prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
; case TUPLE_CSTRING: return dict_write_data_internal(iter, tuplet->key, (uint8_t *)tuplet->cstring.data, tuplet->cstring.length, tuplet->type); case TUPLE_UINT: case TUPLE_INT: return dict_write_data_internal(iter, tuplet->key, (uint8_t *)&tuplet->integer.storage, tuplet->integer.width, tuplet-...
dict_read_first(new_iter)
; new; new = dict_read_next(new_iter)) { uint32_t key = new->key; const Tuple* orig = dict_find(orig_iter, key); if (orig == NULL && update_existing_keys_only) { continue; } if (orig == NULL) { orig = NULL_TUPLE; } Tuple* dest = dest_iter->cursor; result = dict_write_tuple(de...
s_ctx.draw_state.drawing_box.origin = GPoint(x_offset, y_offset); prv_render_action_menu_window(root_level, selected_index, animation_state, additional_crumbs); } } void prv_prepare_canvas_and_render_action_menus_static(const ActionMenuLevel *root_level, ...
(root_level, ActionMenuLevelDisplayModeThin)
; for (size_t i = 0; i < ARRAY_LENGTH(thin_values); i++) { action_menu_level_add_action(root_level, thin_values[i], prv_noop_action_callback, NULL); } const unsigned int selected_index = 1; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitmap_pbi_eq(s_dest_bi...
aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT_NXNY, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Small circles setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP,...
(&ctx, fb)
; typedef struct { char *filename_part; GCornerMask mask; } TestConfig; TestConfig test_config[] = { { .filename_part = "quad_top_left", .mask = GCornerTopLeft, }, { .filename_part = "quad_top_right", .mask = GCornerTopRight, }, { ...
bool requires_address_pinning, uint8_t flags) { if (!new_pairing_info || sm_is_pairing_info_empty(new_pairing_info)) { return BT_BONDING_ID_INVALID; } // Check if this is an update BtPersistBondingOp op = BtPer...
(bonding, BtPersistBondingOpWillDelete)
; // TODO: Make sure this matches what we have stored shared_prf_storage_erase_ble_pairing_data(); } static void prv_fill_ble_data(SMIdentityResolvingKey *irk_in, BTDeviceInternal *device_in, char *name_in, SMIdentityResolvi...
r, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(&center, s_fill_points, s_path_num_points)); prv_reset(); // set stroke width to zero - fill should be drawn, but not outline gdraw_command_set_stroke_width(command, 0); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_stroke_color...
(s_stroke_points, NULL)
; cl_assert_equal_p(s_fill_points, NULL); free(command); } static GDrawCommandList *prv_create_command_list_3(void) { GDrawCommandList *command_list = malloc(sizeof(GDrawCommandList) + (3 * sizeof(GDrawCommand)) + (sizeof(GPoint) * 6)); *command_list = (GDrawCommandList) { .num_commands = 3 }; G...
of(SOME_DATA)); cl_assert(result == DICT_OK); result = dict_write_cstring(&iter, SOME_STRING_KEY, SOME_STRING); cl_assert(result == DICT_OK); result = dict_write_uint8(&iter, SOME_UINT8_KEY, 8); cl_assert(result == DICT_OK); result = dict_write_uint16(&iter, SOME_UINT16_KEY, 16); cl_assert(result == DICT_...
cl_assert(result == DICT_NOT_ENOUGH_STORAGE)
ties()); // Start on known boundary struct tm start_tm = { // Jan 1, 2015, 5am .tm_hour = 5, .tm_mday = 1, .tm_mon = 0, .tm_year = 115 }; time_t utc_sec = mktime(&start_tm); rtc_set_time(utc_sec); // Add a run session const time_t time_elapsed = (20 * SECONDS_PER_MINUTE); ActivityS...
(ActivitySessionType_Walk)
/* * 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...
{ gpio_init.GPIO_Pin = GPIO_Pin_All & ~(GPIO_Pin_3 | GPIO_Pin_4); }
else { gpio_init.GPIO_Pin = GPIO_Pin_All; } gpio_use((GPIO_TypeDef *)gpio_addr); GPIO_Init((GPIO_TypeDef *)gpio_addr, &gpio_init); gpio_release((GPIO_TypeDef *)gpio_addr); tot_gpios -= num_gpios_per_port; } }
/* * 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...
mfg_info_set_watch_color(WATCH_INFO_COLOR_GREEN)
; cl_assert_equal_i(mfg_info_get_watch_color(), WATCH_INFO_COLOR_GREEN); } void test_snowy_mfg_info__rtc_freq(void) { cl_assert_equal_i(mfg_info_get_rtc_freq(), 0); mfg_info_set_rtc_freq(0xfefefefe); cl_assert_equal_i(mfg_info_get_rtc_freq(), 0xfefefefe); mfg_info_set_rtc_freq(1337); cl_assert_equal_i(mf...
/* * 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_pairability_update_due_to_bonding_change()
; } static BTBondingID prv_bt_persistent_storage_store_ble_pairing( const SMPairingInfo *new_pairing_info, bool is_gateway, bool requires_address_pinning, uint8_t flags, const char *device_name, BtPersistBondingOp op) { if (new_pairing_info && is_gateway) { shared_prf_storage_store_ble_pairing_data(new_p...
); text_layer_set_text_alignment(data->steps_card.time_layer, GTextAlignmentCenter); text_layer_set_font(data->steps_card.time_layer, fonts_get_system_font(FONT_KEY_LECO_38_BOLD_NUMBERS)); text_layer_set_background_color(data->steps_card.time_layer, GColorClear); text_layer_set_text_color(...
{ window_stack_pop(true); }
// ------------------------------------------------------------------------------- static void results_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_BACK, prv_results_back_click_handler); } // ------------------------------------------------------------------------------- static ...
ffer to move data out of, it would // have been written directly to flash during dls_log. But, we can end up here because of a // call to prv_write_all_sessions_to_flash() which iterates through ALL active sessions. if (!session->data->buffer_storage) { goto exit; } session->data->write_request_pending =...
{ last_whole_items_read_bytes = read_bytes; *new_read_offset = read_offset; }
} exit: if (got_session_file) { prv_release_session_file(logging_session); } if (last_whole_items_read_bytes < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage for session %d", logging_session->comm.session_id); dls_storage_delete_logging_storage(logging_session); } return last_whole_items_read...
hould_notify_for_type(AlertReminder)); cl_assert(!alerts_should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder)); cl_assert(alerts_should_notify...
alerts_set_notification_vibe_timestamp()
; fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake_rtc_...
/* * 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...
utf8_is_valid_string(s_valid_test_string)
; cl_assert(is_valid); utf8_t* valid_test_string_utf8 = (utf8_t*)s_valid_test_string; for (int i = 0; i < NUM_VALID_CODEPOINTS; ++i) { uint32_t decoded_codepoint = utf8_peek_codepoint(valid_test_string_utf8, NULL); uint32_t actual_codepoint = s_valid_test_codepoints[i]; cl_assert_equal_i(decoded_cod...
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), ...
(a, special_handlers, NULL)
; Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_play_count(b, play_count_b); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_h...
ta(KickstartData *data) { prv_update_current_steps(data); prv_update_typical_steps(data); prv_update_daily_steps_avg(data); prv_update_hrm_bpm(data); prv_normalize_data(data); layer_mark_dirty(&data->base_layer); } #if UNITTEST T_STATIC void prv_set_data(KickstartData *data, int32_t current_steps, ...
WINDOW_NAME("Kickstart")
_FAST_MODE_CLOCK_SPEED_MAX (400000) #define I2C_FAST_MODE_PLUS_CLOCK_SPEED_MAX (1000000) #define TIMINGR_MASK_PRESC (0x0F) #define TIMINGR_MASK_SCLH (0xFF) #define TIMINGR_MASK_SCLL (0xFF) #define CR1_CLEAR_MASK (0x00CFE0FF) #define CR2_CLEAR_MASK (0x07FF7FFF) #define CR2_NBYTES_OFFSET (16) #define CR2_T...
(bus->hal->i2c, bus->hal->clock_ctrl)
; prv_i2c_deinit(bus); } bool i2c_hal_is_busy(I2CBus *bus) { return ((bus->hal->i2c->ISR & I2C_ISR_BUSY) != 0); } static void prv_disable_all_interrupts(I2CBus *bus) { bus->hal->i2c->CR1 &= ~(I2C_CR1_TXIE | I2C_CR1_RXIE | I2C_CR1_TCIE | ...
#include "stubs_hexdump.h" #include "stubs_layout_layer.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_sleep.h" #include "stubs_task_watchdog.h" #define CONTACT_1_UUID 0x0a, 0x04, 0x98...
((uint8_t *)&contact, UUID_SIZE, (uint8_t *)&contact, sizeof(contact))
, 0); cl_assert_equal_i(contacts_db_get_len((uint8_t *)&contact, UUID_SIZE), sizeof(contact)); SerializedContact *serialized_contact; contacts_db_get_serialized_contact((Uuid *)&contact, &serialized_contact); cl_assert_equal_i(serialized_contact->flags, 0); cl_assert_equal_i(serialized_contact->num_attribute...
///// static FrameBuffer *fb; static GContext s_ctx; static GBitmap *s_dest_bitmap; static GBitmap s_tictoc_icon_bitmap; static GBitmap s_smart_alarm_icon_bitmap; static void prv_initialize_icons(void) { gbitmap_init_with_resource(&s_tictoc_icon_bitmap, RESOURCE_ID_MENU_ICON_TICTOC_WATCH); gbitmap_init_with_res...
(s_menu_system_cell_test_row_heights)
; for (int i = 0; i < num_row_heights; i++) { sum += GRID_CELL_PADDING + prv_get_row_height_for_index(i); } return (sum * num_distinct_rows) + GRID_CELL_PADDING; } typedef enum MenuCellType { MenuCellType_Basic, MenuCellType_BasicCustom, MenuCellType_CellLayer, } MenuCellType; //! Allows testing other...
e_action(pin, action, &response_attributes); break; } case TimelineItemActionTypePostpone: { Attribute timestamp_attr = { .id = AttributeIdTimestamp, .uint32 = (uint32_t)(uintptr_t)context, }; AttributeList response_attributes = { .num_attributes = 1, .at...
prv_invoke_ble_hrm_stop_sharing_action(action_menu, pin)
; return NULL; #else case TimelineItemActionTypeBLEHRMStopSharing: break; #endif } PBL_LOG(LOG_LEVEL_ERROR, "Unsupported action type %d", action->type); if (action_menu) { action_menu_close(action_menu, true); } return NULL; } void timeline_actions_invoke_action(const TimelineItemAction ...
{ uuid_data->found_id = app_id; return false; // stop iterating }
return true; // continue iterating } //! Retrieves the AppInstallId for a given UUID using the SettingsFile that is already open. //! @note Requires holding the lock already static AppInstallId prv_find_install_id_for_uuid(SettingsFile *file, const Uuid *uuid) { // used when iterating through all entries in our d...
m_get_tz_timestamp(header); const time_t midnight_first = time_util_get_midnight_of(nodes[0]->timestamp); if (num_nodes == 1) { nodes[0]->duration = header->duration; } else { // first item has correct timestamp, duration should make it last for the rest of the day const time_t until_midnight = midnig...
prv_time_comparator(old_node, new_node)
EG; uint16_t DCDC_V14_0_REG; uint16_t DCDC_V14_1_REG; uint16_t DCDC_V18_0_REG; uint16_t DCDC_V18_1_REG; uint16_t DCDC_VDD_0_REG; uint16_t DCDC_VDD_1_REG; uint16_t DCDC_V18P_0_REG; uint16_t DCDC_V18P_1_REG; uint16_t DCDC_RET_0_REG; uint16_t DCDC_RET_1_REG; uint16_t DCDC_TRIM_REG; uint16_t DCDC_TE...
REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TUNE, 0x0)
; REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_LSSUP_TRIM, 0x5); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_HSGND_TRIM, 0x5); REG_SETF(DCDC, DCDC_V14_0_REG, DCDC_V14_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_V14_0_REG, DCDC_V14_VOLTAGE, 0x8); REG_SETF(DCDC, DCDC_V14_0_REG, DCDC_V14_CUR_LIM_MAX_HV, 0xD); REG_SETF(DCDC, DCD...
/* * 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 NULL; }
// potentially extracting into a generic task_ptrdup(void *, size_t) size_t size = gdraw_command_sequence_get_data_size(sequence); GDrawCommandSequence *result = applib_malloc(size); if (result) { memcpy(result, sequence, size); } return result; } void gdraw_command_sequence_destroy(GDrawCommandSequ...
80, 120}, // 19 seconds { 760, 344, 48}, { 744, 312, 64}, { 744, 352, 40}, { 816, 360, 40}, { 880, 312, 48}, { 1024, 328, 112}, { 1240, 376, 8}, { 1600, 136, 216}, { 1696, 328, 232}, { 1008, 432, 56}, { 960, 320, -152}, { 976, 224, 184}, { 1032, 264, 144}, { 9...
{ 872, 256, 56}, { 976, 288, 80}, { 1152, 320, 64}, // 25 seconds { 1376, 232, 216}, { 1576, 360, 208}, { 1112, 456, 184}, { 800, 400, 152}, { 1120, 408, -16}, { 1056, 424, 232}, { 1008, 336, 224}, { 904, 288, 200}, { 904, 208, 168}, { 784, 136, 168}, { 664, 8...
{ 648, 112, 72}, { 616, 112, -32}, { 696, 128, 32}, { 856, 184, 32}, { 952, 304, 0}, { 1240, 312, 80}, { 1768, 208, 248}, { 1376, 704, 48}, // 28 seconds { 1200, 704, -96}, { 824, 560, 32}, { 688, 336, 136}, { 728, 392, 104}, { 704, 336, 192}, { 688, 320, 312...
omm/bt_lock.h" #include "system/logging.h" #include "system/passert.h" #include <bluetooth/bluetooth_types.h> #include <bluetooth/id.h> #include <btutil/bt_device.h> static uint32_t s_pra_cycling_pause_count; static BTDeviceAddress s_pinned_addr; static bool s_cycling_paused_due_to_dependent_bondings; static void pr...
PBL_LOG(LOG_LEVEL_INFO, "Pausing address cycling because cc2564x and beta build!")
; bt_local_addr_pause_cycling(); #else PBL_LOG(LOG_LEVEL_INFO, "No bondings found that require address pinning!"); bt_driver_set_local_address(true /* allow_cycling */, NULL); #endif } }
n_noop("10 Minutes"), /// No Notification Window Timeout i18n_noop("None"), }; _Static_assert(ARRAY_LENGTH(s_window_timeouts_ms) == ARRAY_LENGTH(s_window_timeouts_labels), ""); static int prv_window_timeout_get_selection_index(void) { const int DEFAULT_IDX = 2; // Double check no one has fudged with the order...
{ case NotificationsItemFilter: prv_filter_menu_push(data); break; #if !CAPABILITY_HAS_VIBE_SCORES case NotificationsItemVibration: if (battery_is_usb_connected()) { return; } prv_vibe_menu_push(data); break; #endif /* !CAPABILITY_HAS_VIBE_SCORES */ case Notifica...
settings_menu_reload_data(SettingsMenuItemNotifications); } static void prv_settings_notifications_event_handler(PebbleEvent *event, void *context) { switch (event->type) { case PEBBLE_BATTERY_CONNECTION_EVENT: // Redraw the menu so that the Vibration status will be re-rendered. settings_menu_mark...
nitialized = false; static bool s_running = false; static const Lis3dhScale s_accel_scale = LIS3DH_SCALE_4G; static PebbleMutex * s_accel_mutex; static uint64_t s_latest_timestamp; static uint8_t s_pending_accel_event = false; static bool s_is_idle = false; static AccelRawData s_last_analytics_position; static AccelRaw...
accel_running()
; if (!running) { if (!accel_start()) { // couldn't start the accel return (false); } } if (!i2c_write_register_block(I2C_LIS3DH, address, write_size, buffer)) { prv_reset(); return (false); } if (!running) { accel_stop(); } return true; } AccelRawData s_accel_data; v...
ructured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(settings_glance, icon, NULL); } static const char *prv_get_title(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FI...
graphics_context_set_fill_color(ctx, battery_fill_color)
; graphics_fill_rect(ctx, &battery_fill_rect); } if (size_out) { *size_out = GSize(battery_silhouette_icon_size.w, settings_glance->subtitle_font_height); } } static void prv_battery_percent_dynamic_text_node_update( UNUSED GContext *ctx, UNUSED GTextNode *node, UNUSED const GRect *box, UNUSED c...
now_secs, .length_min = 0, .ongoing = true, }; break; case ActivitySleepStateUnknown: break; } prior_state = s_test_alg_state.minute_data.sleep_state; } // Update the rate info // The actual implementation only sends a rate update once every epoch (5 se...
rtc_get_time()
; // Get the minute index uint32_t minute_idx = now / SECONDS_PER_MINUTE; // Compute the timestamp of the end of the last record we would have available uint32_t last_minute_avail = minute_idx - (minute_idx % ALG_MINUTES_PER_FILE_RECORD); time_t last_second_available = last_minute_avail * SECONDS_PER_MINUTE...
* 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 "rocky_api_graphics_path2d.h" #include "rocky_api_graphics.h" #include "rocky_api_errors.h" #include "applib/graphics/gpath....
{ if (moved_already) { graphics_line_draw_precise_stroked(ctx, pp, step->pt.xy); } ASSIGN_P(step->pt.xy); break; }
1); prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_assign_horizontal_line_raw); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_assign_horizontal_line_raw"))); }; void prv_blend_horizontal_line_raw(GBitmap *framebuffer, int16_t y, int16_t x1, int16_t x2, ...
TEST_NAMED_PBI_FILE("draw_core_assign_vertical_line_raw")
)); }; void prv_blend_vertical_line_raw(GBitmap *framebuffer, int16_t x, int16_t y1, int16_t y2, GColor color); static void prv_vline_pattern_blend_vertical_line_raw(GContext *ctx, int16_t x, int16_t y1, int16_t y2, GColor color) {...
(request->address, request->length)
) { response.complete = 1; } else { response.complete = 0; start_erase = true; } prv_send_frame(OPCODE_FLASH_ERASE, &response, sizeof(response)); // start the erase after sending the response if (start_erase) { uint32_t end_address = request->address + request->length; s_flash_erase_in_pr...
/* * 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(utf8_is_valid_string("\xF0\x9F\x98\x84"))
; cl_assert(utf8_is_valid_string("πŸ˜ƒ")); } void test_utf8__copy_single_byte_char(void) { utf8_t dest[5]; memset(dest, 0, 5); size_t copied = utf8_copy_character(dest, (utf8_t *)"hello", 5); cl_assert_equal_i(copied, 1); cl_assert_equal_s((char *)dest, "h"); } void test_utf8__copy_multibyte_char(void) { ...
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 permission...
generic_attribute_find_attribute(attr_list2, VEAttributeIdAppUuid, sizeof(data2))
; cl_assert(attr1); cl_assert_equal_i(attr1->id, VEAttributeIdAppUuid); cl_assert_equal_i(attr1->length, 16); offset = sizeof(GenericAttributeList) + sizeof(GenericAttribute); cl_assert_equal_p(attr1->data, &data2[offset]); attr2 = generic_attribute_find_attribute(attr_list2, VEAttributeIdTranscription, si...
re_dump_size(*addr, size) != S_SUCCESS) { return false; } *addr += sizeof(CoreDumpFlashRegionHeader); return true; } static void prv_handle_flash_geometry_request(const void *payload, uint32_t length) { if (length != sizeof(FlashGeometryRequest)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")",...
(OPCODE_FLASH_READ, buffer, frame_length)
; } static void prv_handle_flash_crc_request(const void *payload, uint32_t length) { // there can be 1 or more payloads if (!length || (length % sizeof(FlashCRCRequest))) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } const FlashCRCRequest *request = payload; const uint3...
{ 1288, 312, 328}, { 944, 336, 200}, { 736, 256, 104}, // 27 seconds { 664, 192, 152}, { 712, 136, 192}, { 648, 40, 224}, { 688, -8, 240}, { 776, 8, 272}, { 936, 112, 304}, { 1144, 176, 344}, { 1648, 376, 416}, { 1632, 856, 56}, { 1704, 1208, -160}, { 1368, 49...
{ 1256, 72, 424}, { 1728, 312, 616}, { 2008, 1160, 192}, { 1600, 1560, 264}, { 1328, 424, 696}, { 896, 24, 144}, { 840, 296, 32}, { 704, 896, 8}, { 816, 440, -264}, // 33 seconds { 360, 192, 88}, { 752, 272, 224}, { 880, 456, 184}, { 1312, 656, 176}, { 1456, 5...
{ 1424, 584, 136}, { 1952, 536, 328}, { 1432, 568, 328}, { 1256, 392, 232}, { 1504, 320, 312}, { 1448, 304, 376}, { 1088, 344, 296}, { 856, 272, 192}, { 776, 224, 200}, { 784, 176, 224}, { 752, 96, 232}, { 648, 32, 216}, { 584, 16, 208}, { 736, 56, 224}, { 88...
Point(46, 95), 5); // T facing right - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(71, 91), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(67, 96), 5); // T facing left - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 90), 10); graphics_draw_hori...
(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1)
; graphics_context_set_stroke_color(&ctx, GColorBlack); // Draw lines around boundaries of clipping box - AA false, SW 1 prv_draw_lines(&ctx, 1, 0, 0); // Draw lines around boundaries of clipping box - AA false, SW 2 prv_draw_lines(&ctx, 2, CLIP_OFFSET, 0); // Draw lines around boundaries of clipping box...
if (event.type == PEBBLE_CALENDAR_EVENT) { s_in_calendar_event = event.calendar.is_event_ongoing; } return s_in_calendar_event; } // Fake pins //////////////////////////////////////////////////////////////// static Attribute title_attr = { .id = AttributeIdTitle, .cstring = "title", }; static TimelineIt...
(!stub_new_timer_is_scheduled(timer_id))
/* * 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_LOG_LEVEL_ERROR, "Double free detected on pointer <%p>", ptr)
; } static void prv_croak_on_double_free(void *ptr) { // Always log regardless of CROAKing on unprivileged apps. We don't send the // croak message out over APP_LOG correctly so if we didn't do this developers // wouldn't see the croak reason. APP_LOG(APP_LOG_LEVEL_ERROR, "Double free detected on pointer <%p>"...
fo *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_len: %u, flushing", info->key_len, info->val_len); system_task_add_ca...
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 the // app install id passed in via info static bool prv_remove_matching_resource_file_cal...
_length /* required_free_length */, TIMEOUT_MS); uint8_t fake_data[max_length]; memset(fake_data, 0, max_length); cl_assert_equal_b(comm_session_send_buffer_write(write_sb, fake_data, max_length), true); // Try writing another byte (expect false re...
htons(max_payload_length)
); cl_assert_equal_i(header->endpoint_id, htons(ENDPOINT_ID)); cl_assert_equal_i(memcmp(data_out + sizeof(PebbleProtocolHeader), fake_data_payload, read_space - sizeof(PebbleProtocolHeader)), 0); } else { cl_assert_equal_i(memcmp(data_o...
| | * |<----------------------------------------->| * Integrate over this range for the mean */ //! The current state of the backlight (example: ON/ON_TIMED/ON_FADING). static BacklightState s_light_state; //! The br...
if (s_current_brightness != new_brightness) { prv_change_brightness(new_brightness); }
} static bool prv_light_allowed(void) { if (!s_backlight_allowed) { return false; } if (backlight_is_enabled()) { if (backlight_is_ambient_sensor_enabled()) { // If the light is off and it's bright outside, don't allow the light to turn on // (we don't need it!). Grab the mutex here so th...
buffer will be allocated //! @return Pointer to the end of the buffer (*buffer + size of strings) static uint8_t *prv_fill_native_ancs_action(uint8_t **buffer, TimelineItemAction *action, ActionId ancs_action_id, ...
if (has_multimedia) { // Move the title (sender) to the body for MMS if (ancs_notifications_util_is_group_sms(app_id, subtitle)) { // Promote the subtitle (group name) for Group MMS title = subtitle; subtitle = NULL; } else { title = NULL; } }
if (title && title->length > 0) { *buffer = prv_add_pstring_to_attribute(*buffer, title, TITLE_MAX_LENGTH, &item->attr_list.attributes[attr_idx], AttributeIdTitle); attr_idx++; } if (display_name && display_name->lengt...
ageHeader *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 improvements / analysis prv_flash_read((uint8_t *)&hdr->erase_count, sizeof(hdr->erase_count), prv_page_to_flash_offset(page) + of...
{ int num_erase_regions = s_pfs_page_count / PFS_PAGES_PER_ERASE_SECTOR; int start_region = s_last_page_written / PFS_PAGES_PER_ERASE_SECTOR; int end_region = start_region + num_erase_regions; uint16_t gc_erase_block = s_gc_block.gc_start_page / PFS_PAGES_PER_ERASE_SECTOR; for (int region = start_region; re...
static status_t garbage_collect_sector(uint16_t *free_page, uint16_t sector_start_page, uint32_t sectors_active); //! Updates the last written page to point to next_page static NOINLINE void prv_update_last_written_page(uint16_t next_page) { PageHeader hdr = { 0 }; uint16_t prev_written_page = s_last_page_w...
args)); if (jerry_value_has_error_flag(remove_result)) { rocky_log_exception("removing event listener", remove_result); } for (size_t i = 0; i < ARRAY_LENGTH(args); i++) { jerry_release_value(args[i]); } // mark item as removed and stop iterating query_data->found = true; return...
jerry_get_object_field(rocky, name_from)
; jerry_set_object_field(rocky, name_to, on); } void rocky_global_init(const RockyGlobalAPI *const *global_apis) { PBL_ASSERTN(global_apis); s_global_apis = global_apis; JS_VAR rocky = jerry_create_object(); // this keeps a permanent reference to the singleton rocky_set_rocky_singleton(rocky); rocky_ad...
.argb, GColorRedARGB8); cl_assert_equal_i(s_fill_color.argb, GColorBlueARGB8); cl_assert_equal_i(s_stroke_width, 1); cl_assert_equal_i(s_path_num_points, 2); cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_poi...
(NULL, command)
; cl_assert_equal_i(s_stroke_color.argb, GColorPurpleARGB8); cl_assert_equal_i(s_fill_color.argb, GColorGreenARGB8); cl_assert_equal_i(s_stroke_width, 2); cl_assert_equal_i(s_path_num_points, 2); cl_assert_equal_b(s_path_open, true); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke...
ne) { 0 }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 2 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); ...
line_reset(&line, utf8_bounds.start)
; cl_assert(line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 4); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == '-'); cl_assert(*line.start == 'a'); // mal- cl_assert(*word_iter_state.current.start == 'm'); cl_...
/* * 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...
{ size_t strn = strlen(s1) + 1; if (strn < n) { n = strn; } return memcmp(s1, s2, n); }
&buffer, &client), 0); } void test_shared_circular_buffer__subsampling_2of5(void) { SharedCircularBuffer buffer; uint16_t item_size = 2; uint8_t storage[12*item_size]; uint8_t out_buffer[12*item_size]; uint16_t items_read; shared_circular_buffer_init(&buffer, storage, sizeof(storage)); SubsampledShared...
cl_assert_equal_i(shared_circular_buffer_read_subsampled( &buffer, &client, item_size, out_buffer, 3), 3)
_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 6, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r6_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix left corners PBL-15915 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); ...
(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1, GCornersAll)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax2_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW has no effect, Clip NXNY, all corners setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY ...
transmit_sequence_number) { // ACK was received and processed between the time that the // retransmit timer expired and this callback ran. return; } if (++s_retransmit_count < MAX_RETRANSMITS) { prv_send_info_packet(retransmit_sequence_number, s_tx_buffer->app_protoc...
{ ppp_control_protocol_lower_layer_is_up(PULSE2_TRAINCP); }
void pulse2_reliable_on_link_down(void) { ppp_control_protocol_lower_layer_is_down(PULSE2_TRAINCP); } void pulse2_reliable_init(void) { ppp_control_protocol_init(PULSE2_TRAINCP); ppp_control_protocol_open(PULSE2_TRAINCP); s_tx_buffer = kernel_zalloc_check(sizeof(ReliableInfoBuffer) + ...
GRect from = kino_reel_transform_get_from_frame(reel); GRect to = kino_reel_transform_get_to_frame(reel); kino_reel_scale_segmented_set_from_stroke_width(reel, FIXED_S16_3_ONE, GStrokeWidthOpMultiply); kino_reel_scale_segmented_set_to_stroke_width(reel, FIXED_S16_3_ONE, GStrokeWidthOpMultiply); if (is_rever...
animation_set_handlers((Animation *)anim, (AnimationHandlers) { .stopped = prv_handle_animation_stop, }, data)
; data->mic_window.fly_anim = anim; animation_schedule((Animation *)anim); } // cancel the flying animation static void prv_stop_fly_dot(VoiceUiData *data) { if (animation_is_scheduled((Animation *)data->mic_window.fly_anim)) { GRect to; property_animation_get_to_grect(data->mic_window.fly_anim, &to); ...
w_utc) { if (!s_sleep_summary_settings.enabled) { return; } // Don't bother adding a summary if we don't have any history for an average if (s_sleep_stats.total_days == 0) { INSIGHTS_LOG_DEBUG("Not adding sleep pin - no stats"); return; } // Make sure we're not still sleeping int32_t sleep_s...
if (s_activity_reward_state.active_minutes < s_activity_reward_settings.reward.activity.trigger_active_minutes) { INSIGHTS_LOG_DEBUG("Not showing activity reward - have only been currently active for " "%"PRIu16" minutes out of %"PRIu8, s_activity_reward_state.active_minutes, ...
// All criteria have been met, show reward prv_push_reward(now_utc, &ACTIVITY_REWARD_NOTIF_CONFIG); } // ------------------------------------------------------------------------------------------------ // Returns the step average corresponding to the current time of day static ActivityScalarStore prv_cur_step_av...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ dbgserial_print("Boot bits: "); dbgserial_print_hex(RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR)); dbgserial_newline(); }
void boot_version_write(void) { if (boot_version_read() == s_bootloader_timestamp) { return; } RTC_WriteBackupRegister(BOOTLOADER_VERSION_REGISTER, s_bootloader_timestamp); } uint32_t boot_version_read(void) { return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_launcher_menu_layer_mark_dirty(launcher_menu_layer)
/* * 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...
{ config = kernel_applib_get_compass_config(); }
else { WTF; } if (*config == NULL) { // Note that config will never be NULL after grabbing it from an app, // worker, or kernel state. However, the value pointed to it may be // NULL. *config = task_zalloc_check(sizeof(CompassServiceConfig)); } return config; } static void prv_do_data_h...
s/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 permissions and * limitations u...
(card_data->headings[i].primary_value)
nores it prv_put_phone_event(PhoneEventType_End, PhoneCallSource_PP, ANCS_CALL_UID); } static void prv_call_start(void) { // Note: the source doesn't matter here, phone_call.c ignores it prv_put_phone_event(PhoneEventType_Start, PhoneCallSource_PP, ANCS_CALL_UID); } static void prv_call_hide(uint32_t call_ident...
prv_put_comm_session_event(false /* app_connected */)
} void test_put_bytes__previous_chunk_not_acked_yet(void) { uint8_t max_put_ops = prv_put_bytes_get_max_batched_pb_ops(); prv_receive_init(VALID_OBJECT_SIZE * max_put_ops, ObjectFirmware); prv_process_and_reset_test_counters(); const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc }; uint8_t max_pb_ops = prv_put_bytes...
assert_ack_count(0)
; assert_nack_count(1); } void test_put_bytes__commit_message_sent_while_previous_put_was_not_acked_yet(void) { uint8_t max_put_ops = prv_put_bytes_get_max_batched_pb_ops(); prv_receive_init(VALID_OBJECT_SIZE * max_put_ops, ObjectFirmware); prv_process_and_reset_test_counters(); const uint8_t chunk[] = { 0x...
/* * 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(version_compare((Version) { 6, 0 }, (Version) { 5, 1 }) > 0)
*/ /* * NOTE * If there is not enough room to make another */ /* entry then we will not adjust the size of */ /* this entry to match the amount requested. */ if (heap_info_ptr->Size < (n_units + HEAP_INFO_BLOCK_SIZE(MINIMUM_MEMORY_SIZE))) { // Nope! Just use the whol...
util_dbgserial_str(buffer)
; heap_unlock(heap); } #endif
/* * 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...
{ PBL_LOG(LOG_LEVEL_DEBUG, "stopping tick timer"); regular_timer_remove_callback(&s_tick_timer_info); }
}
-632}, { 368, 560, -664}, { 128, 416, -568}, { 24, 464, -680}, { 176, 560, -752}, { 256, 512, -600}, { 472, 552, -608}, { 728, 600, -656}, { 896, 440, -744}, { 1040, 488, -680}, { 1024, 352, -672}, { 904, 272, -544}, // 133 seconds { 832, 192, -480}, { 840, 160, ...
{ 736, 392, -560}, { 736, 392, -560}, { 744, 392, -552}, { 744, 384, -560}, { 728, 392, -560}, { 736, 352, -552}, { 720, 400, -552}, { 704, 408, -600}, { 696, 400, -600}, { 672, 416, -608}, { 688, 400, -616}, { 680, 400, -616}, { 680, 392, -608}, { 680, 392, -600}...
{ 192, -192, -920}, { 232, -224, -904}, { 208, -240, -880}, { 200, -224, -904}, { 248, -224, -928}, { 328, -232, -928}, // 141 seconds { 288, -248, -944}, { 288, -224, -960}, { 216, -232, -944}, { 232, -232, -912}, { 224, -256, -912}, { 208, -256, -920}, { 216, -...
/* * 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_assert( (BOOT_FPGA_FLASH_ADDR + sizeof(BootFPGAHeader) + sizeof(s_boot_fpga)) < FLASH_REGION_MFG_INFO_END, "FPGA bitstream will overflow FLASH_REGION_MFG_INFO!")
; #endif flash_write_bytes((const uint8_t *)&fpga_header, BOOT_FPGA_FLASH_ADDR, sizeof fpga_header); flash_write_bytes((const uint8_t *)s_boot_fpga, BOOT_FPGA_FLASH_ADDR + sizeof fpga_header, sizeof s_boot_fpga); }
/* * 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...
mutex_create_recursive()
; for (int i=0; i < 10000; i++) { mutex_lock_recursive(s_rmutex); } for (int i=0; i < 10000; i++) { mutex_unlock_recursive(s_rmutex); } mutex_destroy((PebbleMutex *)s_rmutex); s_rmutex = NULL; PROFILER_STOP; PROFILER_PRINT_STATS; } static void s_main(void) { window = window_create(); app_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...
prv_fetch_struct()
.disp_offset_x, .y = prv_fetch_struct().disp_offset_y }; } void mfg_info_set_disp_offsets(GPoint p) { MfgData data = prv_fetch_struct(); data.disp_offset_x = p.x; data.disp_offset_y = p.y; prv_update_struct(&data); } uint32_t mfg_info_get_rtc_freq(void) { return prv_fetch_struct().rtc_freq; } void mf...
/////////////// void test_list__initialize(void) { } void test_list__cleanup(void) { } void test_list__insert_after(void) { ListNode *tail = NULL; ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL; tail = list_insert_after(tail, &a); cl_assert(tail == &a); tail = list_insert_after(&a, &b); cl_assert(tail =...
list_get_next(head)
total message size. This is more complicated if there are strings // Start with the header and the number of parameters. unsigned num_strings = (str_index_1 ? 1 : 0) + (str_index_2 ? 1 : 0); unsigned msg_size = sizeof(BinLogMessage_Param_v1) + (num_fmt_conversions - num_strings) * sizeof(uin...
vsnprintf((char *)msg_buffer + header_length, msg_buffer_size - header_length, expanded_fmt_buffer, args)
; length += header_length; va_end(args); if ((length + 2) >= msg_buffer_size) { length -= 2; } msg_buffer[length++] = '\r'; msg_buffer[length++] = '\n'; prv_log_to_buffer((uint8_t *)msg_buffer, length); } #else // PBL_LOGS_HASHED static char prv_get_log_level_char(uint8_t log_level) { switch (lo...
AlarmKind kind) { prv_alarm_operation(id, prv_set_alarm_kind_op, (void *)(uintptr_t)kind); } // ---------------------------------------------------------------------------------------------- static bool prv_set_alarm_custom_op(AlarmId id, AlarmConfig *config, void *context) { const bool (*scheduled_days)[DAYS_PER...
(s_mutex, portMAX_DELAY)
; const bool alarm_is_scheduled = (s_next_alarm_time != 0); bool is_next_alarm_smart = false; if (alarm_is_scheduled) { is_next_alarm_smart = s_next_alarm.config.is_smart; } mutex_unlock(s_mutex); return is_next_alarm_smart; } // ---------------------------------------------------------------------...
et_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
; graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_...
/* * 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...
{ pulse_start(); s_pulse_started = true; }
#endif #endif } #if IS_BIGBOARD NORETURN test_infra_quarantine_board(const char *quarantine_reason) { PBL_LOG(LOG_LEVEL_INFO, "Quarantine Board: %s", quarantine_reason); boot_bit_set(BOOT_BIT_FORCE_PRF); core_dump_reset(true /* is_forced */); } #endif /* IS_BIGBOARD */
s_notification(ARRAY_LENGTH(s_loading_response), (uint8_t*) s_loading_response); s_num_ds_notifications_received++; } else if (uid == no_content_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_this_message_has_no_content_response), (uint8_t*) s_...
fake_kernel_services_notifications_ancs_notifications_count()
, 4); // Get 4 2-part notifications prv_send_notification((uint8_t *)&s_chunked_dict_part_one); prv_send_notification((uint8_t *)&s_chunked_dict_part_one); prv_send_notification((uint8_t *)&s_chunked_dict_part_one); prv_send_notification((uint8_t *)&s_chunked_dict_part_one); cl_assert_equal_i(s_num_request...
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), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2); cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MAX); cl_as...
prv_clear_handler_histories()
/* * 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...
(RCC->AHB1ENR, (0x1 << idx))
data to use it to its full capability. // // So this function is broken into 3 parts: // 1. Do reads 1 byte at a time until buffer_ptr is word-aligned // 2. Do 32-bit DMA transfers for as much as possible // 3. Do reads 1 bytes at a time to deal with non-aligned acceses at the end const uint32_t word_mask...
QSPI_AutoPollingModeStopCmd(ENABLE)
; prv_set_ddr_enabled(false); // Prepare transaction uint32_t modes_bitset = 0; modes_bitset |= QSPI_ComConfig_FMode_Auto_Polling; modes_bitset |= QSPI_ComConfig_DMode_4Line; modes_bitset |= QSPI_ComConfig_IMode_4Line; modes_bitset |= instruction; prv_set_comm_config(modes_bitset, 0); uint32_t loop...
ill return X, Y, Z data #define WHO_AM_I_REG 0x07 #define SYSMOD_REG 0x08 #define CTRL_REG1 0x10 #define CTRL_REG2 0x11 static bool mag3110_read(uint8_t reg_addr, uint8_t data_len, uint8_t *data) { return i2c_read_register_block(I2C_MAG3110, reg_addr, data_len, data); } static bool mag3110_w...
(s_mag_mutex)
; return (MagReadMagOff); } MagReadStatus rv = MagReadSuccess; uint8_t raw_data[7]; // DR_STATUS_REG is immediately before data registers if (!mag3110_read(DR_STATUS_REG, sizeof(raw_data), raw_data)) { rv = MagReadCommunicationFail; goto done; } // TODO: shouldn't happen at low sample rate,...
/* * 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...
{ // Fall back to a subsector erase s_erase_state.next_erase_addr += SUBSECTOR_SIZE_BYTES; PBL_ASSERTN(s_erase_state.next_erase_addr <= s_erase_state.end_addr); flash_erase_subsector(addr, prv_async_erase_done_cb, NULL); }
} void flash_erase_optimal_range( uint32_t min_start, uint32_t max_start, uint32_t min_end, uint32_t max_end, FlashOperationCompleteCb on_complete, void *context) { PBL_ASSERTN(((min_start & (~SUBSECTOR_ADDR_MASK)) == 0) && ((max_end & (~SUBSECTOR_ADDR_MASK)) == 0) && (min_start ...
t only. This code was added on top of base clar. case 't': { int offset = (argument[2] == '=') ? 3 : 2; char *test_name = argument + offset; const struct clar_suite *suite = &_clar_suites[0]; const struct clar_func *test_funcs = suite->tests; const struct clar_func *test = NULL; ...
error->error_msg = error_msg; if (description != NULL) error->description = strdup(description); _clar.suite_errors++; _clar.total_errors++; if (should_abort) { if (!_clar.trampoline_enabled) { clar_print_onabort( "Fatal error: a cleanup method raised an exception."); clar_repor...
tware * 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 License. */ #include "clar.h" #include "applib/graphics/gtypes.h" #inc...
(GColorRedARGB8, ctx.draw_state.fill_color.argb)
; graphics_context_set_fill_color(&ctx, (GColor8){.a= 2, .r = 3}); cl_assert_equal_i(GColorRedARGB8, ctx.draw_state.fill_color.argb); graphics_context_set_fill_color(&ctx, (GColor8){.a= 1, .r = 3}); cl_assert_equal_i(GColorClearARGB8, ctx.draw_state.fill_color.argb); graphics_context_set_fill_color(&ctx, (GCo...
cl_assert_equal_i(s_invalidate_addr, 0x20)
; cl_assert_equal_i(s_invalidate_size, 0x08); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid); } void test_cpu_cache__userspace_ignore(void) { cl_will_return(icache_is_enabled, true); cl_will_return(dcache_is_enabled, true); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, ...
/* * 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 false; }
void app_fetch_cancel_from_system_task(void) { } void comm_session_app_session_capabilities_evict(const Uuid *app_uuid) { } void put_bytes_cancel(void) { } // Fakes //////////////////////////////////// uint32_t time_get_uptime_seconds(void) { return rtc_get_time(); } void launcher_task_add_callback(void (*callb...
; grect_align(&dot_frame, root_frame, GAlignCenter, false); GRect from; GRect to; if (fly_in) { to = dot_frame; from = dot_frame; from.origin.x = -to.size.w; } else { from = dot_frame; to = dot_frame; to.origin.x = -from.size.w; } data->mic_window.mic_dot_radius = MIC_DOT_MAX_RADI...
VOICE_LOG("Exit UI")
; prv_cancel_dictation(data); DictationSessionStatus status = DictationSessionStatusFailureTranscriptionRejected; if ((data->error_count > 0) && !data->last_session_successful) { status = DictationSessionStatusFailureTranscriptionRejectedWithError; } prv_exit_and_send_result_event(context, sta...
th */, TIMEOUT_MS); uint8_t fake_data[max_length]; memset(fake_data, 0, max_length); comm_session_send_buffer_write(write_sb, fake_data, max_length); comm_session_send_buffer_end_write(write_sb); // Set a yield callback that gives the semph in tim...
htons(max_payload_length)
); cl_assert_equal_i(header->endpoint_id, htons(ENDPOINT_ID)); cl_assert_equal_i(memcmp(pp_data_out + sizeof(PebbleProtocolHeader), fake_data_payload, max_payload_length), 0); // ..._copy() with offset: int offset = 2; bytes_copied = s_default_kernel_send_job_impl.copy(job, o...
of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the spe...
{ const uint16_t vsys_mv = prv_get_vsys_mv(); PBL_ASSERTN(vsys_mv > 0); duty_cycle = (BOARD_CONFIG_VIBE.vsys_scale * duty_cycle) / vsys_mv; }
return duty_cycle; } } static void prv_vibe_raw_ctl(bool on) { if (BOARD_CONFIG_VIBE.options & ActuatorOptions_Pwm) { const uint32_t duty_cycle = (on) ? s_vibe_duty_cycle : PWM_DUTY_CYCLE_OFF; prv_vibe_pwm_enable(on); pwm_set_duty_cycle(&BOARD_CONFIG_VIBE.pwm, s_vibe_duty_cycle); } if (BOARD_...
&& s_session_is_valid; } static bool s_data_sent; bool comm_session_send_data(CommSession *session, uint16_t endpoint_id, const uint8_t* data, size_t length, uint32_t timeout_ms) { // The request is just a single 0x00 byte to endpoint 0x11: cl_assert_equal_i(endpoint_id, 0x11); cl_as...
(fake_event_get_count(), 0)
; cl_assert_equal_i(s_capability_flags, s_expected_capabilities); }
ms(1020); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 2); cl_assert_equal_i(average_ms, 1010); // invalid interval, too high fake_rtc_increment_time_ms(1220); interval_timer_take_sample(&timer); num_intervals = interval...
cl_assert_equal_i(average_ms, 1027)
/* * 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_m(&contact->id, &uuid, UUID_SIZE)
; cl_assert_equal_i(contact->flags, 0); cl_assert_equal_i(contact->attr_list.num_attributes, 1); cl_assert_equal_i(contact->addr_list.num_addresses, 1); contacts_free_contact(contact); }
RIGHTNESS_OFF; s_timer_id = new_timer_create(); s_num_buttons_down = 0; s_user_controlled_state = false; s_mutex = mutex_create(); } void light_button_pressed(void) { mutex_lock(s_mutex); s_num_buttons_down++; if (s_num_buttons_down > 4) { PBL_LOG(LOG_LEVEL_ERROR, "More buttons were pressed than hav...
DEFINE_SYSCALL(void, sys_light_enable_respect_settings, bool enable)
InvalidParameter); } void test_gap_le_connect__register_non_existing_bonding(void) { BTErrno e = gap_le_connect_connect_by_bonding(~0, true /* auto_reconnect */, false /* is_pairing_required */, ...
(e, BTErrnoOK)
; // Assert registrations: registered = gap_le_connect_has_connection_intent(&device, GAPLEClientApp); cl_assert_equal_b(registered, true); registered = gap_le_connect_has_connection_intent(&device, GAPLEClientKernel); cl_assert_equal_b(registered, true); // Only one registration (co-owned by the 2 client...
tCenter); { // do all this in a block so we enforce that nobody uses these variables outside of the block // when dealing with round displays, sizes change depending on location. const GRect probe_rect = GRect(x, y + text_single_line_text_offset_px, w, max_text_line_heig...
applib_free(workout_dialog->subtext_buffer)
; } if (workout_dialog->dialog.destroy_on_pop) { applib_free(workout_dialog); } } void workout_dialog_init(WorkoutDialog *workout_dialog, const char *dialog_name) { PBL_ASSERTN(workout_dialog); *workout_dialog = (WorkoutDialog){}; dialog_init(&workout_dialog->dialog, dialog_name); Window *window = ...
rue); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 100, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricDistanceMeters, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, exp_distance, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetr...
(ActivityMetricStepCount, ((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, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){1 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0, 0})); /...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(data != NULL && should_store != NULL && hdlc_error != NULL)
; bool is_complete = false; *hdlc_error = false; *should_store = false; if (*data == HDLC_FLAG) { if (ctx->escape) { // extra escape character before flag ctx->escape = false; *hdlc_error = true; } // we've reached the end of the frame is_complete = true; } else if (*data == ...
/* * 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...
dialog_set_icon(dialog, data->warning_icon)
/vibes/vibe_score.h" #include "services/normal/vibes/vibe_score_info.h" #include "system/logging.h" #include "system/passert.h" #include "util/string.h" #include <string.h> typedef enum VibeSettingsRow { VibeSettingsRow_Notifications = 0, VibeSettingsRow_PhoneCalls, VibeSettingsRow_Alarms, VibeSettingsRow_Sys...
{ data->toggled_vibes_mask |= VibePatternFeature_Notifications; client = VibeClient_Notifications; break; }
case VibeSettingsRow_PhoneCalls: { data->toggled_vibes_mask |= VibePatternFeature_PhoneCalls; client = VibeClient_PhoneCalls; break; } case VibeSettingsRow_Alarms: { data->toggled_vibes_mask |= VibePatternFeature_Alarms; client = VibeClient_Alarms; break; } case ...
/* * 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 (binary < 26) { return binary + 'A'; } else if (binary < 52) { return binary - 26 + 'a'; } else if (binary < 62) { return binary - 52 + '0'; } else if (binary == 62) { return '+'; } else if (binary == 63) { return '/'; } else { WTF; }
} int32_t base64_encode(char *out, int out_len, const uint8_t *data, int32_t data_len) { int result = (data_len + 2) / 3 * 4; if (result > out_len) { return result; } int32_t i; for (i = 0; i < data_len - 2; i += 3) { *out++ = prv_encode_char(data[i] >> 2); *out++ = prv_encode_char(((data[i] & ...
IC bool prv_gdraw_command_scale_segmented(GDrawCommand *command, uint32_t index, void *context) { ScaleToCBContext *scale = context; const ScaleToGValues * const gvalues = (command->type == GDrawCommandTypePrecisePath) ? &scale->values.precise : &scale->values.i...
(stroke_width, scale->to, scale->to_op)
; const uint16_t new_stroke_width = interpolate_int64_linear( scale->progress, from_stroke_width.raw_value, to_stroke_width.raw_value); gdraw_command_set_stroke_width( command, ((new_stroke_width + FIXED_S16_3_HALF.raw_value) >> FIXED_S16_3_PRECISION)); return true; } void gdraw_command_list_scale_...
ProcessAppSDKType sdk_type, int16_t obstruction_origin_y) { s_app_state_ptr = memory_segment_split(app_state_ram, NULL, sizeof(AppState)); if (!s_app_state_ptr) { return false; } s_app_state_ptr->sdk_type = sdk_type; s_app_state_ptr->initial_obstruction_origin_y = obstr...
{ return &s_app_state_ptr->gmtime_tm; }
struct tm *app_state_get_localtime_tm(void) { return &s_app_state_ptr->localtime_tm; } char *app_state_get_localtime_zone(void) { return s_app_state_ptr->localtime_zone; } void *app_state_get_rand_ptr(void) { return &s_app_state_ptr->rand_seed; } AppInbox **app_state_get_app_message_inbox(void) { return &s_ap...
static uint32_t s_num_connected_services = 0; static PebbleMutex *s_services_lock; void smartstrap_state_init(void) { s_state_lock = mutex_create(); s_services_lock = mutex_create(); s_max_services = smartstrap_profiles_get_max_services(); s_connected_services = kernel_zalloc_check(s_max_services * sizeof(uin...
{ if (prv_find_connected_service(service_id) != -1) { // already connected return; } // insert the service_id PBL_ASSERTN(s_num_connected_services < s_max_services); s_connected_services[s_num_connected_services++] = service_id; }
MON_CONFIG[PMIC_MON_CONFIG_VSYS_INDEX]; prv_set_mon_config(mon_config); ADCVoltageMonitorReading reading = battery_read_voltage_monitor(); uint32_t millivolts = battery_convert_reading_to_millivolts(reading, mon_config->ratio, 1); prv_set_mon_config_register(0); prv_mon_config_unlock(); return (uint16_t)...
{ system_task_add_callback_from_isr(prv_handle_pmic_interrupt, NULL, should_context_switch); }
/* Private Function Implementations */ static bool prv_is_alive(void) { uint8_t val; prv_read_register(0x00, &val); if (val == 0x01) { PBL_LOG(LOG_LEVEL_DEBUG, "Found the max14690"); return true; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error: read max14690 whomai byte 0x%x, expecting 0x%x...