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...
{ return ReconnectType_BleHrm; }
if (s_is_basic_reconnection_enabled) { return ReconnectType_Plain; } return ReconnectType_None; } static void prv_unschedule_adv_if_needed(void) { if (prv_is_advertising_for_reconnection()) { gap_le_advert_unschedule(s_reconnect_advert_job); } } static void prv_evaluate(ReconnectType prev_type) { ...
/* * 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...
(this->pdm_frequency % MIC_SAMPLE_RATE == 0)
; uint32_t oversampling_ratio = this->pdm_frequency / MIC_SAMPLE_RATE; uint32_t sinc_order = (oversampling_ratio <= k_max_sinc4_osr) ? DFSDM_SincOrder_Sinc4 : DFSDM_SincOrder_Sinc3; // Calculate the right shift needed to contain the final value within 24 bits int num_bits = ceil_log_two(oversampling_rati...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const char* hw_version; // Initially, bunch of XXs: hw_version = mfg_get_hw_version(); cl_assert(strcmp(hw_version, "XXXXXXXX") == 0); // Test writing & reading back: const char* written_hw_version1 = "ABCDEFG"; command_hwver_write(written_hw_version1); hw_version = mfg_get_hw_version(); cl_assert...
void test_mfg_serials__serial_number_console(void) { const char* serial; // Initially, bunch of XXs: serial = mfg_get_serial_number(); cl_assert_equal_s(serial, "XXXXXXXXXXXX"); // Test writing & reading back: const char* written_serial1 = "ABCDEFGHIJKL"; command_serial_write(written_serial1); seria...
56, 816, -888}, { -696, 1392, -688}, { -736, 1208, -568}, { -856, 944, -472}, { -720, 536, -800}, // 29 seconds { -296, 512, -1080}, { -328, 496, -744}, { -384, 624, -584}, { -424, 520, -656}, { -480, 336, -656}, { -480, 112, -456}, { -424, -264, -280}, { -112, -240, ...
{ 1480, 568, -80}, { 960, 544, -144}, { 864, 528, -168}, { 856, 520, -80}, { 1112, 560, 16}, { 1400, 472, 56}, { 1320, 328, 64}, { 1296, 216, 64}, { 1224, 200, 8}, { 1200, 320, -64}, { 1040, 352, -120}, { 920, 328, -120}, { 1136, 296, -152}, { 1032, 264, -312}, ...
{ 1168, 272, -64}, { 928, 72, -32}, { 1152, -16, 72}, { 1040, 136, -16}, { 1040, 288, -168}, { 1184, 288, -160}, { 1288, 288, -136}, { 1216, 320, -168}, { 1096, 536, -120}, { 1088, 448, -80}, { 1096, 376, 16}, { 1240, 440, -24}, { 1152, 448, -16}, { 1336, 512, 64...
y be 2 of these callback in the queue at time if this is called right after // a prv_pop_with_delay return; } if (s_phone_ui_data->open_reply_menu_on_pop) { prv_open_reply_action_menu(NULL); } window_stack_remove(&s_phone_ui_data->window, true /* animated */); // The window_stack_remove() call ...
(&s_phone_ui_data->core_ui_container, &s_phone_ui_data->caller_id_text_layer.layer)
; // Shrink the bounds but not the frame size to allow for centering when action bar removed s_phone_ui_data->caller_id_text_layer.layer.bounds.size.w = width - TEXT_RIGHTSIDE_PADDING; // Status text const GRect call_status_text_rect = GRect(TEXT_MARGIN_WIDTH, style->status_pos_y, ...
_data, false /*simulate_bg_delays*/); // Retrieve all of the minute data at once HealthMinuteData retrieve[num_minutes * 2]; uint32_t num_records = num_minutes; time_t start = start_utc + 5; // starting just past the minute to test that &start gets updated activity_algorithm_get_minute_history(retrieve, &nu...
prv_assert_minute_data(&received_records[j], &minute_data[next_read_minute_idx + j])
; } // Advance another minute. It doesn't matter what data we feed in prv_feed_minute_data(1, minute_data + next_write_minute_idx, false /*simulate_bg_delays*/); } // Let's add data for a partial minute and make sure that gets returned const int exp_steps = 23; oldest_to_fetch = rtc_get_time() - S...
NULL); } DEFINE_SYSCALL(bool, sys_hrm_manager_unsubscribe, HRMSessionRef session) { HRM_LOG("Unsubscribing"); bool success = false; mutex_lock_recursive(s_manager_state.lock); HRMSubscriberState *state = prv_get_subscriber_state_from_ref(session); if (state) { ...
{ s_tia_count = 0; sys_hrm_manager_unsubscribe(s_console_session); s_console_session = hrm_manager_subscribe_with_callback( INSTALL_ID_INVALID, 1 /*update_interval_s*/, 0 /*expire_s*/, HRMFeature_LEDCurrent, prv_console_read_callback, NULL); prompt_command_continues_after_returning(); }
t dst_id; //!< daylight savings time index identifier } tz_data; // Load the timezone information for the region_id, excluding the country + city_name itself if (!prv_database_read(region_offset + 1 + TIMEZONE_CITY_LENGTH, &tz_data, sizeof(tz_data))) { *tz_info = (TimezoneInfo) { .dst_id = 0 }...
prv_get_link_count()
er.id, &s_long_items[2].header.id)); #endif cl_assert(!iter_prev(&iterator)); } static int prv_num_items(Iterator iterator) { int n = 1; while (iter_next(&iterator)) { n++; } return n; } void test_timeline__gc_past(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head...
cl_assert(state.node->all_day)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_deinit(&data->status_text_layer)
; window_deinit(&data->window); app_free(data); } static void prv_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* mfg_hrm_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &prv_main, .name = "MfgHRM", }; r...
ms(); 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); cl_assert(max_loops > 0); max_loops--; } // Make sure the frame reached the "to" state cl_assert_equal_point(layer.fr...
ABSOLUTE_VALUE(s_started_handler_calls.entries[0].fired_time_ms - start_ms - delay)
<= 1); cl_assert_equal_i(s_setup_handler_calls.num_calls, 1);; cl_assert(s_setup_handler_calls.entries[0].fired_time_ms - start_ms <= 1); cl_assert_equal_i(s_stopped_handler_calls.num_calls, 1);; cl_assert(s_stopped_handler_calls.entries[0].fired_time_ms - start_ms >= duration); cl_assert(s_stopped_handler...
; uint8_t status_reg; prv_read_register(dev, dev->state->part->instructions.read_status, &status_reg, 1); if (!(status_reg & dev->state->part->status_bit_masks.busy)) { // no erase in progress qspi_release(QSPI); return S_NO_ACTION_REQUIRED; } prv_write_cmd_no_addr(dev, dev->state->part->instruc...
qspi_use(dev->qspi)
lity only exists for popups (modal windows) which currently all // run on Kernel Main launcher_task_add_callback(prv_clear_stale_reminders, data); } static void prv_setup_reminder_watchdog(NotificationWindowData *data) { if (!data->is_modal || regular_timer_is_scheduled(&data->reminder_watchdog_timer_id) || ...
dialog_set_text(dialog, msg)
; dialog_set_icon(dialog, RESOURCE_ID_RESULT_MUTE_LARGE); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); i18n_free(msg, dialog); simple_dialog_push(simple_dialog, prv_get_window_stack()); } static void prv_mute_notification(const ActionMenuItem *action_menu_item, uint8_t ...
eout = 100 * 10; while (GPIO_ReadInputDataBit(DISP_GPIO, DISP_PIN_CDONE) == 0) { if (timeout-- == 0) { dbgserial_putstr("FPGA CDONE timeout expired!"); return false; } delay_us(100); } return true; } static bool prv_reset_into_nvcm(void) { // Reset the FPGA and wait for it to program it...
(CMD_RESET_ASSERT)
; prv_end_command(); ASSERT_BUSY_IS(Bit_RESET); dbgserial_print("Are draw-scene commands ineffectual while in reset? "); prv_draw_scene(SCENE_BLACK); ASSERT_BUSY_IS(Bit_RESET); dbgserial_print("Does releasing reset allow draw-scene commands " "to function again? "); prv_start_command(C...
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 1); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_C...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
istNode *)new_node, prv_alarm_comparator, false); } static void prv_update_alarm_list(AlarmsAppData *data) { prv_clear_alarm_list(data); alarm_for_each(prv_add_alarm_to_list, data); data->can_schedule_a...
{ AlarmsAppData *data = (AlarmsAppData *)callback_context; // Number of alarms + the add alarm header return list_count((ListNode*) data->alarm_list_head) + 1; }
static int16_t prv_alarm_list_get_cell_height_callback(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { return menu_cell_basic_cell_height(); } static void prv_alarm_list_draw...
/* * 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 (periph_addr < AHB2PERIPH_BASE) { return RCC_AHB1PeriphClockCmd; } else if (periph_addr < AHB3_BASE) { return RCC_AHB2PeriphClockCmd; } else { return RCC_AHB3PeriphClockCmd; }
} void periph_config_init(void) { } void periph_config_acquire_lock(void) { } void periph_config_release_lock(void) { } void periph_config_enable(void *periph, uint32_t rcc_bit) { ClockCmd clock_cmd = prv_get_clock_cmd((uintptr_t)periph); #if PERIPH_CONFIG_DEBUG if (prv_string_for_cmd(clock_cmd)) PERIPH_CO...
), &backlight_behaviour, sizeof(backlight_behaviour)); temp = (backlight_behaviour != BacklightBehaviour_Off); settings_file_set(file, PREF_KEY_BACKLIGHT_ENABLED, sizeof(PREF_KEY_BACKLIGHT_ENABLED), &temp, sizeof(temp)); temp = (backlight_behaviour != BacklightBeh...
PBL_ASSERT(success, "Failure to store new value for %s in settings file", key)
; // Update the backing store if (success) { prv_set_pref_backing(entry, value, val_len); } } // ------------------------------------------------------------------------------------ // Exported function used by blob_db API to set the backing store for a specific key bool prefs_private_write_backing(const u...
gbitmap_get_data_row_info(bitmap, corrected_y)
; // delta_x is the first bit of data in this frame relative to the bitmap's coordinate system const int16_t delta_x = fctl.x_offset + bitmap->bounds.origin.x; // for each pixel in this frame, clipping to the bitmap geometry for (int32_t x = MAX(0, row_info.min_x - delta_x); x < MIN...
/* * 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(node)
; LauncherAppGlanceWatchfaces *watchfaces_glance = app_zalloc_check(sizeof(*watchfaces_glance)); // Copy the name of the Watchfaces app as the title const size_t title_size = sizeof(watchfaces_glance->title); strncpy(watchfaces_glance->title, node->name, title_size); watchfaces_glance->title[title_size - 1]...
app_outbox_sender_defs[] = { [AppOutboxServiceTagAppMessageSender] = { .sent_handler = app_message_outbox_handle_app_outbox_message_sent, .max_length = (sizeof(AppMessageAppOutboxData) + APP_MSG_HDR_OVRHD_SIZE + APP_MSG_8K_DICT_SIZE), .max_pending_messages = 1, }, #ifdef UNITTEST [AppOutboxServiceTagU...
{ if (s_app_outbox_consumer[tag].head == head) { return &s_app_outbox_consumer[tag]; } }
rl_text_layer. const int16_t window_width = data->launch_app_window.layer.frame.size.w; const int16_t text_x_offset = (window_width - content_size.w) / 2; #if PLATFORM_ROBERT || PLATFORM_CALCULUS const int16_t text_y_offset = 33; #else const int16_t text_y_offset = 22; #endif const GRect frame = { { text_x_of...
{ return; }
if (event->debug_info.state == DebugInfoStateStarted) { prv_show_spinner(s_fu_app_data); } else { prv_hide_spinner(s_fu_app_data); } } //////////////////// // App boilerplate static void handle_init(void) { launcher_block_popups(true); RecoveryFUAppData *data = app_malloc_check(sizeof(RecoveryFUAp...
if (running) { status = "is"; } APP_LOG(APP_LOG_LEVEL_INFO, "worker %s running", status); } s_seconds_count++; if ((s_seconds_count % 5) == 0) { int value = persist_read_int(42); // APP_LOG(APP_LOG_LEVEL_INFO, "Updating persist value from %d to %d", value, value + 1); persist_write_in...
APP_LOG(APP_LOG_LEVEL_INFO, "launch result: %d", result)
; // Subscribe to health service health_service_events_subscribe(health_event_handler, NULL); } int main(void) { handle_init(); app_event_loop(); handle_deinit(); }
* * 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 language gove...
memset(result, 0, sizeof(ScanResult))
; } // Update all the fields into the result: result->device = device; result->rssi = rssi; // Try getting TX Power Level: int8_t tx_power_level; if (ble_ad_get_tx_power_level(ad_data, &tx_power_level)) { APP_LOG(APP_LOG_LEVEL_INFO, "TX Power: %d", tx_power_level); result->tx_power_level = tx_po...
.activity = KAlgActivityType_Walk, .start_utc = now + 10 * SECONDS_PER_MINUTE, .steps = len * 80, // 80 steps/min .len_minutes = len, .resting_calories = len * 100, .active_calories = len * 200, .distance_mm = len * 1000, }; prv_insert_artificial_activity_session(minute_...
(s_num_captured_activity_sessions, 2)
; ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session_walk); ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session_run); } ...
on_uid; ns_notification.uid = ancs_notification_dict_uid; prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); } static void prv_send_notification(const uint8_t *ancs_notification_dict) { prv_send_notification_with_event_flags(ancs_notification_dict, 0); } static uint8_t *pr...
if (cmd_header->command_id == CommandIDGetAppAttributes) { s_num_requested_app_attributes++; if (strcmp((const char *)cmd_header->data, "com.tests.NotAnApp") == 0) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_fake_app_info_dict), (uint8_t *)s_fake_app_info_...
License for the specific language governing permissions and * limitations under the License. */ #include "menu_layer.h" #include "applib/graphics/graphics.h" #include "applib/ui/kino/kino_reel.h" #include "applib/ui/kino/kino_reel_gbitmap_private.h" #include "process_management/process_manager.h" #include "shell/s...
(subtitle_font)
: 0; const int16_t full_height = title_height + subtitle_height + 10; const int horizontal_margin = menu_cell_basic_horizontal_inset(); const int vertical_margin = (bounds->size.h - full_height) / 2; int left_margin = 0; GRect box; const GAlign icon_align = (GAlign)config->icon_align; if (config->icon) ...
issue with this, we can sort the names and to a binary search T_STATIC const RockyAPIGraphicsColorDefinition s_color_definitions[] = { // taken from https://developer.mozilla.org/en-US/docs/Web/CSS/color_value {"black", GColorARGB8FromHEX(0x000000)}, {"silver", GColorARGB8FromHEX(0xc0c0c0)}, {"gray", GColorARGB...
(0xfafad2)
}, // {"lightgray", GColorARGBFromHEX(0xd3d3d3)}, inconsistent with Pebble color {"lightgreen", GColorARGB8FromHEX(0x90ee90)}, // {"lightgrey", GColorARGBFromHEX(0xd3d3d3)}, inconsistent with Pebble color {"lightpink", GColorARGB8FromHEX(0xffb6c1)}, {"lightsalmon", GColorARGB8FromHEX(0xffa07a)}, {"lightseagre...
e: case GBitmapFormat4BitPalette: return true; case GBitmapFormat8BitCircular: return BITMAP_FORMAT_IS_CIRCULAR_FULL_SCREEN(size, format); #endif default: return false; } } static bool prv_is_palettized_format(GBitmapFormat format) { return format >= GBitmapFormat1BitPalette && format...
{ GBitmap *bitmap = prv_allocate_gbitmap(); if (!bitmap) { return NULL; } if (!gbitmap_init_with_resource_system(bitmap, app_num, resource_id)) { applib_free(bitmap); return NULL; } return bitmap; }
static bool prv_init_with_pbi_data(GBitmap *bitmap, uint8_t *data, size_t data_size, bool is_builtin) { // Initialize our metadata gbitmap_init_with_data(bitmap, data); if (is_builtin) { // for builtin resources, we don't do the extra bitmap manipulation below. return ...
quired for this process before it starts to execute process_manager_process_setup(PebbleTask_Worker); char task_name[configMAX_TASK_NAME_LEN]; snprintf(task_name, sizeof(task_name), "Worker <%s>", process_metadata_get_name(s_worker_task_context.app_md)); TaskParameters_t task_params = { .pvTaskCode = prv_...
{ app_manager_force_quit_to_launcher(); }
t = prv_migrate_local_time_to_UTC(t); rtc_sanitize_time_t(&t); rtc_set_time(t); // Pivot RTC from localtime to UTC prv_migrate_timezone_info(tz_info->tm_gmtoff); } } typedef struct PACKED { // This struct is packed because it mirrors the endpoint definition: // https://pebbletechnology.atlassian.ne...
for (int i = 0; i < DST_YEARS_RANGE; i++) { const int year = current_tm.tm_year + (i - DST_YEARS_OFFSET); dst_start_stamps[i] = prv_clock_dstrule_to_timestamp(false, tz_info, &dst_rule_begin, year); dst_end_stamps[i] = prv_clock_dstrule_to_timestamp(true, tz_info, &dst_rule_end, year); }
// Figure out which timestamps are relevant to us int start_idx = DST_YEARS_OFFSET; int end_idx = DST_YEARS_OFFSET; if (dst_start_stamps[start_idx] > dst_end_stamps[end_idx]) { start_idx--; } if (dst_start_stamps[start_idx] < utc_time && dst_end_stamps[end_idx] < utc_time) { start_idx++; 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...
{ return gap_le_start_scan(); }
SystemTagActivitySession, DATA_LOGGING_BYTE_ARRAY, sizeof(dls_record), buffered, resume, &system_uuid); if (!state->activity_dls_session) { PBL_LOG(LOG_LEVEL_WARNING, "Error creating activity DLS session"); return; } } // Log the record DataLoggingResult result = dls_log(state->activi...
(stats->last_deep_exit_utc, session_exit_utc)
d_for_uuid(&s_default_worker); } void worker_preferences_set_default_worker(AppInstallId app_id) { Uuid uuid; app_install_get_uuid_for_install_id(app_id, &uuid); prv_pref_set(PREF_KEY_DEFAULT_WORKER, &uuid, sizeof(uuid)); } bool quick_launch_is_enabled(ButtonId button) { switch (button) { case BUTTON_ID_U...
{ app_install_enumerate_entries( prv_set_default_any_watchface_enumerate_callback, NULL); app_id = app_install_get_id_for_uuid(&s_default_watchface); }
return app_id; } void system_theme_set_content_size(PreferredContentSize content_size) { if (content_size >= NumPreferredContentSizes) { PBL_LOG(LOG_LEVEL_WARNING, "Ignoring attempt to set content size to invalid size %d", content_size); return; } const uint8_t content_size_uint = content_...
== NULL); cl_assert(child_b.next_sibling == NULL); cl_assert(parent.first_child == &child_a); cl_assert(child_a.next_sibling == &child_c); cl_assert(grand_child_a.parent == &child_a); cl_assert(child_c.parent == &parent); // Remove first-child (child_a): // // +-parent // | // '->child_c ...
(aa, actual)
; cl_assert_equal_i(1, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); // go to child if possible actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(aaa, actual); cl_assert_equal_i(2, current_stack); c...
ferred to the TextLayer we assign it to. text_attributes = graphics_text_attributes_create(); graphics_text_attributes_enable_screen_text_flow(text_attributes, 8); #endif // Check if the text takes up more than one line. If the dialog has a single line of text, // the icon and line of text are positioned lower ...
(action_bar, window)
tf(s, sizeof(s), template, args); VOICE_LOG("%s", s); va_end(args); return 0; } #endif static void prv_teardown_session(void) { #if !defined(TARGET_QEMU) // TODO: replace stub #endif } static void prv_stop_recording(void) { #if !defined(TARGET_QEMU) // TODO: replace stub #endif audio_endpoint_stop_trans...
(s_state == SessionState_StartSession || s_state == SessionState_VoiceEndpointSetupReceived || s_state == SessionState_AudioEndpointSetupReceived)
; prv_cancel_session(); PBL_LOG(LOG_LEVEL_WARNING, "Timeout waiting for session setup result "); prv_send_event(VoiceEventTypeSessionSetup, VoiceStatusTimeout, NULL); mutex_unlock(s_lock); } static VoiceStatus prv_get_status_from_result(VoiceEndpointResult result) { VoiceStatus status; switch (result) {...
r_task_context.app_md != NULL && s_worker_task_context.app_md != app_md) { s_next_worker = (NextWorker) { .md = app_md, .args = args, }; worker_manager_close_current_worker(true /*graceful*/); return true; } // Clear the next worker settings s_next_worker = (NextWorker) {}; // Err...
(PebbleTask_Worker, &task_params, &s_worker_task_context.task_handle)
; // If no default yet, set as the default so that it can be relaunched upon system reset if (worker_manager_get_default_install_id() == INSTALL_ID_INVALID) { worker_manager_set_default_install_id(s_worker_task_context.install_id); } return true; } // -----------------------------------------------------...
e_quadrant_draw_1px_non_aa(ctx, p, radius, GCornersAll); p.x += ctx->draw_state.drawing_box.origin.x; p.y += ctx->draw_state.drawing_box.origin.y; graphics_private_set_pixel(ctx, GPoint(p.x, p.y + radius)); graphics_private_set_pixel(ctx, GPoint(p.x, p.y - radius)); graphics_private_set_pixel(ctx, GPoint(p....
while (x < y) { if (f >= 0) { y--; ddF_y += 2; f += ddF_y; } x++; ddF_x += 2; f += ddF_x; if (quadrant & GCornerBottomLeft) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0 - radius, y0), radius + 1); } prv_fill_horizontal_line(ctx, GPoint(x0 ...
} static void graphics_fill_half_circle(GContext* ctx, int x0, int y0, uint16_t radius, uint8_t section) { int f = 1 - radius; int ddF_x = 1; int ddF_y = -2 * radius; int x = 0; uint16_t y = radius; while (x < y) { if (f >= 0) { y--; ddF_y += 2; ...
const int jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 9th 2015, 16:00:00 // Now - one day const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY + (4 * SECONDS_PER_HOUR); // if the event is within 24 hours, then show the actual ti...
(event_time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUTE))
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 H AGO", time_buf); // June 9th 2015, 16:01:00 (T+00:01:00) rtc_set_time(event_time + (1 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELAT...
s zero) snprintf(dstbuf, 256, "%.*ozero%.*o", -3, 0, -3, 1); cl_assert_equal_s(dstbuf, "zero1"); // Horrible thing snprintf(dstbuf, 256, "%#.ozero", 0); cl_assert_equal_s(dstbuf, "0zero"); // Length modifiers uint64_t hurf = 0x123456789ABCDEF0ULL; snprintf(dstbuf, 256, "%hho,%ho,%o,%lo", hurf, hurf, h...
cl_assert_equal_s(dstbuf, "There are 10 lights, FFFFFFFC")
; // Space for positive signed // No signed conversion occurs, so this is a no-op snprintf(dstbuf, 256, "There are % X lights, the absolute value of % X", 16, -4); cl_assert_equal_s(dstbuf, "There are 10 lights, the absolute value of FFFFFFFC"); // Plus for positive signed // No signed conversion occurs, ...
/* * 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 NULL; }
int8_t vibe_get_braking_strength(void) { return -100; } // fake typedef struct VibeStep { uint32_t duration_ms; int strength; } VibeStep; static VibeStep s_vibe_queue[256]; static int s_vibe_queue_index; bool sys_vibe_pattern_enqueue_step_raw(uint32_t duration_ms, int32_t strength) { s_vibe_queue[s_vibe_que...
/* * 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...
pstring_equal(ps1, ps4)
); cl_assert(!pstring_equal(ps1, ps2)); cl_assert(!pstring_equal(ps1, ps3)); cl_assert(!pstring_equal(ps2, ps3)); cl_assert(!pstring_equal(ps1, NULL)); cl_assert(!pstring_equal(NULL, NULL)); } void test_pstring__equal_cstring(void) { const char *str1 = "Phil"; uint8_t ps1_buf[128]; PascalString16 *ps1 ...
} snprintf(region_name, buffer_size, "UTC%+d%s", hour_offset, min_buf); } } else { strncpy(region_name, "---", buffer_size); } } int16_t clock_get_timezone_region_id(void) { return rtc_get_timezone_id(); } void clock_set_timezone_by_region_id(uint16_t region_id) { TimezoneInfo tz_info; prv_...
i18n_noop("%B %e")
; } break; case FullStyleLower24h: case FullStyleCapital24h: if (with_fulltime) { time_fmt = i18n_noop("%b %e, %R"); } else { time_fmt = i18n_noop("%B %e"); } break; } } else { switch (style) { case FullStyleLower12h: ...
; TimelineItemAction *reply_action = timeline_item_find_reply_action(item); if (!reply_action) { return; } switch (reply_action->type) { case TimelineItemActionTypeResponse: timeline_actions_push_response_menu(item, reply_action, SMS_REPLY_COLOR, prv_ac...
(action_bar_animation, ACTION_BAR_DISAPPEAR_ANIMATION_FRAMES * ANIMATION_FRAME_MS)
; animation_set_curve(action_bar_animation, AnimationCurveEaseIn); GPoint overshoot = GPoint(PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH / 2, 0) + BOUNCEBACK_DISTANCE, 0); Animation *ui_movement = property_animation_get_animation( property_animation_create_bounds_origin(&s_phone_ui_data->core_ui_container, NULL, ...
tal_line(ctx, y, left_margin, right_margin, (fraction_for_bottom >> 1)); } } } else { // PBL-14798: refactor this. // Top and bottom most point helpers for main loop GPointPrecise tm_p0 = far_left; GPointPrecise tm_p1 = far_top; GPointPrecise...
if (bm_p1.x.raw_value != bm_p0.x.raw_value) { bottom_margin.raw_value = bm_p0.y.raw_value + ((bm_p1.y.raw_value - bm_p0.y.raw_value) * (x - ((bm_p0.x.raw_value + add_bottom) / FIXED_S16_3_ONE.raw_value))) * FIXED_S16_3_ONE.raw_value / (bm_p1.x.raw_value - bm_p0.x.raw_va...
} // Find edges for both caps prv_calc_cap_vert(&p0, radius, x, &top_margin, &bottom_margin); prv_calc_cap_vert(&p1, radius, x, &top_margin, &bottom_margin); // Finally draw line if (top_margin.raw_value <= bottom_margin.raw_value) { graphics_private_draw_vertical_line(ctx...
ed(new_settings->enabled); #endif // BLE_HRM_SERVICE return true; } #endif /* CAPABILITY_HAS_HEALTH_TRACKING */ #if PLATFORM_SPALDING static bool prv_set_s_display_user_offset(GPoint *offset) { s_display_user_offset = *offset; return true; } static bool prv_set_s_should_prompt_display_calibration(bool should_pr...
settings_file_open(&file, SHELL_PREFS_FILE_NAME, SHELL_PREFS_FILE_LEN)
!= S_SUCCESS) { return; } prv_convert_deprecated_backlight_behaviour_key(&file); // Init state for each pref from our backing store uint32_t num_entries = ARRAY_LENGTH(s_prefs_table); const PrefsTableEntry *entry = s_prefs_table; for (uint32_t i = 0; i < num_entries; i++, entry++) { // Keys in th...
Requested); window_stack_remove(windows[0][0], false); // Add priority 2 opaque window 0 cl_assert(NumModalPriorities > 2); window_stack_push(window_stacks[2], windows[2][0], false); // An opaque window just went on-screen // Test: A top window results in Exists // Test: One opaque top window removes T...
modal_manager_event_loop_upkeep()
; cl_assert_equal_i(modal_manager_get_properties(), ModalProperty_Exists | ModalProperty_CompositorTransitions | ModalProperty_RenderRequested); cl_assert_equal_i(windows[3][1]->on_screen, true); cl_assert_equal_i(windows[3][1]->is_click_configured, true); cl_assert_equal...
r_type(AlertInvalid)); cl_assert(!alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_notify_for_type(AlertPhoneCall)); } void test_alerts__phone_calls_only(void) { cl_assert(alerts_get_mask() == AlertMaskAllOn); alerts_set_mask(Ale...
alerts_set_notification_vibe_timestamp()
; fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake_rtc_...
if (animated) { #if PBL_RECT Uuid *second_id = notifications_presented_list_relative( notifications_presented_list_first(), +1); if (second_id) { // On rectangular displays, get the notification below the one we want to focus, // set it as the current notification, then swap up. This allows ...
{ // If we are inserting into the middle of this list, just reaload the swap layer so the // number of notifications displayed is correct prv_reload_swap_layer(data); }
} } alerts_incoming_alert_analytics(); if (alerts_should_vibrate_for_type(prv_alert_type_for_notification_type(type))) { #if CAPABILITY_HAS_VIBE_SCORES VibeScore *score = vibe_client_get_score(VibeClient_Notifications); if (score) { vibe_score_do_vibe(score); vibe_score_destroy(score); ...
d to one segment. */ 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 t...
{ heap_info_ptr = (HeapInfo_t *)(((Alignment_t *)heap->end) - heap->begin->PrevSize); }
else { heap_info_ptr = heap->begin; } /* Loop until we have walked the entire list. */ while (((n_units < LARGE_SIZE) || (heap_info_ptr > heap->begin)) && (heap_info_ptr < heap->end)) { prv_sanity_check_block(heap, heap_info_ptr); /* Check to see if the current entry is free and is l...
return false; } // Undo the magic number trick: if (*length == BLE_AD_DATA_FINALIZED) { *length = 0; } // Append the element to the end: uint8_t * const end = ad_data->data + ad_data->ad_data_length + ad_data->scan_resp_data_length; memcpy(end, (const ...
(uuids, num_uuids)
32_t num_records = ALG_MINUTES_PER_FILE_RECORD; time_t start = oldest_to_fetch; HealthMinuteData received_records[ALG_MINUTES_PER_FILE_RECORD]; activity_algorithm_get_minute_history(received_records, &num_records, &start); cl_assert_equal_i(num_records, ALG_MINUTES_PER_FILE_RECORD); cl_assert_equal...
{ // Create two 2 hour sessions, they should both be considered as separate naps ActivitySession sessions[] = { { .start_utc = start_of_today + (13 * SECONDS_PER_HOUR), // 1pm .length_min = 2 * MINUTES_PER_HOUR, .type = ActivitySessionType_Sleep, }, { .start_utc = ...
{ // Create a 2 hour session that ends after 9pm ==> should be regular sleep ActivitySession sessions[] = { { .start_utc = start_of_today + (20 * SECONDS_PER_HOUR), // 8pm .length_min = 2 * MINUTES_PER_HOUR, .type = ActivitySessionType_Sleep, }, }; uint16_t session_...
/* * 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 (s_custom_res_list.array_size <= s_custom_res_list.next_index) { // grow the list int new_size = (s_custom_res_list.array_size + 1) * 2; s_custom_res_list.custom_resources = realloc(s_custom_res_list.custom_resources, new_size); s_custom_res_list.array_size = new_size; }
s_custom_res_list.custom_resources[s_custom_res_list.next_index] = *res; ++s_custom_res_list.next_index; } static void prv_custom_resource_remove(uint32_t resource_id) { int index = prv_custom_resource_get_index(resource_id); if (index < 0) { return; } --s_custom_res_list.next_index; if (s_custom_...
es(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); // Complete A and start B prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); ...
animation_set_handlers(seq, handlers, seq)
; s_parent_for_sequence_unschedule_from_child = seq; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Complete A and start B. This should unschedule the parent prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_eq...
; } if (now != earliest_start_time) { // We need to adjust the delays of each child since one or more were already scheduled uint32_t child_start; if (child->abs_start_time_ms) { child_start = child->abs_start_time_ms - child->delay_ms; } else { success =...
(time_normalized_raw, ANIMATION_NORMALIZED_MAX)
; } return time_normalized_raw; } AnimationProgress animation_private_get_animation_progress(const AnimationPrivate *animation) { // FIXME PBL-25497: Make this function less fragile // Calling prv_get_ms_since_system_start() here means this function will have different return // values if it's called multipl...
X; while ((timeout_attempts-- > 0) && (bus->busy)) {}; bus->busy = false; return (timeout_attempts != 0); } static void prv_semaphore_give(I2CBusState *bus) { bus->busy = false; } static void prv_semaphore_give_from_isr(I2CBusState *bus) { bus->busy = false; return; } /*-------------------BUS/PIN CONFIG ...
PBL_LOG(LOG_LEVEL_ERROR, "Attempted release of disabled bus %s", slave->bus->name)
; return; } slave->bus->state->user_count--; if (slave->bus->state->user_count == 0) { prv_bus_disable(slave->bus); } } void i2c_reset(I2CSlavePort *slave) { PBL_ASSERTN(slave); if (slave->bus->state->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted reset of disabled bus %s when still i...
_menu_app_get_app_info(); } void launcher_cancel_force_quit(void) { } void light_reset_user_controlled(void) { } void mpu_set_task_configurable_regions(MemoryRegion_t *task_params, const MpuRegion **region_ptrs) { } void task_init(void) {} void pebble_task_register(PebbleTask task, TaskHandle_t task_handle) { } v...
test_app_manager__start_first()
; app_manager_launch_new_app(&(AppLaunchConfig) { .md = &s_third_party_app.common, }); // We've sent the deinit event to the first app, but it's going to continue running. cl_assert_equal_i(s_last_to_app_event.type, PEBBLE_PROCESS_DEINIT_EVENT); cl_assert(app_manager_get_current_app_md() == (PebbleProce...
enable_display_access(); prv_display_write_byte(DISP_MODE_CLEAR); prv_display_write_byte(0x00); prv_disable_display_access(); } //! Static mode is entered by sending 0x00 to the panel //! This stops any further updates being registered by //! the display, preventing corruption on shutdown / boot static void pr...
(buffer, 0x00, sizeof(buffer))
; prv_draw_bitmap(dead_face_bits, 24, 32, dead_face_width, dead_face_height, buffer); prv_draw_code(code, buffer); prv_draw_bitmap(error_url_bits, 16, 144, error_url_width, error_url_height, buffer); prv_display_buffer(buffer); } //! Do whatever is necessary to prevent visual artifacts when resetting //! t...
cl_assert_(timingr != I2C_TIMINGR_INVALID_VALUE, "timingr == I2C_TIMINGR_INVALID_VALUE")
; cl_assert_equal_i((timingr >> 28) + 1, expected_prescaler); cl_assert_equal_i((timingr & 0xFF) + 1, expected_scl_low); cl_assert_equal_i(((timingr >> 8) & 0xFF) + 1, expected_scl_high); cl_assert_equal_i(((timingr >> 20) & 0xF) + 1, expected_scl_delay); } void test_i2c_timingr__valid_no_prescaler_no_rise_fal...
792, 400, 216}, { -832, 520, 256}, { -840, 328, 408}, { -888, 280, 296}, { -840, 256, 608}, { -896, 56, 528}, { -824, 432, 584}, // 78 seconds { -752, 240, 824}, { -968, 784, -256}, { -736, 408, 416}, { -824, 520, -104}, { -616, 296, 104}, { -792, 840, 760}, { -76...
{ -328, -272, -800}, { -352, -296, -920}, { -320, -304, -1056}, { -312, -280, -1040}, { -360, -312, -1000}, { -368, -296, -984}, { -368, -256, -912}, { -360, -272, -936}, { -360, -256, -904}, { -336, -296, -872}, { -376, -32, -1024}, { -464, 40, -760}, { -392, 408, -8...
{ -720, 424, -16}, { -664, 800, -360}, { -792, 728, -512}, // 86 seconds { -648, 896, -984}, { -536, 600, 168}, { -752, 648, -640}, { -896, 840, -568}, { -568, 512, -232}, { -512, 624, 184}, { -576, 624, 768}, { -688, 584, 72}, { -568, 768, 200}, { -528, 552, 448...
{ 1280, 280, -104}, { 1488, 208, -88}, { 1584, 272, -48}, { 1216, 104, -24}, { 1152, 192, -184}, { 784, -400, 0}, { 1096, -24, 136}, { 544, -64, -528}, { 712, -88, -344}, { 1128, 184, -280}, { 1048, 80, -320}, { 992, 232, -440}, { 1232, 352, -432}, { 1520, 400, -3...
{ 1232, 752, -328}, { 968, 744, -584}, { 920, 944, -512}, { 1128, 896, -424}, { 1088, 720, -336}, { 1104, 640, -320}, { 1376, 504, -240}, { 1544, 568, -192}, { 1288, 24, 32}, { 1080, 200, -144}, // 42 seconds { 1112, 240, -120}, { 1192, 168, -40}, { 1264, 200, 0},...
{ 720, -224, -256}, { 768, -16, -384}, { 1104, 32, -320}, { 1160, 160, -352}, { 1104, 160, -288}, { 1008, 336, -312}, { 1224, 368, -240}, { 1424, 552, -272}, { 1632, 728, -176}, { 1336, 824, -248}, { 1128, 1200, -400}, { 928, 1408, -288}, { 1168, 880, -232}, { 86...
/* * 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...
check_connected()
; } void test_debounced_connection_service__connected_to_connected(void) { init(true /* connected */); check_connected(); //! Get connected event prv_send_connection_event(true); check_connected(); // Event put prv_assert_event_received(true); } void test_debounced_connection_service__disconnected_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...
{ // They're using 3.2 SDK or older, just let them off with a log message. heap_set_corruption_handler(heap, prv_warn_on_heap_corruption); }
else { heap_set_corruption_handler(heap, prv_croak_on_heap_corruption); } }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const size_t size = sizeof(GAPLEConnectRequestParams) * NumResponseTimeState; connection->connection_parameter_sets = (GAPLEConnectRequestParams *) kernel_zalloc_check(size); }
for (ResponseTimeState s = ResponseTimeMax; s < NumResponseTimeState; ++s) { const PebblePairingServiceConnParamSet *pps_params = &settings->connection_parameter_sets[s]; GAPLEConnectRequestParams *params = &connection->connection_parameter_sets[s]; prv_convert_pps_request_params(pps_pa...
k, sizeof(SMIdentityResolvingKey)) == 0); } static bool prv_get_key_for_sm_pairing_info_itr(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // co...
if (status == GapBondingFileSetFail) { return BT_BONDING_ID_INVALID; }
if (is_gateway && status == GapBondingFileSetUpdated) { prv_update_bondings(key, BtPersistBondingTypeBLE); } prv_call_ble_bonding_change_handlers(key, op); return key; } bool bt_persistent_storage_update_ble_device_name(BTBondingID bonding, const char *device_name) { BtPersistBondingData data; if (!...
_event(1800 /* 180 steps per min * 10 mins */); // Grab the new distance and active_kcalories int32_t new_active_kcalories, new_distance_m; cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &new_distance_m, &bpm, &hr_zone)); // Compute...
cl_assert_equal_i(bpm, 80)
b/en/resource/technical/document/errata_sheet/DM00068628.pdf // Configure the PWR peripheral to put us in low-power STOP mode when // the processor enters deepsleep. #if defined(MICRO_FAMILY_STM32F7) uint32_t temp = PWR->CR1; temp &= ~PWR_CR1_PDDS; temp |= PWR_CR1_LPDS; PWR->CR1 = temp; #else uint32_t te...
prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_BUTTON_TIME, InhibitorButton, now_ticks)
; prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_BLUETOOTH_TIME, InhibitorBluetooth, now_ticks); prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_DISPLAY_TIME, InhibitorDisplay, now_ticks); prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_BACKLIGHT_TIME, InhibitorBacklight, now_ticks); prv_collect(ANALYTICS_DEVICE_...
/* * 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...
{ stop_mode_enable(InhibitorVibes); }
stop_mode_disabled = on; } } static uint16_t prv_get_vsys_mv(void) { if (battery_get_charge_state().is_plugged) { // Plugged in, use Vsys rather than Vbat return pmic_get_vsys(); } // Not plugged in, use latest battery reading return battery_state_get_voltage(); } static uint32_t prv_vibe_get_p...
.gpio_pin = bus->scl_gpio.gpio_pin, .active_high = true }; gpio_output_init(&out_scl, GPIO_PuPd_NOPULL, GPIO_Speed_2MHz); gpio_output_set(&out_scl, false); OutputConfig out_sda = { .gpio = bus->sda_gpio.gpio, .gpio_pin = bus->sda_gpio.gpio_pin, .active_high = true }; gpio_output_init(&out_...
{ PBL_ASSERTN(slave); mutex_lock(slave->bus->state->bus_mutex); if (slave->bus->state->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted release of disabled bus %s", slave->bus->name); mutex_unlock(slave->bus->state->bus_mutex); return; } slave->bus->state->user_count--; if (slave->bus->s...
void i2c_reset(I2CSlavePort *slave) { PBL_ASSERTN(slave); // Take control of bus; only one task may use bus at a time mutex_lock(slave->bus->state->bus_mutex); if (slave->bus->state->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted reset of disabled bus %s when still in use by " "another b...
-------- DEFINE_SYSCALL(uint32_t, sys_accel_manager_get_buffer_size, AccelSessionRef session, uint32_t samples_per_update) { return samples_per_update + 1; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(int, sys_accel_manager_set_sample...
(state == NULL)
; state = kernel_malloc_check(sizeof(AccelSubscriberState)); *state = (AccelSubscriberState) { .session_ref = session, .task = handler_task, .data_cb_handler = data_cb, .data_cb_context = context, .sampling_rate = rate, .samples_per_update = ACCEL_MAX_SAMPLES_PER_UPDATE, ...
&GRect(0, shadow_top_y_offset, layer_w, shadow_top_bitmap_h)); } // Draw bottom shadow, if (partially) visible: const int16_t shadow_bottom_bitmap_h = shadow_top->bounds.size.h; const int16_t bottom_clipped_height = (content_size.h + content_offset.y) - ...
MIN(min_y_offset, 0)
, GCompOp compositing_mode) { GRect destination = bitmap->bounds; destination.origin = gpoint_add(destination.origin, offset); graphics_context_set_compositing_mode(ctx, GCompOpAssign); graphics_draw_bitmap_in_rect(ctx, bitmap, &destination); destination.origin = gpo...
(GPoint(-25, 0))
tx.dest_bitmap, "draw_round_rect_origin_r1_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 2); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r2_aa_sw1_no_clip.${BI...
(&ctx.dest_bitmap, "draw_round_rect_origin_rmax2_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")
); #endif } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_radius_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = false, SW = 1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP,...
compositor compositor_transition(NULL); // Call the upkeep function so the change in state is handled modal_manager_event_loop_upkeep(); // The app is unobstructed, it should not be idle cl_assert_equal_b(s_app_idle, false); // Assert that the window pushed onto the app stack has regained focus, // thi...
app_state_get_window_stack()
; WindowStack *modal_stack = modal_manager_get_window_stack(ModalPriorityGeneric); cl_check(app_stack); cl_check(modal_stack); cl_check(!app_stack->list_head); cl_check(!modal_stack->list_head); // Switch to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); window_stack_p...
ition_hidden_and_unfocused(void) { #if !RECOVERY_FW && !SHELL_SDK app_idle_timeout_resume(); #endif } static void prv_handle_app_to_modal_transition_focus(void) { #if !RECOVERY_FW && (!SHELL_SDK || CAPABILITY_HAS_SDK_SHELL4) watchface_reset_click_manager(); #endif // Let the underlying window know it has lost f...
(context, NULL)
) { continue; } else if (iter.first_visible_idx == ModalPriorityInvalid) { iter.first_visible_idx = idx; } if (prv_has_transition_window(context) && (iter.first_transition_idx == ModalPriorityInvalid)) { iter.first_transition_idx = idx; } if (prv_has_focusable_window(context) && (i...
.is_reversed_ppogatt_enabled = ppogatt_emulated_server_wa_enabled(conn_idx) }; } static uint8_t prv_handle_connection_state_read(uint16_t conn_idx, uint8_t response_buf[READ_RESPONSE_BUFFER_SIZE]) { PebblePairingServiceConnectivityStatus status = {}; prv_get_conne...
{ *response_length_out = prv_handle_connection_state_read(conn_idx, response); }
g permissions and * limitations under the License. */ #include "drivers/rtc.h" #include "drivers/rtc_private.h" #include "drivers/clocksource.h" #include "drivers/exti.h" #include "drivers/periph_config.h" #include "drivers/rtc.h" #include "mcu/interrupts.h" #include "system/logging.h" #include "system/passert.h" ...
(RTC_Format_BIN, &rtc_time_before)
; RTC_GetDate(RTC_Format_BIN, &rtc_date); // See reference manual section 26.6.11 for SSR to milliseconds conversion sub_seconds = RTC_GetSubSecond(); // Make sure neither date nor time rolled over since we read them. RTC_GetTime(RTC_Format_BIN, &rtc_time); // we need to read the DR again beca...
iver, s_kernel_receiver); s_kernel_receiver_is_receiving = false; s_kernel_receiver_cleanup_called = true; } const ReceiverImplementation g_default_kernel_receiver_implementation = { .prepare = prv_default_kernel_receiver_prepare, .write = prv_default_kernel_receiver_write, .finish = prv_default_kernel_recei...
fake_kernel_malloc_mark()
; s_kernel_receiver_available = false; Receiver *r = s_rcv_imp->prepare(s_session, &s_app_message_endpoint, sizeof(AppMessagePush)); cl_assert_equal_p(r, NULL); cl_assert_equal_b(false, s_kernel_receiver_is_receiving); fake_kernel_malloc_mark_assert_equal(); } /////////////...
== mode) { break; } BMI160_DBG("ACCEL: want mode %d, actual %d", mode, status); } #ifdef BMI160_DEBUG PBL_ASSERT(retries > 0, "Could not set power mode to %d", mode); #endif s_accel_power_mode = mode; BMI160_DBG("PMU_STATUS: 0x%x ACC_CONF: 0x%x", bmi160_read_reg(BMI160_REG_PMU_STATUS), bmi160_...
BMI160_DBG("%s", "Enable low power mode")
; } // TODO: If we aren't doing anything else, suspend the chip? } static void prv_enable_operating_mode(AccelOperatingMode mode, BMI160SampleRate sample_rate) { s_operating_states[mode].enabled = true; s_operating_states[mode].sample_interval = sample_rate; prv_configure_operating_mode(); } static void pr...
r with a space, advancing the cursor dbgserial_putchar(0x8); // move the cursor back again } else { dbgserial_putchar(0x07); // bell } return; } } bool prompt_command_is_executing(void) { return s_executing_command != ExecutingCommandNone; } void prompt_watchdog_feed(void) { system_task_...
(s_dbgserial_prompt_context.buffer, command->command, command_length)
og = &data->transcription_dialog; transcription_dialog_init(transcription_dialog); transcription_dialog_update_text(transcription_dialog, data->dialog_text, strlen(data->dialog_text)); transcription_dialog_set_callback(transcription_dialog, prv...
{ case ReminderAppUIState_Start: // Start a transcription data->ui_state = ReminderAppUIState_WaitForDictationEvent; voice_window_reset(data->voice_window); voice_window_push(data->voice_window); break; case ReminderAppUIState_WaitForDictationEvent: break; case ReminderAp...
} static NOINLINE void prv_init(void) { ReminderAppData *data = app_zalloc_check(sizeof(ReminderAppData)); app_state_set_user_data(data); data->ui_state = ReminderAppUIState_Start; // This "background" window is needed because without voice confirmation enabled, // the voice window pops before we get the ...
; size_t validated_size; } SliceValidationIteratorContext; //! If any slices are invalid, context.is_at_least_one_slice_invalid will be set to true. //! If all the slices are valid, context.validated_size will hold the size of the entire serialized //! glance after trimming any slices that go beyond the APP_GLANCE_D...
mutex_unlock(s_app_glance_db.mutex)
; return S_SUCCESS; } static status_t prv_validate_glance(const Uuid *app_uuid, const SerializedAppGlanceHeader *serialized_glance, size_t *len) { // Change this block if we support multiple app glance versions in the future // For now report an error if the glance's version isn't t...
_mm, rate_elapsed_ms); } } mutex_unlock_recursive(s_activity_state.mutex); if (s_activity_state.step_data.steps != prev_steps) { // Post a steps changed event PebbleEvent e = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventMovementUpdate, .data....
{ return; }
cron_job_unschedule(&s_activity_job); if (s_activity_state.accel_session) { accel_session_data_unsubscribe(s_activity_state.accel_session); accel_session_delete(s_activity_state.accel_session); s_activity_state.accel_session = NULL; } // Close down heart rate support prv_heart_rate_deinit(); ...
tricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricDistanceMeters, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTota...
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricDistanceMeters, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){exp_distance, 0, 0, 0, 0, 0, 0}))
; ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricActiveKCalories, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){exp_active_kcalories, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTotalSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){2 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0, 0})); ASSERT_E...
snprintf(filename, sizeof(filename), "draw_circle_offset_aa_r8_%s.${BIT_DEPTH_NAME}.pbi", c.filename_part); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, filename)); } #endif } void test_graphics_draw_circle_${BIT_DEPTH_NAME}__clear(void) { GContext ctx; Layer layer; test_graphics_context_init(&ct...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_swX_clear.${BIT_DEPTH_NAME}.pbi"))
; } void test_graphics_draw_circle_${BIT_DEPTH_NAME}__zero_aa_swX_clear(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Draw clear circles with antialiasing enabled setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 0); graphics_context_set_stroke_color(&ctx, GColorCl...
, sizeof(bufcmp)); int fd = pfs_open(file_small, OP_FLAG_READ, FILE_TYPE_STATIC, 0); cl_assert(fd >= 0); cl_assert_equal_i(pfs_read(fd, &buf[0], sizeof(buf)), sizeof(buf)); cl_assert(memcmp(buf, bufcmp, sizeof(buf)) == 0); cl_assert_equal_i(pfs_close(fd), S_SUCCESS); } } static bool prv_filename...
pfs_open(filename, OP_FLAG_READ, FILE_TYPE_STATIC, 10)
; cl_assert(fd >= 0); pfs_close(fd); } } void test_pfs__remove_files(void) { pfs_format(true); pfs_init(false); // Create some files int fd; fd = pfs_open("a_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); pfs_close(fd); fd = pfs_open("a_test_1", OP_FLAG_WRITE, FILE_TYPE_S...
AP_TIMEOUT_DEFAULT; sys_smartstrap_subscribe(); state->is_initialized = true; } static void prv_state_deinit(void) { SmartstrapConnectionState *state = app_state_get_smartstrap_state(); if (!state->is_initialized) { return; } state->is_initialized = false; event_service_client_unsubscribe(&state->eve...
sys_smartstrap_attribute_get_info(attr, NULL, NULL, buffer_length)
recognizer) { if (false == prv_is_multi_click_enabled(recognizer)) { return 0; } if (recognizer->config.multi_click.max == 0) { return prv_multi_click_get_min(recognizer); } return recognizer->config.multi_click.max; } static uint32_t prv_multi_click_get_timeout(ClickRecognizer *recognizer) { if (f...
app_state_get_click_manager()
->recognizers[button]), offset, needs_reset); } void click_recognizer_handle_button_down(ClickRecognizer *recognizer) { recognizer->is_button_down = true; prv_cancel_timer(&recognizer->multi_click_timer); const bool needs_reset = false; prv_dispatch_event(recognizer, ClickHandlerOffsetRawDown, needs_reset); ...
ng static int16_t prv_get_lfsr(int16_t prev) { uint16_t lfsr = (uint16_t)prev; lfsr = (lfsr >> 1) ^ (-(lfsr & 1) & 0xB400); return (int16_t)lfsr; } static bool prv_dma_handler(DMARequest *request, void *context, bool is_complete) { MicDevice *this = context; bool should_context_switch = false; PROFILER_NO...
prv_enable_clocks(MIC)
return NULL_SAFE_FIELD_ACCESS(music_glance, icon, NULL); } static const char *prv_get_title(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceMusic *music_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(music_glance, title, NULL); } static...
(artist_buffer)
&& !IS_EMPTY_STRING(title_buffer)) { // Use the strings to fill the subtitle buffer snprintf(music_glance->subtitle, music_glance_subtitle_size, "%s - %s", artist_buffer, title_buffer); // Choose the icon we should display; note that we'll use the default icon we set above if we ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_INFO, "PUSHING WINDOW")
; Window *window = &data->window; window_init(window, WINDOW_NAME("Demo Menu")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_stack_push(window, animated); } //////////////////// // App b...
{ 1072, 80, -80}, { 984, 104, -144}, { 1000, 144, -240}, { 1032, 128, -280}, { 1048, 40, -256}, { 976, -16, -208}, { 952, -32, -224}, { 936, 8, -248}, { 1024, 16, -240}, { 1312, 8, -240}, { 1056, 16, -232}, { 1136, 32, -200}, { 1376, 40, -112}, { 1136, 72, -64}, ...
{ 256, 480, -504}, // 97 seconds { 248, 512, -552}, { 280, 624, -640}, { 264, 592, -464}, { 240, 648, -464}, { 248, 792, -256}, { 224, 904, -192}, { 232, 1048, -144}, { 208, 832, 80}, { 192, 1032, 72}, { 152, 872, -8}, { 184, 864, -32}, { 160, 912, -72}, { 176...
{ 208, -280, -952}, { 184, -296, -944}, { 168, -304, -936}, { 176, -304, -936}, { 200, -296, -928}, { 152, -320, -936}, { 224, -304, -936}, { 184, -296, -944}, { 184, -280, -936}, }; *len = ARRAY_LENGTH(samples); return samples; } // ---------------------------------------...
/* * 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...
(VibeClient_PhoneCalls, call_scores, 7, VibeScoreId_Jackhammer, 5)
; } void test_vibe_score_info__cycle_next_alarms(void) { const VibeScoreId alarm_scores[] = { VibeScoreId_StandardLongPulseLow, VibeScoreId_StandardLongPulseHigh, VibeScoreId_Pulse, VibeScoreId_NudgeNudge, VibeScoreId_Jackhammer, VibeScoreId_Reveille, VibeScoreId_Mario, }; prv_test_c...
g_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat8BitCircular); cl_assert(NULL == bmp); bmp = gbitmap_create_blank(s180, GBitmapFormat8BitCircular); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos == bmp->data_row_infos); #endi...
(GSize(13, 10), GBitmapFormat4BitPalette)
read before getting the notification: bool has_notification = gatt_client_subscriptions_get_notification_header(GAPLEClientApp, NULL); cl_assert_equal_b(has_notification, false); const uint8_t value[] = {0xAA, 0xBB, 0xCC}; gatt_client_...
{ // Consume while BT task is waiting for buffer to be freed up: BLECharacteristic characteristic_out; uint8_t *value_out = (uint8_t *) malloc(GATT_CLIENT_SUBSCRIPTIONS_BUFFER_SIZE); uint16_t value_length = GATT_CLIENT_SUBSCRIPTIONS_BUFFER_SIZE; gatt_client_subscriptions_consume_notification(&characteristic_o...
void test_gatt_client_subscriptions__notification_buffer_full(void) { // Subscribe app: BLECharacteristic characteristic = prv_get_indicatable_characteristic(); BTErrno e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClie...
played * (parent->duration_ms + parent->delay_ms); // Loop through animation and all of it's children until the "virtual now" catches up to // the desired elapsed const uint32_t now = prv_get_ms_since_system_start(); uint32_t virtual_now = now; const uint32_t target_now = start_ms + elapsed_ms; while (se...
prv_animation_clone(state, animation)
; } // ------------------------------------------------------------------------------------------ static void prv_dump_animations(ListNode *node, bool is_scheduled, char *buffer, int buffer_size) { while (node) { AnimationPrivate *animation = (AnimationPrivate *)node; dbgserial_putstr_fmt(buffer, buffer_siz...
i")); // Test when clipping/drawing are at (2, 0) and text bounds is at (0, 0) setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_TEXT_0_0, GTextOverflowModeTrailingEllip...
setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1)
; graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG_H, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_neg_h", fb, GColorWhite)); // Test null context boxes - ensure nothing is r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
sort_bubble(array, ARRAY_LENGTH(array), sizeof(int32_t), prv_int32_cmp)
; int32_t sorted[] = {1}; cl_assert_equal_m(array, sorted, sizeof(array)); } typedef struct MyStruct { uint8_t nothing; int32_t number; uint16_t nothing2; } MyStruct; static int prv_MyStruct_cmp(const void *a, const void *b) { MyStruct *t_a = (MyStruct *)a; MyStruct *t_b = (MyStruct *)b; return prv_c...
rtc_get_time()
; } s_workout_data.current_workout->paused = should_be_paused; // Update the global duration since we have changed the pause state prv_update_duration(); PBL_LOG(LOG_LEVEL_INFO, "Paused a workout with type: %d", wrkt_data->type); prv_put_event(PebbleWorkoutEvent_Paused); } prv_unlock(); ...