prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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...
app_outbox_service_is_message_cancelled(outbox_message)
; if (is_cancelled) { static const uint32_t s_zeroes = 0; *data_out = (const uint8_t *)&s_zeroes; return sizeof(s_zeroes); } const AppMessageAppOutboxData *outbox_data = (const AppMessageAppOutboxData *)outbox_message->data; read_pointer = (outbox_data->payload - sizeof(Pebble...
2, 360, -936}, { -232, 376, -936}, { -256, 336, -912}, { -240, 336, -920}, { -224, 392, -952}, { -248, 368, -928}, { -248, 312, -936}, // 245 seconds { -240, 352, -936}, { -232, 360, -928}, { -232, 328, -936}, { -240, 344, -928}, { -232, 344, -920}, { -232, 344, -936}...
{ -224, 376, -920}, { -232, 376, -936}, { -232, 352, -936}, { -216, 352, -936}, { -216, 368, -912}, { -224, 376, -928}, { -224, 376, -936}, { -224, 360, -944}, { -224, 392, -952}, { -224, 344, -920}, { -224, 344, -904}, { -216, 368, -944}, { -224, 368, -944}, { -2...
{ -232, 360, -928}, { -232, 360, -936}, { -232, 336, -936}, { -240, 312, -936}, { -232, 352, -944}, { -232, 352, -936}, { -224, 344, -920}, { -232, 336, -936}, { -240, 352, -936}, // 253 seconds { -232, 352, -936}, { -232, 344, -936}, { -232, 344, -944}, { -224, ...
ces/normal/timeline/item.h" #include "util/size.h" #include "clar.h" // Stubs //////////////////////////////////// #include "fake_rtc.h" #include "stubs_fonts.h" #include "stubs_layout_layer.h" #include "stubs_passert.h" #include "stubs_logging.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #includ...
attribute_get_buffer_size_for_serialized_attributes(3, &cursor, (uint8_t *)s_invalid_serialized_attribute_list + sizeof(s_invalid_serialized_attribute_list))
; cl_assert(result < 0); } void test_timeline_item__deserialize_payload(void) { size_t buf_size = 18 + 9 + 64 + 8 + 5 + 5; char *buffer; TimelineItem *item = timeline_item_create(3, 2, (uint8_t[]) {1, 2}, buf_size, (uint8_t **)&buffer); timeline_item_deserialize_payload(item, buffer, buf_size, s_payload_comp...
rtos_tick_count) { // We rolled over! Note this will happen every 2^32 / 1024 (tick rate) seconds, which is about // 49 days. If this function doesn't get called for 49 days we'll miss a rollover but that's // extremely unlikely. TickType_t rollover_amount = -1; s_coarse_ticks += rollover_amount; ...
{ // Fix up the underlying registers so we don't have to do this again. rtc_set_time(*out_seconds); }
} time_t rtc_get_time(void) { time_t seconds; uint16_t ms; rtc_get_time_ms(&seconds, &ms); return seconds; } //! Tracks whether we've successfully initialized the wakeup functionality static bool s_rtc_wakeup_initialized = false; static const int RTC_WAKEUP_HZ = LSE_FREQUENCY_HZ / 2; void rtc_alarm_ini...
se 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, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific langua...
{ return_status = FLASH_ERROR_OPERATION; }
} void test_system_flash__handle_erase_error_mid_operation(void) { int countdown = 3; cl_assert(!system_flash_erase(FLASH_BASE, 512 KiB, error_in_middle_cb, &countdown)); cl_assert(flash_locked); cl_assert_(countdown <= 0, "Callback not called enough times"); } void malloc_flash_data(uint32_t si...
/* * 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...
strcspn(testbuf, "H")
, 0); }
6}, { 760, 256, -136}, { 704, 240, -104}, { 736, 264, -56}, { 888, 304, -120}, { 1088, 368, -176}, { 1120, 408, -264}, { 1080, 424, -256}, { 1040, 376, -240}, { 1064, 400, -296}, { 888, 392, -264}, { 1000, 336, -240}, { 1216, 288, -128}, { 1336, 272, 0}, { 1272, 2...
{ 896, 144, 24}, { 912, 168, -16}, // 59 seconds { 976, 160, -48}, { 1064, 192, -120}, { 1024, 184, -120}, { 1048, 176, -112}, { 1224, 192, -96}, { 1280, 264, -80}, { 1128, 312, -72}, { 912, 336, -128}, { 792, 328, -144}, { 760, 320, -128}, { 784, 304, -96}, {...
{ 1232, 168, -80}, { 1456, 280, -104}, { 1344, 368, -104}, { 1048, 392, -136}, { 784, 336, -168}, { 704, 280, -152}, { 728, 232, -80}, { 784, 256, -56}, { 904, 296, -144}, { 1080, 352, -176}, { 1104, 432, -256}, // 62 seconds { 1080, 488, -288}, { 1152, 480, -296...
cus(bool in_focus) { LauncherAppWindowData *data = app_state_get_user_data(); if (in_focus) { launcher_menu_layer_set_selection_animations_enabled(&data->launcher_menu_layer, true); } } static void prv_will_focus(bool in_focus) { LauncherAppWindowData *data = app_state_get_user_data(); if (!in_focus) { ...
{ LauncherAppWindowData *data = app_zalloc_check(sizeof(*data)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("Launcher Menu")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .unl...
static void prv_main(void) { const LauncherMenuArgs *args = (const LauncherMenuArgs *)app_manager_get_task_context()->args; // Reset the selection state of the launcher if we're visiting it for the first time or if // it has been more than RETURN_TIMEOUT_TICKS since we were last in the launcher if (args && ar...
istributed 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 "apps/watch/kickstart/kickstart.h" #include "popups/timeline/peek.h" #include "applib/ui/win...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_kickstart__render_steps_below_typical(void) { prv_set_data(&s_data, 5543, 6500, 8000, 0); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_kickstart__render_steps_above_daily_avg(vo...
ual_i(shared_prf_storage_get_valid_page_number(), (i + 1) % SPRF_NUM_PAGES); } // Check if our old information is still in tact after looping and rewriting a ton of times char device_name_out[BT_DEVICE_NAME_BUFFER_SIZE]; // Check pairing info SMPairingInfo pairing_info_out; bool requires_address_pinning ...
shared_prf_storage_get_valid_page_number()
) + offsetof(SharedPRFData, ble_pairing_data) + offsetof(SprfBlePairingData, crc), sizeof(new_crc)); // Confirm new CRC was written flash_read_bytes((uint8_t *)&data, SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()), ...
t_obstruction_origin_y())) { PBL_LOG(LOG_LEVEL_ERROR, "App state configuration failed"); return false; } // The remaining space in app_segment is assigned to the app's heap. // app_state needs to be configured before initializing the app heap // as the AppState struct holds the app heap's Heap object. ...
{ // Back button may have been held down when this app quits. launcher_cancel_force_quit(); // Always notify the phone that the application is not running app_run_state_send_update(&s_app_task_context.app_md->uuid, NOT_RUNNING); // Perform generic process cleanup. Note that s_app_task_context will be cleane...
// --------------------------------------------------------------------------------------------- //! On watchface crashes, we want to signal to the user that the watchface has crashed so that //! they understand why are being jettisoned into the launcher. static void prv_app_show_crash_ui(AppInstallId install_id) { ...
{ printf("Testing that we can update a setting file in place\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_in_place", 4096)); uint8_t key[4]; int key_len = sizeof(key) - 1; memcpy(key, "key", sizeof(key)); uint8_t val[4] = {0x11, 0x22, 0x33, 0x44}; int val_len = sizeof(val)...
// Test that we successfully detect and reallocate a settings file if it gets opened with // a larger requested size. void test_settings_file__reallocate_larger(void) { printf("\nTesting re-allocating a settings file to a larger size\n"); const int k_initial_size = 0x1000; const int k_larger_size = 0x4000; S...
d test_blob_db_endpoint__handle_insert_command_smallest_length(void) { // Process Command uint8_t *resp_ptr = process_blob_db_command(s_insert_cmd_smallest_length, sizeof(s_insert_cmd_smallest_length)); // Check Response cl_assert(0 < *(uint16_t*)resp_ptr); resp_ptr += sizeof(uint16_t); cl_assert(BLOB_DB...
((cmd_ptr - s_invalid_operation_cmd) == sizeof(s_invalid_operation_cmd))
; // Process Command uint8_t *resp_ptr = process_blob_db_command(s_invalid_operation_cmd, sizeof(s_invalid_operation_cmd)); // Check Response cl_assert(token == *(uint16_t*)resp_ptr); resp_ptr += sizeof(uint16_t); cl_assert(BLOB_DB_INVALID_OPERATION == *resp_ptr); resp_ptr += sizeof(uint8_t); cl_as...
/* * 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...
{ BLEAppState *ble_app_state = app_state_get_ble_app_state(); if (!ble_app_state->scan_handler) { return (BTErrnoInvalidState); } const bool result = sys_ble_scan_stop(); if (!result) { return BTErrnoOther; } event_service_client_unsubscribe(&ble_app_state->scan_service_info); ble_app_state->sca...
bool ble_scan_is_scanning(void) { return sys_ble_scan_is_scanning(); }
/* * 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...
(true /* write erase headers */)
; load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); } void t...
{ -448, -304, -112}, { -496, -200, -480}, { -808, 152, -496}, { -920, 248, -624}, { -1008, 288, -632}, { -1136, -168, -232}, { -1760, 312, -720}, { -1328, 32, -184}, { -1120, 192, -320}, { -840, 304, -336}, { -648, 32, 32}, { -520, 64, -16}, { -440, -112, 80}, { -...
{ -656, 328, -112}, { -656, 200, 72}, { -632, 240, 8}, { -664, 32, 288}, { -800, 128, 48}, { -920, 24, 56}, { -1064, 120, 40}, { -1304, 248, 8}, { -1456, 80, 88}, { -960, 248, -176}, // 26 seconds { -1408, 368, -392}, { -1192, 112, -32}, { -896, 120, -232}, { ...
_layer->layer.bounds); } if (text_layer->text && strlen(text_layer->text) > 0) { graphics_context_set_text_color(ctx, get_native_color(text_layer->text_color)); graphics_draw_text(ctx, text_layer->text, text_layer->font, text_layer->layer.bounds, text_layer->overflow_mode, text_layer-...
{ if (text_layer == NULL || overflow_mode == text_layer->overflow_mode) { return; } text_layer->overflow_mode = overflow_mode; layer_mark_dirty(&(text_layer->layer)); }
void text_layer_legacy2_set_font(TextLayerLegacy2 *text_layer, GFont font) { if (text_layer == NULL || font == text_layer->font) { return; } text_layer->font = font; layer_mark_dirty(&(text_layer->layer)); } void text_layer_legacy2_set_should_cache_layout(TextLayerLegacy2 *text_layer, ...
X(0xa9a9a9)}, inconsistent with Pebble color {"darkkhaki", GColorARGB8FromHEX(0xbdb76b)}, {"darkmagenta", GColorARGB8FromHEX(0x8b008b)}, {"darkolivegreen", GColorARGB8FromHEX(0x556b2f)}, {"darkorange", GColorARGB8FromHEX(0xff8c00)}, {"darkorchid", GColorARGB8FromHEX(0x9932cc)}, {"darkred", GColorARGB8FromHE...
(0xdda0dd)
}, {"powderblue", GColorARGB8FromHEX(0xb0e0e6)}, {"rosybrown", GColorARGB8FromHEX(0xbc8f8f)}, {"royalblue", GColorARGB8FromHEX(0x4169e1)}, {"saddlebrown", GColorARGB8FromHEX(0x8b4513)}, {"salmon", GColorARGB8FromHEX(0xfa8072)}, {"sandybrown", GColorARGB8FromHEX(0xf4a460)}, {"seagreen", GColorARGB8FromHEX(...
22); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_odd_cols_no_clip"))); // Test to make sure drawin...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_odd_cols_no_clip")))
; // Test to make sure drawing on all cols creates checkerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bi...
bytes_read); bytes_remaining -= bytes_read; } exit: if (got_session_file) { prv_release_session_file(session); } if (!success) { PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage for session %d", session->comm.session_id); dls_storage_delete_logging_storage(session); } re...
{ consumed_bytes = -1; // error goto exit; }
bool reset_read_offset = (num_bytes == 0); while (reset_read_offset || consumed_bytes < num_bytes) { DLSChunkHeader chunk_hdr; // Reached the end of the file? if (logging_session->storage.read_offset >= logging_session->storage.write_offset) { break; } if (!prv_pfs_seek(logging_session...
t be evaluated manager.active_layer = &layer_a; cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {2, 3}, 2, &s_recognizers_handled); // Recognizers attached to active layer will be processed before those attached to their ancestors ...
(r1->state, RecognizerState_Failed)
; r1->state = RecognizerState_Possible; recognizer_set_simultaneous_with(r1, prv_simultaneous_with_cb); cl_assert(prv_fail_recognizer(r1, &ctx)); cl_assert_equal_i(r1->state, RecognizerState_Possible); cl_assert(ctx.recognizers_active); } void prv_cancel_layer_tree_recognizers(RecognizerManager *manager, ...
/* * 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 (notifications_glance) { strncpy(buffer, notifications_glance->subtitle, buffer_size); buffer[buffer_size - 1] = '\0'; }
} static GTextNode *prv_create_subtitle_node(LauncherAppGlanceStructured *structured_glance) { return launcher_app_glance_structured_create_subtitle_text_node( structured_glance, prv_notifications_glance_subtitle_dynamic_text_node_update); } static void prv_destructor(LauncherAppGlanceStructured *structured_...
acheEntry; ////////////////////////////////////// // KinoPlayer callbacks static void prv_glance_reel_player_frame_did_change_cb(KinoPlayer *player, void *context) { LauncherAppGlanceService *service = context; launcher_app_glance_service_notify_glance_changed(service); } /////////////////////////// // Slice exp...
kino_player_get_reel(glance_reel_player)
)) { kino_player_set_reel(glance_reel_player, NULL, false /* take_ownership */); } } launcher_app_glance_destroy(entry->glance); app_free(entry); } static bool prv_glance_cache_deinit_foreach_cb(ListNode *node, void *context) { LauncherAppGlanceService *service = context; LauncherAppGlanceCacheEnt...
include "uart_definitions.h" #include "drivers/uart.h" #include "drivers/dma.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "system/passert.h" #include "FreeRTOS.h" #define STM32F7_COMPATIBLE #include <mcu.h> #include <mcu/interrupts.h> // The STM32F2 standard peripheral library uses a pre...
(dev->state->initialized)
; // wait for us to be ready to send while (!uart_is_tx_ready(dev)) continue; dev->periph->TDR = data; } uint8_t uart_read_byte(UARTDevice *dev) { // explicitly clear the error flags to match up with F4 behavior prv_clear_all_errors(dev); // read the data regardless since it will clear interrupt flags ...
/* * 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...
{ return false; }
uint8_t* src = (uint8_t*) hex_str; uint8_t* dest = bd_addr + bd_addr_size - 1; for (unsigned int i = 0; i < bd_addr_size; ++i, src += 2, --dest) { *dest = ascii_hex_to_uint(src[0], src[1]); } return true; } uint32_t next_exponential_backoff(uint32_t *attempt, uint32_t initial_value, uint32_t max_valu...
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...
cl_assert_equal_i(start.month, 2)
onday_sleepData"; // insert one cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_sleep_data, sizeof(s_sleep_data)), S_SUCCESS); // check int32_t val_out; cl_assert(health_db_get_typical_value(ActivityMetricSleepTotalSeconds...
health_db_get_typical_value(ActivityMetricHeartRateZone3Minutes, Monday, &val_out)
); } void test_health_db__step_averages(void) { const struct { const char *key; const char *val; } entries[] = { { .key = "sunday_steps", .val = "l4tHpFsFGE6UINneFPMnf2lgINlYuXlDS6xh6vizK9jbDen5mHQgWF6E8jOzBVnEdV0j2DNOzONfJbsWoSWH0QoQpPmm1NSW" \ "l4tHpFsFGE6UINneFPMnf2lgINlYuXl...
96, -200}, // 102 seconds { 1160, 128, 128}, { 880, 192, 272}, { 960, 304, 88}, { 912, 304, 192}, { 864, 312, 112}, { 816, 296, 16}, { 928, 384, -96}, { 1088, 304, -104}, { 1160, 208, 32}, { 1600, 272, 64}, { 1720, 328, 120}, { 1064, 232, 88}, { 1064, 176, 104}, ...
return samples; }
// ---------------------------------------------------------------- // Sample captured: 2015-09-29 15:30:07 local AccelRawData *activity_sample_walk_200_pbl_25297_12(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25297_12 //> TEST_EXPECTED 200 //>...
WeekdayScheduleEnabled", }, [WeekendSchedule] = { .schedule_pref_key = "dndWeekendSchedule", .enabled_pref_key = "dndWeekendScheduleEnabled", } }; static void prv_migrate_legacy_dnd_schedule(SettingsFile *file) { // If Weekday schedule does not exist, assume that the other 3 settings files are missing ...
prv_return_default_if_invalid(s_vibe_score_alarms, DEFAULT_VIBE_SCORE_ALARMS)
; } static void prv_set_vibe_scores_based_on_legacy_intensity(VibeIntensity intensity) { if (intensity == VibeIntensityHigh) { s_vibe_score_notifications = VibeScoreId_StandardShortPulseHigh; s_vibe_score_incoming_calls = VibeScoreId_StandardLongPulseHigh; s_vibe_score_alarms = VibeScoreId_StandardLongPu...
tate; static DMARequest ICE40LP_SPI_TX_DMA_REQUEST = { .state = &s_ice40lp_spi_tx_dma_request_state, .stream = &DMA2_STREAM5_DEVICE, .channel = 1, // Use the same priority as the EXTI handlers so that the DMA-complete // handler doesn't preempt the display BUSY (INTn) handler. .irq_priority = 0x0e, .prior...
IRQ_MAP(I2C1_EV, i2c_hal_event_irq_handler, &I2C_PMIC_MAG_BUS)
/* * 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...
prv_scroll_layer_is_paging_enabled(scroll_layer)
); // Verify shadow_layer is hidden now that paging enabled cl_assert_equal_b(true, scroll_layer_get_shadow_hidden(scroll_layer)); // verify disable paging works scroll_layer_set_paging(scroll_layer, false); cl_assert_equal_b(false, prv_scroll_layer_is_paging_enabled(scroll_layer)); // verify shadow layer ...
t.8bit.pbi")); } // Tests assign, clipping, makes sure in bottom right corner. // Setup: // - Source is 10x15, black box ((0, 0), (5, 10)), rest is red. // - Dest is White, 50x50. // - Dest offset is set to 5x10 pixels in bottom right corner. // Result: // - White, with 5x10 black box in bottom right corner. v...
{ GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__8bit_src_origin_offset_wrap.8bit.pbi"); uint8_t dest_data[100*100]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 100, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { { 0, 0 }, { 10...
// // Test 1-bit to 8-bit blitting /////////////////////////////// // Setup: // - Source is 25x25. // - Source has alternating white / black lines. // - Dest is Blue, 100x100. // - Dest offset is (0,0) to blit to top left corner. // Result: // - 25x25 alternating black / white lines in top left corner. vo...
OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "menu_app.h" #include "applib/app.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "system/lo...
(data->detail_text_buffer, 50, "SELECTION:\n\nSection %i, Row %i\nLong click: %c", index->section, index->row, is_long_click ? 'Y' : 'N')
; Window *detail_window = &data->detail_window; window_init(detail_window, WINDOW_NAME("Demo Menu Detail")); window_set_user_data(detail_window, data); window_set_window_handlers(detail_window, &(WindowHandlers) { .load = detail_window_load, }); const bool animated = true; app_window_stack_push(detai...
onst int16_t label_y_offset = PBL_IF_ROUND_ELSE(40, 16); const GEdgeInsets insets = PBL_IF_ROUND_ELSE(GEdgeInsets(ACTION_BAR_WIDTH + x_margin), GEdgeInsets(0, ACTION_BAR_WIDTH + x_margin, 0, x_margin)); GRect f...
action_bar_layer_init(action_bar)
; } NumberWindow* number_window_create(const char *label, NumberWindowCallbacks callbacks, void *callback_context) { NumberWindow* window = applib_type_malloc(NumberWindow); if (window) { number_window_init(window, label, callbacks, callback_context); } return window; } static void number_window_deinit(Nu...
; // only one page in use so we don't need to cache anything } // Note: If there was more space for statics or stack space we could // put this temporary buffer there FilePageCache *fpc = kernel_malloc_check(sizeof(FilePageCache) * MAX_PAGE_CACHE_ENTRIES); memset(fpc, 0x00, sizeof(FilePageCache) * MAX_...
read_header(page, &pg_hdr, &file_hdr)
) == PageAndFileHdrValid) { File *file = &PFS_FD(fd).file; file->file_size = file_hdr.file_size; file->file_type = file_hdr.file_type; file->start_page = file->curr_page = page; return (S_SUCCESS); } PBL_LOG(LOG_LEVEL_WARNING, "Could not read header %d", hdr_rv); return (E_INTERNAL); } stati...
/* * 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(10, 20, 200, 500)
/* * 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...
app_state_get_user_data()
; gbitmap_deinit(&app_data->bitmap); app_free(app_data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* battery_critical_get_app_info() { static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = s_main, .visibility ...
/* * 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...
("t", "object")
; // ...which also has a method .on() EXECUTE_SCRIPT("var t = typeof _rocky.on"); ASSERT_JS_GLOBAL_EQUALS_S("t", "function"); /// ...which is an alias of .addEventListener() EXECUTE_SCRIPT("var a = (_rocky.on === _rocky.addEventListener);"); ASSERT_JS_GLOBAL_EQUALS_B("a", true); } void test_rocky_api_glo...
ion *action, void *context) { ChainingWindowCBData *cb_data = context; ActionResultData *data = applib_zalloc(sizeof(ActionResultData)); if (!data) { return; } data->chaining_data.action_chaining_window = chaining_window; data->chaining_data.notif = timeline_item_copy(cb_data->item); data->standalon...
(data, success)
er->common.persistent; const bool old_is_persistent = old_header->common.persistent; if (new_is_peeking != old_is_peeking) { // Peeking items always take priority return (old_is_peeking ? 1 : 0) - (new_is_peeking ? 1 : 0); } else if (old_is_peeking && (new_is_persistent != old_is_persistent)) { // Whe...
{ s_peek_event_data.show_before_time_s = before_time_s; timeline_event_refresh(); }
-152, -992}, { -168, -144, -992}, { -168, -136, -984}, { -160, -144, -984}, { -160, -144, -992}, { -168, -152, -992}, { -160, -144, -992}, { -160, -144, -1000}, { -168, -136, -992}, { -168, -152, -984}, { -160, -136, -992}, { -160, -136, -992}, { -168, -144, -984}, { ...
{ -144, -144, -1024}, { -144, -104, -992}, { -152, -104, -976}, { -160, -104, -984}, { -152, -96, -1008}, { -160, -120, -1008}, { -168, -120, -992}, { -152, -120, -1000}, { -152, -120, -1000}, { -160, -112, -984}, { -168, -112, -1000}, { -160, -128, -984}, { -144, -12...
{ -184, -144, -1008}, { -248, -280, -944}, { -168, -160, -1064}, // 265 seconds { -144, -272, -1104}, { -168, -384, -912}, { -128, -264, -776}, { -128, -64, -1032}, { -152, -184, -1000}, { -160, -120, -1072}, { -152, -184, -1064}, { -176, -160, -1096}, { -184, -152, ...
05:24:00 AM { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 148, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 144, 0}, { 0, 0x8d, 0, 147, 0}, { 0, 0x...
{ 0, 0x6a, 0, 155, 0}, { 0, 0x6a, 0, 155, 0}, { 0, 0x6a, 0, 156, 0}, { 0, 0x6a, 15, 155, 0}, { 0, 0x69, 0, 157, 0}, { 0, 0x69, 0, 152, 0}, { 0, 0x59, 785, 151, 0}, { 0, 0x9, 0, 152, 0}, { 0, 0x9, 0, 151, 0}, { 0, 0x9, 0, 168, 0}, { 0, 0x3b, 2146, 164, 0}, // 645: Local ti...
handshake signal and enter deep sleep mode. uint8_t unused; prv_read_register(HRM, ADDR_SYNC, &unused); PPG_DBG("Handshake handle done"); HRM->state->handshake_count++; PROFILER_NODE_STOP(hrm_handling); mutex_unlock(HRM->state->lock); // PPG_DBG log out each PPG data sample that we recorded for (...
if (!gpio_input_read(&dev->int_gpio)) { break; }
system_task_watchdog_feed(); psleep(1); } return (attempt < max_attempts); } // Wait for the INT line to go high. Return true if it went high before timing out static bool prv_wait_int_high(HRMDevice *dev) { const int max_attempts = 300; int attempt; for (attempt = 0; attempt < max_attempts; attempt...
8, 328, -920}, { -296, 328, -928}, // 170 seconds { -288, 328, -936}, { -296, 344, -928}, { -288, 328, -920}, { -288, 328, -920}, { -280, 328, -928}, { -288, 328, -936}, { -296, 328, -928}, { -296, 328, -920}, { -288, 336, -928}, { -296, 328, -928}, { -296, 328, -920}...
{ -288, 328, -928}, { -280, 344, -928}, { -288, 352, -920}, { -288, 352, -920}, { -280, 328, -928}, { -288, 336, -920}, { -288, 344, -928}, { -288, 344, -920}, { -272, 336, -920}, { -288, 352, -920}, { -296, 344, -936}, { -280, 320, -928}, { -288, 352, -928}, { -2...
ive_launcher_task_cb, data); } // ----------------------------------------------------------------------------- //! With iOS 8.2 the pre-existing flag seems to be broken. Don't allow notifications for a bit after //! reconnection so that all the "real" pre-existing notification don't come through again. static Regular...
(data, length)
) { // Discard data if data is not the start of a new message or we didn't request it. return; } } else { // We have stuff in sitting in the reassembly buffer; assume that this is // data we need to finish reassembling the message const bool is_success = prv_reassembly_append(data, length)...
c int s_num_timer_register_calls = 0; static int s_alarm_timer_timeout_ms = 0; static int s_snooze_timer_timeout_ms = 0; static int s_snooze_timer_id = 0; /////////////////////////////////////////////////////////////////////////////////////////////////// //! Fakes time_t rtc_get_time(void) { return s_current_day +...
alarm_create(&(AlarmInfo) { .hour = 5, .minute = 14, .kind = ALARM_KIND_WEEKDAYS })
; prv_assert_alarm_config(id, 5, 14, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); id = alarm_create(&(AlarmInfo) { .hour = 6, .minute = 14, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id, 6, 14, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); } void test_alarm__alarm_create_just_once(void) { A...
, filename, len); base[len] = '\0'; return len; } // Reset the graphics context, fill the background color and center the drawing box according to the // bounds provided static void prv_setup_context(GContext *ctx, GSize bounds) { // just a fake FB so that we can successfully call _context_init() // the actual...
{ prv_convert_sequence(filename, data, size); }
else { printf("Invalid file: %s\n", filename); } free(data); } int main(int argc, const char* argv[]) { // pdc2png file path always passed in as first argument if (argc == 1) { printf("No files specified. Pass a list of file paths to convert " "(e.g. pdc2png [path-to-file1] [path-to-file2] ......
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 in writing, software * distributed und...
(key, "key", sizeof(key))
; uint8_t val[7]; int val_len = 6; printf("Setting key 10 times and verifying we get the same value back...\n"); for (int i = 0; i < 10; i++) { snprintf((char *)val, 7, "val%03d", i); printf("Iteration %d val %s\n", i, val); set_and_verify(&file, key, key_len, val, val_len); } settings_file_cl...
int32_t x4, int32_t y4) { // Calculate all the mid-points of the line segments int32_t x12 = (x1 + x2) / 2; int32_t y12 = (y1 + y2) / 2; int32_t x23 = (x2 + x3) / 2; int32_t y23 = (y2 + y3) / 2; int32_t x34 = (x3 + x4) / 2; int32_t y34 = (y3 + y4) / 2; int32_t x123 = (x12 + x23) / 2; int3...
{ if (builder->num_points >= builder->max_points - 1) { return false; } builder->points[builder->num_points++] = to_point; return true; }
bool gpath_builder_curve_to_point(GPathBuilder *builder, GPoint to_point, GPoint control_point_1, GPoint control_point_2) { GPoint from_point = builder->points[builder->num_points-1]; return bezier_fixed(builder, from_point, control_point_1, control_point_2, to_point); }
">> Writing Addr 0x%"PRIx32" to value 0x%"PRIx16, write_addr, write_val); } flash_write_bytes((uint8_t *)&write_buffer, write_addr, sizeof(write_buffer)); // Confirm write took place read_buffer = 0; flash_read_bytes((uint8_t*) &read_buffer, write_addr, sizeof(read_buffer)); if (disp_logs) {...
{ // only erase the specific erase address if (display_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">> Erasing Addr 0x%"PRIx32, *erase_addr); } flash_erase_sector_blocking(*erase_addr); }
/* * 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...
task_timer_create(&s_task_timer_manager)
; } // -------------------------------------------------------------------------------- // Schedule a timer to run. bool new_timer_start(TimerID timer_id, uint32_t timeout_ms, NewTimerCallback cb, void *cb_data, uint32_t flags) { return task_timer_start(&s_task_timer_manager, timer_id, timeout...
t_equal_b(cancelled, false); reset = false; r->state = RecognizerState_Cancelled; recognizer_reset(r); cl_assert_equal_i(r->state, RecognizerState_Possible); cl_assert_equal_b(reset, true); cl_assert_equal_b(cancelled, false); reset = false; r->state = RecognizerState_Completed; recognizer_reset(r);...
(last_touch_event.type, TouchEvent_Liftoff)
; cl_assert_equal_b(updated, true); cl_assert_equal_i(rec_event, RecognizerEvent_Cancelled); // Should not pass touch events to recognizers that are not active cl_assert_passert(recognizer_handle_touch_event(r, &(TouchEvent) {})); // Should not pass null touch events r->state = RecognizerState_Possible; ...
/* * 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...
(&keys[SMRootKeyTypeEncryption], SMRootKeyTypeEncryption)
; prv_assert_key_is_equal_to_retrieved_key(&keys[SMRootKeyTypeIdentity], SMRootKeyTypeIdentity); } void test_ble_root_keys__regenerate_if_key_not_present(void) { // Pretend one of the root keys isn't there: cl_will_return_count(bt_persistent_storage_get_root_key, true, 1); cl_will_return_count(bt_persistent_st...
event.smartstrap.attribute = mbuf_get_data(&attr->mbuf); if (type == SmartstrapDataReceivedEvent) { PBL_ASSERTN(attr->state == SmartstrapAttributeStateRequestInProgress); prv_set_attribute_state(attr, SmartstrapAttributeStateIdle); if (attr->request_type == SmartstrapRequestTypeWrite) { // the da...
mutex_lock(s_attr_list_lock)
; SmartstrapAttributeInternal *attr; FOREACH_VALID_ATTR(attr) { // At this point, the app is closing so there's no point in freeing the buffers, and doing so // will crash the watch if the app had crashed (and the heap has already been cleaned up). prv_queue_deferred_delete(attr, false /* !do_free */); ...
utc); // Recalculate metric stats activity_insights_recalculate_stats(); // If the pin we loaded was created on the previous day, we don't bother loading the UUID const time_t midnight_today = time_util_get_midnight_of(now_utc); if (time_util_get_midnight_of(activity_pin_last_state.last_triggered_utc) == mi...
{ time_t now_utc = rtc_get_time(); for (int i = 0; i < ActivationDelayInsightTypeCount; i++) { prv_trigger_activation_delay_insight(now_utc, &ACTIVATION_DELAY_INSIGHTS[i]); } }
static void prv_test_push_walk_run_session(void *unused) { const time_t now_utc = rtc_get_time(); ActivitySession walk_session = { .type = ActivitySessionType_Walk, .start_utc = now_utc - 30 * SECONDS_PER_MINUTE - 15 * SECONDS_PER_MINUTE, .length_min = 30, .step_data = { .steps = 2400, ...
/* * 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_LR(0, lr)
; } void *os_malloc(size_t size) { return kernel_malloc(size); } void *os_malloc_check(size_t size) { return kernel_malloc_check(size); } void os_free(void *ptr) { kernel_free(ptr); }
int s_command_list_index = 0; void flash_erase_subsector_blocking(uint32_t subsector_addr) { s_command_list[s_command_list_index++] = (EraseCommand) { .addr = subsector_addr, .type = SubsectorEraseCommand }; } void flash_erase_sector_blocking(uint32_t subsector_addr) { s_command_list[s_command_list_index++] = (Er...
cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand)
; cl_assert_equal_i(s_command_list[1].addr, 64 * 1024); cl_assert_equal_i(s_command_list[1].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[2].addr, 68 * 1024); cl_assert_equal_i(s_command_list[2].type, SubsectorEraseCommand); s_command_list_index = 0; // App that's in an unaligned bank b...
ppg_data.tia[hrm->debug->ppg_data.num_samples - 1] == 0) { PBL_LOG_COLOR(LOG_LEVEL_DEBUG, LOG_COLOR_CYAN, "last PPG TIA sample is 0!"); } if (hrm->debug->ppg_data.num_samples != 20) { PBL_LOG_COLOR(LOG_LEVEL_DEBUG, LOG_COLOR_CYAN, "Only got %"PRIu16" samples!", hrm->de...
(bpm_tl, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD))
; text_layer_set_text_alignment(bpm_tl, GTextAlignmentCenter); text_layer_set_text(bpm_tl, app_data->bpm_string); layer_add_child(&window->layer, &bpm_tl->layer); bounds.origin.y += 35; TextLayer *quality_tl = &app_data->quality_text_layer; text_layer_init(quality_tl, &bounds); text_layer_set_font(qualit...
88 kcalories per day, so we expect to get: // 1388 * 1020/1440 = 1023 kcalories activity_get_metric(ActivityMetricRestingKCalories, 1, &value); const int k_bmr_cal = 1388 * ACTIVITY_CALORIES_PER_KCAL; cl_assert_equal_i(value, ROUND(k_bmr_cal * k_minute_start / MINUTES_PER_DAY, ...
(value, k_exp_steps_2)
; activity_get_metric(ActivityMetricActiveKCalories, 1, &value); // The following determined from a known good commit int32_t exp_active_kcalories_2 = 486; cl_assert_equal_i(value, exp_active_kcalories_2); // We now expect to get the following resting calories const int exp_resting_calories_2 = k_bmr_cal_...
/* * 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(LOG_LEVEL_ALWAYS, "Dialog: Rebooted due to HardFault: LR 0x%"PRIx32, reason.extra)
; break; case RebootReasonCode_StackOverflow: PBL_LOG(LOG_LEVEL_ALWAYS, "Dialog: Rebooted due to StackOverflow"); break; case RebootReasonCode_DialogPlatformReset: PBL_LOG(LOG_LEVEL_ALWAYS, "Dialog: Rebooted due to DialogPlatformReset: error 0x%"PRIx32, reason.extra); ...
R_DB_MAX_SIZE KiBYTES(40) #define MAX_REMINDER_SIZE SETTINGS_VAL_MAX_LEN #define MAX_REMINDER_AGE (15 * SECONDS_PER_MINUTE) typedef struct { TimelineItemStorageFilterCallback filter_cb; time_t timestamp; const char *title; TimelineItem *reminder_out; bool match; } ReminderInfo; static TimelineItemStorage s_...
(&s_storage, prv_timestamp_title_compare_func, &reminder_info)
; return reminder_info.match; } static status_t prv_insert_reminder(const uint8_t *key, int key_len, const uint8_t *val, int val_len, bool mark_synced) { const SerializedTimelineItemHeader *hdr = (const SerializedTimelineItemHeader *)val; const bool has_reminded = hdr->common...
app_running(dev, AS7000AppId_Loader)) { return false; } } prv_log_running_apps(dev); return true; } static uint64_t prv_get_time_ms(void) { time_t time_s; uint16_t time_ms; rtc_get_time_ms(&time_s, &time_ms); return ((uint64_t)time_s) * 1000 + time_ms; } static bool prv_wait_for_loader_ready(H...
ihex_encode(eof_record, IHEX_TYPE_EOF, 0, NULL, 0)
Test, }, .num_attributes = 3, }; static TimelineItem title_item1 = { .header = { .id = {0x9c, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .timestamp = 1, .duration = 0, .type = TimelineItemTypeReminder, .layout = LayoutIdTest, }, ...
cl_assert(memcmp(&item4, &temp, sizeof(TimelineItem)) == 0)
; cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl_assert(reminder_db_get_len((uint8_t *)&item4.header.id, sizeof(Uuid)) == 0); } else { temp.attr_list.attributes = NULL; cl_assert(memcmp(&item4, &temp, sizeof(TimelineItem)) == 0); cl_assert(S_SUCCESS == ...
sh HW was left midstream in a command from // before? prv_flash_wait_for_write_bounded(64000000); prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ_ID); uint32_t manufacturer = prv_flash_read_next_byte(); uint32_t type = prv_flash_read_next_byte(); uint32_t capacity = prv_flash_read_n...
if (((start_addr & SECTOR_ADDR_MASK) == start_addr) && (total_bytes >= SECTOR_SIZE_BYTES)) { prv_flash_erase_sector(start_addr); total_bytes -= SECTOR_SIZE_BYTES; start_addr += SECTOR_SIZE_BYTES; } else { prv_flash_erase_subsector(start_addr); total_bytes -= SUBSECTOR_SIZE_BYTES; ...
watchdog_feed(); } }
ightness, stroke_color, quadrant); // Swapping x and y for rest of the circle prv_plot4(fb, clip_box, center, GPoint(offset.y, offset.x), brightness, stroke_color, quadrant); } #if PBL_COLOR T_STATIC void graphics_circle_quadrant_draw_1px_aa(GContext* ctx, GPoint p, uint16_t radius, ...
for (; progress < stop_progress + special_case_pixels; progress++) { Fixed_S16_3 edge = (Fixed_S16_3){.raw_value = radius_fixed - prv_get_circle_border(progress, radius).raw_value}; if (edge.integer != 0) { weighting = (edge.fraction >> 1); if (edge.integer - ...
_i(3, string_list_count(list)); cl_assert_equal_s("ab", string_list_get_at(list, 0)); cl_assert_equal_s("", string_list_get_at(list, 1)); cl_assert_equal_s("", string_list_get_at(list, 2)); cl_assert_equal_s(NULL, string_list_get_at(list, 3)); // 4 strings (first and last two are empty) list->serialized_by...
malloc(sizeof(s_basic_action_list))
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, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the sp...
(&postpone_attr_list)
; attribute_list_destroy_list(&remove_attr_list); timeline_item_destroy(item); } static void prv_push_success_dialog(void) { SimpleDialog *simple_dialog = simple_dialog_create("Reminder Added"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_set_text(dialog, i18n_get("Added", dialog)); di...
); end = ((char*) start) + (heap_size * ALIGNMENT_SIZE); memset(start, 0, heap_size * ALIGNMENT_SIZE); *heap = (Heap) { .begin = start, .end = end, .fuzz_on_free = fuzz_on_free }; *(heap->begin) = (HeapInfo_t) { .PrevSize = heap_size, .is_allocated = false, .Size = heap_size }; } ...
if(heap_info_ptr != heap->begin) { /* Calculate the pointer to the previous segment. */ HeapInfo_t *previous_block = get_previous_block(heap, heap_info_ptr); HEAP_ASSERT_SANE(heap, previous_block->Size == heap_info_ptr->PrevSize, heap_info_ptr); /* Check to see if the previous segment c...
/* Calculate the pointer to the next segment. */ HeapInfo_t *next_block = get_next_block(heap, heap_info_ptr); /* If we are pointing at the end of the heap, then use the */ /* begin as the next segment. */ if(next_block == heap->end) { /* We can...
r_calls.num_calls < 2) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("rescheduled count: %d\n", s_stopped_handler_calls.num_calls); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, layer.frame.size.w, ...
{ prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("rescheduled count: %d\n", s_stopped_handler_calls.num_calls); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, layer.frame.size.w, layer.frame.size.h); ...
// Make sure we detected a reset of the elapsed after rescheduling cl_assert(s_stopped_handler_calls.num_calls == 2); cl_assert(detected_reset_of_elapsed); // Make sure the frame reached the "to" state cl_assert_equal_point(layer.frame.origin, to_r.origin); // This should return a NULL context now if th...
const AnimationProgress progress) { PropertyAnimationPrivate *property_animation = (PropertyAnimationPrivate *)animation; if (property_animation) { layer_set_frame(property_animation->subject, &property_animation->values.to.grect); } } static const PropertyAnimationImp...
fake_graphics_context_get_context()
#include "8bit/test_framebuffer.h" #else #include "1bit/test_framebuffer.h" #endif // Stubs //////////////////////////////////// #include "graphics_common_stubs.h" #include "stubs_applib_resource.h" static FrameBuffer *fb = NULL; // Setup void test_graphics_draw_line__initialize(void) { fb = malloc(sizeof(Fra...
TEST_NAMED_PBI_FILE("draw_line_across_x_offset_layer")
// Make a local copy of dict since ios_notif_pref_db_insert() modifies val uint8_t val[sizeof(s_ios_pref_db_insert_dict)]; memcpy(val, s_ios_pref_db_insert_dict, sizeof(s_ios_pref_db_insert_dict)); ios_notif_pref_db_insert(key, sizeof(key), val, sizeof(val)); SettingsFile file; settings_file_open(&file, i...
strlen(values[0])
mples: %s", state->test_entry.name); continue; } // Look for and parse the expected values if (strcmp(token, "//>") == 0) { token = strtok(NULL, " \t\n"); if (strcmp(token, "TEST_VERSION") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.version); } else i...
strlen(CLAR_FIXTURE_PATH)
rn (att_error_t)PebblePairingServiceGATTError_ConnParamsMaxSlotsTooLarge; } if (settings->connection_parameter_sets[i].supervision_timeout_30ms * 30 < LL_SUPERVISION_TIMEOUT_MIN_MS) { return (att_error_t)PebblePairingServiceGATTError_ConnParamsSupervisionTimeoutTooSmall; } } } ...
{ rv = prv_handle_conn_params_write(evt); }
else { PBL_LOG(LOG_LEVEL_ERROR, "Writing unhandled handle: %u !", evt->handle); } ble_error_t e = ble_gatts_write_cfm(evt->conn_idx, evt->handle, rv); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_write_cfm: %u", e); } } void pebble_pairing_service_handle_status_change(Connection *co...
//////////////////////////////////////////////////////////////////////////////////////////////// // app_inbox_service_cancel void test_app_inbox__app_inbox_service_cancel(void) { prv_create_test_inbox_and_begin_write(); // Start writing a message that occupies the complete buffer, then cancel it: cl_assert_equa...
assert_num_message_callbacks(2)
; assert_message(0, s_test_data, 1); assert_message(1, s_test_data, 1); // Should be able to write (BUFFER_SIZE) again, // because the message 1 and 2 are consumed now: cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s...
/* * 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(size_bytes); Buffer* b = kernel_malloc_check(sizeof(Buffer) + size_bytes); *b = (Buffer) { .length = size_bytes, .bytes_written = 0, }; return b; }
void buffer_init(Buffer * const buffer, const size_t length) { buffer->bytes_written = 0; buffer->length = length; } void buffer_clear(Buffer * const buffer) { buffer->bytes_written = 0; } bool buffer_is_empty(Buffer * const buffer) { return buffer->bytes_written == 0; }
ool kino_reel_scale_segmented_set_delay_by_distance(KinoReel *reel, GPoint target) { return false; } // Helper Functions ///////////////////// #include "../graphics/test_graphics.h" #include "../graphics/util.h" // Setup and Teardown //////////////////////////////////// static FrameBuffer *fb = NULL; static GBit...
(dialog, GColorRed)
; char buffer[25]; snprintf(buffer, sizeof(buffer), "%d%% Battery", percent); dialog_set_text(dialog, buffer); dialog_set_icon(dialog, RESOURCE_ID_BATTERY_ICON_LOW_LARGE); prv_push_and_render_simple_dialog(dialog); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_simple_dialog__ping(voi...
ate->in_buffer, (void *)&this->filter->RDATAR, sizeof(this->state->in_buffer), prv_dma_handler, (void *)this); } static void prv_dfsdm_disable(MicDevice *this) { // Disable DMA and DFSDM dma_request_stop(this->dma); DFSDM_ChannelCmd(this->channel, DISABLE); DFSDM_Cmd(DISABLE); p...
{ this->state->subscriber.callback(this->state->subscriber.buffer, this->state->subscriber.idx, this->state->subscriber.context); this->state->subscriber.idx = 0; }
ap to get a sub-bitmap that starts at y = 2 // Result: // - A 48 x 50 black box starting at y=2 in dest, rest is blue. void test_bitblt__bitmap_into_bitmap_sub_bitmap(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__bitmap_into_bitmap_sub_bitmap.8bit.pbi"); GBitmap cropped_src_bitmap; gbitmap_i...
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorBlack)
; cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_black_on_white-expect.1bit.pbi")); // Destination Black memset(dest_data, 0b00000000, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorClear); cl_check(gbitmap_pbi_eq(&dest_bitma...
WordIterState word_iter_state = (WordIterState) { 0 }; Line line = (Line) { 0 }; // Allocate immutable types bool success = false; const char *sentence = "Foo bar"; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, sentence); cl_assert(success); const TextBoxParams text_box_params = (TextBoxPara...
cl_assert(line.width_px == 2 * HORIZ_ADVANCE_PX)
; cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 2 * HORIZ_ADVANCE_PX); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(!lin...
scribe again: e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoInvalidState); fake_kernel_malloc_mark_assert_equal(); prv_assert_no_event(); } void test_gatt_client_subscriptions__unsubs...
prv_assert_subscription_event(characteristic, BLESubscriptionIndications, BLEGATTErrorSuccess, true /* kernel */, false /* app */)
; } void test_gatt_client_subscriptions__subscribe_not_first_subscriber(void) { BLECharacteristic characteristic = prv_get_indicatable_characteristic(); // Subscribe kernel: BTErrno e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, ...
{ 1896, 216, -32}, { 1592, 352, -120}, { 1112, 440, -208}, { 1104, 48, -16}, { 928, 128, 144}, { 912, 128, 216}, { 872, 216, 264}, { 864, 312, 248}, { 792, 392, 144}, { 776, 336, 72}, { 864, 336, -16}, { 1008, 248, -8}, { 1184, 264, -64}, { 1336, 256, -24}, { 1896...
{ 1000, 80, 280}, { 984, 208, 264}, { 872, 424, 120}, { 800, 384, 32}, { 848, 320, 0}, { 928, 304, 0}, { 1096, 368, -64}, { 1280, 368, -8}, { 1904, 424, 168}, { 1800, 480, 240}, { 992, 344, 16}, { 1160, 272, 56}, { 1544, 152, 240}, { 1320, 40, 320}, { 1040, 0,...
{ 1096, -16, 304}, { 976, 24, 120}, // 58 seconds { 792, 8, 80}, { 672, 0, 88}, { 592, -48, 72}, { 552, -40, -24}, { 680, -16, -80}, { 1008, 8, -56}, { 1808, -224, 352}, { 2104, 96, 456}, { 1344, 680, -288}, { 1112, 432, -168}, { 1024, 264, 192}, { 928, 56, 2...
into the first child animation->delay_ms = 0; int32_t child_position_inc_delay = prv_get_elapsed(child, now) + child->delay_ms; earliest_start_time = now - child_position_inc_delay; delay = serial_distance32(now, earliest_start_time + duration); } else { success = prv_sched...
(now, earliest_start_time)
; } // Schedule the parent node prv_schedule_low_level_animation(state, now, animation, add_delay_ms); return success; } static AnimationProgress prv_get_distance_normalized(const AnimationPrivate *animation, AnimationProgress time_normalized_raw) { Anim...
0, 160}, { -1152, 336, 112}, { -1088, 256, 168}, { -1024, 208, 216}, { -944, 264, 216}, // 36 seconds { -872, 288, 224}, { -848, 320, 216}, { -1136, 552, 456}, { -984, 464, 384}, { -1240, 296, 288}, { -1072, 528, 152}, { -1064, 480, 144}, { -1208, 440, 136}, { -14...
{ -1488, 880, -104}, { -1280, 560, 56}, { -1320, 552, 120}, { -1480, 576, 160}, { -1336, 472, 128}, { -1112, 504, 136}, { -1104, 440, 216}, { -1088, 440, 160}, { -1064, 352, 144}, { -864, 352, 104}, { -800, 616, 208}, { -928, 536, 200}, { -1368, 392, 288}, { -1344...
{ -1248, 56, 296}, { -1256, 472, 344}, { -1072, 552, 232}, { -1168, 536, 192}, // 44 seconds { -1408, 368, 272}, { -1560, 256, 336}, { -1416, 184, 328}, { -1328, 80, 320}, { -1296, 24, 304}, { -1232, 40, 272}, { -1096, 40, 248}, { -1112, 16, 224}, { -1128, -200, ...
ompliance 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, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eith...
strncmp(remote->name, other->name, sizeof(remote->name))
; } } static void add_remote(SettingsBluetoothData* data, StoredRemote* remote) { const bool ascending = false; data->remote_list_head = list_sorted_add(data->remote_list_head, &remote->list_node, (Comparator) remote_comparator, ascending); } static StoredRemote* stored_remote_create(void) { StoredRemot...
/* * 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_ERROR, "Error: ble_gap_adv_data_set - rv: %d", rv)
; } s_desired_ad_data.needs_updating = false; return rv; } static ble_error_t prv_advert_enable(void) { ble_error_t rv = BLE_ERROR_FAILED; if (s_desired_ad_data.needs_updating) { rv = prv_set_mode_and_data(); if (rv != BLE_STATUS_OK) { return rv; } } rv = ble_gap_adv_start(GAP_CONN_MO...
data until so much time has passed that it is assumed the user has forgotten // about the workout hr_time_left = WORKOUT_ACTIVE_HR_SUBSCRIPTION_TS_EXPIRE; } else if (s_workout_data.frontend_last_opened_ts >= s_workout_data.last_workout_end_ts) { // If the app was opened and closed without startin...
{ PBL_LOG(LOG_LEVEL_WARNING, "Workout (un)pause requested but no workout in progress"); return false; }
prv_lock(); { CurrentWorkoutData *wrkt_data = s_workout_data.current_workout; if (workout_service_is_paused()) { // We are paused and want to unpause. Add the in progress pause time to the total wrkt_data->duration_completed_pauses_s += (rtc_get_time() - wrkt_data->last_paused_utc); } els...
onnected, void *context) { VoiceUiData *data = context; if (connected) { if (data->state == StateError) { // We got here after a dictation result timeout, so restart the dictation prv_start_dictation(data); } else { prv_voice_window_push(data); } } else { VOICE_LOG("Bluetooth not...
{ VOICE_LOG("Empty sentence received"); return false; }
ION_NORMALIZED_MAX * rel_ms_running + animation->duration_ms/2) / animation->duration_ms; time_normalized_raw = MIN(time_normalized_raw, ANIMATION_NORMALIZED_MAX); } return time_normalized_raw; } AnimationProgress animation_private_get_animation_progress(const AnimationPrivate *anima...
if (!prv_animation_children_scheduled(state, animation)) { // Once all our children have completed, we can safely unschedule ourselves prv_unschedule_animation(state, animation, animation->is_completed, !animation->parent /*allow_destroy*/, false /*force_destroy*/, ...
} return blocked_on_children_complete; } // ------------------------------------------------------------------------------------------- // @param state our context // @param now the time we are running to. When called from animation_set_elapsed, this will // be in the future, otherwise it will be the curren...
nclude "host_transport_impl.h" #include "hc_protocol/hc_protocol.h" #include "board.h" #include "kernel/pbl_malloc.h" #include "system/logging.h" #include "system/passert.h" #include "system/hexdump.h" #include "tasks.h" #include "util/attributes.h" #include "util/circular_buffer.h" #include "util/crc32.h" #include ...
hw_wkup_reset_interrupt()
censed 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 in writing, software * distributed under...
(r->state, RecognizerState_Failed)
; cl_assert(s_manager_state_change); cl_assert_equal_i(event_type, -1); r->state = RecognizerState_Possible; s_manager_state_change = false; recognizer_transition_state(r, RecognizerState_Completed); cl_assert_equal_i(r->state, RecognizerState_Completed); cl_assert(s_manager_state_change); cl_assert_eq...
ifo_subscribers++; ms_per_update = state->samples_per_update * 1000 / state->sampling_rate; if (ms_per_update < lowest_ms_per_update) { lowest_ms_per_update = ms_per_update; } } state = (AccelSubscriberState *)state->list_node.next; } // Setup the subsampling numerator and denomin...
if (s_temp_peek_mode) { prv_set_restore_fifo_mode_timer(); // Give us another N seconds }
lator_LowPower, PWR_STOPEntry_WFI); // We don't use ^^ the above function because of a silicon bug which // causes the processor to skip some instructions upon wake from STOP // in certain sitations. See the STM32F20x and STM32F21x Errata sheet // section 2.1.3 "Debugging Stop mode with WFE entry", or the errat...
prv_get_nostop_ticks(inhibitor, now_ticks)
; s_inhibitor_profile[inhibitor].total_ticks_while_disabled = 0; portEXIT_CRITICAL(); analytics_set(metric, ticks_to_milliseconds(ticks), AnalyticsClient_System); } void analytics_external_collect_stop_inhibitor_stats(RtcTicks now_ticks) { prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_MAIN_TIME, InhibitorMain...
_session_by_type(CommSessionTransportType session_type) { return (CommSession *) list_find((ListNode *) s_session_head, prv_find_session_is_type_filter, (void*)session_type); } static CommSession *prv_get_system_session(void) { // Attempt to explicitly find and return a session t...
comm_session_set_responsiveness(comm_session, BtConsumerApp, ResponseTimeMax, 0)
; return; } PBL_LOG(LOG_LEVEL_WARNING, "Invalid sniff interval"); syscall_failed(); } DEFINE_SYSCALL(bool, sys_system_pp_has_capability, CommSessionCapability capability) { CommSession *session = comm_session_get_system_session(); return comm_session_has_capability(session, capability); }
/* * 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...
{ continue; }
const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y); const uint8_t *src = src_row_info.data; // This is the initial position that takes into account destination delta shift const int16_t src_initial_x = src_bitmap->bounds.origin.x + dest_delta_begin_x; const int16_...
e touch: " : ""); printf(list == &s_recognizers_reset ? "Reset: " : ""); printf("{ "); for (uint32_t i = 0; i < count; i++) { printf("%d, ", indices[i]); } printf("}"); ListNode *node = *list; int list_num = list_count(node); bool failed = list_num != count; if (failed) { count = list_num; ...
(recognizers[1], &layer_c.recognizer_list)
; cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {0, 1}, 2, &s_recognizers_handled); // Recognizers that attached to layers other than the active layer and its ancestors will not be // processed recognizer_add_to_list(recognizer...
uint8_t burst_buf[fifo_frame_len]; spi_ll_slave_burst_read(BMI160_SPI, &burst_buf[0], fifo_frame_len); AccelDriverSample data; prv_process_fifo_frame(burst_buf, &data); data.timestamp_us = start_time; start_time += curr_sampling_interval_us; BMI160_DBG("%2d: %"PRId16" %"PRId16" %"PRId16, i...
PBL_LOG(LOG_LEVEL_DEBUG, "Read BMI160 whoami byte 0x%"PRIx8", expecting 0x%"PRIx8, whoami, BMI160_CHIP_ID)
; return (whoami == BMI160_CHIP_ID); } // TODO/NOTE: The accel & gyro self test routines changes some of the BMI160 // configuration state. In the future we could update them so they do not // destroy the state bool accel_run_selftest(void) { prv_update_accel_interrupts(false); prv_run_command(BMI160_CMD_SOFTR...
IS, * 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 "settings.h" #include "settings_menu.h" #include "settings_window.h" #include "applib/app.h" #include "applib/ui/app_win...
(window, &(WindowHandlers){ .load = prv_window_load, .unload = prv_window_unload, })
; window_set_background_color(window, GColorBlack); app_window_stack_push(window, true); } static void handle_deinit(void) { // Window unload deinits everything } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd *settings_get_app_info() { static const...
prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, inner_seq), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert...
cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MIN)
; #endif } // -------------------------------------------------------------------------------------- // Test the get_duration call on a sequence animation void test_animation__sequence_get_duration(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int delay_a = 100; const int play_count_a =...
test->expect_status, test->expect_index, test->expect_eval_time); printf("got : \"%s\" err %d @ %zu eval@%jd\n", s_output, s_error.status, err_index, s_cond.eval_time); #endif if (s_error.status) { #if DEBUG_PRINTING printf("\"%s\"\n", test->params); printf("%*s^\n", (i...
ARRAY_LENGTH(s_full_tests)
; i++) { TemplateStringVars vars = {}; TemplateStringError err = {}; TemplateStringEvalConditions cond = {}; vars.current_time = s_full_tests[i].intime; cond.eval_time = EVAL_FALL_THROUGH; memset(s_output, 'Z', sizeof(s_output)); bool rv = template_string_evaluate(s_full_tests[i].instr, s_...