prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
} static void prv_window_disapper(Window *window) { } void prv_syncing_content_offset_changed(struct ScrollLayer *scroll_layer, void *context) { AppData *data = app_state_get_user_data(); data->prv_orig_content_offset_changed(scroll_layer, context); GPoint offset = scroll_layer_get_content_offset(scroll_layer...
app_window_stack_push(window, true)
; PROFILER_INIT; PROFILER_START; app_event_loop(); } const PebbleProcessMd* fps_test_get_app_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = s_main, .name = "FPS Test" }; return (const PebbleProcessMd*) &s_app_info; }
fake_comm_session_open_call_count()
, 0); } void test_ppogatt__open_session_when_found_pebble_app(void) { prv_discover_and_read_meta_and_reset(); // Simulate getting "Reset Complete" from remote: prv_receive_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]); // Expect "Reset Complete" to be sent by FW: prv_assert_sent_reset_com...
unter = (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_THREE) << 2) | (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_TWO) << 1) | boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_ONE); if (counter == 7) { boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_c...
button_get_state_bits()
& ~SELECT_BUTTON_MASK; while (1) { // See if we should restart uint8_t button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK; if (button_state != prev_button_state) { system_reset(); } delay_ms(10); } } static void check_and_handle_resuming_from_standby(void) { periph_config_ena...
prv_prepare_canvas_and_render_emoji(RESOURCE_ID_GOTHIC_28_EMOJI)
; cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); }
est_rect), dest_row_info.max_x + 1); if (dest_end_x < dest_begin_x) { continue; } const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y); const uint8_t *src = src_row_info.data; // This is the initial position that takes into account destination delta shift c...
{ case GCompOpAssign: case GCompOpAssignInverted: case GCompOpAnd: case GCompOpOr: case GCompOpClear: { for (int16_t dest_y = dest_begin_y; dest_y < dest_end_y; ++dest_y, ++src_y) { // Wrap-around source bitmap vertically if (src_y >= src_end_y) { src_y = src_begin_y;...
// Check if content should wrap (under and over) for tiling if (!WITHIN(src_x, src_bitmap->bounds.origin.x, grect_get_max_x(&src_bitmap->bounds) - 1)) { // keep correct bounds alignment for circular when tiling src_x = src_bitmap->bounds.origi...
; } extern ANCSClientState prv_get_state(void); extern void prv_check_ancs_alive(void); void test_ancs__alive_check_disconnection(void) { prv_check_ancs_alive(); // check we're in the alive check state and we sent a single request cl_assert_equal_i(prv_get_state(), ANCSClientStateAliveCheck); cl_assert_equal...
(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT)
; // Make sure that losing BT altogether sends the event ancs_destroy(); cl_assert_equal_i(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT); fake_event_clear_last(); } void test_ancs__unrequested_notifications(void) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_complete_dict), (uint8_t*) s_...
blocking(QSPIFlash *dev, uint32_t addr, void *buffer, uint32_t length) { // TODO: Figure out what thresholds we should use when switching between memory mapping, DMA, & // polling PBL-37438 bool should_use_dma = length > 128 && !dev->state->coredump_mode; bool should_use_memmap = length > 128; #if QSPI_DMA_DIS...
{ result = false; break; }
} // stop memory mapped mode qspi_mmap_stop(QSPI); return result; } status_t qspi_flash_blank_check(QSPIFlash *dev, uint32_t addr, bool is_subsector) { qspi_use(dev->qspi); #if TARGET_QEMU // QEMU doesn't support memory-mapping the FLASH const bool result = prv_blank_check_poll(dev, addr, is_subsector);...
ut_us > 0) { if (gpio_input_read(&creset_input) == level) return true; delay_us(100); timeout_us -= 100; } return false; } static bool prv_wait_programmed(void) { // The datasheet lists the typical NVCM configuration time as 56 ms. // Something is wrong if it takes more than twice that time. int ...
set_4V5_power_state(true)
; } void display_power_disable(void) { PBL_LOG(LOG_LEVEL_DEBUG, "Disabling 4v5 (Display VDDP)"); set_4V5_power_state(false); psleep(2); if (ICE40LP->use_6v6_rail) { PBL_LOG(LOG_LEVEL_DEBUG, "Disabling 6v6 (Display VDDC)"); set_6V6_power_state(false); psleep(2); } } //! //! Starts a frame. //!...
y obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Lic...
settings_file_get(&file, (uint8_t*)&wakeup_id, sizeof(wakeup_id), (uint8_t*)&wakeup_entry_v1, sizeof(wakeup_entry_v1))
); cl_assert_equal_i(wakeup_entry_v1.reason, WAKEUP_REASON); cl_assert_equal_i(wakeup_entry_v1.repeat_hours_missed, 0); cl_assert(!wakeup_entry_v1.repeating); cl_assert(wakeup_entry_v1.notify_if_missed); uuid_equal(&wakeup_entry_v1.uuid, &app_uuid); close_settings_file(&file); // Migrate the timezone an...
deinit_icon(TimelineLayout *layout) { kino_layer_deinit(&layout->icon_layer); } //////////////////////// // Layout Impl //////////////////////// GSize timeline_layout_get_content_size(GContext *ctx, LayoutLayer *layout) { return ((TimelineLayout *)layout)->view_size; } static void prv_update_proc(Layer *layer, G...
(buffer, config->buffer_size, layout->info->pin_time)
; } static void prv_time_word_update(const LayoutLayer *layout_ref, const LayoutNodeTextDynamicConfig *config, char *buffer, bool render) { const TimelineLayout *layout = (TimelineLayout *)layout_ref; clock_get_time_word(buffer, config->buffer_size,...
n_get("%H:%M", i18n_owner) : i18n_get("%l:%M%p", i18n_owner); char time_str_buf[TIME_BUFFER_LENGTH]; strftime(time_str_buf, TIME_BUFFER_LENGTH, format, &time); safe_strcat(out_buf, string_strip_leading_whitespace(time_str_buf), buf_length); } // ------------------------------------------------------------------...
i18n_get(title_i18n, &pin_attr_list)
); char *start_time = kernel_zalloc_check(TIME_STRING_TIME_LENGTH); char *end_time = kernel_zalloc_check(TIME_STRING_TIME_LENGTH); char *time_range = kernel_zalloc_check(max_attr_length); const char *time_range_fmt = i18n_get("%s - %s", &pin_attr_list); /// "10:00AM - 11:00PM" clock_copy_time_string_timestam...
16, 464, -312}, { 1072, 448, -416}, { 1024, 376, -400}, { 1432, 272, -344}, { 1472, 160, -184}, { 1120, 224, -256}, { 864, 280, -320}, { 752, 248, -312}, { 728, 208, -288}, { 704, 176, -280}, { 736, 152, -208}, { 872, 200, -208}, { 1024, 216, -208}, { 1104, 192, -152}...
{ 744, 416, -216}, { 808, 432, -264}, { 904, 448, -312}, { 976, 520, -400}, { 992, 496, -400}, { 1112, 472, -304}, { 1384, 568, -336}, { 1184, 648, -384}, { 1368, 664, -312}, { 1480, 480, -168}, // 72 seconds { 1312, 312, -152}, { 1000, 304, -160}, { 864, 336, -15...
{ 1224, 328, -64}, { 976, 296, -72}, { 800, 320, -104}, { 728, 288, -80}, { 712, 200, -56}, { 704, 208, -80}, { 808, 240, -104}, { 976, 264, -152}, { 1088, 176, -88}, { 1176, 88, -128}, { 1192, 144, -208}, { 1104, 208, -344}, { 1256, 184, -264}, { 1160, 160, -168...
es not exit // a high power state RegularTimerInfo watchdog_cb_info; // current running state of the connection ResponseTimeState curr_requested_state; // A list of consumers who have requested changes to latency state != ResponseTimeMax ConnectionStateRequest *requests; } ConnectionMgrInfo; R...
(watchdog_cb_info)
depoint_is_zero_width(utf8_iter_state->codepoint)) { if (utf8_iter_state->codepoint == 0) { PBL_ASSERTN(utf8_iter_state->current == utf8_iter_state->bounds->end); return false; } if (!iter_next(char_iter)) { break; } } return true; } static bool prv_line_iter_is_vertical_overflo...
{ continue; }
if (codepoint_should_skip(codepoint)) { continue; }; return true; } } bool char_iter_prev(IteratorState state) { CharIterState* char_iter_state = (CharIterState*) state; Codepoint codepoint; Iterator* utf8_iter = &char_iter_state->utf8_iter; Utf8IterState* utf8_iter_state = &char_iter_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...
while (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) { }
} static void prv_quad_enable() { QSPI_ComConfig_InitTypeDef qspi_com_config; QSPI_ComConfig_StructInit(&qspi_com_config); qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write; qspi_com_config.QSPI_ComConfig_IMode = QSPI_ComConfig_IMode_1Line; qspi_com_config.QSPI_ComConfig_Ins = MT25Q...
recognizer_get_user_data(r)
; *destroyed = true; } void test_recognizer__destroy(void) { bool impl_destroyed = false; s_test_impl_data.destroyed = &impl_destroyed; bool sub_destroyed = false; Recognizer *r = test_recognizer_create(&s_test_impl_data, &sub_destroyed); test_recognizer_enable_on_destroy(); recognizer_set_on_destroy(r,...
84}, { 216, -896, -448}, // 15 seconds { 320, -720, -376}, { 384, -784, -256}, { 568, -184, -48}, { -272, 256, -360}, { -464, 648, -440}, { -824, 872, -528}, { -888, 976, -808}, { -704, 1120, -536}, { -704, 1192, -784}, { -496, 1056, -744}, { -568, 1160, -1032}, {...
{ -1296, 64, -16}, { -1104, 240, 96}, { -1016, 368, 152}, { -1184, 456, -16}, { -1296, 488, -32}, { -1264, 664, -64}, { -1256, 1064, -112}, { -1048, 320, -264}, { -1576, 632, -176}, { -1136, 632, -232}, { -1144, 488, -280}, { -1304, 352, -160}, { -1408, 400, -128}, ...
{ -1416, 240, -152}, { -1384, 152, 8}, { -1368, 96, 104}, { -1248, 120, 96}, // 23 seconds { -1048, 0, 104}, { -992, -728, 536}, { -608, -96, -184}, { -1144, -200, -128}, { -1664, 216, -176}, { -1872, 504, -424}, { -1656, 304, -136}, { -1408, 184, -8}, { -1248, 3...
_t)required_free_length, (uint32_t)space_remaining); return false; } return true; } static void prv_send_event_if_needed(AppInboxNode *inbox) { if (!inbox || inbox->has_pending_event) { return; } PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_callback...
{ AppInboxNode *inbox = prv_find_inbox_by_tag_and_log_if_not_found(tag); if (!inbox) { goto unlock; } prv_finish(inbox); }
unlock: prv_unlock(); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Unit Test Interfaces bool app_inbox_service_has_inbox_for_tag(AppInboxServiceTag tag) { bool has_inbox; prv_lock(); has_inbox = (prv_find_inbox_by_tag(tag) != NULL); prv_unlock();...
_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_stroke_width(ctx, 10); graphics...
(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_WIDTH)
; graphics_draw_line(&ctx, START_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, STROKE_WIDTH); graphics_draw_line(&ctx, START_ON_ORIGIN_RECT_XY, ...
} else { for (j = 0; j < (int)_clar_suite_count; ++j) if (strcmp(argument, _clar_suites[j].name) == 0) { clar_run_suite(&_clar_suites[j]); break; } } if (_clar.active_suite == NULL) { clar_print_onabort("No suite matching '%s' found.\n", ar...
longjmp(_clar.trampoline, -1)
; } } void clar__assert_equal_s( const char *s1, const char *s2, const char *file, int line, const char *err, int should_abort) { int match = (s1 == NULL || s2 == NULL) ? (s1 == s2) : (strcmp(s1, s2) == 0); if (!match) { char buf[4096]; snprint_eq(buf, 4096, "'%s' != '%s'", s1, s2); clar...
///////////////////////////////////////////// static Attribute title_attr = { .id = AttributeIdTitle, .cstring = "title", }; static TimelineItem item1 = { .header = { .id = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, .timestamp = 10*60, ...
(!prv_get_calendar_ongoing())
; cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); cl_assert(timeline_remove(&item1.header.id)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 3); cl_assert(!prv_get_calendar_ongoing()); cl_assert(!stub_...
case BUTTON_ID_BACK: uuid = &s_quick_launch_back.uuid; break; case NUM_BUTTONS: break; } PBL_ASSERTN(uuid); return app_install_get_id_for_uuid(uuid); } void quick_launch_set_app(ButtonId button, AppInstallId app_id) { QuickLaunchPreference pref = (QuickLaunchPreference) { .enabled = t...
shell_prefs_set_language_english(!shell_prefs_get_language_english())
; } #if CAPABILITY_HAS_HEALTH_TRACKING static void prv_activity_pref_set(void) { prv_pref_set(PREF_KEY_ACTIVITY_PREFERENCES, &s_activity_preferences, sizeof(s_activity_preferences)); } time_t activity_prefs_get_activation_time(void) { return s_activity_activation_timestamp; } void activity_prefs_s...
_handler) { is_relevant = (*api_ref)->add_handler(event_name, func); if (is_relevant) { break; } } } if (!is_relevant) { APP_LOG(LOG_LEVEL_WARNING, "Unknown event '%s'", event_name); return jerry_create_undefined(); } prv_add_event_listener_to_list((char *)event_name, fun...
{ jerry_value_t event = (jerry_value_t)(uintptr_t) ctx; rocky_global_call_event_handlers(event); jerry_release_value(event); // was acquired in rocky_global_call_event_handlers_async() call }
void rocky_global_call_event_handlers_async(jerry_value_t event) { sys_current_process_schedule_callback(prv_call_event_handlers_async_cb, (void *)(uintptr_t)jerry_acquire_value(event)); } jerry_value_t rocky_global_create_event(const char *type_str) { JS_VAR jerry_type_st...
/* * 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(callback_called)
; cl_assert(flash_locked); } void test_system_flash__handle_erase_error(void) { return_status = FLASH_ERROR_OPERATION; cl_assert(!system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert(flash_locked); } void error_in_middle_cb(uint32_t num, uint32_t den, void *context) { int *countdown = context; i...
{ -1808, 176, 88}, { -1632, 120, 64}, { -1552, 88, 8}, { -1400, 104, 24}, { -1160, 160, -8}, { -1008, 160, -56}, { -1056, 56, -40}, { -864, -392, -48}, { -936, -120, -176}, { -1152, 88, -248}, // 28 seconds { -1176, 168, -424}, { -1360, 240, -376}, { -1416, -120,...
{ -1488, 400, 48}, { -1128, 392, -48}, { -1152, 384, -24}, { -1336, 384, 48}, { -1456, 328, 104}, { -1296, 224, 136}, { -1256, 208, 128}, { -1232, 168, 128}, { -1192, 120, 144}, { -1080, 112, 136}, { -976, 96, 112}, { -968, 104, 120}, { -1072, 120, 144}, { -968, 8...
{ -1616, 184, 136}, { -1368, 112, 136}, { -1160, 32, 88}, { -976, 56, 64}, { -856, 88, 64}, { -784, 120, 80}, { -704, 64, 48}, { -840, 128, 128}, { -952, 96, -40}, // 36 seconds { -1024, -80, -24}, { -1256, 208, -256}, { -1216, 296, -648}, { -1472, -8, -440}, ...
lash. static const uintptr_t FMC_BANK_1_BASE_ADDRESS = 0x60000000; //! This is the unit that we use for writing static const uint32_t PAGE_SIZE_BYTES = 64; //! Different commands we can send to the flash typedef enum S29VSCommand { S29VSCommand_WriteBufferLoad = 0x25, S29VSCommand_BufferToFlash = 0x29, S29VSCo...
(sector_base_addr, S29VSCommand_ReadStatusRegister)
; return flash_s29vs_read_short(sector_base_addr); } static uint8_t prv_poll_for_ready(FlashAddress sector_base_addr) { // TODO: We should probably just assert if this takes too long uint8_t status; while (((status = prv_read_status_register(sector_base_addr)) & S29VSStatusBit_DeviceReady) == 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...
window_do_layer_update_proc(layer, ctx)
; #if CAPABILITY_HAS_SDK_SHELL4 SdkAppData *data = app_state_get_user_data(); const int time_max_y = grect_get_max_y(&data->time_text_layer.layer.frame); const int line_top_margin = 14; const int line_stroke_width = 2; graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &GRect(0, tim...
TimelineLayout *card_timeline_layout) { KinoReel *from_reel = kino_reel_create_with_resource_system( card_timeline_layout->icon_res_info.res_app_num, card_timeline_layout->icon_res_info.res_id); if (!from_reel) { return; } const uint32_t duration = TIMELINE_CARD_TRANSITION...
layer_set_clips(&layout->icon_layer.layer, true)
; } void timeline_layout_transition_card_to_pin(TimelineLayout *card_timeline_layout, TimelineLayout *pin_timeline_layout) { KinoReel *from_reel = kino_reel_create_with_resource_system( card_timeline_layout->icon_res_info.res_app_num, card_timeline_layout->icon...
_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_neg", fb, GColorWhite)); ...
(10, 70, 100, 30)
, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); ctx.draw_state.text_color.a = 0; graphics_draw_text(&ctx, "blue0", &s_font_info, GRect(10, 100, 100, 30), GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap...
.g. 3rd party app vibes title = i18n_noop("System"); const VibeIntensity current_system_default_vibe_intensity = vibe_intensity_get(); subtitle = vibe_intensity_get_string_for_intensity(current_system_default_vibe_intensity); break; } default: { WTF; } } // We need to set...
{ vibes_cancel(); }
static Window *prv_init(void) { SettingsVibePatternsData *data = app_zalloc_check(sizeof(SettingsVibePatternsData)); data->callbacks = (SettingsCallbacks) { .deinit = prv_deinit_cb, .draw_row = prv_draw_row_cb, .selection_changed = prv_selection_changed_cb, .select_click = prv_select_click_cb, ...
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.validated_size will hold the size of the entire serialized //! glance after trimming any s...
pfs_remove(SETTINGS_FILE_NAME)
; mutex_unlock(s_app_glance_db.mutex); return S_SUCCESS; } static status_t prv_validate_glance(const Uuid *app_uuid, const SerializedAppGlanceHeader *serialized_glance, size_t *len) { // Change this block if we support multiple app glance versions in the future // For now report a...
_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state->acquired); PBL_ASSERTN(slave->slave_state->scs_selected == false); slave->slave_state->scs_selected = true; gpio_output_set(&slave->spi_scs, true); // SCS asserted (low) } void spi_ll_slave_scs_deassert(const SPISlavePort *slave) { P...
(slave->slave_state->acquired)
; PBL_ASSERTN(slave->slave_state->dma_state == SPISlavePortDMAState_Idle); slave->slave_state->dma_state = SPISlavePortDMAState_Read; slave->slave_state->dma_complete_handler = handler; slave->slave_state->dma_complete_context = context; prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqRx, true); dma_request_st...
/* * 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...
WRITE_LINE(" r sector %u", logging_session->storage.read_sector)
; WRITE_LINE(" r offset %"PRIu32, logging_session->storage.read_offset); WRITE_LINE(" w sector %u", logging_session->storage.write_sector); WRITE_LINE(" w offset %"PRIu32, logging_session->storage.write_offset); #undef WRITE_LINE } #endif void command_dls_erase_all(void) { dls_clear(); } void command_dls_...
clude "stubs_logging.h" #include "stubs_prompt.h" #include "fake_otp.h" #include <signal.h> extern void command_hwver_write(const char*); extern void command_pcba_serial_write(const char*); // Tests ///////////////////////////////////////////// void test_mfg_serials__initialize(void) { fake_otp_reset(); } void t...
mfg_get_serial_number()
; cl_assert_equal_i(index, 0); cl_assert_equal_i(r, MfgSerialsResultFailIncorrectLength); cl_assert_equal_s(sn, "XXXXXXXXXXXX"); // String too short: const char *short_sn = "ABCDEFGHIJK"; r = mfg_write_serial_number(short_sn, strlen(short_sn), &index); sn = mfg_get_serial_number(); cl_assert_equal_i(in...
eLaunchAppEventExtended) { .common.reason = APP_LAUNCH_WAKEUP, .wakeup.wakeup_id = wakeup_id, .wakeup.wakeup_reason = entry.reason, }; data->common.args = &data->wakeup; PebbleEvent event = { .type = PEBBLE_APP_LAUNCH_EVENT, .launch_app = { .id = app_...
(s_current_timer_id, (time_difference * 1000), prv_wakeup_dispatcher, (void*)((intptr_t)s_wakeup_state.current_wakeup_id), 0)
aw_rect_offset_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 11 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 11); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbi...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_clip_rect_aa_nudge.${BIT_DEPTH_NAME}.pbi"))
d. Boot into recovery mode. dbgserial_putstr("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 sta...
display_init()
; display_boot_splash(); #ifdef DISPLAY_DEMO_LOOP while (1) { for (int i=0; i < 92; ++i) { display_firmware_update_progress(i, 91); delay_us(80000); } for (uint32_t i=0; i <= 0xf; ++i) { display_error_code(i * 0x11111111); delay_us(200000); } for (uint32_t i=0; i < 8; +...
}, /* US (United States) [America/Los_Angeles] Rule US 2007 max - Mar Sun>=8 2:00 1:00 D Rule US 2007 max - Nov Sun>=1 2:00 0 S Mar 8th 2015 10:00 UTC ~ Nov 1st 2015 09:00 UTC, GMT-8 */ [31]={ 1425808800, 1446368400,-8 * SECONDS_PER_HOUR }, /* Uruguay (Uruguay) [Am...
rtc_set_timezone(&tzinfo)
at the trigger time) if (activity_prefs_activity_insights_are_enabled() && (minute_of_day == s_activity_summary_settings.summary.activity.trigger_minute) && s_activity_summary_settings.summary.activity.show_notification) { prv_push_activity_summary_notification(pin_time_utc, steps, total_step...
(pace_str, pace_buf_size, pace_s, false, headings)
; snprintf(pace_str + offset, pace_buf_size - offset, " /%s", prv_get_distance_unit(headings)); string_list_add_string(headings, headings_buf_size, i18n_get("Avg Pace", headings), headings_buf_size); string_list_add_string(values, values_buf_size, pace_str, values_buf_size); } 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...
{ return debug_db_get_logs_base_address(generation) + (chunk * CHUNK_SIZE_BYTES) + offset; }
ed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "timeline_layout_animations.h" #include "applib/graphics/graphics.h...
layer_set_clips(&layer->layer, true)
; if (finished) { // begin the second half of the animation prv_pin_to_card_second_half(timeline_layout, timeline_layout->transition_layout); } timeline_layout->transition_layout = NULL; } void timeline_layout_transition_pin_to_card(TimelineLayout *pin_timeline_layout, ...
if (data->select_index == SelectIndexDirection) { data->up_down_direction = !(data->up_down_direction); } else if (data->select_index == SelectIndexOverflow) { data->word_wrap = !(data->word_wrap); }
} text_layer_set_text_color(&data->direction_layer, GColorBlack); text_layer_set_background_color(&data->direction_layer, GColorWhite); text_layer_set_text_color(&data->word_wrap_layer, GColorBlack); text_layer_set_background_color(&data->word_wrap_layer, GColorWhite); if (data->select_index == SelectInd...
/* * 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_ctl_reset_bluetooth()
16, -1008}, { 48, 24, -1000}, { 48, 24, -1000}, { 40, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 32, -992}, { 48, 16, -1000}, { 48, 32, -992}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, ...
{ 48, 24, -992}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -992}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 40, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 40, 24, ...
{ 48, 24, -1000}, { 48, 24, -992}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 32...
8n_get_with_buffer(const char *string, char *buffer, size_t length) { i18n_get_with_buffer(string, buffer, length); } size_t sys_i18n_get_length(const char *string) { return i18n_get_length(string); } // Tests //////////////////////////////////// // (SU) = Single UNIX Specification extension // (GNU)= glibc ext...
(tmbuf, sizeof(tmbuf), "%Z %%", &jan_2_2015__13_00_00)
; cl_assert_equal_s(tmbuf, "UTC %"); } void test_strftime__return_value(void) { char tmbuf[512]; struct tm jan_2_2015__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 2015 - 1900, .tm_mon = 0, .tm_mday = 2, // 2015/01/02 .tm_wday = 5, .tm_yday = 1, // Friday, 2nd day of ...
ics_event_put_byte_stats( CommSession *session, bool crc_good, uint8_t type, uint32_t bytes_transferred, uint32_t elapsed_time_ms, uint32_t conn_events, uint32_t sync_errors, uint32_t skip_errors, uint32_t other_errors) { bool is_ppogatt = false; uint16_t conn_interval = 0; if (!prv_get_connection_de...
MIN(conn_interval, UINT8_MAX)
, .type = type, .bytes_transferred = bytes_transferred, .elapsed_time_ms = elapsed_time_ms, .conn_events = conn_events, .sync_errors = MIN(sync_errors, UINT16_MAX), .skip_errors = MIN(skip_errors, UINT16_MAX), .other_errors = MIN(other_errors, UINT16_MAX), }, }; ANALYT...
_init(); // Let's use all available RAM for the log buffer! // That is, the difference between s_log_buffer_ram and RETENTION_BLE (__ble_vars_start__). // This will always be at least sizeof(s_log_buffer_ram). uint32_t start_addr = (uint32_t)s_log_buffer_ram; uint32_t end_addr = (uint32_t)&__ble_vars_start__...
if ((str1_len + str2_len) >= MAX_MSG_STR_LEN) { str1_len = MIN(str1_len, MAX_MSG_STR_LEN_HALF); str2_len = MIN(str2_len, MAX_MSG_STR_LEN_HALF); }
if (str1_len) { // length + strlen(string) + padding (round up to nearest uint32_t). msg_size += 1 + str1_len + (3 - (1 + str1_len + 3) % 4); } if (str2_len) { // length + strlen(string) + padding (round up to nearest uint32_t). msg_size += 1 + str2_len + (3 - (1 + str2_len + 3) % ...
d_charging_state; } // ------------------------------------------------------------------------------------------------ // If necessary, change the sampling period of our heart rate subscription // @param[in] now_ts number of seconds the system has been running (from time_get_uptime_seconds()) static void prv_heart_r...
(hrm_event, now_utc, now_uptime_ts)
; // Log it to the mobile protobuf_log_hr_add_sample(s_activity_state.hr.log_session, now_utc, hrm_event->bpm.bpm, hrm_event->bpm.quality); } if (valid_hr_reading || hrm_event->bpm.quality == HRMQuality_OffWrist) { mutex_lock_recursive(s_activity_state.mutex);...
pfs_read(fd, b, sz) == sz); for (int j = 0; j < large_file_size / 4; j++) { uint32_t *val = ((uint32_t *)((uint8_t *)b)) + j; cl_assert(*val == (curr | (curr << 16))); curr++; } cl_assert(pfs_close(fd) == S_SUCCESS); free(b); } } void test_pfs__file_span_regions(void) { pfs_form...
pfs_init(true)
; ftl_force_version(1); // simulate a migration by leaving leaving files in various states // in the first region. Then try to add another region and confirm // none of the files have been corrupted char file_small[10]; char buf[50]; const int erase_count = 3; for (int num_erases = 0; num_erases < era...
((uint8_t)0b11110101)
; s_display_colors[7] = GColorWhite; app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("Shapes")); window_set_user_data(window, data); window_set_fullscreen(window, true); layer_set_update_proc(&window->layer, layer_update_proc); window_set_click_config_p...
p(buf, bufcmp, sizeof(buf)) == 0); cl_assert_equal_i(pfs_close(fd), S_SUCCESS); } } void test_pfs__garbage_collection_when_full(void) { char file_name[10]; int num = 0; int fd; while (1) { snprintf(file_name, sizeof(file_name), "file%d", num++); fd = pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_S...
pfs_close(fd)
; } void test_pfs__write(void) { int rv = pfs_write(-1, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_write(1000000, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_write(0, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); uint8_t buf[10]; int fd = pfs_open("newfile", OP_FLAG_WRITE |...
* 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...
{ for (int i = 0; i < count; i++) { if (uuid_equal(&uuid_list[i], find_me)) { return i; } } return -1; }
// if an entry appears in the UUID list, place it's install_id in the correct index of // storage->id_list bool prv_enumerate_apps(AppInstallEntry *entry, void *data) { UuidTranslateData *my_data = (UuidTranslateData *) data; int idx = prv_uuid_search(&entry->uuid, my_data->uuid_list, my_data->count); if (idx...
RCC->AHB2ENR = 0; RCC->AHB3ENR = 0; RCC->APB1ENR = 0x00000400; // Reserved bit needs to be set to enable RTC! RCC->APB2ENR = 0; // Reset most peripherals used by the bootloader. We want to minimize the // chances that the firmware unintentionally relies on some state that the // bootloader leaves behind...
boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_THREE)
<< 2) | (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_TWO) << 1) | boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_ONE); if (counter == 7) { boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE); return true; }...
v_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); prv_process_and_reset_test_counters(); prv_receive_install(s_last_response_cookie); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__install_message_too_short(void) { prv_receive_init_put_and_commit_fw_object(); const uint8_t incomplete_...
prv_receive_init_fw_object()
; // The timer is overridden by the 30s Put Bytes timeout: cl_assert_equal_i(stub_new_timer_timeout(put_bytes_get_timer_id()), PUT_BYTES_TIMEOUT_MS); fake_event_reset_count(); stub_new_timer_fire(put_bytes_get_timer_id()); fake_system_task_callbacks_invoke_pending(); // Expect only "Cleanup" event: cl_...
{ 0, 0x59, 0, 179}, { 0, 0x59, 0, 180}, { 0, 0x59, 0, 177}, // 1230: Local time: 10:05:00 PM { 0, 0x59, 0, 180}, { 0, 0x59, 0, 180}, { 0, 0x59, 0, 180}, { 0, 0x59, 0, 179}, { 0, 0x59, 0, 177}, { 0, 0x59, 0, 180}, { 0, 0x59, 0, 180}, { 0, 0x59, 0, 180}, { 0, 0x59, 0, 180}...
{ 0, 0x59, 0, 181}, { 0, 0x59, 0, 180}, { 0, 0x59, 0, 180}, { 0, 0x59, 0, 177}, { 0, 0x59, 0, 147}, { 0, 0x59, 0, 147}, { 8, 0x5a, 877, 170}, { 0, 0x87, 5871, 147}, { 0, 0x16, 770, 144}, { 0, 0x16, 0, 147}, { 0, 0x25, 2455, 149}, { 0, 0x54, 0, 126}, { 0, 0x54, 0, 149}...
{ 0, 0x63, 0, 150}, { 0, 0x63, 18, 149}, { 0, 0x63, 803, 149}, { 0, 0x44, 0, 149}, { 0, 0x44, 75, 146}, { 0, 0x44, 0, 149}, { 0, 0x44, 0, 148}, { 0, 0x44, 0, 149}, { 0, 0x44, 0, 149}, { 0, 0x44, 0, 146}, { 0, 0x44, 0, 149}, { 0, 0x44, 0, 149}, { 0, 0x44, 0, 148}, ...
rt(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {6, 5, 4, 2, 3}, 5, &s_recognizers_handled); prv_destroy_recognizers(recognizers, k_rec_count); } bool prv_dispatch_touch_event(Recognizer *recognizer, void *context); void test_recognizer_man...
layer_init(&layer_a, &GRectZero)
; layer_init(&layer_b, &GRectZero); layer_init(&layer_c, &GRectZero); layer_add_child(root, &layer_a); layer_add_child(root, &layer_b); layer_add_child(&layer_a, &layer_c); recognizer_add_to_list(recognizers[0], window_get_recognizer_list(&window)); recognizer_add_to_list(recognizers[1], &layer_a.recogni...
value); return true; } static void prv_test_settings_file_compaction(const bool manual) { // If manual is enabled, then the test will force a compaction every so often // If manual is disabled, then the test will only compact when it is required to do so. SettingsFile file; cl_must_pass(settings_file_open(&...
(&file, key, key_len)
continue; // keep looking } // we have found a page to use, but we need to erase the contents first prv_erase_unit(prv_get_unit_base_address(flash_addr)); } s_curr_state.log_file_id = prv_get_next_log_file_id(prev_log_id); s_curr_state.page_start_addr = flash_addr; new_log_re...
(state->log_start_addr, state->page_index * LOG_PAGE_SIZE)
_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_jja00.${BIT_DEPTH_NAME}.pbi")); // Test when clipping/drawing are at (2, 0) and text bounds is at (0, 0) setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1); ...
(&ctx, "jja", &s_font_info, RECT_NEG_W, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL)
; cl_check(framebuffer_is_empty("draw_text_neg_w", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG_H, GTextOverflowModeTrailingEllipsis, GTextAl...
bbleTask_App); window_stack_push(app_stack, window1, true); cl_assert_equal_i(window_stack_count(app_stack), 1); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to the kernel to push a modal window stub_pebble_tasks_set_current(PebbleTask...
{ WindowStack *stack = app_state_get_window_stack(); Window *window1 = window_create(); Window *window2 = window_create(); Window *window3 = window_create(); window1->debug_name = "Window1"; window2->debug_name = "Window2"; window3->debug_name = "Window3"; window_stack_push(stack, window1, true); win...
void test_window_stack__pop_all_modals(void) { Window *windows[NumModalPriorities]; WindowStack *window_stacks[NumModalPriorities]; for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { window_stacks[idx] = modal_manager_get_window_stack(idx); windows[idx] = window_create(); ...
rgb); #endif color.a = 1; graphics_context_set_fill_color(&context, color); cl_assert_equal_i(context.draw_state.fill_color.argb, GColorClear.argb); color.a = 0; graphics_context_set_fill_color(&context, color); cl_assert_equal_i(context.draw_state.fill_color.argb, GColorClear.argb); // Fill Color - 2-...
(&context, &GRect(10, 20, 40, 10))
; ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context, false, 1, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_draw_1px_non_aa(&context, GPoint(50, 50), 10)); setup_test(&context, false, 1, GColorBlack, GCo...
_get(&file, PREF_KEY_DEFAULT_WATCHFACE, sizeof(PREF_KEY_DEFAULT_WATCHFACE), &s_default_watchface, sizeof(s_default_watchface)) != S_SUCCESS) { s_default_watchface = UUID_INVALID; } if (settings_file_get(&file, PREF_KEY_CONTENT_SIZE, sizeof(PREF_KEY_CONTENT_SIZE), ...
( (PreferredContentSize)s_content_size)
; } bool activity_prefs_tracking_is_enabled(void) { #if CAPABILITY_HAS_HEALTH_TRACKING return true; #else return false; #endif } #if CAPABILITY_HAS_HEALTH_TRACKING void activity_prefs_tracking_set_enabled(bool enable) { } bool activity_prefs_activity_insights_are_enabled(void) { return false; } void activity_...
NDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "gap_le_slave_reconnect.h" #include "applib/bluetooth/ble_ad_parse.h" #include "gap_le.h" #include "gap_le_advert.h" #include "gap_le_connect.h" #inc...
bt_driver_adv_reconnect_get_job_terms(&num_terms)
; s_reconnect_advert_job = gap_le_advert_schedule(ad, advert_terms, num_terms, prv_advert_job_unscheduled_callback, NULL, ...
&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerTopRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_topright.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGI...
cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornersAll, 8), 0)
; cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 5), GCornersAll, 8), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(4, 0), GCornersAll, 8), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(4, 8), GCornerNone, 8), 0); // Test minimum of width and height is taken as radius cl_assert_equal_i(prv_cl...
iter_next(&word_iter)
); cl_assert(*word_iter_state.current.start == 'I'); cl_assert(*word_iter_state.current.end == '\n'); cl_assert(HORIZ_ADVANCE_PX * 2 == word_iter_state.current.width_px); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == 'o'); ...
/* * 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...
(BOARD_CONFIG_DISPLAY.spi)
; SPI_StructInit(&spi_cfg); spi_cfg.SPI_Direction = SPI_Direction_1Line_Tx; // Write-only SPI spi_cfg.SPI_Mode = SPI_Mode_Master; spi_cfg.SPI_DataSize = SPI_DataSize_8b; spi_cfg.SPI_CPOL = SPI_CPOL_Low; spi_cfg.SPI_CPHA = SPI_CPHA_1Edge; spi_cfg.SPI_NSS = SPI_NSS_Soft; spi_cfg.SPI_BaudRatePrescaler = ...
int16_t offset_y; bool slide_up; bool timeline_is_destination; bool timeline_is_empty; GColor fill_color; } CompositorSlideTransitionData; static CompositorSlideTransitionData s_data; static void prv_copy_framebuffer_rows(GBitmap *dest_bitmap, GBitmap *src_bitmap, int16_t start_row, ...
if (s_data.timeline_is_destination) { #if CAPABILITY_HAS_TIMELINE_PEEK if (!s_data.timeline_is_empty) { graphics_context_set_fill_color(ctx, GColorWhite); const int content_width = DISP_COLS - TIMELINE_PEEK_ICON_BOX_WIDTH; graphics_fill_rect(ctx, &GRect(0, fill_offset_y, content_width, fill_height...
Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is ...
(HcEndpointID_Gatt, msg_id, (uint8_t *)data, alloc_size)
; kernel_free(data); } void hc_endpoint_gatt_send_notification(const BTDeviceInternal *addr, uint16_t handle, uint16_t value_length, const uint8_t *value) { prv_send_notification_indication(addr, handle, value_length, value, HcMessageID_Gat...
gs for cached & new fds file->op_flags = op_flags; file->offset = 0; // (re)set seek position file->is_tmp = is_tmp; if (res == FDAlreadyLoaded) { // we found the FD in cache! file->curr_page = file->start_page; bool perform_crc_check = (op_flags & OP_FLAG_SKIP_HDR_CRC_CHECK) == 0; if (perform_crc...
file_found_in_cache(name, op_flags, &res)
|| (res < S_SUCCESS)) { goto cleanup; } // The file is not in the cache, let's see if it's on the filesystem int fd = res; if ((res = file_found_or_added_to_pfs(fd, name, op_flags, file_type, start_size)) >= S_SUCCESS) { res = fd; // success so return the fd } cleanup: if (res >= S_SUCCESS)...
FIG.mic_config.i2s_sd.gpio_pin; GPIO_Init(BOARD_CONFIG.mic_config.i2s_sd.gpio, &GPIO_InitStructure); GPIO_PinAFConfig(BOARD_CONFIG.mic_config.i2s_sd.gpio, BOARD_CONFIG.mic_config.i2s_sd.gpio_pin_source, BOARD_CONFIG.mic_config.i2s_sd.gpio_af); gpio_release(BOARD_CONFIG.mic_config.i2s_ck.gpio); gpio_relea...
periph_config_acquire_lock()
; periph_config_disable(BOARD_CONFIG.mic_config.spi, BOARD_CONFIG.mic_config.spi_clock_ctrl); periph_config_release_lock(); // Disable I2S PLL RCC_PLLI2SCmd(DISABLE); prv_mic_power_disable(); stop_mode_enable(InhibitorMic); s_running = false; PBL_LOG(LOG_LEVEL_DEBUG, "Stopped ...
/* * 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 (r == 0 || strncmp(buf, "05", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"m\": %s", buf); }
r = strftime(buf, buf_size, "%M", &good_data); if (r == 0 || strncmp(buf, "04", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"M\": %s", buf); } r = strftime(buf, buf_size, "%p", &good_data); if (r == 0 || strncmp(buf, "AM", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \...
o = (EventServiceInfo) { .type = PEBBLE_DICTATION_EVENT, .handler = prv_handle_voice_transcription_result, .context = data, }; event_service_client_subscribe(&data->event_service_info); voice_window_transcription_dialog_keep_alive_on_select(data->voice_window, true); voice_window_push(data->voice_...
localtime_r(&utc_sec, &local_tm)
; if (local_tm.tm_hour < 10) { local_tm.tm_hour = 12; local_tm.tm_min = 0; local_tm.tm_sec = 0; } else if (local_tm.tm_hour < 16) { local_tm.tm_hour = 18; local_tm.tm_min = 0; local_tm.tm_sec = 0; } else { local_tm.tm_hour += 2; local_tm.tm_sec = 0; } time_t new_time = mktime(...
"applib/ui/window_private.h" #include "applib/ui/layer.h" #include "util/math.h" #include "util.h" #include "clar.h" #include <stdio.h> // Helper Functions //////////////////////////////////// #include "test_graphics.h" #include "${BIT_DEPTH_NAME}/test_framebuffer.h" // Stubs //////////////////////////////////// #...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc...
0, 272, 40}, { 1312, 368, 24}, { 856, 320, -8}, { 1032, 256, 96}, { 1208, 152, 224}, { 984, 144, 160}, { 792, 64, 144}, { 712, 64, 0}, { 744, 32, -16}, { 832, 56, -32}, { 824, -8, -16}, { 976, -88, -24}, { 1072, 56, -176}, { 1392, -264, -32}, { 1544, 120, 56}, ...
// 75 seconds { 1240, 232, -104}, { 1408, 392, -248}, { 1072, 432, -24}, { 736, 200, -24}, { 800, 248, 0}, { 824, 304, -32}, { 912, 368, -64}, { 840, 352, -208}, { 952, 384, -232}, { 1136, 240, -248}, { 1168, 240, -184}, { 1848, 224, -56}, { 1528, 392, -32}, {...
{ 1000, 56, 160}, { 864, 56, 112}, { 776, 48, 16}, { 800, 24, 40}, { 776, -8, 0}, { 864, -80, 24}, // 78 seconds { 1016, -112, 8}, { 992, -56, -48}, { 1448, -232, 64}, { 1440, 0, 112}, { 1120, 240, -48}, { 1192, 288, -176}, { 936, 232, 16}, { 712, 184, 40}, ...
/* * 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(action3_attributes)
, .attributes = action3_attributes } }, }; static Attribute attributes[] = { {.id = AttributeIdTitle, .cstring = "Sender"}, {.id = AttributeIdBody, .cstring = "Message"}, {.id = AttributeIdSubtitle, .cstring = "Subject"}, }; bool system_task_add_callback(SystemTaskEventCallback cb, void *data)...
_transition_default_push_create_animation(WindowTransitioningContext *context) { window_transition_context_disappear(context); window_transition_context_appear(context); return animation_create(); } const WindowTransitionImplementation window_transition_default_push_implementation = { .create_animation = windo...
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 *window = window_create(); stub_pebble_tasks_set_current(PebbleTask_App); cl_check(app_sta...
inute_data.num_sessions_created < TEST_ACTIVITY_MAX_SESSIONS); cl_assert(s_test_alg_state.minute_data.sleep_current_container_idx < 0); s_test_alg_state.minute_data.sleep_current_container_idx = s_test_alg_state.minute_data.num_sessions_created; s_test_alg_state.minute_data.s...
{ continue; }
if (s_test_alg_state.minute_data.sessions[i].start_utc + (s_test_alg_state.minute_data.sessions[i].length_min * SECONDS_PER_MINUTE) < sleep_earliest_end_utc) { continue; } ACTIVITY_LOG_DEBUG("Returning session %d: start_min: %d, len_min: %"PRIu16" ", session->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...
fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)
; text_layer_set_font(&data->text_layer, data->gothic_14_bold); text_layer_set_text_alignment(&data->text_layer, GTextAlignmentCenter); data->line_spacing_delta = 0; text_layer_set_line_spacing_delta(&data->text_layer, data->line_spacing_delta); data->overflow_mode = GTextOverflowModeWordWrap; text_layer_se...
box_max_x = MIN(clip_box_max_x, data_row_info.max_x); // If x1 is further outside the clip box than the left gradient width, we need to move x1 up // to clip_box_min_x and proceed such that we don't draw the left gradient int16_t x1_distance_outside_clip_box = clip_box_min_x - x1.integer; if (x1_distance_outsid...
{ if (!dst_color) { return; } // If there's no mask, just set the color normally and return if (!mask) { memset(dst_color, src_color.argb, (size_t)width); return; } const uint8_t pixels_per_byte = (uint8_t)GDRAWMASK_PIXELS_PER_BYTE; const unsigned int mask_row_data_offset = data_row_offset /...
ALWAYS_INLINE uint8_t graphics_private_raw_mask_get_value(const GContext *ctx, const GDrawMask *mask, GPoint p) { const GBitmap *framebuffer_bitmap = &ctx->dest_bitmap; const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer_bitmap, ...
/* * 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...
sniprintf(buffer, TIMESTAMP_BUFFER_SIZE, "%02u:%02u:%02u.%03u ", time_seconds_calendar.tm_hour, time_seconds_calendar.tm_min, time_seconds_calendar.tm_sec, time_ms)
; serial_console_write_log_message(buffer); } static void prv_log_serial( uint8_t log_level, const char* src_filename, int src_line_number, const char* message) { if (!serial_console_is_logging_enabled() && log_level != LOG_LEVEL_ALWAYS) { return; } // Log the log level and the current task+privilege...
ialogs/dialog.h" #include "applib/ui/dialogs/dialog_private.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/progress_window.h" #include "applib/ui/window.h" #include "applib/ui/window_manager.h" #include "applib/voice/voice_window.h" #include "applib/...
{ evented_timer_cancel(data->response.timer); }
} static void prv_cleanup_action_result(ActionResultData *data, bool succeeded) { if (!data) { return; } // report to analytics the result of the action if (data->response.attribute.id == AttributeIdTitle && data->response.attribute.cstring) { analytics_event_canned_response(data->response.attr...
hunk; DBG("Sending Chunk (%"PRIu32" bytes remaining)", (uint32_t) bytes_remaining); PBL_ASSERTN(APP_MSG_OK == app_message_outbox_send()); } //////////////////////////////////////////////////////////////////////////////// // Handling Inbound Object Chunks ///////////////////////////////////////////////////////////...
rocky_global_call_event_handlers(event)
; } } } else { DBG("No 'message' event handlers"); } prv_cleanup_inbound_reassembly_buffer(); } return true; } //////////////////////////////////////////////////////////////////////////////// // Control Message Queue ////////////////////////////////////////////////////////////////...
/* * 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...
(sizeof(KinoReelImplGBitmap))
; if (reel) { kino_reel_gbitmap_init(reel, bitmap); reel->owns_bitmap = take_ownership; } return (KinoReel *)reel; } KinoReel *kino_reel_gbitmap_create_with_resource(uint32_t resource_id) { ResAppNum app_num = sys_get_current_resource_num(); return kino_reel_gbitmap_create_with_resource_system(app_n...
ndler }; h = animation_create(); cl_assert(h != NULL); void *context = h; animation_set_handlers(h, handlers, context); animation_set_implementation(h, &implementation); return h; } // -------------------------------------------------------------------------------------- // Setup. Called before each ...
(prop_h, &r)
; cl_assert_equal_rect(set_r, r); set_r = GRect(5, 6, 7, 8); property_animation_set_to_grect(prop_h, &set_r); r = GRect(0, 0, 0, 0); property_animation_get_to_grect(prop_h, &r); cl_assert_equal_rect(set_r, r); subject = (void *)0x11223344; property_animation_set_subject(prop_h, &subject); subject = ...
/* * 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...
fake_app_timer_is_scheduled(timer)
); cl_assert(app_timer_trigger(timer)); ASSERT_JS_GLOBAL_EQUALS_I("extra_arg", 5.0); } script = "clearInterval(timer);"; EXECUTE_SCRIPT(script); cl_assert(fake_app_timer_is_scheduled(timer) == false); } void test_rocky_api_timers__setTimeout(void) { char *script = "var num_times = 0;" "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...
(GColorRed.b == 0b00)
; cl_assert(GColorRed.a == 0b11); } void test_graphics_colors__green(void) { cl_assert(GColorGreen.r == 0b00); cl_assert(GColorGreen.g == 0b11); cl_assert(GColorGreen.b == 0b00); cl_assert(GColorGreen.a == 0b11); } void test_graphics_colors__blue(void) { cl_assert(GColorBlue.r == 0b00); cl_assert(GColor...
inbox->num_success = 0; success = true; } unlock: prv_unlock(); return success; } //! @note Executes on app task, therefore we need to go through syscalls to access AppInbox! static void prv_callback_event_handler(void *ctx) { AppInboxServiceTag tag = (AppInboxServiceTag)(uintptr_t)ctx; AppInboxConsum...
{ prv_lock(); { AppInboxNode *node = s_app_inbox_head; while (node) { AppInboxNode *next = (AppInboxNode *) node->node.next; kernel_free(node); node = next; } s_app_inbox_head = NULL; } prv_unlock(); }
static bool prv_is_inbox_being_written(AppInboxNode *inbox) { return (inbox->writer != NULL); } static size_t prv_get_space_remaining(AppInboxNode *inbox) { return (inbox->buffer.size - inbox->buffer.write_index - inbox->buffer.current_offset); } bool prv_check_space_remaining(AppInboxNode *inbox, size_t requir...
calculation and reenable this: - PBL-16509 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_point_origin_layer_aa.${BIT_DEPTH...
{ GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 10); graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_inside_offset_la...
#define COLOR_START_POINT GPointPrecise(5, 35) #define COLOR_END_POINT GPointPrecise(45, 40) void test_graphics_draw_stroke_${BIT_DEPTH_NAME}__color(void) { // TODO: Fix blending and reenable this - PBL-16509 /* GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, OFFSET_RECT...
erval_us; } return accel_get_sampling_interval(); } 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)...
for (int mask = 0; mask < max_permutations; mask++) { int count = __builtin_popcount(mask); if (count == 0) { continue; // we don't care about the empty set } int test_rates[count]; int idx = 0; for (int j = 0; j < poss_rates; j++) { if ((mask & (0x1 << j)) != 0) { test_rate...
ETRIC_FLASH_ERASE_COUNT, s_system_analytics_erase_count, AnalyticsClient_System); s_system_analytics_read_bytes_count = 0; s_system_analytics_write_bytes_count = 0; s_system_analytics_erase_count = 0; } void analytics_external_collect_app_flash_read_stats(void) { analytics_set(ANALYTICS_APP_ME...
{ return s_erase_poll_timer; }
#endif //! Assumes that s_flash_lock is held. static void prv_erase_pause(void) { if (s_erase.in_progress && !s_erase.suspended) { // If an erase is in progress, make sure it gets at least a mininum time slice to progress. // If not, the successive kicking of the suspend timer could starve it out completely...
__callcount++; return jerry_create_undefined(); } void test_rocky_api_global__initialize(void) { fake_app_timer_init(); rocky_runtime_context_init(); jerry_init(JERRY_INIT_EMPTY); s_app_window_stack_get_top_window = (Window){}; s_app_event_loop_callback = NULL; s_log_internal__expected = NULL; s_prv_...
jerry_obj_refcount(o)
unds = &cell_layer->bounds; uint32_t start_idx = (uintptr_t)arg1; uint32_t num_marks = (uintptr_t)arg2; // Calculate rect containing generic marks GSize overall_size = GSize(MARK_PADDING * (num_marks + 1), 0); for (uint32_t i = 0; i < num_marks; i++) { const GSize mark_size = cd->regulatory_marks[start_id...
i18n_free(subtitle, title)
; } static void prv_certification_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) { SettingsSystemData *data = (SettingsSystemData *) context; PBL_ASSERTN(cell_index->section == 0); SystemCertificationData *cd = &data-...
ter sin wave // generated by tintin/tools/trigTable.py static const uint16_t SIN_LOOKUP[] = { 0, 401, 801, 1202, 1602, 2002, 2403, 2803, 3203, 3603, 4003, 4403, 4802, 5202, 5601, 6000, 6399, 6797, 7195, 7593, 7991, 8389, 8786, 9182, 9579, 9975, 10371, 10766, 11161, 11555, 11949, 12343, 12736, 13129, 13521, 13913, 14304...
if (angle >= TRIG_MAX_ANGLE / 2) { mult = -mult; angle -= TRIG_MAX_ANGLE / 2; }
if (angle >= TRIG_MAX_ANGLE / 4 && angle <= TRIG_MAX_ANGLE / 2) { angle = TRIG_MAX_ANGLE / 2 - angle; } // if I can interpolate linearly int32_t lookup_angle = angle * 4 / 0xff; if ((uint32_t)(lookup_angle + 1) < sizeof(SIN_LOOKUP) / sizeof(int32_t)) { return mult * (SIN_LOOKUP[lookup_angle] + ((a...
) {4, 0, 3, 1}, 4, &s_recognizers_handled); cl_assert_equal_p(manager.active_layer, &layer_c); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_...
prv_compare_recognizers_processed(NULL, 0, &s_recognizers_handled)
; prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); // Layer A's recognizer's gesture completes immediately. All recognizers receive the touch event // because Layer A's recognizers receive the touch events last. All rec...
t_lock.h" #include "stubs_gap_le_advert.h" #include "stubs_bluetooth_analytics.h" #include "stubs_gatt_client_discovery.h" #include "stubs_gatt_client_subscriptions.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pebble_pairing_service.h" #include "stubs_print.h" #inclu...
(&address_out)
, false); BTDeviceAddress address_out_expected = {}; cl_assert_equal_m(&address_out_expected, &address_out, sizeof(address_out)); BTDeviceAddress address = (BTDeviceAddress) { .octets = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }, }; cl_assert_equal_b(bt_persistent_storage_set_ble_pinned_address(&ad...
/* * 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...
(GColorCobaltBlue, GColorBlack)
, GColorWhite }, .icons_enabled = config->icons_enabled, }; option_menu_configure(&s_data.option_menu, &option_menu_config); const OptionMenuCallbacks callbacks = { .draw_row = config->callbacks.draw_row ?: prv_menu_draw_row, .get_num_rows = config->callbacks.get_num_rows ?: prv_menu_get_num_rows, ...
layer.frame.size.w, layer.frame.size.h); if (layer.frame.origin.x == to_r.origin.x && layer.frame.origin.y == to_r.origin.y) { reached_end_elapsed = true; } if (reached_end_elapsed && s_stopped_handler_calls.num_calls == 1 && layer.frame.origin.x < to_r.origin.x) { detected_reset_of_el...
cl_assert(max_loops > 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...
{ AnalyticsEventCrash *crash_report = (AnalyticsEventCrash *)reason; analytics_event_crash(crash_report->crash_code, crash_report->link_register); kernel_free(crash_report); }
static RebootReasonCode s_last_reboot_reason_code = RebootReasonCode_Unknown; RebootReasonCode reboot_reason_get_last_reboot_reason(void) { return s_last_reboot_reason_code; } void debug_reboot_reason_print(McuRebootReason mcu_reboot_reason) { RebootReason reason; reboot_reason_get(&reason); bool show_reset_...
------------------------------------------------------ // Log a health insight created event. void analytics_event_health_insight_created(time_t timestamp, ActivityInsightType insight_type, PercentTier pct_tier) { // Format the ev...
prv_get_connection_details(session, &is_ppogatt, &conn_interval)
id = EVENTED_TIMER_INVALID_ID; } } static void prv_cancel_reminder_watchdog(NotificationWindowData *data) { if (regular_timer_is_scheduled(&data->reminder_watchdog_timer_id)) { regular_timer_remove_callback(&data->reminder_watchdog_timer_id); } } static void prv_cleanup_timers(NotificationWindowData *data) ...
{ return interpolate_moook_soft(normalized, from, to, NUM_MOOOK_SOFT_MID_FRAMES); }
// scroll = true, then scroll the layer up dy // scroll = false, then shrink the layer's size by dy static Animation *prv_create_anim_frame(Layer *layer, int16_t dy, bool scroll) { GRect *start = &layer->frame; GRect stop = *start; if (scroll) { stop.origin.y += dy; } else { stop.size.h += dy; } ...