prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
t_classic_data)); } else { // Just updating the name prv_update_and_cleanup_struct_async(device_name, MEMBER_SIZE(BTClassicPairingData, name), offsetof(SharedPRFData, bt_classic_data) + offsetof(BTClassicPairingData, name)); } } void shared_prf_storage_store_bt_classic_pairing_data( BTD...
mutex_create()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
layer_set_clips(&card_timeline_layout->icon_layer.layer, false)
; // TODO: PBL-28738 Refactor kino reel transform APIs or usage of APIs // There is a lot of shared code throughout, and the API is code space intensive const bool take_ownership = true; KinoReel *new_reel = kino_reel_scale_segmented_create(from_reel, take_ownership, icon_to); kino_reel_transform_set_from_fr...
TRIC_FLASH_READ_BYTES_COUNT, s_system_analytics_read_bytes_count, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_FLASH_WRITE_BYTES_COUNT, s_system_analytics_write_bytes_count, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_FLASH_ERASE_COUNT, ...
PBL_LOG(LOG_LEVEL_ERROR, "Giving up on restarting the flash erase."); break; } } } flash_impl_clear_nvram_erase_status(); mutex_unlock(s_flash_lock); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pfs_format(false)
; // Load pre-migration wakeup entry onto pfs SettingsFile file; const int32_t timestamp = TIMESTAMP; // Create the Migration Entry w_entry = (WakeupEntryV1) { .uuid = app_uuid, .reason = WAKEUP_REASON, .repeating = false, .repeat_hours_missed = 0, .notify_if_missed = true }; open_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...
if (is_found) { // Check that attribute length is valid bool attr_length_invalid = (attr_list[i].max_length != 0) && (attr->length > attr_list[i].max_length); if (attr_length_invalid) { PBL_LOG(LOG_LEVEL_INFO, "Length of ANCS attribute %d is invalid: length: %d, max_length: %d", ...
} if (!is_found) { // The attribute was unexpected, the dictionary is malformed PBL_LOG(LOG_LEVEL_INFO, "Unexpected ANCS attribute. ID = %d. The dictionary is malformed", attr->id); *out_error = true; return false; } extracted_complete_attribute = ((uint8_t*)attr...
saddlebrown", GColorARGB8FromHEX(0x8b4513)}, {"salmon", GColorARGB8FromHEX(0xfa8072)}, {"sandybrown", GColorARGB8FromHEX(0xf4a460)}, {"seagreen", GColorARGB8FromHEX(0x2e8b57)}, {"seashell", GColorARGB8FromHEX(0xfff5ee)}, {"sienna", GColorARGB8FromHEX(0xa0522d)}, {"skyblue", GColorARGB8FromHEX(0x87ceeb)}, ...
if (s_color_definitions[i].name && strcmp(s_color_definitions[i].name, color_value) == 0) { if (parsed_color) { *parsed_color = (GColor8) {.argb = s_color_definitions[i].value}; } return true; }
le_info(false /*compact_first*/, &num_records, &data_bytes, &minutes); s_alg_state->num_minute_records = num_records; PBL_LOG(LOG_LEVEL_DEBUG, "Found %"PRIu16" records in minute file", s_alg_state->num_minute_records); // Reset all metrics activity_algorithm_metrics_changed_notification(); // Ret...
activity_metrics_prv_get_distance_mm()
_old_firmware"); return system_flash_erase( FIRMWARE_BASE, firmware_length, prv_display_erase_progress, 0); } static void prv_display_write_progress( uint32_t progress, uint32_t total, void *ctx) { display_firmware_update_progress(progress/2 + total/2, total); } static bool write_new_firmware( uin...
(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS)
; boot_bit_clear(BOOT_BIT_NEW_FW_AVAILABLE); boot_bit_set(BOOT_BIT_NEW_FW_INSTALLED); } bool switch_to_recovery_fw() { dbgserial_putstr("Loading recovery firmware"); UpdateFirmwareResult result = update_fw(FLASH_REGION_SAFE_FIRMWARE_BEGIN); bool recovery_fw_ok = true; switch (result) { case UPDATE_FW_SU...
JERRY_ARGS_MAKE(input); ROCKY_ARGS_ASSIGN(ROCKY_ARG(output)); cl_assert_equal_b(output, cases[i].expected_output); ASSERT_JS_ERROR(error_value, NULL /* Never errors out! */); jerry_release_value(input); cases[i].input = 0; } }
void test_rocky_api_util_args__string(void) { struct { jerry_value_t input; char *expected_output; } cases[] = { { .input = jerry_create_boolean(false), .expected_output = "false", }, { .input = jerry_create_number(0.0), .expected_output = "0", }, { .input...
v_push_before_time_menu(SettingsTimelinePeekData *data) { /// Shows up in the Timeline settings as the title for the "Timing" submenu window. const char *title = i18n_noop("Timing"); const int selected = prv_before_time_min_to_index(timeline_peek_prefs_get_before_time()); const OptionMenuCallbacks callbacks = {...
("Timeline Quick View First Use")
, RESOURCE_ID_SUNNY_DAY_TINY, text, GColorBlack, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite), NULL, RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_push_settings_window); expandable_dialog_set_header(expandable_dialog, header); #if PBL_ROUND expandable_dialog_set_header_font(expandable_dialog, ...
ar *s1); void clar__assert( int condition, const char *file, int line, const char *error_msg, const char *description, int should_abort) { struct clar_error *error; if (condition) return; #ifndef _WIN32 #ifdef UNITTEST_DEBUG // Break in debugger: raise(SIGINT); #endif #endif error = calloc...
for (i = 0; i < len; i++) { // Multiple of 16 means new line (with line offset). if ((i % 16) == 0) { // Just don't print ASCII for the zeroth line. if (i != 0) { printf(" %s\n", buff); } // Output the offset. printf(" %04x ", i); } // Now the hex code for the ...
// Pad out last line if not exactly 16 characters. while ((i % 16) != 0) { printf(" "); i++; } // And print the final ASCII bit. printf(" %s\n", buff); } void clar__assert_equal_m( uint8_t *m1, uint8_t *m2, int n, const char *file, int line, const char *err, int should_abort) { ...
ete_isr); } static void prv_handle_int_waiting_for_sending(void) { s_spi_transport.state = SPITransportState_Sending; dialog_spi_send_and_receive_dma(s_spi_transport.tx_read_ptr, NULL, s_spi_transport.bytes_sendable_count, prv_handle_sending_compl...
{ prv_watchdog_start(); s_spi_transport.state = SPITransportState_WaitingForReceiving; }
else if (s_spi_transport.bytes_sendable_count) { prv_watchdog_start(); s_spi_transport.state = SPITransportState_WaitingForSending; } else { // Nothing to send nor receive, back to idle: s_spi_transport.state = SPITransportState_Idle; } } static void prv_update_local_status_msg(void) { prv_lock(...
nt32_t SOME_DATA_KEY = 0xb00bf00b; static const uint8_t SOME_DATA[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; static const uint32_t SOME_STRING_KEY = 0xbeefbabe; static const char *SOME_STRING = "Hello World"; static const uint32_t SOME_NULL_KEY = 0x0; static const uint32_t SOME_EMPTY_STRING_KEY = 0x1; static const char *SO...
cl_assert(result == DICT_OK)
(string_buffer != NULL)
; PBL_ASSERTN(payload != NULL); uint8_t *buf_end = (uint8_t *)string_buffer + string_buffer_size; return attributes_actions_deserialize(&item->attr_list, &item->action_group, (uint8_t*) string_buffer, buf_end, payload, payload_size); } void timeline_item_destroy(Timeline...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(job->cached_execute_time, target)
4, GCornersAll); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 20, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitm...
("clear_over_black", ctx.parent_framebuffer, GColorWhite)
); } #define RECT_WIDTH 30 #define RECT_HEIGHT 40 #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 144, 168) #define ORIGIN_DRAW_RECT_NO_CLIP GRect(6, 6, RECT_WIDTH, RECT_HEIGH...
reate_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID, TEST_PAYLOAD, sizeof(TEST_PAYLOAD)); size_t length = comm_session_send_queue_get_length(s_app_session_ptr); comm_session_send_queue_consume(s_app_session_ptr, length - 1); comm_session_send_queue_cl...
memset(bytes_out, 0xff, length)
; // Copy & consume one byte of the header -- note the header is 4 bytes total: size_t first_length = num_bytes; cl_assert_equal_i(first_length, comm_session_send_queue_copy(s_app_session_ptr, 0, first_length, bytes_out)); comm_session_send_queue_c...
add_uint32(&negative_attr_list, AttributeIdIconLarge, notif_config->icon_negative_response); const int num_actions = 3; TimelineItemActionGroup action_group = { .num_actions = num_actions, .actions = (TimelineItemAction[]) { { .id = ActivityInsightResponseTypePosit...
{ AttributeList open_attr_list = {0}; prv_set_open_app_action(&open_attr_list, health_card_type, pin_attr_list); AttributeList remove_attr_list = {0}; attribute_list_add_cstring(&remove_attr_list, AttributeIdTitle, i18n_get("Remove", pi...
TimelineItemTypePin, layout_id, pin_attr_list, &action_group); for (int i = 0; i < num_responses; i++) { ResponseItem *response_item = &response_items[i]; attribute_list_destroy_list(&resp...
l_change(MenuLayer *UNUSED menu_layer, MenuIndex *new_index, MenuIndex UNUSED old_index, void *context) { LauncherMenuLayer *launcher_menu_layer = context; prv_play_glance_for_row(launcher_menu_layer, new_index->row); } T_STATIC void prv_launcher_menu_layer_set_sele...
(content_indicator, ContentIndicatorDirectionUp, &content_indicator_config)
; content_indicator_config.layer = down_arrow_layer; content_indicator_configure_direction(content_indicator, ContentIndicatorDirectionDown, &content_indicator_config); #endif // Wait to add the menu layer until after we might have added the content indicators because //...
d = 0 }; #else timezone_database_load_region_info(region_id, tz_info); prv_update_dstrule_timestamps_by_dstzone_id(tz_info, utc_time); #endif } static TimezoneInfo prv_get_timezone_info_from_data(TimezoneCBData *tz_data) { int region_id = -1; if (tz_data->region_name_len) { region_id = timezone_database_f...
if (clock_is_timezone_set()) { new_time = prv_migrate_local_time_to_UTC(new_time); }
STEPS_OR_RETURN_ERROR(5); if (argc >= 4) { GRectPrecise rect; ROCKY_ARGS_ASSIGN_OR_RETURN_ERROR(ROCKY_ARG(rect)); grect_precise_standardize(&rect); // shift rectangle into coordinate system const int16_t half_pt = FIXED_S16_3_HALF.raw_value; rect.origin.x.raw_value -= half_pt; rect.origi...
jerry_create_undefined()
, NULL, 0); }
emote* stored_remote_create(void) { StoredRemote* remote = task_malloc_check(sizeof(*remote)); *remote = (StoredRemote){}; return remote; } static void prv_copy_device_name_with_fallback(StoredRemote *remote, const char *name) { if (!name || strlen(name) == 0) { i18n_get_with_buffer("<Untitled>", remote->n...
ble_hrm_is_sharing_to_connection(connection)
; #endif bt_unlock(); } } remote = (StoredRemote *)remote->list_node.next; } } static void prv_clear_remote_list(SettingsBluetoothData* data) { while (data->remote_list_head) { StoredRemote* remote = (StoredRemote*) data->remote_list_head; data->remote_list_head = list_pop_head(&remot...
------------------------------------------------------------------------------------- ActivityScalarStore activity_metrics_prv_steps_per_minute(void) { ActivityState *state = activity_private_state(); return state->steps_per_minute; } // ----------------------------------------------------------------------------...
{ state->hr.num_quality_samples++; }
state->hr.num_samples++; } // Update the timestamp used for figuring out when we should change the sampling period. // This is based on uptime so that it doesn't get messed up if the mobile changes the // UTC time on us. state->hr.last_sample_ts = now_uptime; // Save the BPM, quality, a...
true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoOK); // Simulate getting a Connection Complete event for the device from Bluetopia: prv_fake_connec...
gap_le_connect_connection_intents_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...
(text_heap_info, buf)
; layer_add_child(window_layer, text_layer_get_layer(text_heap_info)); } static void deinit(void) { // Don't free anything } static void s_main(void) { init(); app_event_loop(); deinit(); } const PebbleProcessMd* app_heap_demo_app_get_info(void) { static const PebbleProcessMdSystem s_app_heap_demo_app_in...
int32_t)(1<<((n)+1)))) - 1) // Set bits y..x in a bit-vector (x <= y; x, y >= 0) #define BITS_BETWEEN(x,y) (BITS(y) & ~BITS(x-1)) // Yo dawg, I heard you like tests so I put tests in your tests so you can test // your tests while you test! void test_system_flash__bit_range_macros(void) { cl_assert_equal_i(0b1, BITS(...
(FLASH_BASE, 512 KiB, error_in_middle_cb, &countdown)
); cl_assert(flash_locked); cl_assert_(countdown <= 0, "Callback not called enough times"); } void malloc_flash_data(uint32_t size) { flash_data_length = size; flash_written_data = malloc(size * sizeof(uint8_t)); cl_assert(flash_written_data); flash_written_flag = malloc(size * sizeof(bool)); cl_assert(...
{ regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); }
// Simulate receiving an ack for the last, after the roll-back, but before the packets are // retransmitted (the last part shouldn't matter much, but simplifies the test a bit) prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], (sn - 1) % PPOGATT_SN_MOD_DIV); // Some new data ...
day_separator; } ListViewConfig; static void prv_add_timeline_item(const TimelineItemConfig *config, bool past) { PBL_ASSERTN(config); TimelineItem *item = NULL; const time_t now = rtc_get_time(); const time_t timestamp = now + ((past ? -1 : 1) * config->relative_timestamp); if (config) { AttributeList l...
{ #if !PLATFORM_SPALDING prv_create_and_render_title_and_subtitle(false /* past */, MINUTES_PER_HOUR / 2); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE(); #endif }
void test_timeline_list_view__title_and_subtitle_free_time_future(void) { prv_create_and_render_title_and_subtitle(false /* past */, 5 /* first_duration_m */); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE(); } void test_timeline_list_view__title_and_subtitle_free_time_past(void) { prv_create_and_render_title_a...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_test_cache, &s_test_item[2])
; cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[0], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[1], &s_test_item[2], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[2], &ZERO_ITEM, sizeof(TestCacheItem)); circular_cache_push(&s_test_cache, &s_test_item[1]); cl_assert_equal_m(&s_c...
fake_event_clear_last()
; } void test_gatt_client_subscriptions__cleanup(void) { for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) { gatt_client_subscriptions_cleanup_by_client(c); } gap_le_connection_deinit(); gatt_client_subscription_cleanup(); fake_pbl_malloc_check_net_allocs(); fake_pbl_malloc_clear_tracking(); } // ----...
((const uint32_t [ACTIVITY_HISTORY_DAYS]){100, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTotalSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){2 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepRestfulSeconds, ...
(ActivityMetricSleepRestfulSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 1 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0}))
; activity_get_metric(ActivityMetricRestingKCalories, ACTIVITY_HISTORY_DAYS, actual_resting_kcalories); for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { if (i == 0) { cl_assert_equal_i(actual_resting_kcalories[i], s_exp_5pm_resting_kcalories); } else if (i == 1) { cl_asse...
/* * 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_set_override_mode(BtCtlModeOverrideStop)
; stop_mode_disable(InhibitorBluetooth); bt_driver_test_start(); } bool bt_test_bt_sig_rf_test_mode(void) { return bt_driver_test_enter_rf_test_mode(); } void bt_test_enter_hci_passthrough(void) { // redirect all communications to the BT module serial_console_set_state(SERIAL_CONSOLE_STATE_HCI_PASSTHROUGH)...
for a bit battery_set_fast_charge(false); data->fastcharge_enabled = false; } else if (charge_percent > PASS_BATTERY_PERCENTAGE) { // The reading can be a bit shaky in the short term (i.e. a flaky USB connection), or we // just started charging. Make sure we have settled before tra...
(window, true)
; tick_timer_service_subscribe(SECOND_UNIT, prv_handle_second_tick); app_window_stack_push(window, true /* Animated */); } static void s_main(void) { app_init(); app_event_loop(); } const PebbleProcessMd* mfg_runin_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_fu...
8}, // 63 seconds { 784, 40, -368}, { 608, 136, -408}, { 840, 72, -280}, { 888, -72, -360}, { 936, 0, -272}, { 1296, 280, -328}, { 1688, 504, -448}, { 1856, 568, -344}, { 1688, 800, -408}, { 1392, 544, -368}, { 1016, 696, -272}, { 1040, 776, -208}, { 1192, 1096, -...
{ 1416, 672, -352}, { 1120, 816, -336}, { 936, 880, -280}, { 1040, 912, -216}, { 1040, 752, -256}, { 1096, 672, -208}, { 1288, 536, -192}, { 1240, 328, -160}, { 1232, 272, -104}, { 1328, 296, -104}, { 1400, 248, -64}, { 1392, 224, -32}, { 1432, 168, -16}, { 1232, ...
{ 1368, 200, -64}, { 728, -352, -56}, { 648, -264, -296}, { 720, -504, -328}, { 880, -192, -384}, { 1160, -104, -400}, { 1200, 32, -280}, { 1192, 88, -168}, { 1256, 288, -216}, { 1472, 472, -160}, { 1848, 432, -248}, { 1832, 512, -176}, { 1776, 672, -184}, { 1472...
(dest_bitmap, src_bitmap, GPoint(0, dest_row), GCompOpAssign, GColorWhite); } } static void prv_shift_framebuffer_rows(GBitmap *dest_bitmap, int16_t start_row, int16_t end_row, int16_t shift_amount) { GBitmap src_bitmap = *dest_bitmap; prv_copy...
compositor_set_modal_transition_offset(GPoint(0, app_offset_y))
; } static void prv_slide_transition_animation_init(Animation *animation) { // Give a regular moook more time to stretch the anticipation const uint32_t duration = s_data.timeline_is_destination ? interpolate_moook_in_duration() : interpolate_moook_durat...
ng_call_ui; // Incoming call reply data TimelineItem *call_response_item; bool waiting_for_action_result; bool open_reply_menu_on_pop; void *action_handle; } PhoneUIData; static const PhoneStyle s_phone_style_default = { .icon_size = TimelineResourceSizeLarge, .icon_pos = { ICON_POSITION_X, PBL_IF_RECT_...
{ TimelineResourceInfo timeline_res = { .res_id = timeline_res_id, }; AppResourceInfo icon_res_info; timeline_resources_get_id(&timeline_res, s_phone_ui_data->style->icon_size, &icon_res_info); const ResourceId resource = icon_res_info.res_id; KinoReel *image = kino_reel_create_with_resource(resource);...
kino_layer_set_reel(&s_phone_ui_data->icon_layer, image, true); s_phone_ui_data->current_icon = image; s_phone_ui_data->current_icon_id = resource; #endif } #if !PLATFORM_TINTIN static void prv_update_color_boundary(void *subject, int16_t boundary) { s_phone_ui_data->bg_color.boundary = boundary; layer_mark...
serialized_attribute_list; result = attribute_get_buffer_size_for_serialized_attributes(3, &cursor, (uint8_t *)s_invalid_serialized_attribute_list + sizeof(s_invalid_serialized_attribute_list)); cl_assert(result < 0); } void test_timeline_item__deserialize_payload(void) { size_t buf_size = 18 + 9 + 6...
("", string_list_get_at(list, 2))
; cl_assert_equal_s("", string_list_get_at(list, 3)); // non-null-terminated string is treated as one string - this is the standard case // please note that the string will only be terminated if there's another \0 following // when deserializing the data, the deserializer will append the needed \0 list->seri...
res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; } else { File *f = &PFS_FD(fd).file; char file_name[f->namelen + 1]; file_name[f->namelen] = '\0'; memcpy(file_name, f->name, f->namelen); if ((res = pfs_close(fd)) >= 0) { res = pfs_remove(file_name); } } mutex_...
((uint8_t *)file_name, file_hdr.file_namelen, prv_page_to_flash_offset(pg) + FILE_NAME_OFFSET)
; file_name[file_hdr.file_namelen] = 0; if (callback && !callback(file_name)) { // Don't include continue; } // Make sure the rest of the page header contents are valid. We are doing this after the // filename filter call because it requires more flash reads and is likely slower than t...
is_master, device); } int GAP_LE_Disconnect(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR) { return 0; } int GAP_LE_Pair_Remote_Device(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, GAP_LE_Pa...
{ return &s_resolving_bd_addr; }
const BTDeviceInternal *fake_GAPAPI_get_device_resolving_to_fake_irk(void) { static BTDeviceInternal s_resolving_device; s_resolving_device = (const BTDeviceInternal) { .address = BDADDRToBTDeviceAddress(s_resolving_bd_addr), .is_random_address = true, }; return &s_resolving_device; } Boolean_t GAP_L...
ModalProperty_RenderRequested); cl_assert_equal_i(windows[3][1]->on_screen, true); cl_assert_equal_i(windows[3][1]->is_click_configured, true); cl_assert_equal_i(windows[2][1]->on_screen, true); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_i(windows[1][0]->on...
modal_manager_get_properties()
, ModalProperty_Exists | ModalProperty_CompositorTransitions | ModalProperty_RenderRequested | ModalProperty_Unfocused); cl_assert_equal_i(windows[3][1]->on_screen, true); cl_assert_equal_i(windows[3][1]->is_click_configured, false); cl_assert_equal_i(windows[3][0]->on_scre...
{ AncsAppNameStorageEntry entry = { .app_id = (ANCSAttribute *)app_id, }; AncsAppNameStorageEntry *found = circular_cache_get(s_cache, &entry); if (found) { return found->app_name; } else { return NULL; } }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_ctx, s_fb)
; read_pbi("no_litter_crop.png.pbi", &test_image); } void test_graphics_draw_bitmap__cleanup(void) { free(s_fb); free(test_image.addr); } // Layout Test Support //////////////////////////////////// #define TEST_LAYER_SIZE (GSize(64, 110)) #define TEST_LAYER_OFFSET_ORIGIN (GPoint(80, 55)) static GPoint s_layer...
flags return dev->periph->DR; } UARTRXErrorFlags uart_has_errored_out(UARTDevice *dev) { uint16_t errors = dev->periph->SR; UARTRXErrorFlags flags = { .parity_error = (errors & USART_FLAG_PE) != 0, .overrun_error = (errors & USART_FLAG_ORE) != 0, .framing_error = (errors & USART_FLAG_FE) != 0, ....
if (dev->state->rx_irq_handler(dev, data, &err_flags)) { should_context_switch = true; }
} } } if (dev->state->tx_irq_handler && dev->state->tx_int_enabled && uart_is_tx_ready(dev)) { if (dev->state->tx_irq_handler(dev)) { should_context_switch = true; } } portEND_SWITCHING_ISR(should_context_switch); } void uart_clear_all_interrupt_flags(UARTDevice *dev) { dev->periph->...
e_add_entry(bg_counter_id, bg_counter_size /* size */); cl_assert_equal_i(1, bg_counter_id); // load first app char filename_buf[32]; app_storage_get_file_name(filename_buf, sizeof(filename_buf), 1, PebbleTask_App); load_fixture_on_pfs(APP1_APP_FIXTURE_NAME, filename_buf); app_s...
(bg_counter_id)
); cl_assert_equal_b(false, prv_app_install_is_watchface(menu_layer_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(CRAZY_ID)); } void test_app_install_manager__get_uuid_for_install_id(void) { Uuid uuid = {}; cl_assert_equal_b(false, app_install_get_uuid_for_install_id(INSTALL_ID_INVALID, &uuid));...
/* * 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 (linear_distance < ANIMATION_NORMALIZED_MAX * 3/4) { return ANIMATION_NORMALIZED_MAX * 3/2 - linear_distance; } else { return linear_distance; }
string ListNode *find_str = list_find(s_head_callback_node_list, watch_list_find_str, (char *)callback_node->name); if (find_str == NULL) { kernel_free((void *)(callback_node->name)); } kernel_free(callback_node); mutex_unlock_recursive(s_pfs_mutex); } // IMPORTANT: This call assumes that the cal...
if (!IS_PAGE_TYPE(pg_hdr.page_flags, PAGE_FLAG_START_PAGE)) { continue; // only start pages contain file name info }
FileHeader file_hdr; prv_flash_read((uint8_t *)&file_hdr.file_namelen, sizeof(file_hdr.file_namelen), prv_page_to_flash_offset(pg) + file_namelen_offset); char file_name[file_hdr.file_namelen + 1]; prv_flash_read((uint8_t *)file_name, file_hdr.file_namelen, prv_p...
&data->title_text); text_layer_deinit(&data->info_text); i18n_free_all(data); } static void prv_push_kcc_window(SystemCertificationData *data) { window_init(&data->kcc_window, WINDOW_NAME("System KCC")); window_set_user_data(&data->kcc_window, data); window_set_window_handlers(&data->kcc_window, &(WindowHand...
(sizeof(SettingsSystemData))
; *data = (SettingsSystemData){}; data->callbacks = (SettingsCallbacks) { .deinit = prv_deinit_cb, .draw_row = prv_draw_row_cb, .select_click = prv_select_click_cb, .num_rows = prv_num_rows_cb, }; return settings_window_create(SettingsMenuItemSystem, &data->callbacks); } const SettingsModuleM...
/* * 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_get_next(&a)
///////////////// // List helper functions //////////////////////////////// static bool prv_is_app_filtered_out(AppInstallEntry *entry, AppMenuDataSource * const source) { return (source->callbacks.filter && (source->callbacks.filter(source, entry) == false)); } ///////////////////////// // Order List helpers /////...
if (other_node) { other_node->storage_order = new_storage_order; }
} } if (update_and_take_ownership) { app_free(storage); } } static void prv_sorted_add(AppMenuDataSource *source, AppMenuNode *menu_node) { // Update the entire list order only if we've just read the order in this context. If we haven't // just read the order, then we're building a list starting fro...
l empty = prv_buffer_empty(field, field_size); if (empty) { return true; } const uint32_t field_crc = *(uint32_t*)field; const bool valid_crc = (field_crc == crc32(CRC32_INIT, SPRF_FIELD_DATA(field), SPRF_FIELD_DATA_SIZE(field_size))); return valid_crc; } //! Return whether the entire SharedPRFDat...
if (!prv_valid_struct(data_out)) { PBL_LOG(LOG_LEVEL_WARNING, "Shared PRF Storage sector # %"PRIu32" is corrupted. Invalidating" " and starting a new one", s_valid_page_idx); prv_invalidate_current_page(); memset(data_out, 0xFF, sizeof(*data_out)); }
} static SharedPRFData *prv_alloc_and_fetch_struct(void) { SharedPRFData *data = kernel_zalloc_check(sizeof(SharedPRFData)); prv_fetch_struct(data); return data; } static void prv_dealloc_struct(SharedPRFData *data) { kernel_free(data); } static void prv_persist_field(uint8_t *field, size_t offset, size_t f...
usicPlayStatePaused) { window_single_click_subscribe(BUTTON_ID_SELECT, prv_play_pause_click_handler); } else { window_single_click_subscribe(BUTTON_ID_SELECT, prv_ellipsis_click_handler); } window_long_click_subscribe(BUTTON_ID_UP, 0, prv_volume_long_click_start_handler, prv_...
prv_create_no_music_window()
; app_window_stack_push(&data->no_music_window->window, false); } static void prv_pop_no_music_window(MusicAppData *data) { if (data->no_music_window) { app_window_stack_remove(&data->no_music_window->window, true); app_free(data->no_music_window); data->no_music_window = NULL; } } static void prv_u...
end of sleep, the last KALG_MAX_UNCERTAIN_SLEEP_M minutes are // uncertain *stats = (KAlgOngoingSleepStats) { .sleep_start_utc = s_kalg_sleep_start_utc, .sleep_len_m = (now - s_kalg_sleep_start_utc) / SECONDS_PER_MINUTE - KALG_MAX_UNCERTAIN_SLEEP_M, .uncertain...
(rtc_get_time(), &minute_record)
; if (simulate_bg_delays) { rtc_set_time(rtc_get_time() - delay); } } } // ============================================================================================= // Start of unit tests void test_activity_algorithm_kraepelin__initialize(void) { time_t utc_sec = mktime(&s_start_time_tm); fake...
>opcode = BULKIO_RESP_DOMAIN_OPEN; resp->fd = fd; pulse_reliable_send(resp, sizeof(*resp)); } static void prv_handle_close(Command *cmd, size_t length) { PulseTransferFD *pulse_fd = prv_get_fd(cmd, length); if (!pulse_fd) { // prv_get_fd has already sent an error response return; } status_t status...
(cmd->erase.data, payload_length, cmd->erase.cookie)
; if (ret == E_INVALID_ARGUMENT) { prv_respond_malformed_command(cmd, length, "Invalid domain data"); return; } if (ret == S_TRUE) { // Handler will send responses itself, we're done here return; } pulse_bulkio_erase_message_send(cmd->erase.domain, ret, cmd->erase.cookie);...
/* * 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...
(20, grect_longest_side(GRect(0, 0, 20, 10)))
; cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, 10, -20))); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, -20, 10))); } void test_gtypes__grect_shortest_side(void) { cl_assert_equal_i(0, grect_shortest_side(GRectZero)); cl_assert_equal_i(10, grect_shortest_side(GRect(0, 0, 10, 20))); cl_assert_...
/* * 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 ((pos + 4 > length - 1) || (*space == '\0')) { break; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&layer, &across_x_layer_update_callback)
* limitations under the License. */ #include "applib/app_watch_info.h" #include "drivers/flash.h" #include "flash_region/flash_region.h" #include "system/firmware_storage.h" #include "system/passert.h" #include "util/attributes.h" #include "util/build_id.h" #include "util/string.h" #include <stddef.h> #include <std...
(buffer, buffer_bytes_left, build_id, build_id_bytes_left, false)
; } void version_copy_current_build_id_hex_string(char *buffer, size_t buffer_bytes_left) { version_copy_build_id_hex_string(buffer, buffer_bytes_left, &TINTIN_BUILD_ID); } void version_get_major_minor_patch(unsigned int *major, unsigned int *minor, char const **patch_ptr) { *ma...
shPart QSPI_FLASH_PART = { .instructions = { .fast_read = 0x0B, .fast_read_ddr = 0x0D, .page_program = 0x02, .erase_sector_4k = 0x20, .erase_block_64k = 0xD8, .write_enable = 0x06, .write_disable = 0x04, .read_status = 0x05, .read_flag_status = 0x70, .erase_suspend = 0x75, ...
{ qspi_flash_erase_resume(QSPI_FLASH, sector_addr); return S_SUCCESS; }
status_t flash_impl_read_sync(void *buffer_ptr, FlashAddress start_addr, size_t buffer_size) { 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 ...
.small_cell_height = 42, .horizontal_inset = 10, .title_subtitle_left_margin = 34, }, //! @note these are the same as Large until ExtraLarge is designed [PreferredContentSizeExtraLarge] = { .basic_cell_height = 61, .small_cell_height = 42, .horizontal_inset = 10, .title_subtitle_left_marg...
{ // Offset by the cap offset to match round's icon-title delta box.origin.y += fonts_get_font_cap_offset(title_font); }
} if (config->icon_box_model) { box.origin = gpoint_add(box.origin, config->icon_box_model->offset); } left_margin = box.origin.x; prv_draw_icon(ctx, config->icon, &box, is_legacy2); } box = *bounds; if (icon_align == GAlignRight) { left_margin = horizontal_margin; box.size.w...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(10, 20, 100, 600)
); cl_assert_equal_grect(l.bounds, GRect(1, 1, 200, 599)); // act as 2.x once bounds.size isn't same as frame.size layer_set_bounds(&l, &GRect(0, 0, 150, 600)); layer_set_frame(&l, &GRect(10, 20, 100, 700)); cl_assert_equal_grect(l.bounds, GRect(0, 0, 150, 700)); }
p_Consecutive | StatsBasicOp_ConsecutiveFirst | StatsBasicOp_Median); struct { int32_t sum; int32_t avg; int32_t min; int32_t max; int32_t count; int32_t max_streak; int32_t first_streak; int32_t median; } result; stats_calculate_basic(op, data, num_data, NULL, NULL, &result...
stats_calculate_basic(op, data, num_data, NULL, NULL, &result.sum)
; cl_assert_equal_i(result.sum, 0); cl_assert_equal_i(result.avg, 0); cl_assert_equal_i(result.min, INT32_MAX); cl_assert_equal_i(result.max, INT32_MIN); cl_assert_equal_i(result.count, 0); cl_assert_equal_i(result.max_streak, 0); cl_assert_equal_i(result.first_streak, 0); cl_assert_equal_i(result.media...
ze of our filesystem in bytes. static uint32_t s_ftl_size; //! Keeps track of which regions are included in the filesystem. static unsigned int s_next_region_idx = 0; //! returns FSRegion size given idx in s_region_list static uint32_t prv_region_size(int idx) { return (s_region_list[idx].end - s_region_list[idx].s...
prv_region_size(idx)
; if (offset < curr_virt_offset_end) { uint32_t bytes = MIN(curr_virt_offset_end - offset, size); if (operation == FTLRead) { flash_read_bytes( buffer, s_region_list[idx].start + offset - curr_virt_offset_begin, bytes); } else if (operation == FTLWrite ) { flash_write_...
/* * 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...
(ps3->str_value, ps3_str, strlen(ps3_str))
; const char *ps4_str = "Phil"; uint8_t ps4_buf[128]; PascalString16 *ps4 = (PascalString16 *)&ps4_buf; ps4->str_length = strlen(ps4_str); memcpy(ps4->str_value, ps4_str, strlen(ps4_str)); cl_assert(pstring_equal(ps1, ps4)); cl_assert(!pstring_equal(ps1, ps2)); cl_assert(!pstring_equal(ps1, ps3)); ...
xt_init(); jerry_init(JERRY_INIT_EMPTY); } static void prv_deinit(void) { jerry_cleanup(); rocky_runtime_context_deinit(); } void test_js__initialize(void) { fake_pbl_malloc_clear_tracking(); s_skip_mem_leak_check = false; fake_app_timer_init(); prv_init(); s_app_window_stack_get_top_window = (Window...
cl_assert_equal_i(0, s_graphics_draw_line.call_count)
; cl_assert_equal_i(1, s_graphics_context_set_fill_color.call_count); cl_assert_equal_i(0, s_graphics_context_set_stroke_color.call_count); cl_assert_equal_i(0, s_graphics_context_set_stroke_width.call_count); } // run update proc multiple times to verify we don't have a memory leak for (int i = 1024...
ate = SessionState_StartSession; // check if we're being started from an app so we know to send the UUID when setting up a session s_from_app = ((pebble_task_get_current() == PebbleTask_App) && !app_install_id_from_system(app_manager_get_current_app_id())); if (s_from_app) { s_app_uuid = app_manager_ge...
{ prv_cancel_session(); VoiceStatus status = prv_get_status_from_result(result); PBL_LOG(LOG_LEVEL_WARNING, "Error occurred setting up session: %d", result); prv_send_event(VoiceEventTypeSessionSetup, status, NULL); goto done; }
if (app_initiated != s_from_app) { prv_cancel_session(); if (app_initiated) { PBL_LOG(LOG_LEVEL_WARNING, "Received session setup result for app initiated session when it " "was not expected"); } else { PBL_LOG(LOG_LEVEL_WARNING, "Received session setup result for non-app sessio...
TEST_OFFSET_Y (0) static bool prv_gbitmap_format_and_compositing_mode_combo_is_valid(GBitmapFormat bitmap_format, GCompOp compositing_mode) { return !((bitmap_format != GBitmapFormat1Bit) && ((compositing_mode == GCompOpAssignInverted) || ...
prv_origin_layer_test(GPoint(0, -40))
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_bitmap_layer_inside(void) { prv_origin_bitmap_layer_test(GPointZero); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_bitmap_layer_across_x(void) { prv_...
"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 "compositor_round_flip_transitions.h" #include "services/common/compositor/compositor_transitions.h" #inclu...
{ // Unwrap our animation configuration from the context RoundFlipTransitionAnimationConfiguration config = { .data = animation_get_context(animation) }; // Save a reference to the existing draw implementation const GDrawRawImplementation *saved_draw_implementation = ctx->draw_state.draw_implementation; ...
//! The transition direction here is the direction of the visual elements, not the motion static void prv_configure_round_flip_transition_animation(Animation *animation, CompositorTransitionDirection direction) { RoundFlipTransitionAnimationConfiguration con...
{ 448, 432, -776}, { 440, 392, -776}, { 448, 408, -768}, { 432, 368, -736}, { 464, 416, -728}, { 472, 416, -792}, { 432, 408, -768}, // 134 seconds { 440, 384, -776}, { 448, 408, -776}, { 440, 400, -768}, { 448, 392, -776}, { 448, 416, -760}, { 448, 400, -768}, { ...
{ 464, 400, -776}, { 488, 384, -776}, { 440, 416, -768}, { 456, 368, -776}, { 464, 368, -792}, { 456, 376, -776}, { 480, 384, -768}, { 448, 384, -768}, { 464, 384, -776}, { 464, 376, -784}, { 456, 376, -776}, { 480, 376, -768}, { 448, 392, -768}, { 464, 376, -776}...
{ 456, 392, -768}, // 142 seconds { 480, 392, -768}, { 448, 400, -776}, { 464, 400, -768}, { 464, 392, -768}, { 456, 392, -760}, { 480, 384, -752}, { 464, 416, -776}, { 448, 392, -768}, { 456, 384, -776}, { 464, 376, -776}, { 464, 376, -768}, { 472, 416, -760}, ...
, .hour = 1, .mday = 20, .month = 10, .may_be_instant = true, }; // 2015 Nov 21, 00:00:00 GMT const time_t advance = 1448064000 - s_2015_nov12_123456_gmt; prv_basic_test(&s_timezone_gmt, &test_cron, s_2015_nov12_123456_gmt, advance, advance, 1); } void test_cron__dst_simple_from(void) { // D...
for (int i = 0; i < ARRAY_LENGTH(jobs); ++i) { cron_job_schedule(&jobs[i]); }
cron_job_schedule_after(&jobs[0], &new_job); cl_assert_equal_i((uintptr_t)jobs[0].cb_data, 0); cl_assert_equal_i((uintptr_t)new_job.cb_data, 0); cl_assert_equal_i(cron_service_get_job_count(), ARRAY_LENGTH(jobs) + 1); fake_rtc_increment_time(0); cron_service_wakeup(); cl_assert_equal_i((uintptr_t)jobs...
ET_Y - GRAPH_OFFSET_Y) #define AVG_LINE_HEIGHT 4 #define AVG_LINE_LEGEND_WIDTH 10 #define AVG_LINE_COLOR GColorYellow #define INFO_PADDING_BOTTOM 6 //! Get the current day in the standard tm format. Sunday is 0 static uint8_t prv_get_weekday(time_t timestamp) { return time_util_get_day_in_week(timestamp); } stati...
(ctx, &thin_box)
; } static int16_t prv_draw_day_bar(GContext *ctx, int weekday, const GRect *box, GColor bar_color, bool wide_bar) { const int bar_inset = 3; GRect box_inset = grect_inset(*box, GEdgeInsets(bar_inset, bar_inset, 0, bar_inset)); if (wide_bar) { prv_draw_day_bar_wide(ctx, box, &...
>hal->i2c->CR1 |= I2C_CR1_START; // Enable event and error interrupts bus->hal->i2c->CR2 |= I2C_CR2_ITEVTEN | I2C_CR2_ITERREN; } /*------------------------INTERRUPT FUNCTIONS--------------------------*/ //! End a transfer and disable further interrupts //! Only call from interrupt functions static portBASE_TYPE p...
if (transfer->size == 1) { // Last byte, we want to NACK this one to tell the slave to stop sending us bytes. i2c->CR1 &= ~I2C_CR1_ACK; } transfer->state = I2CTransferState_WaitForData; break; case I2CTransferState_WaitForData: // This state just ensures that the trans...
----------------------------------------------------------------------- // Test setting a play count of 0 void test_animation__basic_play_count_0(void) { #ifdef TEST_INCLUDE_BASIC const int duration_a = 300; Animation *a = prv_create_test_animation(); animation_set_play_count(a, 0); animation_set_duration(a, d...
(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), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0)...
; } static EventServiceBuffer* prv_get_esb_for_event(PebbleEvent *e) { void **buf_ptr = event_get_buffer(e); EventServiceBuffer *esb = NULL; if (buf_ptr && *buf_ptr) { esb = (EventServiceBuffer *)list_find((ListNode *)s_event_service_buffers, prv_buffer_find, ...
kernel_free(esb)
; event_deinit(e); } } }
pin_source, BOARD_CONFIG.mic_config.i2s_sd.gpio_af); gpio_release(BOARD_CONFIG.mic_config.i2s_ck.gpio); gpio_release(BOARD_CONFIG.mic_config.i2s_sd.gpio); // I2S configuration SPI_I2S_DeInit(BOARD_CONFIG.mic_config.spi); I2S_InitTypeDef I2S_InitStructure; I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq_3...
RCC_PLLI2SCmd(DISABLE)
; prv_mic_power_disable(); stop_mode_enable(InhibitorMic); s_running = false; PBL_LOG(LOG_LEVEL_DEBUG, "Stopped microphone, dropped samples: %d", s_overflow_cnt); unlock: mutex_unlock_recursive(s_mic_mutex); } bool mic_is_running(MicDevice *this) { return s_running; } static void prv_dispatch_samples_c...
he quota (see calculation of DLS_MAX_DATA_BYTES). if (!prv_open_file(&session->storage, OP_FLAG_WRITE | OP_FLAG_READ, DLS_FILE_INIT_SIZE_BYTES, session)) { return false; } if (space_needed == 0) { // If no extra space needed, we are done because we successfully opened the file. r...
if (!prv_pfs_seek(storage->fd, storage->write_offset + sizeof(DLSChunkHeader), FSeekSet)) { return false; }
if (!prv_pfs_write(storage->fd, (void *)data_ptr, data_chunk_length)) { return false; } // Write data chunk header now if (!prv_pfs_seek(storage->fd, storage->write_offset, FSeekSet)) { return false; } DLSChunkHeader data_hdr = { .num_bytes = data_chunk_length, .valid = true }; ...
hics/gdraw_command_private.h" #include "applib/graphics/graphics_private_raw.h" #include "stubs_applib_resource.h" #include "stubs_app_state.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_pbl_malloc.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #i...
gdraw_command_image_draw(&ctx, image, GPoint(0, 0))
nclude "services/common/light.h" #include "shell/prefs.h" #include "system/passert.h" #include "util/math.h" static const int16_t MAX_OFFSET_MAGNITUDE = 10; typedef enum { DisplayCalibrationState_X_Adjust, DisplayCalibrationState_Y_Adjust, DisplayCalibrationState_Confirm } DisplayCalibrationState; static const...
{ const int16_t stripe_inset = 6; const int16_t stripe_width = 2; const GRect *layer_bounds = &layer->bounds; const bool is_horizontal = ((alignment == GAlignTop) || (alignment == GAlignBottom)); GRect rect = (GRect) { .size = (is_horizontal) ? GSize(layer_bounds->size.w, stripe_width) ...
.bounds = { { 0, 0 }, { 50, 50 } } }; memset(dest_data, GColorBlue.argb, sizeof(dest_data)); // 2 wider than src_bitmap, so 2 columns of red will repeat again. GRect dest_rect = GRect(0, 0, src_bitmap->bounds.size.w + 2, src_bitmap->bounds.size.h); bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit( &de...
(dest_data, GColorBlue.argb, sizeof(dest_data))
rebuild() is called from KernelMain during boot. s_initializing_storage = true; // Iterate through all files in the file system, looking for DLS storage files by name PFSFileListEntry *dir_list = pfs_create_file_list(prv_filename_filter_cb); // Create a session for each entry PFSFileListEntry *head = dir_li...
(*max_bytes, session->storage.num_bytes)
; return true; } void analytics_external_collect_dls_stats(void) { uint32_t max_bytes = 0; dls_list_for_each_session(prv_max_numbytes_cb, &max_bytes); analytics_set(ANALYTICS_DEVICE_METRIC_DATA_LOGGING_MAX_SPOOLED_BYTES, max_bytes, AnalyticsClient_System); }
i * SECONDS_PER_DAY))); } AlarmStorageKey key = { .id = alarm->id, .type = ALARM_DATA_PINS }; settings_file_set(file, &key, sizeof(key), settings_file_buffer, UUID_SIZE * num_pin_adds); cleanup: kernel_free(settings_file_buffer); kernel_free(local_alarm_time); kernel_free(entry); } //...
(id, config, rtc_get_time(), NULL)
; // Send one triggered event for the alarm prv_analytics_op(id, config, (void *)(uintptr_t)AnalyticsEvent_AlarmTriggered); return false; } // ---------------------------------------------------------------------------------------------- static void prv_clear_snooze_timer(void) { new_timer_stop(s_snooze_timer...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_WARNING, "Found malformed item with invalid key/val sizes; ignoring.")
; } return true; } SerializedTimelineItemHeader hdr; info->get_val(file, &hdr, sizeof(SerializedTimelineItemHeader)); // Restore flags & status hdr.common.flags = ~hdr.common.flags; hdr.common.status = ~hdr.common.status; if (uuid_equal(&find_info->parent_id, &hdr.common.parent_id)) { find_in...
ppings[] = { { false, false, false, false, 0x0 }, { true, true, false, false, 0x1 }, { true, true, true, false, 0x2 }, { true, true, true, true, 0x3 }, { true, false, false, false, 0x5 }, { true, false, true, false, 0x6 }, { true, false, true, false, 0x7 } // Both 0x6 and 0x7 map to the same...
if (region.enabled) { const uint8_t size_field = (attributes >> 1) & 0x1f; region.size = 32 << (size_field - 4); region.disabled_subregions = (attributes & 0x0000ff00) >> 8; const uint32_t raw_base_address = MPU->RBAR; region.base_address = raw_base_address & ~(region.size - 1); const uint8_t...
return region; } // Fill in the task parameters for a new task with the configurable memory regions we want. void mpu_set_task_configurable_regions(MemoryRegion_t *memory_regions, const MpuRegion **region_ptrs) { unsigned int region_num, region_idx; uint32_t base_reg, at...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
rocky_global_has_event_handlers("memorypressure")
); } void test_rocky_api_memory__oom_app_fault_if_handler_allocates_more_than_headroom(void) { s_skip_pbl_malloc_check = true; cl_assert_passert(EXECUTE_SCRIPT( "var data = [];\n" "_rocky.on('memorypressure', function(){\n" " var handlerData = [];\n" " for (var i = 0; i < 100000; i++) {handlerDat...
/* * 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...
menu_layer->callbacks.select_long_click(menu_layer, &menu_layer->selection.index, menu_layer->callback_context)
; } } void menu_up_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { const bool up = true; const bool animated = true; menu_layer_set_selected_next(menu_layer, up, MenuRowAlignCenter, animated); } void menu_down_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { const ...
*timeline_layer, GColor color) { timeline_layer->sidebar_color = color; } void timeline_layer_set_sidebar_width(TimelineLayer *timeline_layer, int16_t width) { timeline_layer->sidebar_width = width; } static void prv_sidebar_setter(void *context, int16_t value) { TimelineLayer *timeline_layer = context; time...
((Layer *)&layer->end_of_timeline, hidden)
; } void timeline_layer_init(TimelineLayer *layer, const GRect *frame_ref, TimelineScrollDirection scroll_direction) { *layer = (TimelineLayer) {}; // timeline layer layer_init(&layer->layer, frame_ref); layer_set_clips(&layer->layer, false); layer_set_update_proc(&layer->layer, prv_...
e. bus->i2c->DR = bus->transfer.device_address | I2C_READ_WRITE_BIT; if (bus->transfer.size == 1) { // Last byte, we want to NACK this one to tell the slave to stop sending us bytes. bus->i2c->CR1 &= ~I2C_CR1_ACK; } bus->transfer.state = TRANSFER_STATE_WAIT_FOR_DATA; break;...
(irq_error_handler(&i2c_buses[0]))
sequence) { gbitmap_sequence_destroy(sequence_reel->sequence); } gbitmap_destroy(sequence_reel->render_bitmap); applib_free(sequence_reel); } static uint32_t prv_elapsed_getter(KinoReel *reel) { KinoReelImplGBitmapSequence *sequence_reel = (KinoReelImplGBitmapSequence *)reel; return sequence_reel->elaps...
if (sequence == NULL) { return NULL; }
return kino_reel_gbitmap_sequence_create(sequence, true); }
/* * 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 (buffer_length < 11) { dbgserial_putstr("itoa buffer too small"); return; }
sequence_number) { mutex_lock(s_reliable_timer_state_lock); RtcTicks timeout_ticks = timeout_ms * RTC_TICKS_HZ / 1000; s_reliable_timer_expiry_time_tick = rtc_get_ticks() + timeout_ticks; s_reliable_timer_sequence_number = sequence_number; // Wake up the PULSE task to get it to notice the newly-started timer...
break; } else { if (c == '\0') { c = FRAME_DELIMITER; } cobs_streaming_decode(&frame_decode_ctx, c); } } // Finally handle the timer. if (timeout == 0) { pulse2_reliable_retransmit_timer_expired_handler(timer_sequence_number); } prv_pulse...
static void prv_forge_terminate_ack(void) { // Send an LCP Terminate-Ack without invoking the control_protocol // API since we need to send these packets from precarious situations // when the OS and PULSE may not have been initialized yet. uint8_t *packet = pulse_link_send_begin(LCP_PROTOCOL_NUMBER); packe...
ic language governing permissions and * limitations under the License. */ #include "api.h" #include "sync.h" #include "endpoint_private.h" #include "services/common/comm_session/session.h" #include "services/common/comm_session/session_send_buffer.h" #include "services/common/analytics/analytics.h" #include "system...
blob_db_sync_next(sync_session)
re, because the column index // will be lost in the menu layer selection changed callback. Otherwise, it will be updated // in prv_selection_changed_cb() to ensure the correct index is used by the draw functions. aml->selected_index = new_selected_index; } const int menu_layer_index = prv_get_menu_laye...
PBL_IF_RECT_ELSE(3, 0)
nd_send_result_event(data, DictationSessionStatusSuccess); } break; } default: WTF; } } // This function gets the next state to transition to and whether that transition should be deferred // until the current animation is complete. static VoiceUiState prv_get_next_state(VoiceUiState curren...
(data, true /* fly in */)
; break; case StateWaitForReady: // Stop fly in animation. Start pulsing dot animation. Start progress bar animation prv_stop_fly_dot(data); prv_show_mic_dot_pulse(data); prv_show_progress_bar(data, true /* animated */); break; case StateStopWaitForReady: // Shrink pr...
user that the watchface has crashed so that //! they understand why are being jettisoned into the launcher. static void prv_app_show_crash_ui(AppInstallId install_id) { AppInstallEntry entry; if (!app_install_get_entry_for_install_id(install_id, &entry)) { return; } if (!app_install_entry_is_watchface(&en...
process_metadata_get_name(s_next_app.md)
, (int)gracefully); // Shouldn't be called from app. Use app_manager_put_kill_app_event() instead. PBL_ASSERT_TASK(PebbleTask_KernelMain); // We have to call this here, in addition to calling it in prv_app_cleanup(), // because the timer could otherwise be triggered while waiting for the task // t...
y3, int32_t x4, int32_t y4) { // Calculate all the mid-points of the line segments int32_t x12 = (x1 + x2) / 2; int32_t y12 = (y1 + y2) / 2; int32_t x23 = (x2 + x3) / 2; int32_t y23 = (y2 + y3) / 2; int32_t x34 = (x3 + x4) / 2; int32_t y34 = (y3 + y4) / 2; int32_...
if (builder->num_points >= builder->max_points - 1) { return false; }
builder->points[builder->num_points++] = to_point; return true; } bool gpath_builder_curve_to_point(GPathBuilder *builder, GPoint to_point, GPoint control_point_1, GPoint control_point_2) { GPoint from_point = builder->points[builder->num_points-1]; return bezier_fixed(build...
ayer) { GRect bounds; layer_get_unobstructed_bounds(layer, &bounds); return bounds; } //! Sets the window on the layer and on all of its children static void layer_set_window(Layer *layer, Window *window) { layer->window = window; Layer *child = layer->first_child; while (child) { layer_set_window(chil...
layer_mark_dirty(layer->parent)
e; goto exit; } // Getting heart rate using sum should fail value = health_service_aggregate_averaged(HealthMetricHeartRateBPM, time_start_of_today(), time(NULL), HealthAggregationSum, HealthServiceTimeScopeOnce); APP_L...
window_get_root_layer(window)
; GRect bounds = layer_get_bounds(window_layer); static SimpleMenuItem menu_items[] = { { .title = "Step History", .callback = prv_debug_cmd_step_history, }, { .title = "Active Minutes History", .callback = prv_debug_cmd_active_time_history, }, { .title = "Distance(m) Hist...
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 "progress_window.h" #include "applib/applib_malloc.auto.h" #include "a...
animation_sequence_create(animation1, animation2, NULL)
; data->result_animation = animation; animation_schedule(animation); #else // Don't animate to a dot on old platforms, just finish immediately. static const bool success = true; prv_finished(data, success); #endif } static void prv_schedule_progress_failure_animation(ProgressWindow *data, uint32_t timeline_...
; EXECUTE_SCRIPT( "ctx.lineWidth = 2.1;\n" "var w = ctx.lineWidth;\n" ); ASSERT_JS_GLOBAL_EQUALS_I("w", 2); EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.lineWidth = -4;\n", "TypeError: Argument at index 0 is invalid: Value out of bounds for native type" ); EXECUTE_SCRIPT("var w = ctx.lineWidth;\n"); ...
cl_assert_equal_rect((GRect(0, 1, 11, large_int)), s_graphics_draw_text.last_call.draw_text.box)
e command_id, we know what parser to call later on: reassembly_ctx->command_id = cmd_header->command_id; // Append the partial response to the reassembly buffer: const int bytes_written = buffer_add(&reassembly_ctx->buffer, data, length); // If this gets hit, NOTIFICATION_ATTRIBUTES_MAX_BUFFER_LENGTH i...
while (length > 0) { length--; if (*data++ == 0) { break; } }
ANCSAttribute *app_attrs[NUM_FETCHED_APP_ATTRIBUTES] = {0}; if (length == 0) { goto fail; } bool error = false; const bool complete = ancs_util_get_attr_ptrs(data, length, s_fetched_app_attributes, ...
int16_t start = x1; int16_t end = x1 + (dx * xi); if (end < start) { swap16(&start, &end); } graphics_private_draw_horizontal_line_prepared(ctx, framebuffer, &ctx->draw_state.clip_box, y1, (Fixed_S16_3) {.integer = start}, ...
(radius * radius - y * y)
}; } static void prv_calc_cap_prepared(Fixed_S16_3 cap_center, Fixed_S16_3 cap_center_offset, Fixed_S16_3 cap_radius, Fixed_S16_3 progress, Fixed_S16_3 *min, Fixed_S16_3 *max) { if (progress.raw_value >= cap_center.raw_value - cap_radius.raw_value && progress.raw_value <= cap_center.raw_value + cap_r...