prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
les = 0; s_force_sampling_interval = false; } void test_accel_manager__cleanup(void) { test_accel_manager_reset(); } static void prv_noop_sample_handler(void *context) { } static void prv_validate_sample_rates(int *arr, int num_samples) { for (int i = 0; i < num_samples; i++) { // force a compiler error ...
(state, &num, &den, &samples_per_update)
; cl_assert_equal_i(num, 1); cl_assert_equal_i(den, 10); cl_assert_equal_i(samples_per_update, ARRAY_LENGTH(fake_buf)); } void test_accel_manager__batched_samples(void) { AccelRawData fake_buf[30]; stub_pebble_tasks_set_current(PebbleTask_KernelMain); AccelManagerState *main_session = sys_accel_manager_...
ging icon battery_icon_node->node.margin.w = 7; GTextNode *vertically_centered_battery_icon_node = prv_wrap_text_node_in_vertically_centered_container(&battery_icon_node->node); graphics_text_node_container_add_child(&horizontal_container_node->container, vertically_...
comm_session_get_system_session()
!= NULL); } static void prv_event_handler(PebbleEvent *event, void *context) { LauncherAppGlanceStructured *structured_glance = context; PBL_ASSERTN(structured_glance); LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); PBL_ASSERTN(settings_glance);...
list_free_last(void) { ScanResult *prev = NULL; ScanResult *result = s_head; while (result) { if (!result->next) { // Found the last result, unlink and free it: prev->next = NULL; free(result); return; } prev = result; result = result->next; } } //! Finds ScanResult base...
bt_uuid_expand_16bit(0x180D)
; result->has_heart_rate_service = ble_ad_includes_service(ad_data, &hrm_uuid); } else { result->has_services = false; result->has_heart_rate_service = false; } // Insert into the list: list_link_sorted_by_rssi(result); // Tell the menu to update: menu_layer_reload_data(s_menu_layer); } void ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(num_bytes <= sizeof(font_cache->offsets_buffer_2_2))
; } else { FontHashTableEntry table_entry; Codepoint hash_entry_offset = s_font_md_size[version] + table_id * sizeof(FontHashTableEntry); // find which bucket the codepoint was put into TODO: cache hash table? PBL_LOG_D(LOG_DOMAIN_TEXT, LOG_LEVEL_DEBUG, "HTE read: table_id:%d, cp:%"PRIx3...
/* * 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...
while ((DBGSERIAL_UART->ISR & USART_ISR_TXE) == 0) continue;
DBGSERIAL_UART->TDR = c; while ((DBGSERIAL_UART->ISR & USART_ISR_TXE) == 0) continue; } void dbgserial_print(const char* str) { for (; *str && s_message_length < MAX_MESSAGE; ++str) { if (*str == '\n') { dbgserial_newline(); } else if (*str != '\r') { s_message_buffer[s_message_length++] = *...
-------------------------------------------- // Return true if the passed in day is a weekend static bool prv_is_weekend(DayInWeek day) { return (day == Sunday) || (day == Saturday); } // ---------------------------------------------------------------------------------------------- // Return the activity metric that...
(daily, &state->cache->steps_daily, sizeof(*daily))
; // Get updated value for today. Getting only today's value is MUCH faster than getting // the historical values sys_activity_get_metric(prv_get_activity_metric(metric), 1, &daily->totals[0]); return true; } // Read in the metric history if (!sys_activity_get_metric(prv_get_activity_metric(metri...
/* * 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(InhibitorButton)
; } } static void prv_enable_button_timer(void) { // Don't let the timer interrupt us while we're mucking with it. __disable_irq(); if (!prv_check_timer_enabled()) { periph_config_enable(TIM4, RCC_APB1Periph_TIM4); TIM_ITConfig(TIM4, TIM_IT_Update, ENABLE); TIM_Cmd(TIM4, ENABLE); // Prevent us...
us->state), "Could not acquire semaphore token"); // Set up transfer bus->state->transfer = (I2CTransfer) { .device_address = device_address, .register_address = register_address, .direction = direction, .type = type, .size = size, .idx = 0, .data = data, }; i2c_hal_init_transfer(b...
prv_do_transfer(slave->bus, Write, slave->address, register_address_start, write_size, (uint8_t*)buffer, SendRegisterAddress)
; if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Write failed on bus %s", slave->bus->name); } return result; } bool i2c_write_block(I2CSlavePort *slave, uint32_t write_size, const uint8_t* buffer) { PBL_ASSERTN(slave); PBL_ASSERTN(buffer); // Do transfer locks the bus bool result = prv_do_transfer(slav...
tr_list); // Record size of the attribute list in the data struct as well as the overall size accumulator current_attr_list_data->attr_list_size = attribute_list_get_serialized_size(attr_list); serialized_glance_size += current_attr_list_data->attr_list_size; } // Allocate a buffer for the serialized ...
(attr_list_data_buffer)
; return is_attr_list_valid; } typedef struct SliceValidationIteratorContext { bool is_at_least_one_slice_invalid; 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.validate...
///////////////////////////////////////////// // Accel service state variables static AccelServiceState *s_accel_session = NULL; static bool s_charger_plugged = false; static AccelRawData s_accel_data = { 0 }; ////////////////////////////////////////////////////////////////////////////////// // Private calibration h...
mag_start_sampling()
/* * 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 (info->key_len != UUID_SIZE || info->val_len == 0) { return true; // continue iteration }
// Compare timestamps (this should omit most reminders) ReminderInfo *reminder_info = (ReminderInfo *)context; SerializedTimelineItemHeader header; info->get_val(file, (uint8_t *)&header, sizeof(SerializedTimelineItemHeader)); if (reminder_info->timestamp != header.common.timestamp) { return true; // co...
GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); grect_align(&box, &cell_layer->bounds, GAlignCenter, true /* clip */); box.origin.y -= fonts_get_font_cap_offset(font); graphics_dra...
{ AlarmsAppData *data = (AlarmsAppData *)callback_context; if (prv_is_add_alarm_cell(&old_index)) { data->show_limit_reached_text = false; } }
#if CAPABILITY_HAS_HEALTH_TRACKING /////////////////////////////////////////////////////////////////////////////////////////////////// //! Smart Alarm first use dialog typedef struct FirstUseDialog { ExpandableDialog dialog; AlarmsAppData *data; } FirstUseDialog; static void prv_alarms_app_opened_click_handler(...
et_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__clipped(void) { GContext ctx; Layer layer; test_graphics_context_i...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r3_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 4, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_R...
ndBuffer *sb = comm_session_send_buffer_begin_write(session, ENDPOINT_ID, required_length, COMM_SESSION_DEFAULT_TIMEOUT); if (!sb) { PBL_LOG(LOG_LEVEL_DEBUG, "Failed to get send buffer"); return false; } BluetoothHeader header = { .command = 0x8...
version_copy_current_build_id_hex_string(build_id_string, 64)
; DEBUG_LOG(LOG_LEVEL_INFO, "BUILD ID: %s", build_id_string); debug_reboot_reason_print(mcu_reboot_reason); } void debug_print_last_launched_app(void) { // Get the slot of the last launched app // so we know what was running when we rebooted uint32_t last_launched_app_slot = reboot_get_slot_of_last_launched...
izeof(PebbleLaunchAppEventExtended)); *ext = (PebbleLaunchAppEventExtended) { .common = data->next_app_args.common, .wakeup = data->next_app_args.wakeup_info }; #if PLATFORM_TINTIN ext->common.transition = compositor_app_slide_transition_get(true /* slide to right */); #else ext->common.transition = com...
watchface_set_default_install_id(INSTALL_ID_INVALID)
; } else if ((worker_manager_get_default_install_id() == data->install_entry.install_id) && app_install_entry_has_worker(&data->install_entry)) { // We failed to fetch a worker and it was our default. // Invalidate it and it will be reassigned to one that is launched next. PBL_LOG(LOG_LEVEL_W...
C_APB2Periph_TIM11 | RCC_APB2Periph_SPI5 | RCC_APB2Periph_SPI6 | RCC_APB2Periph_SAI1 | RCC_APB2Periph_LTDC; RCC_DeInit(); RCC_AHB1PeriphResetCmd(ahb1_periphs, ENABLE); RCC_AHB1PeriphResetCmd(ahb1_periphs, DISABLE); RCC_AHB2PeriphResetCmd(ahb2_periphs, ENABLE); RCC_AHB2PeriphResetCmd(ahb2_periphs, DISA...
("Failed to start firmware, strike three.")
; boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); return true; } else if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)) { dbgserial_putstr("Failed to start firmware, strike two."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); } else {...
cessors__copy_service_refs_matching(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_mock_put_service_discovery_events(); const uint8_t num_services = 1; // Test gatt_client_copy_service_ref...
(1, refs_out)
; const Uuid uuid = gatt_client_service_get_uuid(service_refs_out[0]); cl_assert(uuid_equal(&uuid, &bp_service->uuid)); // Thermo & Random 128 bit service should be part of the second gen refs_out = gatt_client_copy_service_refs_by_discovery_generation( &device, service_refs_out, 3, 1); cl_assert_equa...
rocess_management/app_manager.h" #include "process_management/worker_manager.h" #include "applib/app_logging.h" #include "applib/app_heap_analytics.h" #include "kernel/memory_layout.h" #include "mcu/privilege.h" #include "services/common/analytics/analytics_event.h" #include "services/common/system_task.h" #include "s...
{ // Write the information out into a global variable so it can be logged out at a less critical time. s_current_app_crash_info = crash_info; const PebbleProcessMd *md = sys_process_manager_get_current_process_md(); s_current_app_crash_info.app_uuid = md->uuid; s_current_app_crash_info.is_rocky_app = md->is_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
tick_timer_service_unsubscribe()
*remote_name = task_zalloc_check(max_name_size + sizeof(ellipsis)); strncpy(remote_name, remote->name, name_size); if (name_size > max_name_size) { const size_t ellipsis_start_offset = utf8_get_size_truncate(remote_name, name_size); strncpy(&remote_name[ellipsis_start_offset], ellipsis, sizeof(ellipsis)); ...
if (bt_ctl_is_airplane_mode_on()) { graphics_draw_text(ctx, i18n_get("Disable Airplane Mode to connect.", data), font, box, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } else { graphics_draw_text(ctx, i18n_get("Open the Pebble app on your phon...
ctx->draw_state = draw_state; } #endif } else { const uint16_t device_index = row - 1; draw_stored_remote_item(ctx, cell_layer, device_index, data); } } static void prv_select_click_cb(SettingsCallbacks *context, uint16_t row) { SettingsBluetoothData *data = (SettingsBluetoothData *) cont...
952, 240, 88}, { 888, 272, 56}, { 824, 288, -72}, { 840, 264, -88}, { 880, 296, -112}, // 50 seconds { 960, 272, -128}, { 1064, 280, -96}, { 1104, 272, -56}, { 1328, 160, -16}, { 1504, 152, 72}, { 1320, 320, 24}, { 1016, 264, 16}, { 1416, 144, 152}, { 1736, -48, ...
{ -48, 728, -56}, { 16, 696, -72}, { 192, 992, -80}, { 152, 872, -48}, { 320, 1040, -56}, { 424, 1112, -64}, { 408, 1016, -24}, { 472, 976, -96}, { 488, 960, -72}, { 552, 976, -48}, { 568, 912, -40}, { 584, 952, -56}, // 56 seconds { 576, 872, -48}, { 584, 816...
{ 536, 1360, -32}, { 472, 1112, 8}, { 480, 1048, -56}, { 400, 1184, -32}, { 336, 1112, -160}, { 256, 728, -240}, { 120, 304, -112}, { 40, -96, -472}, { 56, 128, -704}, { 48, 16, -776}, { 0, -8, -816}, { 8, 16, -904}, { 8, -16, -968}, { 0, -48, -928}, { 32, 80...
/* * 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_gap_le_device_name_request(connection); }
void gap_le_device_name_handle_request_all(void) { connection_for_each(prv_handle_request_all_cb, NULL); }
GRect prv_time_rect(void) { const MusicAppSizeConfig *config = prv_config(); return GRect(config->horizontal_margin, config->time_field.origin_y, prv_content_width(), config->time_field.size_h); } static GRect prv_cassette_rect(void) { const MusicAppSizeConfig *config = prv_config(); const int1...
(volume_is_up ? &data->image_volume_up : &data->image_volume_down)
; music_command_send(volume_is_up ? MusicCommandVolumeUp : MusicCommandVolumeDown); } static Animation* prv_create_layer_upwards_animation(Layer *layer, int16_t offset) { GPoint target = GPoint(0, -layer->bounds.size.h - offset); GPoint origin = GPoint(0, -offset); Animation *animation = property_animation_get...
/* * 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...
event_put(&e)
; } static char *prv_bool_to_string(bool active) { return active ? "Active" : "Inactive"; } static void prv_do_update(void) { const bool is_active = do_not_disturb_is_active(); if (is_active == s_data.was_active) { // No change return; } s_data.was_active = is_active; PBL_LOG(LOG_LEVEL_INFO, "Quie...
if (item_layer->timeline_layout) { GRect bounds = item_layer->timeline_layout->layout_layer.layer.bounds; bounds.origin.y = 0 - item_layer->scroll_offset_pixels; layer_set_bounds((Layer *)item_layer->timeline_layout, &bounds); } } /////////////////////////////////////////////////////////// // Scrolling ...
(item_layer, first_scroll, true)
; } else if (current_scroll + SCROLL_AMOUNT + SCROLL_FUDGE_AMOUNT >= max_scroll) { #if PBL_ROUND // scroll down to page aligned end of content max_scroll = ROUND_TO_MOD_CEIL(max_scroll, DISP_ROWS - STATUS_BAR_LAYER_HEIGHT); #endif prv_update_scroll_offset(item_layer, max_scroll, false); } else { prv...
entation() { return &window_transition_default_pop_implementation; } Animation *window_transition_default_push_create_animation(WindowTransitioningContext *context) { window_transition_context_disappear(context); window_transition_context_appear(context); return animation_create(); } const WindowTransitionImp...
stub_pebble_tasks_set_current(PebbleTask_App)
; app_window_stack_pop_all(false); stub_pebble_tasks_set_current(PebbleTask_KernelMain); modal_manager_pop_all(); fake_animation_cleanup(); cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0); } // Tests //////////////////////////////////// void test_window_stack__basic_app_push(void) { Window *wi...
/* * 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 (reel) { return ((KinoReelImplGBitmapSequence*)reel)->sequence; }
IONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/blob_db/contacts_db.h" #include "services/normal/contacts/contacts.h" #inclu...
cl_assert_equal_i(contacts_db_get_len((uint8_t *)&contact, UUID_SIZE), 0)
turb_toggle.h" #include "applib/ui/action_toggle.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/dialogs/actionable_dialog.h" #include "applib/ui/dialogs/dialog.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/vibes.h" #include "applib/...
{ prv_push_first_use_dialog(msg, prv_toggle_manual_dnd_from_action_menu); }
else { prv_push_first_use_dialog(msg, prv_toggle_manual_dnd_from_settings_menu); } } static void prv_try_update_schedule_mode(void *data) { const bool clear_override = (bool) (uintptr_t) data; if (clear_override) { s_data.manually_override_dnd = false; } if (do_not_disturb_is_schedule_enabled(Weekd...
en; top_rects_color.a = 2; const GRect top_left_rect = (GRect) { .origin = GPoint(top_rects_x_offset, 0), .size = top_rects_size }; prv_draw_hlines_in_rect(ctx, draw_func, &top_left_rect, top_rects_color); const GRect top_right_rect = (GRect) { .origin = GPoint((bitmap_bounds_size->w / 2) + top_re...
TEST_NAMED_PBI_FILE("draw_core_assign_horizontal_line_raw")
/* * 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...
(GColorBlack.r == 0b00)
; cl_assert(GColorBlack.g == 0b00); cl_assert(GColorBlack.b == 0b00); cl_assert(GColorBlack.a == 0b11); } void test_graphics_colors__white(void) { cl_assert(GColorWhite.r == 0b11); cl_assert(GColorWhite.g == 0b11); cl_assert(GColorWhite.b == 0b11); cl_assert(GColorWhite.a == 0b11); } void test_graphics_...
nter_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(menu_layer_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(CRAZY_ID)); } void test_app_install_manager__get_uuid_for_install_id(void) { Uuid uuid = {}; cl_assert_equal_b(false, app_install_get_uuid_for_install_id(INSTALL_ID_INVALID, ...
cl_assert_equal_i(ProcessTypeWorker, bg_counter_md_worker->process_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...
if (kind == ANALYTICS_BLOB_KIND_APP_HEARTBEAT) { kind_str = "App"; tag = DlsSystemTagAnalyticsAppHeartbeat; } else if (kind == ANALYTICS_BLOB_KIND_EVENT) { kind_str = "Event"; buffered = true; tag = DlsSystemTagAnalyticsEvent; } else { WTF; }
// TODO: Use different tag ids for device_hb and app_hb sessions. // https://pebbletechnology.atlassian.net/browse/PBL-5463 const bool resume = false; DataLoggingSessionRef dls_session = dls_create( tag, DATA_LOGGING_BYTE_ARRAY, item_length, buffered, resume, &system_uuid); PBL_LOG(LOG_LEVEL_DEBUG, "...
8, -1080}, { 88, 24, -1056}, // 2 seconds { 48, -48, -1008}, { 0, 40, -992}, { 184, 64, -1056}, { 240, 80, -1112}, { 352, 112, -1160}, { 368, 88, -1144}, { 280, 48, -1072}, { 200, -56, -1032}, { 160, -176, -952}, { 112, -200, -920}, { 136, -184, -896}, { 184, -200...
{ 1032, 104, -176}, { 1048, 72, -240}, { 952, 56, -240}, { 824, 96, -256}, { 784, 80, -304}, { 968, 64, -280}, { 928, 32, -248}, { 1160, 48, -240}, { 1128, 64, -128}, { 1064, 144, -144}, { 1128, 216, -168}, { 1056, 216, -128}, { 936, 248, -256}, // 8 seconds {...
{ 1176, 144, -368}, { 1136, 200, -264}, { 960, 224, -184}, { 904, 280, -176}, { 968, 336, -192}, { 1064, 328, -200}, { 984, 336, -160}, { 1088, 376, -128}, { 1384, 480, -48}, { 984, 512, 136}, { 1160, 472, -40}, { 1296, 544, 32}, { 840, 440, -40}, { 872, 400, -10...
esp_data_out, scan_resp_data, sizeof(scan_resp_data)) == 0); // Expect one regular timer to be running for adverts: cl_assert_equal_i(regular_timer_seconds_count(), 1); // Unschedule callback should not have been called: cl_assert_equal_i(s_unscheduled_cb_count, 0); // Make sure the all t...
gap_le_advert_schedule(ad_e, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0)
; cl_assert(infinite_job_e); // Infinite jobs are equal in priority to finite jobs, so it should get immediate air-time for one cycle: assert_ad_data("E"); // No jobs should been have been unscheduled: cl_assert_equal_i(s_unscheduled_cb_count, 0); // This is the last round for "C": regular_timer_fire_se...
_whitespace(GContext* ctx, Word* word, const TextBoxParams* const text_box_params) { while (word_trim_preceeding_codepoint(ctx, word, SPACE_CODEPOINT, text_box_params)); } //////////////////////////////////////////////////////////// // Walk Line typedef void (*CharVisitorCallback)(GContext* ctx, const TextBoxParams...
iter_next(&char_iter)
) { break; } current_codepoint = utf8_iter_state->codepoint; if (current_codepoint == NEWLINE_CODEPOINT) { if (is_newline_as_space) { current_codepoint = SPACE_CODEPOINT; } else { break; } } next_glyph_width_px = prv_codepoint_get_horizontal_advance(&ctx->fo...
{ ActivitySession *session = &sessions[i]; GColor fill_color = GColorClear; if (session->type == ActivitySessionType_Sleep) { fill_color = PROGRESS_CURRENT_COLOR; } else if (session->type == ActivitySessionType_RestfulSleep) { fill_color = PROGRESS_SECONDARY_COLOR; } if (gcolor_eq...
graphics_draw_round_rect(ctx, &s_sleep_summary_masking_rect, 5)
; // This needs to be done after drawing the progress bars or else the progress fill // overlaps the outline and things look weird health_progress_bar_outline(ctx, &data->progress_bar, PROGRESS_OUTLINE_COLOR); } static void prv_render_icon(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data =...
dialog_spi_assert_chip_select(false); // FIXME: PBL-32865: The "OVR" (overrun) status flag gets set at some point, not sure why because // the data arrives OK. Need to reset it, otherwise the next transfer will get a 0x00 byte // prepended to the beginning... // From the F7 Spec: "When the SPI is used only to ...
{ // reset the interrupt count s_int_fired = 0; s_dma_pending_transfer = false; periph_config_acquire_lock(); prv_init_spi(); periph_config_release_lock(); prv_init_exti(int_exti_cb ?: prv_exti_cb); }
void dialog_spi_deinit(void) { exti_disable(DIALOG_EXTI); if (s_dma_pending_transfer) { spi_ll_slave_read_write_dma_stop(DIALOG_SPI); prv_cleanup_after_dma_transfer(); s_dma_pending_transfer = false; } spi_slave_port_deinit(DIALOG_SPI); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_user_data(window, countdown_window)
ivate.h" #include "services/normal/activity/kraepelin/activity_algorithm_kraepelin.h" #include "services/normal/data_logging/data_logging_service.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/protobuf_log/protobuf_log.h" #include "shell/prefs.h" #include "system/logging.h" #include "system/pa...
{ cl_assert(session < s_hrm_next_session_ref); s_hrm_manager_update_interval = update_interval_s; s_hrm_manager_expire_s = expire_s; s_hrm_manager_num_update_interval_changes++; return true; }
HRMSessionRef sys_hrm_manager_app_subscribe(AppInstallId app_id, uint32_t update_interval_s, uint16_t expire_s, HRMFeature features) { return HRM_INVALID_SESSION_REF; } HRMSessionRef sys_hrm_manager_get_app_subscription(AppInstallId app_id) { return HRM_INVALID_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...
cl_assert_equal_i(NULL_SAFE_FIELD_ACCESS(null_ptr, field_to_access, 1234), 1234)
; cl_assert_equal_p(NULL_SAFE_FIELD_ACCESS(null_ptr, ptr_field_to_access, NULL), NULL); int data = 1337; const NullSafeFieldAccessTestStruct test_struct = (NullSafeFieldAccessTestStruct) { .field_to_access = data, .ptr_field_to_access = &data, }; // Passing in a valid struct ptr should return the fi...
static const AppOutboxSenderDef s_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, }, #ifd...
for (AppOutboxServiceTag tag = 0; tag < NumAppOutboxServiceTag; ++tag) { if (s_app_outbox_consumer[tag].head == head) { return &s_app_outbox_consumer[tag]; } }
return NULL; } void prv_cleanup_pending_messages(AppOutboxConsumer *consumer, bool should_call_sent_handler) { AppOutboxMessage *message = consumer->head; consumer->head = NULL; while (message) { if (should_call_sent_handler) { prv_schedule_sent_handler(message->sent_handler, message->cb_ctx, ...
er, Fixed_S16_3 radius, int32_t angle_start, int32_t angle_end) { record_mock_call(s_graphics_draw_arc_precise) { .draw_arc.center = center, .draw_arc.radius = radius, .draw_arc.angle_start = angle_start, .draw_arc.angle_end = angle_end, }; } MockCallRecordin...
rocky_global_init(s_graphics_api)
; prv_create_global_ctx(); EXECUTE_SCRIPT( "ctx.beginPath();\n" "ctx.moveTo(1, 2);\n" "ctx.lineTo(3, 4);\n" "ctx.lineTo(5, 6);\n" "ctx.lineTo(7, 8);\n" "ctx.moveTo(9, 10);\n" "ctx.lineTo(11, 12);\n" "ctx.stroke();\n" ); cl_assert_equal_i(4, s_graphics_line_draw_precise_stroked...
there are still // notifications pending in the buffer become invalid before the time they are processed. // Probably not a big deal. gatt_client_subscriptions_reschedule(GAPLEClientKernel); return; // yield } // This is ugly and causes double-copying the data... // TODO: https://...
{ PBL_LOG(LOG_LEVEL_DEBUG, "PEBBLE_BLE_CONNECTION_EVENT: reason=0x%x, conn=%u, bond=%u", event->hci_reason, event->connected, event->bonding_id); const bool connected = event->connected; // FIXME: When PPoGATT is supported add a check for active gateway // https://pebbletechnology.atlassian.net/brows...
// ------------------------------------------------------------------------------------------------- void kernel_le_client_handle_event(const PebbleEvent *e) { switch (e->type) { case PEBBLE_BLE_SCAN_EVENT: PBL_LOG(LOG_LEVEL_DEBUG, "PEBBLE_BLE_SCAN_EVENT"); return; case PEBBLE_BLE_CONNECTION_EV...
(a, b, NULL)
; animation_set_play_count(seq, repeat_count); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start A prv_advance_to_ms_with_timers(start_ms + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_ass...
_events(void) { RecognizerEvent rec_event = -1; TouchEvent last_touch_event = { .type = TouchEvent_Liftoff }; RecognizerState new_state; bool updated = false; s_test_impl_data.last_touch_event = &last_touch_event; s_test_impl_data.new_state = &new_state; s_test_impl_data.updated = &updated; NEW_RECOGNIZ...
recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touchdown })
; cl_assert_equal_i(last_touch_event.type, TouchEvent_Touchdown); cl_assert_equal_b(updated, true); cl_assert_equal_i(r->state, new_state); } bool s_simultaneous = false; static bool prv_simultaneous_with_cb(const Recognizer *recognizer, const Recognizer *simultaneous_with) {...
/* * 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...
(stream->index < stream->length)
; stream->data[stream->index++] = data; } uint32_t sle_decode(const uint8_t *in, uint32_t in_len, uint8_t *out, uint32_t out_len) { ReadByteStream in_stream = { .data = in, .length = in_len }; WriteByteStream out_stream = { .data = out, .length = out_len }; const uint8_t escape = prv_byte_...
rstr(key, HR_ZONE_DATA_KEY_SUFFIX)) { HeartRateZoneData *data = (HeartRateZoneData *)val; if (!prv_is_last_processed_timestamp_valid(data->last_processed_timestamp)) { return; } if (data->num_zones != HRZone_Max) { return; } PBL_LOG(LOG_LEVEL_INFO, "Got HeartRateZoneData for wday: %d...
memset(averages->average, ACTIVITY_METRIC_AVERAGES_UNKNOWN & 0xFF, sizeof(averages->average))
; SettingsFile file; if (prv_file_open_and_lock(&file) != S_SUCCESS) { return false; } char key[HEALTH_DB_MAX_KEY_LEN]; snprintf(key, HEALTH_DB_MAX_KEY_LEN, "%s%s", WEEKDAY_NAMES[day], STEP_TYPICALS_KEY_SUFFIX); const int key_len = strlen(key); status_t s = settings_file_get(&file, key, key_len, av...
/* * 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_spin_until_creset_is(true), "CRESET not high after reset")
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
task_watchdog_mask_clear(pebble_task_get_current())
; close_db_files(); prv_factory_reset_non_pfs_data(); pfs_remove_files(NULL); prv_factory_reset_post(false /* should_shutdown */); } #endif // !RECOVERY_FW //! Used by the mfg flow to kick us out the MFG firmware and into the conumer PRF that's stored //! on the external flash. void command_enter_consumer_...
pulse_link_max_send_size() - LCP_HEADER_LEN); memcpy(packet->data, bad_packet, body_len); pulse_link_send(packet, LCP_HEADER_LEN + body_len); } static void prv_on_timeout(void *context) { PPPControlProtocol *this = context; mutex_lock(this->state->lock); if (this->state->restart_count > 0) { // TO+ s...
prv_transition_to(this, LinkState_Opened)
; break; default: break; } } static void prv_handle_nak_or_reject(PPPControlProtocol *this, struct LCPPacket *packet) { // Process nak/rej options // respond with new configure request // TODO: we don't send options, so no nak/rej is expected yet } static v...
/* * 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...
(bitset_bytes[i])
; } return (num_bits_set); }
(*s_log_internal__expected == NULL); } void test_rocky_api_global__can_unsubsribe_event_handlers(void) { static const RockyGlobalAPI api = { .add_handler = prv_api_add, .remove_handler = prv_api_remove, }; static const RockyGlobalAPI *apis[] = { &api, NULL, }; rocky_global_init(apis); s_pr...
(1, s_prv_listener_a1__callcount)
; jerry_release_value(a_event); } void test_rocky_api_global__event_constructor(void) { static const RockyGlobalAPI *apis[] = {NULL}; rocky_global_init(apis); EXECUTE_SCRIPT( "_rocky.Event.prototype.myCustomThing = 'xyz';\n" "var e = new _rocky.Event('myevent');\n" "var t = e.type;\n" "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...
(prv_send_job, session)
; return true; // we croak if a task cannot be scheduled on KernelMain } bool bt_driver_comm_is_current_task_send_next_task(void) { return launcher_task_is_current_task(); }
l_count); } else { cl_assert_equal_i(2, s_graphics_fill_rect.call_count); cl_assert_equal_i(0, s_graphics_line_draw_precise_stroked.call_count); cl_assert_equal_i(0, s_graphics_draw_line.call_count); cl_assert_equal_i(1, s_graphics_context_set_fill_color.call_count); cl_assert_equal_i(0, s_graphic...
prv_js_global_get_value("e2")
ios_notif_pref_db_get_prefs((uint8_t *)app_id, strlen(app_id)); char *display_name = ""; if (notif_prefs) { display_name = (char *)attribute_get_string(&notif_prefs->attr_list, AttributeIdAppName, ""); } const char *mute_label = i18n_noop("Mute %s"); static char mute_label_buf[32]; snpri...
(data, NULL)
; } static void prv_back_button_single_click_handler(ClickRecognizerRef recognizer, void *data) { NotificationWindowData *window_data = data; if (window_data->is_modal) { analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_CLOSED_COUNT, AnalyticsClient_System); } prv_pop_notification_window(window_data); } ...
ds_user_to_start_playback_on_phone(void) { prv_connect_ams(); // No metadata received yet, user needs to start playback on phone cl_assert_equal_b(music_needs_user_to_start_playback_on_phone(), true); // Received metadata // cl_assert_equal_b(music_needs_user_to_start_playback_on_phone(), false); // Metad...
cl_assert_equal_i(track_duration_ms, 0)
(((FileResourceData *) entry->store_data)->name, op_flags)
; } static uint32_t resource_storage_file_get_length(ResourceStoreEntry *entry) { const uint8_t op_flags = OP_FLAG_READ | OP_FLAG_SKIP_HDR_CRC_CHECK | OP_FLAG_USE_PAGE_CACHE; return prv_file_common_get_length_and_close(prv_file_open(entry, op_flags)); } static uint32_t resource_storage_file_get_crc(ResourceStoreE...
0xb7, 0x3a, 0x0e, 0x80, 0xef, 0x09, 0xaf, 0x74}; // Legacy transport (iAP) isn't aware of the app UUID, so don't set anything: Transport *legacy_transport = (Transport *) TransportID2; CommSession *legacy_app_session = comm_session_open(legacy_transport, &s_transport_imp, ...
fake_system_task_callbacks_invoke_pending()
; cl_assert_equal_i(fake_system_task_count_callbacks(), 0); cl_assert_equal_i(s_send_next_count, 0); } static bool prv_schedule_send_next(CommSession *session) { return true; } static bool s_is_current_task_schedule_task = false; static bool prv_is_current_task_schedule_task(Transport *transport) { return s_i...
592, -800}, { 24, 600, -800}, { 16, 592, -800}, { 24, 592, -800}, { 24, 592, -800}, { 32, 600, -808}, { 32, 600, -808}, { 32, 592, -800}, { 24, 592, -800}, { 24, 600, -808}, { 24, 600, -792}, { 24, 600, -792}, { 24, 592, -808}, { 16, 592, -800}, { 24, 600, -800},...
{ 16, 600, -800}, { 16, 600, -800}, { 16, 600, -800}, { 16, 600, -800}, { 24, 600, -800}, { 24, 600, -800}, { 24, 600, -800}, { 24, 600, -800}, { 24, 600, -800}, { 24, 592, -800}, { 24, 600, -792}, { 24, 608, -792}, { 32, 600, -792}, { 24, 592, -800}, { 24, 60...
{ 24, 600, -792}, { 24, 600, -800}, { 24, 600, -792}, { 24, 600, -792}, { 24, 600, -792}, { 16, 608, -800}, { 16, 608, -792}, { 24, 608, -800}, { 24, 600, -800}, { 24, 608, -792}, { 16, 608, -792}, { 16, 600, -792}, { 24, 592, -792}, { 16, 608, -792}, { 24, 6...
frame; #if PBL_ROUND const int top_bottom_inset = (frame.size.h - LAUNCHER_MENU_LAYER_CELL_ROUND_FOCUSED_CELL_HEIGHT - (2 * LAUNCHER_MENU_LAYER_CELL_ROUND_UNFOCUSED_CELL_HEIGHT)) / 2; const GEdgeInsets menu_layer_frame_insets = GEdgeInsets(top_bottom_inset, 0); menu_layer_frame = grect_inset(menu...
{ if (!launcher_menu_layer || !window) { return; } menu_layer_set_click_config_onto_window(&launcher_menu_layer->menu_layer, window); }
void launcher_menu_layer_reload_data(LauncherMenuLayer *launcher_menu_layer) { if (!launcher_menu_layer) { return; } menu_layer_reload_data(&launcher_menu_layer->menu_layer); } void launcher_menu_layer_set_selection_state(LauncherMenuLayer *launcher_menu_layer, ...
_equal_fixed_s32_16(test_value, FIXED_S32_16_ONE); property_animation_set_from_fixed_s32_16(prop_h, &start_value); // Start, we should start at the start values prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_fixed_s32_16(value, start_value); // Halfway through prv_advance_to_ms_with_timers(...
animation_schedule(h)
; // Test the accessor functions GColor8 test_value; property_animation_get_from_gcolor8(prop_h, &test_value); cl_assert(gcolor_equal(test_value, start_value)); property_animation_get_to_gcolor8(prop_h, &test_value); cl_assert(gcolor_equal(test_value, end_value)); GColor8 set_value; set_value = (GCo...
/* * 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_process_md.allow_js) { return comm_session_get_system_session(); } return s_app_session_ptr; }
bool comm_session_is_valid(const CommSession *session) { if (!session) { return false; } return (session == comm_session_get_current_app_session() || session == comm_session_get_system_session()); } static int s_send_next_count = 0; void comm_session_send_next(CommSession *session) { ++s_send_n...
, 744, -328}, { 952, 968, -272}, { 856, 752, -136}, { 1088, 752, -200}, { 1376, 544, -152}, { 1112, 544, -264}, // 39 seconds { 872, 248, -216}, { 912, 104, -80}, { 1088, 248, -112}, { 1400, 184, -120}, { 1368, 192, -56}, { 1320, 160, -144}, { 1104, 104, -168}, { ...
{ 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}, { 864...
{ 1312, 336, -48}, { 1112, 160, -128}, { 1040, 192, -136}, // 47 seconds { 1088, 256, -104}, { 1192, 216, -136}, { 1192, 184, -112}, { 1120, 160, -168}, { 856, -80, -96}, { 728, -72, 24}, { 504, -8, -504}, { 712, -40, -312}, { 1416, 256, -440}, { 1392, 104, -400}...
verwrite */); } else { dbgserial_putstr("Entering infinite loop in ISR"); while (true) ; } } // ================================================================================= // You can capture when the user selects a menu icon with a menu item select callback static void menu_select_callback(int index,...
NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_WKUP_IRQn; // Lower values are higher priority - make this same or lower priority than a FreeRTOS ISR NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = (configMAX_SYSCALL_INTERRUPT_PRIORITY >> 4); NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVI...
// ================================================================================= static void prv_window_load(Window *window) { TestTimersAppData *data = s_app_data; int i = 0; data->menu_items[i++] = (SimpleMenuItem) { .title = "croak", .callback = menu_select_callback, }; data->menu_ite...
aw_1px_aa(&context, GPoint(5, 5), GPoint(45, 10))); #else ASSERT_CALLED(graphics_line_draw_1px_non_aa(&context, GPoint(5, 5), GPoint(45, 10))); #endif setup_test(&context, true, 1, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect(&context, &GRe...
graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))
; ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_ODD)); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)); setu...
rval(); } uint32_t accel_get_sampling_interval(void) { return s_sampling_interval_us; } void accel_set_num_samples(uint32_t num_samples) { s_num_samples = num_samples; } int accel_peek(AccelDriverSample *data) { return 0; } void accel_enable_shake_detection(bool on) { } bool accel_get_shake_detection_enabled(vo...
if ((mask & (0x1 << j)) != 0) { test_rates[idx] = sample_rates[j]; idx++; }
} printf("Testing: "); for (int i = 0; i < count; i++) { printf("%d ", sample_rates[i]); } printf("\n"); prv_run_accel_test(test_rates, count); } } void test_accel_manager__jitterfree(void) { // Force the fake accel to only support the 125hz sample rate. s_force_sampling_interval...
ree(peek_layer); } void peek_layer_init(PeekLayer *peek_layer, const GRect *frame) { *peek_layer = (PeekLayer) { .icon_offset_y = PEEK_LAYER_ICON_OFFSET_Y, .subtitle_margin = PEEK_LAYER_SUBTITLE_MARGIN, .dot_diameter = 9, }; // peek layer layer_init(&peek_layer->layer, frame); layer_set_clips(&pe...
{ icon_from = (GRect) { .origin.x = layer_frame.origin.x + (layer_frame.size.w - UNFOLD_DOT_SIZE_PX) / 2, .origin.y = layer_frame.origin.y + (layer_frame.size.h - UNFOLD_DOT_SIZE_PX) / 2, .size = UNFOLD_DOT_SIZE, }; }
GSize size = kino_reel_get_size(from_reel); GRect icon_to = { .origin.x = layer_frame.origin.x + (layer_frame.size.w - size.w) / 2, .origin.y = layer_frame.origin.y + (layer_frame.size.h - size.h) / 2, .size = size, }; const bool take_ownership = true; KinoReel *kino_reel = kino_reel_unfold_cre...
void test_rocky_text_encoding__jerry_handles_utf8_strings_in_source(void) { // Source is be UTF-8 encoded. // Have a string variable with Pile of Poo (💩) or U+1F4A9 in it, encoded using 4-bytes: EXECUTE_SCRIPT("var pileOfPooUTF8 = '\xF0\x9F\x92\xA9';"); // Expect a pair of surrogate code points: EXECUTE_SCR...
(buffer_size)
; const jerry_size_t copied_size = jerry_string_to_utf8_char_buffer(s, utf8_buffer, buffer_size); if (!is_overflow_test) { cl_assert_equal_i(copied_size, cases[i].expected_utf_size); if (cases[i].expected_utf_size) { cl_assert_equal_m(utf8_buffer, cases[i].expected_utf_d...
uint8_t stroke_width) { s_last_args_for_mock = (ArgsForMock){ .ctx = *ctx, .r0 = *rect, .radius = radius, .corner_mask = GCornersAll }; strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)); } void prv_draw_round_rect_stroked(GContext* ctx, const GRect *r...
cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlue.argb)
; #else cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlack.argb); #endif color.a = 2; graphics_context_set_stroke_color(&context, color); #if PBL_COLOR cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlue.argb); #else cl_assert_equal_i(context.draw_state.stroke_color.argb, GCol...
, { 1448, 344, 152}, { 1408, 208, 152}, { 1440, 152, 200}, { 1224, 192, 256}, { 1024, 88, 152}, { 872, 80, 136}, { 776, 0, 104}, { 744, -56, 64}, { 680, -104, 88}, { 704, -144, 32}, { 792, -80, -8}, { 936, -48, -16}, { 1528, -168, 112}, { 1976, 24, 216}, { 139...
{ 1240, 152, 16}, { 1064, 320, -152}, { 944, 384, -200}, { 832, 184, 80}, { 848, 160, 120}, { 888, 264, 72}, { 920, 400, 32}, { 824, 488, -48}, { 920, 416, -120}, { 1136, 376, -192}, { 1200, 192, -192}, { 1312, 192, 24}, { 1472, 264, -16}, { 1144, 328, -32}, {...
{ 888, 136, 192}, { 784, 96, 168}, // 83 seconds { 808, 88, 112}, { 824, -8, 144}, { 840, -8, 104}, { 936, -64, 120}, { 1040, 0, -16}, { 960, -8, -56}, { 1512, -200, 160}, { 1264, 40, 112}, { 1272, 352, -144}, { 1136, 344, -112}, { 904, 280, 88}, { 784, 200, ...
/* * 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...
(data->units_font)
HZ(2); prv_display_context_init(&s_display_context); vSemaphoreCreateBinary(s_dma_update_in_progress_semaphore); dma_request_init(SHARP_SPI_TX_DMA); prv_enable_display_spi_clock(); prv_display_start(); prv_disable_display_spi_clock(); s_initialized = true; } static void prv_display_context_init(Dis...
SPI_I2S_SendData(BOARD_CONFIG_DISPLAY.spi, d)
; while (!SPI_I2S_GetFlagStatus(BOARD_CONFIG_DISPLAY.spi, SPI_I2S_FLAG_TXE)) {} } static bool prv_do_dma_update(void) { DisplayRow r; PBL_ASSERTN(s_display_context.get_next_row != NULL); bool is_end_of_buffer = !s_display_context.get_next_row(&r); switch (s_display_context.state) { case DISPLAY_STATE_IDL...
) == false); cl_assert(do_not_disturb_is_schedule_enabled(WeekendSchedule) == false); active = do_not_disturb_is_active(); cl_assert(active == false); // 11 PM - 7 AM DoNotDisturbSchedule weekday_schedule = { .from_hour = 23, .from_minute = 0, .to_hour = 7, .to_minute = 0, }; // 1 AM - 9...
(active == false)
; // Timer will go off at 00:00 on Saturday. (46.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 167400 * MS_PER_SECOND); // 10:30 PM - 8:30 AM DoNotDisturbSchedule weekday_schedule_2 = { .from_hour = 22, .from_minute = 30, .to_hour = 8, .to_minute = 30, }; // 12 AM ...
k_callbacks_invoke_pending(); } fake_pb_storage_mem_assert_contents_written(buffer, sizeof(buffer)); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Commit Message void test_put_bytes__commit_message_too_short(void) { prv_receive_init_and_put_fw_object(...
assert_ack_count(0)
; assert_nack_count(1); } void test_put_bytes__install_message_while_not_in_fw_update_mode(void) { prv_receive_init_put_and_commit_fw_object(); s_firmware_update_is_in_progress = false; prv_receive_install(s_last_response_cookie); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__install_...
date_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(2, 2, 28, 20), 4); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite)...
(&ctx.dest_bitmap, "draw_round_rect_across_y_offset_layer.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__clear(...
_MIN_LENGTH; // don't care if the timeout is alreay queued as the FSM state will make it a noop new_timer_stop(s_read_timer); } accessory_use_dma(false); mbuf_clear_next(&s_header_mbuf); prv_reset_read_info(); prv_reset_read_consumer(); smartstrap_fsm_state_set(SmartstrapStateReadReady); smartstr...
if ((smartstrap_fsm_state_get() != SmartstrapStateReadInProgress) && (smartstrap_fsm_state_get() != SmartstrapStateNotifyInProgress)) { return false; }
bool should_context_switch = false; bool hdlc_err; bool should_store; bool is_complete = hdlc_streaming_decode(&s_read_info.hdlc_ctx, &data, &should_store, &hdlc_err); if (hdlc_err) { // the rest of the frame is invalid s_read_info.should_drop = true; } else if (is_complete) { prv_handle_compl...
MfgSerialsResult result, const uint8_t index, const char *value, const char *name); const char* mfg_get_serial_number(void) { // Trying from "most recent" slot to "least recent": for (int i = ARRAY_LENGTH(OTP_SERIAL_SLOT_INDICES) - 1; i >= 0; --i) { const uint8_t index = OTP_SERIAL_SLOT_INDICES[i]; if (ot...
(result, index, hwver, "HW version")
ig_provider) { window_set_click_config_provider_with_context(window, click_config_provider, NULL); } void window_set_click_context(ButtonId button_id, void *context) { prv_check_is_in_click_config_provider(window_manager_get_top_window(), "context"); ClickManager *mgr = prv_get_current_click_manager(); ClickCo...
{ window->window_handlers = *handlers; }
ion_dialog); // Find the current index utf8_t *cursor = (utf8_t *)dialog->buffer; int16_t current_idx = 0; while (cursor < (utf8_t *)transcription_dialog->zero) { cursor = utf8_get_next(cursor); current_idx++; } PBL_ASSERTN(cursor == (utf8_t *)transcription_dialog->zero); PBL_ASSERTN(current_idx ...
{ Dialog *dialog = expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog); animation_unschedule(property_animation_get_animation(transcription_dialog->animation)); *transcription_dialog->zero = transcription_dialog->missing; transcription_dialog->zero = dialog->buffer + transcription_dialog->buf...
static void prv_transcription_dialog_unload(void *context) { TranscriptionDialog *transcription_dialog = context; app_timer_cancel(transcription_dialog->pop_timer); prv_stop_text_animation(transcription_dialog); } static void prv_transcription_dialog_load(void *context) { TranscriptionDialog *transcription_d...
k, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40...
(&context)
; graphics_context_set_compositing_mode(&context, GCompOpOr); cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0); // Text Color draw_state = graphics_context_get_drawing_state(&context); graphics_context_set_text_color(&context, GColorRed); cl_assert(memcmp(&draw_state, &context.d...
/* * 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_text_layer, "Down")
; } static void prv_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler); window_single_click_subscribe(BUTTON_ID_UP, prv_up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_down_click_handler); } static void prv_window_load(Window *wi...
prv_now_ms()
; uint64_t unschedule_time = 0; uint64_t time_ms; for (int num_loops = 0; num_loops < 10; num_loops++) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, layer.f...
336, -920}, { -280, 344, -944}, { -272, 328, -936}, { -280, 328, -920}, { -288, 344, -928}, { -288, 352, -928}, { -272, 312, -928}, { -280, 336, -928}, { -280, 336, -928}, { -280, 320, -928}, { -280, 336, -928}, { -280, 336, -928}, { -288, 352, -920}, // 173 seconds ...
{ -272, 320, -912}, { -280, 256, -928}, { -272, 240, -968}, { -256, 272, -968}, // 178 seconds { -272, 304, -936}, { -272, 296, -952}, { -256, 320, -944}, { -256, 280, -968}, { -232, 384, -952}, { -248, 280, -944}, { -240, 368, -968}, { -264, 256, -936}, { -272, 2...
e version is totally unexpected, remove the file and create a new one PBL_LOG(LOG_LEVEL_ERROR, "Unknown settings file verison %"PRIu16"", version); } if (result != S_SUCCESS) { // Delete the old file and create a new one if migration failed activity_private_settings_close(file); pfs_remove(ACTIVITY...
memset(&s_activity_state.hr.metrics.minutes_in_zone, 0, sizeof(s_activity_state.hr.metrics.minutes_in_zone))
; s_activity_state.steps_per_minute_last_steps = 0; s_activity_state.distance_mm = 0; s_activity_state.active_calories = 0; s_activity_state.resting_calories = 0; activity_algorithm_metrics_changed_notification(); s_activity_state.cur_day_index = cur_day_index; // Remove sessi...
/* * 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...
find_device_by_conn_idx(conn_idx)
; if (dev) { dev->is_gateway = is_gateway; } storage_release(); BTDeviceInternal device; connection_get_address(connection, &device); hc_endpoint_pebble_pairing_service_found_gateway(&device); } static bool prv_is_bonded(uint16_t conn_idx) { storage_acquire(); device_t *dev = find_device_by_conn_i...
cept in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY K...
(num.fraction == 7)
; test_num = (int32_t)((float)-0 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == 0); cl_assert(num.fraction == 0); test_num = (int32_t)((float)0 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.i...
return (start_time != end_time); } // Converts the sensor time from the BMI160 captured at the time the sample // was collected to the actual system time static uint64_t prv_get_sample_time_us(uint8_t sensor_time[3]) { uint64_t curr_time_us = prv_get_curr_system_time_ms() * 1000; uint32_t time_since_data_colle...
{ BMI160_DBG("0x%"PRIx8" = 0x%"PRIx8, addr, bmi160_read_reg(addr)); }
BMI160_DBG("Latched = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_LATCH)); BMI160_DBG("Err reg = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_ERR)); BMI160_DBG("INT_MAP[0] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_0)); BMI160_DBG("INT_MAP[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_1)); BMI160_DBG("INT_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...
setup_pbi_test(TEST_PBI_FILE)
d *context) { s_state.out.failure_count = 0; prv_handle_outbox_result(APP_MSG_OK); } static void prv_handle_outbox_failed(DictionaryIterator *it, AppMessageResult reason, void *ctx) { APP_LOG(APP_LOG_LEVEL_WARNING, "Failed to send message: Reason %d", reason); ++s_state.out.failure_count; prv_handle_outbox_r...
(LOG_LEVEL_ERROR, "Resetting because bad Chunk!")
; prv_session_open__exit_and_initiate_reset(); } } else if (dict_find(it, PostMessageKeyResetRequest)) { prv_awaiting_reset_complete_remote_initiated_enter(); prv_session_open__after_exit(); } else if (dict_find(it, PostMessageKeyResetComplete)) { PBL_LOG(LOG_LEVEL_ERROR, "Resetting because go...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ list->alloc += 10; list->names = realloc(list->names, list->alloc * sizeof(const char *)); }
list->names[list->count++] = cat; } static void clar_category_enable(const char *category) { clar_category_add_to_list(&_clar_categorize_enabled, category); } static void clar_category_enable_all(size_t suite_count, const struct clar_suite *suites) { size_t i; const char **cat; clar_category_enable(CLAR_CATEG...
/* * 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...
{ while (node != NULL && index != 0) { if (index > 0) { node = node->next; index--; } else { node = node->prev; index++; } } return node; }
ListNode* list_sorted_add(ListNode *node, ListNode *new_node, Comparator comparator, bool ascending) { if (node == NULL) { return new_node; } if (new_node == NULL) { return node; } ListNode * const head = node; for(;;) { int order = comparator(node, new_node); if (!ascending) { order...
/* * 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...
RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, BOOT_BIT_INITIALIZED)
; } } void boot_bit_set(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); current_value |= bit; RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value); } void boot_bit_clear(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); ...
v = settings_file_each(&storage->file, prv_each_find_children, &info); if (rv) { goto cleanup; } if (info.num_children) { rv = S_SUCCESS; } else { rv = S_NO_MORE_ITEMS; } cleanup: mutex_unlock(storage->mutex); return rv == S_SUCCESS; } status_t timeline_item_storage_delete_with_parent( ...
mutex_lock(storage->mutex)
; status_t rv = settings_file_get(&storage->file, key, key_len, val_out, val_len); // Restore flags & status SerializedTimelineItemHeader *hdr = (SerializedTimelineItemHeader *)val_out; hdr->common.flags = ~hdr->common.flags; hdr->common.status = ~hdr->common.status; mutex_unlock(storage->mutex); retur...
Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed un...
(&config->info)
x, int y); #elif SCREEN_COLOR_DEPTH_BITS == 8 extern GColor get_bitmap_color(GBitmap *bmp, int x, int y); #endif void test_graphics_draw_rotated_bitmap__initialize(void) { s_fake_data_row_handling = false; fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_image_bw = ...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_set_0.Xbit.pbi"))
; // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
------------------ void worker_manager_init(void) { s_to_worker_event_queue = xQueueCreate(MAX_TO_WORKER_EVENTS, sizeof(PebbleEvent)); } // --------------------------------------------------------------------------------------------- // This is the wrapper function for the worker. It's not allowed to return as it's...
(memory_segment_split(&worker_segment, NULL, stack_guard_size))
; // No (accessible) memory segments can be placed between the top of WORKER_RAM // and the end of stack. Stacks always grow towards lower memory addresses, so // we want a stack overflow to touch the stack guard region before it begins // to clobber actual data. And syscalls assume that the stack is always at ...
/* * 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...
{ // all other transitions are invalid cl_assert(false); }
} SmartstrapState smartstrap_fsm_state_get(void) { return s_fsm_state; } void smartstrap_fsm_state_reset(void) { s_fsm_state = SmartstrapStateReadReady; } bool smartstrap_fsm_state_test_and_set(SmartstrapState expected_state, SmartstrapState next_state) { if (s_fsm_state != expected_state) { return false;...
/* * 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...
(HDLC_START)
; } static void prv_put_byte_hdlc(uint8_t datum) { if ((datum == HDLC_ESCAPE) || (datum == HDLC_START)) { prv_put_byte(HDLC_ESCAPE); prv_put_byte(datum ^ HDLC_ESCAPE_MASK); } else { prv_put_byte(datum); } } static void prv_prompt_output_cb(int16_t *samples, size_t sample_count, void *context) { co...
/* * 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(error)
; } void test_ancs_util__should_parse_incomplete_last_attribute(void) { bool error = false; cl_assert(!ancs_util_is_complete_notif_attr_response(s_chunked_dict_part_one, sizeof(s_chunked_dict_part_one), &error)); cl_assert(!error); } void test_ancs_util__should_not_parse_malformed_notif_attr_dict(void) ...