prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
i18n_noop("You walked %d steps which is %d%% below your typical. " "Being active makes you feel amaaaazing–try to get back on track tomorrow."), i18n_noop("You walked %d steps today which is %d%% below your typical. " "Don't worry, tomorrow is just around the corner 😀")...
i18n_noop("Good morning! You slept for %dH %dM. Consistency is key; " "keep doing what you're doing 😃.")
, i18n_noop("You're rockin' the shut eye! You slept for %dH %dM. Make it a nightly ritual. " "You deserve it."), i18n_noop("Feelin' good? You slept for %dH %dM. Nothing can stop you now 👊"), }, }, [PercentTier_BelowAverage] = { .num_variants = 4, .variants = ...
/* * 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...
(bytes, saved_lr, heap)
; } return mem; } void *task_calloc(size_t count, size_t size) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_calloc(task_heap_get_for_current_task(), count, size, saved_lr); } void *task_calloc_check(size_t count, size_t size) { register uintptr_t lr __asm("lr"); uintptr_t s...
__, .cache_policy = MpuCachePolicy_NotCacheable, .priv_read = false, .priv_write = false, .user_read = false, .user_write = false }; static const MpuRegion s_app_region = { .region_num = MemoryRegion_AppRAM, .enabled = true, .base_address = MPU_REGION_APP_BASE_ADDRESS, .size = MPU_REGION_APP_SIZE, ...
{ // No null between here and the end of the memory region. return false; }
return true; }
express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "clar.h" #include "util.h" #in...
layer_set_update_proc(&layer, &inside_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outs...
/* * 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...
{ clock = clocks.PCLK2_Frequency; }
else { WTF; } int lg; if (bus_frequency > (clock / 2)) { lg = 1; // Underclock to the highest possible frequency } else { uint32_t divisor = clock / bus_frequency; lg = ceil_log_two(divisor); } // Prescalers only exists for values in [2 - 256] range PBL_ASSERTN(lg > 0); PBL_ASSERTN(lg...
{ 968, 1200, -408}, { 976, 760, -240}, { 1152, 712, -232}, { 1384, 608, -240}, { 1312, 488, -200}, { 1200, 304, -160}, { 1280, 280, -264}, { 1432, 256, -160}, { 1512, 264, -136}, { 1496, 224, -104}, { 1272, 176, -144}, { 896, -384, -104}, { 848, -288, -24}, { 480, -...
{ 192, -920, -840}, { 104, -944, -784}, { 296, -632, -528}, { 472, -528, -104}, { 784, -256, 136}, { 792, -120, 416}, { 1512, 136, 200}, { 1328, 440, 160}, { 1536, 648, 104}, { 1784, 776, 64}, { 2096, 792, -64}, // 74 seconds { 2616, 592, -336}, { 2544, 1280, -704...
{ 1288, 576, -184}, { 1712, 624, -264}, { 1784, 424, -168}, { 1592, 144, -104}, { 1592, 104, -96}, { 1624, 200, -48}, { 1560, 112, -112}, { 1560, 80, -48}, { 1328, 40, -8}, { 752, -776, 256}, { 656, -184, -64}, { 552, -344, 16}, { 800, 48, -176}, { 992, 136, -216...
const char* written_hw_version4 = "VWXYZ12"; command_hwver_write(written_hw_version4); hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version4, hw_version); // Write fifth time const char* written_hw_version5 = "3456789"; command_hwver_write(written_hw_version5); hw_version = mfg_get_...
(sn, third_sn)
; cl_assert_equal_i(index, 4); // SERIAL3 lives at index 4 // Fourth time: const char *fourth_sn = "mnbvcxzlkjhg"; r = mfg_write_serial_number(fourth_sn, strlen(fourth_sn), &index); sn = mfg_get_serial_number(); cl_assert_equal_i(r, MfgSerialsResultSuccess); cl_assert_equal_s(sn, fourth_sn); cl_assert_...
num_services, &bp_service->uuid); cl_assert_equal_i(num_found_services, num_services); // Test that the UUID matches the Blood Pressure UUID: const Uuid uuid = gatt_client_service_ge...
(uuid_equal(&uuid1, &thermo_service->uuid) || uuid_equal(&uuid1, &random_128bit_service->uuid))
; cl_assert(uuid_equal(&uuid2, &thermo_service->uuid) || uuid_equal(&uuid2, &random_128bit_service->uuid)); }
ne_mode ? ToggleStateEnablingBluetooth : ToggleStateDisablingBluetooth; settings_menu_mark_dirty(SettingsMenuItemBluetooth); } bool is_remote_connected(StoredRemote* remote) { switch (remote->type) { case StoredRemoteTypeBTClassic: return remote->classic.connected; case StoredRemoteTypeBLE: ret...
add_remote(data, remote)
; } } //! This must be called after updating classic remotes for remote consolidation static void prv_add_and_merge_ble_remotes(SettingsBluetoothData *data) { bt_persistent_storage_for_each_ble_pairing(prv_add_and_merge_ble_remote, data); StoredRemote *remote = (StoredRemote *)data->remote_list_head; while (r...
_send_frame(OPCODE_FLASH_GEOMETRY, &response, sizeof(response)); } static void prv_handle_flash_erase_request(const void *payload, uint32_t length) { if (length != sizeof(FlashEraseRequest)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } const FlashEraseRequest *request = pa...
if (request->region == REGION_FW_SCRATCH) { boot_bit_set(BOOT_BIT_NEW_FW_AVAILABLE); } else if (request->region == REGION_PFS) { // Do nothing! } else if (request->region == REGION_COREDUMP) { // Do nothing! } else { PBL_LOG(LOG_LEVEL_ERROR, "Invalid region (%"PRIu8")", request->region); }
/* * 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...
layer_mark_dirty(&app_data->window.layer)
; } } static void prv_handle_init(void) { const bool has_hrm = mfg_info_is_hrm_present(); AppData *data = task_zalloc(sizeof(*data)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, ""); window_set_fullscreen(window, true); TextLayer *title = &data->title_text_laye...
/* * 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...
(frequency, LSE_FREQUENCY_HZ * 1000)
; PBL_LOG(LOG_LEVEL_DEBUG, "Calibrating RTC by %s%"PRIu32" units", (config.sign == RTC_CalibSign_Positive) ? "+" : "-", config.units); // This is a no-op if RTC_CALIBRATION_TESTING is undefined. rtc_calibration_init_timer(); RTC_CoarseCalibConfig(config.sign, config.units); RTC_CoarseCalibCmd(ENA...
(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE))
; } // Tests palettized bitblt non-power-of-two tiling support to circular display buffer // Result: // - gbitmap matches platform loaded PBI void test_bitblt_circular__color_8_bit_tiling_palettized(void) { GBitmap *bitmap = setup_png_test(TEST_NAMED_PNG_FILE("test_bitblt_circular__tile_palettized")); cl_assert(...
break; default: PBL_CROAK("reset loop boot bits overrun"); break; } return false; } static bool check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool check_for_fw_start_failure() { // Add more failure conditions here. if (!watchdog_check_re...
(" ___ _ _ _ ")
; dbgserial_putstr("/ __><_>| || |__"); dbgserial_putstr("\\__ \\| || || / /"); dbgserial_putstr("<___/|_||_||_\\_\\"); dbgserial_putstr(""); // PMIC requires I2C i2c_init(); dbgserial_putstr("i2c inited"); pmic_init(); dbgserial_putstr("pmic inited"); boot_bit_init(); dbgserial_putstr("boo...
eturn res; } #if PBL_BW T_STATIC bool get_bitmap_bit(GBitmap *bmp, int x, int y) { int byte_num = y * bmp->row_size_bytes + x / 8; int bit_num = x % 8; uint8_t byte = ((uint8_t*)(bmp->addr))[byte_num]; return (byte & (1 << bit_num)) ? 1 : 0; } #elif PBL_COLOR T_STATIC GColor get_bitmap_color(GBitmap *bmp, int ...
((width * width) + (height * height))
+ 2; const int32_t min_x = src_ic.x - max_distance; const int32_t min_y = src_ic.y - max_distance; const int32_t size_x = max_distance*2; const int32_t size_y = size_x; const GRect dest_clip_min = GRect(dest_ic.x + min_x, dest_ic.y + min_y, size_x, size_y); grect_clip(&dest_clip, &dest_clip_m...
mask_value_index = 0; mask_value_index < num_mask_values; mask_value_index++) { int16_t y1 = (int16_t)(mask_value_index * num_pixels_per_mask_value); int16_t y2 = (int16_t)(y1 + num_pixels_per_mask_value - 1); record_func(ctx, x, y1, y2, src_color); } } cl_assert(graphics_context_mask_record...
{ const GSize bitmap_size = GSize(num_src_colors, num_dest_colors * hline_applying_test_column_width); prv_prepare_canvas(ctx, bitmap_size); // Fill the canvas so each row (of width vline_applying_test_row_height) is set to one of the // different possible dest_colors for (i...
static GDrawMask *prv_create_mask_for_vline_applying_test(GContext *ctx) { // The initial transparency doesn't really matter since we're about to overwrite it const bool transparent = false; GDrawMask *mask = graphics_context_mask_create(ctx, transparent); cl_assert(mask); const GSize mask_size = ctx->dest...
/* * 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); }
xact(current_rtc_ticks_at_second, ticks_to_time(s_coarse_ticks + current_rtc_ticks)); } static void initialize_fast_mode_state(void) { RtcIntervalTicks before_ticks = get_rtc_interval_ticks(); // Set the RTC to value 0 so we start from scratch nicely RTC_TimeTypeDef rtc_time; RTC_TimeStructInit(&rtc_time); ...
(RTC_Alarm_A, DISABLE)
; RTC_AlarmTypeDef alarm_config; RTC_AlarmStructInit(&alarm_config); alarm_config.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay; s_alarm_set_time = rtc_get_ticks(); RtcTicks alarm_expiry_time = s_alarm_set_time + num_ticks; uint32_t days, hours, minutes, seconds; time_util_split_seconds_into_parts(alarm_e...
lock(device_id, i2c_device_address, register_address, 1, result); } bool i2c_read_register_block(I2cDevice device_id, uint8_t i2c_device_address, uint8_t register_address_start, uint8_t read_size, uint8_t* result_buffer) { #if defined(TARGET_QEMU) PBL_LOG(LOG_LEVEL_DEBUG, "i2c reads on Q...
{ // Last byte, we want to NACK this one to tell the slave to stop sending us bytes. bus->i2c->CR1 &= ~I2C_CR1_ACK; }
bus->transfer.state = TRANSFER_STATE_WAIT_FOR_DATA; break; case TRANSFER_STATE_WAIT_FOR_DATA: //This state just ensures that the transition to receive mode event happened // Enable RXNE interrupt for writing bus->i2c->CR2 |= I2C_CR2_ITBUFEN; bus->transfer.state = TRANSFER_STAT...
"Palo Alto"); static StringList headings = StringListLiteral("Attendees\0Organizer"); static StringList paragraphs = StringListLiteral("Ryan Case\nBrad Murray\0Sarah Otten"); attribute_list_add_string_list(&list, AttributeIdHeadings, &headings); attribute_list_add_string_list(&list,...
{ // Past pins (deprecated) prv_add_calendar_pin(-4 * 60 * 60, 60, !is_all_day, !recurring, 0, 0); prv_add_generic_pin(-6 * 60 * 60, !has_subtitle); prv_add_generic_pin(-5 * 60 * 60, has_subtitle); prv_add_sports_pin(-4 * 60 * 60, GColorBlack, is_ingame, !has_broadcaster); prv_add_ac...
/* * 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...
("Katharine Claire Berry", dest, NAME_LENGTH)
; cl_assert_equal_s(dest, "Katharine C. B."); } void test_phone_formatting__name_double_space(void) { char dest[NAME_LENGTH]; phone_format_caller_name("Katharine Berry", dest, NAME_LENGTH); cl_assert_equal_s(dest, "Katharine B."); } void test_phone_formatting__name_trailing_space(void) { char dest[NAME_L...
eate_object(), .expected_output = true, }, { .input = jerry_create_external_function(prv_dummy), .expected_output = true, }, }; for (int i = 0; i < ARRAY_LENGTH(cases); ++i) { bool output = !cases[i].expected_output; jerry_value_t input = cases[i].input; JERRY_ARGS_MAKE(i...
jerry_create_number(0)
, [1] = jerry_create_number(0), [2] = jerry_create_number(0), [3] = jerry_create_number(4096.0), }, .argc = 4, .error_msg = "TypeError: Argument at index 3 is invalid: Value out of bounds for native type", }, { .argv = { [0] = jerry_create_number(0), ...
/* * 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_is_hrm_enabled) { // Set all handlers to NULL, so the ble_service dispatcher won't ever try to call us: s_hrs.svc = (const ble_service_t) {}; return; }
const hrs_body_sensor_location_t sensor_location = HRS_SENSOR_LOC_WRIST; static const hrs_callbacks_t s_callbacks = { .ee_reset = NULL, // Beat-to-beat interval data is not supported at the moment. .notif_changed = prv_handle_subscribe, }; hrs_init(&s_hrs, sensor_location, &s_callbacks, start_hdl); ...
bitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw3_clip_nxny.${BIT_DEPTH_...
graphics_draw_rect(ctx, &box)
; } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__clipping_rect(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); graphics_context_set_stroke_color(&ctx, GColorBlack); // Draw rectangles around boundaries of clipping b...
sert_equal_b(true, s_kernel_receiver_finish_called); } void test_app_message_receiver__receive_push_but_inbox_not_opened_then_cleanup(void) { Receiver *r = s_rcv_imp->prepare(s_session, &s_app_message_endpoint, sizeof(AppMessagePush)); s_rcv_imp->write(r, (const uint8_t *)&s_push...
(s_app_message_pp_received_length, sizeof(AppMessageAck))
{ 88, -32, -936}, { 96, -16, -936}, { 88, -24, -928}, { 96, -24, -936}, { 88, -16, -936}, { 96, -24, -928}, { 96, -24, -936}, { 96, -32, -928}, { 96, -16, -928}, { 96, -8, -928}, { 96, -24, -936}, { 88, -24, -928}, { 88, -48, -928}, { 96, -64, -928}, { 104, -72, -...
{ 104, 8, -936}, { 96, -24, -928}, // 135 seconds { 104, -32, -920}, { 112, -16, -936}, { 104, -24, -928}, { 96, -16, -936}, { 104, -8, -928}, { 128, -32, -920}, { 120, -32, -928}, { 104, -32, -920}, { 112, 80, -952}, { 96, 32, -944}, { 96, -8, -936}, { 104, 4...
{ 96, -32, -936}, { 96, -48, -928}, { 96, -24, -928}, { 96, -32, -928}, { 96, -48, -928}, { 96, -40, -944}, // 138 seconds { 96, -40, -936}, { 104, -48, -928}, { 104, -24, -944}, { 104, -80, -928}, { 104, -48, -928}, { 88, -32, -936}, { 104, -48, -920}, { 88,...
x = WITHIN(weekday, Monday, Thursday) ? 1 : 0; const int thin_width = 5; thin_box.origin.x += thin_offset_x + (box->size.w - thin_width) / 2; thin_box.size.w = thin_width; graphics_context_set_fill_color(ctx, bar_color); graphics_fill_rect(ctx, &thin_box); } static int16_t prv_draw_day_bar(GContext *ctx, int...
prv_convert_to_graph_height(graph_card, avg)
, AVG_LINE_HEIGHT / 2); graphics_context_set_fill_color(ctx, AVG_LINE_COLOR); graphics_fill_rect(ctx, &(GRect) {{ offset_x, offset_y - AVG_LINE_HEIGHT / 2 }, { width, AVG_LINE_HEIGHT }}); } static void prv_draw_avg_lines(HealthGraphCar...
t, AnimationCurveEaseOut); } // scroll to bottom of current notification static void prv_scroll_to_bottom(SwapLayer *swap_layer) { const GRect *current_frame = &swap_layer->current->layer.frame; const GRect *layer_frame = &swap_layer->layer.frame; // don't allow scrolling up if (current_frame->size.h < layer_f...
if (max_dy == offset) { // if we have already scrolled our maximum amount for this notification, we should swap prv_handle_swap_attempt(swap_layer, direction, is_repeating); return; }
#else if (offset >= swap_layer->current->layer.bounds.size.h - DISP_ROWS) { prv_handle_swap_attempt(swap_layer, direction, is_repeating); return; } #endif // pause at the top of a notification if ((offset == 0) && (is_repeating) && (swap_layer->swap_delay_re...
the heap has configured using heap_set_lock_impl static void heap_lock(Heap* heap) { if (heap->lock_impl.lock_function) { heap->lock_impl.lock_function(heap->lock_impl.lock_context); } } //! Unlock the heap, using whatever behaviour the heap has configured using heap_set_lock_impl static void heap_unlock(Heap...
(start, 0, heap_size * ALIGNMENT_SIZE)
; *heap = (Heap) { .begin = start, .end = end, .fuzz_on_free = fuzz_on_free }; *(heap->begin) = (HeapInfo_t) { .PrevSize = heap_size, .is_allocated = false, .Size = heap_size }; } void heap_set_lock_impl(Heap *heap, HeapLockImpl lock_impl) { heap->lock_impl = lock_impl; } void heap...
/* * 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(mfg_info_get_watch_color(), WATCH_INFO_COLOR_RED)
; mfg_info_set_watch_color(WATCH_INFO_COLOR_GREEN); cl_assert_equal_i(mfg_info_get_watch_color(), WATCH_INFO_COLOR_GREEN); } void test_snowy_mfg_info__rtc_freq(void) { cl_assert_equal_i(mfg_info_get_rtc_freq(), 0); mfg_info_set_rtc_freq(0xfefefefe); cl_assert_equal_i(mfg_info_get_rtc_freq(), 0xfefefefe); ...
BMI160SampleRate sample_interval; } s_operating_states[] = { [AccelOperatingModeData] = { .enabled = false, .sample_interval = BMI160SampleRate_25_HZ, }, [AccelOperatingModeShakeDetection] = { .enabled = false, .sample_interval = BMI160SampleRate_25_HZ, }, [AccelOperatingModeDoubleTapDetectio...
ARRAY_LENGTH(s_operating_states)
; i++) { if (s_operating_states[i].enabled) { // use MIN because sample rate enum value is actually the sampling interval in us sample_rate_max = MIN(sample_rate_max, s_operating_states[i].sample_interval); } } return (uint32_t)sample_rate_max; } // Determine the bit that flips when the sample ...
Window window; SimpleMenuLayer simple_menu_layer; SimpleMenuSection menu_sections[1]; SimpleMenuItem menu_items[FLASH_TEST_CASE_NUM_MENU_ITEMS]; Window test_window; TextLayer msg_text_layer[3]; TextLayer status_text_layer; char status_text[STATUS_TEXT_SIZE]; FlashTestCaseType test_case; uint8_t test...
(msg_text_layer, "Press Back To Exit")
ount = 0; } void test_health_db__cleanup(void) { } // Dummy Data //////////////////////////////////////////////////////////////// #define NUM_CURRENT_MOVEMENT_METRICS 5 #define NUM_CURRENT_SLEEP_METRICS 4 #define NUM_CURRENT_HR_ZONE_METRICS 3 typedef enum MovementDataFields { MD_Version, MD_Timestamp, MD_Ste...
(ActivityMetricSleepTotalSeconds, Monday, &val_out)
); cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalSleepDuration]); // flush cl_assert_equal_i(health_db_flush(), S_SUCCESS); // check cl_assert(!health_db_get_typical_value(ActivityMetricSleepTotalSeconds, Monday, &val_out)); // insert something with an older version (this will succeed) cl_assert_eq...
// Attribute will be stored in place, not in string buffer break; } *cursor += attribute->length; return string_alloc_size; } Attribute *prv_add_attribute(AttributeList *list, AttributeId id) { Attribute *attribute_found = attribute_find(list, id); if (attribute_found) { return attribute_foun...
(buffer, buf_end, cursor, payload_end, &attr_list.attributes[i])
/* * 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_stack_push(window, true)
iphResetCmd(apb2_periphs, DISABLE); // The Cortex-M user guide states that the reset values for the core registers // are as follows: // R0-R12 = Unknown // MSP = VECTOR_TABLE[0] (main stack pointer) // PSP = Unknown (process stack pointer) // LR = 0xFFFFFFFF // PC = VECTOR_TABLE[1]...
if (boot_bit_test(BOOT_BIT_FORCE_PRF)) { boot_bit_clear(BOOT_BIT_FORCE_PRF); return true; }
if (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)) { dbgserial_putstr("Hold down UP + BACK for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK))) { // stop waiting if not held down an...
ata_subscription_error_response(void) { prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], (const uint8_t *) &s_meta_v0_system, sizeof(s_meta_v0_system), ...
prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], 0)
/* * 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...
gpath_builder_line_to_point(builder, p2)
; gpath_builder_line_to_point(builder, p3); gpath_builder_line_to_point(builder, p4); GPath *path = gpath_builder_create_path(builder); gpath_builder_destroy(builder); graphics_context_set_fill_color(ctx, color); gpath_draw_filled(ctx, path); gpath_destroy(path); } void health_progress_bar_fill(GContext...
uint8_t *key, int key_len) { const int resumed_pos = settings_raw_iter_get_resumed_record_pos(iter); // Resume searching at the current record for (; !settings_raw_iter_end(iter); settings_raw_iter_next(iter)) { if (prv_is_desired_hdr(iter, key, key_len)) { return true; } } // If we got here,...
settings_raw_iter_write_byte(&file->iter, offset, byte)
; return S_SUCCESS; } // Note that this operation is designed to be atomic from the perspective of // an outside observer. That is, either the new value will be completely // written and returned for all future queries, or, if we reboot/loose power/ // run into an error, then we will continue to return the previous...
/* * 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 (Tuple *) (((uint8_t *)iter->cursor) + sizeof(Tuple) + length); }
static DictionaryResult dict_write_data_internal(DictionaryIterator *iter, const uint32_t key, const uint8_t * const data, const uint16_t data_length, const TupleType type) { if (iter == NULL || iter->dictionary == NULL || iter->cursor == NULL) { return DICT_INVALID_ARGS; } if (iter->cursor == i...
t_disturb_set_manually_enabled(!do_not_disturb_is_active()); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Helper Functions static void prv_assert_settings_value(const void *key, size_t key_len, const void *expected_valu...
do_not_disturb_set_schedule_enabled(WeekdaySchedule, true)
; return rv; } bool app_db_exists_install_id(AppInstallId app_id) { status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return rv; } bool exists = settings_file_exists(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId)); prv_close_f...
prv_close_file_and_unlock_mutex()
; return rv; } status_t app_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_len) { status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return rv; } PBL_ASSERTN(key_len == 16); AppInstallId app_id = prv_find_install_id_for_uuid(&s_app_db.settings_file, (Uuid *)key);...
void *context) { AlarmDetailData *data = (AlarmDetailData *) context; alarm_delete(data->alarm_id); if (data->alarm_editor_callback) { data->alarm_editor_callback(DELETED, data->alarm_id, data->callback_context); } } static ActionMenuLevel *prv_create_main_menu(void) { ...
("1 hour")
}; unsigned current_snooze_delay = alarm_get_snooze_delay(); for (int i = 0; i < NUM_SNOOZE_MENU_ITEMS; i++) { snooze_level->items[i] = (ActionMenuItem) { .label = i18n_get(snooze_delay_strs[i], data), .perform_action = prv_edit_snooze_delay, .action_data = (void *) (uintptr_t) snooze_dela...
/* * 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...
pfs_open(filename, options->op_flags, options->filetype, options->start_size)
; return fd; } static int prv_fd_from_context(void *context) { return (uintptr_t)context; } static int pfs_domain_read(uint8_t *buf, uint32_t address, uint32_t length, void *context) { int fd = prv_fd_from_context(context); pfs_seek(fd, address, FSeekSet); return pfs_read(fd, buf, length); } static int pfs...
ata->option_menu, use_icons /* icons_enabled */); option_menu_set_choice(&data->option_menu, prv_get_chosen_row_index(data)); option_menu_reload_data(&data->option_menu); } // Settings Menu callbacks /////////////////////////// static void prv_select_cb(OptionMenu *option_menu, int row, void *context) { Settin...
(data->data_source, row - 1)
; title = node->name; } option_menu_system_draw_row(option_menu, ctx, cell_layer, text_frame, title, false, NULL); } static uint16_t prv_row_height_cb(OptionMenu *option_menu, uint16_t row, bool is_selected, void *context) { const int16_t cell_height = option_menu_def...
on *spawn = animation_spawn_create(b, c, NULL); cl_assert(spawn != NULL); // Create a sequence by putting a in front and repeat it 5 times // We now have a -> (b | c) Animation *seq = animation_sequence_create(a, spawn, NULL); animation_set_play_count(seq, repeat_count); // Now, clone it Animation *clo...
(&s_stopped_handler_calls, a0)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a1), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a1), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a2), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls,...
or, GColor back_color, GTextAlignment text_align, GTextOverflowMode overflow_mode) { PBL_ASSERTN(text_layer); *text_layer = (TextLayer){}; text_layer->layer.frame = *frame; text_layer->layer.bounds = (GRect){{0, 0}, frame->size}; text_layer->layer.update_proc = (LayerUpdat...
(LOG_LEVEL_DEBUG, "Init layout")
; graphics_text_layout_cache_init(&text_layer->layout_cache); } else { graphics_text_layout_cache_deinit(&text_layer->layout_cache); text_layer->layout_cache = NULL; } } GSize text_layer_get_content_size(GContext* ctx, TextLayer *text_layer) { PBL_ASSERTN(text_layer); if (!text_layer->should_cache_...
} } else if (shape == SQUARE) { // Move the square X per Y data->square.origin.x += (data->square_velocity_x * PIXEL_SPEED_PER_FRAME); if (data->square.origin.x < 0 || data->square.origin.x + data->square.size.w > data->window.layer.bounds.size.w) { data->square_velocity_x = d...
(data->bucket, data->bucket_offset)
; } } } static void draw_shape(GContext* ctx, AppData *data, DrawShape shape, GColor color) { graphics_context_set_fill_color(ctx, color); graphics_context_set_stroke_color(ctx, color); if (data->fill) { if (shape == POINT) { graphics_draw_pixel(ctx, data->point_p0); } else if (shape == LINE)...
ateway(BT_BONDING_ID_INVALID); } } } static void prv_call_common_bonding_change_handlers(BTBondingID bonding, BtPersistBondingOp op) { bt_pairability_update_due_to_bonding_change(); } typedef struct { unsigned int count; BtPersistBondingType type; } PairingCountItrData; static bool prv_get_num_pairings_b...
(LOG_LEVEL_ERROR, "Failed to store pinned address")
; } else if (rv == GapBondingFileSetUpdated) { shared_prf_storage_set_ble_pinned_address(addr); } return success; } BTBondingID bt_persistent_storage_store_ble_pairing(const SMPairingInfo *new_pairing_info, bool is_gateway, const char *device_name, ...
der the License. */ #include "mag3110.h" #include "board/board.h" #include "console/prompt.h" #include "drivers/exti.h" #include "drivers/gpio.h" #include "drivers/i2c.h" #include "drivers/mag.h" #include "drivers/periph_config.h" #include "kernel/events.h" #include "system/logging.h" #include "os/mutex.h" #include ...
(I2C_MAG3110)
; exti_disable(BOARD_CONFIG_MAG.mag_int); } mutex_unlock(s_mag_mutex); } // aligns magnetometer data with the coordinate system we have adopted // for the watch static int16_t align_coord_system(int axis, uint8_t *raw_data) { int offset = 2 * BOARD_CONFIG_MAG.mag_config.axes_offsets[axis]; bool do_invert ...
ndler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 0); // Should have been deleted automatically cl_assert_equal_i(prv_count_animations(), 0); #endif } // -------------------------------...
(prv_count_handler_entries(&s_stopped_handler_calls, a), 1)
; cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1)...
sectors(void) { // write 0's to the entire flash static uint8_t buf[2048] = { 0 }; char status[80]; __disable_irq(); for (int i = 0; i < 2; i++) { for (uint32_t addr = 0; addr < BOARD_NOR_FLASH_SIZE; addr += sizeof(buf)) { if (addr >= FLASH_REGION_SAFE_FIRMWARE_BEGIN && addr < FLASH_REG...
for (int i = 0; i < 100; i++) { snprintf(name, sizeof(name), "litter%d", i); int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 300); if (i % 5 == 0) { pfs_close_and_remove(fd); } else { pfs_close(fd); } }
{ -1096, 576, -88}, { -1072, 496, -16}, { -1128, 344, 80}, { -808, 264, 80}, { -520, 184, -16}, { -496, 256, -32}, { -552, 216, 64}, { -600, 176, 136}, { -680, 208, 152}, { -736, 280, 168}, { -792, 328, 120}, { -1008, 368, 104}, { -1048, 352, 104}, { -1080, 384, ...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-05 15:49:08 local AccelRawData *activity_sample_walk_100_pbl_25655_5(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25655_5 //> TEST...
/* * 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 (!(sys_resource_load_range(app_num, resource_id, 0, (uint8_t*)&data_signature, sizeof(data_signature)) == sizeof(data_signature) && (ntohl(data_signature) == expected_signature))) { return false; }
// Data is the second entry after the resource signature if (data_size) { size_t output_data_size = sys_resource_size(app_num, resource_id) - VIBE_DATA_OFFSET; *data_size = output_data_size; } return true; } bool vibe_score_validate(VibeScore *score, uint32_t data_size) { if (!score) { return f...
(s_kalg_state, now, samples[i].steps, 7000 /*vmc*/, 0 /*orientation*/, true /*plugged_in*/, samples[i].resting_calories, samples[i].active_calories, samples[i].distance_mm, false /* shutting_down */, prv_activity_session_callback, NULL)
; now += SECONDS_PER_MINUTE; rtc_set_time(now); } } // --------------------------------------------------------------------------------------- // Test that we correectly recognize walk and run activities void test_kraepelin_algorithm__walks_and_runs(void) { const int k_minute_data_len = 60; const int k_m...
/* * 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...
get_timezone_abbr()
/* * 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_hrs, sensor_location, &s_callbacks, start_hdl)
; PBL_ASSERTN(start_hdl == s_hrs.svc.start_h); } void hrm_service_handle_measurement(const BleHrmServiceMeasurement *measurement, const BTDeviceInternal *permitted_devices, size_t num_permitted_devices) { const hrs_measurement_t hrs_measuremen...
/* * 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...
{ static AccelRawData samples[] = { { -42, -52, -1027}, { -43, -29, -1054}, { -76, 12, -975}, { -72, -17, -906}, { -64, -40, -892}, { -81, -37, -933}, { -77, -15, -1008}, { -83, 0, -1041}, { -81, -27, -1029}, { -80, -57, -993}, { -97, -27, -973}, { -119, -21, -991}, ...
} else if (strcmp(token, "TEST_WEIGHT") == 0) { sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight); } else if (strcmp(token, "TEST_NAME") == 0) { sscanf(token + strlen(token) + 1, "%s", state->test_entry.name); } } // If this is a "static AlgDlsMinuteData sample...
(&state->common)
) { return false; } } // Parse next set of samples in the current file bool success = prv_parse_accel_samples_file(state); if (success) { *entry = state->test_entry; return true; } else { // No more in this file fclose(state->common.file); state->common.f...
tion_menu, const ActionMenuItem *action_menu_item, void *context) { prv_mute_notification(action_menu_item, MuteBitfield_Always); } static void prv_mute_notification_weekdays(ActionMenu *action_menu, ...
prv_should_show_action_in_action_menu(window_data, item, action)
&& action != dismiss_action) { timeline_actions_add_action_to_root_level(action, root_level); } } if (has_ancs_mute_action) { const char *app_id = attribute_get_string(&item->attr_list, AttributeIdiOSAppIdentifier, ""); iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_prefs((uint8_t *)a...
sition++; } static void prv_filter_format(TemplateStringState *state) { bool match; bool previously_matched = false; bool did_output = false; // We need to iterate all the way through for finding the proper 'next' time. while (*state->position != ')') { match = prv_format_predicate(state, previously_mat...
{ state->position++; continue; }
else if (*state->position == '}') { continue; } else { state->error->status = TemplateStringErrorStatus_MissingClosingBrace; return; } } // Must end on a closing brace. if (*state->position != '}') { state->error->status = TemplateStringErrorStatus_MissingClosingBrace; return; ...
-560, 240, 88}, { -576, 248, 80}, { -744, 272, 88}, { -1048, 272, 120}, { -1144, 288, 120}, { -1240, 272, 32}, { -1376, 416, -32}, { -960, 560, -240}, { -816, 512, -296}, { -768, 440, -224}, { -648, 280, -112}, { -520, 312, -184}, { -504, 216, -136}, { -456, 184, -120...
{ -976, 400, -128}, { -1248, 376, -8}, { -1504, 424, -72}, { -1368, 536, -152}, { -1048, 504, -56}, { -1136, 544, -152}, { -880, 416, -56}, // 63 seconds { -648, 400, -96}, { -456, 400, -152}, { -440, 344, -72}, { -464, 256, 8}, { -536, 240, 40}, { -624, 280, 40},...
{ -1056, 448, -56}, { -752, 320, 32}, { -520, 376, -56}, { -480, 400, -80}, { -496, 280, 16}, { -568, 264, 40}, { -600, 272, 80}, { -640, 296, 96}, { -760, 320, 88}, { -1008, 336, 88}, { -976, 352, 32}, { -1304, 360, -40}, { -1352, 392, -16}, { -1008, 440, -288},...
ample(&data); } bmi160_end_burst(); BMI160_DBG("%d bytes remain", prv_get_current_fifo_length_and_timestamp(&last_frame_time)); if (was_low_power) { bmi160_set_accel_power_mode(BMI160_Accel_Mode_Low); } } static void prv_handle_data(void) { s_accel_outstanding_data_work = false; // if the task dra...
prv_run_command(BMI160_CMD_SOFTRESET)
d; uint32_t session_id; uint32_t num_samples; uint32_t seconds; // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending();...
(10 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake)
; } // 30 minute "morning walk" 4 hours later at 2:30am prv_feed_cannned_accel_data(30 * SECONDS_PER_MINUTE, 50, ActivitySleepStateAwake); activity_get_metric(ActivityMetricSleepState, 1, &value); cl_assert_equal_i(value, ActivitySleepStateAwake); // Assert that we got the same sleep sessions using the ac...
storage_store_bt_classic_pairing_data( BTDeviceAddress *addr, const char *device_name, SM128BitKey *link_key, uint8_t platform_bits) { if (link_key) { // New pairing BTClassicPairingData data; prv_load_bt_classic_pairing_data(&data, addr, device_name, link_key, platform_bits); prv_update_and_...
{ prv_shared_prf_storage_store_ble_pairing_data(&data->ble_data); }
memset(&s_pending_bondings, 0x00, sizeof(s_pending_bondings)); } prv_unlock_pending_bonding(); } static void prv_async_shared_prf_update_timer_cb(void *data) { system_task_add_callback(prv_system_task_prf_update_cb, NULL); prv_lock_pending_bonding(); { regular_timer_remove_callback(&s_shared_prf_w...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(strtol(" 500", NULL, 10), 500)
; cl_assert_equal_i(strtol(" 765", NULL, 10), 765); cl_assert_equal_i(strtol(" 573888", NULL, 10), 573888); cl_assert_equal_i(strtol(" 713713", NULL, 10), 713713); } void test_strtol__suffix(void) { cl_assert_equal_i(strtol("500hurf", NULL, 10), 500); cl_assert_equal_i(strtol("765berse...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ kino_layer_play_section(&layout->icon_layer, start, duration); }
} static void prv_pin_to_card_second_half_stopped(KinoLayer *layer, bool finished, void *context) { TimelineLayout *layout = context; KinoReel *new_reel = kino_reel_create_with_resource_system(layout->icon_res_info.res_app_num, layout->icon_res_info.res...
e License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distri...
(heading->secondary_value, buffer_len, health_data_current_distance_meters_get(health_data))
; HealthDetailSubtitle *subtitle = &card_data->subtitles[card_data->num_subtitles++]; *subtitle = (HealthDetailSubtitle) { .label = app_zalloc_check(buffer_len), .fill_color = PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack), }; prv_set_avg(subtitle->label, buffer_len, card_data->daily_avg, card_data); ...
if (s_session.id == AUDIO_ENDPOINT_SESSION_INVALID_ID) { return; // Party's over }
AudioEndpointSetupCompleteCallback cb = NULL; AudioEndpointSessionId id = AUDIO_ENDPOINT_SESSION_INVALID_ID; bt_lock(); // We're repeatedly calling comm_session_set_responsiveness_ext, but we only need to call the // completed handler the first time the requested responsiveness takes effect: if (s_sessio...
{ if (prv_is_selection_last_weekday(graph_card)) { // The graph starts on Monday, so wrap around the selection and current_day for Sunday const time_t selection_time = ((positive_modulo(graph_card->selection - Monday, DAYS_PER_WEEK) - positive_modulo(graph_card->current_day - Monday, DAYS_P...
(PBL_IF_RECT_ELSE(FONT_KEY_GOTHIC_24_BOLD, FONT_KEY_GOTHIC_18_BOLD))
; graph_card->legend_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD); graph_card->current_day = prv_get_weekday(graph_card->data_timestamp); // The day characters in standard tm weekday order graph_card->day_chars = i18n_get("SMTWTFS", graph_card); graph_card->selection = HealthGraphIndex_Aver...
----------------------------------------------------------------------------------- // Test a sequence animation with a component that has a play count of 0 void test_animation__sequence_with_0_component(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 500; const int play_cou...
(spawn, true, true)
, play_count_spawn * duration_a); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(spawn); // Start A prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entrie...
not been reached. uint8_t min_interval_minutes; //! The maximum interval between two "poll services" requests. //! The automatic sending of poll requests will only occur when max_interval_minutes is reached. uint8_t max_interval_minutes; uint8_t counted_minutes; //!< Number of minutes passed since the last...
(&s_poll_timer)
; } void poll_remote_set_intervals(PollRemoteService service, const uint8_t min_interval_minutes, const uint8_t max_interval_minutes) { set_intervals(&s_poll_remote_contexts[service], min_interval_minutes, max_interval_minutes); (max_interval_minutes == 0) ? poll_remote_stop() : poll_remote_start(); }
cell_layer, MenuCellSpan *cursor, GContext* ctx) { if (cursor->h == 0) { // cell has height 0, no need to draw anything. return; } cell_layer->bounds.size.h = cursor->h; cell_layer->frame.size.h = cursor->h; cell_layer->frame.origin.y = cursor->y; // Save current drawing state: GDrawState pr...
(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx)
; // Draw the separator on top of the cell if (top_diff >= it->it.cursor.sep) { prv_menu_layer_draw_separator(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx); } // Update the cache with the center-most row it->it.cursor.y = iter_y; if (false == it->cache_set) { it->new_c...
ain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License ...
memcpy(contact, s_contact_1, sizeof(s_contact_1))
; cl_assert_equal_i(contacts_db_insert((uint8_t *)&contact, UUID_SIZE, (uint8_t *)&contact, sizeof(contact)), 0); cl_assert_equal_i(contacts_db_delete((uint8_t *)&contact, UUID_SIZE), 0); cl_assert_equal_i(contacts_db_get_len((uint8_t *)&contact, UUID_SIZE), 0); } void test_contacts_db__flush(void) { uint8_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...
bt_conn_dialog_init(bt_dialog, NULL, 0)
>icon_skip_forward, animated); action_bar_layer_set_icon_animated(&data->action_bar, BUTTON_BACKWARD, &data->icon_skip_backward, animated); if (music_get_playback_state() == MusicPlayStatePaused) { action_bar_layer_set_icon_animated(&data->action_bar, BUTTON_ID_SELECT, &data...
app_timer_register(VOLUME_REPEAT_INTERVAL_MS, prv_handle_volume_repeat, data)
; prv_change_volume(data->volume_is_up); prv_do_haptic_feedback_vibe(context); } static void prv_volume_long_click_start_handler(ClickRecognizerRef recognizer, void *context) { const bool volume_is_up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP); prv_change_volume(volume_is_up); prv_set_act...
ox.size.w; line.height_px = text_box_params.box.size.h; cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_i...
line_reset(&line, utf8_bounds.start)
; cl_assert(line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 3); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == 'a'); // ani- cl_assert(*word_iter_state.current.start == 'a'); cl_as...
[1]); // Add priority 3 opaque window 0 cl_assert(NumModalPriorities > 3); window_stack_push(window_stacks[3], windows[3][0], false); // An opaque top window of a different stack is now obstructing the transparent top window // Top here throughout means that it is the top window of the window stack it is in...
modal_manager_get_properties()
, ModalProperty_Transparent | ModalProperty_Unfocused); // Add priority 2 opaque window 0 cl_assert(NumModalPriorities > 2); window_stack_push(window_stacks[2], windows[2][0], false); // Add priority 2 unfocusable window 1 window_set_focusable(windows[2][1], false); window_stack_push(w...
/* * 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...
{ OS_TASK task = DialogTaskList[i]; if (task != 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Task %s stack has %d bytes free", pcTaskGetTaskName(task), ((int)uxTaskGetStackHighWaterMark(task) * sizeof(StackType_t))); } }
} DialogTask task_get_dialogtask(void) { if (mcu_state_is_isr()) { return DialogTask_ISR; } return task_to_dialogtask(xTaskGetCurrentTaskHandle()); } void task_unregister_task(OS_TASK task) { DialogTask index = task_to_dialogtask(task); if (index >= DialogTask_Last) { return; } DialogTaskList[i...
int len = vsnprintf(buffer, buffer_len, fmt, fmt_args); va_end(fmt_args); return (len); } static char *get_expected_msg(void) { cl_assert(s_msg.msg_arr != NULL); cl_assert(s_msg.curr_msg_idx < s_msg.num_items); char *expected_msg = NULL; if (s_msg.num_processed != 0) { expected_msg = s_msg.msg_arr[s_m...
generate_unique_logs(space_avail, log_len, &num_logs)
; setup_and_test_expected_msg(logs, 0, 0, num_logs); free_logs(logs, num_logs); } } //! void test_flash_logging__wrap(void) { flash_logging_init(); uint32_t tot_size, erase_size, page_size, page_hdr_size; test_flash_logging_get_info(&tot_size, &erase_size, &page_size, &page_hdr_size); int nu...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(pm_mode_extended_sleep)
; } // Note: Once called, sleep mode will be disabled void power_inhibit_sleep(void) { pm_set_sleep_mode(pm_mode_idle); } void power_enter_hibernation(void) { // Just this call alone goes a long way, because it will cause the system to enter hibernation // as soon as there are no more runnable tasks. pm_set_s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bt_driver_classic_copy_connected_device_name(name)
; if (!connected) { // Try LE: GAPLEConnection *connection = gap_le_connection_any(); if (connection) { const char *device_name = connection->device_name ?: "<Unknown>"; strncpy(name, device_name, BT_DEVICE_NAME_BUFFER_SIZE); name[BT_DEVICE_NAME_BUFFER_SIZE - 1] = '\0'; connected =...
ngth // Attribute text: 'D', 'i', 's', 'm', 'i', 's', 's', }; static uint8_t attr_list2_serialized[] = { 0x01, // Attribute 1 ID - Title 0x04, 0x00, // Attribute 1 Length // Attribute text: 'L', 'i', 'k', 'e', 0x07, // Attribute 2 ID...
{ AttributeList list = {0}; attribute_list_add_cstring(&list, AttributeIdTitle, "Title"); attribute_list_add_cstring(&list, AttributeIdSubtitle, "Subtitle"); attribute_list_add_cstring(&list, AttributeIdBody, "Body"); // title + subtitle + body + 3 * (attributeid + pointer) size_t size_list = attribute_lis...
static void prv_check_app_glance_subtitle_in_attribute_list_deserializes( const uint8_t *serialized_attribute_list_to_deserialize, size_t serialized_attribute_list_to_deserialize_size, uint8_t num_attributes, const char *expected_app_glance_subtitle_after_deserializing) { // Get the buffer size needed ...
/* * 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...
ARRAY_LENGTH(s_tests)
; } static void prv_draw_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callback_context) { PBL_ASSERTN(cell_index->row < ARRAY_LENGTH(s_tests)); menu_cell_title_draw(ctx, cell_layer, s_tests[cell_index->row]->name); } static void prv_click_handler(struct MenuLay...
(app_install_id_from_app_db(cur_worker_id)))) { PBL_LOG(LOG_LEVEL_DEBUG, "close and delay callbacks for worker closing"); s_install_callback_data.callback_paused_for_worker = true; s_pending_worker_deletion = cur_worker_id; worker_manager_handle_remove_current_worker(); ...
PBL_LOG(LOG_LEVEL_DEBUG, "app_install_invoke_callbacks"); app_install_invoke_callbacks(s_install_callback_data.install_type, s_install_callback_data.install_id); bool app_upgrade = false; switch (s_install_callback_data.install_type) { case APP_UPGRADED: app_upgrade ...
ificationActionResult *action_result = e->sys_notification.action_result; if (action_result == NULL || (data->response.ignore_failures && action_result->type != ActionResultTypeSuccess)) { const bool success = false; prv_cleanup_action_result(data, success); return; } char uuid_string[UUID_STR...
prv_subscribe_to_action_results_and_timeouts(data, ignore_failures)
; if (action_menu) { TimelineActionMenu *timeline_action_menu = action_menu_get_context(action_menu); prv_set_action_result(timeline_action_menu, data); action_menu_freeze(action_menu); } // perform the action switch (action->type) { case TimelineItemActionTypeAncsGeneric: case TimelineIt...
/* * 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...
(0, prv_redraw_timer_cb, data)
; } // The profiler functions are in the exported symbols table but not in the header // because we aren't quite ready to expose them to 3rd party developers extern void __profiler_init(void); extern void __profiler_print_stats(void); extern void __profiler_start(void); extern void __profiler_stop(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...
app_free(data)
; accel_tap_service_unsubscribe(); connection_service_unsubscribe(); } static void handle_init(void) { EventServiceAppData *data = app_malloc_check(sizeof(EventServiceAppData)); memset(data, 0, sizeof(EventServiceAppData)); app_state_set_user_data(data); // Init window window_init(&data->window, "Event...
504, -104, 208}, { -1448, 264, -144}, { -1488, 240, -248}, { -1632, 152, -272}, { -1608, 400, -216}, { -1280, 440, 160}, { -944, 744, 112}, { -880, 192, 0}, { -1024, 320, 56}, { -864, 376, 72}, { -936, 432, 120}, { -984, 600, 336}, { -1304, 544, 56}, { -1424, 384, 32}...
{ -1232, -128, -112}, { -1104, 88, -152}, { -888, 224, -104}, { -864, 328, -112}, { -976, 344, -136}, { -952, 288, -120}, { -1208, 400, -200}, { -1296, 712, -152}, { -1328, 192, -168}, { -1688, 280, -192}, // 62 seconds { -1272, 384, -296}, { -1096, 384, -256}, { ...
ompiled_with_legacy2_sdk()); GColor *palette = NULL; uint8_t palette_size = gbitmap_get_palette_size(format); if (palette_size > 0) { palette = applib_zalloc(palette_size * sizeof(GColor)); } return palette; } #define BITMAP_FORMAT_IS_CIRCULAR_FULL_SCREEN(size, format) \ ((format) == GBitmapFormat8BitC...
gbitmap_set_palette(bitmap, palette, free_on_destroy)
; } return bitmap; } // Adapted from http://aggregate.org/MAGIC/#Bit%20Reversal T_STATIC uint8_t prv_byte_reverse(uint8_t b) { b = (b & 0xaa) >> 1 | (b & 0x55) << 1; b = (b & 0xcc) >> 2 | (b & 0x33) << 2; b = (b & 0xf0) >> 4 | (b & 0x0f) << 4; return b; } GBitmap* gbitmap_create_palettized_from_1bit(cons...
/* * 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...
(bus->spi, bus->state->spi_clock_periph)
; } void prv_spi_disable_peripheral_clock(const SPIBus *bus) { periph_config_disable(bus->spi, bus->state->spi_clock_periph); } static void prv_spi_clear_flags(const SPIBus *bus) { prv_spi_receive_data(bus); prv_spi_get_flag_status(bus, (SpiI2sFlag)0); } static void prv_spi_dma_cmd(const SPIBus *bus, SpiI2sDma...
drawing on all cols creates checkerboard pattern setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TES...
{ graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); }
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_checkerboard_no_clip"))); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { gr...
/* * 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...
malloc(sizeof(FrameBuffer))
/* * 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, false)
; // animate the pop by using the new top most window Window *other_window = app_window_stack_get_top_window(); layer_add_child(&other_window->layer, &pin_window->layer); // animate the card layout to the right GPoint to_origin = { pin_window->layer.bounds.size.w, 0 }; Animation *animation = prv_create_bo...
HealthCardView *health_card_view = animation_get_context(animation); const AnimationProgress bounce_back_length = (interpolate_moook_out_duration() * ANIMATION_NORMALIZED_MAX) / interpolate_moook_soft_duration(NUM_MID_FRAMES); if (normalized >= ANIMATION_NORMALIZED_MAX - bounce_back_length) { pr...
if (next_card_index < 0) { // Exit app_window_stack_pop_all(true); } else if (next_card_index >= CardCount) { // Top of the list (no-op) // TODO: maybe we want an animation? return; } else { // animate the cards' positions prv_schedule_slide_animation(health_card_view, next_card_index, s...
, 4); cl_assert(memcmp(out_buffer, "1234", 4) == 0); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(shared_circular_buffer_consume(&buffer, &client, 4)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 6); // Now there's just 56 in the...
(&buffer, &client1, 2)
_state.dma_semaphore); } void DMA2_Stream0_IRQHandler(void) { if (DMA_GetITStatus(FLASH_DMA_STREAM, DMA_IT_TCIF3)) { DMA_ClearITPendingBit(FLASH_DMA_STREAM, DMA_IT_TCIF3); NVIC_DisableIRQ(FLASH_DMA_IRQn); signed portBASE_TYPE was_higher_priority_task_woken = pdFALSE; xSemaphoreGiveFromISR(s_flash_sta...
{ return (s_flash_state.enabled); }
void flash_init(void) { if (s_flash_state.mutex != 0) { return; // Already initialized. } s_flash_state.mutex = mutex_create(); vSemaphoreCreateBinary(s_flash_state.dma_semaphore); flash_lock(); enable_flash_spi_clock(); flash_start(); s_flash_state.enabled = true; s_flash_state.sleep_when_i...
DEAD - i + (i << 16); char buf[20]; snprintf(buf, sizeof(buf), "%x", uniq_msg_id); for (int j = 0; j < log_len; j += strlen(buf)) { memcpy(&msg[j], buf, MIN(strlen(buf), log_len - j)); } msg[log_len] = '\0'; msg_arr[i] = task_strdup(msg); } return (msg_arr); } static void free_log...
(LOG_LEVEL_DEBUG, "flash_log_line_dump_long_lived: got %s", buf)
; int curr_val; int filled = sscanf(buf, "Loop Counter %d", &curr_val); cl_assert_equal_i(filled, 1); if (s_long_lived_last_val != -1) { cl_assert_equal_i(s_long_lived_last_val + 1, curr_val); } s_long_lived_last_val = curr_val; PBL_LOG(LOG_LEVEL_DEBUG, "flash_log_line_dump_long_lived: got %s, last...
t_animation_schedule, 3); cl_assert_equal_i(s_count_compositor_init_func_a, 1); cl_assert_equal_i(s_count_compositor_init_func_b, 2); } void test_compositor__app_render_busy(void) { // Set the display as busy and then render the app. Nothing should update. s_display_update_in_progress = true; compositor_app_...
cl_assert_equal_i(s_app_window_render_count, 2)
taSource *source; InstallEventType event_type; } InstallData; void prv_alert_data_source_changed(AppMenuDataSource *data_source) { if (data_source->callbacks.changed) { data_source->callbacks.changed(data_source->callback_context); } } static void prv_do_app_added(AppMenuDataSource *source, AppInstallId ins...
(iter->install_id)
) { prv_unload_node(source, iter); } iter = temp; } prv_alert_data_source_changed(source); } static void prv_app_db_cleared_callback(const AppInstallId install_id, void *data) { // data is just a pointer to the AppMenuDataSource prv_send_callback_to_app((AppMenuDataSource *)data, INSTALL_ID_INVA...