prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
} // Init the flash hardware void cd_flash_init(void) { // Enable the SPI clock RCC_APB2PeriphClockCmd(FLASH_SPI_CLOCK, ENABLE); // Enable the GPIO clock uint8_t idx = ((((uint32_t)FLASH_GPIO) - AHB1PERIPH_BASE) / 0x0400); SET_BIT(RCC->AHB1ENR, (0x1 << idx)); // Init the flash hardware flash_hw_init()...
prv_flash_wait_for_write()
; } // Erase a region comprised of 1 or more sub-sectors. This will erase sectors at a time if // the address and size allow. void cd_flash_erase_region(uint32_t start_addr, uint32_t total_bytes) { CD_ASSERTN(((start_addr & SUBSECTOR_ADDR_MASK) == start_addr) && ((total_bytes & SUBSECTOR_ADDR_MASK) == ...
ndler; } void window_raw_click_subscribe(ButtonId button_id, ClickHandler down_handler, ClickHandler up_handler, void *context) { prv_check_is_in_click_config_provider(window_manager_get_top_window(), "subscribe"); if (button_id == BUTTON_ID_BACK) { PBL_LOG(LOG_LEVEL_DEBUG, "Cannot register BUTTON_ID_BACK raw ...
(background_color)
); } void window_set_fullscreen(Window *window, bool enabled) { if (window->is_fullscreen == enabled) { return; } window->is_fullscreen = enabled; window->layer.frame = window_calc_frame(enabled); window->layer.bounds.size = window->layer.frame.size; layer_mark_dirty(&window->layer); } bool window_ge...
const int exit_timeout_ms = 2 * ANIMATION_TARGET_FRAME_INTERVAL_MS; evented_timer_register(exit_timeout_ms, false, prv_exit_timer_callback, context); } //! Used for setting the animation frame source and/or destination of the peek layer. //! If use_pin is true, the animation frame size and position will be that o...
timeline_layer_create_sidebar_animation(&data->timeline_layer, to_sidebar_width)
; } static void prv_exit(TimelineAppData *data) { UNUSED const TimelineAppState prev_state = data->state; if (!prv_set_state(data, TimelineAppStateExit)) { return; } #if ANIMATION_SLIDE prv_launch_watchface(data); #elif ANIMATION_DOT const uint32_t duration = interpolate_moook_in_duration(); animatio...
sumption but the lower the RMS noise static void prv_accel_enable_undersampling(bool enable) { const uint8_t acc_us_bwp_mask = (BMI160_ACC_CONF_ACC_BWP_MASK << BMI160_ACC_CONF_ACC_BWP_SHIFT) | (BMI160_ACC_CONF_ACC_US_MASK << BMI160_ACC_CONF_ACC_US_SHIFT); uint8_t acc_us_bwp; if (!enable) { acc_us...
psleep(50)
; // Collect data with the positive offset applied for (unsigned int i = 0; i < ARRAY_LENGTH(accel_test_axis); ++i) { accel_test_axis[i].positive_value = bmi160_read_16bit_reg(accel_test_axis[i].register_address); PBL_LOG(LOG_LEVEL_DEBUG, "+ %c: %"PRId16, accel_test_axis[i].axis_name, accel_tes...
src_ic.x, src_ic.x - src->bounds.origin.x); const int16_t max_height = MAX(src->bounds.origin.y + src->bounds.size.h - src_ic.y, src_ic.y - src->bounds.origin.y); const int32_t width = 2 * (max_width + 1); // Add one more pixel in case on t...
gcolor_alpha_blend(src_color, dst_color)
; break; } case GCompOpOr: { const GColor dst_color = get_bitmap_color(dest_bitmap, x, y); if (tint_color.a != 0) { GColor actual_color = tint_color; actual_color.a = src_color.a; ctx->draw_state.stroke_color = gcolor_alpha_blend(actual_c...
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 "ice40lp.h" #include "board/board.h" #include "drivers/dbgserial.h" #include "drivers/display/ice40lp_d...
prv_spi_write(spi_zeros, sizeof(spi_zeros))
; if (!gpio_input_read(&ICE40LP->cdone)) { dbgserial_putstr("CDONE not high after programming"); return false; } return true; } void display_power_enable(void) { // The display requires us to wait 1ms between each power rail coming up. The PMIC // initialization brings up the 3.2V rail (VLCD on the ...
g_service.h" #include "services/normal/data_logging/dls_private.h" #include "applib/app.h" #include "applib/data_logging.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/window.h" #include "applib/ui/text_layer.h" #include "applib/app_timer.h" #include "applib/app_logging.h" #include <stdio.h> #include <...
(&s_data.window, "Logging Demo")
; app_window_stack_push(&s_data.window, true /* Animated */); window_set_click_config_provider_with_context(&s_data.window, click_config_provider, &s_data.window); const GRect *bounds = &s_data.window.layer.bounds; for (int i = 0; i < 3; ++i) { s_data.info[i...
16_t font_height = fonts_get_font_height(font); static const int16_t TEXT_LAYER_Y_OFFSET = 50; TextLayer *text_layer = &data->mic_window.text_layer; text_layer_init_with_parameters(text_layer, &GRect(0, dot_frame.origin.y + TEXT_LAYER_Y_OFFSET, ...
(&data->mic_window.mic_dot_layer)
; text_layer_deinit(&data->mic_window.text_layer); status_bar_layer_deinit(&data->mic_window.status_bar); event_service_client_unsubscribe(&data->voice_event_sub); } static void prv_mic_window_disappear(Window *window) { VoiceUiData *data = window_get_user_data(window); if (data->state != StateError) { /...
BToken token; BlobDBResponse result; uint8_t num_ids; BlobDBId db_ids[NumBlobDBs]; } response = { .cmd = BLOB_DB_COMMAND_DIRTY_DBS_RESPONSE, .token = *(BlobDBToken *)data, .result = BLOB_DB_SUCCESS, }; blob_db_get_dirty_dbs(response.db_ids, &response.num_ids); // we don't want to send ...
(session, (uint8_t *)&response, sizeof(response))
ze > heap->high_water_mark) { heap->high_water_mark = heap->current_size; } } } heap_unlock(heap); if (allocated_block) { return &allocated_block->Data; } return NULL; } void heap_free(Heap* const heap, void *ptr, uintptr_t client_pc) { UTIL_ASSERT(heap->begin); if (!ptr) { //...
if(next_next_block == heap->end) { heap->begin->PrevSize = heap_info_ptr->Size; } else { next_next_block->PrevSize = heap_info_ptr->Size; }
} } } heap_unlock(heap); } bool heap_is_allocated(Heap* const heap, void* ptr) { bool rc = false; if (!heap_contains_address(heap, ptr)) { return rc; } HeapInfo_t *heap_info_ptr = heap->begin; // Iterate through the heap to see if this pointer is still allocated. heap_lock(heap); whi...
/* * 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_window_stack_pop(true)
; } } static void prv_menu_reload_data(void *context) { OptionMenu *option_menu = context; option_menu_reload_data(option_menu); } static void prv_menu_unload(OptionMenu *option_menu, void *context) { QuickLaunchAppMenuData *data = context; option_menu_destroy(option_menu); app_menu_data_source_deinit(&d...
rv_is_weekend(DayInWeek day) { return (day == Sunday) || (day == Saturday); } // ---------------------------------------------------------------------------------------------- // Return the activity metric that maps to the given health metric. We separate the two because // in the future, the health APIs may need to...
{ memcpy(daily, &state->cache->steps_daily, sizeof(*daily)); // Get updated value for today. Getting only today's value is MUCH faster than getting // the historical values sys_activity_get_metric(prv_get_activity_metric(metric), 1, &daily->totals[0]); return true; }
s_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_...
void mutex_unlock(PebbleMutex * handle) { cl_assert_equal_b(s_mutex_locked, true); s_mutex_locked = false; } static const char DEVICE_NAME[BT_DEVICE_NAME_BUFFER_SIZE] = "ABCDEFGHIJKLMNOPQRS"; static const char *PAIRING_NAME = "Blah123"; static const BTDeviceAddress DEVICE_ADDR = {.octets = {0x88, 0x99, 0xaa, 0xbb...
(shared_prf_storage_get_valid_page_number(), 0)
; // Test that it sees all pages are invalid, rewrites everything, and picks the first empty page prv_fill_flash_random_data(); shared_prf_storage_init(); cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 0); } void test_shared_prf_storage_v3__wipe_all(void) { SMPairingInfo sm_pairing_info; me...
c void prv_start_connecting(void) { #if !BLE_MASTER_CONNECT_SUPPORT // PBL-32761 PBL_LOG(LOG_LEVEL_WARNING, "Watch driven BLE connection unimplemented"); #else if (s_has_pending_create_connection) { PBL_LOG(LOG_LEVEL_ERROR, "Already connecting..."); return; } BLE_GAP_LOG_DEBUG("Starting connecting..");...
memcmp(&connection->device.opaque, &intent->bonding->device.opaque, sizeof(connection->device.opaque))
); } return false; } return (0 == memcmp(connection->irk, &intent->bonding->irk, sizeof(*connection->irk))); } else { return bt_device_equal(&connection->device.opaque, &intent->device.opaque); } } static void prv_intent_remove_and_free(GAPLEConnectionIntent *intent) { list_remove(&inten...
{ 1024, -104, 32}, { 1080, -40, -16}, { 1056, -88, 0}, { 1048, -104, 16}, { 984, -128, -24}, { 968, -104, -40}, { 984, -96, -72}, { 1000, -112, -72}, { 1016, -120, -56}, { 1032, -136, -64}, { 1296, -136, -72}, { 1336, -144, -88}, { 1224, -112, -128}, { 1024, -80, -24...
{ 1016, -272, -152}, { 992, -248, -160}, { 984, -216, -184}, { 1008, -232, -160}, { 1056, -248, -128}, { 1072, -232, -112}, { 1128, -216, -112}, { 1168, -200, -72}, { 1192, -208, -80}, // 34 seconds { 1568, -168, -208}, { 1304, -192, -160}, { 1016, -152, -160}, { ...
{ 1144, -80, -232}, { 1232, -96, -200}, { 1592, -104, -248}, { 1256, -104, -192}, { 856, -40, -256}, { 584, -16, -312}, { 840, -16, -280}, { 1128, -88, -216}, { 1232, -128, -160}, { 1088, -144, -136}, { 984, -104, -200}, { 976, -80, -216}, { 992, -136, -184}, { 9...
/* * 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(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;" "var f = function(extra) {" " num_tim...
bytes_needed)) { *bytes_in_list -= node->size; node = (EvictListNode *)list_pop_head((ListNode *)node); kernel_free(temp); } else { break; } } *list_node = node; } //! Check if we need to free up some space in the cache. If so, do it. static void prv_cleanup_app_cache_if_needed(voi...
if (bytes_needed == 0) { return E_INVALID_ARGUMENT; }
status_t rv; mutex_lock_recursive(s_app_cache_mutex); { SettingsFile file; rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE); if (rv != S_SUCCESS) { goto unlock; } // we don't want to remove any default apps or quick launch apps, so keep them in a list. EachE...
} update_output_value(nf); } } static void down_click_handler(ClickRecognizerRef recognizer, NumberWindow *nf) { bool is_decreased = false; int32_t new_val = nf->value - nf->step_size; if (new_val >= nf->min_val && new_val < nf->value) { nf->value = new_val; is_decreased = true; } if (is_decr...
update_output_value(nf)
; } void number_window_set_step_size(NumberWindow *nf, int32_t step) { nf->step_size = step; } int32_t number_window_get_value(const NumberWindow *nf) { return nf->value; } static void number_window_load(NumberWindow *nw) { ActionBarLayer *action_bar = &nw->action_bar; action_bar_layer_set_context(action_bar...
prv_disable_spi_cs_wakeup_interrupt_handling_and_unblock_transaction_loop(); } } static bool prv_is_scs_asserted(void) { return (false == hw_gpio_get_pin_status(HOST_SPI->spi.cs.port, HOST_SPI->spi.cs.pin)); } // TODO: Can we avoid re-configuring every time? We might be missing a trigger if it happens // before...
PBL_LOG(LOG_LEVEL_DEBUG, "->IN")
; PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)&remote_status_in, sizeof(remote_status_in)); prv_core_dump(); } HOST_TRANSPORT_DEBUG_LOG("Local Status: %u bytes sendable, %u bytes receivable", local_status_out.bytes_sendable_count, local_status_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...
if (!config->timeout_ms) { // Set the default prompt or result dialog timeout config->timeout_ms = prv_should_prompt(&ctx->config) ? 4500 : 1800; }
if (!config->text_color.argb) { config->text_color = GColorBlack; } if (!config->background_color.argb) { config->background_color = !ctx->enabled ? GColorMediumAquamarine : GColorMelon; } } static void prv_setup_dialog(Dialog *dialog, const ActionToggleDialogConfig *config, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
list_count_to_tail_from(&b)
/* * 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))
; framebuffer_init(fb, &(GSize) { DISP_COLS, DISP_ROWS }); } // Teardown void test_framebuffer_duma__cleanup(void) { free(fb); } // Intentionally unchecked framebuffer drawing function static void draw_fb_raw(uint8_t *buffer, int offset, GColor8 color) { buffer[offset] = color.argb; } // Tests ////////////////...
uffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */); pfs_init(false /* run filesystem che...
prv_create_card_and_render(&health_data)
_equal_i(s_num_timeline_adds, 14); cl_assert_equal_i(s_num_timeline_removes, 9); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again, but not until Monday s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); ...
(s_num_alarms_fired, 5)
; s_current_day = s_wednesday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 6); } void test_alarm__custom_alarm_weekends_and_weekday(void) { AlarmId id1; bool schedule_1[7] = {true, false, false, true, false, false, true}; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind ...
ated priority static bool prv_each_free_up_space(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if ((info->key_len != sizeof(AppInstallId)) || (info->val_len != sizeof(AppCacheEntry))) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid cache entry with key_len: %u and val_...
(node->id)
; node = (EvictListNode *)list_pop_head((ListNode *)node); kernel_free(temp); } } unlock: mutex_unlock_recursive(s_app_cache_mutex); return rv; } ////////////////////// // AppCache Helpers ////////////////////// // Remove the filename entry in the PFSFileList (via context) that corresponds to th...
italized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 H", time_buf); // June 10th 2015, 13:00:59 (T-00:59:01) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equ...
cl_assert_equal_s("Fri, 12:00 PM", time_buf)
; // June 11th 2015, 12:00:00 (T-24:00:00) rtc_set_time(event_time - SECONDS_PER_DAY); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Fri, 12:00 PM", time_buf); // June 11th 2015, 12:00:01 (T-23:59:59) rtc_set_time(event_time - SECONDS_PER_DA...
TS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 3); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); // TODO: Fix offset calculation ...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 1); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NX...
pre-ack PB packet"); } } static void prv_deinit_put_job_queue(void) { PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs; for (int i = 0; i < MAX_BATCHED_PB_PUT_OPS; i++) { kernel_free(put_jobs->job[i].buffer); put_jobs->job[i].buffer = NULL; } } static bool prv_init_put_job_queue_if_necessar...
(LOG_LEVEL_WARNING, "Put bytes Tok: %"PRIu32" timed out after %"PRIu32"ms, cleaning up.", s_pb_state.token, PUT_TIMEOUT_MS)
; prv_cleanup_async(); } static bool prv_has_valid_fw_update_state_for_object_type(PutBytesObjectType type) { #ifndef RECOVERY_FW if (!firmware_update_is_in_progress()) { bool is_fw_update_object = (type == ObjectFirmware || type == ObjectRecovery || ...
border(Fixed_S16_3 offset, uint32_t offset_radius_sq, uint32_t opposite_radius_sq) { if (offset_radius_sq == opposite_radius_sq) { // We're dealing with a circle return (Fixed_S16_3){.raw_value = integer_sqrt((offset_radius_sq << FIXED_S16_3_PRECISION) - ...
(ctx, GPoint(p.x + x, p.y + y))
her express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/preferred_content_size.h" #include "applib/ui/window_private.h" #include "apps/system_apps/settings/settings_notifications_private.h" #include "popups...
{ strncpy(buffer, s_test_data.timestamp, (size_t)buf_size); buffer[buf_size - 1] = '\0'; }
} void clock_get_until_time(char *buffer, int buf_size, time_t timestamp, int max_relative_hrs) { if (buffer && s_test_data.reminder_timestamp) { strncpy(buffer, s_test_data.reminder_timestamp, (size_t)buf_size); buffer[buf_size - 1] = '\0'; } } void clock_copy_time_string(char *buffer, uint8_t buf_size)...
// stop parsing } } return true; // continue parsing } bool ble_ad_includes_service(const BLEAdData *ad, const Uuid *service_uuid) { struct IncludesServiceCtx ctx = { .service_uuid = service_uuid, .included = false, }; const BLEAdParseCallbacks callbacks = (const BLEAdParseCallbacks) { .serv...
{ const size_t size_to_copy = ble_ad_get_raw_data_size(ad); if (size < size_to_copy) { return 0; } memcpy(buffer, ad->data, size_to_copy); return size_to_copy; }
// ----------------------------------------------------------------------------- //! ble_ad_get_manufacturer_specific_data() wrapper and helper function: struct ManufacturerSpecificCtx { uint16_t company_id; uint8_t *buffer; const uint8_t size; size_t copied_size; }; static bool copy_manufacturer_specific_p...
{ 16, 224, -904}, { 16, 176, -904}, { 24, 208, -912}, { 8, 224, -920}, // 211 seconds { 24, 216, -904}, { 16, 184, -896}, { 16, 184, -896}, { 24, 208, -912}, { 16, 248, -904}, { 16, 192, -920}, { 16, 200, -904}, { 16, 208, -912}, { 16, 184, -904}, { 8, 208, -9...
{ 56, 376, -840}, { 72, 512, -888}, { 64, 304, -872}, { 48, 192, -888}, { 56, 208, -872}, { 80, 280, -928}, { -32, 128, -888}, { 48, 248, -816}, { 24, 224, -936}, // 217 seconds { 16, 336, -1008}, { 128, 352, -872}, { 48, 352, -896}, { 80, 216, -848}, { 88, 12...
{ 40, 224, -904}, { 48, 184, -904}, { 40, 160, -904}, { 40, 208, -912}, { 48, 184, -912}, { 32, 192, -912}, { 40, 200, -888}, { 48, 168, -880}, { 8, 216, -888}, { 16, 232, -904}, { 40, 208, -952}, { 40, 208, -912}, { 40, 200, -904}, // 220 seconds { 8, 176, -...
/* * 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 prv_file_open_by_name(((FileResourceData *) entry->store_data)->name, op_flags); }
static uint32_t resource_storage_file_get_length(ResourceStoreEntry *entry) { const uint8_t op_flags = OP_FLAG_READ | OP_FLAG_SKIP_HDR_CRC_CHECK | OP_FLAG_USE_PAGE_CACHE; return prv_file_common_get_length_and_close(prv_file_open(entry, op_flags)); } static uint32_t resource_storage_file_get_crc(ResourceStoreEntr...
false; // adjust for coordinate system center.x.raw_value -= FIXED_S16_3_HALF.raw_value; center.y.raw_value -= FIXED_S16_3_HALF.raw_value; s_rocky_path_steps[s_rocky_path_steps_num++] = (RockyAPIPathStep) { .type = RockyAPIPathStepType_Arc, .arc = (RockyAPIPathStepArc) { .center = center, ...
(obj, ROCKY_CONTEXT2D_STROKE, prv_stroke)
; rocky_add_function(obj, ROCKY_CONTEXT2D_FILL, prv_fill); } //! For unit testing jerry_value_t rocky_api_graphics_path2d_try_allocate_steps(size_t inc_steps) { TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(inc_steps); return jerry_create_undefined(); } size_t rocky_api_graphics_path2d_min_array_len(void) { return MINIM...
l_get_sector_base_address(addr), .on_complete_cb = on_complete_cb, .cb_context = context, .expected_duration = is_subsector? flash_impl_get_typical_subsector_erase_duration_ms() : flash_impl_get_typical_sector_erase_duration_ms(), }; stop_mode_disable(InhibitorFlash); // FIXME: PBL-1802...
new_timer_start(s_erase_poll_timer, remaining_ms, prv_flash_erase_timer_cb, NULL, 0)
; } } static void prv_blocking_erase_complete(void *context, status_t status) { PBL_ASSERT(PASSED(status), "Flash erase failure: %" PRId32, status); } static void prv_flash_erase_blocking(uint32_t sector_addr, bool is_subsector) { uint32_t total_time_spent_waiting_ms = 0; uint32_t remaining_ms = prv_flash_er...
_size_bytes(FrameBuffer *f) { return FRAMEBUFFER_SIZE_BYTES; } /////////////////////////////////////////////////////////// // Tests void test_char_iterator__initialize(void) { framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); } void ...
iter_next(&char_iter)
); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
list_contains(list, &handler->list_node)
) { PBL_LOG(LOG_LEVEL_DEBUG, "Event service handler already subscribed"); return; } // Add to handlers list list_sorted_add(list, &handler->list_node, (Comparator)event_service_comparator, true); sys_event_service_client_subscribe(handler); } void event_service_client_unsubscribe(EventServiceInfo *han...
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the Licen...
cl_check_(gcolor_equal(get_bitmap_color(&s_bmp, x, y), s_palette[x]), print_buf)
; cl_check_(gcolor_equal(get_bitmap_color(&s_bmp, x, y), s_palette[x]), print_buf); } } #endif } void test_bitblt_palette__4Bit_assign(void) { const int BITS_PER_PIXEL = 4; const int PIXELS_PER_BYTE = (8 / BITS_PER_PIXEL); const int WIDTH = 16; const int HEIGHT = 16; const int ROW_STRIDE = (WIDTH...
turn; } bt_persistent_storage_delete_bt_classic_pairing_by_id(BT_CLASSIC_BONDING_ID); } bool bt_persistent_storage_get_bt_classic_pairing_by_id(BTBondingID bonding, BTDeviceAddress *address_out, SM128BitKey *link_key...
bt_persistent_storage_delete_ble_pairing_by_id(BLE_BONDING_ID)
; if (bt_driver_supports_bt_classic()) { bt_persistent_storage_delete_bt_classic_pairing_by_id(BT_CLASSIC_BONDING_ID); } }
raceful way to handle this #ifndef RECOVERY_FW system_task_add_callback(dls_private_handle_disconnect, NULL); #endif } prv_put_comm_session_event(false, is_system); if (is_system && (session->destination == TransportDestinationHybrid)) { prv_put_comm_session_event(true, false); } // Cleanup: comm...
PBL_LOG(LOG_LEVEL_WARNING, "Could not acquire send buffer for %x", endpoint_id)
; return false; } comm_session_send_buffer_write(sb, data, length); comm_session_send_buffer_end_write(sb); return true; } // ------------------------------------------------------------------------------------------------- typedef struct { const Uuid *app_uuid; CommSession *fallback_session; } FindBy...
/* * 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...
(animation)
; // We need to artificially limit how frequent we attempt to update the screen. If we update // it too fast the thing we wanted to do in the background never gets done. This isn't quite // ideal, as around 60 steps is when things are actually smooth, but 60 is too fast and does // restrict the speed of our co...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (prev) { // Unlink from previous node: prev->next = result->next; } else { // Unlink from head: s_head = result->next; }
// Return found result: return result; } // Iterate: prev = result; result = result->next; } // Not found: return NULL; } //! Inserts the result into the list, keeping the list sorted by RSSI (strongest //! first). static void list_link_sorted_by_rssi(ScanResult *result) { ScanRes...
{ 1136, -144, -56}, { 1024, -120, -40}, { 1064, -80, -80}, // 125 seconds { 1040, -96, -40}, { 984, -96, -16}, { 944, -120, -32}, { 904, -104, -56}, { 888, -120, -64}, { 912, -144, -96}, { 952, -144, -112}, { 1008, -136, -128}, { 1080, -128, -160}, { 1432, -176, -64...
{ 856, 208, -144}, { 952, 200, -240}, { 1048, 192, -288}, { 1112, 184, -400}, { 1096, 160, -392}, { 1456, 184, -592}, { 1528, 248, -664}, { 1208, 56, -360}, { 864, -136, -280}, { 896, -64, -240}, { 1144, 8, -296}, { 1368, 24, -216}, { 1160, -24, -88}, { 1152, -32,...
ection.x > 0) { --data->intersection.x; } break; case ATTRIBUTE_Y: if (data->intersection.y > 0) { --data->intersection.y; } break; default: break; } layer_mark_dirty(data->canvas_layer); } static void down_handler(ClickRecognizerRef recognizer, void *con...
draw_ui_element(ctx, GRect(70, 120, 40, 20), text, data->selection == ATTRIBUTE_Y, data->selection == ATTRIBUTE_Y)
{ -136, 592, -920}, { -184, 512, -888}, // 218 seconds { -208, 488, -800}, { -248, 456, -904}, { -216, 432, -808}, { -224, 472, -760}, { -280, 304, -1000}, { -192, 416, -784}, { -216, 360, -1056}, { -176, 368, -840}, { -208, 352, -1008}, { -152, 288, -968}, { -144,...
{ -208, 496, -832}, { -232, 584, -960}, { -248, 544, -928}, { -288, 512, -936}, { -240, 632, -944}, { -240, 432, -888}, { -248, 408, -944}, { -192, 336, -856}, { -152, 384, -1056}, { -128, 416, -888}, { -136, 232, -1024}, { -152, 488, -984}, { -160, 320, -840}, { ...
{ -200, 264, -864}, { -160, 336, -960}, { -176, 344, -1064}, { -248, 384, -968}, { -216, 216, -912}, { -224, 432, -1200}, // 226 seconds { -240, 256, -824}, { -152, 392, -1064}, { -208, 152, -760}, { -136, 408, -1016}, { -184, 176, -752}, { -112, 408, -992}, { -1...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(sizeof(uint16_t) + sizeof(char) * size)
; pstring->str_length = 0; return pstring; } PascalString16 *pstring_create_pstring16_from_string(char string[]) { uint16_t length = strlen(string); PascalString16* pstring; if (length == 0) { // Empty string pstring = task_malloc_check(sizeof(uint16_t) + sizeof(char) * 1); pstring->str_length = ...
return result; #endif } // ---------------------------------------------------------------------------------------------- // Compute the value of the given metric using aggregation and averaging based on daily history // values. static HealthValue prv_compute_aggregate_averaged_using_daily_totals( HealthServiceS...
sys_activity_get_minute_history(minute_data, &num_records, &time_start)
; if (!success) { APP_LOG(APP_LOG_LEVEL_WARNING, "Error fetching minute history"); break; } PBL_LOG(LOG_LEVEL_DEBUG, " Got %"PRIu32" minute records for %d", num_records, (int)time_start); if (num_records == 0) { // No more data available more_data = false; bre...
stack requirements during the minute handler (see PBL-38130) static bool NOINLINE prv_prepare_minute_data(uint16_t uncertain_m, time_t sleep_start_utc, uint16_t sleep_len_m, AlgMinuteFileRecord *file_record, AlgMinuteDLSRecord *d...
while (prv_prepare_minute_data(uncertain_m, sleep_start_utc, sleep_len_m, file_record, dls_record, force_send)) { PBL_ASSERTN((file_record == NULL) != ...
} // ------------------------------------------------------------------------------------------- // Handle storage and logging of the minute data static void prv_log_minute_data(time_t utc_now, AlgMinuteRecord *minute_rec) { // Store the minute data into our circular buffer. The only place we ever read from this b...
te_median_hr_bpm(ActivityState *state) { const ActivityHRSupport *hr = &state->hr; const uint16_t num_hr_samples = hr->num_samples; if (num_hr_samples > 0) { int32_t median, total_weight; // Stats requires an int32_t array and we need one for both the samples and the weights int32_t *sample_buf = ta...
{ // Update the median HR / HR weight for the minute prv_update_median_hr_bpm(state); // Update our current HR zone (based on the median which is calculated above) prv_update_current_hr_zone(state); }
mutex_unlock_recursive(state->mutex); } // ------------------------------------------------------------------------------------------ // The metrics minute handler void activity_metrics_prv_minute_handler(time_t utc_sec) { ActivityState *state = activity_private_state(); uint16_t cur_day_index = time_util_get_...
tate), offset); return (curr_state == state); } static bool is_create_complete(uint16_t start_page) { return (get_curr_state(start_page, CREATE_STATE_OFFSET, CREATE_STATE_DONE)); } static bool is_delete_complete(uint16_t start_page) { return (get_curr_state(start_page, DELETE_STATE_OFFSET, DELETE_STATE_DONE)); ...
{ const int file_namelen_offset = FILEHEADER_OFFSET + offsetof(FileHeader, file_namelen); uint8_t namelen = strlen(name); for (uint16_t pg = 0; pg < s_pfs_page_count; pg++) { PageHeader pg_hdr; FileHeader file_hdr; pg_hdr.page_flags = prv_get_page_flags(pg); if (!IS_PAGE_TYPE(pg_hdr.page_f...
// Populates 'hdr' with what the new erase header for the 'page' specified // should look like static int get_updated_erase_hdr(PageHeader *hdr, uint16_t page) { memset(hdr, 0xff, sizeof(*hdr)); // before wiping a page, get its erase_count. This is not currently used but // enables future wear leveling improve...
llback(&it, NULL); \ } \ } while(0); #define RCV_RESET_REQUEST() \ RCV_APP_MESSAGE(TupletBytes(PostMessageKeyResetRequest, NULL, 0)); #define RCV_RESET_COMPLETE() \ RCV_APP_MESSAGE(TupletBytes(PostMessageKeyResetComplete, \ (const uint8_t *)&VALID_RESET_COMPLETE, sizeof(VALID_RESET_COMPLE...
(TupletBytes(PostMessageKeyResetRequest, NULL, 0))
; // TODO: check fields cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteLocalInitiated); } void test_rocky_api_app_message__awaiting_reset_request__disconnect(void) { prv_init_api(false /* start_connected */); prv_simulate_transport_connection_even...
type = LayoutNodeType_Horizontal, .container.num_nodes = ARRAY_LENGTH(s_horizontal_config_nodes), .container.nodes = (LayoutNodeConfig **)&s_horizontal_config_nodes, }; GTextNodeHorizontal *horizontal_node = (GTextNodeHorizontal *)layout_create_text_node_from_config( &layout->layout_layer, ...
attribute_get_string(attributes, AttributeIdShortTitle, NULL)
?: attribute_get_string(attributes, layout->impl->attributes.primary_id, ""); primary_node->line_spacing_delta = style->primary_line_spacing_delta; int num_primary_lines = is_fat ? 2 : 1; if (is_peek) { if (!has_secondary) { num_primary_lines = 2; const int primary_only_offset...
not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES O...
(buffer, address, chunk_size)
; PBL_LOG(LOG_LEVEL_ALWAYS, "Data at address 0x%"PRIx32, address); hexdump_log(LOG_LEVEL_ALWAYS, buffer, chunk_size); address += chunk_size; length -= chunk_size; } // Go back to the prompt. serial_console_set_state(SERIAL_CONSOLE_STATE_PROMPT); } void command_crc_flash(const char* address_str...
itr, &itr_data); return itr_data.key_out; } BTBondingID bt_persistent_storage_store_bt_classic_pairing(BTDeviceAddress *address, SM128BitKey *link_key, char *name, uint8_t *platform_bits) { if (!a...
{ PBL_LOG(LOG_LEVEL_ERROR, "Not getting BT Classic id %d. Type mismatch", bonding); return false; }
if (address_out) { *address_out = data.bt_classic_data.addr; } if (link_key_out) { *link_key_out = data.bt_classic_data.link_key; } if (name_out) { strncpy(name_out, data.bt_classic_data.name, BT_DEVICE_NAME_BUFFER_SIZE); name_out[BT_DEVICE_NAME_BUFFER_SIZE - 1] = 0; } if (platform_bits_...
/* * 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(is_complete == true)
p://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permis...
(head == &bar1.list_node)
; cl_assert(list_get_next(head) == &bar2.list_node); cl_assert(list_get_tail(head) == &bar3.list_node); } void test_list__sort_descending(void) { IntNode bar1 = { .value = 1 }; IntNode bar2 = { .value = 2 }; IntNode bar3 = { .value = 3 }; ListNode* head = 0; head = list_sorted_add(head, &bar2.list_node...
t GSize top_rects_size = GSize(bitmap_bounds_size->w / 4, bitmap_bounds_size->h * 2 / 5); const int16_t top_rects_x_offset = ((bitmap_bounds_size->w / 2) - top_rects_size.w) / 2; GColor top_rects_color = GColorGreen; top_rects_color.a = 2; const GRect top_left_rect = (GRect) { .origin = GPoint(top_rects_x_o...
(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1)
{ 1704, 24, 552}, { 1584, -24, 560}, { 1536, 32, 472}, { 1472, -16, 488}, { 1600, 144, 432}, { 1296, 288, 240}, { 1016, -16, -744}, { 744, 208, -720}, { 672, 160, -200}, { 1296, 464, 80}, { 1352, 160, 288}, { 1432, 144, 496}, { 1528, 48, 536}, // 254 seconds {...
{ 600, 480, 1456}, { 672, 208, 1432}, { 880, 208, 1248}, { 1048, 176, 944}, { 1456, 184, 912}, { 1896, 144, 864}, { 1792, 48, 664}, { 1672, 88, 560}, { 1688, 64, 560}, { 1856, -32, 560}, { 1640, -104, 456}, { 1480, 88, 376}, { 1368, 8, -256}, { 664, -56, -904}, ...
/* * 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 TimelineArgs s_timeline_args; const bool is_up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP); if (is_up) { PBL_LOG(LOG_LEVEL_DEBUG, "Launching timeline in past mode."); s_timeline_args.direction = TimelineIterDirectionPast; analytics_inc(ANALYTICS_DEVICE_METRIC_TIMELINE_PAST_...
static void prv_configure_click_handler(ButtonId button_id, ClickHandler single_click_handler) { ClickConfig *cfg = &s_click_manager.recognizers[button_id].config; cfg->long_click.delay_ms = QUICK_LAUNCH_HOLD_MS; cfg->long_click.handler = prv_quick_launch_handler; cfg->click.handler = single_click_handler; } ...
RMALIZED_MIN); #endif } // -------------------------------------------------------------------------------------- // Test the get_duration call on a sequence animation void test_animation__sequence_get_duration(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int delay_a = 100; const int p...
animation_get_duration(b, false, false)
1.integer <= y2.integer) { prv_update_mask(ctx, y1.integer, x, x, color); y1.integer++; } // last pixel with blending (don't render first *and* last pixel if line length is 1) if (y2.fraction != 0) { prv_blend_color_and_update_mask(ctx, y1.integer, x, x, color, (uint8_t)y2.fraction); } } T_STATIC ...
if (x1.integer > clip_box_max_x) { break; }
prv_blend_color_and_update_mask(ctx, y, x1.integer, x1.integer, color, (uint8_t)(FIXED_S16_3_ONE.raw_value * (right_aa_offset - i) / right_aa_offset)); x1.integer++; } } } const GDrawRawImplementation g_mask_recording_draw...
land has a half-hour DST if (tz_info->dst_id == DSTID_LORDHOWE) { uxtime -= time_tm.tm_isdst ? SECONDS_PER_HOUR / 2 : 0; } else { uxtime -= time_tm.tm_isdst ? SECONDS_PER_HOUR : 0; } uxtime -= time_tm.tm_gmtoff; return uxtime; } #endif // RECOVERY_FW T_STATIC void prv_update_dstrule_timestamps_by_dst...
if (clock_is_timezone_set()) { // We'll need to update timezone stamps. time_t tz_adjust_time; // Get the time that we need to adjust for. if (t) { tz_adjust_time = *t; } else { tz_adjust_time = orig_utc_time; } if (tz_info) { // Adjust the DST rule timestamps of the provided tz_info...
// Note: update the timezone before setting the utc time. (If we set the utc // time first we could wind up accidentally applying the timezone correction // to that value in the case where no timezone data previously existed // ... such as a migration from legacy firmware or after the RTC backup // domain h...
iting_mode); // Then redraw the two variations offset so the bottom right edge of the right variation // is aligned with the bottom right edge of the framebuffer const GPoint framebuffer_bottom_right_point = GPoint(grect_get_max_x(&s_ctx.dest_bitmap.bounds), grect_get_max_y(&s_ctx.dest_b...
GPoint(25, 0)
); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_bitmap_layer_across_nx(void) { prv_offset_bitmap_layer_test(GPoint(-25, 0)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_bitmap_layer_across_y(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...
{ uint32_t time_ms = 24 * 7 * 60 * 60 * 1000; cl_assert_equal_i(milliseconds_to_ticks(time_ms), (uint32_t)milliseconds_to_ticks_double(time_ms)); }
/* * 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...
(&region, (void*) 9999)
); } void test_memory_layout__cstring_in_region(void) { const char buffer[] = "yyyxxxstrstr\0badstrxxxyyy"; const char *valid_str = buffer + 6; // skip yyyxxx, equal to "strstr" const char *invalid_str = buffer + 6 + 7; // skip yyyxxx + strstr\0, equal to "badstr" but no trailing null MpuRegion region = { ...
t_enable = 0x66, .reset = 0x99, .qspi_id = 0xAF, .block_lock = 0x36, .block_lock_status = 0x3C, .block_unlock_all = 0x98, .write_protection_enable = 0x68, .read_protection_status = 0x2B, }, .status_bit_masks = { .busy = 1 << 0, .write_enable = 1 << 1, }, .flag_status_bit_ma...
{ PBL_ASSERT(buffer_size > 0, "flash_impl_read_sync() called with 0 bytes to read"); qspi_flash_read_blocking(QSPI_FLASH, start_addr, buffer_ptr, buffer_size); return S_SUCCESS; }
int flash_impl_write_page_begin(const void *buffer, const FlashAddress start_addr, size_t len) { return qspi_flash_write_page_begin(QSPI_FLASH, buffer, start_addr, len); } status_t flash_impl_get_write_status(void) { return qspi_flash_get_write_status(QSPI_FLASH); } status_t flash_impl_enter_low_power_mode(void...
iner *container) { GTextNodeText *text_node = graphics_text_node_create_text(buffer_size); if (container) { graphics_text_node_container_add_child(container, &text_node->node); } text_node->font = font; text_node->color = color; return text_node; } GTextNodeText *health_util_create_text_node_with_text(...
{ case UnitsDistance_Miles: return miles_string; case UnitsDistance_KM: return km_string; case UnitsDistanceCount: break; }
return ""; } int health_util_format_distance(char *buffer, size_t buffer_size, uint32_t distance_m) { return health_util_format_whole_and_decimal(buffer, buffer_size, distance_m, health_util_get_distance_factor()); } void health_util_convert_distance_to_whole_and_dec...
********/ void test_app_install_manager__get_id_invalid_uuid(void) { const Uuid made_up = {0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17}; cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&made_up)); cl_assert_equal_i...
(false, app_install_is_hidden(tictoc_id))
; cl_assert_equal_b(false, app_install_is_hidden(music_id)); cl_assert_equal_b(true, app_install_is_hidden(sports_id)); cl_assert_equal_b(false, app_install_is_hidden(bg_counter_id)); cl_assert_equal_b(false, app_install_is_hidden(menu_layer_id)); cl_assert_equal_b(false, app_install_is_hidden(CRAZY_ID)); }...
task_cb, (void*)(uintptr_t)(check_counter == 0)); // force a flush every 15 minutes static const int EMPTY_ALL_SESSIONS_INTERVAL_MINUTES = 15 / DATALOGGING_DO_FLUSH_CHECK_INTERVAL_MINUTES; check_counter = (check_counter + 1) % EMPTY_ALL_SESSIONS_INTERVAL_MINUTES; } // ---------...
dls_storage_rebuild()
; // add callbacks to empty and check logging_sessions dls_resume(); s_initialized = true; } // ---------------------------------------------------------------------------------------- bool dls_initialized(void) { return s_initialized; } // ------------------------------------------------------------------...
// Entry we are currently processing FILE *file; // File we currently have open SampleFileType type; // type of samples } SampleDiscoveryState; #define ACCEL_SAMPLES_DISCOVERY_MAX_SAMPLES (12 * SECONDS_PER_MINUTE * KALG_SAMPLE_HZ) typedef struct { SampleDiscoveryState c...
if (state->test_entry.num_samples > 0) { return true; } else { return false; }
} // --------------------------------------------------------------------------------------- static bool prv_parse_sleep_samples_file(SleepSampleDiscoveryState *state) { // Init for next set of samples state->test_entry = (SleepFileTestEntry) { .samples = state->samples, .version = 1, .total = {-1, -...
vileged } void test_app_manager__start_first(void) { cl_assert(app_manager_get_current_app_md() == NULL); app_manager_start_first_app(); cl_assert(app_manager_get_current_app_md() == (PebbleProcessMd*) &s_launch_app); cl_assert(s_last_to_app_event.type == 0); app_manager_get_task_context()->safe_to_kill = ...
app_manager_get_current_app_md()
== (PebbleProcessMd*) &s_root_app); } void test_app_manager__override_next_app_with_watchface_using_action_performed_exit_reason(void) { test_app_manager__start_first(); // Check that the default exit reason is "not specified" const AppExitReason default_exit_reason = app_exit_reason_get(); cl_assert_equal_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...
{ LauncherAppGlanceStructured *structured_glance = user_data; LauncherAppGlanceNotifications *notifications_glance = launcher_app_glance_structured_get_data(structured_glance); if (notifications_glance) { strncpy(buffer, notifications_glance->subtitle, buffer_size); buffer[buffer_size - 1] = '\0'; ...
static GTextNode *prv_create_subtitle_node(LauncherAppGlanceStructured *structured_glance) { return launcher_app_glance_structured_create_subtitle_text_node( structured_glance, prv_notifications_glance_subtitle_dynamic_text_node_update); } static void prv_destructor(LauncherAppGlanceStructured *structured_gl...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_set_text(&data->text, data->text_buffer)
; toggle_color(window); // Let's try shortening the repeat interval as we go: ClickConfig *config = click_recognizer_get_config(recognizer); config->click.repeat_interval_ms = MAX((config->click.repeat_interval_ms / 2), 100); } static void select_long_click_handler(ClickRecognizerRef recognizer, Window *windo...
/* * 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 (data->is_peek_layer_used) { Layer *root_layer = window_get_root_layer(&data->window); PeekLayer *peek_layer = &data->peek_layer; peek_layer_play(peek_layer); layer_add_child(root_layer, (Layer *)peek_layer); const int standing_ms = 1 * MS_PER_SECOND; data->peek_layer_timer = evented_tim...
static void prv_animation_stopped_failure(Animation *animation, bool finished, void *context) { ProgressWindow *data = context; prv_show_peek_layer(data); } static void prv_schedule_progress_success_animation(ProgressWindow *data) { #if !PLATFORM_TINTIN GRect beg = data->progress_layer.layer.bounds; GRect mi...
st_graphics_context_init(&ctx, &framebuffer); } void test_bitblt_palette__cleanup(void) { } void test_bitblt_palette__1Bit_color(void) { const int BITS_PER_PIXEL = 1; const int PIXELS_PER_BYTE = (8 / BITS_PER_PIXEL); const int WIDTH = 2; const int HEIGHT = 2; const int ROW_STRIDE = (WIDTH + (PIXELS_PER_BYTE...
for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { packed_pixel_set(s_data, x /* color_index */, x, y, BITS_PER_PIXEL, s_bmp.row_size_bytes); } }
memset(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_data)); #if SCREEN_COLOR_DEPTH_BITS == 8 char print_buf[20]; for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { snprintf(print_buf, sizeof(print_buf), "Failed index = %d, %d", x, y); cl_check_(gcolor_equal(get_bitma...
sed on current or previous animation if (!current) { curr_offset = 0; } else { curr_offset = (-timeline_layer->move_delta) * (REL_BAR_BACK_TO_BACK_OFFSET - curr_offset); prev_offset = 0; } GRect first_icon_frame; GRect second_icon_frame; const int line_length = prv_get_line_length(timelin...
(&first_icon_frame)
+ REL_BAR_VERT_MARGIN - y_offset + REL_BAR_LINE_WIDTH; graphics_fill_rect(ctx, &GRect(line1_start.x, line1_start.y, REL_BAR_OVERLAP_STROKE_WIDTH, line_length)); GRect notch = GRectZero; notch.origin.x = line1_start.x - REL_BAR_LINE_NOTCH_HORIZ_OFFSET + 1; not...
---------------- static void prv_do_double_tap_handle(PebbleEvent *e, void *context) { PebbleTask task = pebble_task_get_current(); AccelServiceState *state = (AccelServiceState *)accel_service_private_get_session(task); PBL_ASSERTN(state->double_tap_handler != NULL); // only kernel clients can subscribe to dou...
{ AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); return accel_session_set_samples_per_update(session, samples_per_update); }
, 104, -224}, { 928, 64, -128}, { 856, 0, 96}, { 992, 80, -168}, { 1176, 256, -264}, { 1184, 352, -448}, { 1480, 312, -216}, { 1424, 192, 8}, // 110 seconds { 1176, 304, -384}, { 840, 480, -360}, { 744, 352, -224}, { 760, 384, -232}, { 824, 464, -320}, { 856, 552,...
{ 576, 40, -8}, { 560, 80, 0}, { 648, 152, 56}, { 896, 296, -40}, { 1264, 256, 24}, { 1464, 320, -120}, { 1464, 336, -256}, { 1464, 312, -152}, { 1312, 296, -152}, { 976, 320, -456}, { 736, 256, -360}, { 696, 320, -264}, { 712, 352, -320}, { 776, 440, -360}, {...
{ 960, 432, -408}, { 752, 448, -312}, // 118 seconds { 720, 432, -272}, { 792, 488, -304}, { 888, 536, -336}, { 856, 576, -296}, { 928, 656, -384}, { 912, 664, -296}, { 1144, 656, -232}, { 1248, 664, -232}, { 1304, 744, -288}, { 1632, 656, -104}, { 1752, 544, -48...
rue /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); memset(&s_font_info, 0, sizeof(s_font_info)); resource_init(); fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_C...
(s_dest_bitmap, TEST_PBI_FILE)
/* * 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...
send_golf_cmd(CMD_SELECT)
; } static void config_provider(AppData *data) { window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler) up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) down_click_handler); window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler) select_click_handler); } static void win...
/* * 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...
{ // File doesn't exist, need to create a new file. fd = pfs_open(ORDER_FILE, OP_FLAG_WRITE, FILE_TYPE_STATIC, storage_size); }
if (fd < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Could not create app menu order file"); goto cleanup; } // write back the whole file int wrote_storage_bytes = pfs_write(fd, (uint8_t *)storage, storage_size); if (wrote_storage_bytes != storage_size) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to write all bytes...
240, 408, 88}, { 1280, 336, 128}, { 1336, 272, 184}, { 1232, 216, 224}, { 1152, 200, 184}, { 1056, 208, 120}, { 984, 248, 96}, { 952, 232, 128}, { 1072, 216, 96}, { 1112, 184, 112}, { 1208, 192, 40}, { 1368, 176, -272}, { 1312, 136, -432}, { 1200, -64, -280}, { 10...
{ 1048, 640, 16}, { 1232, 728, -96}, { 1248, 472, -320}, { 952, 384, -120}, { 1128, 496, -72}, { 1424, 472, -64}, { 1440, 368, 16}, { 1328, 160, 32}, // 54 seconds { 1264, 8, 72}, { 1200, -8, 0}, { 1088, 104, -16}, { 1000, 160, -64}, { 840, 192, -96}, { 1024, ...
{ 1112, 184, 16}, { 928, 184, -64}, { 1000, 136, -80}, { 1304, 120, -64}, { 1128, 288, -224}, { 1248, 232, -368}, { 1528, 240, -384}, { 1184, 160, -248}, { 792, 72, -264}, { 896, 152, -280}, { 992, 240, -216}, { 1072, 376, -232}, { 992, 624, -216}, { 792, 744, -1...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_s(buffer, "test_model")
; } void test_spalding_mfg_info__1_to_3_conversion(void) { // Force in an old data version. typedef struct { uint32_t data_version; uint32_t color; uint32_t rtc_freq; } MfgDataV1; MfgDataV1 old_data = { .data_version = 1, .color = 3, .rtc_freq = 4 }; flash_write_bytes((c...
int val_len = sizeof(val); set_and_verify(&file, key, key_len, val, val_len); // setting a byte to all 0s should work settings_file_set_byte(&file, key, key_len, 2, 0x00); val[2] &= 0x00; verify(&file, key, key_len, val, val_len); // setting all 1s should do nothing - only reset bytes are applied setti...
cl_assert_equal_i(NUM_RECORDS - 1, after_count - before_count)
; }
/* * 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...
{ ProgressWindow *data = context; const bool success = true; prv_finished(data, success); }
static void prv_finished_failure_callback(void *data) { const bool success = false; prv_finished(data, success); } static void prv_show_peek_layer(ProgressWindow *data) { if (data->is_peek_layer_used) { Layer *root_layer = window_get_root_layer(&data->window); PeekLayer *peek_layer = &data->peek_layer;...
char *dismiss_text = i18n_noop("Alarm dismissed"); dialog_set_text(dialog, i18n_get(dismiss_text, dialog)); i18n_free(dismiss_text, dialog); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); dialog_set_background_color(dialog, GColorJaegerGreen); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DISMI...
(s_alarm_popup_data->alarm_popup)
; } static void prv_snooze_click_handler(ClickRecognizerRef recognizer, void *data) { alarm_set_snooze_alarm(); prv_show_snooze_confirm_dialog(); actionable_dialog_pop(s_alarm_popup_data->alarm_popup); } static void prv_click_provider(void *context) { window_single_click_subscribe(BUTTON_ID_DOWN, prv_dismiss_...
s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 5 * SECONDS_PER_MINUTE; activity_insights_process_sleep_data(rtc_get_time()); // Pin added should have been called again, but with the same UUID cl_assert_equal_i(s_data.pins_added, 2); cl_assert(uuid_equal(&orig_id, &s_last_timeline_id)); // Mak...
(rtc_get_time())
; cl_assert_equal_i(s_data.pins_added, 1); // Re-init (simulates power cycle) and make sure we don't add a pin again activity_insights_init(rtc_get_time()); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 1); // Make sure we still merge properly after a power cyc...
/* * 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...
COBS_OVERHEAD(PULSE_MAX_SEND_SIZE)
*test_messages[] = { "A simple test log message! Woohoo!", "Another message", "ABCDEFG 0123456789", "Last simple test message" }; int num_messages = ARRAY_LENGTH(test_messages); setup_and_test_expected_msg((char **)test_messages, 0, 0, num_messages); } //! Auto generate unique log messages of ...
((uint8_t *)msg, start_addr, 1)
; cl_assert(rv); 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); uint32_t addr = FLASH_LOG_INVALID_ADDR; int loop_count = 0; char *log = malloc(100); int num_half_wraps = 0; int tot_half_wraps = 5; // make ...
stem_task.h" #include "services/normal/stationary.h" #include "shell/normal/battery_ui.h" #include "shell/prefs.h" #include "system/bootbits.h" #include "system/passert.h" #include "util/math.h" #include "util/size.h" #include "util/time/time.h" #include "system/version.h" #include "services/normal/activity/activity.h...
(status_layer)
); status_bar_layer_deinit(status_layer); } // Dialog callbacks for confirmation. //////////////////////////////////////////////////// static ConfirmationDialog *prv_settings_confirm(const char *title, const char *text, uint32_t resource_id) { ConfirmationDialog *con...
/* * 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...
{ horiz_advance = text_resources_get_glyph_horiz_advance(font_cache, codepoint, font); }
return MAX(horiz_advance, 0); } //////////////////////////////////////////////////////////// // Init functions //! @note can be init to a null-termination character void char_iter_init(Iterator* char_iter, CharIterState* char_iter_state, const TextBoxParams* const text_box_params, utf8_t* start) { Iterator* utf8...
window_stack_get_top_window(), ctx); SYS_PROFILER_NODE_STOP(render_app); } else { // TODO: PBL-17645 render container layer instead of the two windows WindowTransitioningContext *transition_context = &stack->transition_context; if (transition_context->implementation->render) { transition_contex...
app_state_get_applib_internal_events_info()
; struct tm currtime; sys_localtime_r(&e->clock_tick.tick_time, &currtime); const int minute_of_day = (currtime.tm_hour * 60) + currtime.tm_min; if (events_info->minute_of_last_legacy2_statusbar_change != minute_of_day) { events_info->minute_of_last_legacy2_statusbar_change = minute_of_day; ...
ksum.h" #include <stdint.h> #include <string.h> // Software implementation of the legacy checksum. This emulates the behaviour // of the CRC peripheral in the STM32F2/F4 series MCUs and the bugs in the // legacy CRC driver implementation. While the raw throughput of the hardware // CRC peripheral is greater, it is no...
legacy_defective_checksum_finish(&checksum)
; }
raphics_context_set_fill_color(GContext* ctx, GColor color) { record_mock_call(s_graphics_context_set_fill_color) { .ctx = ctx, .color = color, }; ctx->draw_state.fill_color = color; } static MockCallRecordings s_graphics_context_set_stroke_color; void graphics_context_set_stroke_color(GContext* ctx, GColor ...
strncpy(s_graphics_text_layout_get_max_used_size.last_call.max_used_size.text, text, sizeof(s_graphics_text_layout_get_max_used_size.last_call.max_used_size.text))
; return s_graphics_text_layout_get_max_used_size__result; } void test_rocky_api_graphics__initialize(void) { fake_app_timer_init(); rocky_runtime_context_init(); jerry_init(JERRY_INIT_EMPTY); s_app_window_stack_get_top_window = (Window){}; s_context = (GContext){}; s_app_state_get_graphics_context = &...
/dialogs/expandable_dialog.h" #include "apps/system_app_ids.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "services/normal/activity/activity_algorithm.h" #include "services/normal/activity/activity_insights.h" #include "services/normal/data_logging/data_logging_service.h" #in...
prv_convert_seconds_to_time(values[i], elapsed, sizeof(elapsed))
; char temp[32]; snprintf(temp, sizeof(temp), "\n%d: %s", i, elapsed); strcat(data->debug_card.dialog_text, temp); } prv_display_alert(data->debug_card.dialog_text); } // ----------------------------------------------------------------------------------------- static void prv_set_steps(int32_t steps, ...
"A simple test log message! Woohoo!", "Another message", "ABCDEFG 0123456789", "Last simple test message" }; int num_messages = ARRAY_LENGTH(test_messages); setup_and_test_expected_msg((char **)test_messages, 0, 0, num_messages); } //! Auto generate unique log messages of uniform length which span ...
cl_assert(rv)
+ 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(p...
(prv_count_handler_entries(&s_stopped_handler_calls, a), 2)
; cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0)...
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 distributed on a...
(dcache_line_size, 8)
; cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x24; s_user_size = 0x20; memory_cache_flush((void*)0x26, 0x2); cl_assert_equal_i(s_flush_addr, 0x20); cl_assert_equal_i(s_flush_size, 0x08); cl_assert_equal_i(s_invalidate_addr, 0x20); cl_assert_equal_i(s_invalidate_size, ...
" "), .expected_output = true, }, { .input = jerry_create_array(0), .expected_output = true, }, { .input = jerry_create_object(), .expected_output = true, }, { .input = jerry_create_external_function(prv_dummy), .expected_output = true, }, }; fo...
jerry_create_number(4095.875)