prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
min, .slave_latency_events = evt->conn_params.slave_latency, .supervision_timeout_10ms = evt->conn_params.sup_timeout, }, .peer_address = addr, .status = HciStatusCode_Success, .is_master = evt->is_master, .handle = evt->conn_idx, }, }; // Store the current local a...
{ PBL_LOG(LOG_LEVEL_INFO, "Disconnected: idx=%"PRIu16", reason=0x%"PRIx8, evt->conn_idx, evt->reason); local_addr_handle_disconnection(); Connection *conn = connection_by_idx_check(evt->conn_idx); BTDeviceInternal addr; connection_get_address(conn, &addr); BleDisconnectionCompleteEvent event = ...
static void prv_handle_evt_gap_sec_level_changed(const ble_evt_gap_sec_level_changed_t *evt) { PBL_LOG(LOG_LEVEL_INFO, "Security level changed to: %u", evt->level); Connection *conn = connection_by_idx(evt->conn_idx); if (conn == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "No connection for idx=%d", evt->conn_idx); ...
----------------------------------------------------------------------------------------- static Animation *prv_complex_init(Animation *parent_h, Animation **animation_array, uint32_t array_len, AnimationType type) { AnimationState *state = prv_animation_state_get(PebbleTask_Current...
prv_find_animation_by_handle(state, clone_h, false /*quiet*/)
y2) <= 40, "Breaking back-compatibility!"); _Static_assert(sizeof(AnimationLegacy2Scheduler) <= 16, "Breaking back-compatibility!"); #endif // Pack a function pointer into 28 bits. We do this by dropping bits // 1, 26, 30 and 31 and packing the remainder together. static uintptr_t prv_custom_curve_ptr_pack(AnimationC...
app_timer_register(interval_ms, (AppTimerCallback) animation_legacy2_timer_callback, animation_legacy2_scheduler)
; PBL_ASSERTN(animation_legacy2_scheduler->timer_handle != NULL); } } static void animation_legacy2_private_schedule(AnimationLegacy2 *animation, AnimationLegacy2Scheduler* animation_legacy2_scheduler) { PBL_ASSERTN(animation != NULL); PBL_ASSERTN(animation->implementation->update != NULL); if (...
/* * 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...
(FLASH_BASE + 12345, 1, NULL, NULL)
); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_some_sectors_from_beginning(void) { cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_sys...
VEAttributeIdTimestamp, attr_list_size); if (timestamp_attr && timestamp_attr->length == sizeof(uint32_t)) { uint32_t *timestamp_ptr = (uint32_t*)timestamp_attr->data; timestamp = *timestamp_ptr; } GenericAttribute *reminder_attr = generic_attribute_find_attribute(&msg->attr_list, VEAttribute...
kernel_free(msg)
t StatsBasicOp op = (StatsBasicOp_Sum | StatsBasicOp_Average | StatsBasicOp_Count | StatsBasicOp_Min | StatsBasicOp_Max); stats_calculate_basic(op, daily_totals.totals, ARRAY_LENGTH(daily_totals.totals), health_service_private_weekday_filter, (void *)(uintptr_t)local_tm->tm_wday, ...
{ HealthServiceMetricStats stats; if (!prv_get_metric_stats(state, metric, &stats, day_in_week)) { return false; } HealthValue value_per_day = stats.weekly.avg; default_value = value_per_day / ACTIVITY_NUM_METRIC_AVERAGES; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uint32_t digit = (num & (0xf << (i * 4))) >> (i * 4); char c; if (digit < 0xa) { c = '0' + digit; } else if (digit < 0x10) { c = 'a' + (digit - 0xa); } else { c = ' '; } *buffer++ = c; }
*buffer = '\0'; } static int8_t ascii_hex_to_int(const uint8_t c) { if (isdigit(c)) return c - '0'; if (isupper(c)) return (c - 'A') + 10; if (islower(c)) return (c - 'a') + 10; return -1; } static uint8_t ascii_hex_to_uint(const uint8_t msb, const uint8_t lsb) { return 16 * ascii_hex_to_int(msb) + asci...
undefined value. return rocky_error_unexpected_type(0, "JSON.stringify()-able object"); } const uint32_t str_size = jerry_get_utf8_string_size(json_string) + 1 /* trailing zero */; char *const data_buffer = task_zalloc(str_size); if (!data_buffer) { return prv_create_oom_error(); } jerry_string_to...
{ return false; }
/* * 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...
graphics_context_set_stroke_color(ctx, GColorBlack)
; graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_st...
void) { // Force in an old data version. typedef struct { uint32_t data_version; uint32_t color; uint32_t rtc_freq; } MfgDataV1; MfgDataV1 old_data = { .data_version = 1, .color = 3, .rtc_freq = 4 }; flash_write_bytes((const uint8_t*) &old_data, FLASH_REGION_MFG_INFO_BEGIN...
(memcmp(fpga_buffer + HEADER_SIZE, s_boot_fpga, sizeof(s_boot_fpga)) == 0)
mode == LayoutLayerModePinnedThin, false)) { const bool is_future = (layout->info->scroll_direction == TimelineScrollDirectionDown); const int padding_left = is_future ? 25 : 29; text_node->node.offset.x += padding_left; text_node->node.margin.w += padding_left; } return &text_node->node; } static ...
(num_vertical_nodes)
; const bool is_future = (layout->info->scroll_direction == TimelineScrollDirectionDown); const bool is_peek = (layout->layout_layer.mode == LayoutLayerModePeek); vertical_node->vertical_alignment = is_peek ? GVerticalAlignmentCenter : PBL_IF_ROUND_ELSE((is_future ? GVerticalAlignmentBottom : GVerticalAlign...
_node.next; } // Setup the subsampling numerator and denominators state = (AccelSubscriberState *)s_data_subscribers; while (state) { uint16_t new_num, new_den; if ((highest_rate % state->sampling_rate) == 0) { new_num = 1; new_den = highest_rate / state->sampling_rate; } else { P...
accel_get_latest_timestamp()
; // Else, change the FIFO to 1 deep and wait for a reading ACCEL_LOG_DEBUG("setting FIFO to 1 deep for peek"); accel_set_num_samples(1); s_accel_samples_per_update = 1; // Set a timer to restore settings after a while prv_set_restore_fifo_mode_timer(); int max_loops = 12; ...
/* * 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_push(1)
; prv_test_backing_data(0, 0); prv_test_backing_data(1, 1); prv_test_backing_data_empty(2); prv_push(2); prv_test_backing_data(0, 0); prv_test_backing_data(1, 1); prv_test_backing_data(2, 2); prv_push(3); prv_test_backing_data(0, 3); prv_test_backing_data(1, 1); prv_test_backing_data(2, 2); p...
cation_storage_store(&e); TimelineItem r; cl_assert(notification_storage_get(&i, &r)); compare_notifications(&e, &r); free(r.allocated_buffer); notification_storage_set_status(&i, TimelineItemStatusActioned); cl_assert(notification_storage_get(&i, &r)); cl_assert(uuid_equal(&e.header.id, &r.header.id));...
(r.allocated_buffer)
urns the order in which (a, b) occurs // returns negative int for a descending value (a > b), positive for an ascending value (b > a), // 0 for equal static int prv_timer_expire_compare_func(void* a, void* b) { if (((TaskTimer*)b)->expire_time < ((TaskTimer*)a)->expire_time) { return -1; } else if (((TaskTimer*...
{ xSemaphoreGive(manager->semaphore); }
mutex_unlock(manager->mutex); return true; } // -------------------------------------------------------------------------------- // Return scheduled status bool task_timer_scheduled(TaskTimerManager *manager, TaskTimerID timer_id, uint32_t *expire_ms_p) { mutex_lock(manager->mutex); // Find this timer in ou...
/* * 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 (resp) { resp->opcode = PULSE_PP_OPCODE_DATA; const size_t bytes_to_copy = MIN(bytes_remaining, mss); comm_session_send_queue_copy(session, 0 /* start_offset */, bytes_to_copy, &resp->data[0]); pulse_reliable_send(resp, bytes_to_copy + sizeof(PulsePPPacket)...
} } static void prv_reset(Transport *transport) { PBL_LOG(LOG_LEVEL_INFO, "Unimplemented"); } static void prv_granted_kernel_main_cb(void *ctx) { ResponsivenessGrantedHandler granted_handler = ctx; granted_handler(); } static void prv_set_connection_responsiveness( Transport *transport, BtConsumer consu...
; // Setup void test_graphics_draw_line__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_line__cleanup(void) { free(fb); } // Tests //////////////////////////////////// void inside_layer_update_callback(Layer* me...
(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_nx_offset_layer")))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_y_offset_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc...
; cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)); // check fifth cl_assert(iter_next(&iterator)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); // check sixth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.heade...
(iter_prev(&iterator))
; cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[3].header.id)); #if CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[2].header.id)); #endif cl_assert(!iter_prev(&iterator)); } static int prv_num_items(Iterator iterator) { i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_fetch_cancel_from_system_task(app_id)
; return S_SUCCESS; } else { // ignore the deletion and send back a failure message. The phone will retry later. return E_BUSY; } } //! SettingsFileEachCallback function is used to iterate over all keys and find the largest //! AppInstallId currently being using. static bool prv_each_inspect_ids(Settin...
/* * 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...
(context, (--s_simulate_flash_driver_error_countdown? S_SUCCESS : E_BUSY))
; } bool new_timer_add_work_callback(NewTimerWorkCallback cb, void *data) { if (--s_simulate_work_queue_full_countdown == 0) { return false; } cb(data); return true; } static void prv_assert_erase_commands(EraseCommand *commands) { int expected_command_count = 0; EraseCommand *cursor = commands; whi...
d, 0, 150, 0}, { 0, 0x7d, 0, 150, 0}, { 0, 0x7d, 0, 150, 0}, { 0, 0x7d, 0, 151, 0}, { 0, 0x7d, 0, 151, 0}, { 0, 0x7d, 0, 151, 0}, { 0, 0x7d, 0, 151, 0}, { 0, 0x7d, 138, 151, 0}, { 0, 0x7d, 0, 151, 0}, { 0, 0x7d, 0, 151, 0}, { 0, 0x7d, 0, 151, 0}, { 0, 0x7d, 0, 151, 0}, { ...
{ 0, 0x5a, 0, 150, 0}, { 8, 0x69, 600, 150, 0}, { 0, 0x77, 1000, 151, 0}, { 0, 0x7, 0, 151, 0}, { 0, 0x7, 0, 151, 0}, // 870: Local time: 04:51:00 AM { 0, 0x7, 0, 151, 0}, { 0, 0x7, 0, 151, 0}, { 0, 0x7, 0, 151, 0}, { 16, 0x62, 8336, 150, 0}, { 0, 0x72, 817, 150, 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...
ARRAY_LENGTH(s_override_table)
/* * 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...
for (uint16_t i = 0; i < size; i++) { if ((str[i] < (utf8_t)' ') && (str[i] != '\x08')) { return false; } }
return true; } bool transcription_validate(const Transcription *transcription, size_t size) { if (!transcription || (size <= sizeof(Transcription)) || (transcription->type != TranscriptionTypeSentenceList)) { return false; } uint8_t *end = (uint8_t *)transcription + size; uint8_t *cursor =...
list_mutex); mutex_lock(s_list_mutex); // can't schedule an already scheduled job PBL_ASSERTN(!prv_is_scheduled(new_job)); // can't schedule after an unscheduled job PBL_ASSERTN(prv_is_scheduled(job)); // copy schedule info from existing job CronJob temp_job = *job; list_init(&temp_job.list_node); ...
{ if (cron->wday & (1 << cron_tm->tm_wday)) { break; } // Advance the day. cron_tm->tm_mday++; cron_tm->tm_wday = (cron_tm->tm_wday + 1) % DAYS_PER_WEEK; adjusted = true; }
{ -888, 432, 32}, { -1176, 456, -8}, { -1016, 448, -80}, { -1096, 472, -168}, { -1104, 456, -88}, { -960, 496, -192}, { -720, 472, -288}, { -416, 352, -216}, { -280, 288, -192}, { -360, 440, -192}, { -448, 368, -56}, { -584, 504, -120}, { -632, 536, -80}, // 13 sec...
// 18 seconds { -504, 352, 40}, { -608, 384, 48}, { -720, 464, 16}, { -1064, 528, 16}, { -1072, 480, 16}, { -1152, 568, -72}, { -1048, 592, -88}, { -904, 616, -256}, { -1072, 592, -232}, { -776, 456, -96}, { -424, 384, -144}, { -296, 416, -176}, { -296, 336, -96},...
{ -456, 328, -64}, { -360, 368, -184}, { -336, 352, -152}, { -456, 360, -112}, { -576, 376, -48}, { -704, 408, -16}, { -816, 512, -80}, { -976, 576, -128}, { -1304, 624, -96}, // 21 seconds { -1392, 672, -152}, { -1080, 608, -32}, { -1000, 632, -104}, { -832, 512...
/* * 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...
(buf == 1)
, { 1448, -24, -96}, { 1168, -32, -160}, { 872, -40, -280}, { 648, -32, -360}, { 872, -24, -352}, { 1136, -80, -240}, // 104 seconds { 1136, -112, -200}, { 984, -88, -224}, { 896, -48, -312}, { 944, 16, -336}, { 944, 16, -360}, { 968, 40, -400}, { 904, 80, -432}, ...
{ 1160, -168, -96}, { 1168, -160, -72}, { 1088, -144, -32}, { 1024, -96, -40}, { 984, -24, -56}, { 984, -24, -32}, { 1040, -32, -40}, { 1064, -48, -48}, { 1024, -72, -88}, { 984, -112, -96}, { 960, -128, -96}, { 1016, -104, -120}, { 1080, -104, -128}, { 1096, -120...
{ 1016, -88, -352}, { 1104, -112, -336}, { 1496, -80, -320}, { 1344, -48, -336}, { 928, -56, -296}, { 680, -40, -288}, { 1112, -16, -256}, { 1336, -56, -120}, { 1056, -96, -80}, { 912, -56, -184}, { 928, -24, -208}, { 952, -48, -192}, { 976, -64, -176}, { 984, -8...
and * limitations under the License. */ #include "applib/graphics/gtypes.h" #include "clar.h" #include "stubs_app_state.h" #include "stubs_heap.h" #include "stubs_passert.h" #include "stubs_process_manager.h" void test_graphics_colors__black(void) { cl_assert(GColorBlack.r == 0b00); cl_assert(GColorBlack.g ==...
(GColorWhiteARGB8, gcolor_get_grayscale(GColorWhite).argb)
; cl_assert_equal_i(GColorBlackARGB8, gcolor_get_grayscale(GColorBlack).argb); cl_assert_equal_i(GColorLightGrayARGB8, gcolor_get_grayscale(GColorLightGray).argb); cl_assert_equal_i(GColorDarkGrayARGB8, gcolor_get_grayscale(GColorDarkGray).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_grayscale(GColorYe...
0, 148, 0}, { 0, 0x71, 0, 148, 0}, { 0, 0x71, 0, 148, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 147, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 149, 0}, { 0, 0x71, 0, 147, 0}, // 240: Local time: 10:11:00 PM { 0, 0x71, 0, 149, 0}, ...
{ 0, 0x36, 0, 150, 0}, { 0, 0x36, 0, 148, 0}, // 345: Local time: 11:56:00 PM { 0, 0x36, 0, 150, 0}, { 0, 0x36, 0, 150, 0}, { 0, 0x36, 0, 150, 0}, { 0, 0x36, 0, 152, 0}, { 0, 0x36, 0, 148, 0}, { 0, 0x36, 0, 150, 0}, { 0, 0x36, 0, 150, 0}, { 0, 0x36, 0, 150, 0}, { 0, 0x36,...
{ 0, 0x36, 0, 151, 0}, { 0, 0x36, 0, 151, 0}, { 0, 0x36, 0, 151, 0}, { 0, 0x36, 0, 149, 0}, { 0, 0x36, 0, 151, 0}, { 0, 0x36, 0, 151, 0}, { 0, 0x36, 0, 151, 0}, { 0, 0x36, 0, 151, 0}, { 0, 0x36, 0, 150, 0}, // 405: Local time: 12:56:00 AM { 0, 0x36, 15, 151, 0}, { 0, 0x3...
/* * 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...
{ char c = str[i]; str[i] = str[j]; str[j] = c; }
} /* itoa: convert n to characters in s */ void itoa_int(int n, char *str, int base) { bool neg; if ((neg = (n < 0))) { /* record sign */ n = -n; /* make n positive */ } int i = 0; do { /* generate digits in reverse order */ str[i++] = (n %...
++buffer; } if (buffer >= buffer_end) { args.num_args = i; return args; } // Yay, a param! args.args[i] = buffer; // Skip over the param and set us up for the next one. while (buffer < buffer_end && *buffer != ' ') { ++buffer; } *(buffer++) = 0; } args...
if (UNLIKELY(c == 0x4)) { // CTRL-D dbgserial_putstr("^D"); serial_console_set_state(SERIAL_CONSOLE_STATE_LOGGING); return; }
if (UNLIKELY(c == 0xd)) { // Enter key s_executing_command = ExecutingCommandDbgSerial; system_task_add_callback_from_isr(prv_execute_command_from_dbgserial, NULL, should_context_switch); return; } if (UNLIKELY(c == 0x7f)) { // Backspace if (s_dbgserial_pro...
gbitmap_create_blank(bitmap_size, PBL_IF_COLOR_ELSE(GBitmapFormat8Bit, GBitmapFormat1Bit)); s_ctx.dest_bitmap = *s_dest_bitmap; s_ctx.draw_state.clip_box.size = bitmap_size; s_ctx.draw_state.drawing_box.size = bitmap_size; // Fill the bitmap with pink so it's easier to s...
(s_menu_system_cell_layer_test_column_data)
, /* is_legacy2 */ false); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_menu_layer_system_cells__cell_width_180(void) { const int16_t cell_width = 180; prv_prepare_canvas_and_render_cells( MenuCellType_CellLayer, cell_width, s_menu_system_cell_layer_test_column_data, ...
"draw_arc_origin_aa_precise_%s_%s_.${BIT_DEPTH_NAME}.pbi", precision_modes[precision_mode], mode_names[mode]); cl_check_(gbitmap_pbi_eq(&ctx.dest_bitmap, filename), filename); center.y.integer -= DRAWING_SPACING; angle_end += TRIG_MAX_ANGLE / 4; } center.x.fraction = 4; center...
TO_TRIG(360 + 90)
const Layer *cell_layer, uint16_t row, bool selected) { SettingsNotificationsData *data = ((SettingsOptionMenuData *)context)->context; const char *subtitle = NULL; const char *title = NULL; switch (row) { case NotificationsItemFilter: title = i18n_noop("Filter"); subtit...
i18n_noop("Notifications")
, .init = prv_init, }; return &s_module_info; } void analytics_external_collect_notification_settings(void) { const uint8_t strength = get_strength_for_intensity(vibe_intensity_get()); analytics_set(ANALYTICS_DEVICE_METRIC_SETTING_VIBRATION_STRENGTH, strength, AnalyticsClient_System); }
bool schedule_6[7] = {false, false, false, false, true, false, false}; char alarm_day_text_6[32] = {0}; alarm_get_string_for_custom(schedule_6, alarm_day_text_6); cl_assert_equal_s(alarm_day_text_6, "Thursdays"); bool schedule_7[7] = {false, false, false, false, false, true, false}; char alarm_day_text_7[32]...
alarm_get_string_for_kind(ALARM_KIND_WEEKENDS, all_caps)
ack pointer) // LR = 0xFFFFFFFF // PC = VECTOR_TABLE[1] // PRIMASK = 0x0 // FAULTMASK = 0x0 // BASEPRI = 0x0 // CONTROL = 0x0 // // Attempt to put the processor into as close to the reset state as possible // before passing control to the firmware. // // No attempt is made to s...
if (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)) { dbgserial_putstr("Hold down UP + BACK for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK))) { // stop waiting if not held down any lo...
void *reset_vector, *initial_sp; prv_get_fw_reset_vector(&reset_vector, &initial_sp); if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initial_sp == 0xffffffff) { dbgserial_putstr("Firmware is erased"); return true; } return false; } static void sad_watch(uint32_t error_code) { dbgse...
de "services/normal/app_cache.h" #include "services/normal/blob_db/app_db.h" #include "services/normal/process_management/app_storage.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util/math.h" #include "util/uuid.h" //! Used for keeping track of binaries that are loa...
{ AppFetchResult error; if (s_fetch_state.cancelling) { PBL_LOG(LOG_LEVEL_WARNING, "Put bytes cancelled by user"); error = AppFetchResultUserCancelled; } else { PBL_LOG(LOG_LEVEL_ERROR, "Put bytes failure"); error = AppFetchResultPutBytesFailure; } prv_cleanup(error); go...
if (pb_event->type == PebblePutBytesEventTypeInitTimeout) { PBL_LOG(LOG_LEVEL_WARNING, "Timed out waiting for putbytes request from phone"); prv_cleanup(AppFetchResultTimeoutError); } // If this is an object that doesn't have a cookie, then we won't care about it. if (pb_event->has_cookie == false) {...
0, 568, -792}, { -120, 544, -784}, { -112, 552, -832}, { -128, 592, -848}, { -120, 576, -824}, // 307 seconds { -112, 552, -824}, { -112, 544, -832}, { -112, 560, -824}, { -112, 568, -808}, { -128, 576, -808}, { -128, 568, -824}, { -120, 568, -840}, { -120, 576, -824}...
{ -136, 576, -808}, { -144, 584, -808}, { -144, 584, -808}, { -144, 576, -800}, { -144, 568, -808}, { -136, 584, -800}, { -144, 600, -800}, { -144, 592, -808}, { -144, 592, -792}, { -144, 592, -776}, { -144, 592, -808}, { -144, 576, -824}, { -144, 592, -816}, { -1...
{ -136, 600, -792}, { -136, 600, -800}, { -120, 576, -800}, { -128, 560, -808}, { -128, 584, -808}, { -128, 584, -800}, { -120, 592, -808}, { -120, 592, -808}, { -136, 584, -808}, { -136, 592, -808}, { -128, 592, -808}, { -136, 600, -792}, { -136, 600, -800}, { -...
, -296}, { 1544, -632, 24}, { 1040, -424, 144}, { 1016, -32, -168}, { 1840, 3096, -1264}, { 1752, 4000, -2160}, { 216, 3360, -1504}, { -320, 1896, -984}, { -608, 1144, -368}, // 43 seconds { -768, 224, -224}, { -1352, -264, -32}, { -1600, -448, 0}, { -1064, -88, 112},...
{ 992, 768, 256}, { 1368, 64, -112}, // 48 seconds { 1264, -776, 96}, { 1320, 128, 152}, { 984, -216, 216}, { 840, 336, 152}, { 1448, 4000, -872}, { 2136, 4000, -2312}, { 392, 2504, -1352}, { -152, 1640, -728}, { -456, 832, -328}, { -712, -56, 96}, { -2024, -328, ...
{ 1600, 4000, -1424}, { 648, 3744, -1752}, { -432, 1736, -944}, { -672, 968, -744}, { -608, 96, -576}, { -1176, -688, 8}, { -1072, -632, -88}, { -1128, 200, -336}, { -1064, 1160, -936}, { -936, 4000, -2472}, { 624, 4000, -2416}, { 2056, 3272, -352}, { 1576, 1624, 184...
re_dump_reserve_ble_slot(&flash_addr, &max_size, (ElfExternalNote *)build_id)) { PBL_LOG(LOG_LEVEL_ERROR, "Can't reserve slot for BLE core dump"); goto powerdown; } uint32_t flash_addr_max = flash_addr + max_size; PBL_LOG(LOG_LEVEL_DEBUG, "Using flash slot %lx %lx", flash_addr, flash_addr_max); // Read...
(region_buf)
; PBL_LOG(LOG_LEVEL_INFO, "BLE Core Dump complete"); } // NB: this function runs on the host_transport thread (BTTrans). static void prv_core_dump(void) { // Disable host-transport's use of SPI & interrupts dialog_spi_deinit(); s_spi_dma_semph = xSemaphoreCreateBinary(); s_spi_int_semph = xSemaphoreCreateB...
st AMSEntityUpdateNotification *update, const uint16_t value_length) { const AMSShuffleMode shuffle_mode = prv_parse_queue_value(update->value_str, value_length); PBL_LOG(LOG_LEVEL_DEBUG, "Queue shuffle mode update: %d", shuffle_mode); // TODO: Do something with th...
(update, value_length)
; // FIXME: This is a workaround. See PBL-21818 music_update_track_position(0); return; case AMSTrackAttributeIDDuration: prv_handle_track_duration_update(update, value_length); return; default: break; } break; default: ...
e a crash: // https://pebbletechnology.atlassian.net/browse/PBL-23455 } void test_gatt_client_subscriptions__notification_single_subscriber(void) { // Subscribe app: BLECharacteristic characteristic = prv_get_indicatable_characteristic(); BTErrno e = gatt_client_subscriptions_subscribe(characteristic, BLESubsc...
(fake_event_get_count(), 2)
/* * 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_finish_request_response(request, resp, true /* should_free_request */)
last 20 // samples (about one second). // - Host reads any data/HRV-result/LED-current, as needed (see registers [14...53]) // - Host reads the HRM-result/SYNC-byte (registers [54...57]). // If not in HRM-mode, the host can just read the SYNC-byte (register 57). // Reading the SYNC-byte causes the...
PBL_LOG(LOG_LEVEL_DEBUG, " - None (idle)")
; } else { if (app_ids & AS7000AppId_Loader) { PBL_LOG(LOG_LEVEL_DEBUG, " - Loader"); } if (app_ids & AS7000AppId_HRM) { PBL_LOG(LOG_LEVEL_DEBUG, " - HRM"); } if (app_ids & AS7000AppId_PRV) { PBL_LOG(LOG_LEVEL_DEBUG, " - PRV"); } if (app_ids & AS7000AppId_GSR) { PBL...
/* * 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...
(123, gbitmap_get_bytes_per_row(&bmp))
; cl_assert_equal_p(&some_addr + 0 * 123, gbitmap_get_data_row_info(&bmp, 0).data); cl_assert_equal_p(&some_addr + 1 * 123, gbitmap_get_data_row_info(&bmp, 1).data); cl_assert_equal_i(0, gbitmap_get_data_row_info(&bmp, 3).min_x); cl_assert_equal_i(3, gbitmap_get_data_row_info(&bmp, 3).max_x); } void test_gbitm...
/* * 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 (_path == NULL) return NULL;
length = strlen(_path); path = malloc(length + 2); if (path == NULL) return NULL; memcpy(path, _path, length); path[length] = 0; path[length + 1] = 0; for (i = 0; i < length; ++i) { if (path[i] == '/') path[i] = '\\'; } return path; } static void fileops(int mode, const char *_source, const char ...
CH_INFO_COLOR_PEBBLE_2_HR_WHITE: case WATCH_INFO_COLOR_PEBBLE_2_HR_LIME: case WATCH_INFO_COLOR_PEBBLE_2_HR_AQUA: pres_detect_thrsh = PRES_DETECT_THRSH_WHITE; break; default: pres_detect_thrsh = 1; break; } if (!prv_write_register(dev, ADDR_PRES_DETECT_THRSH, pres_detect_thrsh)) {...
(&dev->en_gpio, false)
; psleep(20); #else gpio_output_set(&dev->en_gpio, true); psleep(NORMAL_BOOT_DELAY_MS); #endif AS7000InfoRecord hrm_info; if (!prv_get_and_log_device_info(dev, &hrm_info, true /* log_version */)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read AS7000 version info!"); goto cleanup; } if (hrm_info.appl...
r_sample], msg->msrmt.num_values * sizeof(uint32_t)); } } // Delete the session now protobuf_log_session_delete(session_ref); } // --------------------------------------------------------------------------------------------- // Test using the data logging transport void test_protobuf...
{ success = protobuf_log_session_add_event(session_ref, &events[i]); cl_assert(success); }
enter_point.y, }; const GPoint circle2_location = { .x = (-sin_lookup(angle) * (-radius_of_path) / TRIG_MAX_RATIO) + circle_center_point.x, .y = (-cos_lookup(angle) * (-radius_of_path) / TRIG_MAX_RATIO) + circle_center_point.y, }; graphics_context_set_fill_color(ctx, data->spinner_color); graphics_co...
animation_set_implementation(animation, &data->spinner_anim_impl)
; animation_schedule(animation); } } Window* spinner_ui_window_get(GColor spinner_color) { SpinnerUIData *data = kernel_malloc_check(sizeof(SpinnerUIData)); *data = (SpinnerUIData){}; data->spinner_color = spinner_color; data->should_cancel_animation = false; Window* window = &data->window; window...
estamp, title, uid, negative_action)) { PBL_LOG(LOG_LEVEL_DEBUG, "Ignoring ANCS reminders notification because existing " "time-based reminder was found in db"); return true; } // filter out super-old notifications if (prv_should_ignore_because_st...
prv_should_ignore_because_duplicate(notification, &existing_header)
) { PBL_LOG(LOG_LEVEL_DEBUG, "Duplicate ANCS notification: %"PRIu32, uid); timeline_item_destroy(notification); notification_storage_unlock(); goto cleanup; } prv_handle_ancs_update(notification, &existing_header); } else { prv_handle_new_ancs_notif(notification); } notificati...
D_MEMORY_MAP_OPEN); bma255_write_register(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_OPEN); bma255_write_register(BMA255Register_TEMPERATURE_SENSOR_CTRL, BMA255_TEMPERATURE_SENSOR_DISABLE); bma255_write_register(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_CLOSE); exti_con...
for (int i = 0; i < num_samples_available; ++i) { uint8_t buf[BMA255_FIFO_FRAME_SIZE_BYTES]; for (int j = 0; j < BMA255_FIFO_FRAME_SIZE_BYTES; ++j) { buf[j] = bma255_send_and_receive_byte(0); } prv_convert_accel_raw_data_to_mgs(buf, &data[i]); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
( distance_normalized, property_animation->values.from.grect.size.w, property_animation->values.to.grect.size.w)
; result.size.h = distance_interpolate( distance_normalized, property_animation->values.from.grect.size.h, property_animation->values.to.grect.size.h); ((PropertyAnimationLegacy2Implementation*) property_animation->animation.implementation) ->accessors.setter.grect(property_animation->subje...
abled // - 1 stop bit // - no flow control dev->periph->CR1 &= ~USART_CR1_UE; dev->periph->CR2 = (dev->do_swap_rx_tx ? USART_CR2_SWAP : 0); dev->periph->CR3 = (dev->half_duplex ? USART_CR3_HDSEL : 0); dev->periph->CR1 = cr1_extra_flags | USART_CR1_UE; dev->state->initialized = true; // initialize the ...
(dev->irq_channel, dev->irq_priority)
; NVIC_EnableIRQ(dev->irq_channel); } else { // disable the interrupt NVIC_DisableIRQ(dev->irq_channel); } } void uart_set_rx_interrupt_handler(UARTDevice *dev, UARTRXInterruptHandler irq_handler) { PBL_ASSERTN(dev->state->initialized); dev->state->rx_irq_handler = irq_handler; } void uart_set_tx_...
NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 2 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLI...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; #endif } #define OFFSET_RECT_NO_CLIP GRect(20, 10, 144, 168) #define OFFSET_RECT_CLIP_XY GRect(20, 10, 20, 20) #define OFFSET_RECT_CLIP_NXNY GRect(20, 10, 144, 168) #define OFFSET_DRAW_RECT_NO_CLIP GRect(6, 6, 30, 40) #define OFFSET_DRAW_RECT_CLIP_XY GRect(6, 6, 30, 40) #define OFFSET_DRAW_R...
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 "phone_pp.h" #include "kernel/events.h" #include "services/common/comm...
(PhoneCmdGetStateRequest, NULL, 0)
; } void pp_get_phone_state_set_enabled(bool enabled) { s_get_phone_state_enabled = enabled; } static bool prv_parse_msg_to_event(const uint8_t *iter, size_t length, PebbleEvent *event_out, bool is_state_response) { uint8_t msg_type = *iter++; --length; bool did_parse = fal...
payload, header->payload_length, &string_alloc_size, (uint8_t **) &buffer)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to get timeline item"); goto cleanup; } timeline_item_de...
{ return (action->type == TimelineItemActionTypeAncsNegative || action->type == TimelineItemActionTypeDismiss); }
bool timeline_item_action_is_ancs(const TimelineItemAction *action) { return action->type == TimelineItemActionTypeAncsNegative || action->type == TimelineItemActionTypeAncsDelete || action->type == TimelineItemActionTypeAncsDial || action->type == TimelineItemActionTypeAncsPositive; } b...
sizeof(s_test_impl_data)); cl_assert_equal_p(r->subscriber.event, dummy); cl_assert_equal_p(r->subscriber.data, &sub_data); cl_assert_equal_i(r->state, RecognizerState_Possible); cl_assert_equal_i(r->flags, 0); cl_assert_equal_p(r->simultaneous_with_cb, NULL); cl_assert_equal_p(r->fail_after, NULL); cl_a...
cl_assert(!s_manager_state_change)
; cl_assert_passert(recognizer_transition_state(r, RecognizerState_Failed)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started)); event_type = -1; recognizer_transition_state(r, RecognizerState_Updated); cl_...
2}, { 1560, 360, -16}, { 992, 456, -56}, { 912, 368, -56}, { 1056, 232, 32}, { 1008, 160, 104}, { 848, 136, 64}, { 776, 128, 24}, { 752, 112, 24}, { 808, 64, 8}, { 864, 16, 24}, { 936, 8, 16}, { 1096, 16, -24}, { 1024, 96, -160}, { 1512, -32, 96}, { 1160, 224,...
{ 1512, 32, 112}, { 1144, 248, -40}, { 1120, 400, -136}, { 888, 336, 80}, { 680, 168, 96}, { 768, 184, 112}, { 840, 224, 96}, { 776, 304, 56}, { 680, 360, -16}, { 784, 360, -56}, { 1040, 376, -96}, { 1264, 256, -8}, { 1328, 248, 16}, { 1856, 408, -32}, { 1088,...
// 76 seconds { 808, 72, 88}, { 760, 88, 48}, { 720, 32, 40}, { 736, 24, 24}, { 784, 0, 24}, { 928, 0, 8}, { 1160, 32, -24}, { 1248, -24, -32}, { 1736, -72, 32}, { 1200, 280, 24}, { 784, 480, -208}, { 936, 344, -16}, { 792, 152, 72}, { 704, 120, 104}, { 8...
/* * 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_INFO, "crashing worker")
; } static void down_click_handler(ClickRecognizerRef recognizer, void *context) { AppWorkerResult result = app_worker_kill(); APP_LOG(APP_LOG_LEVEL_INFO, "kill result: %d", result); } static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); win...
alog_set_background_color(dialog, data->background_color); const size_t warning_length = 64; char buffer[warning_length]; const uint32_t battery_hours_left = battery_curve_get_hours_remaining(percent); const char *message = clock_get_relative_daypart_string(rtc_get_time(), battery_hours_left); if (message) {...
(s_dialog)
; s_dialog = NULL; } }
s //////////////////////////////////////////////////////////////////////////////// static void prv_clear_all_interrupt_flags(DMARequest *this) { switch ((uintptr_t)this->stream->periph) { case (uintptr_t)DMA1_Stream0: case (uintptr_t)DMA2_Stream0: this->stream->controller->periph->LIFCR = ALL_INTERRUPT...
(this->periph, this->rcc_bit)
se health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_fill); #endif // This needs to be done after drawing the progress bars or else the progress fill // overlaps the outline and things look weird health_progress_bar_outline(ctx, &data->progress_bar, PROGRESS_OUTLINE_COLOR); } ...
(base_layer)
; } GColor health_activity_summary_card_get_bg_color(Layer *layer) { return CARD_BACKGROUND_COLOR; } bool health_activity_summary_show_select_indicator(Layer *layer) { return true; }
(stack_depth, 3)
; cl_assert_equal_p(dump[0].addr, window3); cl_assert_equal_s(dump[0].name, "Window3"); cl_assert_equal_p(dump[1].addr, window2); cl_assert_equal_s(dump[1].name, "Window2"); cl_assert_equal_p(dump[2].addr, window1); cl_assert_equal_s(dump[2].name, "Window1"); kernel_free(dump); } void test_window_stack__...
ongoing returns false cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Sleep)); cl_assert_equal_i(0, health_service_peek_current_activities()); } // --------------------------------------------------------------------------------------- // Test that we report the that multiple...
(prv_is_hr_elevated(), false)
; activity_get_metric(ActivityMetricHeartRateZone1Minutes, 1, &zone1_minutes); cl_assert_equal_i(zone1_minutes, 0); activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes); cl_assert_equal_i(zone2_minutes, 0); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes); c...
//////////////////// // Init Message void test_put_bytes__init_firmware(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); // All good! assert_ack_count(1); assert_nack_count(0); // Expect "Start" event: PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_PUT_BYTES...
prv_receive_data(s_session, (const uint8_t *) &incomplete_put_msg, sizeof(incomplete_put_msg))
; assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__put_message_length_field_too_long(void) { prv_receive_init_fw_object(); prv_process_and_reset_test_counters(); const size_t payload_size = 2; const uint8_t chunk[] = { 0xaa, 0xbb }; uint8_t buffer[sizeof(PutRequest) + payload_size]; ...
get_num_rows, .selection_will_change = prv_skip_odd_rows, }); menu_layer_reload_data(&l); const int16_t basic_cell_height = menu_cell_basic_cell_height(); const int initial_scroll_offset = (DISP_ROWS - basic_cell_height) / 2; cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); cl_assert_equ...
GRect(10, 10, height, DISP_COLS)
); menu_layer_set_center_focused(&l, true); s_num_rows = 3; menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks) { .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, .get_cell_height = prv_get_row_height_depending_on_selection_state, }); menu_layer_set_center_focused(&l, true); menu...
lex, .spi_cpol = SpiCPol_Low, .spi_cpha = SpiCPha_1Edge, .spi_first_bit = SpiFirstBit_MSB, .rx_dma = &DIALOG_SPI_RX_DMA_REQUEST, .tx_dma = &DIALOG_SPI_TX_DMA_REQUEST }; SPISlavePort * const DIALOG_SPI = &DIALOG_SPI_SLAVE_PORT; // // iCE40LP configuration // static ICE40LPDeviceState s_ice40lp_state; static...
spi_slave_port_init(BMI160_SPI)
sure neither inner_seq, a, nor b played cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, inner_seq), 0); cl_assert_equal_i(prv_count_hand...
(prv_count_handler_entries(&s_stopped_handler_calls, b), 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_last_update_distance(a), ANIMATION_NORMALIZED_MIN); cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MIN); #end...
u_layer_set_callbacks_by_value(MenuLayer *menu_layer, void *callback_context, MenuLayerCallbacks callbacks) { menu_layer_set_callbacks(menu_layer, callback_context, &callbacks); } void menu_layer_set_click_config_onto_window(MenuLayer *menu_layer, struct Window *window) { // ...
(scroll_animation)
these variables, // because ad_spi_complex_transact blocks until transfer is completed: SPITransportMsgStatus remote_status_in = {}; SPITransportMsgStatus local_status_out = { .msg_id = SPITransportMsgID_Status, .bytes_sendable_count = tx_bytes_available, .bytes_receivable_count = rx_bytes_available,...
circular_buffer_write_finish(&s_rx_buffer, rx_len)
; // Check if more data is available in the circular buffer. // If not, flip s_is_transacting back while the lock is taken. Otherwise, a concurrent call to // host_transport_tx_enqueue() would be prevented to unblock the transaction loop again. bool has_more_tx_data = circular_buffer_get_read_space_remaining(&...
Connection *connection = gap_le_connection_by_device(&event->peer_address); #if CAPABILITY_HAS_BUILTIN_HRM ble_hrm_handle_disconnection(connection); #endif const bool local_is_master = connection->local_is_master; PBL_LOG(LOG_LEVEL_INFO, "LE Disconn: addr="BT_DEVICE_ADDRESS_FMT", is_random_addr=%u,",...
{ PBL_LOG(LOG_LEVEL_INFO, "Encryption refreshed!"); goto unlock; }
// Check that the ack/nack timer is removed: cl_assert_equal_p(app_message_outbox_get_ack_nack_timer(), NULL); cl_assert_equal_i(1, s_out_failed_call_count); cl_assert_equal_i(s_failure_result, APP_MSG_NOT_CONNECTED); cl_assert_equal_b(s_nack_sent_is_called, false); // Check the state is reset properly cl...
prv_set_remote_receive_handler(prv_receive_ack_nack_callback)
; prv_receive_test_data(TEST_TRANSACTION_ID_2, false); prv_process_sent_data(); cl_assert_equal_b(s_in_received_is_called, false); cl_assert_equal_b(s_in_dropped_is_called, false); cl_assert_equal_b(s_nack_received_for_id_2, true); // Check that the state is reset check_in_accepting_again(); } void te...
// iOS doesn't correctly send the timestamp at UTC midnight, rather it sends it in local time if (header->timestamp % SECONDS_PER_DAY != 0) { // NOT at UTC midnight, so presumably an iOS bug midnight = time_util_get_midnight_of(header->timestamp); } else { midnight = timeline_item_get_tz_timestamp(head...
(LOG_LEVEL_DEBUG, "Node with id %x%x...", node->id.byte0, node->id.byte1)
; PBL_LOG(LOG_LEVEL_DEBUG, "Index %d", node->index); PBL_LOG(LOG_LEVEL_DEBUG, "Timestamp %ld", node->timestamp); PBL_LOG(LOG_LEVEL_DEBUG, "Duration %hu", node->duration); PBL_LOG(LOG_LEVEL_DEBUG, "All day? %s", node->all_day ? "True": "False"); PBL_LOG(LOG_LEVEL_DEBUG, "Address %p", node); node ...
et_content_offset(scroll_layer); if (!expandable_dialog->show_action_bar) { // Prematurely return if we are not showing the action bar. return; } if (offset.y < 0) { // We have scrolled down, so we want to display the up arrow. prv_show_action_bar_icon(expandable_dialog, BUTTON_ID_UP); } else ...
(GTextAlignmentLeft, (show_action_bar ? GTextAlignmentRight : GTextAlignmentCenter))
; uint16_t right_aligned_box_reduction = PBL_IF_RECT_ELSE(0, show_action_bar ? 10 : 0); if (has_header) { const uint16_t HEADER_OFFSET = 6; #if PBL_RECT x = left_margin_px; w = frame.size.w - right_margin_px - left_margin_px - action_bar_offset - right_aligned_box_reduction; #else x = 0; ...
* 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 specific language gover...
(msg->filename, filename, sizeof(msg->filename))
; // Copy the log message into the struct and set the message_length param. const int max_message_length = buffer_len - sizeof(LogBinaryMessage); // Use vnsiprintf only if we don't have sufficient stack space if (!prv_use_default_log_msg(msg, max_message_length)) { prv_sprintf_to_msg(msg, max_message_leng...
alize each slice into the serialized glance buffer for (unsigned int slice_index = 0; slice_index < glance->num_slices; slice_index++) { const AppGlanceSliceInternal *current_slice = &glance->slices[slice_index]; SliceSerializationAttributeListData *current_attr_list_data = &attr_lists[slice_index]; Attr...
{ *validation_context = (SliceValidationIteratorContext) { .is_at_least_one_slice_invalid = true, .validated_size = 0, }; return false; }
/* * 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 (GDrawState) { }; }
bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) { return false; } void graphics_context_set_drawing_state(GContext *ctx, GDrawState draw_state) { } void window_schedule_render(struct Window *window) { } TimerID animation_service_test_get_timer_id(void); // -----------------------------------...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(s_vibe_queue[4].strength, -100)
; } void test_vibe_score__repeat_delay_is_valid(void) { uint8_t buffer[] = { 'V', 'I', 'B', 'E', // FourCC 1, 0, // version 0, 0, 0, 0, // reserved bytes 23, 0, // attr_list_size 3, // GenericAttributeList.num_attributes VibeAttributeId_Notes, 8, 0, // GenericAttribute.lengt...
offsetof(SharedPRFData, ble_data)); #endif } void shared_prf_storage_store_ble_pairing_data( const SMPairingInfo *pairing_info, const char *name, bool requires_address_pinning, uint8_t flags) { if (!pairing_info || sm_is_pairing_info_empty(pairing_info)) { PBL_LOG(LOG_LEVEL_WARNING, "PRF Storage: At...
(&s_pending_bondings.pending_data.bt_classic_data, addr, device_name, link_key, platform_bits)
limitations under the License. */ #include "comm/ble/kernel_le_client/ancs/ancs.h" #include "comm/ble/kernel_le_client/ancs/ancs_types.h" #include "comm/ble/kernel_le_client/ancs/ancs_util.h" #include "util/buffer.h" #include "clar.h" #include <string.h> // Stubs /////////////////////////////////////////////////...
(buffer_add(b, s_chunked_dict_part_two, sizeof(s_chunked_dict_part_two)), sizeof(s_chunked_dict_part_two))
; bool error = false; cl_assert(ancs_util_is_complete_notif_attr_response(b->data, b->bytes_written, &error)); cl_assert(!error); ANCSAttribute *attr_ptrs[NUM_FETCHED_NOTIF_ATTRIBUTES]; const GetNotificationAttributesMsg *msg = (const GetNotificationAttributesMsg*) b->data; const size_t attributes_leng...
/* * 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_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, 1); cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x1F, 0x2); cl_assert_equal_i(s_flush_addr, 0x1F); 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...
(addr_mac_str_out, BT_DEVICE_ADDRESS_FMT_BUFFER_SIZE, BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(s_local_address))
; } T_STATIC void prv_generate_address(BTDeviceAddress *addr_out) { const char *serial = mfg_get_serial_number(); const uint32_t full_len = strlen(serial); const uint32_t half_len = (full_len / 2); // Hash of the normal serial const uint32_t serial_hash = hash((uint8_t *)serial, full_len); // Hash of the...
ot is 625us: const uint32_t min_interval_ms = ((next->terms[next->cur_term].min_interval_slots * 5) / 8); const uint32_t max_interval_ms = ((next->terms[next->cur_term].max_interval_slots * 5) / 8); BLE_LOG_DEBUG("Enable Ad job %s", prv_string_for_debug_tag(next->tag)); bool result = bt_driver...
payload->scan_resp_data_length); *job = (const GAPLEAdvertisingJob) { .unscheduled_callback = callback, .unscheduled_callback_data = callback_data, .term_time_elapsed_secs = 0, .num_terms = num_terms, .tag = tag, .payload = { .ad_data_length = ...
// ----------------------------------------------------------------------------- void gap_le_advert_unschedule(GAPLEAdvertisingJobRef job) { if (!job) { return; } bool is_registered = false; bt_lock(); { if (!s_gap_le_advert_is_initialized) { goto unlock; } is_registered = prv_is_re...
cl_assert_equal_i(job->cached_execute_time, UINT32_MAX); cron_clear_all_jobs(); } void test_cron__time_change_instant(void) { CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 35, .hour = CRON_HOUR_ANY, .mday = CRON_MDAY_ANY, .month = CRON_MONTH_ANY, .ma...
cl_assert_equal_i(cron_service_get_job_count(), 0)
= 0; s_write_length = 0; s_last_meta_response_info = (const MetaResponseInfo) {}; s_prepare_return_null = false; } void test_session_receive_router__cleanup(void) { if (s_session) { comm_session_close(s_session, CommSessionCloseReason_UnderlyingDisconnection); s_session = NULL; } } void test_sessio...
(0x00, 0x01, PUBLIC_TEST_ENDPOINT_ID >> 8, PUBLIC_TEST_ENDPOINT_ID & 0xff, 0x55)
; cl_assert_equal_i(s_prepare_count, 1); } void test_session_receive_router__ignore_message_if_no_receiver_could_be_prepared(void) { // Expect an inbound message to be skipped/ignored if no Receiver could be prepared. // The message should get eaten and not interfere with whatever comes next. s_prepare_return...
/* * 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...
callback(data)
; } static uint32_t s_unscheduled_cb_count; static void * s_unscheduled_cb_data = "Callback Data"; static GAPLEAdvertisingJobRef s_unscheduled_job; static bool s_unscheduled_completed; static void unscheduled_callback(GAPLEAdvertisingJobRef job, bool completed, ...
g_FMode_Indirect_Read; modes_bitset |= QSPI_ComConfig_DMode_4Line; modes_bitset |= QSPI_ComConfig_IMode_4Line; modes_bitset |= instruction; if (addr != QSPI_ADDR_NO_ADDR) { modes_bitset |= QSPI_ComConfig_ADMode_4Line; modes_bitset |= QSPI_ComConfig_ADSize_24bit; } prv_set_comm_config(modes_bitset, d...
if (addr != QSPI_ADDR_NO_ADDR) { QSPI_SetAddress(addr); }
const uint8_t *read_ptr = buffer; for (uint32_t i = 0; i < length; ++i) { // Note: this will stall the CPU when the FIFO gets full while data is being sent. // For performance reasons, we should replace it with DMA in the future // PBL-28805 QSPI_SendData8(read_ptr[i]); } prv_wait_for_transfe...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, (data_len + 1))
, E_INVALID_ARGUMENT); // Make sure we reject data that is too small to hold all entries cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, (data_len - sizeof(SerializedSendTextContact))), E_INVALID_ARGUMENT); // Make sure we reject keys we don't recognize c...
UT 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_color.h" #include "rocky_api_util.h" #include "string.h" #include "util/size.h" #define GColorARGB8FromRGBA(re...
GColorARGB8FromHEX(0xadff2f)
}, {"grey", GColorARGB8FromHEX(0x808080)}, {"honeydew", GColorARGB8FromHEX(0xf0fff0)}, {"hotpink", GColorARGB8FromHEX(0xff69b4)}, {"indianred", GColorARGB8FromHEX(0xcd5c5c)}, // {"indigo", GColorARGBFromHEX(0x4b0082)}, inconsistent with Pebble color {"ivory", GColorARGB8FromHEX(0xfffff0)}, {"khaki", GColor...
/* * 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_release(button_config->gpio)
; return !bit; } uint8_t button_get_state_bits(void) { uint8_t button_state = 0x00; for (int i = 0; i < NUM_BUTTONS; ++i) { button_state |= (button_is_pressed(i) ? 0x01 : 0x00) << i; } return button_state; } void button_init(void) { // Need to disable button wakeup functionality // or the buttons do...
Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ...
(&firmware_description)
) { dbgserial_putstr( "Our internal flash contents are bad (checksum failed)! " "This is really bad!"); return UPDATE_FW_ERROR_MICRO_FLASH_MANGLED; } return UPDATE_FW_SUCCESS; } void check_update_fw(void) { if (!boot_bit_test(BOOT_BIT_NEW_FW_AVAILABLE)) { return; } if (boot_bit_...
oc(TextLayer); if (layer) { text_layer_init(layer, &frame); } return layer; } void text_layer_destroy(TextLayer* text_layer) { if (!text_layer) { return; } text_layer_deinit(text_layer); applib_free(text_layer); } void text_layer_deinit(TextLayer *text_layer) { PBL_ASSERTN(text_layer); layer...
{ PBL_ASSERTN(text_layer); // Initialize cached layout if not already initialized text_layer_set_should_cache_layout(text_layer, true); graphics_text_layout_set_line_spacing_delta(text_layer->layout_cache, delta); layer_mark_dirty(&(text_layer->layer)); }
int16_t text_layer_get_line_spacing_delta(TextLayer *text_layer) { PBL_ASSERTN(text_layer); return graphics_text_layout_get_line_spacing_delta(text_layer->layout_cache); } void text_layer_enable_screen_text_flow_and_paging(TextLayer *text_layer, uint8_t inset) { if (!text_layer) { return; } if (text_la...
kino_reel_get_elapsed(test_reel), 20); } void test_kino_player__create_finite_animation_finite_reel_foward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; Animation *animation = (Animation *)kin...
(test_player)
; cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); animation_set_elapsed(animation, 20); animation_set_duration(animation, ANIMATION_DURATION_INFINITE); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(t...
readings[i] = raw_buf[base] | (raw_buf[base + 1] << 8); } const AccelConfig *cfg = &BOARD_CONFIG_ACCEL.accel_config; data->x = (cfg->axes_inverts[AXIS_X] ? -1 : 1) * prv_raw_to_mgs(readings[cfg->axes_offsets[AXIS_X]]); data->y = (cfg->axes_inverts[AXIS_Y] ? -1 : 1) * prv_raw_to_mgs(readings[cfg-...
{ axis = AXIS_Y; invert = cfg->axes_inverts[AXIS_Y]; }
else if ((int2_status & (shift << cfg->axes_offsets[AXIS_Z])) != 0) { axis = AXIS_Z; invert = cfg->axes_inverts[AXIS_Z]; } else { BMI160_DBG("No Axis?: 0x%"PRIx8" 0x%"PRIx8, int0_status, int2_status); } *direction *= (invert ? -1 : 1); return axis; } static void prv_dump_int_stats(void); static v...
prv_set_action_bar_icon(BUTTON_ID_UP, up_icon, &s_phone_ui_data->up_bitmap); prv_set_action_bar_icon(BUTTON_ID_SELECT, select_icon, &s_phone_ui_data->select_bitmap); prv_set_action_bar_icon(BUTTON_ID_DOWN, down_icon, &s_phone_ui_data->down_bitmap); } else { prv_hide_action_bar(); } action_bar_layer_s...
(system_theme_get_font(TextStyleFont_Header), fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD))
; Window *window = &s_phone_ui_data->window; window_init(window, WINDOW_NAME("Phone")); window_set_status_bar_icon(window, (GBitmap*)&s_status_icon_phone_bitmap); layer_set_update_proc(&window->layer, prv_window_update_proc); window_set_window_handlers(&s_phone_ui_data->window, &(WindowHandlers) { .unlo...
/* * 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...
{ len++; }
return len; }
get_sec_level(conn_idx, &level); } Connection *connection = connection_by_idx(conn_idx); connection_set_should_pin_address(connection, req->should_pin_address); connection_set_should_auto_accept_re_pairing(connection, req->should_auto_accept_re_pairing); connection_set_reversed_ppogatt_enabled(connection, re...
memcpy(&cccd_value, evt->value, sizeof(cccd_value))
; bool is_subscribed = (cccd_value & GATT_CCC_NOTIFICATIONS); Connection *connection = connection_by_idx_check(evt->conn_idx); uint16_t value_handle; if (evt->handle == s_pps_ctx.att_hdl.conn_status_cccd) { connection_set_subscribed_to_connection_status_notifications(connection, is_subscribed); value_ha...
file->name, OP_FLAG_OVERWRITE | OP_FLAG_READ, file->max_used_space); if (status < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Could not open temporary file to compact settings file. Error %"PRIi32".", status); return status; } settings_raw_iter_begin(&new_file.iter...
prv_is_desired_hdr(iter, key, key_len)
) { return true; } } // No record found return false; } static status_t cleanup_partial_transactions(SettingsFile *file) { for (settings_raw_iter_begin(&file->iter); !settings_raw_iter_end(&file->iter); settings_raw_iter_next(&file->iter)) { if (partially_written(&file->iter.hdr)) { ...
on_internal.h" #include "services/common/comm_session/session_remote_os.h" #include "services/common/comm_session/session_remote_version.h" #include "util/net.h" static CommSession s_session; extern void session_remote_version_protocol_msg_callback(CommSession *session, ...
fake_pbl_malloc_clear_tracking()
; } void test_session_remote_version__receive_invalid_msg(void) { uint8_t invalid_msg = 0xff; session_remote_version_protocol_msg_callback(&s_session, &invalid_msg, sizeof(invalid_msg)); cl_assert_equal_i(fake_event_get_count(), 0); } static const CommSessionCapability s_expected_capabilities = (CommSession...
/* * 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...
i18n_noop("MI")
, i18n_noop("KM")); char distance_buffer[HEALTH_WHOLE_AND_DECIMAL_LENGTH]; health_util_format_whole_and_decimal(distance_buffer, HEALTH_WHOLE_AND_DECIMAL_LENGTH, current_distance_meters, conversion_factor); snprintf(buffer, buffer_size, "%s%s", distance_buffer, units_strin...