prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); const GContextInitializationMode context_init_mode = GContextInitializationMode_System; graphics_context_init(&s_ctx, fb, context_init_mode); framebuffer_clear(fb); // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); pf...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE_X(details2)))
/* * 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_will_return(icache_is_enabled, true)
; cl_will_return(dcache_is_enabled, true); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1); cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x20, 0x1); cl_assert_equal_i(s_flush_addr, 0x20); cl...
isr(&e); } } //! Returns the latest accel reading void accel_get_latest_reading(AccelRawData *data) { *data = s_latest_reading; } //! Clears the pending accel event boolean. Called by KernelMain once it receives the accel_manager_dispatch_data //! callback void accel_reset_pending_accel_event(void) { s_pending_...
PBL_LOG(LOG_LEVEL_ERROR, "Self test failed, could not start accel")
; return false; } psleep(10); accel_get_data(&data, 1); lis3dh_enter_self_test_mode(SELF_TEST_MODE_ONE); // ST recommends sleeping for 1ms after programming the module to // enter self-test mode; a 100x factor of safety ought to be // sufficient psleep(100); accel_get_data(&data_st, 1); lis...
ssert_equal_i(decoded_codepoint, actual_codepoint); malformed_test_string_utf8 = utf8_get_next(malformed_test_string_utf8); } // When we decode the invalid codepoint, it should return an invalid stream // error and set the pointer to the stream to be null cl_assert_equal_i(utf8_peek_codepoint(malformed_tes...
realloc(output_buffer, 3)
/* * 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 GOvalScaleMode oval_scale_mode = GOvalScaleModeFitCircle; // Calculate the radial rect const GRect inset_layer_bounds = grect_inset((*layer_bounds), GEdgeInsets(shape_size->h / 2)); const GRect shape_rect = grect_centered_from_polar(inset_layer_bounds, oval_scale_mode, ...
ted_handler) { ConnectionMgrInfo *conn_mgr_info; if (!hdl || !((conn_mgr_info = hdl->conn_mgr_info))) { PBL_LOG(LOG_LEVEL_ERROR, "GAP Handle not properly intialized"); return; } bt_lock(); // remove the watchdog timer if it was already scheduled since we are // going to recompute RegularTimerInfo...
{ prv_mode_chaos_monkey_stop(); goto unlock; }
4, -264}, { 704, 896, -224}, { 608, 920, -152}, { 488, 872, -136}, { 384, 752, -80}, // 157 seconds { 240, 656, 8}, { 136, 656, 40}, { 24, 584, -48}, { 16, 624, 120}, { 96, 664, 64}, { 48, 720, 128}, { 184, 872, 112}, { 192, 824, 240}, { 272, 768, 200}, { 272,...
{ 128, -336, -936}, { 104, -312, -936}, { 112, -336, -936}, { 112, -328, -928}, { 112, -336, -904}, { 112, -336, -920}, { 128, -336, -936}, { 128, -336, -904}, { 144, -328, -904}, { 144, -336, -872}, { 208, -328, -856}, { 208, -304, -808}, { 232, -280, -792}, { 24...
-784, -496, 8}, { -1216, -408, -392}, { -1472, -576, -360}, { -1800, -384, -200}, { -1584, -96, -184}, { -1392, 16, -160}, { -1232, 40, -32}, { -1168, 176, 48}, { -1208, 152, 80}, // 33 seconds { -1432, 248, 104}, { -1696, 344, 48}, { -2016, 280, 304}, { -1808, 1504, ...
{ -1192, 360, 88}, // 38 seconds { -1256, 424, -96}, { -1520, 392, -80}, { -1608, 624, 168}, { -1088, 1160, 112}, { -1224, 1104, -88}, { -904, 936, 48}, { -912, 696, -64}, { -1112, 440, -32}, { -1408, 560, -56}, { -1592, 688, -40}, { -1472, 384, 32}, { -1424, 336,...
{ 320, 536, -968}, { 480, 528, -912}, { 344, 504, -808}, { 152, 480, -744}, { 32, 552, -736}, { -64, 544, -680}, { -48, 560, -736}, { -72, 528, -720}, { -88, 528, -736}, { -88, 544, -784}, { -48, 560, -808}, { -40, 552, -816}, { -32, 568, -840}, { -8, 584, -808}, ...
{ 248, 984, -600}, { 320, 984, -696}, // 64 seconds { 408, 760, -536}, { 360, 680, -488}, { 288, 632, -512}, { 240, 680, -504}, { 136, 720, -536}, { 104, 736, -576}, { 32, 680, -576}, { -64, 696, -616}, { -80, 680, -632}, { -80, 728, -672}, { -32, 712, -688}, ...
{ 152, 360, -688}, { 192, 408, -800}, { 216, 368, -848}, { 248, 416, -872}, { 224, 344, -880}, { 192, 296, -808}, { 168, 480, -808}, { 152, 520, -792}, { 144, 560, -824}, { 80, 536, -800}, // 67 seconds { 24, 632, -728}, { 0, 712, -616}, { -8, 608, -712}, { 7...
header); if (has_notification) { if (characteristic_out) { *characteristic_out = header.characteristic; } if (value_length_out) { *value_length_out = header.value_length; } } return has_notification; } DEFINE_SYSCALL(void, sys_ble_client_consume_read, uintptr_t object_ref, ...
DEFINE_SYSCALL(void, sys_ble_service_get_uuid, Uuid *uuid, BLEService service_ref)
e a pointer to a // function anywhere in one half of the total address space. Since // current Pebble hardware (at the time of writing) can only have code // in one of a few small ranges, a pointer can be packed into much fewer // than 28 bits while still being able to address a function anywhere in // memory that exis...
animation_legacy2_get_ms_since_system_start()
; const int32_t delta_ms = serial_distance32(now, animation->abs_start_time_ms); const uint32_t interval_ms = MAX(delta_ms, 0) + rate_control_delay_ms; if (animation_legacy2_scheduler->timer_handle != NULL) { app_timer_reschedule(animation_legacy2_scheduler->timer_handle, interval_ms); // Ignore the retu...
en. We're in a transition period // with an amphibious iAP + LE mode, where the iOS app decides what connection to use for // PP transport. To keep iAP reconnection going (for legacy PebbleKit iOS support and also to // connect to the Pebble app), the BT Classic bonding is kept as the "active // gateway" and an...
bt_persistent_storage_set_active_gateway(BT_BONDING_ID_INVALID)
; } } } static void prv_call_common_bonding_change_handlers(BTBondingID bonding, BtPersistBondingOp op) { bt_pairability_update_due_to_bonding_change(); } typedef struct { unsigned int count; BtPersistBondingType type; } PairingCountItrData; static bool prv_get_num_pairings_by_type_itr(SettingsFile *file...
/* * 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...
mutex_assert_held_by_curr_task(s_vibe_history_mutex, true)
; while (s_vibe_history && s_vibe_history->time_end != END_NOT_SET) { VibeHistory *vibe = s_vibe_history; if (cutoff != HISTORY_CLEAR_ALL && vibe->time_end >= cutoff) { break; } s_vibe_history = (VibeHistory*)list_get_next((ListNode*)vibe); kernel_free(vibe); } } DEFINE_SYSCALL(void, sys_...
*current_icon; ResourceId current_icon_id; bool hid_action_bar; GBitmap up_bitmap; GBitmap select_bitmap; GBitmap down_bitmap; ClickHandler up_action; ClickHandler select_action; ClickHandler down_action; const PhoneStyle *style; GFont name_font; GFont long_name_font; GFont status_font; c...
timeline_resources_get_id(&timeline_res, s_phone_ui_data->style->icon_size, &icon_res_info)
; const ResourceId resource = icon_res_info.res_id; KinoReel *image = kino_reel_create_with_resource(resource); #if !PLATFORM_TINTIN GRect layer_frame = s_phone_ui_data->icon_layer.layer.frame; GSize size = kino_reel_get_size(image); GRect icon_from = { .origin.x = layer_frame.origin.x + (layer_frame.s...
->consecutive_days); } // ----------------------------------------------------------------------------------------------- // Validates history stats for a given metric against insight settings static bool prv_validate_history_stats(const ActivityInsightMetricHistoryStats *stats, ...
{ // The user has not enabled pebble health return NULL; }
AttributeList notif_attr_list = {0}; const char *body = i18n_get("You like sleep, don't you? " "Get fun stats on your sleep and start waking " "up less groggy with Pebble Health.", &notif_attr_list); prv_build_notification...
er, row, is_selected); } } static uint16_t prv_get_num_rows_callback(MenuLayer *menu_layer, uint16_t section_index, void *context) { PBL_ASSERTN(section_index < SettingsMenuItem_Count); SettingsData *data = context; SettingsCallbacks *callbacks = prv_get_current_callb...
(sizeof(*data))
; data->current_category = category; data->title = settings_menu_get_submodule_info(category)->name; data->callbacks = callbacks; app_state_set_user_data(data); window_init(&data->window, WINDOW_NAME("Settings Window")); window_set_user_data(&data->window, data); window_set_window_handlers(&data->windo...
e_kernel_services_notifications_ancs_notifications_count(), 1); // } // // rtc_set_time(rtc_get_time() + SECONDS_PER_DAY); // activity_insights_recalculate_stats(); // activity_insights_process_sleep_data(rtc_get_time()); // cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 2); // //...
rtc_get_time()
); // Make sure that when we are active, we don't trigger without being above average s_data.steps_per_minute = 80; s_data.metric_history[ActivityMetricStepCount][0] = AVERAGE_STEPS; prv_minute_update(ACTIVE_MINUTES); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); } voi...
/* * 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...
if (shared_circular_buffer_get_read_space_remaining(&s_buffer, &s_buffer_client) < msg_length + sizeof(uint8_t)) { return; // Not ready yet, consume nothing. }
// Flash_logging_log_start can trigger a flash erase. Release the buffer mutex // to allow logging while the (slow) erase completes. mutex_unlock(s_buffer_mutex); uint32_t flash_addr = flash_logging_log_start(msg_length); mutex_lock(s_buffer_mutex); if (flash_addr == FLASH_LOG_INVALID_ADDR) { return; ...
emove from the removed items list // as we want to add it back to the window stack. if (window_stack_from) { ListNode *node = list_find(window_stack_from->removed_list_head, prv_filter_window_item_for_window, window); if (node != NULL) { list_remove(node, &window_stack_from->removed_list_head,...
NULL_SAFE_FIELD_ACCESS(window_stack, list_head, NULL)
; return NULL_SAFE_FIELD_ACCESS(item, window, NULL); } void window_stack_push(WindowStack *window_stack, Window *window, bool animated) { const WindowTransitionImplementation *transition_insert = animated ? window_transition_get_default_push_implementation() : &g_window_transition_none_imple...
6, -264}, { 1184, 80, -256}, { 1496, 104, -304}, { 1320, 120, -248}, { 1088, 112, -200}, { 904, 120, -184}, { 960, 104, -184}, { 1144, 96, -168}, { 1248, 88, -120}, { 1144, 56, -64}, { 1064, 32, -48}, { 1024, 32, -32}, { 952, 32, -48}, { 912, 32, -72}, // 59 secon...
{ 1088, 96, 0}, { 1056, 96, -8}, { 1072, 104, -32}, { 1072, 88, -56}, { 1072, 64, -64}, { 1080, 24, -72}, { 1064, 24, -144}, { 1176, 0, -152}, { 1104, -8, -144}, { 976, -8, -216}, { 960, 0, -288}, { 848, 32, -360}, { 824, 32, -392}, { 1064, 24, -408}, { 1208, ...
{ 880, -72, -224}, { 896, -136, -208}, { 1200, -152, -184}, { 1144, -152, -128}, // 67 seconds { 1032, -128, -80}, { 1016, -96, -88}, { 992, -112, -48}, { 1016, -56, -96}, { 1016, -24, -128}, { 1064, -32, -80}, { 1032, 64, -160}, { 944, 16, -152}, { 944, 64, -200...
))) { return; } // Make the Bluetopia heap consumption of this module as minimal and predictable as possible, // by having only one outstanding GATT operation queued up at any moment in time (instead of // queueing up all the writes in one go): const AMSEntityID entity_id = s_ams_client->next_entity_to_r...
{ case AMSPlaybackInfoIdxState: { state->playback_state = prv_music_playstate_for_ams_playback_state(value_out); break; } case AMSPlaybackInfoIdxRate: state->playback_rate_percent = value_out; break; case AMSPlaybackInfoIdxElapsedTime: state->elapsed_time_ms = value_out; ...
return true /* should_continue */; } static void prv_handle_player_playback_info_update(const AMSEntityUpdateNotification *update, const uint16_t value_length) { MusicPlayerStateUpdate state = {}; const uint8_t num_results = ams_util_csv_parse(update->value_str...
fied); printf("flags: "PRIb8", ", TO_BINARY(hdr.flags)); printf("key_hash: %"PRIu8", key_len: %d, val_len: %d }\n", hdr.key_hash, hdr.key_len, hdr.val_len); } } static void verify(SettingsFile *file, uint8_t *key, int key_len, uint8_t *val, int val_len) { int val_len_out = settings_file...
printf("\nTesting manual file compaction...\n")
; const bool manual_compaction = true; prv_test_settings_file_compaction(manual_compaction); } void test_settings_file__automatic_compaction_increment(void) { printf("\nTesting automatic file compaction...\n"); const bool manual_compaction = false; prv_test_settings_file_compaction(manual_compaction); } sta...
0}, { 1256, -72, -120}, { 952, -64, -152}, { 952, -80, -128}, { 1368, -96, -64}, { 1440, -144, -24}, { 1240, -160, -32}, { 1024, -144, -16}, { 968, -80, -56}, { 920, -40, -72}, { 896, -32, -48}, { 880, -8, -96}, { 840, 24, -128}, { 840, 48, -192}, // 88 seconds ...
{ 416, 744, -552}, { 440, 680, -616}, // 93 seconds { 472, 576, -608}, { 456, 560, -584}, { 728, 640, -640}, { 968, 536, -592}, { 936, 384, -560}, { 768, 360, -472}, { 752, 400, -392}, { 816, 448, -400}, { 920, 448, -448}, { 872, 360, -400}, { 848, 376, -400}, ...
{ 744, -80, -272}, { 728, -112, -112}, { 1112, -96, -136}, { 1208, -40, -72}, { 1088, -72, -64}, { 992, 8, -168}, { 880, 8, -240}, { 848, 32, -208}, { 944, 40, -288}, { 960, 32, -280}, { 952, 64, -304}, // 96 seconds { 944, 40, -352}, { 960, 32, -376}, { 952,...
xit, if the app has not alreeady finished it's de-init, we post a de_init event to the app, set //! a 3 second timer, and return immediately to the caller. If/when the app finally finishes deinit, it will post a //! PEBBLE_PROCESS_KILL_EVENT (graceful=true), which results in this method being again with graceful=true. ...
(sizeof(PebbleLaunchAppEventExtended))
; *data = (PebbleLaunchAppEventExtended) { .common = config->common }; data->common.transition = prv_get_transition(&config->common, config->id); PebbleEvent e = { .type = PEBBLE_APP_LAUNCH_EVENT, .launch_app = { .id = config->id, .data = data }, }; event_put(&e); } // -------...
s map. flash_impl_use(); prv_issue_command(0, S29VSCommand_DeviceIDEntry); uint16_t result = flash_s29vs_read_short(0x0); prv_software_reset(); flash_impl_release(); return result; } static uint16_t prv_read_configuration_register(void) { prv_issue_command(0, S29VSCommand_ConfigureRegisterEntry); uint...
{ prv_flash_reset(); prv_flash_protect_range(start_sector, end_sector); return S_SUCCESS; }
CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 9, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r9_no_clip.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_radius_aa(void) { GContext ctx; test_graphics_context_init(&ctx, ...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
/* * 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...
(LOG_LEVEL_INFO, "HcTest: Config PA: %d", msg->payload[0])
; hw_fem_set_pin_config(msg->payload[0]); break; #endif case HCMessageID_Test_Sleep: prv_handle_sleep_test_cmd(msg); break; case HcMessageID_Test_UnmodulatedTxStart: prv_enable_continuous_wave_mode((HcTestUnmodTxStart *)&msg->payload[0]); break; case HcMessageID_Test_Unmo...
v_count_handler_entries(&s_setup_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert(prv_count_handler_entries(&s_update_handler_calls, a) >= test_duration/MIN_FRAME...
(prv_count_handler_entries(&s_started_handler_calls, b), 2)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); // Complete B prv_advance_to_ms_with_timers(start_ms + duration_tot...
/* * 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_ASSERTN((impl->curr_pos + length) <= impl->total_payload_size)
; memcpy(impl->payload + impl->curr_pos, data, length); impl->curr_pos += length; } static void prv_wipe_receiver_data(DefaultReceiverImpl *receiver) { *receiver = (DefaultReceiverImpl) { }; } static void prv_default_kernel_receiver_cb(void *data) { DefaultReceiverImpl *impl = (DefaultReceiverImpl *)data; ...
/* * 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_ASSERTN(periph_addr >= APB1PERIPH_BASE); if (periph_addr < APB2PERIPH_BASE) { return RCC_APB1PeriphClockCmd; } else if (periph_addr < AHB1PERIPH_BASE) { return RCC_APB2PeriphClockCmd; } else if (periph_addr < AHB2PERIPH_BASE) { return RCC_AHB1PeriphClockCmd; } else if (periph_addr < AHB3_BAS...
/* * 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...
{ uint8_t *frame_data_buffer = NULL; // Allocate gbitmap GBitmapSequence* bitmap_sequence = applib_type_zalloc(GBitmapSequence); if (bitmap_sequence == NULL) { goto cleanup; } bitmap_sequence->resource_id = resource_id; bitmap_sequence->data_is_loaded_from_flash = true; if (!prv_gbitmap_sequence_...
bitmap_sequence->bitmap_size = (GSize){.w = upng_get_width(upng), .h = upng_get_height(upng)}; bitmap_sequence->total_frames = upng_apng_num_frames(upng); if (!gbitmap_png_is_format_supported(upng)) { APP_LOG(APP_LOG_LEVEL_ERROR, APNG_FORMAT_ERROR); goto cleanup; } // Create a color palette in RGBA...
/* * 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, CENTER_OF_ORIGIN_RECT, RADIUS_SMALL)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_...
.header = { .id = {0x99, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87, 0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01}, .timestamp = 0, .duration = 0, .type = TimelineItemTypeNotification } }; cl_assert(E_INVALID_ARGUMENT == reminder_db_insert_item(&not_a_reminder)); } ...
reminder_db_get_dirty_list()
; cl_assert(dirty_list); cl_assert(list_count((ListNode *)dirty_list) == num_reminders); // Mark some items as synced reminder_db_mark_synced((uint8_t *)&item1.header.id, sizeof(TimelineItemId)); reminder_db_mark_synced((uint8_t *)&item3.header.id, sizeof(TimelineItemId)); // We should now only have 2 dir...
rnal device = prv_dummy_device(1); // Register connection intent: BTErrno e = gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_assert_equal_i(...
prv_fake_connect(&device, false /* is_master*/)
; // Verify the kernel task got a (virtual) connection event: prv_assert_client_event(&device, true /* connected */, (1 << PebbleTask_KernelMain), HCI_ERROR_CODE_SUCCESS); // Register connection intent for app: e = gap_le_connect_connect_by_bonding(bonding_id, ...
le) { case BMI160_SCALE_2G: cfg_val = BMI160_ACC_RANGE_2G; break; case BMI160_SCALE_4G: cfg_val = BMI160_ACC_RANGE_4G; break; case BMI160_SCALE_8G: cfg_val = BMI160_ACC_RANGE_8G; break; case BMI160_SCALE_16G: cfg_val = BMI160_ACC_RANGE_16G; break; defa...
(res, data)
; data->timestamp_us = prv_get_sample_time_us(&res[6]); BMI160_DBG("%"PRId16" %"PRId16" %"PRId16, data->x, data->y, data->z); } static IMUCoordinateAxis prv_get_axis_direction(uint8_t int0_status, uint8_t int2_status, uint8_t mask, uint8_t shift, int32_t *direction...
/* * 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...
(uo_rect.size.w)
; JS_VAR unobstructed_height = jerry_create_number(uo_rect.size.h); jerry_set_object_field(canvas, ROCKY_CANVAS_UNOBSTRUCTEDLEFT, unobstructed_left); jerry_set_object_field(canvas, ROCKY_CANVAS_UNOBSTRUCTEDTOP, unobstructed_right); jerry_set_object_field(canvas, ROCKY_CANVAS_UNOBSTRUCTEDWIDTH, unobstruc...
/* * 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...
DEFINE_SYSCALL(void, sys_profiler_node_start, ProfilerNode *node)
{ if (PRIVILEGE_WAS_ELEVATED) { if (!list_contains(g_profiler.nodes, (ListNode *)node)) { // Instead of calling syscall_failed(), simply return. If PROFILE_INIT has not been // executed yet, there won't be any nodes in the list. return; } } node->start = DWT->CYCCNT; } DEFINE_SYSCALL(...
VOICE_LOG("Result: timeout"); if (!connection_service_peek_pebble_app_connection()) { data->error_count++; if (data->error_count < MAX_ERROR_COUNT) { prv_set_mic_window_state(data, StateError); prv_push_bt_dialog(data); } else { prv_push_final_error_dialog(da...
(data->session_id)
RebootReason reason = { RebootReasonCode_ForcedCoreDump, 0}; reboot_reason_set(&reason); } // Pend the Non-Maskable Interrupt, as the NMI handler performs the core dump. SCB->ICSR = SCB_ICSR_NMIPENDSET_Msk; __DSB(); __ISB(); // Shouldn't get here RebootReason reason = { RebootReasonCode_CoreDumpEntry...
(false /*new*/)
; if (!s_core_dump_is_forced && flash_base != CORE_DUMP_FLASH_INVALID_ADDR) { CoreDumpFlashRegionHeader region_hdr; CoreDumpImageHeader image_hdr; prv_debug_str_int("CD: Checking: ", flash_base); prv_flash_read_bytes(&region_hdr, flash_base, sizeof(region_hdr)); prv_flash_read_bytes(&image_hdr, fl...
); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 3); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dra...
{ GContext ctx; test_graphics_context_init(&ctx, fb); // AA = true, SW = 1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 0); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r0_aa_sw1_no_clip.${BIT_D...
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, tru...
/* * 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...
(worker_state_get_battery_state_service_state())
; connection_service_state_init(worker_state_get_connection_service_state()); tick_timer_service_state_init(worker_state_get_tick_timer_service_state()); #if CAPABILITY_HAS_HEALTH_TRACKING health_service_state_init(worker_state_get_health_service_state()); #endif } void worker_state_deinit(void) { #if CAPABIL...
1126, 358, 188}, { 981, 316, 185}, { 885, 252, 189}, { 862, 216, 198}, { 864, 185, 205}, { 848, 157, 204}, { 747, 149, 177}, { 797, 158, 169}, { 958, 152, 197}, { 1055, 174, 144}, { 1239, 222, 128}, { 1446, 266, 146}, { 1215, 408, -120}, { 1155, 476, -185}, { 101...
{ 774, 136, 116}, { 681, 120, 94}, { 740, 143, 83}, { 956, 160, 124}, { 1168, 210, 125}, { 1418, 257, 216}, { 1618, 270, 460}, { 1375, 438, 247}, { 1127, 483, -1}, { 990, 329, 171}, { 941, 331, 172}, { 837, 197, 150}, { 701, 234, 174}, { 646, 294, 146}, { 656,...
n writing, software * distributed under 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 "graphics_private_raw_mask.h" #incl...
(ctx, y, x1.integer, x2.integer, color)
; // increment the last_pixel since we had some middle pixels last_pixel_x++; // x1 doesn't need to be increased as it's not used anymore in this function } // last pixel with blending (don't render first *and* last pixel if line length is 1) if (x2.fraction != 0) { prv_blend_color_and_update_mas...
fill_color); graphics_fill_circle(ctx, command->points[0], command->radius); } if ((command->stroke_color.a != 0) && (command->stroke_width > 0)) { graphics_context_set_stroke_color(ctx, command->stroke_color); graphics_context_set_stroke_width(ctx, command->stroke_width); graphics_draw_circle(ctx, ...
{ if (!command || ((command->type != GDrawCommandTypePath) && (command->type != GDrawCommandTypePrecisePath))) { return false; } return command->path_open; }
void gdraw_command_set_hidden(GDrawCommand *command, bool hidden) { if (!command) { return; } command->hidden = hidden; } bool gdraw_command_get_hidden(GDrawCommand *command) { if (!command) { return false; } return command->hidden; } size_t gdraw_command_copy_points(GDrawCommand *command, GPoin...
///////////////////////////////// static bool prv_is_outbox_busy(void) { return (s_state.out.msg_type != OutboxMsgTypeNone || s_state.out.app_msg_retry_timer != EVENTED_TIMER_INVALID_ID); } static void prv_outbox_try_send_next(void) { if (prv_is_outbox_busy()) { return; } // Send out the next m...
PBL_ASSERTN(s_state.state == PostMessageStateAwaitingResetCompleteRemoteInitiated || s_state.state == PostMessageStateAwaitingResetCompleteLocalInitiated)
; const PostMessageUnsupportedErrorPayload error_payload = { .error_code = error, }; prv_control_message_queue_add(PostMessageKeyUnsupportedError, &error_payload, sizeof(error_payload)); prv_awaiting_reset_request__enter(); } ///////////////////////////////////////////////...
st be typecast GTransformSetter setter = (GTransformSetter)((PropertyAnimationImplementation*) property_animation->animation.implementation) ->accessors.setter.int16; setter(property_animation->subject, result); } #endif // ---------------------------...
implementation->accessors.getter.uint32(subject)
; property_animation->values.from.uint32 = from_value ? *((uint32_t *)from_value) : implementation->accessors.getter.uint32(subject); } else if (property_animation->animation.implementation->update == (AnimationUpdateImplementation) propert...
cl_assert(value); buffer = malloc(value_length); memcpy(buffer, value, value_length); } else { cl_assert_equal_p(value, NULL); buffer = NULL; } *write = (const Write) { .characteristic = characteristic, .client = client, .is_response_required = is_response_required, .value = b...
cl_assert_equal_b(is_response_required, s_write_head->is_response_required)
; } else { fake_gatt_client_op_assert_write_failed(); } Write *old_write = s_write_head; s_write_head = (Write *) list_pop_head(&s_write_head->node); free(old_write->value); free(old_write); }
&data->event_service_info); prv_cancel_response_timer(data); applib_free(data); } static void prv_show_result_window(ActionResultData *data, const TimelineResourceId timeline_res_id, const char *msg, bool succeeded) { const GSize simple_dialog_icon_size = timeline_resources_get...
prv_show_result_window(data, data->dialog.icon, data->dialog.message, data->dialog.success)
; } else { prv_cleanup_action_result(data, success); } } static void prv_show_progress_window(void *data_ptr) { ActionResultData *data = data_ptr; data->progress_window = applib_zalloc(sizeof(ProgressWindow)); if (!data->progress_window) { const bool success = false; prv_cleanup_action_result(dat...
/* * 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...
(window, animated)
; } //////////////////// // App boilerplate static void handle_init(void) { FSResourceAppData *data = (FSResourceAppData*) app_malloc_check(sizeof(FSResourceAppData)); if (data == NULL) { PBL_CROAK("Out of memory"); } app_state_set_user_data(data); push_window(data); } static void handle_deinit(void) { ...
/* * 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_buffer_index = 0; memset(s_buffer, 0, BUFFER_LENGTH); while (callback(context)) { cl_assert(s_did_send_byte); } }
void fake_accessory_get_buffer(uint8_t **buffer, int *length) { *buffer = s_buffer; *length = s_buffer_index; }
s_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.des...
(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW = 5 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 5); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "...
/* * 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...
sys_ecompass_service_subscribed()
) { // If we haven't initialized the compass yet by subscribing, do that now. compass_service_subscribe(NULL); } sys_ecompass_get_last_heading(data); if (data->is_declination_valid) { data->true_heading += config->heading_declination; } // 11 second timer to turn off compass, reset timeout ever...
ressed(&data->button_combo_state, click_recognizer_get_button_id(recognizer)); } static void prv_raw_up_handler(ClickRecognizerRef recognizer, void *context) { RecoveryFUAppData *data = app_state_get_user_data(); getting_started_button_combo_button_released(&data->but...
gap_le_connection_copy_device_name(gap_conn, data->name_text_buffer, BT_DEVICE_NAME_BUFFER_SIZE)
; } else { // If we aren't connected and/or don't have a session, display the name of the device // so it's easier for a user to figure out what they should be trying to connect to bt_local_id_copy_device_name(data->name_text_buffer, false); // For debugging purposes, we are going to add -'s to the b...
s CREATE_DMA_STREAM(1, 1); // DMA1_STREAM1_DEVICE - Debug UART RX CREATE_DMA_STREAM(1, 4); // DMA1_STREAM4_DEVICE - Sharp SPI TX // DMA Requests static DMARequestState s_dbg_uart_dma_request_state; static DMARequest DBG_UART_RX_DMA_REQUEST = { .state = &s_dbg_uart_dma_request_state, .stream = &DMA1_STREAM1_DEVIC...
(I2C1_EV, i2c_hal_event_irq_handler, &I2C_MAIN_BUS)
; IRQ_MAP(I2C1_ER, i2c_hal_error_irq_handler, &I2C_MAIN_BUS); IRQ_MAP(I2C2_EV, i2c_hal_event_irq_handler, &I2C_2V5_BUS); IRQ_MAP(I2C2_ER, i2c_hal_error_irq_handler, &I2C_2V5_BUS); // VOLTAGE MONITOR DEVICES static const VoltageMonitorDevice VOLTAGE_MONITOR_ALS_DEVICE = { .adc = ADC2, .adc_channel = ADC_Channel_12...
nclude <stdbool.h> #include <stdio.h> #include <string.h> //! BlobDB Endpoint ID static const uint16_t BLOB_DB2_ENDPOINT_ID = 0xb2db; //! Message Length Constants static const uint8_t DIRTY_DATABASES_LENGTH = 2; static const uint8_t START_SYNC_LENGTH = 3; static const uint8_t WRITE_RESPONSE_LENGTH = 3; static const u...
PBL_LOG(LOG_LEVEL_ERROR, "Got a write response with an invalid length: %"PRIu32"", length)
; return; } prv_handle_wb_write_response(data, length); } static void prv_handle_wb_response(CommSession *session, const uint8_t *data, uint32_t length) { if (length < WRITEBACK_RESPONSE_LENGTH) { PBL_LOG(LOG_LEVEL_ERROR, "Got a write...
" #include "kernel/util/wfi.h" #include "mcu/interrupts.h" #include "services/common/analytics/analytics.h" #include "system/passert.h" #define STM32F2_COMPATIBLE #define STM32F4_COMPATIBLE #define STM32F7_COMPATIBLE #include <mcu.h> #include <stdbool.h> #include <inttypes.h> static int s_num_items_disallowing_stop_...
portEXIT_CRITICAL()
; } void stop_mode_enable( StopModeInhibitor inhibitor ) { portENTER_CRITICAL(); PBL_ASSERTN(s_num_items_disallowing_stop_mode != 0); PBL_ASSERTN(s_inhibitor_profile[inhibitor].active_count != 0); --s_num_items_disallowing_stop_mode; --s_inhibitor_profile[inhibitor].active_count; if (s_inhibitor_profile[i...
dialog->text_color, GColorClear, text_alignment, GTextOverflowModeWordWrap); #if PBL_ROUND text_layer_enable_screen_text_flow_and_paging(subtext_layer, TEXT_FLOW_INSET_PX); #endif layer_add_child(&window->layer, &subtext_layer->layer); ...
{ return; }
ActionBarLayer *action_bar = &workout_dialog->action_bar; action_bar_layer_set_context(action_bar, context); } void workout_dialog_push(WorkoutDialog *workout_dialog, WindowStack *window_stack) { dialog_push(&workout_dialog->dialog, window_stack); } void app_workout_dialog_push(WorkoutDialog *workout_dialog) {...
/* * 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...
(&nf->window.layer)
app_hb sessions. // https://pebbletechnology.atlassian.net/browse/PBL-5463 const bool resume = false; DataLoggingSessionRef dls_session = dls_create( tag, DATA_LOGGING_BYTE_ARRAY, item_length, buffered, resume, &system_uuid); PBL_LOG(LOG_LEVEL_DEBUG, "%s HB Session: %p", kind_str, dls_session); if (!d...
analytics_heartbeat_set(device_hb, ANALYTICS_DEVICE_METRIC_TIMESTAMP, timestamp)
; analytics_heartbeat_set(device_hb, ANALYTICS_DEVICE_METRIC_DEVICE_UP_TIME, current_ticks); analytics_heartbeat_set(device_hb, ANALYTICS_DEVICE_METRIC_TIME_INTERVAL, dt_ms); AnalyticsHeartbeatList *app_hb_node = app_hbs; while (app_hb_node) { AnalyticsHeartbeat *app_hb = app_hb_node->heartbeat; analyt...
/* * 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...
graphics_text_attributes_create()
; graphics_text_attributes_enable_screen_text_flow(text_attributes, 8); #endif // Check if the text takes up more than one line. If the dialog has a single line of text, // the icon and line of text are positioned lower so as to be more vertically centered. GContext *ctx = graphics_context_get_current_context()...
i_eq(&ctx.dest_bitmap, "draw_rect_offset_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi...
(ctx, &box)
; } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__clipping_rect(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); graphics_context_set_stroke_color(&ctx, GColorBlack); // Draw rectangles around boundaries of clipping b...
text_alignment) : title_font_height * intitial_title_text_lines; const int title_text_cap_offset = (config->title) ? fonts_get_font_cap_offset(title_font) : 0; int16_t container_height = title_text_frame_height + subtitle_text_frame_height; if (icon_align == GAlignTop) { // The ...
(container_rect.origin, config->icon_box_model->offset)
; } prv_draw_icon(ctx, config->icon, &container_rect, is_legacy2); } } int cell_layer_bounds_origin_x = cell_layer_bounds->origin.x; // Move the title and subtitle closer together to match designs const int16_t icon_on_left_title_subtitle_vertical_spacing_offset = -3; if (icon_align == GAlign...
set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, 14), 12); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); graphics_draw_circ...
{ GContext ctx; test_graphics_context_init(&ctx, fb); // Big circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_no_clip.${BIT_DEPTH_NAME}.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...
animation_private_using_legacy_2(NULL)
) { // on 2.x we don't need to consider any easing animation_get_implementation(animation)->update(animation, 0); } else { animation_private_update(NULL, animation_private_animation_find(animation), 0); } } static void prv_transition_teardown_destroy_animation(Animation *a) { // needed for compatibil...
/* * 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...
(LOG_LEVEL_WARNING, "Attempted to unsubscribe from %d, no service found", subscription->event_type)
ubsector_addr) { s_command_list[s_command_list_index++] = (EraseCommand) { .addr = subsector_addr, .type = SectorEraseCommand }; } // Tests /////////////////////////////////////////////////////////// void test_flash_region__initialize(void) { s_command_list_index = 0; } void test_flash_region__cleanup(void) { } ...
(s_command_list[2].type, SubsectorEraseCommand)
; s_command_list_index = 0; // App that's in an unaligned bank but smaller than 64k flash_region_erase_optimal_range(32 * 1024, 32 * 1024, (32 + 18) * 1024, (32 + 96) * 1024); cl_assert_equal_i(s_command_list_index, 5); cl_assert_equal_i(s_command_list[0].addr, 32 * 1024); cl_assert_equal_i(s_command_li...
cs/framebuffer.h" #include "applib/ui/bitmap_layer.h" #include "applib/ui/window_private.h" #include "util/size.h" #include <stdio.h> // Helper Functions //////////////////////////////////// #include "test_graphics.h" #include "../graphics/util.h" #if (SCREEN_COLOR_DEPTH_BITS == 1) #include "1bit/test_framebuffer.h...
{ goto cleanup; }
cl_assert_equal_i(fread(png_data, 1, file_size, fp), file_size); // Create a GBitmap using the PNG data result = gbitmap_create_from_png_data(png_data, file_size); if (result) { free(png_data); } } cleanup: fclose(fp); return result; } static GBitmap *prv_create_bitmap_from_pbi_fi...
/* * 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_CHUNK_SIZE, firmware_length - i)
; flash_read_bytes(buffer, flash_new_fw_start + i, chunk_size); if (!system_flash_write(system_flash_base + i, buffer, chunk_size, NULL, NULL)) { dbgserial_putstr("We're dead"); return false; } prv_display_write_progress(i, firmware_length, NULL); } return true; } static bool prv_check_...
fy elapsed time and snooze s_smart_snooze_counter++; prv_snooze_alarm(SMART_ALARM_SNOOZE_DELAY_S); return; } } if (trigger) { prv_put_alarm_event(); // Alarm events are triggered for both the initial alarm time and subsequent user snoozes // Ensure that we only record the first ala...
settings_file_delete(file, &key, sizeof(key))
yer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_x_y_...
(ctx, GPoint(p.x + 7, p.y + 3))
; } // Draws two columns of colors (first 32 colors in first column, second 32 colors in second column) // Offsets the two color columns based on input transparency static void prv_draw_boxes(GContext *ctx, uint8_t transparency) { int column = 3 - transparency; for (uint8_t color_index = 0; color_index < 64; color...
Debug UART RX CREATE_DMA_STREAM(1, 4); // DMA1_STREAM4_DEVICE - Sharp SPI TX // DMA Requests static DMARequestState s_dbg_uart_dma_request_state; static DMARequest DBG_UART_RX_DMA_REQUEST = { .state = &s_dbg_uart_dma_request_state, .stream = &DMA1_STREAM1_DEVICE, .channel = 4, .irq_priority = IRQ_PRIORITY_IN...
IRQ_MAP(I2C1_ER, i2c_hal_error_irq_handler, &I2C_MAIN_BUS)
; IRQ_MAP(I2C2_EV, i2c_hal_event_irq_handler, &I2C_2V5_BUS); IRQ_MAP(I2C2_ER, i2c_hal_error_irq_handler, &I2C_2V5_BUS); // VOLTAGE MONITOR DEVICES static const VoltageMonitorDevice VOLTAGE_MONITOR_ALS_DEVICE = { .adc = ADC2, .adc_channel = ADC_Channel_12, .clock_ctrl = RCC_APB2Periph_ADC2, .input = { .gpi...
/* * 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...
{ SLEDecodeContext ctx; uint8_t buf[] = { 0xfd, // escape code 0xfd, 0x01, // literal escape byte 0xfd, 0x00 // end }; sle_decode_init(&ctx, buf); uint8_t byte; uint32_t count = 0; while (sle_decode(&ctx, &byte)) { cl_assert_equal_i(byte, 0xfd); ++count; } cl_assert_equal_i(count,...
static bool page_is_deleted(uint8_t page_flags) { return (page_type_bits_set(page_flags, DELETED_START_PAGE_MASK) || page_type_bits_set(page_flags, DELETED_CONT_PAGE_MASK)); } static bool page_is_erased(uint8_t page_flags) { return (page_type_bits_set(page_flags, PAGE_FLAG_ERASED_PAGE)); } static bool page_...
{ prv_flash_read((uint8_t *)pg_hdr, sizeof(*pg_hdr), prv_page_to_flash_offset(page)); if (compute_pg_header_crc(pg_hdr) != pg_hdr->hdr_crc) { return (HdrCrcCorrupt); } if (pg_hdr->version > PFS_CUR_VERSION) { PBL_LOG(LOG_LEVEL_ERROR, "Unexpected Version Header, 0x%x", (int)pg_hdr->version); ...
static status_t write_file_header(FileHeader *hdr, uint16_t pg) { hdr->hdr_crc = compute_file_header_crc(hdr); prv_flash_write((uint8_t *)hdr, sizeof(*hdr), prv_page_to_flash_offset(pg) + FILEHEADER_OFFSET); return (S_SUCCESS); } static status_t write_pg_header(PageHeader *hdr, uint16_t pg) { // recove...
e; p3.y.raw_value += FIXED_S16_3_HALF.raw_value; // GRectZero + standardize cl_assert_equal_grect(GRect(6, 6, 0, 0), grect_centered_internal(&p3, GSize(0, 0))); cl_assert_equal_grect(GRect(5, 5, 1, 2), grect_centered_internal(&p3, GSize(-1, -2))); // handles fixed point cl_assert_equal_grect(GRect(5, 5, 2...
(1, 1, 9, 9)
; grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 5, 5); cl_assert_fixedS16_3(radius, 4); r = GRect(2, 2, 8, 8); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 5.5, 5.5); cl_assert_fixedS16_3(radius, 3.5); } void test_graphics_...
erator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); Uuid first_all_day_event = state.pin.header.id; cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id)); cl_assert(state.node->all_day); // check tha...
uuid_equal(&state.pin.header.id, &earlier_item.header.id)
); cl_assert(!state.node->all_day); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[0].header.id)); cl_assert(state.node->all_day); cl_assert(!iter_next(&iterator)); cl_assert(iter_prev(&iterator)); cl_assert(!iter_prev(&iterator)); } void test_timeline__all...
/* * 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...
snprintf(app_data->result, size, "You said:\n%s", transcription)
; text_layer_set_text(app_data->result_text, app_data->result); return; } } app_data->result = malloc(100); snprintf(app_data->result, 100, "Welp, that didn't work (Error: %u).\n Try again.", result); text_layer_set_text(app_data->result_text, app_data->result); } static void prv_select_click_h...
/* * 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...
GRect(0,0,180,180)
; ScrollLayer *scroll_layer = scroll_layer_create(scroll_bounds); // Verify paging is disabled by default cl_assert_equal_b(false, prv_scroll_layer_is_paging_enabled(scroll_layer)); // Verify shadow_layer is not hidden when paging disabled cl_assert_equal_b(false, scroll_layer_get_shadow_hidden(scroll_layer)...
stem_analytics_read_bytes_count += buffer_size; // TODO: use DMA when possible // TODO: be smarter about pausing erases. Some flash chips allow concurrent // reads while an erase is in progress, as long as the read is to another bank // than the one being erased. prv_erase_pause(); new_timer_start(s_erase_s...
mutex_unlock(s_flash_lock)
; xSemaphoreGive(s_erase_semphr); // Only run the callback with no locks held so that the callback won't // deadlock if it kicks off another sector erase. on_complete_cb(context, S_NO_ACTION_REQUIRED); return 0; } analytics_inc(ANALYTICS_APP_METRIC_FLASH_SUBSECTOR_ERASE_COUNT, A...
/ Create / Clear AnalyticsHeartbeat *analytics_heartbeat_create(AnalyticsHeartbeatKind kind) { uint32_t size = sizeof(AnalyticsHeartbeat) + analytics_heartbeat_kind_data_size(kind); AnalyticsHeartbeat *heartbeat = kernel_malloc_check(size); heartbeat->kind = kind; analytics_heartbeat_clear(heartbeat); return ...
{ const Uuid *uuid = analytics_heartbeat_get_uuid(heartbeat); char uuid_buf[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(uuid, uuid_buf); PBL_LOG(LOG_LEVEL_DEBUG, "App heartbeat for %s:", uuid_buf); prv_print_heartbeat(heartbeat, ANALYTICS_APP_METRIC_START, ANALYTICS_APP_METRIC_END); break; }
default: PBL_LOG(LOG_LEVEL_DEBUG, "Unable to print heartbeat: Unrecognized kind %d", heartbeat->kind); } } #else void analytics_heartbeat_print(AnalyticsHeartbeat *heartbeat) { PBL_LOG(LOG_LEVEL_DEBUG, "Turn on ANALYTICS_DEBUG to get heartbeat printing support."); } #endif
/* * 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...
{ delay_us(1000); }
, -1032}, { 32, 104, -816}, { 16, 160, -888}, { 8, 136, -936}, { 8, 152, -944}, { 56, 136, -872}, { 8, 72, -912}, { 0, 136, -936}, { 0, 160, -952}, { 16, 96, -936}, { 24, 152, -896}, { 24, 104, -896}, // 245 seconds { 0, 88, -928}, { 8, 168, -936}, { 16, 136, ...
{ 24, 192, -920}, { 24, 192, -912}, { 16, 176, -912}, { 24, 176, -912}, { 24, 184, -912}, { 24, 192, -920}, { 32, 152, -912}, { 32, 200, -912}, { 24, 160, -904}, { 0, 152, -912}, { 8, 184, -912}, { 24, 176, -904}, { 8, 176, -912}, { 16, 176, -904}, { 16, 208, ...
(void) { if (s_outbox_buffer) { free(s_outbox_buffer); } } // Statics and Utilities static void prv_init_and_goto_session_open(void); static void prv_simulate_transport_connection_event(bool is_connected) { // FIXME: use events here instead of poking at the internals! if (is_connected) { prv_handle_c...
for (Tuple *expected_t = dict_read_first(&expected_it); expected_t != NULL; \ expected_t = dict_read_next(&expected_it)) { \ Tuple *found_t = dict_find(&s_outbox_iterator, expected_t->key); \ cl_assert(found_t); \ cl_assert_equal_i(found_t->type, expected_t->type); \ cl_assert_equal_i(f...
\ } while (0); #define EXPECT_OUTBOX_NO_MESSAGE_PENDING() \ cl_assert_equal_b(false, s_is_outbox_message_pending); #define EXPECT_OUTBOX_RESET_REQUEST() \ EXPECT_OUTBOX_MESSAGE_PENDING(TupletBytes(PostMessageKeyResetRequest, NULL, 0)); #define EXPECT_OUTBOX_RESET_COMPLETE_PENDING() \ EXPECT_OUTBOX_MESSAGE_P...
// terminates list // // For threads, we store a CoreDumpThreadInfo structure as the "chunk": // chunk_key = 'THRD' // chunk[] = { uint8_t name[16]; // includes null termination // uint32_t id; // thread id // uint8_t running; // true if this thread ...
{ CoreDumpFlashRegionHeader region_hdr; flash_read_bytes((uint8_t *)&region_hdr, flash_base, sizeof(region_hdr)); region_hdr.unread = 0; flash_write_bytes((uint8_t *)&region_hdr, flash_base, sizeof(region_hdr)); }
bool core_dump_is_unread_available(uint32_t flash_base) { if (flash_base != CORE_DUMP_FLASH_INVALID_ADDR) { // a coredump is on flash CoreDumpFlashRegionHeader region_hdr; CoreDumpImageHeader image_hdr; flash_read_bytes((uint8_t *)&region_hdr, flash_base, sizeof(region_hdr)); flash_read_bytes((uint8...
/* * 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...
notifications_migrate_timezone(utc_diff)
; wakeup_migrate_timezone(utc_diff); #endif } static time_t prv_migrate_local_time_to_UTC(time_t local_time) { return time_local_to_utc(local_time); } // Should only called by prv_update_time_info_and_generate_event()! static void prv_handle_timezone_set(TimezoneInfo *tz_info) { // Check if the timezone is set ...
/* * 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...
(result, 0)
; } // Make sure our new method for calculating battery usage matches the old one for stm32f2 /////////////////////////////////////////////////////////// static int prv_legacy_f2_calculation_millivolts(ADCVoltageMonitorReading reading) { return (int) ((reading.vmon_total * (2730) / reading.vref_total) * 295) / 256; ...
&stored_data.ble_data.pairing_info.identity.opaque)) { itr_data->irk_out = stored_data.ble_data.pairing_info.irk; strncpy(itr_data->name_out, stored_data.ble_data.name, BT_DEVICE_NAME_BUFFER_SIZE); itr_data->found = true; return false; // stop iterating } return true; // continue iterati...
info->get_key(file, (uint8_t*) &key, info->key_len)
requested."); return; } prv_enter_awaiting_reset_complete(client, false /* self_initiated */); } // ------------------------------------------------------------------------------------------------- static void prv_handle_reset_complete(PPoGATTClient *client, const PPoGATTPacket *packet, ...
if (sn == prv_prev_sn(client->out.next_expected_ack_sn)) { // Data we had sent got dropped causing the other side to re-ACK the last data it had received. // Don't roll back directly to avoid creating an Sorcerer's Apprentice bug // https://en.wikipedia.org/wiki/Sorcerer%27s_Apprentice_Syndrome // We'll...
/* * 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...
kino_reel_destroy(music_glance->icon)
; // Set the new icon and record its resource ID // TODO PBL-38539: Switch from using a regular resource ID to using a TimelineResourceId music_glance->icon = kino_reel_create_with_resource(new_icon_resource_id); PBL_ASSERTN(music_glance->icon); music_glance->icon_resource_id = new_icon_resource_id; } stati...
time_state_exact(TICKS_IN_AN_INTERVAL - (RTC_TICKS_HZ - (before_ticks % RTC_TICKS_HZ)), ticks_to_time(s_coarse_ticks)); //save_rtc_time_state(0); } void rtc_init(void) { periph_config_acquire_lock(); rtc_enable_backup_regs(); periph_config_release_lock(); restore_rtc_time_state(); initialize_fast_mode_sta...
(RTC_Format_BIN, RTC_Alarm_A, &alarm_config)
; RTC_ITConfig(RTC_IT_ALRA, ENABLE); RTC_AlarmCmd(RTC_Alarm_A, ENABLE); RTC_ClearFlag(RTC_FLAG_ALRAF); EXTI_ClearITPendingBit(EXTI_Line17); RTC_ClearITPendingBit(RTC_IT_ALRA); } RtcTicks rtc_alarm_get_elapsed_ticks(void) { return rtc_get_ticks() - s_alarm_set_time; } bool rtc_alarm_is_initialized(void) ...
the License for the specific language governing permissions and * limitations under the License. */ #include "layer.h" #include "layer_private.h" #include "applib/app_logging.h" #include "applib/applib_malloc.auto.h" #include "applib/graphics/graphics.h" #include "applib/ui/recognizer/recognizer.h" #include "appli...
prv_layer_tree_traverse_next(stack, max_depth, current_depth, descend)
; } void layer_render_tree(Layer *node, GContext *ctx) { // NOTE: make sure to restore ctx->draw_state before leaving this function const GDrawState root_draw_state = ctx->draw_state; uint8_t current_depth = 0; // We render our layout tree using a stack as opposed to using recursion to optimize for task // ...
ed_prf_storage_store_bt_classic_pairing_data(addr, device_name, link_key, platform_bits); #else prv_lock_pending_bonding(); { shared_prf_storage_erase_bt_classic_pairing_data(); prv_load_bt_classic_pairing_data(&s_pending_bondings.pending_data.bt_classic_data, addr, devi...
regular_timer_is_scheduled(&s_shared_prf_writeback_timer)
) { regular_timer_remove_callback(&s_shared_prf_writeback_timer); s_shared_prf_writeback_timer.cb(NULL); } } //! For unit tests RegularTimerInfo *shared_prf_storage_get_writeback_timer(void) { return &s_shared_prf_writeback_timer; }
(iter_prev(&iterator))
; cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__multiday(void) { TimelineItem multiday_item = { .header = { .id = {0x29, 0xac, 0xd8, 0xb5, 0x9, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x3, 0x64, 0xd0, 0x5b, 0x...
/* * 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...
memcpy(c->cache + i * c->item_size, item, c->item_size)
; } } void circular_cache_flush(CircularCache *c) { // This assumes that the user of this library can differentiate empty entries in the cache from // valid ones. for (int i = 0; i < c->total_items; i++) { uint8_t* item = prv_get_item_at_index(c, i); if (c->item_destructor) { c->item_destructor(i...
{ 1800, 672, -96}, { 1728, 384, 72}, { 1480, 312, -24}, { 1432, 288, -112}, { 1456, 360, 184}, { 1344, 344, 272}, { 1360, 280, 40}, { 1296, 264, -120}, { 1464, 408, 24}, { 1000, 584, 216}, { 1080, 568, -40}, { 968, 504, -16}, // 92 seconds { 992, 528, -24}, { 1...
{ 824, 128, 32}, { 1072, 168, 88}, { 1128, 256, -8}, { 936, 344, -200}, { 1096, 296, -128}, { 1488, 472, -112}, { 944, 800, 136}, { 1312, 192, -88}, { 1176, 184, -96}, { 1000, 456, -104}, { 1160, 512, -48}, { 1432, 528, 48}, { 1576, 472, 248}, { 1720, 472, 80}, ...
{ 1064, 448, 40}, // 100 seconds { 1208, 448, 136}, { 1600, 400, 152}, { 1544, 280, 104}, { 1512, 128, 232}, { 1512, -40, 200}, { 1312, -80, 64}, { 1072, 0, -8}, { 824, 24, -8}, { 872, 24, 32}, { 1064, 80, 80}, { 816, 96, 24}, { 1120, 0, 8}, { 1120, -80, 112}...
bool is_gateway, const char *device_name, bool requires_address_pinning, uint8_t flags) { if (!new_pairing_info || sm_is_pairing_info_empty(new_pairing_info)) { return BT_BONDING_ID_INVALI...
{ BtPersistBondingData deleted_data; if (!prv_delete_pairing_with_type_by_id(bonding, BtPersistBondingTypeBLE, &deleted_data)) { return; } prv_remove_ble_bonding_from_bt_driver(&deleted_data); prv_call_ble_bonding_change_handlers(bonding, BtPersistBondingOpWillDelete); // TODO: Make sure this matches ...
// "555-555-5555" 0x00}; phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg)); fake_system_task_callbacks_invoke_pending(); prv_assert_last_event(PhoneEventType_Incoming, true /* check_cookie */, true /* check_name_number */, "", "555-555-5555"); } void te...
prv_assert_last_event(PhoneEventType_End, false /* check_cookie */, false /* check_name_number */, NULL, NULL)
; } void test_phone_pp__get_phone_call_state_response_one_started_call(void) { pp_get_phone_state_set_enabled(true); uint8_t pp_msg[] = {0x83, 0x05, 0x08, 0x1a, 0xd4, 0x77, 0x08}; phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg)); fake_system_task_callbacks_invoke_pending(); prv_assert_last_even...
; prv_stop_fly_dot(data); break; default: WTF; } } static void prv_set_mic_window_state(VoiceUiData *data, VoiceUiState state) { bool defer_transition; state = prv_get_next_state(data->state, state, &defer_transition); if (!defer_transition) { prv_do_transition(data, state); } d...
kino_reel_scale_segmented_set_bounce_effect(icon_reel, UNFOLD_BOUNCE_AMOUNT)
; kino_layer_init(&data->mic_window.icon_layer, &icon_frame); // do not clip bounds of window - animated icon will be hidden when it's not within the // visible bounds kino_layer_set_reel(&data->mic_window.icon_layer, icon_reel, true); kino_layer_set_callbacks(&data->mic_window.icon_layer, (KinoLay...
s_cleanup_count = 0; static uint8_t s_write_buffer[1024]; static uint16_t s_write_length; static bool s_prepare_return_null = false; static Receiver * prv_system_test_receiver_prepare(CommSession *session, const PebbleProtocolEndpoint *endpoint, ...
(MetaResponseCodeUnhandled)
params, Line* line, GRect cursor, const Codepoint codepoint); void render_chars_char_visitor_cb(GContext* ctx, const TextBoxParams* const text_box_params, Line* line, GRect cursor, const Codepoint codepoint) { if (codepoint_is_zero_width(codepoint...
prv_codepoint_get_horizontal_advance(&ctx->font_cache, text_box_params->font, current_codepoint)
; } // Trim trailing whitespace if (last_visited_char) { while ((current_codepoint == NEWLINE_CODEPOINT || current_codepoint == SPACE_CODEPOINT)) { // Newlines should not adjust the width if (current_codepoint == NEWLINE_CODEPOINT) { next_glyph_width_px = 0; } else { next_gl...
}, // 780: Local time: 2015-11-15 09:40:00 AM { 0, 0x46, 20, 199, 0}, { 0, 0x46, 6, 198, 0}, { 0, 0x46, 24, 198, 0}, { 0, 0x46, 358, 199, 0}, { 0, 0x46, 505, 197, 0}, { 0, 0x46, 5, 196, 0}, { 0, 0x46, 0, 196, 0}, { 0, 0x47, 339, 199, 0}, { 0, 0x56, 2127, 202, 0}, { 0, 0x56, 7...
{ 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, // 885: Local time: 2015-11-15 11:25:00 AM { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, ...
{ 0, 0x48, 0, 142, 0}, { 0, 0x48, 0, 141, 0}, { 0, 0x48, 0, 142, 0}, { 0, 0x48, 0, 141, 0}, { 0, 0x48, 0, 141, 0}, { 0, 0x48, 0, 141, 0}, { 0, 0x48, 0, 141, 0}, { 0, 0x48, 0, 141, 0}, { 0, 0x48, 0, 141, 0}, { 0, 0x48, 0, 141, 0}, // 945: Local time: 2015-11-15 12:26:00 PM ...