prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
.tm_mday = 1, .tm_mon = 0, .tm_year = 115 }; time_t utc_sec = mktime(&start_tm); rtc_set_time(utc_sec); // Add a Sleep session const time_t time_elapsed = (120 * SECONDS_PER_MINUTE); ActivitySession sleep_session = { .start_utc = utc_sec - time_elapsed, .length_min = time_elapsed, .ty...
memset(activity_private_state()->hr.samples, bpm, num_samples)
; memset(activity_private_state()->hr.weights, 100, num_samples); for (int i = 0; i < num_minutes; i++) { prv_minute_system_task_cb(NULL); } } static bool prv_is_hr_elevated(void) { return activity_private_state()->hr.metrics.is_hr_elevated; } void test_activity__update_time_in_hr_zones(void) { int32_t...
}, { -472, 752, 656}, { -528, 744, 648}, { -440, 784, 600}, { -368, 680, 448}, { -360, 656, 344}, { -400, 584, 376}, { -440, 496, 328}, { -504, 464, 352}, { -576, 464, 328}, { -640, 472, 304}, { -720, 536, 384}, { -760, 712, 480}, { -744, 784, 608}, { -840, 936, 7...
{ -640, 800, 768}, { -592, 640, 768}, { -440, 536, 576}, { -336, 400, 376}, { -344, 344, 288}, { -368, 408, 264}, { -416, 520, 504}, { -328, 712, 608}, // 431 seconds { -328, 808, 656}, { -376, 792, 576}, { -456, 792, 576}, { -632, 800, 752}, { -448, 848, 624}, ...
{ -488, 464, 488}, { -616, 504, 544}, { -736, 680, 736}, { -656, 792, 824}, { -632, 912, 744}, { -744, 896, 824}, { -528, 824, 760}, { -480, 704, 624}, { -472, 632, 680}, { -304, 528, 448}, { -312, 368, 336}, { -360, 424, 304}, { -384, 488, 256}, { -400, 648, 416...
ng permissions and * limitations under the License. */ #include "applib/app.h" #include "applib/ui/ui.h" #include "kernel/core_dump.h" #include "kernel/pbl_malloc.h" #include "kernel/util/sleep.h" #include "process_management/pebble_process_md.h" #include "process_management/pebble_process_md.h" #include "process_st...
{ PBL_LOG(LOG_LEVEL_INFO, "Entering infinite loop in non-FreeRTOS ISR."); NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_WKUP_IRQn; // Lower values are higher priority - make this higher priority than a FreeRTOS ISR NVIC_InitStructure.NVIC_IRQChannelPreemptionPrio...
else if (index == 6) { PBL_LOG(LOG_LEVEL_INFO, "Forcing bus fault during core dump"); core_dump_test_force_bus_fault(); core_dump_reset(false /* don't force overwrite */); } else if (index == 7) { PBL_LOG(LOG_LEVEL_INFO, "Forcing inf loop during core dump"); core_dump_test_force_inf_loop(); ...
"Resetting I2C bus %s", slave->bus->name); // decrement user count for reset so that if this user is the only user, the // bus will be powered down during the reset slave->bus->state->user_count--; // Reset and reconfigure bus and pins prv_bus_reset(slave->bus); // Restore user count slave->bus->state-...
i2c_hal_init_transfer(bus)
; bus->state->transfer_nack_count = 0; bus->state->transfer_start_ticks = rtc_get_ticks(); bool result = false; bool complete = false; do { i2c_hal_start_transfer(bus); // Wait on semaphore until it is released by interrupt or a timeout occurs if (prv_semaphore_wait(bus->state)) { if ((bu...
vent = { .type = PEBBLE_BT_STATE_EVENT, .bluetooth = { .state = { .airplane = s_comm_airplane_mode_on, .enabled = s_comm_enabled, .override = s_comm_override, }, }, }; event_put(&event); } static void prv_comm_state_change(void *context) { static bool s_first_run =...
if (bt_ctl_is_bluetooth_active()) { system_task_add_callback(prv_bt_ctl_reset_bluetooth_callback, NULL); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Bluetooth is disabled, reset aborted"); }
} void command_bt_airplane_mode(const char* new_mode) { // as tests run using command_bt_airplane_mode, will retain nomenclature // but work as override mode change BtCtlModeOverride override = BtCtlModeOverrideStop; if (strcmp(new_mode, "exit") == 0) { override = BtCtlModeOverrideNone; } bt_ctl_set_o...
t function knows that nothing was drawn rect = GRectZero; goto call_processor_post_function_and_return; } // TODO PBL-35694: what if src_bitmap == dest_bitmap.... // This currently works only if the regions are equal, or the dest region is // to the bottom/right of it, since we scan from left to right,...
if (dest_bitmap == NULL) { return; }
GRect dest_clip = ctx->draw_state.clip_box; dest_ic.x += ctx->draw_state.drawing_box.origin.x; dest_ic.y += ctx->draw_state.drawing_box.origin.y; GCompOp compositing_mode = ctx->draw_state.compositing_mode; #if PBL_BW GColor foreground, background; switch (compositing_mode) { case GCompOpAssign: ...
= 0; i < 50; i++) { GETTING_STARTED_COMPLETE = !GETTING_STARTED_COMPLETE; cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), i % SPRF_NUM_PAGES); shared_prf_storage_set_getting_started_complete(GETTING_STARTED_COMPLETE); cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), (i + 1) ...
flash_read_bytes((uint8_t *)&data, SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()), sizeof(data))
; cl_assert(data.getting_started.crc != 0xFFFFFFFF); uint32_t new_crc = 0; flash_write_bytes((uint8_t *)&new_crc, SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()) + offsetof(SharedPRFData, ble_pairing_data) + offsetof(SprfBlePairingDat...
x01}, .parent_id = {0}, .timestamp = 1421020800, // midnight jan 12, 2015 UTC .duration = MINUTES_PER_DAY, .type = TimelineItemTypePin, .all_day = 1, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .ac...
(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); // check sixth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)); // check rollover behaviour cl_assert(!iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].h...
uint32_t tot_request_size) { uint32_t req_size = tot_request_size - sizeof(PutRequest); uint32_t data_length = ntohl(request_hdr->length); if (data_length > req_size) { PBL_LOG(LOG_LEVEL_ERROR, "Length value longer than buffer"); return true; } uint32_t request_token = prv_parse_token(PutBy...
(request_token)
; break; default: // This case is unreachable due to the prv_is_invalid_command_for_current_state() test. break; } finally: prv_receiver_reset(); xSemaphoreGive(s_pb_semaphore); } void put_bytes_init(void) { vSemaphoreCreateBinary(s_pb_semaphore) PBL_ASSERTN(s_pb_semaphore != NULL); } ...
er_set_update_proc(&layer, &outside_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_nx_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_y_layer_update_callback); layer_render_...
graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y + 2))
; graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 2, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y ...
ics; i++) { if (client->characteristics.meta == characteristics[i] || client->characteristics.data == characteristics[i]) { client_removed = true; prv_delete_client(client, true, DeleteReason_ServiceRemoved); break; } } client = next; } // P...
PBL_LOG(LOG_LEVEL_DEBUG, "Got notification/read for unknown client")
; goto unlock; } if (is_data) { prv_handle_data_notification(client, value, value_length); } else { prv_handle_meta_read(client, value, value_length, error); } } unlock: bt_unlock(); } // ---------------------------------------------------------------------------------------------...
MSubscriberCallback callback, void *context) { if (!s_hrm_present) { return HRM_INVALID_SESSION_REF; } const PebbleTask current_task = pebble_task_get_current(); bool is_app_subscription = false; if (current_task == PebbleTask_KernelBackground) { // KernelBG must provide a callback PBL_ASSERTN(ca...
(s_manager_state.lock)
; return (state != NULL); } DEFINE_SYSCALL(bool, sys_hrm_manager_set_features, HRMSessionRef session, HRMFeature features) { bool success = false; mutex_lock_recursive(s_manager_state.lock); HRMSubscriberState *state = prv_get_subscriber_state_from_ref(session); if (state) { state->features = features; ...
storage_order; if (!update_and_take_ownership) { break; } else { continue; } } if (update_and_take_ownership) { AppMenuNode *other_node = prv_find_node_with_install_id(storage_app_id, source); if (other_node) { other_node->storage_order = new_storage_order;...
(install_id, source)
; if (is_removed) { prv_alert_data_source_changed(source); } } //! Called when an application is uninstalled static void prv_app_removed_callback(const AppInstallId install_id, void *data) { AppMenuDataSource *data_source = data; prv_send_callback_to_app(data_source, install_id, APP_REMOVED); } //! Must b...
me_get_isdst(prev)) { return time_get_dstoffset(); } else { return -time_get_dstoffset(); } } int32_t time_get_dstoffset(void) { return s_dst_adjust; } time_t time_get_dst_start(void) { return s_dst_start; } time_t time_get_dst_end(void) { return s_dst_end; } DEFINE_SYSCALL(time_t, sys_time_utc_to...
{ *day_part = seconds / SECONDS_PER_DAY; seconds -= *day_part * SECONDS_PER_DAY; *hour_part = seconds / SECONDS_PER_HOUR; seconds -= *hour_part * SECONDS_PER_HOUR; *minute_part = seconds / SECONDS_PER_MINUTE; seconds -= *minute_part * SECONDS_PER_MINUTE; *second_part = seconds; }
int time_util_get_num_hours(int hours, bool is24h) { return is24h ? hours : (hours + 12 - 1) % 12 + 1; } int time_util_get_seconds_until_daily_time(struct tm *time, int hour, int minute) { int hour_diff = hour - time->tm_hour; if (hour < time->tm_hour || (hour == time->tm_hour && minute <= time->tm_min)) { ...
cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); // Test that another event < 1 minute away fails to schedule (E_DOES_NOT_EXIST) wakeup_id = sys_wakeup_schedule(sys_get_time() + 1, 0, false); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); } // work around system_task_add_ca...
cl_assert_equal_i(stub_new_timer_timeout(gap_timer) / 1000, WAKEUP_CATCHUP_WINDOW)
; stub_new_timer_fire(wakeup_get_current()); wakeup_dispatcher_system_task((void *)(uintptr_t)second_wakeup_id); // The current timer should be the third event, with a WAKEUP_CATCHUP_WINDOW second gap again (catchup) gap_timer = wakeup_get_current(); cl_assert_equal_i(stub_new_timer_timeout(gap_timer) / 100...
it renders then immediately we render frame 2 gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 0); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(2))); // Frame 2 has delay 1000 ms, so at time 1000 ms, we expect frame 3 gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 1 * 10...
gbitmap_set_bounds(bitmap, shift_bounds)
/* * 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...
(&bitmap, 0, 0)
); // But now change the palette format to something that requires more space and watch it fail s_fake_bitmap_data.info.format = GBitmapFormat4BitPalette; cl_assert(!gbitmap_init_with_resource_system(&bitmap, 0, 0)); // But if we have space for the palette, it should pass s_resource_size = prv_calculate_siz...
/* * 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 last_word = 0; for (unsigned int i = 0; i < data_length; ++i) { last_word = (last_word << 8) | data[i]; } crc_value = CRC_CalcCRC(last_word); }
else { crc_value = CRC_GetCRC(); } return crc_value; } static void prv_calculate_incremental_stop(void) { prv_disable_crc_clock(); } uint32_t crc_calculate_bytes(const uint8_t* data, unsigned int data_length) { prv_calculate_incremental_start(); // First calculate the CRC of the whole words, since th...
/* * 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_has_invalid_length(sizeof(AppMessagePush), length)
) { return false; } bool success = false; // Scan the dictionary: const size_t dict_size = length - sizeof(AppMessagePush) + sizeof(Dictionary); DictionaryIterator iter; const Tuple *tuple = dict_read_begin_from_buffer(&iter, (const uint8_t *) &push_m...
ate); } static void prv_destructor(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceWorkout *workout_glance = launcher_app_glance_structured_get_data(structured_glance); if (workout_glance) { kino_reel_destroy(workout_glance->icon); app_timer_cancel(workout_glance->timer); } app...
PBL_ASSERTN(node)
; LauncherAppGlanceWorkout *workout_glance = app_zalloc_check(sizeof(*workout_glance)); // Copy the name of the Workout app as the title const size_t title_size = sizeof(workout_glance->title); strncpy(workout_glance->title, node->name, title_size); workout_glance->title[title_size - 1] = '\0'; const boo...
/* * 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...
(normalized, AnimationCurveEaseInOut)
; gdraw_command_list_scale_stroke_width( list, data->stroke_width.from, data->stroke_width.to, data->stroke_width.from_op, data->stroke_width.to_op, stroke_width_progress); if (delay_ctx.owns_lookup) { applib_free(index_lookup); } } static GPoint prv_calc_bounce_offset(GRect from, GRect to, int1...
; fd++) { PFS_FD(fd) = (FileDesc) { .fd_status = FD_STATUS_FREE }; } ftl_populate_region_list(); if (run_filesystem_check) { if (!pfs_active()) { // either we have downgraded or there is no data on the flash PBL_LOG(LOG_LEVEL_INFO, "PFS not active ... formatting"); pfs_format(true /* w...
(fd, buffer, num_bytes)
/* * 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...
timeline_event_deinit()
; reminder_db_deinit(); pin_db_deinit(); } void factory_reset_fast(void *unused) { s_in_factory_reset = true; // disable the watchdog... we've got lots to do before we reset task_watchdog_mask_clear(pebble_task_get_current()); close_db_files(); prv_factory_reset_non_pfs_data(); pfs_remove_files(NUL...
olor_boundary(void *subject, int16_t boundary) { s_phone_ui_data->bg_color.boundary = boundary; layer_mark_dirty(&s_phone_ui_data->window.layer); } static int16_t prv_get_color_boundary(void *subject) { return s_phone_ui_data->bg_color.boundary; } static const PropertyAnimationImplementation s_color_slide_anima...
{ phone_format_caller_name(caller_text, s_phone_ui_data->caller_id_text_buf, NAME_BUFFER_LENGTH); }
if (s_phone_ui_data->style->large_caller_id) { caller_id_font = s_phone_ui_data->name_font; lines++; } else if (prv_has_long_name(s_phone_ui_data->name_font)) { caller_id_font = s_phone_ui_data->long_name_font; lines++; } else { caller_id_font = s_phone_ui_data->name_font; } text_layer_...
ation_dialog); dialog_set_text(dialog, i18n_get("Done", data)); dialog_set_icon(dialog, RESOURCE_ID_RESULT_SHREDDED_LARGE); static const uint32_t DIALOG_TIMEOUT = 2000; dialog_set_timeout(dialog, DIALOG_TIMEOUT); // Set the app exit reason so we will go to the watchface upon exit app_exit_reason_set(APP_EX...
(ctx, icon, icon_rect.origin)
; } // Temporarily inset the cell layer's bounds from the left so the text doesn't draw over any // icon on the left Layer *mutable_cell_layer = (Layer *)cell_layer; const int text_left_margin = icon_left_margin + MAX(icon_size.w, ATTRIBUTE_ICON_TINY_SIZE_PX); mutable_cell_layer->bounds = grect_inset...
/* * 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...
{ // The first time the stack starts, use the QemuSetting_DefaultConnected setting. // Subsequent times, always auto-connect when the stack starts. static bool s_should_auto_connect = false; // Have KernelMain set us to connected once the event loop starts up, this gives enough time // for the launcher to in...
_unschedule(context->animation); applib_free(context->animation); } else { animation_set_elapsed(context->animation, animation_get_duration(context->animation, true, true)); } } *context = (WindowTransitioningContext) { .window_to = window_to, .window_to_last...
list_remove(&item->list_node, &window_stack_from->list_head, NULL)
; } else { // If the item is not yet on the window stack's list, then we allocate space for it // on the heap. item = applib_type_malloc(WindowStackItem); *item = (WindowStackItem) { .window = window, .pop_transition_implementation = transition_pop, }; } inserter(item); if (wi...
origin_r4_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // SW = 5 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 5); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw5_no_clip.${BIT_DE...
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uint16_t t_ms; time_t t_s; sys_get_time_ms(&t_s, &t_ms); time_t legacy_time = sys_time_utc_to_local(t_s); if (out_ms) { *out_ms = t_ms; } if (tloc) { *tloc = legacy_time; } return (t_ms); }
extern size_t localized_strftime(char* s, size_t maxsize, const char* format, const struct tm* tim_p, const char *locale); struct tm *pbl_override_gmtime(const time_t *timep) { struct tm *gmtime_tm = NULL; if (pebble_task_get_current() == PebbleTask_App) { gmtime_tm = app_state_get_gmtime_tm(); } e...
eiver *r = s_rcv_imp->prepare(s_session, &s_app_message_endpoint, sizeof(AppMessagePush)); cl_assert_equal_p(r, NULL); cl_assert_equal_b(false, s_kernel_receiver_is_receiving); fake_kernel_malloc_mark_assert_equal(); } ///////////////////////////////////////////////////////////...
app_message_receiver_close()
; cl_assert_equal_b(true, app_message_receiver_open(sizeof(AppMessagePush))); // Receive the remainder of the push message: s_rcv_imp->write(r, ((const uint8_t *)&s_push) + 1, sizeof(s_push) - 1); s_rcv_imp->finish(r); // Header fwd to default system receiver should have finished, so it can be nacked: prv...
static void update_key_callback(const uint32_t key, const Tuple *new_tuple, const Tuple *old_tuple, void *context) { cl_assert(CONTEXT == context); switch (key) { case SOME_INT8_KEY: is_int8_updated = true; cl_assert(should_update_existing_keys_only == false); cl_assert(new_tuple->type == TU...
STRING_IDX, DATA_IDX, NUM_TUPLES, }; bool has_tuple[NUM_TUPLES] = { false, false, false }; Tuple *tuple = dict_read_begin_from_buffer(&dest_iter, dest_buffer, tmp_size); while (tuple) { switch (tuple->key) { case SOME_DATA_KEY: has_tuple[DATA_IDX] = true; ...
cl_assert(has_tuple[INT8_IDX] == false); } else { cl_assert(has_tuple[INT8_IDX] == true); } cl_assert(has_tuple[STRING_IDX] == true); cl_assert(has_tuple[DATA_IDX] == true); } }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
floor( 0.5)
== 0.0); cl_assert(floor(-0.5) == -1.0); cl_assert(floor( 0.0) == 0.0); cl_assert(floor(-0.0) == -0.0); cl_assert(floor( 1.5) == 1.0); cl_assert(floor(-1.5) == -2.0); cl_assert(floor( 2.0) == 2.0); cl_assert(floor(-2.0) == -2.0); cl_assert(floor( 0.0001) == 0.0); cl_assert(floor(-0.0001) == -1.0...
0x10, 0x210, 0x3110, 0x32100, 0x432100, 0x5321100, 0x64321100, }; // Set up the insets for doing the top corners. uint32_t corner_insets_left = (corner_mask & GCornerTopLeft) ? round_top_corner_lookup[radius] : 0; uint32_t corner_insets_right = (corner_mask & GCornerTopRight) ? round_top_corner_lookup[radius]...
if (radius <= alt_radius) { prv_fill_rect_legacy2(ctx, *rect, radius, corner_mask, fill_color); } else { // These are used to optimize the rectangles that are drawn such that only three rectangles // are drawn always int16_t top_rect_origin_x = rect->origin.x; int16_t top_rect_size_w = rect->size....
0, GCornerNone, fill_color); // Middle Rect prv_fill_rect_legacy2(ctx, GRect(rect->origin.x, rect->origin.y + radius, rect->size.w, rect->size.h - 2 * radius), 0, GCornerNone, fill_color); // Bottom Rect prv_fill...
{ 120, 1096, 384}, { 32, 1184, 288}, { -112, 2144, 896}, { -344, 1320, 640}, { -112, 1192, 208}, // 86 seconds { -40, 800, 248}, { 0, 560, 216}, { 104, 536, 104}, { 152, 512, 176}, { 128, 632, 216}, { 120, 904, 464}, { 48, 1096, -136}, { 56, 1104, 40}, { -72, 1160...
{ 184, 920, 360}, { 184, 1272, 240}, { 80, 1128, 456}, { -104, 1200, 152}, { -120, 1200, 144}, { -168, 960, 8}, { -360, 1024, 312}, { -504, 1312, 232}, { -296, 1200, 112}, { -136, 928, 32}, { 8, 608, 72}, { 120, 528, 24}, // 92 seconds { 176, 512, 144}, { 184,...
{ -240, 688, -160}, { -488, 640, 88}, { -1128, 752, 16}, { -1512, 1032, -72}, { -1432, 600, 56}, { -1336, 792, -360}, { -680, 584, -136}, { -520, 280, -48}, { -696, 256, -88}, { -920, 376, -192}, { -1080, 232, -136}, { -1056, 392, -176}, { -1272, 296, -184}, { -1...
+ 1, fake_gatt_is_service_discovery_stop_count()); if (i < GATT_CLIENT_DISCOVERY_MAX_RETRY) { // Check whether GATT_Start_Service_Discovery has been called, except for the last iteration: cl_assert_equal_i(start_count + 1, fake_gatt_is_service_discovery_start_count()); // No client event: ...
(list_count(&connection->gatt_remote_services->node), 1)
S; i++) { if (fpc[i].contiguous_pgs < contiguous_pgs) { optimal_idx = i; contiguous_pgs = fpc[i].contiguous_pgs; } } // only kick the current cache entry if it's worse than the one // we are adding if (fpc[optimal_idx].contiguous_pgs > toadd->contiguous_pgs) { return; ...
PFS_FD(fd)
; uint8_t curr_status = file_desc->fd_status; file_desc->fd_status = FD_STATUS_IN_USE; mutex_unlock_recursive(s_pfs_mutex); pfs_prepare_for_file_creation(start_size, 0 /* no timeout */); mutex_lock_recursive(s_pfs_mutex); file_desc->fd_status = curr_status; } int res = create_flash_file(fil...
colate", GColorARGB8FromHEX(0xd2691e)}, {"coral", GColorARGB8FromHEX(0xff7f50)}, {"cornflowerblue", GColorARGB8FromHEX(0x6495ed)}, {"cornsilk", GColorARGB8FromHEX(0xfff8dc)}, {"crimson", GColorARGB8FromHEX(0xdc143c)}, {"darkblue", GColorARGB8FromHEX(0x00008b)}, {"darkcyan", GColorARGB8FromHEX(0x008b8b)}, ...
(0xfdf5e6)
}, {"olivedrab", GColorARGB8FromHEX(0x6b8e23)}, {"orangered", GColorARGB8FromHEX(0xff4500)}, {"orchid", GColorARGB8FromHEX(0xda70d6)}, {"palegoldenrod", GColorARGB8FromHEX(0xeee8aa)}, {"palegreen", GColorARGB8FromHEX(0x98fb98)}, {"paleturquoise", GColorARGB8FromHEX(0xafeeee)}, {"palevioletred", GColorARGB...
You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See t...
cl_assert_equal_s((char *)dest, NIHAO_FIRST_CHARACTER)
; } void test_utf8__copy_last_character(void) { utf8_t dest[5]; memset(dest, 0, 5); size_t copied = utf8_copy_character(dest, (utf8_t *)NIHAO_FIRST_CHARACTER, 5); cl_assert_equal_i(copied, NIHAO_FIRST_CHARACTER_BYTES); cl_assert_equal_s((char *)dest, NIHAO_FIRST_CHARACTER); } void test_utf8__copy_invalid_...
f 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 spec...
(LOG_LEVEL_INFO, BATT_LOG_COLOR, "Battery critical: go to standby mode")
; if (low_power_is_active()) { low_power_standby(); } else { enter_standby(RebootReasonCode_LowBattery); } } static void prv_enter_standby(void) { system_task_add_callback(system_task_handle_battery_critical, NULL); } static void prv_log_battery_state(PreciseBatteryChargeState state) { const uint16_...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 4)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq...
-10, 2, 18, 4)); } static void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(4, 5, 18, 10)); } static void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBla...
("clear_over_black", ctx.parent_framebuffer, GColorWhite)
); } #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 144, 168) #define ORIGIN_DRAW_RECT_NO_CLIP GRect(6, 6, 30, 40) #define ORIGIN_DRAW_RECT_CLIP_XY GRect(6, 6, 30, 40) #define ORIGIN_DRAW_RECT_CLIP_NXNY ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (data_length) { uint32_t last_word = 0; for (unsigned int i = 0; i < data_length; ++i) { last_word = (last_word << 8) | data[i]; } crc_value = CRC_CalcCRC(last_word); } else { crc_value = CRC_GetCRC(); }
return crc_value; } void crc_calculate_incremental_stop(void) { PBL_ASSERTN(s_initialized); disable_crc_clock(); } uint32_t crc_calculate_bytes(const uint8_t* data, unsigned int data_length) { crc_calculate_incremental_start(); // First calculate the CRC of the whole words, since the hardware works 4 ...
================= void two_timers_menu_cb(int index, void *ctx) { uint32_t zero_flags = 0; uint32_t expire_ms; menu_callback_prefix(index, ctx); // Multiple timers int timer_idx_0 = 0; s_app_data->timer[timer_idx_0] = new_timer_create(); bool success = new_timer_start(s_app_data->timer[timer_idx_0], 3...
{ void *cb_data = 0; uint32_t zero_flags = 0; menu_callback_prefix(index, ctx); // invalid timer id new_timer_start(0x12345678, 100, timer_callback, cb_data, zero_flags); }
// ================================================================================= void reg_timer_schedule_1sec_from_cb_menu_cb(int index, void *ctx) { menu_callback_prefix(index, ctx); s_app_data->reg_timers[0].cb = reg_timer_1_callback; regular_timer_add_seconds_callback(&s_app_data->reg_timers[0]); } //...
e.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 permissions and * ...
(bytes, saved_lr, heap)
; } return mem; } void app_free(void *ptr) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; heap_free(app_state_get_heap(), ptr, saved_lr); } void *app_realloc(void *ptr, size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_realloc(app_state_get_heap()...
&& ((s_time_stamp - image_hdr.time_stamp) < CORE_DUMP_MIN_AGE_SECONDS)) { prv_debug_str("CD: Still fresh"); #ifndef IS_BIGBOARD prv_reset(); #else prv_debug_str("CD: BigBoard, forcing dump"); #endif } } // Get flash address to save new image to. This method also pre-erases ...
prv_reset()
; } // ----------------------------------------------------- // Warning: these functions use the normal flash driver status_t core_dump_size(uint32_t flash_base, uint32_t *size) { CoreDumpChunkHeader chunk_hdr; uint32_t core_dump_base = flash_base + sizeof(CoreDumpFlashRegionHeader); uint32_t current_offset = si...
vt_gatts_read_req_t *evt) { uint8_t response[READ_RESPONSE_BUFFER_SIZE] = {}; size_t response_length = 0; att_error_t response_status = ATT_ERROR_OK; if (evt->handle == s_pps_ctx.att_hdl.trigger_pairing) { const PairingTriggerRequestData request = { .should_pin_address = false, .no_slave_securi...
{ if (evt->length != sizeof(uint16_t)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid GATT MTU size %u!", evt->length); return ATT_ERROR_INVALID_VALUE_LENGTH; } // https://pebbletechnology.atlassian.net/browse/PBL-34474: // we ought to change our local MTU according to the requested MTU size. // However, if we c...
; } static void prv_run_value_change_animation(SelectionLayer *selection_layer) { #if !PLATFORM_TINTIN Animation *bump_text = prv_create_bump_text_animation(selection_layer); Animation *bump_settle = prv_create_bump_settle_animation(selection_layer); selection_layer->value_change_animation = animation_sequence_c...
prv_create_slide_settle_animation(selection_layer)
; selection_layer->next_cell_animation = animation_sequence_create(over_animation, settle_animation, NULL); animation_schedule(selection_layer->next_cell_animation); #else selection_layer->selected_cell_idx++; layer_mark_dirty(&selection_layer->layer); #endif } //////////////////////////////////////////...
t_tx_power_level returns false, when no TX Power Level: int8_t tx_power_level_out; cl_assert(!ble_ad_get_tx_power_level(s_ad_data, &tx_power_level_out)); } void test_ble_ad_parse__128_bit_uuid(void) { // AD Element, Length: 2, AD Type: Flags // AD Element, Length: 17, AD Type: More 128-bit UUIDs available, /...
ble_ad_destroy(ad)
; // 8x 32-bit UUIDs does not fit, expect false: ad = ble_ad_create(); cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 8), false); ble_ad_destroy(ad); } void test_ble_ad_parse__set_service_uuids_16_bit(void) { BLEAdData *ad; Uuid uuid[15]; for (int i = 0; i < 15; ++i) { uuid[i] = bt_uuid_expan...
/* * 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 new_state == AccessoryInputStateMfg; }
else if (s_input_state == AccessoryInputStateMic) { return new_state == AccessoryInputStateMfg; } return false; } // The accessory state is used to differentiate between different consumers of the accessory port. // Before a consumer uses the accessory port, it must set its state and return the state to idle ...
sample_collection_enabled) { prv_collect_raw_samples(data, num_samples, false /*finish*/); } // See if we have a stepping rate update from the algorithm. If so, accumulate the distance // covered. uint16_t rate_steps; uint32_t rate_elapsed_ms; time_t rate_update_time; activity_algorit...
(height_mm, weight_dag * 10, gender, age_years)
; activity_algorithm_metrics_changed_notification(); // Register our minutes callback cron_job_schedule(&s_activity_job); s_activity_state.started = true; PBL_LOG(LOG_LEVEL_INFO, "Activity tracking started"); PebbleEvent event = { .type = PEBBLE_ACTIVITY_EVENT, .activity_event = { ...
t, seek_type); if (result < S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Err %d while seeking", result); return false; } return true; } // ---------------------------------------------------------------------------------------- // Logs if an error occurs, returns true on success static size_t prv_pfs_get_file...
dls_list_for_each_session(prv_compact_session_cb, NULL)
pitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Fri, 12:00 PM", time_buf); // June 11th 2015, 23:59:30 (T-12:00:30) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) - 30); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_a...
(event_time + (1 * SECONDS_PER_MINUTE) - 1)
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("NOW", time_buf); // June 9th 2015, 12:01:00 (T+00:01:00) rtc_set_time(event_time + (1 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_...
/* * 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 (e->connected) { return BTErrnoConnected; } // FIXME: PBL-35506 We need to re-evaluate what error code to actually use here return e->hci_reason; }
/* * 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...
(fpc_pinstrap_get_value() == 0x1)
; s_pinstrap_results[1] = PinstrapResult_Float; cl_assert(fpc_pinstrap_get_value() == 0x2); s_pinstrap_results[0] = PinstrapResult_Vplus; s_pinstrap_results[1] = PinstrapResult_GND; cl_assert(fpc_pinstrap_get_value() == 0x3); s_pinstrap_results[1] = PinstrapResult_Vplus; cl_assert(fpc_pinstrap_get_va...
/* * 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...
jerry_value_has_error_flag(rv)
ther bars // Note that Thursday is the center bar, not Wednesday since drawing begins with Monday // S M T W T F S const int bar_widths[DAYS_PER_WEEK] = { w, w, w, w + 1, w + 1, w + 1, w }; const int bar_width = bar_widths[weekday]; #else const int bar_wi...
(i, graph_card->current_day)
; const GColor bar_color = prv_get_bar_color(graph_card, is_active, is_wide); const int16_t next_x = prv_draw_day_bar(ctx, i, &box, bar_color, is_wide); // Draw the day character legend const int char_offset_y = 1; box.origin.y = LABEL_OFFSET_Y + char_offset_y; box.size.h = legend_line_height; ...
CESS, app_db_read((uint8_t*)&app1.uuid, sizeof(Uuid), (uint8_t*)&temp, sizeof(AppDBEntry))); cl_assert_equal_i(5, app_db_check_next_unique_id()); // check app 1 memset(&temp, 0, sizeof(AppDBEntry)); cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_uuid(&app1.uuid, &temp)); cl_assert_equal_b(true,...
app_db_exists_install_id(1)
); cl_assert_equal_b(true, app_db_exists_install_id(2)); cl_assert_equal_b(true, app_db_exists_install_id(3)); cl_assert_equal_b(false, app_db_exists_install_id(4)); } static const uint8_t some_data[] = {0x01, 0x02, 0x17, 0x54}; void prv_enumerate_entries(AppInstallId install_id, AppDBEntry *entry, void *data) ...
// Insert child_b below child_b (first_child code path): // // +-parent // | // '->child_b->child_a // layer_insert_below_sibling(&child_b, &child_a); cl_assert(child_b.parent == &parent); cl_assert(child_b.next_sibling == &child_a); cl_assert(child_a.next_sibling == NULL); // Insert chi...
(stack, ARRAY_LENGTH(stack), &current_stack, false)
; cl_assert_equal_p(b, actual); cl_assert_equal_i(0, current_stack); cl_assert_equal_p(b, stack[0]); // test limited stack size (go to sibling instead of child) stack[0] = a; current_stack = 0; actual = __layer_tree_traverse_next__test_accessor(stack, 1, &current_stack, true); cl_assert_equal_p(b, act...
/* * 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...
(metric, client)
; } DEFINE_SYSCALL(void, sys_analytics_stopwatch_stop, AnalyticsMetric metric) { analytics_stopwatch_stop(metric); } static bool prv_is_event_allowed(const AnalyticsEventBlob *const event_blob) { switch (event_blob->event) { case AnalyticsEvent_AppOOMNative: case AnalyticsEvent_AppOOMRocky: return t...
cryptionInfoValid), .is_remote_encryption_info_valid = SPRF_FLAG_IS_SET(data.fields, SprfValidFields_RemoteEncryptionInfoValid), .is_remote_identity_info_valid = SPRF_FLAG_IS_SET(data.fields, SprfValidFields_RemoteIdentityInfoValid), .is_remote_signing_info_valid = SPRF_F...
{ bool rv; prv_lock(); { SprfGettingStarted data; rv = SPRF_FETCH_FIELD(data, getting_started); if (!rv) { goto unlock; } rv = data.is_complete; } unlock: prv_unlock(); return rv; }
void shared_prf_storage_set_getting_started_complete(bool set) { prv_lock(); { SprfGettingStarted data = { .is_complete = set }; SPRF_PERSIST_FIELD(data, getting_started); } prv_unlock(); } //! //! Legacy Stubs for BT Classic - Should never be called so assert if they are! //! bool shared_...
r_layer.h" #include "applib/ui/animation.h" #include "applib/ui/animation_interpolate.h" #include "applib/ui/dialogs/dialog_private.h" #include "applib/ui/scroll_layer.h" #include "kernel/ui/kernel_ui.h" #include "resource/resource_ids.auto.h" #include "system/passert.h" #include <stdlib.h> #include <string.h> #defin...
(transcription_dialog->animation, &begin)
; property_animation_set_to_int16(transcription_dialog->animation, &count); Animation *anim = property_animation_get_animation(transcription_dialog->animation); animation_set_duration(anim, (count - begin) * CHARACTER_DELAY); animation_set_curve(anim, AnimationCurveEaseInOut); // Text is shown if creating ...
alette)); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette); } // Tests 4-bit palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_4_bit(void) { GBitmap *bitmap = set...
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette)))
menu_layer_update_selection_highlight(menu_layer, up, selection_animated, true /* change_ongoing_animation */); prv_menu_layer_update_selection_scroll_position(menu_layer, MenuRowAlignNone, selection_animated); static const PropertyAnimationImplementation s_center_focus_...
(menu_layer)
; if (index.section >= num_sections) { index.section = num_sections - 1; } // check to make sure this callback has been set, return early if not if (menu_layer->callbacks.get_num_rows == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "Please set menu layer callbacks before running menu_layer_set_selected_index."); ...
d *context) { graphics_text_node_destroy(node); return true; } static void prv_destroy_text_node_container(GTextNode *node) { if (!node) { return; } GTextNodeContainer *container_node = (GTextNodeContainer *)node; prv_container_each(container_node, prv_destroy_container_iter, NULL); prv_destroy_text_...
ToGValue(&max_used_size)
[axis]; if (align == GAxisAlign_Center) { ToGValue(&ctx->box.origin)[axis] += excess_length / 2; } else if (align == GAxisAlign_Max) { ToGValue(&ctx->box.origin)[axis] += excess_length; } } static void prv_will_draw_container(GTextNodeDrawContext *ctx) { GTextNodeContainer *container = (GTextNodeContai...
anguage governing permissions and * limitations under the License. */ #if PULSE_EVERYWHERE #include "pulse_protocol_impl.h" #include "console/control_protocol.h" #include "console/control_protocol_impl.h" #include "console/pulse.h" #include "console/pulse2_transport_impl.h" #include "console/pulse_control_message_...
pulse_link_send(packet, packet_size)
{ PBL_LOG(LOG_LEVEL_ERROR, "Must call app_message_outbox_send() before calling app_message_outbox_begin() again!"); return APP_MSG_INVALID_STATE; } else if (phase == OUT_CLOSED) { PBL_LOG(LOG_LEVEL_ERROR, "Must call app_message_open() before calling app_message_outbox_begin()!"); ...
PBL_LOG(LOG_LEVEL_ERROR, "Tx ID mismatch: %"PRIu8" != %"PRIu8, outbox->transaction_id, header->transaction_id)
; return; } prv_stop_timer(outbox); if (header->command == CMD_NACK) { prv_handle_nack_or_ack_timeout(outbox, APP_MSG_SEND_REJECTED); return; } if (outbox->phase == OUT_AWAITING_REPLY_AND_OUTBOX_CALLBACK) { outbox->phase = OUT_AWAITING_OUTBOX_CALLBACK; return; } // phase == OUT_AWAI...
_size(config->paragraph_style_font, config->size), .line_spacing_delta = -2, .extent.margin.h = 17, }; GTextNodeVertical *vertical_node = graphics_text_node_create_vertical(num_headings * 2); for (unsigned int i = 0; i < num_headings; i++) { const char *heading = string_list_get_at(headings, i); ...
layout_create_text_node_from_config( layout, PBL_IF_ROUND_ELSE(&vertical_config.container.extent.node, &horizontal_config.container.extent.node))
; if (context->index > 0) { UNUSED const int metric_margin_top = PBL_IF_RECT_ELSE(0, 5); UNUSED const int metric_margin_h_rect = 14; UNUSED const int metric_margin_h_round_inner = 20; UNUSED const int metric_margin_h_round_page = 24; const int metric_margin_h = PBL_IF_RECT_ELSE(metric_marg...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return prv_fetch_struct().color; }
void mfg_info_set_watch_color(WatchInfoColor color) { MfgData data = prv_fetch_struct(); data.color = color; prv_update_struct(&data); } uint32_t mfg_info_get_rtc_freq(void) { return prv_fetch_struct().rtc_freq; } void mfg_info_set_rtc_freq(uint32_t rtc_freq) { MfgData data = prv_fetch_struct(); data.rt...
), .action_group.actions = actions, }; uint8_t *buffer = malloc(sizeof(s_payload_complete)); timeline_item_serialize_payload(&item, buffer, sizeof(s_payload_complete)); cl_assert(memcmp(buffer, s_payload_complete, sizeof(s_payload_complete)) == 0); } void test_timeline_item__string_list(void) { StringLi...
cl_assert_equal_p(timeline_item_find_action_with_id(&item, 0), NULL)
; // Make sure we actually find the items we're looking for item.action_group.num_actions = ARRAY_LENGTH(s_basic_action_list); item.action_group.actions = s_basic_action_list; cl_assert_equal_p(timeline_item_find_action_with_id(&item, 0), &s_basic_action_list[0]); cl_assert_equal_p(timeline_item_find_action_...
/* * 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(af_config->gpio, &init)
ool was_running = false; if (animation) { was_running = animation_is_scheduled(animation); if (was_running) { animation_unschedule(animation); } } if (animated) { static const PropertyAnimationImplementation implementation = { .base = { .update = (AnimationUpdateImplementation)...
(BUTTON_ID_SELECT, get_callback_context(scroll_layer))
; // Callback to provide the client to setup the SELECT button: if (scroll_layer->callbacks.click_config_provider) { scroll_layer->callbacks.click_config_provider(get_callback_context(scroll_layer)); } } void scroll_layer_set_click_config_onto_window(ScrollLayer *scroll_layer, struct Window *window) { win...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(window, true)
; TextLayer *title = &data->title; text_layer_init(title, &window->layer.bounds); text_layer_set_font(title, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(title, GTextAlignmentCenter); text_layer_set_text(title, "VIBE TEST"); layer_add_child(&window->layer, &title->layer); ...
ame.size.w, title_frame.size.h + instruction_frame.size.h) }; const bool clips = true; grect_align(&text_container_frame, &max_text_container_frame, GAlignCenter, clips); grect_align(&title_frame, &text_container_frame, GAlignTop, clips); grect_align(&instruction_frame, &text_container_frame, GAlignBottom, c...
{ DisplayCalibrationData *data = context; if (data->state == DisplayCalibrationState_Confirm) { // set a new user offset shell_prefs_set_display_offset(data->offset); analytics_inc(ANALYTICS_DEVICE_METRIC_DISPLAY_OFFSET_MODIFIED_COUNT, AnalyticsClient_System); window_stack_remove(&data->window, true...
static void prv_back_click_handler(ClickRecognizerRef recognizer, void *context) { DisplayCalibrationData *data = context; if (data->state == INITIAL_STATE) { // exit the calibration window without changing the prefs window_stack_remove(&data->window, true /* animated */); return; } data->state--...
} if (!info.num_success && !info.num_failed) { // Shouldn't ever happen, but better not PBL_ASSERTN on app task PBL_LOG(LOG_LEVEL_ERROR, "Got callback, but zero messages!?"); // fall-through } // These conditions are redundant, just for safety: while ((num_message_consumed < info.num_success) && ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Dropping data, not enough space %"PRIu32" vs %"PRIu32, (uint32_t)required_free_length, (uint32_t)space_remaining); return false; }
return true; } static void prv_send_event_if_needed(AppInboxNode *inbox) { if (!inbox || inbox->has_pending_event) { return; } PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_callback_event_handler, .data = (void *)(uintptr_t) inbox->tag, }, }; ...
/* * 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_ERROR, "Failed to read OTP %p", (void *)otp_addr); }
return rv; } bool dialog_chip_id_copy(DialogChipID *chip_id_out) { hw_otpc_init(); #if dg_configEXT_CRYSTAL_FREQ == EXT_CRYSTAL_IS_16M HW_OTPC_SYS_CLK_FREQ freq = HW_OTPC_SYS_CLK_FREQ_16; #elif dg_configEXT_CRYSTAL_FREQ == EXT_CRYSTAL_IS_32M HW_OTPC_SYS_CLK_FREQ freq = HW_OTPC_SYS_CLK_FREQ_32; #else # erro...
lbackData { //! We can't have multiple callbacks in flight at once. Only invoke a new set of callbacks //! if this is false. bool callback_in_progress; //! We may have to pause doing callbacks to wait for the app or worker to close. If so, this is set to //! true. bool callback_paused_for_app; bool callb...
if (s_install_callback_data.done_callback) { s_install_callback_data.done_callback(s_install_callback_data.callback_data); }
if (s_install_callback_data.uuid) { kernel_free(s_install_callback_data.uuid); } s_install_callback_data = (InstallCallbackData) { .callback_in_progress = false }; } bool app_install_do_callbacks(InstallEventType event_type, AppInstallId install_id, Uuid *uuid, InstallCallbackDoneCallback done_c...
ingAnimationState_Top, additional_crumbs); } static void prv_render_action_menus_animated( SettingsContentSize content_size, const ActionMenuLevel *root_level, unsigned int selected_index, unsigned int additional_crumbs) { const int16_t x_offset = GRID_CELL_PADDING + (cont...
(ARRAY_LENGTH(thin_values))
; action_menu_level_set_display_mode(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 = 4; prv_prepare_canvas_and_render_actio...
/* * 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...
{ switch ((uintptr_t)this->stream->periph) { case (uintptr_t)DMA1_Stream0: case (uintptr_t)DMA2_Stream0: *has_tc = this->stream->controller->periph->LISR & DMA_LISR_TCIF0; *has_ht = this->stream->controller->periph->LISR & DMA_LISR_HTIF0; break; case (uintptr_t)DMA1_Stream1: case (ui...
*has_ht = this->stream->controller->periph->HISR & DMA_HISR_HTIF6; break; case (uintptr_t)DMA1_Stream7: case (uintptr_t)DMA2_Stream7: *has_tc = this->stream->controller->periph->HISR & DMA_HISR_TCIF7; *has_ht = this->stream->controller->periph->HISR & DMA_HISR_HTIF7; break; de...
R_PADDING + STATUS_BAR_LAYER_HEIGHT; frame.size = NOTIFICATION_TINY_RESOURCE_SIZE; const bool align_in_frame = true; peek_layer_set_scale_to_image(peek_layer, &data->peek_icon_info, TimelineResourceSizeTiny, frame, align_in_frame); // set peek_layer clips to true so I can resiz...
layer_add_child(window_get_root_layer(window), (Layer *)data->peek_layer)
; layer_insert_below_sibling((Layer *)data->peek_layer, (Layer *)&data->status_layer); } /////////////////////// // SwapLayer Callbacks /////////////////////// static void prv_remove_notification(NotificationWindowData *data, Uuid *notif_id, const bool should_close_am) { // We ...
{ 696, 584, 24}, { 856, 576, -8}, { 984, 648, -56}, { 1016, 392, 80}, { 1048, 280, 112}, { 1544, 208, 184}, { 1160, 712, 408}, { 1184, 1072, -136}, { 1104, 672, -160}, { 1024, 520, -96}, { 1184, 528, -40}, { 1536, 576, 40}, { 1448, 312, 136}, { 1280, 24, 120}, ...
{ 1440, 504, 0}, { 1096, 616, 144}, { 1168, 672, 8}, { 1320, 720, -168}, { 1008, 624, -176}, { 1160, 552, -24}, { 1520, 576, 80}, { 1512, 352, 144}, { 1304, 64, 128}, { 1144, -32, 80}, // 48 seconds { 1048, 88, 24}, { 1048, 184, -72}, { 968, 248, -64}, { 1056,...
{ 1088, 128, -40}, { 1112, 176, -232}, { 1120, 120, -280}, { 1352, 72, -24}, { 1352, 176, -168}, { 1328, 232, -248}, { 1360, 248, -232}, { 1160, 264, -312}, { 936, 312, -280}, { 888, 288, -136}, { 960, 360, -88}, { 1000, 368, -104}, { 992, 376, -152}, { 1168, 424...
PBL_ASSERTN(buffer_size); mutex_assert_held_by_curr_task(s_flash_state.mutex, true /* is_held */); // Writing a zero-length buffer is a no-op. if (buffer_size < 1) { return; } flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_PAGE_PROGRAM); flash_send_24b_address(...
flash_write_page(buffer, start_addr, bytes_to_write)
; start_addr += bytes_to_write; buffer += bytes_to_write; buffer_size -= bytes_to_write; bytes_to_write = MIN(buffer_size, FLASH_PAGE_SIZE); } disable_flash_spi_clock(); power_tracking_stop(PowerSystemFlashWrite); flash_unlock(); } void flash_erase_subsector_blocking(uint32_t subsector_addr)...
lse { // Either the request was not written successfully, or we are not waiting for a response for it. prv_set_attribute_state(attr, SmartstrapAttributeStateIdle); } // send an event now that we've completed the write PebbleEvent event = { .type = PEBBLE_SMARTSTRAP_EVENT, .smartstrap = { .t...
(&s_attr_head->list_node, &new_attr->list_node)
/* * 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...
circular_buffer_write(&buffer, (uint8_t*) "123", 3)
); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 5); cl_assert(circular_buffer_write(&buffer, (uint8_t*) "456", 3)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(!circular_buffer_write(&buffer, (uint8_t*) "789", 3)); // too big cl_assert_equal_i(c...
/* * 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 (s_initialized) { return; } s_led_enable = 0; if (BOARD_CONFIG_BACKLIGHT.options & ActuatorOptions_Ctl) { periph_config_acquire_lock(); gpio_output_init(&BOARD_CONFIG_BACKLIGHT.ctl, GPIO_OType_PP, GPIO_Speed_2MHz); gpio_output_set(&BOARD_CONFIG_BACKLIGHT.ctl, false); periph_config_rel...
// TODO: PBL-36077 Move to a generic 4v5 enable void led_enable(LEDEnabler enabler) { if (s_led_enable == 0) { gpio_output_set(&BOARD_CONFIG_BACKLIGHT.ctl, true); } s_led_enable |= enabler; } // TODO: PBL-36077 Move to a generic 4v5 disable void led_disable(LEDEnabler enabler) { s_led_enable &= ~enabler;...
the completion percent of the animation. This is a reverse animation. It starts // fully drawn, then the amount drawn decreases selection_layer->slide_settle_anim_progress = 100 - (100 * distance_normalized) / ANIMATION_NORMALIZED_MAX; layer_mark_dirty(&selection_layer->layer); } static void prv_slide_sett...
(BUTTON_ID_DOWN, selection_layer)
; window_set_click_context(BUTTON_ID_SELECT, selection_layer); window_single_repeating_click_subscribe(BUTTON_ID_UP, BUTTON_HOLD_REPEAT_MS, prv_up_down_click_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, ...
rcle_fill_non_aa(GContext* ctx, GPoint p, uint16_t radius) { s_last_args_for_mock = (ArgsForMock){ .ctx = *ctx, .p0 = p, .radius = radius }; strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)); } void prv_draw_round_rect(GContext* ctx, const GRect *rect, uint16_t radius) {...
(ctx, stroke_width)
; graphics_context_set_stroke_color(ctx, stroke_color); graphics_context_set_fill_color(ctx, fill_color); ctx->lock = lock; reset_last_args_for_mock(); } // Setup void test_graphics_context_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DIS...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_data.order_mutex)
; } typedef struct { const Uuid *uuid_list; uint8_t count; AppMenuOrderStorage *storage; } UuidTranslateData; // search for a UUID in a list of UUID's. Return the index in which it was found or -1 if not found. int prv_uuid_search(const Uuid *find_me, const Uuid *uuid_list, uint8_t count) { for (int i = 0; i ...
start values prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_gtransform(value, start_value); // Halfway through prv_advance_to_ms_with_timers(start_ms + duration/2); cl_assert_close_gtransform(value, mid_value); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_...
animation_set_handlers(h, handlers, context)
; animation_set_duration(h, duration); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(h); // Test the accessor functions uint32_t test_value; property_animation_get_from_uint32(prop_h, &test_value); cl_assert_equal_i(test_value, start_value); property_animatio...
/* * 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...
kernel_free(crash_report)
; } static RebootReasonCode s_last_reboot_reason_code = RebootReasonCode_Unknown; RebootReasonCode reboot_reason_get_last_reboot_reason(void) { return s_last_reboot_reason_code; } void debug_reboot_reason_print(McuRebootReason mcu_reboot_reason) { RebootReason reason; reboot_reason_get(&reason); bool show_res...
st = NULL; static PebbleRecursiveMutex *s_analytics_lock = NULL; // Locking Functions static void prv_lock(void) { mutex_lock_recursive(s_analytics_lock); } static void prv_unlock(void) { mutex_unlock_recursive(s_analytics_lock); } // Analytic Node Functions static bool prv_compare_analytic(ListNode *found_nod...
(metric, prv_stopwatch_elapsed_ms(stopwatch, rtc_get()))
; list_remove(&stopwatch->node, &s_stopwatch_list, NULL); } prv_unlock(); } void analytics_stopwatches_update(uint32_t current_ticks) { prv_lock(); ListNode *cur = s_stopwatch_list; while (cur != NULL) { AnalyticsStopwatchNode *node = (AnalyticsStopwatchNode *)cur; analytics_add(node->metric, 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...
FLASH_Lock()
8}, { -824, -192, -48}, // 2 seconds { -944, -520, -304}, { -1168, -632, 384}, { -960, 120, 200}, { -1144, 808, 168}, { -488, 312, -592}, { -896, 16, -640}, { -816, -176, -288}, { -952, -88, -224}, { -744, 112, -328}, { -800, 88, -128}, { -640, 32, -128}, { -944, ...
{ -848, -168, -608}, { -776, -344, -592}, { -808, -248, -608}, { -800, -320, -528}, { -888, -392, -312}, { -848, -320, -128}, { -760, -336, -72}, { -888, -304, -32}, { -760, -312, 112}, { -808, -328, 560}, { -832, -120, 664}, { -840, -288, 408}, { -960, 24, 304}, ...
/* * 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...
(buffer, size)
; } void nested_syscall(void * buffer, int size) { syscall_internal_elevate_privilege(); syscall_assert_userspace_buffer(buffer, size); bad_syscall(buffer, size); good_syscall(buffer, size); } void bad_nested_syscall(void * buffer, int size) { syscall_internal_elevate_privilege(); bad_syscall(buffer, size...
bulk_action_mode(bool enable) { return; } bool ancs_notifications_is_bulk_action_mode_enabled(void) { return false; } status_t reminder_db_delete_with_parent(const TimelineItemId *id) { return S_SUCCESS; } void timeline_action_endpoint_invoke_action(const Uuid *id, uint8_t action_id, AttributeList *attribu...
attribute_get_string(&item->attr_list, AttributeIdSubtitle, "none")
, "subtitle"); cl_assert(timeline_add(item)); timeline_item_destroy(item); cl_assert(timeline_exists(&id)); TimelineItem item_temp; cl_assert_equal_i(pin_db_get(&id, &item_temp), 0); cl_assert(uuid_equal(&id, &item_temp.header.id)); cl_assert_equal_s(attribute_get_string(&item_temp.attr_list, Attrib...
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, 0, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r0_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); // TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rounded rect #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_s...
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1, GCornersAll)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax2_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_corners(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Currently prv_fill_rect only supports up to radius 8, fix in P...
); if (!prv_write_register_block(dev, ADDR_LOADER_STATUS, data_record, IHEX_RECORD_LENGTH(load_length))) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to write hex record"); return false; } // Wait for the loader to be ready, indicating that the last // ...
(dev, AS7000AppId_HRM)
) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to start HRM app!"); goto failed; } // Configure the int_gpio pin only when we're going to use it, as this pin is shared with // the jtag pins and therefore can cause issues when flashing firmwares onto bigboards. gpio_input_init_pull_up_down(&dev->int_gpio, GPIO_Pu...
text_layer_deinit(&data->info_text_layer); text_layer_deinit(&data->device_name_text_layer); text_layer_deinit(&data->code_text_layer); gbitmap_destroy(data->approve_bitmap); gbitmap_destroy(data->decline_bitmap); action_bar_layer_deinit(&data->action_bar_layer); new_timer_delete(data->timer)...
PBL_LOG(LOG_LEVEL_WARNING, "Got completion (%u) but not right state", success)
; return; } PBL_LOG(LOG_LEVEL_DEBUG, "Got Completion! %u", success); data->ui_state = success ? BTPairingUIStateSuccess : BTPairingUIStateFailed; prv_adjust_background_frame_for_state(data); if (!new_timer_stop(data->timer)) { // Timer was already executing... if (success) { PBL_LOG(LOG_LE...
_BUTTONS: break; } PBL_ASSERTN(key); pref.enabled = enabled; prv_pref_set(key, &pref, sizeof(pref)); } void quick_launch_set_quick_launch_setup_opened(uint8_t version) { if (s_quick_launch_setup_opened != version) { s_quick_launch_setup_opened = version; prv_pref_set(PREF_KEY_QUICK_LAUNCH_SETUP...
prv_pref_set(PREF_KEY_ACTIVITY_HEALTH_APP_OPENED, &s_activity_prefs_health_app_opened, sizeof(s_activity_prefs_health_app_opened))
er); { // 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_height_px...
(workout_dialog->subtext_buffer)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_set_text_alignment(status, GTextAlignmentCenter)
; layer_add_child(&window->layer, &status->layer); app_window_stack_push(window, true /* Animated */); s_timer = evented_timer_register(100, true /* repeating */, prv_update_display, data); } static void s_main(void) { prv_handle_init(); app_event_loop(); evented_timer_cancel(s_timer); } const PebbleP...