prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
layout = LayoutIdTest, }, .attr_list = (AttributeList) { .num_attributes = 1, .attributes = (Attribute[1]) {{ .id = AttributeIdTitle, .cstring = "test 1" }} } }; static TimelineItem title_item2 = { .header = { .id = {0xac, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x3...
cl_assert(memcmp(&item4, &temp, sizeof(TimelineItem)) == 0)
SS) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to set pref '%s' (%"PRIi32")", entry->key, (int32_t)rv); } settings_file_close(&file); } } mutex_unlock(s_mutex); return (rv == S_SUCCESS); } // ------------------------------------------------------------------------------------ // Convenience fu...
{ // If the handler returns false, that means it reset the global back to the default, // so we should write the new value to the backing prefs_private_write_backing(event->key, event->key_len, entry->value, entry->value_len); }
} } // ======================================================================================== // Exported functions used by the firmware to read/change a preference. // IMPORTANT: When implementing the *set* call, be sure to call prv_pref_set(). This does // two things: // 1.) It validates that the stored globa...
k(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_ny_offset_layer"))); } void test_graphics_draw_line__clear(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 60, 60)); layer_set_update_proc(&layer, &inside_layer_update_cal...
gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_odd_rows_no_clip"))
); // Test to make sure drawing on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&...
move, .attr_list = remove_attr_list, } }, }; TimelineItem *item = timeline_item_create_with_attributes(data->timestamp, 0, // duration TimelineItemTypePin, ...
clock_get_time_word(tmp, date_time_len, data->timestamp)
; strncat(data->dialog_text, tmp, buf_space_remaining); } static void prv_handle_dictation_event(PebbleEvent *e, void *context) { ReminderAppData *data = context; const DictationSessionStatus status = e->dictation.result; if (status == DictationSessionStatusSuccess) { if (data->reminder_str) { app_f...
; pstring_project_list_on_serialized_array(&pstring16_list, &entry->pstring16s); pstring_add_pstring16_to_list(&pstring16_list, location_name); pstring_add_pstring16_to_list(&pstring16_list, short_phrase); pstring_destroy_pstring16(location_name); pstring_destroy_pstring16(short_phrase); *size_out = entr...
strlen(s_entry_phrases[index])
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(s_did_send_byte)
; } } void fake_accessory_get_buffer(uint8_t **buffer, int *length) { *buffer = s_buffer; *length = s_buffer_index; }
_ERROR, "Attribute already exists (0x%x,0x%x)", service_id, attribute_id); return false; } SmartstrapAttributeInternal *new_attr = kernel_zalloc(sizeof(SmartstrapAttributeInternal)); if (!new_attr) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to allocate attribute"); return false; } *new_attr = (Smartstra...
{ mutex_lock(s_attr_list_lock); SmartstrapAttributeInternal *attr = prv_find_by_buffer((uint8_t *)app_attr); mutex_unlock(s_attr_list_lock); if (!attr) { return SmartstrapResultInvalidArgs; } else if (!sys_smartstrap_is_service_connected(attr->service_id)) { // go back to idle if we had begun a write ...
DEFINE_SYSCALL(void, sys_smartstrap_attribute_event_processed, SmartstrapAttribute *app_attr) { mutex_lock(s_attr_list_lock); SmartstrapAttributeInternal *attr = prv_find_by_buffer((uint8_t *)app_attr); mutex_unlock(s_attr_list_lock); if (!attr) { // the app might have destroyed the attribute return; ...
t sync with an invalid length: %"PRIu32"", length); return; } struct PACKED StartSyncResponseMsg { BlobDBCommand cmd; BlobDBToken token; BlobDBResponse result; } response = { .cmd = BLOB_DB_COMMAND_START_SYNC_RESPONSE, }; BlobDBId db_id; endpoint_private_read_token_db_id(data, &respons...
(LOG_LEVEL_DEBUG, "WRITEBACK Response")
; prv_handle_wb_response(session, data, data_length); break; case BLOB_DB_COMMAND_SYNC_DONE_RESPONSE: PBL_LOG(LOG_LEVEL_DEBUG, "SYNC DONE Response"); prv_handle_sync_done_response(session, data, data_length); break; default: PBL_LOG(LOG_LEVEL_ERROR, "Invalid BlobDB2 message r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
htonl(fw_metadata->version_timestamp)
cordFunc)(GContext *ctx, int16_t y, int16_t x1, int16_t x2, GColor color); static void prv_mask_record_hline_test_pattern(HorizontalClippingMaskRecordFunc record_func) { GContext *ctx = s_ctx; prv_prepare_canvas_for_hline_recording_test(ctx); graphics_context_se...
{ ctx->draw_state.stroke_color = (GColor) { .argb = (uint8_t)(column_index | 0b11000000) }; graphics_draw_pixel(ctx, GPoint(x, y)); }
} } } static GDrawMask *prv_create_mask_for_hline_applying_test(GContext *ctx) { // The initial transparency doesn't really matter since we're about to overwrite it const bool transparent = false; GDrawMask *mask = graphics_context_mask_create(ctx, transparent); cl_assert(mask); const GSize mask_size...
b_data) { NotificationWindowData *window_data = cb_data; if (type != NotificationReminder) { return; } TimelineItem reminder; if (S_SUCCESS != reminder_db_read_item(&reminder, id)) { return; } timeline_item_free_allocated_buffer(&reminder); TimelineItem item; if (S_SUCCESS != pin_db_get(&re...
dialog_set_fullscreen(dialog, true)
; dialog_set_background_color(dialog, GColorBlueMoon); dialog_set_timeout(dialog, 1700); simple_dialog_push(simple_dialog, prv_get_window_stack()); } static void prv_snooze_reminder_cb(ActionMenu *action_menu, const ActionMenuItem *action_menu_item, ...
6, -176}, { 776, 112, 120}, { 856, 128, 128}, { 880, 96, 176}, { 896, 192, 240}, { 840, 360, 112}, { 776, 312, 64}, { 848, 360, 8}, { 968, 272, 72}, { 1256, 328, 48}, { 1272, 136, 128}, { 1712, 168, 72}, { 1440, 352, 16}, { 920, 232, 48}, { 1056, 136, 64}, { 1...
{ 808, 352, 104}, { 760, 336, 64}, { 784, 296, 56}, { 992, 288, 16}, { 1208, 312, 8}, { 1280, 328, 16}, { 1624, 352, 64}, { 1384, 416, 104}, { 992, 304, 48}, { 1192, 224, 72}, { 1328, 128, 144}, { 1176, 48, 152}, { 976, 24, 120}, { 792, -48, 120}, { 648, -24, ...
{ 656, -48, 136}, { 584, -48, 96}, { 584, -24, 48}, { 712, -8, 32}, { 1000, 48, 0}, { 1392, -136, 104}, { 2160, -296, 480}, { 1656, 536, 56}, { 1104, 880, -344}, { 976, 184, 16}, { 848, -32, 304}, { 880, -64, 336}, { 896, 112, 232}, { 808, 336, 112}, { 792, 3...
%d, %d, %d", (int)data->data0, (int)data->data1, (int)data->data2); text_layer_set_text(text_layer, g_text); } } static void up_click_handler(ClickRecognizerRef recognizer, void *context) { AppWorkerResult result = app_worker_launch(); APP_LOG(APP_LOG_LEVEL_INFO, "launch result: %d", result); } static voi...
(APP_LOG_LEVEL_INFO, "app: New sleep event: total: %"PRIu32", restful: %"PRIu32" ", total_sleep / SECONDS_PER_MINUTE, restful_sleep / SECONDS_PER_MINUTE)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(0, 40, 144, 40)
); text_layer_set_text(&window->text, description.debug_name); layer_add_child(&window->window.layer, &window->text.layer); StatusBarLayer *status_bar = &window->status_bar; status_bar_layer_init(status_bar); if (description.status_bar) { status_bar_layer_set_colors(status_bar, status_bar_color, ...
struct LCPPacket *packet) { // Process nak/rej options // respond with new configure request // TODO: we don't send options, so no nak/rej is expected yet } static void prv_on_configure_nak_or_reject(PPPControlProtocol *this, struct LCPPacket *packet) { if ...
(this, LinkState_Starting)
; } else if (this->state->link_state == LinkState_Closed) { this->state->restart_count = MAX_CONFIGURE; prv_send_configure_request(this); prv_transition_to(this, LinkState_RequestSent); } else if (this->state->link_state == LinkState_Stopping) { prv_transition_to(this, LinkState_Closing); } mute...
erOffsetRawUp = offsetof(ClickConfig, raw.up_handler), ClickHandlerOffsetRawDown = offsetof(ClickConfig, raw.down_handler), } ClickHandlerOffset; static ClickHandler prv_get_handler(ClickRecognizer *recognizer, ClickHandlerOffset offset) { return *((ClickHandler*)(((uint8_t*)&recognizer->config) + offset)); } sta...
{ if (false == prv_is_long_click_enabled(recognizer)) { return 0; } if (recognizer->config.long_click.delay_ms == 0) { return LONG_CLICK_DEFAULT_DELAY_MS; } return recognizer->config.long_click.delay_ms; }
inline static bool prv_can_more_clicks_follow(ClickRecognizer *recognizer) { if (recognizer->number_of_clicks_counted >= prv_multi_click_get_max(recognizer)) { return false; } return true; } uint8_t click_number_of_clicks_counted(ClickRecognizerRef recognizer_ref) { ClickRecognizer *recognizer = (ClickRe...
_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 5); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offs...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 4 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 4); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dr...
ual_i(s_num_timeline_adds, 1); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); // Only 1 pin should be added cl_assert_equal_i(s_num_timeline_adds, 2); // First alarm ...
(s_num_alarms_fired, 2)
; s_current_day = s_wednesday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 3); } void test_alarm__custom_alarm_weekends(void) { AlarmId id1, id2; bool schedule_1[7] = {true, false, false, false, false, false, true}; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALAR...
during the minute handler (see PBL-38130) // Returns distance we traveled in the last minute, in mm. static uint32_t NOINLINE prv_fill_minute_record(time_t utc_sec, AlgMinuteDLSSample *m_rec) { bool still; kalg_minute_stats(s_alg_state->k_state, &m_rec->base.vmc, &m_rec->base.orientation, &still...
prv_unlock()
tionIntent *intent) { // TODO: If the bonding does not contain a valid IRK, perhaps we should use and whitelist the // identity address and treat it as a normal connection intent? // See note in BT spec "Note: An all zero Identity Resolving Key data field indicates that a // device does not have a valid resolva...
kernel_malloc(alloc_size)
; if (!intent) { return BTErrnoNotEnoughResources; } memset(intent, 0, alloc_size); s_intents = (GAPLEConnectionIntent *) list_prepend(&s_intents->node, &intent->node); if (request->is_bonding_based) { // Create bonding info cache i...
(ahb1_periphs, DISABLE)
; const uint32_t ahb2_periphs = 0 | RCC_AHB2Periph_DCMI | RCC_AHB2Periph_CRYP | RCC_AHB2Periph_HASH | RCC_AHB2Periph_RNG | RCC_AHB2Periph_OTG_FS; RCC_AHB2PeriphResetCmd(ahb2_periphs, ENABLE); RCC_AHB2PeriphResetCmd(ahb2_periphs, DISABLE); const uint32_t ahb3_periphs = 0 | RCC_AHB3Peri...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG_SYNC(LOG_LEVEL_WARNING, "Task <%s> stuck: LR: %p PC: %p", pebble_task_get_name(task), current_lr, current_pc)
; reboot_reason->watchdog.stuck_task_pc = (uint32_t)current_pc; reboot_reason->watchdog.stuck_task_lr = (uint32_t)current_lr; } static void prv_log_failed_message(RebootReason *reboot_reason) { PBL_LOG_SYNC(LOG_LEVEL_WARNING, "Watchdog feed failed, last feed %dms ago, current status 0x%"PRIx16" mask 0x%"PR...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, false)
; graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(-10, 2, 18, 4), 4, GCornersAll); } void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rec...
y strings into the buffer return prv_deep_copy_attribute(dest, src, buffer, buffer_end); } bool attribute_list_copy(AttributeList *out, const AttributeList *in, uint8_t *buffer, uint8_t *const buffer_end) { out->num_attributes = in->num_attributes; uint8_t *write_ptr = buffer; out->att...
{ for (int i = 0; i < num_attributes; i++) { SerializedAttributeHeader *attrib_hdr = (SerializedAttributeHeader *)cursor; cursor += sizeof(SerializedAttributeHeader); switch (prv_attribute_type(attrib_hdr->id)) { case AttributeTypeString: // variable-length break; case Attribut...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
connection_get_address(connection, &subscription.device)
; hc_endpoint_hrm_update_subscription(&subscription); } void hrm_service_register(uint16_t start_hdl) { if (!s_is_hrm_enabled) { // Set all handlers to NULL, so the ble_service dispatcher won't ever try to call us: s_hrs.svc = (const ble_service_t) {}; return; } const hrs_body_sensor_location_t se...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const char *src = src_ptr; char *dst = dst_ptr; uint8_t code = 0x01; size_t code_idx = 0; size_t dst_idx = 1; for (size_t src_idx = 0; src_idx < length; ++src_idx) { if (src[src_idx] == '\0') { dst[code_idx] = code; code_idx = dst_idx++; code = 0x01; } else { dst[dst_idx++...
f(cccd_value)); bool is_subscribed = (cccd_value & GATT_CCC_NOTIFICATIONS); Connection *connection = connection_by_idx_check(evt->conn_idx); uint16_t value_handle; if (evt->handle == s_pps_ctx.att_hdl.conn_status_cccd) { connection_set_subscribed_to_connection_status_notifications(connection, is_subscribed)...
{ if (length < sizeof(PebblePairingServiceRemoteDesiredState)) { return ATT_ERROR_INVALID_VALUE_LENGTH; } if (desired_state->state >= NumResponseTimeState) { return (att_error_t)PebblePairingServiceGATTError_ConnParamsInvalidRemoteDesiredState; } return ATT_ERROR_OK; }
static att_error_t prv_handle_ple_update_request( uint16_t conn_idx, const PebblePairingServicePacketLengthExtension *ple_req, size_t length) { if (length < sizeof(PebblePairingServicePacketLengthExtension)) { return ATT_ERROR_INVALID_VALUE_LENGTH; } #if !SUPPORTS_PACKET_LENGTH_EXTENSION return ((att_e...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_inside_origin_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 12), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 23), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 13), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 24), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_N...
notification prv_feed_deep_sleep_min(30); prv_test_end(context, passed); } // ------------------------------------------------------------------------------- static void prv_test_sleep(void *context) { bool passed = true; int32_t value; // Reset all stored data activity_test_reset(true /*reset_settings...
(LOG_LEVEL_DEBUG, "Start sleep: %d", (int)start_sleep_time)
; prv_feed_light_sleep_min(80); prv_feed_steps_min(2); prv_feed_light_sleep_min(1); // Shift UTC time back by 75 days rtc_set_time(rtc_get_time() - 75 * SECONDS_PER_DAY - 6 * SECONDS_PER_HOUR); // Sleep a little more prv_feed_light_sleep_min(10); // Restore time to just after we started sleeping befo...
a *= -1; } y_offset += delta; } GRect rect = GRect(current_x_offset, y_offset, selection_layer->cell_widths[i], height); graphics_draw_text(ctx, text, selection_layer->font, rect, GTextOverflowModeFill, GTextAlignmentCenter, NULL); } } // Update the...
animation_set_handlers(animation, anim_handler, selection_layer)
2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS"...
PBL_IF_BW_ELSE(85, 83)
, 88); graphics_context_set_text_color(ctx, CURRENT_TEXT_COLOR); graphics_draw_text(ctx, buffer, font, GRect(0, y, base_layer->bounds.size.w, 35), GTextOverflowModeFill, GTextAlignmentCenter, NULL); } static void prv_render_typical_steps(GContext *ctx, Layer *base_layer) {...
return; } const uint16_t next_value_length = gatt_client_subscriptions_consume_notification(&header.characteristic, buffer, &header.value_length, GAPLEClientKernel, &has_more); ...
(LOG_LEVEL_DEBUG, "Disconnected from Gateway!")
; ppogatt_destroy(); ams_destroy(); ancs_destroy(); app_launch_handle_disconnection(); gap_le_slave_reconnect_start(); gatt_client_op_cleanup(GAPLEClientKernel); } } // ------------------------------------------------------------------------------------------------- void kernel_le_client_hand...
ed_value = LOOPS; settings_file_each(&file, prv_each_check_all_values, (void *)&desired_value); } void test_settings_file__manual_compaction_increment(void) { printf("\nTesting manual file compaction...\n"); const bool manual_compaction = true; prv_test_settings_file_compaction(manual_compaction); } void test...
memcpy(key, "k255", 5)
vision for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; kino_player_play(test_player); animation_set_elapsed(test_player->animation, 1234); // intentionally bad value prv_play_animation_update(test_player->animation, ANIMATION_NORMALIZED_MAX * 20 / 300);...
(kino_reel_get_elapsed(test_reel), 20)
; } void test_kino_player__create_infinite_animation_finite_reel_forward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; Animation *animation = (Animation *)kino_player_create_play_animation(tes...
invalid(app_smartstrap_attribute_begin_write(NULL, &buffer, NULL)); assert_result_invalid(app_smartstrap_attribute_begin_write(NULL, NULL, &buffer_len)); assert_result_invalid(app_smartstrap_attribute_begin_write(NULL, &buffer, &buffer_len)); assert_result_invalid(app_smartstrap_attribute_begin_write(attr, NULL, ...
(PebbleTask_App)
e old implementation really did them either. fmt++; } // Helper macros to make goto stuff look cleaner #define FMT_STRCOPY(V) do { \ i18nstr = NULL; \ cpystr = V; \ goto _fmt_strcopy; \ } while (0) #define FMT_STRCOPY_I18N(V) do { \ i18nstr = V; \ goto _fmt_strcopy; \ } while (0) #define FMT_INTCO...
FMT_INTCOPY(t->tm_min, 2, INTFMT_PADZERO)
; break; case 'r': // SU FMT_RECURSE_I18N(time_locale->r_fmt); break; case 'p': if (t->tm_hour < 12) { FMT_STRCOPY_I18N(time_locale->am_pm_upcase[0]); } else { FMT_STRCOPY_I18N(time_locale->am_pm_upcase[1]); } break; case 'P':...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GPoint(5, 35)
, GPoint(45, 40)); } void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void across_x_layer_update_...
result = prv_set_mon_config_register(register_value); // Need to wait a short period of time for the reading to settle due to capacitance on the line. delay_us(200); return result; } bool pmic_enable_battery_measure(void) { prv_mon_config_lock(); return prv_set_mon_config(&MON_CONFIG[PMIC_MON_CONFIG_VBAT_...
{ bool is_connected = pmic_is_usb_connected(); PBL_LOG(LOG_LEVEL_DEBUG, "Got PMIC debounced interrupt, plugged?: %s bounces: %u", is_connected ? "YES" : "NO", s_interrupt_bounce_count); s_interrupt_bounce_count = 0; if (is_connected) { // Configure our charging parameters when the charging cable...
static void prv_handle_pmic_interrupt(void *data) { prv_clear_any_pending_interrupts(); ++s_interrupt_bounce_count; new_timer_start(s_debounce_usb_conn_timer, USB_CONN_DEBOUNCE_MS, prv_debounce_callback, NULL, 0 /*flags*/); } sta...
aw_horizontal_line_dotted(&ctx, GPoint(6, 12), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 23), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 13), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 24), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 13), 10)
prv_weather_data_list_node_comparator, ascending); iterator_context->count++; } static bool prv_get_default_location_key(WeatherDBKey *key_out) { SerializedWeatherAppPrefs *prefs = watch_app_prefs_get_weather(); if (!prefs) { PBL_LO...
mutex_create()
; static EventServiceInfo s_blobdb_event_info = { .type = PEBBLE_BLOBDB_EVENT, .handler = prv_blobdb_event_handler, }; prv_update_default_location_cache(); event_service_client_subscribe(&s_blobdb_event_info); } WeatherDataListNode *weather_service_locations_list_create(size_t *count_out) { Weather...
_out, sizeof(*value_length_in_out)); syscall_assert_userspace_buffer(value_out, *value_length_in_out); syscall_assert_userspace_buffer(has_more_out, sizeof(*has_more_out)); } return gatt_client_subscriptions_consume_notification(object_ref_out, value_...
if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(uuid, sizeof(*uuid)); }
*uuid = gatt_client_characteristic_get_uuid(characteristic); } DEFINE_SYSCALL(BLEAttributeProperty, sys_ble_characteristic_get_properties, BLECharacteristic characteristic) { return gatt_client_characteristic_get_properties(characteristic); } DEFINE_SYSCALL(BLEService, sys_bl...
PBL_ASSERTN(state->test_entry.name[0] != 0); int steps = 0; int orientation = 0; int vmc = 0; int light = 0; int plugged_in = 0; if (state->test_entry.version == 1) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d", &steps, &orientation, &vmc); } else if (state->test_...
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.min)
; } else if (strcmp(token, "TEST_START_AT_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.max); } else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at); } else if (strc...
tem == NULL) { return NULL; } if (!prv_item_init(item, num_attributes, num_actions, attributes_per_action, required_size_for_strings, string_buffer)) { task_free(item); return NULL; } return item; } TimelineItem *timeline_item_copy(TimelineItem *src) { if (!src) { return NULL; } ...
PBL_ASSERTN(payload != NULL)
; uint8_t *buf_end = (uint8_t *)string_buffer + string_buffer_size; return attributes_actions_deserialize(&item->attr_list, &item->action_group, (uint8_t*) string_buffer, buf_end, payload, payload_size); } void timeline_item_destroy(TimelineItem* item) { if (item != NULL...
NULL)) { // check if system task is ready to go or is already running a callback. // If it's ready to run, we definitely want to throttle the app task. // Or, if it's blocked in a callback, there's a chance it could be waiting for a mutex held by // the background worker and the worker won't be able to ...
(TIME_PERIOD <= UINT16_MAX && prescaler <= UINT16_MAX)
; tim_config.TIM_Period = TIME_PERIOD; tim_config.TIM_Prescaler = prescaler; tim_config.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM2, &tim_config); TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE); TIM_Cmd(TIM2, ENABLE); // Setup another unused interrupt vector to handle our low priority interr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
notif_db_insert((uint8_t *)&hdr1, UUID_SIZE, (uint8_t *)&hdr1, sizeof(hdr1))
, 0); cl_assert_equal_i(notif_db_insert((uint8_t *)&hdr2, UUID_SIZE, (uint8_t *)&hdr2, sizeof(hdr2)), 0); cl_assert_equal_i(notif_db_insert((uint8_t *)&hdr3, UUID_SIZE, (uint8_t *)&hdr3, sizeof(hdr3)), 0); cl_assert_equal_i(notif_db_flush(), 0); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(n...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ ISCTYPE_TEST(isprint) }
comm/ble/kernel_le_client/ancs/ancs_util.h" #include "comm/ble/kernel_le_client/ancs/ancs_types.h" // Test Data /////////////////////////////////////////////////////////// #include "test_data.h" // Stubs /////////////////////////////////////////////////////////// #include "stubs_common.h" #include "stubs_blob_db_sy...
{ prv_support_sms_replies(); ANCSAttribute *notif_attributes[NUM_FETCHED_NOTIF_ATTRIBUTES] = {0}; ANCSAttribute *app_attrs[NUM_FETCHED_APP_ATTRIBUTES] = {0}; const size_t header_len = sizeof(GetNotificationAttributesMsg); bool error = false; const bool complete = ancs_util_get_attr_ptrs(s_sms_ancs_data + ...
TimelineItemAction *response_action = &notif->action_group.actions[1]; cl_assert_equal_i(response_action->type, TimelineItemActionTypeAncsResponse); cl_assert_equal_i(response_action->attr_list.num_attributes, 2); cl_assert_equal_i(response_action->attr_list.attributes[0].id, AttributeIdTitle); cl_assert_equ...
BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "pebble.h" #include <stdlib.h> static Window *window; static TextLayer *s_text_layer_a; static TextLayer *s_text_la...
animation_set_curve((Animation*) a, AnimationCurveEaseOut)
; animation_set_curve((Animation*) a_rev, AnimationCurveEaseOut); break; case BUTTON_ID_DOWN: animation_set_curve((Animation*) a, AnimationCurveEaseIn); animation_set_curve((Animation*) a_rev, AnimationCurveEaseIn); break; default: case BUTTON_ID_SELECT: animation_set_c...
"applib/ui/dialogs/actionable_dialog.h" #include "applib/ui/dialogs/dialog.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/vibes.h" #include "applib/ui/window_manager.h" #include "applib/ui/window_stack.h" #include "drivers/rtc.h" #include "kernel/ev...
(msg, prv_toggle_manual_dnd_from_settings_menu)
; } } static void prv_try_update_schedule_mode(void *data) { const bool clear_override = (bool) (uintptr_t) data; if (clear_override) { s_data.manually_override_dnd = false; } if (do_not_disturb_is_schedule_enabled(WeekdaySchedule) || do_not_disturb_is_schedule_enabled(WeekendSchedule)) { prv_...
(7, 13), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 24), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_no_clip"))); // Even rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); graph...
(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_no_clip"))
); // Even rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_COLS); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 2), MAX_NUM_COLS + 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_init(&data->box, &scroll_bounds)
{ -40, 408, 880}, { -168, 400, 976}, { -224, 352, 928}, { -240, 328, 824}, { -280, 312, 856}, { -256, 272, 832}, { -320, 272, 656}, { -312, 408, 648}, { -312, 488, 512}, { -352, 552, 760}, { -312, 472, 856}, { -336, 360, 816}, { -296, 248, 760}, { -328, 440, 816}, ...
{ 208, 952, -112}, { 248, 952, -136}, { 264, 936, -200}, { 208, 1248, -376}, { 224, 1096, -280}, { 224, 912, -248}, { 272, 816, -272}, // 76 seconds { 280, 784, -264}, { 560, 920, -264}, { 832, 1232, -32}, { 600, 1056, -64}, { 144, 840, 0}, { -216, 368, -48}, ...
{ 448, 760, -176}, { 448, 816, -176}, { 448, 856, -144}, { 448, 848, -96}, { 440, 800, -136}, { 480, 736, -192}, { 464, 768, -40}, { 488, 784, -88}, { 512, 736, -200}, { 464, 768, -136}, { 496, 704, -88}, { 448, 696, -56}, { 448, 832, -56}, // 79 seconds { 44...
activity_algorithm_enable_activity_tracking(false /* disable */); PBL_LOG(LOG_LEVEL_INFO, "Starting a workout with type: %d", type); prv_put_event(PebbleWorkoutEvent_Started); } unlock: prv_unlock(); return rv; } // ---------------------------------------------------------------------------------------...
if (!workout_service_is_workout_type_supported(session->type)) { rv = false; goto unlock; }
ActivitySession session_copy = *session; // Remove the session from out list of sessions so it doesn't get counted twice activity_sessions_prv_delete_activity_session(session); // Start a new workout if (!workout_service_start_workout(session_copy.type)) { rv = false; goto unlock; ...
the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "dbgserial.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #...
MAX_SIZE_AFTER_COBS_ENCODING(raw_length)
]; size_t cooked_length = cobs_encode(cooked_packet, raw_packet, raw_length); prv_putchar(FRAME_DELIMITER); for (size_t i = 0; i < cooked_length; ++i) { if (cooked_packet[i] == FRAME_DELIMITER) { prv_putchar('\0'); } else { prv_putchar(cooked_packet[i]); } } prv_putchar(FRAME_DELIMITE...
t entry ResTableEntry res_entry = {0}; if (!prv_read_res_table_entry(&res_entry, entry, manifest->num_resources - 1)) { return 0; } // Get the full ending offset of the last resource. uint32_t resource_end_offset = res_entry.offset + res_entry.length; // Add the store's metadata size to the end address ...
prv_get_store_entry(app_num, resource_id, &entry)
l_assert_equal_i(s_path_fill_count, 2); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert_equal_i(s_circle_fill_count, 1); prv_reset(); gdraw_command_list_get_command(command_list, 2)->hidden = true; gdraw_command_list_draw(ctx, command_list); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert_equ...
gdraw_command_list_get_command(command_list, 0)
; *command = (GDrawCommand) { .type = GDrawCommandTypePath, .hidden = false, .stroke_color = GColorRed, .stroke_width = 1, .fill_color = GColorBlue, .path_open = true, .num_points = 2, }; GPoint points[] = {{ 6, 1 }, {5, -5} }; memcpy(command_list->commands[0].points, points, sizeof(...
ion; PBL_ASSERTN(session); size_t bytes_remaining = comm_session_send_queue_get_length(session); size_t mss = pulse_reliable_max_send_size() - sizeof(PulsePPPacket); while (bytes_remaining) { bt_unlock(); PulsePPPacket *resp = (PulsePPPacket*) pulse_reliable_send_begin(PULSE2_PEBBLE_PROTOCOL); bt_...
if (send_event) { PebbleEvent e = { .type = PEBBLE_BT_CONNECTION_EVENT, .bluetooth = { .connection = { .state = (s_transport.session) ? PebbleBluetoothConnectionEventStateConnected : PebbleBluetoothConnectionEventStateDisconnected } } }; event_put(&e); ...
+i) { s_receive_buffers[i] = kernel_malloc_check(sizeof(IncomingPulseFrame)); prv_return_receive_buffer(s_receive_buffers[i]); } s_current_receive_buffer = prv_take_receive_buffer(); s_drop_rest_of_frame = false; s_keepalive_timer = new_timer_create(); PBL_ASSERTN(s_keepalive_timer != TIMER_INVALID_I...
if (!cobs_streaming_decode(&s_frame_decode_ctx, c)) { s_drop_rest_of_frame = true; }
} } void *pulse_best_effort_send_begin(const uint8_t protocol) { mutex_lock(s_tx_buffer_mutex); s_tx_buffer[COBS_OVERHEAD(PULSE_MAX_SEND_SIZE)] = protocol; // Expose only the payload of the message return s_tx_buffer + COBS_OVERHEAD(PULSE_MAX_SEND_SIZE) + 1; } void pulse_best_effort_send(void *buf, const ...
se"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITH...
(inset_amount - 1, MIN(outer_point.y, frame->size.h - inset_amount))
ontal_line_dotted(&ctx, GPoint(0, 7), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 9), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 13), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20); graphics_draw_horizo...
GPoint(0, 11)
, 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 13), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 19), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, ...
n_resp_data_length; while (cursor < end) { const BLEAdElement *elem = (const BLEAdElement *) cursor; if (elem->header.length == 0) { // We've hit a padding zero. We should be done, or this packet is corrupt. return; } if (cursor + elem->header.length + 1 /* +1 length byte */ > end) { ...
{ struct TxPowerLevelCtx *ctx = (struct TxPowerLevelCtx *)cb_data; *ctx->tx_power_level_out = tx_power_level; ctx->included = true; return false; // stop parsing }
bool ble_ad_get_tx_power_level(const BLEAdData *ad, int8_t *tx_power_level_out) { struct TxPowerLevelCtx ctx = { .tx_power_level_out = tx_power_level_out, .included = false, }; const BLEAdParseCallbacks callbacks = { .tx_power_level_cb = tx_power_level_cb, }; ble_a...
t i = 0; i < 30; i++) { HealthValue value = health_service_sum(metric, day_start, day_start + SECONDS_PER_DAY); APP_LOG(APP_LOG_LEVEL_DEBUG, "%d: %d", i, (int)value); char temp[32]; snprintf(temp, sizeof(temp), "\n%d: %d", i, (int)value); prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(da...
snprintf(data->sleep_card.text, sizeof(data->sleep_card.text), "Zzz..\ntotal: %s\ndeep: %s\nenter: %s\nexit: %s", total_sleep_str, deep_sleep_str, bed_time_str, wake_time_str)
; text_layer_set_text(data->sleep_card.text_layer, data->sleep_card.text); } // ------------------------------------------------------------------------------- static void sleep_window_load(Window *window) { HealthAPITestAppData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(w...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(MHZ_TO_HZ(360), I2CBusMode_Standard, KHZ_TO_HZ(100), 0, 0)
, 8, 240, 209, 12); } void test_i2c_timingr__valid_no_prescaler_rise_fall_time(void) { // We'll use a base clock speed of 20MHz and try to get to 100kHz I2C with fall and rise times of // 500ns each. // // 20MHz / 100kHz = 200 cycles => 200 - 6 sync cycles - (2 * 500ns / (1 / 20MHz)) = 174 c...
l_i(event.put_bytes.progress_percent, 0); cl_assert_equal_b(event.put_bytes.failed, false); } void test_put_bytes__init_while_already_busy(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); assert_nack_count(1); } void test_put_bytes__init_too_lar...
(payload_size)
+ 1 /* one off! */, }; memcpy(&put_msg->payload[0], chunk, payload_size); prv_receive_data(s_session, buffer, sizeof(buffer)); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__invalid_session_cookie(void) { prv_receive_init_fw_object(); prv_process_and_reset_test_counters(); const u...
a.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_offset_layer_aa.${BIT_DEP...
graphics_line_draw_precise_stroked_aa(&ctx, CLOSE_POINTS_LESS_THAN_1PX_START, CLOSE_POINTS_LESS_THAN_1PX_END, 10)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_close_points_less_than_1px_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, CLOSE_POINTS_AROUND_1PX_START, CLOSE_POINTS_AROUND_1PX_END, 10); c...
rv_prepare_row(ctx, menu_layer, cell_layer, highlight); const GRect prev_bounds = cell_layer->bounds; // in theory, we could decrement the origin by cell_content_origin_offset_y after the call // in practice once shouldn't trust the draw_row implementation const int16_t draw_box_origin_y = ctx->draw_state.draw...
if (is_header_in_frame) { // Draw section header: prv_menu_layer_draw_section_header(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx); // Draw the separator on top of the cell: if (top_diff >= it->it.cursor.sep) { prv_menu_layer_draw_separator(it->it.menu_layer, &it->cell_layer, &it->i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(tag, item_type, item_size, buffer, resume)
; } DEFINE_SYSCALL(void, sys_data_logging_finish, DataLoggingSessionRef session_ref) { // TODO: It would be nice to verify the session itself, because they could be // passing us any memory address (not necesarilly a valid DataLoggingSession). // An evil developer could potentially use this to confuse the data_l...
0x00, // AppGlanceSliceType - AppGlanceSliceType_IconAndSubtitle 0x01, // Number of attributes // Slice Attributes 0x25, // Attribute ID - AttributeIdTimestamp 0x04, 0x00, // Attribute Length // Slice expiration time: 0x96, 0x64, 0x4F...
{ // Call the basic glance blob insert test to insert the basic glance blob test_app_glance_db__basic_glance_blob_insert_and_read(); const size_t glance_size = sizeof(s_app_glance_basic); uint8_t glance_out[glance_size]; // Trying to read the basic glance blob back with an invalid key length should fail c...
void test_app_glance_db__basic_glance_blob_delete(void) { // Call the basic glance blob insert test to insert the basic glance blob test_app_glance_db__basic_glance_blob_insert_and_read(); // Delete the basic glance blob cl_assert_equal_i(app_glance_db_delete((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE), ...
touch_handle_update(1, TouchState_FingerDown, &GPoint(55, 55), 2, 3686480)
; touch_handle_update(1, TouchState_FingerDown, &GPoint(33, 33), 7, 3686500); touch_handle_driver_event(TouchDriverEvent_ControllerError); PebbleEvent event = fake_event_get_last(); // Touches cancelled event generated cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, P...
T must be greater than ACTIVE_MODE_START_BUFFER"); typedef struct { AudioEndpointSessionId id; AudioEndpointSetupCompleteCallback setup_completed; AudioEndpointStopTransferCallback stop_transfer; TimerID active_mode_trigger; } AudioEndpointSession; static AudioEndpointSessionId s_session_id = AUDIO_ENDPOINT_S...
comm_session_send_buffer_begin_write(comm_session, AUDIO_ENDPOINT, sizeof(DataTransferMsg) + frame_size + 1, 0 /* timeout_ms, never block */)
_node->overflow, overflow_mode); cl_assert_equal_p(text_node->alignment, alignment); TextLayoutExtended *layout = (TextLayoutExtended *)layout_ref; cl_assert_equal_p(text_node->line_spacing_delta, layout->line_spacing_delta); layout->max_used_size = s_data.max_used_size; } GSize graphics_text_layout_get_max_...
graphics_text_node_create_horizontal(0)
; cl_assert_equal_i(h_empty->container.max_nodes, 0); cl_assert_equal_p(NULL, h_empty->container.nodes); GTextNodeHorizontal *h_nodes = graphics_text_node_create_horizontal(3); cl_assert_equal_i(h_nodes->container.max_nodes, 3); cl_assert_equal_p(h_nodes + 1, (void *)h_nodes->container.nodes); GTextNodeVe...
{ return; } GDrawState graphics_context_get_drawing_state(GContext* ctx) { GDrawState state; memset(&state, 0, sizeof(GDrawState)); return state; } void graphics_context_set_drawing_state(GContext* ctx, GDrawState draw_state) { return; } bool compositor_is_animating(void) { return false; } void *composi...
(window->parent_window_stack, new_window, true)
; } static void prv_pop_window_load(Window *window) { prv_window_load(window); cl_check(window->parent_window_stack); cl_assert_equal_i(window->on_screen, true); cl_assert_equal_i(window->is_loaded, false); window_stack_pop(window->parent_window_stack, true); } static void prv_push_window_unload(Window *w...
A255SampleInterval_250HZ; break; default: WTF; } return sample_interval; } //! Set the LOW_POWER and LPW registers as required. //! The LPW register is masked because it contains the sleep duration for our desired ODR. static void prv_enter_power_mode(BMA255PowerMode mode) { bma255_write_register...
(interval_us)
; // FIXME: For now, tie us to 125Hz. 125Hz is a rate that is easy enough to // subsample to all of our supported accel service rates, and also cuts down power consumption // from the 140uA range to 100uA. // Being able to sample at a lower rate like 38Hz will be able to get us down into the 40uA range. // ...
28, 20), 4); } void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(16, 2, 28, 20), 4); } void across_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi"))
; layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&la...
t_offset; } if (test_addr >= FLASH_TEST_ADDR_END) { PBL_LOG(LOG_LEVEL_DEBUG, "Skipping test address 0x%"PRIx32" which is out of range", test_addr); break; } // If test_pattern was written over the data_pattern, then return data should be 0 since // data cannot transitio...
for (test_offset = 1, bitpos=0; test_offset & addr_mask; test_offset <<= 1, bitpos++) { if (test_offset >= base_addr) { test_addr = test_offset; } else { test_addr = base_addr + test_offset; } if (test_addr >= FLASH_TEST_ADDR_END) { break; } // Skip base address if (test...
if (bit_offset >= base_addr) { test_addr2 = bit_offset; } else { test_addr2 = base_addr + bit_offset; } if (test_addr2 >= FLASH_TEST_ADDR_END) { break; } status = prv_read_verify_byte(test_addr2, data_pattern, FLASH_TEST_ERR_STUCK_AT_LOW, bitpos2, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_flush_addr, 0x1F)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kernel_ui_get_graphics_context()
; } } ContentIndicatorsBuffer *kernel_ui_get_content_indicators_buffer(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); return &s_kernel_content_indicators_buffer; } ContentIndicatorsBuffer *content_indicator_get_current_buffer(void) { if (pebble_task_get_current() == PebbleTask_App) { return app_state_ge...
nd_send_result_event(data, DictationSessionStatusSuccess); } break; } default: WTF; } } // This function gets the next state to transition to and whether that transition should be deferred // until the current animation is complete. static VoiceUiState prv_get_next_state(VoiceUiState curren...
(data, true /* fly in */)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&BOARD_CONFIG_BACKLIGHT.pwm, TIMER_PERIOD_RESOLUTION, TIMER_PERIOD_RESOLUTION * PWM_OUTPUT_FREQUENCY_HZ)
_t minute; // 1 entry per week day. True if the alarm should go off on that week day. Sunday = 0. bool scheduled_days[DAYS_PER_WEEK]; //! v3.12 alarm fields, compiled in even for unhealthy platforms to simplify compatibility union { //! These flags have the same value in memory and in flash. struct { ...
if (s_smart_snooze_counter >= SMART_ALARM_MAX_SMART_SNOOZE) { // The smart alarm has reached the end of its time range return true; }
const int sleep_seconds = prv_get_sleep_seconds(); switch (prv_get_sleep_state()) { case ActivitySleepStateUnknown: case ActivitySleepStateAwake: // The user is awake, just trigger return true; case ActivitySleepStateLightSleep: case ActivitySleepStateRestfulSleep: // The user is ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ *max_used_id = field->id; }
return false; } static int get_next_id() { int max_used_id = -1; search_map(walk_max_used_id, &max_used_id); return (max_used_id + 1); } // grows the size of the pmap file to the new_size specified static status_t enlarge_pmap_file(int *fd, size_t new_size) { const size_t hunk_size = 256; uint8_t *buf = ...
IZE]; // Setup //////////////////////////////////////////////////////////////// void test_watch_app_prefs_db__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); watch_app_prefs_db_init(); // Set up our test prefs with some random data SerializedSendTextPrefs *prefs = (SerializedSendText...
(watch_app_prefs_db_get_len(WEATHER_KEY, WEATHER_KEY_LEN), 0)
; } void test_watch_app_prefs_db__flush(void) { cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, sizeof(s_send_text_prefs)), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_insert(WEATHER_KEY, WEATHER_KEY_LEN, s_weather_...
; prv_transition_to_accepting(outbox); } //! Use sys_current_process_schedule_callback to maximize the stack space available to the //! app's failed_callback. static void prv_handle_outbox_error_async(AppMessageResult result) { sys_current_process_schedule_callback(prv_handle_outbox_error_cb, (void *)(uintptr_t)re...
{ PBL_LOG(LOG_LEVEL_ERROR, "Must call app_message_open() before calling app_message_outbox_begin()!"); return APP_MSG_INVALID_STATE; }
// Reset the send state (dictionary, counters, etc.) // We do this here, as this function is only called when we begin a new outbox, // so the state should always be clean when we return successfully. prv_outbox_prepare(outbox); *iterator = &outbox->iterator; outbox->phase = OUT_WRITING; outbox->result ...
t orientation = 0; int vmc = 0; int light = 0; int plugged_in = 0; if (state->test_entry.version == 1) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d", &steps, &orientation, &vmc); } else if (state->test_entry.version == 2) { sscanf(token + strlen(token) + 1, "%d, 0x%x, ...
(token, "TEST_START_AT_MAX")
== 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.max); } else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at); } else if (strcmp(token, "TEST_WEIGHT") == 0) { sscanf(token...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(list_get_tail(node), new_node)
; } ListNode* list_prepend(ListNode* node, ListNode* new_node) { return list_insert_before(list_get_head(node), new_node); } ListNode* list_get_next(ListNode* node) { if (node == NULL) { return NULL; } return node->next; } ListNode* list_get_prev(ListNode* node) { if (node == NULL) { return NULL; ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ memset(&cksum, 0xcc, sizeof cksum); legacy_defective_checksum_init(&cksum); }
ar_func *test, const struct clar_suite *suite) { _clar.suite_errors = 0; _clar.active_suite = suite->name; _clar.active_test = test->name; clar_run_test(test, &suite->initialize, &suite->cleanup); } #endif static void clar_usage(const char *arg) { printf("Usage: %s [options]\n\n", arg); printf("Options:...
(" %s\n", suite->tests[i].name)
; } } printf("\n"); exit(0); } default: clar_usage(argv[0]); } } } static int clar_test(int argc, char **argv) { clar_print_init( (int)_clar_callback_count, (int)_clar_suite_count, "" ); if (clar_sandbox() < 0) { clar_print_onabort("Failed to sandb...
in_1, }, }; static const VoltageMonitorDevice VOLTAGE_MONITOR_TEMPERATURE_DEVICE = { .adc = ADC1, .adc_channel = ADC_Channel_TempSensor, .clock_ctrl = RCC_APB2Periph_ADC1, // .input not applicable }; VoltageMonitorDevice * const VOLTAGE_MONITOR_ALS = &VOLTAGE_MONITOR_ALS_DEVICE; VoltageMonitorDevice * const...
voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY)
nizerState_Started)); r->state = RecognizerState_Possible; cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); recognizer_transit...
cl_assert_passert(recognizer_set_failed(r))
; } static void prv_sub_destroy(const Recognizer *r) { bool *destroyed = recognizer_get_user_data(r); *destroyed = true; } void test_recognizer__destroy(void) { bool impl_destroyed = false; s_test_impl_data.destroyed = &impl_destroyed; bool sub_destroyed = false; Recognizer *r = test_recognizer_create(&s...
gnmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(window_layer, text_layer_get_layer(&data->info_text)); } static void prv_kcc_window_unload(Window *window) { SystemCertificationData *data = (SystemCertificationData *) window_get_user_data(window); prv_deinit_sta...
{ launcher_task_add_callback(prv_shutdown_cb, 0); }
break; case SystemMenuItemFactoryReset: settings_factory_reset_window_push(); break; default: WTF; } settings_menu_reload_data(SettingsMenuItemSystem); } static uint16_t prv_num_rows_cb(SettingsCallbacks *context) { return SystemMenuItem_Count; } static Window *prv_init(void) { ...
accel_data = hrm_manager_get_accel_data(); const uint8_t num_samples = accel_data->num_samples; prv_write_register(HRM, ADDR_NUM_ACCEL_SAMPLES, num_samples); for (uint32_t i = 0; i < num_samples; ++i) { prv_write_accel_sample(HRM, i + 1, &accel_data->data[i]); } data.accel_data = *accel_data; hrm_manage...
(dev, ADDR_APP_IDS, &running_apps)
) { return false; } PBL_LOG(LOG_LEVEL_DEBUG, "Apps running: 0x%"PRIx8, running_apps); if (app == AS7000AppId_Idle) { // no apps should be running return running_apps == AS7000AppId_Idle; } return running_apps & app; } //! Set the applications that should be running on the HRM. //! //! This comman...
; } bool flash_is_enabled(void) { return (s_flash_state.enabled); } void flash_init(void) { if (s_flash_state.mutex != 0) { return; // Already initialized. } s_flash_state.mutex = mutex_create(); vSemaphoreCreateBinary(s_flash_state.dma_semaphore); flash_lock(); enable_flash_spi_clock(); flash_...
(PowerSystemFlashErase)
; enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_ERASE_SUBSECTOR); flash_send_24b_address(subsector_addr); flash_end_cmd(); flash_wait_for_write(); prv_check_protection_flag(); disable_flash_spi_clock(); ...
0, 112, 232}, { -888, 120, 208}, { -992, 48, 296}, { -928, -312, 328}, { -1056, -384, 248}, { -1264, 272, -8}, { -1424, 312, 16}, { -1456, 232, 72}, { -1464, 64, 240}, { -1424, 200, 264}, { -1296, 416, 408}, { -1080, 472, 432}, { -1056, 304, 384}, { -1112, 312, 328}, ...
{ -1040, 320, -552}, { -1112, 136, -152}, { -1056, -40, -64}, { -984, -24, -80}, { -888, 40, -32}, { -816, 88, -104}, { -864, 216, -96}, { -856, 224, -88}, { -864, 376, -40}, // 104 seconds { -1320, 520, 280}, { -1576, 1032, 280}, { -960, 1000, 296}, { -656, 1000,...
{ -440, 712, 648}, { -256, 1008, 464}, { -104, 1016, 568}, { 88, 1368, 848}, { 216, 1600, 568}, { 48, 1664, 192}, { 88, 1296, 128}, { 40, 856, 400}, { 0, 672, 360}, { -48, 616, 312}, { -48, 496, 312}, { 56, 336, 328}, { 232, 352, 304}, { 280, 488, 400}, { 232...
canf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc, &light, &plugged_in); } else { cl_assert(false); } fflush(stdout); PBL_ASSERTN(state->test_entry.num_samples < SLEEP_SAMPLES_DISCOVERY_MAX_SAMPLES); state->samples[state->test_entry....
{ *entry = state->test_entry; return true; }
else { // No more in this file fclose(state->common.file); state->common.file = NULL; } } } // --------------------------------------------------------------------------------------- // Return info on the next set of samples static bool prv_activity_sample_discovery_next(ActivityFileTestEntry...
= 0x09, PmicRegisters_GPIO2_CNTL = 0x0a, PmicRegisters_GPIO3_CNTL = 0x0b, PmicRegisters_GPIO4_CNTL = 0x0c, PmicRegisters_GPIO5_CNTL = 0x0d, PmicRegisters_GPIO_SIG_OUT = 0x20, PmicRegisters_GPIO_SIG_IN = 0x21, PmicRegisters_REG1_VOLTAGE = 0x22, PmicRegisters_REG2_VOLTAGE = 0x23, PmicRegisters_REG_CNT...
i2c_use(I2C_DEVICE_AS3701B)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(memcmp(out_buffer, (uint8_t*) "5678", 4) == 0)
; cl_assert(circular_buffer_consume(&buffer, 4)); // Get the rest of the wrapped read cl_assert(circular_buffer_read(&buffer, 2, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 2); cl_assert(memcmp(out_buffer, (uint8_t*) "9a", 2) == 0); cl_assert(circular_buffer_consume(&buffer, 2)); // Consum...
n supported must saturate to 1600Hz sample_rate = BMI160SampleRate_1600_HZ; } return sample_rate; } static void prv_configure_operating_mode(void) { BMI160SampleRate interval_us = prv_get_min_sampling_interval_us(); uint8_t acc_odr = (uint8_t)prv_get_odr(interval_us); // should be able to write the samp...
(BMI160_REG_FIFO_CONFIG_0, fifo_wm)
; BMI160_DBG("FWM = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_FIFO_CONFIG_0)); uint8_t curr_frame_cfg = bmi160_read_reg(BMI160_REG_FIFO_CONFIG_1); uint8_t desired_cfg = BMI160_FIFO_CONFIG_1_ACC_EN; if (curr_frame_cfg != desired_cfg) { prv_run_command(BMI160_CMD_FIFO_FLUSH); // clear any lingering en...
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, }, }, .rand = 0x11223344, .ediv = 9876, }, .irk = (const SMIdentityResolvingKey) { .data = { 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, }, }, .identity = (const BTD...
(shared_prf_storage_get_ble_pairing_data(NULL, NULL, NULL, NULL), true)
; shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_ble_pairing_data(NULL, NULL, NULL, NULL), false); } void test_shared_prf_storage_v3__getting_started_complete(void) { shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false); shared_p...
#include "services/normal/timeline/health_layout.h" #include "system/logging.h" #include "util/time/time.h" #define SELECT_INDICATOR_COLOR (PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack)) #define BACK_TO_WATCHFACE (-1) // Enum for different card types typedef enum { Card_ActivitySummary, #if CAPABILITY_HAS_BUILTIN_HRM...
content_indicator_configure_direction(content_indicator, direction, &(ContentIndicatorConfig) { .layer = indicator_layer, .colors.foreground = gcolor_legible_over(card_bg_color), .colors.background = card_bg_color, })
; } static void prv_refresh_content_indicators(HealthCardView *health_card_view) { prv_content_indicator_setup_direction(health_card_view, &health_card_view->up_indicator, &health_card_view->up_arrow_layer, ...
-600}, { 128, 992, -384}, { 160, 760, -392}, { 224, 640, -384}, { 304, 400, -224}, { 328, 520, -328}, { 368, 560, -312}, { 400, 624, -344}, { 376, 744, -416}, { 408, 752, -424}, { 400, 712, -336}, // 5 seconds { 496, 856, -440}, { 488, 688, -456}, { 472, 1136, -3...
{ -480, 456, 208}, { -504, 344, 224}, { -544, 320, 64}, { -664, 464, 64}, { -560, 288, 32}, { -504, 440, 8}, { -640, 520, -56}, { -776, 488, -144}, { -872, 688, -88}, { -1024, 544, -336}, { -1528, -168, 152}, { -1104, 616, -360}, { -920, 280, -176}, { -752, 328, -...
{ -624, 192, 64}, { -848, 240, -24}, { -936, 472, 16}, // 13 seconds { -1184, 208, -136}, { -1384, 440, -184}, { -1320, 480, -280}, { -1160, 528, -336}, { -872, 440, -248}, { -648, 320, -304}, { -472, 192, -88}, { -512, 296, -136}, { -552, 368, -232}, { -712, 432...