prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
vious head animation wasn't running yet: if (old_head_is_animating == false) { prv_reschedule_timer(state, 0); } } ANIMATION_LOG_DEBUG("scheduled %d (%p) to run at (%d). delay:%d, duration:%d", (int)animation->handle, animation, (int)animation->abs_start_time_ms, (int)(animation->dela...
{ // computes (earliest_start_time - child->abs_start_time_ms) earliest_start_time = child_start_time; }
child_end_time = child_start_time + child_duration; } else { child_end_time = now + animation->delay_ms + add_delay_ms + child_duration; } if (serial_distance32(child_end_time, latest_end_time) < 0) { // computes (latest_end_time - child_end_time) latest_end_time = chi...
e.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 language governing permissions and * ...
(LOG_LEVEL_INFO, "Entering infinite loop in non-FreeRTOS ISR.")
; NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_WKUP_IRQn; // Lower values are higher priority - make this higher priority than a FreeRTOS ISR NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = (configMAX_SYSCALL_INTERRUPT_PRIORITY >> 4) - 1; NVIC_InitStructur...
/* * 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_IF_COLOR_ELSE(GColorYellow, GColorDarkGray)
); window_set_window_handlers(window, &(WindowHandlers){ .unload = prv_window_unload_handler, }); layer_init(&countdown_window->base_layer, &window->layer.bounds); layer_set_update_proc(&countdown_window->base_layer, prv_base_layer_update_proc); layer_add_child(&window->layer, &countdown_window->base_lay...
get_properties(), ModalProperty_Exists | ModalProperty_CompositorTransitions); } // Description: // This test ensures that when we push a window onto the modal window stack, then // we push another window onto the modal window stack at a lower priority, then // pushing the first at a lower priority...
(window1->on_screen, true)
; window_stack_remove(window1, true); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window_stack_count(app_stack), 0); window_destroy(window1); window_destroy(window2); } // Tests modal and app transitions with a transparent modal window void test_window_stack__transparent_modal_and_app(...
/* * 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...
(inverter, !layer_get_hidden(inverter))
; } static void prv_vibe_timer_callback(void *data) { static const uint32_t SECOND_PULSE_DURATIONS[] = { 1000 }; VibePattern pat = { .durations = SECOND_PULSE_DURATIONS, .num_segments = ARRAY_LENGTH(SECOND_PULSE_DURATIONS) }; vibes_enqueue_custom_pattern(pat); app_timer_register(INTER_VIBE_PERIOD_MS...
l pull-up, so we should always be open-drain const bool is_open_drain = true; #else // If we raise the baud rate above 115200 we need to configure as push-pull to ensure we are // sufficiently driving the line. Ideally, the accessory would have a strong-enough pull-up, but // now that we've released use of the ...
(s_send_semaphore, portMAX_DELAY)
== pdPASS); PBL_ASSERTN(stream_callback != NULL); PBL_ASSERTN(!s_input_enabled); if (s_dma_enabled) { uart_clear_rx_dma_buffer(ACCESSORY_UART); } s_stream_context = context; s_stream_cb = stream_callback; s_has_sent_byte = false; uart_set_tx_interrupt_enabled(ACCESSORY_UART, true); // Block until...
cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_util__eval_no_error(void) { s_log_internal__expected = (const char *[]){ NULL }; prv_do_eval("1+1;"); cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_util__eval_throw_string(void) { s_log_internal__expected = (const char ...
(now, "getMinutes")
; jerry_value_t getHours = jerry_get_object_field(now, "getHours"); jerry_value_t getDate = jerry_get_object_field(now, "getDate"); jerry_value_t getMonth = jerry_get_object_field(now, "getMonth"); jerry_value_t getYear = jerry_get_object_field(now, "getYear"); jerry_value_t result_seconds = jerry_call_funct...
uint32_t CACHE_CTRL1_REG; uint32_t CACHE_LNSIZECFG_REG; uint32_t CACHE_ASSOCCFG_REG; uint32_t CACHE_CTRL2_REG; uint32_t CACHE_CTRL3_REG; uint32_t CACHE_MRM_HITS_REG; uint32_t CACHE_MRM_MISSES_REG; uint32_t CACHE_MRM_CTRL_REG; uint32_t CACHE_MRM_TINT_REG; uint32_t CACHE_MRM_THRES_REG; uint...
REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_HYST, 0x4)
; REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_VOLTAGE, 0x10); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_CUR_LIM_MAX_HV, 0x18); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_CUR_LIM_MIN, 0x4); REG_SETF(...
assert_equal_i(BIG_TIME_APP_ID, big_time_app_id); menu_layer_init(&menu_layer, &GRect(0,0,144,76)); rtc_set_time(100); } extern ListNode *s_head_callback_node_list; void test_app_menu_data_source__cleanup(void) { s_head_callback_node_list = NULL; app_install_manager_flush_recent_communication_timestamps(); ...
app_menu_data_source_deinit(&data_source)
; } void prv_write_order_to_file(const AppInstallId order[], uint8_t num_entries) { uint8_t entries_to_write = num_entries + 1; uint16_t file_len = sizeof(uint8_t) + (entries_to_write) * sizeof(AppInstallId); pfs_remove("lnc_ord"); int fd = pfs_open("lnc_ord", OP_FLAG_WRITE, FILE_TYPE_STATIC, file_len); pfs...
/* * 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_LOG(APP_LOG_LEVEL_DEBUG, "App Message Failed to Send!")
; } static void app_message_init(void) { // Register message handlers app_message_register_inbox_received(in_received_handler); app_message_register_inbox_dropped(in_dropped_handler); app_message_register_outbox_failed(out_failed_handler); // Init buffers app_message_open(64, 64); } static void window_loa...
(session, (SessionSendQueueJob **)&sb)
; } // ------------------------------------------------------------------------------------------------- // Interfaces for testing SemaphoreHandle_t comm_session_send_buffer_write_semaphore(void) { return s_default_kernel_sender_write_semaphore; } void comm_default_kernel_sender_deinit(void) { vSemaphoreDelete(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...
{ s_granted_count = 0; fake_rtc_init(0, 0); regular_timer_init(); fake_gap_le_connect_params_init(); s_hdl.conn_mgr_info = bt_conn_mgr_info_init(); }
void test_bt_conn_mgr__cleanup(void) { regular_timer_deinit(); } void test_bt_conn_mgr__ble_latency_mgr(void) { // 1 consumer at fastest rate should result in fastest rate getting scheduled conn_mgr_set_ble_conn_response_time( &s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMin, 100); uint16_t secs_...
/* * 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...
buffer_remove(b, 1, 4)
_day_idx:%d, num_days:%d, seconds_first_day:%d, seconds_last_day:%d," \ "seconds_total_last_day: %d}\n", \ (int)r_a.last_day_idx, (int)r_a.num_days, \ (int)r_a.seconds_first_day, (int)r_a.seconds_last_day, \ (int)r_a.seconds_total_last_day, \ (in...
{ const time_t now = rtc_get_time(); bool result; HealthServiceTimeRange range; // clamps value that goes into the future result = prv_calculate_time_range(now - 10, now + 11, &range); cl_assert_equal_b(result, true); cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 0, .num...
void test_health__sum_full_days(void) { // use values structured as binary mask so we can detect if we sum up currect days s_sys_activity_get_metric_values.out.history[0] = 1000; s_sys_activity_get_metric_values.out.history[1] = 2000; s_sys_activity_get_metric_values.out.history[2] = 4000; s_sys_activity_ge...
last byte is emitted by the SPI peripheral delay_us(7); GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET); // hold time > 1us // produce a delay 4ms delay_us(4); gpio_release(DISP_GPIO); } //! These functions needed to be called around any commands that //! are sent to the display. NOINLINE only for code...
(DISP_GPIO, &s_disp_gpio_init)
; s_disp_gpio_init.GPIO_Mode = GPIO_Mode_OUT; s_disp_gpio_init.GPIO_OType = GPIO_OType_OD; s_disp_gpio_init.GPIO_Pin = DISP_PIN_LCD; GPIO_Init(DISP_GPIO, &s_disp_gpio_init); // Set up a SPI bus on SPI2 SPI_I2S_DeInit(DISP_SPI); SPI_Init(DISP_SPI, &s_disp_spi_init); SPI_Cmd(DISP_SPI, ENABLE); // +5...
more data uint32_t samples_drained = 0; while (state->num_samples < state->samples_per_update) { // Read available data. AccelManagerBufferData data; if (!shared_circular_buffer_read_subsampled( &s_buffer, &state->buffer_client, sizeof(data), &data, 1)) { // we have drained a...
analytics_external_collect_accel_xyz_delta()
LOG(LOG_LEVEL_ERROR, "Failed to get entry for id %"PRId32, id); } else if (app_install_entry_is_watchface(&entry)) { // If the watchface is for an unsupported SDK version, we need to switch the default // watchface back to tictoc. Otherwise, we will be stuck in the launcher forever. watchf...
pebble_task_get_name(task)
/* * 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; // out of range }
else if (id == LayoutIdCommNotification) { return false; // NYI } else { return s_layout_verifiers[id](existing_attributes); } } GSize layout_get_size(GContext *ctx, LayoutLayer *layout) { return layout->impl->size_getter(ctx, layout); } const LayoutColors *layout_get_colors(const LayoutLayer *layout) ...
= 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, "draw_rect_offset_aa_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLI...
(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 4)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq...
et_id_system( (TimelineResourceId)TimelineResourceTestTimelineId_AlarmClock, TimelineResourceSizeTiny, TimelineResourceTestAppId_ValidApp, &res_info)); s_is_app_published_resource_invalid = false; // Calling the function with valid args should return true and set the correct values in res_info cl_ass...
cl_assert_equal_i(res_info.res_id, RESOURCE_ID_BIRTHDAY_EVENT_LARGE)
; // Set the TimelineResourceInfo to valid values timeline_res_info = (TimelineResourceInfo) { .app_id = &valid_app_data->install_entry.uuid, .res_id = (TimelineResourceId)TimelineResourceTestTimelineId_AlarmClock, .fallback_id = TIMELINE_RESOURCE_BIRTHDAY_EVENT, }; // Calling the function for an ...
------------------------------------------------ // Post-process the passed in sleep sessions. This function identifies which sleep sessions are // nap sessions and labels them as such // @param num_input_sessions number of entries in the sessions array // @param sessions array of activity sessions void activity_algori...
kernel_free(k_state)
; return false; } // Init globals *s_alg_state = (AlgState) { .mutex = mutex_create_recursive(), .k_state = k_state, }; shared_circular_buffer_init(&s_alg_state->minute_data_cbuf, (uint8_t *)s_alg_state->minute_data_storage, sizeof(s_alg...
ersion 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 ...
{ args.num_args = i; return args; }
// Yay, a param! args.args[i] = buffer; // Skip over the param and set us up for the next one. while (buffer < buffer_end && *buffer != ' ') { ++buffer; } *(buffer++) = 0; } args.num_args = NUM_SUPPORTED_PARAM_COUNT; return args; } static void prv_execute_given_command(const Com...
rb_set_manually_enabled(false); enabled = do_not_disturb_is_manually_enabled(); cl_assert(do_not_disturb_is_active() == false); cl_assert(enabled == false); prv_assert_manually_dnd_setting_val(false); cl_assert_equal_i(s_num_dnd_events_put, 2); do_not_disturb_set_manually_enabled(true); enabled = do_not_...
do_not_disturb_is_active()
; cl_assert(active == true); } void test_do_not_disturb__disabling_manual_dnd_should_override_scheduled(void) { bool active; // Time 00:00, Manual and Scheduled DND both OFF DoNotDisturbSchedule schedule = { .from_hour = 0, .from_minute = 30, .to_hour = 12, .to_minute = 30, }; active = do_n...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
("gack() = %d\n", gack())
; // 789 cl_will_return_count(gack, 765, 3); printf("gack() = %d\n", gack()); // 765 printf("gack() = %d\n", gack()); // 765 printf("gack() = %d\n", gack()); // 765 printf("gack() = %d\n", gack()); return 0; } #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...
pulse_bulkio_erase_message_send(PulseBulkIODomainType_ExternalFlash, S_SUCCESS, state->cookie)
; kernel_free(state); } } static status_t external_flash_domain_erase(uint8_t *packet_data, size_t length, uint8_t cookie) { if (length != sizeof(ExternalFlashEraseOptions)) { return E_INVALID_ARGUMENT; } ExternalFlashEraseOptions *options = (ExternalFlashEraseOptions*)packet_data; ExternalFlashEra...
(SessionSendQueueJob *)job; } // Tests //////////////////////////////////////////////////////////////////////////////////////////////////// static const uint8_t TEST_DATA[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; void test_session_send_queue__initialize(void) { s_valid_session = &s_session; s_free_count = 0; ...
(comm_session_send_queue_get_read_pointer(s_valid_session, &data_out), sizeof(TEST_DATA) - consumed)
; cl_assert_equal_m(data_out, TEST_DATA + consumed, sizeof(TEST_DATA) - consumed); comm_session_send_queue_consume(s_valid_session, 1); } // Expect head to be free'd: cl_assert_equal_i(s_free_count, 1); // Next job can be read: cl_assert_equal_i(comm_session_send_queue_get_read_pointer(s_valid_sess...
, 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)); } void test_reminder_db__delete_parent(void) { prv_insert_default_remi...
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 dirty items cl_assert_equal_i(reminder_db_is_dirty(&is_dirty), S_SUCCESS);...
_FLASH #include "flash_test.h" #include "applib/app.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/simple_menu_layer.h" #include "applib/ui/text_layer.h" #include "applib/ui/window.h" #include "applib/ui/window_stack.h" #include "mfg/mfg_apps/mfg_flash_test.h" #include "process_state/app_state/app_s...
text_layer_set_text(msg_text_layer, "Select To Confirm Switch")
; } else { text_layer_set_text(msg_text_layer, "Press Select To Start"); } text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter); text_layer_set_background_color(msg_text_layer, GColorBlack); text_layer_set_text_color(msg_text_layer, GColorWhite); text_layer_set_font(msg_text_layer, font...
phics_draw_horizontal_line_dotted(&ctx, GPoint(0, 6), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); grap...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20),...
28, -544}, { 864, 312, -464}, { 1264, 312, -472}, { 1232, 224, -440}, { 952, 128, -392}, { 872, 80, -280}, { 1112, 104, -272}, { 1208, 40, -208}, { 1056, 24, -216}, { 960, 48, -240}, { 880, 72, -232}, { 872, 120, -280}, // 13 seconds { 840, 144, -344}, { 880, 112,...
{ 848, 80, -216}, { 1152, 72, -128}, { 1176, -40, -96}, { 1008, -104, -96}, { 952, -48, -120}, { 1000, -16, -136}, { 1040, -8, -128}, { 1104, -48, -88}, { 1024, -64, -64}, { 976, -48, -96}, { 960, -40, -88}, { 1032, -32, -40}, { 1064, -24, -24}, { 1064, -32, -16},...
{ 1512, 24, -64}, { 1232, 64, -104}, { 840, 40, -192}, // 21 seconds { 592, 0, -72}, { 1064, 40, -48}, { 1240, 56, -64}, { 976, 32, -64}, { 904, 40, -96}, { 920, 40, -176}, { 904, -8, -160}, { 952, -48, -160}, { 984, -80, -200}, { 1016, -96, -240}, { 1024, -1...
cell_width = 56, .ampm_cell_width = 56, .cell_padding = 6, .top_offset_with_label = 87, .top_offset_without_label = 67, // NOTE: this hasn't been designed, because we don't use it .label_origin_y = 33, .range_origin_y = 158, }; static const TimeSelectionSizeConfig *s_time_selection_configs[NumPreferredCon...
(end_buf, sizeof(end_buf), hour_end, minute_end, true)
/// #include "stubs_analytics.h" #include "stubs_bt_lock.h" #include "stubs_bt_stack.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_rand_ptr.h" #include "stubs_syscall_internal.h" void comm_session_analytics_open_session(CommSession *session) { } void comm_session_analytics_close_session(Co...
comm_session_get_current_app_session()
, NULL); } void test_session__send_data_returns_false_for_null_session(void) { const uint16_t endpoint_id = 1234; uint8_t data[] = {1, 2, 3, 4}; cl_assert_equal_b(comm_session_send_data(NULL, endpoint_id, data, sizeof(data), CO...
*context) { SwapLayerDemoData *data = context; data->idx = 0; swap_layer_reload_data(&data->swap_layer); } static void prv_click_config_provider(void *context) { SwapLayerDemoData *data = context; window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_single_click_handler); window_long_click_subscribe...
app_window_stack_push(window, animated)
; } //////////////////// // App boilerplate static void s_main(void) { handle_init(); app_event_loop(); } const PebbleProcessMd* swap_layer_demo_get_app_info() { static const PebbleProcessMdSystem s_app_info = { .common = { .main_func = s_main, // UUID: 12a32d95-ef69-46d4-a0b9-854cc62f97f9 ...
urn rv; } else if (app_db_exists_install_id(install_id)) { AppDBEntry *db_entry = kernel_malloc_check(sizeof(AppDBEntry)); bool rv = (app_db_get_app_entry_for_install_id(install_id, db_entry) == S_SUCCESS); if (rv) { rv = prv_app_install_entry_from_app_db_entry(install_id, db_entry, entry); } ...
app_manager_get_current_app_id()
== install_id) { process_manager_put_kill_process_event(PebbleTask_App, gracefully); } if (worker_manager_get_current_worker_id() == install_id) { process_manager_put_kill_process_event(PebbleTask_Worker, gracefully); } // We are not deleting the cache here because it will be deleted quicker in files...
/* * 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_data.window, &(WindowHandlers){ .load = prv_window_load_handler, .unload = prv_window_unload_handler, })
; } void test_kickstart__cleanup(void) { window_deinit(&s_data.window); } // Tests ////////////////////// void test_kickstart__render_no_data(void) { 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 t...
/* * 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 (image == NULL) { return; }
add a pin again activity_insights_init(rtc_get_time()); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 1); // Make sure we still merge properly after a power cycle activity_insights_init(rtc_get_time()); rtc_set_time(rtc_get_time() + 2 * SECONDS_PER_HOUR); prv...
(rtc_get_time() + 5 * SECONDS_PER_HOUR)
; prv_add_nap_session(0, 1); activity_insights_process_minute_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 1); // Re-init (simulates power cycle) and make sure we don't add a pin again activity_insights_init(rtc_get_time()); activity_insights_process_minute_data(rtc_get_time()); cl_assert_e...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(strcmp(without_whitespace, string_strip_leading_whitespace(with_whitespace)) == 0)
; const char *with_newlines = "\n\n\nbonjour, monde"; const char *without_newlines = "bonjour, monde"; cl_assert(strcmp(without_newlines, string_strip_leading_whitespace(with_newlines)) == 0); const char *with_both = "\n\n \n \nalbuquerque is a lovely town, not!\n"; const char *with_neither = "albuquerque ...
lue(GContext* ctx, GRect rect, uint16_t radius, GCornerMask corner_mask) { s_graphics_fill_rect.call_count++; s_graphics_fill_rect.last_call = (MockCallRecording) { .ctx = ctx, .rect = rect, .radius = radius, .corner_mask = corner_mask, }; } GPointPrecise gp...
rocky_event_loop_with_string_or_snapshot(script, sizeof(script))
; cl_assert(*s_log_internal__expected == NULL); } AppTimer *rocky_timer_get_app_timer(void *data); void test_js__init_deinit(void) { // PBL-40702: test_js__init_deinit is leaking memory... s_skip_mem_leak_check = true; prv_deinit(); char *script = "var num_times = 0;" "var extra_arg = 0;" "var...
/* * 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...
TIM_ARRPreloadConfig(pwm->timer.peripheral, ENABLE)
ected_transport_type) { CommSessionTransportType transport_type = implementation->get_type(transport); return transport_type == expected_transport_type; } //! bt_lock() is expected to be taken by the caller! CommSession * comm_session_open(Transport *transport, const TransportImplementation *implementation, ...
kernel_free(session)
; } void comm_session_set_responsiveness( CommSession *session, BtConsumer consumer, ResponseTimeState state, uint16_t max_period_secs) { comm_session_set_responsiveness_ext(session, consumer, state, max_period_secs, NULL); } void comm_session_set_responsiveness_ext(CommSession *session, BtConsumer consumer...
/* * 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_DEBUG, "Max size used %d %d", size_used.w, size_used.h)
; } static void push_window(struct AppState *data) { Window* window = &data->window; window_init(window, WINDOW_NAME("Text Spacing")); window_set_user_data(window, data); window_set_click_config_provider(window, (ClickConfigProvider) config_provider); window_set_window_handlers(window, &(WindowHandlers) { ...
/* * 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_format_time(number_buffer, number_buffer_size, (clock_is_24h_style() ? i18n_noop("%R") : i18n_noop("%l:%M")), timestamp)
; const char *number_buffer_ptr = string_strip_leading_whitespace(number_buffer); memmove(number_buffer, number_buffer_ptr, number_buffer_size - (number_buffer_ptr - number_buffer)); return written - (number_buffer_ptr - number_buffer); } size_t clock_get_time_word(char *buffer, size_t buffer...
id) { time_t now_s; uint16_t now_ms; sys_get_time_ms(&now_s, &now_ms); uint64_t ms = (now_s * 1000) + now_ms; return ms; } static void prv_update_analytics_metrics(VoiceUiData *data) { data->elapsed_ms = prv_get_time_ms() - data->start_ms; data->num_sessions++; } static void prv_dictation_timeout_cb(voi...
(data, DictationSessionStatusFailureRecognizerError)
; } } } static void prv_handle_dictation_result(VoiceUiData *data, PebbleVoiceServiceEvent *event) { VOICE_LOG("Handling result event"); data->session_id = VOICE_SESSION_ID_INVALID; bool success = false; switch (event->status) { case VoiceStatusSuccess: { success = prv_handle_dictation_success(...
ta *) context; return list_count(data->remote_list_head) + 1; } static int16_t prv_row_height_cb(SettingsCallbacks *context, uint16_t row, bool is_selected) { #if PBL_RECT # if CAPABILITY_HAS_BUILTIN_HRM int heart_rate_sharing_text_height = 0; if (row > 0) { SettingsBluetoothData *data = (SettingsBluetoothD...
{ return; }
/* * 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 true; }
size_t heap_bytes_free(void) { return 123456; } static uint32_t s_resource_storage_get_num_entries__result; uint32_t resource_storage_get_num_entries(ResAppNum app_num, uint32_t resource_id) { return s_resource_storage_get_num_entries__result; } void rocky_api_watchface_init(void){} void rocky_api_deinit(void){...
interrupt and then calling the DMA Interrupt Handler directly. This will cause the // callback above to be called. static void prv_wait_for_dma(bool is_tx_only) { while (!s_spi_dma_complete) { if (NVIC_GetPendingIRQ(DMA_IRQn)) { NVIC_ClearPendingIRQ(DMA_IRQn); DMA_Handler(); } } // NOTE: It l...
reboot_reason_set(&reason)
; // Go into low-power mode. Hard reset isn't useful. prv_low_power_mode(); } s_core_dump_initiated = true; if (user_requested) { printf("CD: user requested\n"); RebootReason reason = { .code = RebootReasonCode_CoreDumpRequested }; reboot_reason_set(&reason); } // Save the registers th...
est); ble_hrm_handle_sharing_request_response(is_granted, s_last_sharing_request); s_last_sharing_request = NULL; } void test_ble_hrm__sub_unsub(void) { cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 0); cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, 0); prv_assert_event_ser...
(&s_conn_a)
); cl_assert_equal_b(false, ble_hrm_is_sharing()); prv_assert_event_service_subscribed(false); prv_assert_last_disconnected(s_device_a); } void test_ble_hrm__revoke_all(void) { // Device A subscribes: bt_driver_cb_hrm_service_update_subscription(s_device_a, true); // Expect permissions UI to be presented:...
sage_len; } } // ------------------------------------------------------------------------------------------- int pbl_log_binary_format(char* buffer, int buffer_len, const uint8_t log_level, const char* src_filename_path, int src_line_number, ...
(fmt_args, packed_loghash)
; pbl_log_hashed_vargs(true, core_number, packed_loghash, fmt_args); va_end(fmt_args); } // Core Number must be shifted to the correct position. void pbl_log_hashed_vargs(const bool async, const uint32_t core_number, const uint32_t packed_loghash, va_list fmt_args) { LogState *state ...
4, .duration = 0, .type = TimelineItemTypeReminder, .layout = LayoutIdTest, } }; static SerializedTimelineItemHeader bad_item = { .common = { .id = {0x8c, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x42, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .timestamp = 3, .duration = 0, ...
memcmp(&item3, &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 *) &item3, sizeof(Uuid)) == 0); memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp)); temp.attr_list.attributes = NU...
/* * 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 E_INVALID_OPERATION; }
memcpy(&info->caller_number, msg, MIN(caller_number_size, sizeof(info->caller_number)))
; msg += caller_number_size; msg_length += caller_number_size + 1; uint8_t caller_name_size = *msg++; memcpy(&info->caller_name, msg, MIN(caller_name_size, sizeof(info->caller_name))); msg_length += caller_name_size + 1; // Ensure that we haven't run off the end of our buffer if (msg_length > leng...
conds { 760, -88, -528}, { 760, -48, -544}, { 752, -32, -568}, { 744, -48, -592}, { 736, -40, -608}, { 744, -32, -592}, { 744, -64, -568}, { 736, -64, -560}, { 720, 16, -664}, { 712, -32, -640}, { 712, -24, -584}, { 704, -24, -616}, { 704, 40, -640}, { 704, 96, -7...
{ 720, -24, -608}, { 712, -32, -600}, { 720, 8, -624}, { 696, -48, -632}, { 696, 8, -624}, { 704, 8, -664}, { 696, 32, -672}, { 696, 32, -648}, // 111 seconds { 696, 0, -632}, { 688, -8, -632}, { 696, 24, -656}, { 696, 16, -672}, { 680, 32, -688}, { 696, 56, -...
{ 760, -72, -560}, { 752, -80, -584}, { 736, -112, -568}, { 752, -88, -576}, { 744, -72, -576}, { 736, -48, -600}, { 736, -32, -616}, { 728, -40, -632}, { 720, 0, -648}, { 720, -16, -648}, { 720, -56, -640}, { 720, -40, -624}, { 736, -56, -592}, { 736, -72, -576}...
/* * 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 (ResHandle)resource_id; }
ance *glance) { // Ignore slices that aren't of the IconAndSubtitle type beyond this point for now if (glance->current_slice.type != AppGlanceSliceType_IconAndSubtitle) { return; } LauncherAppGlanceStructured *structured_glance = (LauncherAppGlanceStructured *)glance; LauncherAppGlanceGeneric *generic_gl...
(subtitle_template_string, buffer, buffer_size, &template_string_reeval_conditions, &template_string_vars, &template_string_error)
; if (template_string_error.status != TemplateStringErrorStatus_Success) { // Zero out the buffer and return buffer[0] = '\0'; PBL_LOG(LOG_LEVEL_WARNING, "Error at index %zu in evaluating template string: %s", template_string_error.index_in_string, subtitle_template_string); return; } ...
/* * 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...
i18n_get("Charging", dialog)
); dialog_set_background_color(dialog, GColorLightGray); dialog_set_icon(dialog, RESOURCE_ID_BATTERY_ICON_CHARGING_LARGE); } static void prv_update_ui_warning(Dialog *dialog, void *context) { const BatteryWarningDisplayData *data = context; const uint32_t percent = data->percent; dialog_set_background_color(...
N_BAR_ICON_X; } prv_set_action_bar_icon(BUTTON_ID_UP, up_icon, &s_phone_ui_data->up_bitmap); prv_set_action_bar_icon(BUTTON_ID_SELECT, select_icon, &s_phone_ui_data->select_bitmap); prv_set_action_bar_icon(BUTTON_ID_DOWN, down_icon, &s_phone_ui_data->down_bitmap); } else { prv_hide_action_bar(); ...
(TextStyleFont_Header)
, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); Window *window = &s_phone_ui_data->window; window_init(window, WINDOW_NAME("Phone")); window_set_status_bar_icon(window, (GBitmap*)&s_status_icon_phone_bitmap); layer_set_update_proc(&window->layer, prv_window_update_proc); window_set...
memset(s_storage_data.buffer, 0, sizeof(s_storage_data.buffer))
; s_storage_data.total_size = buffer_size; PutBytesStorageInfo *info_copy = NULL; if (info) { info_copy = (PutBytesStorageInfo *)kernel_malloc_check(sizeof(PutBytesStorageInfo)); *info_copy = *info; } s_storage_data.info = info_copy; storage->impl_data = &s_storage_data; // put_bytes_storage_raw....
ange; graphics_context_set_fill_color(&context, color); #if PBL_COLOR cl_assert_equal_i(context.draw_state.fill_color.argb, GColorOrange.argb); #else cl_assert_equal_i(context.draw_state.fill_color.argb, GColorDarkGray.argb); #endif color.a = 2; graphics_context_set_fill_color(&context, color); #if PBL_COLOR...
prv_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)
); #endif } void test_graphics_context_${BIT_DEPTH_NAME}__draw_stroke_width_1(void) { // Stroke width 1, non-antialiased setup_test(&context, false, 1, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); ASSERT_CALLED(graphics_line_draw_1px_non_aa(&context, GPoint(5, ...
static const GTextNodeBaseImpl s_custom_impl = { .destructor = prv_destroy_text_node_base, .will_draw = prv_draw_noop, .did_draw = prv_draw_noop, .draw = prv_draw_text_node_custom, }; static const GTextNodeContainerImpl s_horizontal_impl = { .base.is_container = true, .base.destructor = prv_destroy_text_n...
if (node->clip) { ctx->gcontext->draw_state.clip_box = ctx->cached_clip_box; }
gsize_add_eq(ctx->size_out, node->margin); } if (parent_ctx) { prv_container(parent_ctx->node)->did_draw_child(parent_ctx, node); } } static void prv_draw_text_node_tree(GTextNode *root_node, GContext *gcontext, const GRect *box, const GTextNodeDrawConfig *config, bo...
/* * 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...
USART_Cmd(USART1, ENABLE)
; } static void prv_putchar(uint8_t c) { while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) continue; USART_SendData(USART1, c); while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) continue; } void dbgserial_print(const char* str) { for (; *str && s_message_length < MAX_MESSAGE; ++str) { ...
meline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_ass...
cl_assert_equal_i(timeline_model_get_num_items(), 2)
; cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeli...
AYOUT_HEIGHT) for circular display #define SCROLL_PX PBL_IF_RECT_ELSE(48, LAYOUT_HEIGHT) // Max pixel scroll for repeating scrolls (button is held) #define REPEATING_SCROLL_PX 24 // Scroll animation speed // Same as the normal moook duration, but one frame shorter #define SCROLL_MS PBL_IF_RECT_ELSE(200, interpolate_m...
{ swap_layer->swap_in_progress = false; if (swap_layer->callbacks.layout_did_appear_handler) { swap_layer->callbacks.layout_did_appear_handler(swap_layer, layout, rel_change, swap_layer->context); } }
static void prv_update_colors(SwapLayer *swap_layer, GColor bg_color, bool status_bar_filled) { if (swap_layer->callbacks.update_colors_handler) { swap_layer->callbacks.update_colors_handler(swap_layer, bg_color, status_bar_filled, sw...
nclude "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_process_manager.h" #include "stubs_ui_window.h" // Fakes ///////////////////// #include "fake_event_service.h" // Statics ///////////////////// void *s_context_target; typedef struct UnobstructedAreaTestData { void *context; int num_wil...
cl_assert_equal_grect(s_data.last_will_change_final_area, to_area_expected)
; } void test_unobstructed_area_service__will_change_twice(void) { UnobstructedAreaHandlers handlers = { .will_change = prv_will_change, }; app_unobstructed_area_service_subscribe(handlers, s_data.context); cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler); cl_assert_equal_p...
ner = GCornerNone; break; } graphics_fill_round_rect(ctx, &rect, radius - margin, corner); } GRect icon_rect = icon->bounds; const bool clip = true; grect_align(&icon_rect, &rect, GAlignCenter, clip); const GCompOp op = (is_white != is_highlighted) ? GCompOpAssign : GCompOp...
{ window_set_click_config_provider_with_context( action_bar->window, (ClickConfigProvider) action_bar_legacy2_click_config_provider, action_bar); }
/* * 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...
strtol("765", NULL, 10)
, 765); cl_assert_equal_i(strtol("573888", NULL, 10), 573888); cl_assert_equal_i(strtol("713713", NULL, 10), 713713); cl_assert_equal_i(strtol("2147483646", NULL, 10), 2147483646); cl_assert_equal_i(strtol("-2147483647", NULL, 10), -2147483647); } void test_strtol__whitespace_pfx(void) { cl_assert_equal_i(s...
/*chalk*/ 53, /*diorite*/ 24, /*emery*/ 45); } static int prv_press_animation_offset(void) { const PlatformType platform = process_manager_current_platform(); return PBL_PLATFORM_SWITCH(platform, /*aplite*/ 5, ...
graphics_fill_rect(ctx, &action_bar->layer.bounds)
; } void prv_draw_background_round(ActionBarLayer *action_bar, GContext *ctx, GColor bg_color) { const uint32_t action_bar_circle_diameter = DISP_ROWS * 19 / 9; GRect action_bar_circle_frame = (GRect) { .size = GSize(action_bar_circle_diameter, action_bar_circle_diameter) }; grect_align(&action_bar_circl...
&l, NULL, &(MenuLayerCallbacks){ .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, }); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0, l.selection.y); const int16_t basic_cell_height = menu_cell_basic_cell_height(); const int row0_vertically_centered = (...
(true, s_content_available[ContentIndicatorDirectionDown])
; // totally wrong menu_layer_set_selected_next(&l, true, MenuRowAlignNone, false); cl_assert_equal_i(2 * FOCUSED, l.selection.y); cl_assert_equal_i(NORMAL, l.selection.h); cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp]); cl_assert_equal_b(true, s_content_available[ContentIndicat...
C * * 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 * distrib...
if (data->up_down_direction) { text_layer_set_text(&data->direction_layer, "Direction: Up/Down"); } else { text_layer_set_text(&data->direction_layer, "Direction: Left/Right"); }
case LIGHT_STATE_ON_TIMED: new_brightness = prv_backlight_get_intensity(); // Schedule the timer to move us from the ON_TIMED state to the ON_FADING state new_timer_start(s_timer_id, backlight_get_timeout_ms(), light_timer_callback, NULL, 0 /* flags */); break; ca...
if (enable) { if (prv_light_allowed()) { prv_change_state(LIGHT_STATE_ON); } } else if (s_num_buttons_down == 0) { prv_change_state(LIGHT_STATE_OFF); }
mutex_unlock(s_mutex); } void light_reset_user_controlled(void) { mutex_lock(s_mutex); // http://www.youtube.com/watch?v=6t_KgE6Yuqg if (s_user_controlled_state) { s_user_controlled_state = false; if (s_num_buttons_down == 0) { prv_change_state(LIGHT_STATE_OFF); } } mutex_unlock(s_mu...
ay:%d," \ "seconds_total_last_day: %d}\n", \ (int)r_a.last_day_idx, (int)r_a.num_days, \ (int)r_a.seconds_first_day, (int)r_a.seconds_last_day, \ (int)r_a.seconds_total_last_day, \ (int)r_b.last_day_idx, (int)r_b.num_days, \ (int)r_...
time_util_get_midnight_of(now - (ACTIVITY_HISTORY_DAYS - 1) * SECONDS_PER_DAY)
; result = prv_calculate_time_range(first_valid_time - 12, first_valid_time + 13, &range); cl_assert_equal_b(result, true); cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = ACTIVITY_HISTORY_DAYS - 1, .num_days = 1, .seconds_first_day = 13, ...
SET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE); return true; } return false; } static bool prv_check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool prv_check_for_fw_start_...
boot_bit_init()
; if (!rtc_init()) { // Need to initialize the display in this // case so we can see the sad watch display_init(); prv_sad_watch(ERROR_CANT_START_LSE); } // Standby checks need to know the button pressed state button_init(); // On tintin the bootloader handles entering and leaving standby m...
tic BMI160GyroPowerMode s_gyro_power_mode = BMI160_Gyro_Mode_Suspend; static bool s_accel_outstanding_motion_work = false; static bool s_accel_outstanding_data_work = false; static bool s_fifo_in_use = false; static uint8_t curr_fifo_num_samples_wm = 0; static bool s_double_tap_detection_enabled = false; static bool ...
ARRAY_LENGTH(readings)
; i++) { int base = i * 2; readings[i] = raw_buf[base] | (raw_buf[base + 1] << 8); } const AccelConfig *cfg = &BOARD_CONFIG_ACCEL.accel_config; data->x = (cfg->axes_inverts[AXIS_X] ? -1 : 1) * prv_raw_to_mgs(readings[cfg->axes_offsets[AXIS_X]]); data->y = (cfg->axes_inverts[AXIS_Y] ? -1 : 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...
{ return false; }
bool success = false; // Scan the dictionary: const size_t dict_size = length - sizeof(AppMessagePush) + sizeof(Dictionary); DictionaryIterator iter; const Tuple *tuple = dict_read_begin_from_buffer(&iter, (const uint8_t *) &push_message->dictionary, ...
/* * 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...
(sequence)
)) { // return the last frame if the elapsed time is longer than the total duration return gdraw_command_sequence_get_frame_by_index(sequence, sequence->num_frames - 1); } elapsed %= prv_get_single_play_duration(sequence); uint32_t total = 0; GDrawCommandFrame *frame = sequence->frames; for (uint32_...
(i2c_buses[i].i2c)
; } s_initialized = true; for (uint32_t i = 0; i < ARRAY_LENGTH(i2c_buses); i++) { if (BOARD_CONFIG.i2c_bus_configs[i].rail_cfg_fn) { BOARD_CONFIG.i2c_bus_configs[i].rail_cfg_fn(); } if (BOARD_CONFIG.i2c_bus_configs[i].rail_ctl_fn) { bus_rail_power_down(i); } } } void i2c_use(I2cD...
xt* ctx, GPoint p, uint16_t radius) { s_fill_points = prv_copy_points(&p, 1, s_offset); s_radius = radius; s_circle_fill_count++; } void graphics_context_move_draw_box(GContext* ctx, GPoint offset) { s_offset = offset; } void graphics_line_draw_precise_stroked(GContext* ctx, GPointPrecise p0, GPointPrecise p1...
(s_stroke_color.argb, GColorRedARGB8)
; cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_stroke_width, 2); cl_assert_equal_i(s_path_num_points, 2); cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points, s_stroke_...
/* * 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_handle_init()
; app_event_loop(); evented_timer_cancel(s_timer); } const PebbleProcessMd* mfg_accel_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, // UUID: ED2E214A-D4B5-4360-B5EC-612B9E49FB95 .common.uuid = { 0xED, 0x2E, 0x21, 0x4A, 0xD4, 0xB5, 0x43, 0x60, ...
ool bitmap_supports_transparency = (bitmap_format != GBitmapFormat1Bit); // DISPOSE_OP_BACKGROUND sets the background to black with transparency (0x00) // If we don't support tranparency, just do nothing. if (bitmap_supports_transparency && (png_decoder_data->last_dispose_op == APNG_DISPOSE_OP_BACKGROUND))...
MIN((int32_t)fctl.width, row_info.max_x - delta_x + 1)
; x++) { const uint32_t corrected_dst_x = x + delta_x; uint8_t channel = raw_image_get_value_for_bitdepth(upng_buffer, x, y, row_stride_bytes, bpp); if (transparent_gray >= 0 && channel == transparent_gray) { // Gra...
const uint8_t* data, unsigned int data_length) { cl_assert_equal_i(data_length, 1); cl_assert_equal_i(data[0], 0x08); // MusicEndpointCmdIDGetAllInfo s_now_playing_requested = true; } static bool s_next_track_command_sent; static void prv_assert_next_track_command_sent_cb(uint16_t endpoint_id, ...
(zero_length_now_playing, sizeof(zero_length_now_playing))
; cl_assert_equal_b(music_has_now_playing(), false); } void test_music_endpoint__ignore_malformatted_messages(void) { // Android app connects: prv_receive_app_info_event(true /* is_android */); const uint8_t malformatted_artist[] = { 0x10, 14, 'o', 'n', 'e', 3, 't', 'w', 'o', 5, 't', 'h', 'r', 'e', 'e' }...
THOUT 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 "health_util.h" #include "services/common/i18n/i18n.h" #include "services/normal/activity/activity.h" #include "shell/prefs.h" #i...
{ GTextNodeText *hours_text_node = health_util_create_text_node(hours_and_minutes_buffer_size, number_font, color, container); snprintf((char *) hours_text_node->text, hours_and_minutes_buffer_size, i18n_get("%d", i18n_owner), hours)...
if (hours != INT_MIN && minutes != INT_MIN) { // add a space between the H and the number of minutes health_util_create_text_node_with_text(i18n_get(" ", i18n_owner), units_font, color, container); } if (minutes != INT_MIN) { GTextNodeText *minutes_text_node = health_util_create_text_node(hours_and...
vice handlers static void prv_did_focus(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_...
("Launcher Menu")
); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .unload = prv_window_unload, }); const bool animated = false; app_window_stack_push(window, animated); } static void prv_main(void) { const LauncherMenuArgs *args = (const Launche...
v[i]); if (!prv_check_value_number_within_bounds(RockyArgTypeFixedS16_3, &d, value_error_out)) { value_error_out->arg_offset = i; return false; } v[i] = prv_fixed_s3_from_double(d); } *((GRectPrecise *)binding->ptr) = (GRectPrecise) { .origin.x = v[0], .origin.y = v[1], .size.w =...
{ for (uint32_t i = 0; i < num_arg_bindings; ++i) { const RockyArgBinding *binding = &arg_bindings[i]; RockyArgAssignImp imp; prv_init_arg_assign_imp(binding->type, &imp); // Check number of arguments: // TODO: PBL-40644: support optional bindings if (i + imp.expected_num_args > argc) { ...
--------------------------------------------- static void prv_debug_cmd_weekday_averages(int index, void *context) { ActivityDemoAppData *data = context; prv_display_averages_alert(data, Monday); } // ----------------------------------------------------------------------------------------- static void prv_debug_c...
for (int i = (int)chunk - k_num_last_minutes; i < (int)chunk; i++) { HealthMinuteData *m_data = &minute_data[i]; char temp[32]; snprintf(temp, sizeof(temp), "\n%"PRId8", 0x%"PRIx8", %"PRIu16", %"PRId8" ", m_data->steps, m_data->orientation, m_data->vmc, m_data->light); safe_strcat...
} prv_display_alert(data->debug_card.dialog_text); exit: app_free(minute_data); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_send_fake_logging_record(int index, void *context) { activity_test_send_fake_dls_records(); } // -------...
sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight); } else if (strcmp(token, "TEST_NAME") == 0) { sscanf(token + strlen(token) + 1, "%s", state->test_entry.name); } } // If this is a "static AlgDlsMinuteData samples[] = {" line, skip it if (strcmp(token, "static")...
{ sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.min); }
else if (strcmp(token, "TEST_LEN_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.max); } else if (strcmp(token, "TEST_START_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.value); } else if (strcmp(token, "TEST_START_AT_MIN") ==...
metas[i].expected_destination); ppogatt_close(client); } } void test_ppogatt__handles_unsupported_meta_ppogatt_version(void) { PPoGATTMetaV0 future_meta_non_compatible = s_meta_v0_system; future_meta_non_compatible.ppogatt_min_version = 0xaa; future_meta_non_compatible.ppogatt_max_version = 0xff; prv_n...
(s_characteristics[0][PPoGATTCharacteristicMeta], NULL, 0, BLEGATTErrorInvalidHandle)
; cl_assert_equal_i(ppogatt_client_count(), 0); } void test_ppogatt__cleanup_client_when_data_subscription_cccd_write_failed(void) { fake_gatt_client_subscriptions_set_subscribe_return_value(BTErrnoInvalidParameter); prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][...
Version NOW, // Timestamp 1234, // Sleep Duration 1111, // Deep Sleep Duration 2222, // Fall Asleep Time 3333, // Wakeup Time 4444, // Active Time 5555, // Typical sleep duration 6666, // Typical deep sleep duration 7777, // Ty...
(health_db_get_typical_value(ActivityMetricSleepExitAtSeconds, Monday, &val_out))
; cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalWakeupTime]); } void test_health_db__hr_zone_data(void) { const char *key = "monday_heartRateZoneData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_hr_zone_data, sizeof(s_hr_zone_data)), ...
_storage_updates = 0; } /////////////////////////////////////////////////////////////////////////////////////////////////// //! BT Classic Pairing Info static void prv_call_bt_classic_bonding_change_handlers(BTBondingID bonding, BtPersistBondingOp op) { prv_u...
(key, BtPersistBondingTypeBTClassic)
; } if (name && link_key) { // For now make the active gateway the most recently added BT Classic pairing if (op == BtPersistBondingOpDidAdd) { bt_persistent_storage_set_active_gateway(key); } prv_call_bt_classic_bonding_change_handlers(key, op); } return key; } void bt_persistent_stora...
#if PBL_ROUND bounds = grect_inset_internal(bounds, 0, STATUS_BAR_LAYER_HEIGHT); #endif menu_layer_init(&data->day_picker_menu_layer, &bounds); menu_layer_set_callbacks(&data->day_picker_menu_layer, data, &(MenuLayerCallbacks) { .get_num_sections = prv_day_picker_get_num_sections, .get_num_rows = prv_day_...
{ // drawing a day of the week const char *cell_text; // List should start off with Monday uint16_t day_index = cell_index->row % DAYS_PER_WEEK; const struct lc_time_T *time_locale = time_locale_get(); cell_text = i18n_get(time_locale->weekday[day_index], &data->custom_day_picker_window); if (d...
} static bool prv_is_custom_day_scheduled(AlarmEditorData *data) { for (unsigned int i = 0; i < sizeof(data->scheduled_days); i++) { if (data->scheduled_days[i]) { return true; } } return false; } static void prv_custom_day_picker_handle_selection(MenuLayer *menu_layer, MenuIndex *cell_index, ...
TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 200; const int duration_c = 500; const int repeat_count = 5; int duration_total = duration_a + MAX(duration_b, duration_c); // Create 3 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); ...
(&s_started_handler_calls, b)
, 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c)...
, num_entries); prv_test_new_order_with_filter_callback(watchface_order, num_entries, watchface_filter_callback); } } void test_app_menu_data_source__last_app_not_in_order_file(void) { // settings has to be at the beginning. The app_menu_data_source module enforces i...
{ AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); cl_assert_equal_i(node->install_id, desired_order[i]); }
app_menu_data_source_deinit(&data_source); } void test_app_menu_data_source__complete_sorted_order(void) { // Apps are sorted in the order of Quick Launch only, Override apps, Storage (smallest first), // Record (smallest first), and finally Install ID (smallest first). Verify that this is true. // This also...
/* * 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 0; }
handlers.will_change, prv_will_change); const GRect from_area = GRect(0, 0, DISP_COLS, 400); const GRect to_area = GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_will_change(from_area.size.h, to_area.size.h); fake_event_service_handle_last(); unobstructed_area_service_will_change(from_area.size.h, t...
GRect(0, 0, DISP_COLS, 200)
; unobstructed_area_service_will_change(from_area.size.h, to_area.size.h); UnobstructedAreaHandlers handlers = { .will_change = prv_will_change, .did_change = prv_did_change, }; app_unobstructed_area_service_subscribe(handlers, s_data.context); cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTE...
(&ctx->dest_bitmap, diff, false /* patch_garbage */)
; } } compositor_port_hole_transition_draw_outer_ring(ctx, ABS(current_offset_px), GColorBlack); s_data.animation_offset_px = current_offset_px; } const CompositorTransition *compositor_port_hole_transition_app_get( CompositorTransitionDirection direction) { if (compositor_transition_app_to_app_should...
E_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertOther)); cl_assert(!alerts_should_vibrate_for_type(AlertOther)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); ...
alerts_should_notify_for_type(AlertReminder)
); cl_assert(!alerts_should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder)); cl_assert(!alerts_should_notify_for_type(AlertOther)); cl_assert...
AppStatus_Stopped = 0, AppStatus_Enabled_1HZ = 1, } AppStatus; typedef struct { HRMSessionRef session; EventServiceInfo hrm_event_info; Window window; TextLayer bpm_text_layer; TextLayer quality_text_layer; char bpm_string[BPM_STRING_LEN]; bool ready_to_send; DictionaryIterator *out_iter; } AppD...
dict_write_uint32(app_data->out_iter, AppMessageKey_Model, watch_color)
; prv_send_msg(); } static void prv_handle_hrm_data(PebbleEvent *e, void *context) { AppData *app_data = app_state_get_user_data(); if (e->type == PEBBLE_HRM_EVENT) { PebbleHRMEvent *hrm = &e->hrm; // Save HRMEventBPM data and send when we get the current into. static uint8_t bpm = 0; static u...
void ams_handle_service_removed(BLECharacteristic *characteristics, uint8_t num_characteristics) { ams_invalidate_all_references(); } void ams_handle_service_discovered(BLECharacteristic *characteristics) { if (!s_ams_client) { return; } BLE_LOG_DEBUG("In AMS service discovery CB"); PBL_ASSERTN(charact...
if (!s_ams_client) { return; }
prv_set_connected(false); kernel_free(s_ams_client); s_ams_client = NULL; } static void prv_send_command_kernel_main_task_cb(void *data) { if (!s_ams_client) { return; } const AMSRemoteCommandID command_id = (uintptr_t)data; BLECharacteristic characteristic = s_ams_client->characteristics[AMSCharac...
prv_handle_escape_character(state); if (state->error->status != TemplateStringErrorStatus_Success) { return; } state->position++; } if (*state->position == '\0') { state->error->status = TemplateStringErrorStatus_MissingClosingQuote; return; } // Skip the delimiter state->position++...
{ while ((*state->position != '}') && (*state->position != '\0')) { if (state->filters_complete) { state->error->status = TemplateStringErrorStatus_FormatBeforeLast; return; } // Find the filter's opening paren const char *filter_name_paren = strchr(state->position, '('); if (!filter_n...
return; } // Skip past the closing brace. state->position++; } bool template_string_evaluate(const char *input_template_string, char *output, size_t output_size, TemplateStringEvalConditions *eval_cond, const TemplateStringVars *vars, TemplateStrin...
prv_assign_horizontal_line_raw prv_assign_row_with_pattern_1bit(framebuffer, y, x1, x2 - x1 + 1, color); #endif // SCREEN_COLOR_DEPTH_BITS == 8 } // This function draws vertical line with blending, given values have to be clipped and adjusted // clip_box and draw_box respecively. T_STATIC void prv_blend_vertical_...
if (width > 0) { prv_set_color(ctx, output, data_row_offset, x1.integer, width, color); output += width; x1.integer += width; }
// last pixel with blending (don't render first *and* last pixel if line length is 1) if (right_aa_offset <= 1) { if (x1.integer <= clip_box_max_x) { graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, color, x1.integer, (uint8_t)x2.fractio...
ut, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_3, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_3, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_3, name_out); cl_assert_equal_i(platform_bi...
cl_assert(id != BT_BONDING_ID_INVALID)