prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
cleanup(); fake_kernel_malloc_deinit(); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Forwarding to default system receiver to nack the message static const AppMessagePush s_push = { .header = { .command = CMD_PUSH, .transaction_id = 0xa5, }, }...
cl_assert_equal_b(true, s_communication_timestamp_updated)
; prv_destroy_inbox(); } void test_app_message_receiver__receive_push_buffer_overflow(void) { cl_assert_equal_b(true, app_message_receiver_open(sizeof(AppMessagePush))); // Write an ACK, we should be able to fit one (N)ACK in addition to the Push message: AppMessageAck ack = {}; Receiver *r = s_rcv_imp->pre...
White)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &corners_all_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_corners_all.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &clear_layer_update_callback); layer_render_...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
); } static uint8_t prv_poll_for_ready(FlashAddress sector_base_addr) { // TODO: We should probably just assert if this takes too long uint8_t status; while (((status = prv_read_status_register(sector_base_addr)) & S29VSStatusBit_DeviceReady) == 0) { delay_us(10); } return (status); } //! Issu...
(0, S29VSCommand_SectorLock)
; prv_issue_command_argument(0, S29VSCommand_SectorLock); start_sector = flash_impl_get_sector_base_address(start_sector); end_sector = flash_impl_get_sector_base_address(end_sector); ((__IO uint16_t*) (FMC_BANK_1_BASE_ADDRESS + start_sector))[0] = S29VSCommand_SectorLockRangeArg; ((__IO uint16_t*) (F...
/* * 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...
gmtime_r(timep, result)
xt s_ctx; static FrameBuffer s_fb; size_t framebuffer_get_size_bytes(FrameBuffer *f) { return FRAMEBUFFER_SIZE_BYTES; } /////////////////////////////////////////////////////////// // Tests void test_line_layout__initialize(void) { framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); graphics_context_init(...
cl_assert(iter_next(&word_iter))
; cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_...
typical_sleep_end_24h % TWELVE_HOURS; const int typical_start = (typical_sleep_start_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS); const int typical_end = (typical_sleep_end_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS); #if PBL_COLOR const bool fell_asleep_late = (typical_sle...
(sleep_text, sizeof(sleep_text), typical_sleep, base_layer)
; } else { snprintf(sleep_text, sizeof(sleep_text), EM_DASH); } health_ui_render_typical_text_box(ctx, base_layer, sleep_text); } static void prv_render_no_sleep_data_text(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); const int y = PBL_IF_RECT_ELSE(9...
nter, &radius); cl_assert_gpoint_precise(center, 0, 5); cl_assert_fixedS16_3(radius, 0); // 1 pixel width means radius of 0 r = GRect(-1, -5, 1, 1); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, -1, -5); cl_assert_fixedS16_3(radius, 0); // 2 pixel width means: c...
(0, 0, 0, 0)
, GOvalScaleModeFillCircle); cl_assert_gpoint_precise(s_center, 0.0, 0.0); cl_assert_fixedS16_3(s_radius_outer, 0.0); cl_assert(s_radius_inner.integer <= 0); cl_assert_equal_i(s_angle_start, 0); cl_assert_equal_i(s_angle_end, TRIG_MAX_ANGLE); } void graphics_fill_radial_precise_internal(GContext *ctx, GPoint...
/* * 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...
{ // Check that the header in the custom override directory shadowed the default // override directory's version. cl_assert(overridden_define() == 42); }
void test_test_infra__custom_only_header(void) { // Check that the header only in the custom override directory was included. cl_assert(custom_only_define()); }
vel_add_child(root_level, emoji_level, "Emoji"); const unsigned int selected_index = 1; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_action_menu_window__wide_display_mode_with_chevron_and_long_labels(void) {...
(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
; }
erEvent event_type = -1; NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, &event_type); // Test that manager state change handler is called when not called from a touch event handler recognizer_transition_state(r, RecognizerState_Failed); cl_assert_equal_i(r->state, RecognizerState_Failed); cl_as...
(r, RecognizerState_Cancelled)
; cl_assert_equal_i(event_type, RecognizerEvent_Cancelled); cl_assert_equal_i(r->state, RecognizerState_Cancelled); cl_assert(!s_manager_state_change); r->state = RecognizerState_Started; recognizer_transition_state(r, RecognizerState_Completed); cl_assert_equal_i(event_type, RecognizerEvent_Completed); ...
we're using it if (app_cache_entry_exists(install_id)) { app_cache_app_launched(install_id); goto done; } // System apps don't need to be fetched / are always installed if (app_install_id_from_system(install_id)) { goto done; } // The app isn't cached. Fetch it! PebbleEvent...
pin_db_read_item_header(next_item_out, &id)
le_out, out, &value_length, GAPLEClientApp, &has_more); cl_assert_equal_i(handle_out, BLE_CHARACTERISTIC_INVALID); cl_assert_equal_i(value_length, 0); // Notification will be eaten, regardless of whether it was copied: cl_assert_equal_b(has_more, false); ...
(GAPLEClientApp)
; cl_assert_equal_b(gatt_client_get_event_pending_state(GAPLEClientApp), true); fake_event_clear_last(); } static void prv_assert_no_pending_events_to_kernel_and_app(void) { cl_assert_equal_b(gatt_client_get_event_pending_state(GAPLEClientKernel), false); cl_assert_equal_b(gatt_client_get_event_pending_state(G...
); printf("\nReceived %d minute records", (int)num_records); for (int j = 0; j < num_records; j++) { printf("\nRecord:%d, steps: %d", j, (int)received_records[j].steps); } // Verify the contents of the records for (int j = 0; j < num_records; j++) { prv_assert_minute_data(&received_rec...
(sessions[1].type, ActivitySessionType_Nap)
; } { // Create a 2 hour session that ends after 9pm ==> should be regular sleep ActivitySession sessions[] = { { .start_utc = start_of_today + (20 * SECONDS_PER_HOUR), // 8pm .length_min = 2 * MINUTES_PER_HOUR, .type = ActivitySessionType_Sleep, }, }; uint16_t ses...
rk, &box, highlight); #else prv_draw_fcc_cell_round(ctx, &cell_layer->bounds, title, subtitle, mark, is_selected, highlight); #endif } static void prv_draw_regulatory_marks_cell( GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd, bool is_selected, const void *arg1,...
(ctx, cell_layer, title, subtitle, NULL)
; } static void prv_draw_korea_regulatory_cell( GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd, bool is_selected, const void *arg1, const void *arg2) { const char *title = arg1; const char *subtitle = i18n_get("See details...", title); menu_cell_basic_draw(ctx, cell_layer, title, sub...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&utf8_iter)
); cl_assert(i == NUM_VALID_CODEPOINTS); cl_assert(utf8_iter_state.current == utf8_bounds.end); cl_assert(*utf8_iter_state.current == '\0'); cl_assert(utf8_iter_state.codepoint == 0); } void test_utf8_iterator__decode_valid_string_backwards(void) { // Mutable types Iterator utf8_iter; Utf8IterState utf8...
CRON_MONTH_ANY, prv_cron_callback) CRON_JOB(CRON_MINUTE_ANY, CRON_HOUR_ANY, 1, CRON_MONTH_ANY, prv_cron_callback) }; CronJob new_job = { .cb = prv_counting_cb, .cb_data = (void*)0, }; prv_set_rtc(s_2015_nov12_123456_gmt, &s_timezone_gmt); cron_clear_all_jobs(); cl_assert_equal_i(cron_service...
(&s_timezone_gmt, &test_cron, s_2015_nov12_000000_gmt, advance, advance, 2)
; } void test_cron__offset_positive_seconds_any_day_dst(void) { CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 30, .hour = 0, .mday = CRON_MDAY_ANY, .month = CRON_MONTH_ANY, .offset_seconds = 30 * SECONDS_PER_MINUTE, .may_be_instant = false, }; co...
ntext *ctx, bool enable) { } void graphics_context_set_stroke_width(GContext* ctx, uint8_t stroke_width) { s_stroke_width = stroke_width; } void gpath_draw_stroke(GContext* ctx, GPath* path, bool open) { s_stroke_points = prv_copy_points(path->points, path->num_points, s_offset); s_path_open = open; s_path_s...
(s_path_num_points, 2)
; cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke_count, 0); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); cl_assert_equal_p(s_stroke_points, NULL); prv_reset(); // make fill color transparent (nothing should be dr...
_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_no_clip"))); // Even rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_COLS); graphics_draw_horizontal_line_dotte...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
eak; } } cl_assert(fds[i] == E_OUT_OF_RESOURCES); for (int j = 0; j < i; j++) { cl_assert(pfs_close(fds[j]) == S_SUCCESS); } fd = pfs_open("newfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); pfs_close(fd); int fd2 = pfs_open("newfile", OP_FLAG_READ, 0, 0); cl_assert((fd2 >= ...
pfs_open(file, OP_FLAG_OVERWRITE, FILE_TYPE_STATIC, strlen(overwrite_string))
; cl_assert(fd >= 0); pfs_init(false); // simulate a reboot uint8_t read_buf[strlen(string)]; fd = pfs_open(file, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0); rv = pfs_read(fd, &read_buf[0], strlen(string)); cl_assert_equal_i(rv, strlen(string)); cl_assert(memcmp(string, read_buf, strlen(string)) == 0); ...
ectivity_icon_id = RESOURCE_ID_INVALID; if (bt_ctl_is_airplane_mode_on()) { new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_AIRPLANE_MODE; } else if (do_not_disturb_is_active()) { new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_DND; } else if (!prv_is_pebble_app_connected()) { ...
kino_layer_get_layer(&data->connectivity_icon)
); kino_layer_init(&data->battery_icon, &GRect(DISP_COLS - kino_width - kino_padding, 0, kino_width, STATUS_BAR_LAYER_HEIGHT)); kino_layer_set_alignment(&data->battery_icon, GAlignRight); layer_add_child(&window->layer, kino_layer_get_layer(&data->battery_icon)); p...
/* * 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...
{ KinoReelImplPDCS *dcs_reel = (KinoReelImplPDCS *)reel; return gdraw_command_sequence_get_bounds_size(dcs_reel->sequence); }
static size_t prv_data_size_getter(const KinoReel *reel) { KinoReelImplPDCS *dcs_reel = (KinoReelImplPDCS *)reel; return gdraw_command_sequence_get_data_size(dcs_reel->sequence); } static void prv_draw_processed_func(KinoReel *reel, GContext *ctx, GPoint offset, KinoReelProces...
_system_font(FONT_KEY_GOTHIC_24_BOLD); const GSize title_text_size = GSize(window_bounds.size.w, fonts_get_font_height(title_text_font)); const GFont info_text_font = fonts_get_system_font(FONT_KEY_GOTHIC_14); const GSize info_text_size = GSize(window_bounds.size.w, fonts_get_font_height(info_text_font)); const...
(dialog, i18n_get("Do you want to shut down?", a_dialog))
; dialog_set_icon(dialog, RESOURCE_ID_GENERIC_QUESTION_LARGE); i18n_free_all(a_dialog); actionable_dialog_push(a_dialog, modal_manager_get_window_stack(ModalPriorityGeneric)); } static void prv_deinit_cb(SettingsCallbacks *context) { SettingsSystemData *data = (SettingsSystemData *) context; i18n_free_all(...
const HealthServiceTimeRange *range) { PBL_ASSERTN(values && range && range->seconds_total_last_day > 0); if (((range->last_day_idx + range->num_days) > num_values) || (range->num_days < 1)) { return; } // as all indices inside of values[] are relative to range.last_day_idx, we adjust the poin...
{ if (is_weekend) { which_stats = &stats.weekend; } else { which_stats = &stats.weekday; } }
else if (scope == HealthServiceTimeScopeWeekly) { which_stats = &stats.weekly; } else { APP_LOG(APP_LOG_LEVEL_ERROR, "Unsupported scope: %d", (int) scope); result = 0; } // Get the result switch (aggregation) { case HealthAggregationSum: // NOTE: the caller is asking for "sum" aggregatio...
_with_data->previous_compositing_mode; ctx->draw_state.tint_color = processor_with_data->previous_tint_color; // Check that the bitmap here is the bitmap we specified in the .pre function cl_assert_equal_p(bitmap_used, BITMAP_TO_SPECIFY_IN_PRE_FUNCTION); // Check that the rect here is the clipped version of t...
graphics_draw_bitmap_in_rect_processed(&s_ctx, &bitmap, &rect, &processor.processor)
; // Check that the bitmap was not drawn cl_assert_equal_i(s_bitblt_bitmap_into_bitmap_tiled_calls.call_count, 0); // Check that the .post function was called even though the .pre function makes some change // that causes no bitmap to be drawn cl_assert(processor.post_func_called); } static void post_funct...
ry.version == 3) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc, &light, &plugged_in); } else { cl_assert(false); } fflush(stdout); PBL_ASSERTN(state->test_entry.num_samples < SLEEP_SAMPLES_DISCOVERY_MAX_SAMPLES); stat...
if (strcmp(token, "TEST_WEIGHT") == 0) { sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight); } else if (strcmp(token, "TEST_NAME") == 0) { sscanf(token + strlen(token) + 1, "%s", state->test_entry.name); }
#include "applib/app.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/ui.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "popups/health_tracking_ui.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "services/common/i18n/i1...
{ WorkoutDialog *workout_dialog = &data->detected_workout_dialog; workout_dialog_init(workout_dialog, "Workout Detected"); Dialog *dialog = workout_dialog_get_dialog(workout_dialog); dialog_show_status_bar_layer(dialog, true); dialog_set_fullscreen(dialog, true); dialog_set_background_color(dialog, PBL_IF...
find_subscription_by_att_handle(ListNode *node, void *data) { const GATTClientSubscriptionNode *subscription = (const GATTClientSubscriptionNode *) node; const uint16_t att_handle = (const uint16_t)(uintptr_t) data; return (subscription->att_handle == att_handle); } static bool prv_retain_buffer(GAPLEClient clie...
bt_unlock()
z_on_free }; *(heap->begin) = (HeapInfo_t) { .PrevSize = heap_size, .is_allocated = false, .Size = heap_size }; } void heap_set_lock_impl(Heap *heap, HeapLockImpl lock_impl) { heap->lock_impl = lock_impl; } void heap_set_double_free_handler(Heap *heap, DoubleFreeHandler double_free_handler) { h...
{ /* Add the segment to be freed to the new beginer. */ previous_block->Size += heap_info_ptr->Size; /* Set the pointer to the beginning of the previous */ /* free segment. */ heap_info_ptr = previous_block; }
} /* Calculate the pointer to the next segment. */ HeapInfo_t *next_block = get_next_block(heap, heap_info_ptr); /* If we are pointing at the end of the heap, then use the */ /* begin as the next segment. */ if(next_block == heap->end) { /* ...
ified static status_t enlarge_pmap_file(int *fd, size_t new_size) { const size_t hunk_size = 256; uint8_t *buf = kernel_malloc(hunk_size); if (buf == NULL) { return (E_OUT_OF_MEMORY); } PBL_LOG(LOG_LEVEL_DEBUG, "Growing pmap to %d bytes", (int)new_size); int new_fd = prv_pmap_open_debug_wrapper(s_map_fi...
(search_result)
) { *uuid = field.uuid; } RETURN_STATUS(search_result); } static bool prv_dump_callback(PersistMapIdField *field, void *data) { char uuid_string[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&field->uuid, uuid_string); PBL_LOG(LOG_LEVEL_INFO, "%s -> %d", uuid_string, field->id); return false; } void pe...
ts = prv_get_full_quadrants(starting_quadrant_normalized, ending_quadrant_normalized); } return config; } static void prv_fill_oval_precise(GContext *ctx, GPointPrecise center, Fixed_S16_3 radius_outer_x, Fixed_S16_3 radius_outer...
(&end_top, &end_bottom)
; } // Range for scanline, since scanlines are mirred from the middle of the circle this is also // indicated from the middle, therefore initialised with 0 (as middle) and // radius_y (as scalines are on y axis) int draw_min = 0; int draw_max = radius_outer_y.integer; // Adjust to drawing_box offset...
_layer, ""); layer_set_hidden((Layer *)&data->mic_window.text_layer, true); } static void prv_show_mic_text(VoiceUiData *data, const char *msg) { layer_set_hidden((Layer *)&data->mic_window.text_layer, false); sys_i18n_get_with_buffer(msg, data->mic_window.text_buffer, sizeof(data->mic_window.text_buffer)); te...
interpolate_moook_soft(normalized, from, to, NUM_MOOOK_FRAMES_MID)
; } // fly dot in or out of the window static void prv_fly_dot(VoiceUiData *data, bool fly_in) { Layer *dot_layer = &data->mic_window.mic_dot_layer; const GRect *root_frame = &window_get_root_layer(layer_get_window(dot_layer))->frame; GRect dot_frame = {.size = MIC_DOT_LAYER_SIZE}; grect_align(&dot_frame, roo...
40, 304, -8}, // 126 seconds { 1088, 248, 16}, { 864, 168, 8}, { 744, 176, -16}, { 784, 192, 0}, { 792, 168, 8}, { 888, 96, 56}, { 1016, 48, 40}, { 1104, 64, 8}, { 1040, 8, -16}, { 1224, 96, -104}, { 1280, 56, -16}, { 1160, 144, -88}, { 1280, 224, -144}, { 133...
{ 1160, 320, -352}, { 1160, 328, -320}, { 1272, 368, -240}, { 1064, 392, -264}, { 1048, 336, -224}, { 1104, 304, -152}, { 1184, 312, -72}, { 1176, 328, -16}, { 984, 272, -16}, { 808, 248, -24}, { 776, 216, -16}, // 132 seconds { 832, 184, -24}, { 928, 184, -8}, ...
{ 1064, 240, 40}, { 864, 192, -8}, { 784, 216, -8}, { 816, 224, 24}, { 856, 184, 32}, { 888, 136, 32}, { 992, 112, 8}, { 1040, 128, -8}, { 984, 112, -32}, { 1176, 120, -48}, { 1120, 160, -32}, { 1000, 120, -88}, { 1128, 224, -80}, { 1232, 280, -120}, { 1072, ...
fake_kernel_malloc_init(); fake_kernel_malloc_enable_stats(true); stub_pebble_tasks_set_current(TEST_TARGET_TASK); s_num_messages_to_consume_from_handler = 0; s_can_send_event = true; s_dropped_idx = 0; memset(s_dropped_messages, 0, sizeof(s_dropped_messages)); s_message_idx = 0; memset(s_messages, 0,...
(success, false)
; cl_assert_equal_b(false, app_inbox_service_has_inbox_for_tag(AppInboxServiceTagUnitTestAlt)); fake_kernel_malloc_mark_assert_equal(); } void test_app_inbox__app_inbox_create_and_register_tag_already_associated(void) { bool success; uint8_t storage[BUFFER_SIZE]; success = app_inbox_service_register(storage...
verflowed or not. uint8_t file_id:FILE_ID_BIT_WIDTH; //! Just in case we have to change this struct in the future. uint8_t version_id:VERSION_ID_BIT_WIDTH; } FileHeaderBasic; typedef struct PACKED { char version_tag[FW_METADATA_VERSION_TAG_BYTES]; uint8_t is_recovery; } FileHeaderDetails; typedef struct PA...
((uint8_t*) &file_header, get_file_address(generation_to_index(file_generation)), sizeof(file_header))
info = gbitmap_get_data_row_info(framebuffer, y1.integer); output = (GColor8 *)(data_row_info.data + x); } // middle pixels while (y1.integer <= y2.integer) { // Only draw the pixel if its within the bitmap data row range if (WITHIN(x, data_row_info.min_x, data_row_info.max_x)) { prv_set_color(...
(clip_box_max_x, data_row_info.max_x)
d.h" #include "drivers/dma.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/spi.h" #include "drivers/spi_dma.h" #include "kernel/util/delay.h" #include "kernel/util/stop.h" #include "system/passert.h" #include "util/units.h" #define STM32F2_COMPATIBLE #define STM32F4_COMPATIBLE #define...
s_dma_transfer_complete_cb(&should_context_switch)
rmware // only uses 400~ unique resources at the time of writing so 14 bits (16384 resources) should be // enough. // Therefore our key layout becomes: // is_app:1 // resource_id:14 // codepoint:17 const bool is_app = (font_res->app_num != 0); return (is_app ? 1 << 31 : 0) | ((font_res->reso...
{ break; // Handle a padded, odd number of rle units }
// Number of bits in this run uint8_t length = (rle_unit_pair & RLE4_LENGTH_MASK) + 1; // Symbol of this run. We don't need to generate a pattern of 0s. ;-) if (rle_unit_pair & RLE4_SYMBOL_MASK) { uint8_t pattern = ((1 << length) - 1); // List of 'length' 1s buf |= (pattern <...
(&file->iter, offset, byte)
; return S_SUCCESS; } // Note that this operation is designed to be atomic from the perspective of // an outside observer. That is, either the new value will be completely // written and returned for all future queries, or, if we reboot/loose power/ // run into an error, then we will continue to return the previous...
/* * 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_input_init(&ICE40LP->cdone)
; gpio_input_init(&ICE40LP->busy); periph_config_release_lock(); } static bool prv_spin_until_creset_is(bool level) { int timeout_us = 500 * 1000; InputConfig creset_input = { .gpio = ICE40LP->creset.gpio, .gpio_pin = ICE40LP->creset.gpio_pin, }; while (timeout_us > 0) { if (gpio_input_read(&c...
ID_PARAM // Should not get re-requested prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); cl_assert_equal_i(s_num_requested_notif_attributes, 3); cl_assert_equal_i(s_num_ds_notifications_received, 3); ns_notification.uid = s_invalid_param_uid; // This will return wit...
((uint8_t *)&s_unknown_app_unique_title_dict, EventFlagMultiMedia)
; prv_cmp_last_received_notification(&s_unknown_app_unique_title_parsed_item); } // Make sure we send an ANCS_DISCONNECTED event whenever our session goes away void test_ancs__disconnection(void) { // Simulate a disconnection/reconnection ancs_handle_service_removed(s_characteristics, NumANCSCharacteristic); a...
(&addr_2, &link_key_2, name_2, &platform_bits_2)
; cl_assert(id_2 != BT_BONDING_ID_INVALID); ret = bt_persistent_storage_is_unfaithful(); cl_assert(ret); // A "sync" happened. We are now faithful bt_persistent_storage_set_unfaithful(false); ret = bt_persistent_storage_is_unfaithful(); cl_assert(!ret); // Add a BLE pairing. We should still be faithfu...
//! Which file we're writing to this boot. [0 - DEBUG_DB_NUM_FILES) static int s_current_file_index; //! The id we're using for the current file. static uint8_t s_current_file_id; static int generation_to_index(int file_generation) { int index = s_current_file_index - file_generation; if (index < 0) { index +...
(file_generation)
) + SECTION_HEADER_SIZE_BYTES; } void debug_db_reformat_header_section(void) { flash_erase_subsector_blocking(get_current_file_address()); FirmwareMetadata md; bool result = version_copy_running_fw_metadata(&md); PBL_ASSERTN(result); FileHeader file_header = { .basic = { .magic = VALID_FILE_HEADE...
d 15 minutes, set stable bit."); new_timer_delete(s_uptime_timer); boot_bit_set(BOOT_BIT_FW_STABLE); } static void prv_low_power_debug_config_callback(void* data) { new_timer_delete(s_lowpower_timer); // Turn off sleep and stop mode debugging if it is not explicitly enabled // 4 cases: // STM32F2/STM32F7,...
(PebbleTask_KernelMain)
/* * 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...
mcu_state_is_isr()
) { return DialogTask_ISR; } return task_to_dialogtask(xTaskGetCurrentTaskHandle()); } void task_unregister_task(OS_TASK task) { DialogTask index = task_to_dialogtask(task); if (index >= DialogTask_Last) { return; } DialogTaskList[index] = NULL; } void task_unregister_dialogtask(DialogTask task) {...
rnel_free(rsp); PBL_LOG(LOG_LEVEL_DEBUG, "GET_BYTES: sending next %d bytes. %d remaining", (int)data_len, (int)(remaining_bytes-data_len)); } else { // Send image info response const GetBytesRspObjectInfo rsp = (const GetBytesRspObjectInfo) { .hdr.cmd_id = GET_BYTES_CMD_OBJECT_INFO, ...
{ case GET_BYTES_CMD_GET_COREDUMP: case GET_BYTES_CMD_GET_FILE: case GET_BYTES_CMD_GET_FLASH: case GET_BYTES_CMD_GET_NEW_COREDUMP: break; default: PBL_LOG(LOG_LEVEL_ERROR, "first byte can't be %u", hdr->cmd_id); prv_protocol_send_err_response(session, hdr->transaction_id, ...
we save current metrics to setting. static void prv_update_real_time_derived_metrics(void) { ActivityState *state = activity_private_state(); mutex_lock_recursive(state->mutex); { state->step_data.distance_meters = ROUND(state->distance_mm, MM_PER_METER);...
{ sample_buf[i] = hr->samples[i]; weight_buf[i] = hr->weights[i]; }
// Calculate the total weight stats_calculate_basic(StatsBasicOp_Sum, weight_buf, hr->num_samples, NULL, NULL, &total_weight); // Calculate the weighted median median = stats_calculate_weighted_median(sample_buf, weight_buf, num_hr_samples); task_free(sample_buf); ta...
ort, const TransportImplementation *implementation, CommSessionTransportType expected_transport_type) { CommSessionTransportType transport_type = implementation->get_type(transport); return transport_type == expected_transport_type; } //! bt_lock(...
comm_session_receive_router_cleanup(session)
P_FLAG_WRITE, FILE_TYPE_STATIC, len); cl_assert(fd >= 0); cl_assert(pfs_write(fd, (uint8_t *)buf, len) == len); cl_assert(pfs_close(fd) == S_SUCCESS); if (num_erases != (erase_count - 1)) { cl_assert(pfs_remove(file_small) == S_SUCCESS); } } } int original_page_count = num...
{ pfs_close_and_remove(fd); }
else { pfs_close(fd); } } // force partial garbage collection test_force_reboot_during_garbage_collection(start_page); // reset our state variables, there should be no files found pfs_reset_all_state(); for (int i = 0; i < pages_to_write; i++) { snprintf(file_small, sizeof(file_small), "fil...
s/graphics_private_raw.h" #include "applib/graphics/graphics_private_raw_mask.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "util/graphics.h" #include "util/trig.h" #include "clar.h" #include "util.h" #includ...
{ int16_t x1 = (int16_t)(mask_value_index * num_pixels_per_mask_value); int16_t x2 = (int16_t)(x1 + num_pixels_per_mask_value - 1); record_func(ctx, y, x1, x2, src_color); }
nnected (according to the ble_gap_conn_param_update // API) prv_log_conn_params(&event->conn_params); const uint16_t conn_idx = event->conn_idx; Connection *conn = connection_by_idx(conn_idx); if (conn == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "No connection for idx=%d", conn_idx); return; } BTDeviceI...
if (!prv_get_device_and_irk_by_conn_idx(evt->conn_idx, &e.is_resolved, &e.irk)) { // Disconnected in the mean time return; }
e.is_address_updated = true; dialog_utils_bd_address_to_bt_device(&evt->address, &e.device); dialog_utils_bd_address_to_bt_device(&evt->resolved_address, &e.new_device); // Also update the new address in the local connection list: Connection *connection = connection_by_idx_check(evt->conn_idx); connectio...
(uint8_t*) &ns_notification); cl_assert_equal_i(s_num_requested_notif_attributes, 4); cl_assert_equal_i(s_num_ds_notifications_received, 4); ns_notification.uid = comple_dict_uid; prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); cl_assert_equal_i(s_num_requested_noti...
cl_assert_equal_i(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT)
; fake_event_clear_last(); // If we unexpectedly register another session, make sure we send the event ancs_handle_service_discovered(s_characteristics); cl_assert_equal_i(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT); fake_event_clear_last(); ancs_invalidate_all_references(); cl_assert_eq...
&connection->node); gap_le_connect_params_setup_connection(connection); return connection; } // ------------------------------------------------------------------------------------------------- void prv_destroy_connection(GAPLEConnection *connection) { gatt_service_changed_serv...
{ return prv_find_connection_by_addr(addr); }
// ------------------------------------------------------------------------------------------------- //! @note !!! To access the returned context bt_lock MUST be held!!! GAPLEConnection *gap_le_connection_by_gatt_id(unsigned int connection_id) { return prv_find_connection_by_gatt_id(connection_id); } // ---------...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(success = s_notify_success)
; cl_assert(profile = s_notify_profile); s_did_notify = false; } SmartstrapResult smartstrap_profiles_handle_request(const SmartstrapRequest *request) { s_request = *request; s_did_request = true; return SmartstrapResultOk; } void fake_smartstrap_profiles_check_request_params(const SmartstrapRequest *reques...
LECT for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!prv_prf_button_combination_is_pressed()) { // stop waiting if not held down any longer return false; } delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_get_fw_reset_vector(...
delay_us(200000)
= (indices[i] != ((RecognizerHandled *)node)->idx); node = list_get_next(node); } } if (failed) { node = *list; printf(" != { "); for (uint32_t i = 0; i < count; i++) { printf("%d, ", ((RecognizerHandled *)node)->idx); node = list_get_next(node); } printf("}"); } print...
recognizer_add_to_list(recognizers[3], &layer_a.recognizer_list)
; recognizer_add_to_list(recognizers[4], &layer_b.recognizer_list); cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {0, 1}, 2, &s_recognizers_handled); // Recognizers attached to children of active layer will not be evaluated man...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
mutex_lock_recursive(s_hc_lock)
; } static void prv_unlock(void) { mutex_unlock_recursive(s_hc_lock); } static void prv_update_hc_state(HcProtocolState state) { prv_lock(); s_hc_state = state; prv_unlock(); } //! WARNING: Will log if function is called and state is not initialized. static bool prv_check_initialized(void) { bool is_initia...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
layer_set_bounds(&status_bar.layer, &bounds)
; cl_assert_status_bar_height(status_bar); }
/* * 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...
free(apple_ibeacon_ad_data)
; ble_ad_destroy(new_ibeacon_ad_data); } static BLEAdData *create_too_short_ad_data(void) { static const uint8_t too_short_ad_element[] = { 0x1a, // 26 bytes 0xff, // Manufacturer Specific AD Type 0x4c, 0x00, // Apple 0x02, // iBeacon 0x14, // Number of bytes to follow -- Internally inconsistent!...
ECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
d) { return s_app_list; } RecognizerList *window_get_recognizer_list(Window *window) { if (!window) { return NULL; } return layer_get_recognizer_list(&window->layer); } RecognizerManager *window_get_recognizer_manager(Window *window) { return s_manager; } struct Layer* window_get_root_layer(const Windo...
{ recognizer_destroy(recognizers[i]); }
free(recognizers); } // tests bool prv_process_all_recognizers(RecognizerManager *manager, RecognizerListIteratorCb iter_cb, void *context); void test_recognizer_manager__process_all_recognizers(void) { const int k_rec_count = 7; Recognizer **recognizers = prv_create_recogniz...
.handle = 0x15, }, }, }, } }; return &s_health_thermometer_service; } void fake_gatt_put_discovery_indication_blood_pressure_service( unsigned int connection_id) { GATT_Characteristic_Descriptor_Information_t cccd...
{ *start = BP_START_ATT_HANDLE; *end = BP_END_ATT_HANDLE; }
static Service s_random_128bit_service; #define RANDOM_S_START_ATT_HANDLE 0x17 #define RANDOM_S_END_ATT_HANDLE 0x25 void fake_gatt_put_discovery_indication_random_128bit_uuid_service(unsigned int connection_id) { GATT_Characteristic_Descriptor_Information_t cccd1 = { .Characteristic_Descriptor_Handle = 0x21...
prv_clock_get_month_named_date(buffer, buffer_size, timestamp, abbrev)
; } size_t clock_get_month_named_abbrev_date(char *buffer, size_t buffer_size, time_t timestamp) { const bool abbrev = true; return prv_clock_get_month_named_date(buffer, buffer_size, timestamp, abbrev); } void clock_get_since_time(char *buffer, int buf_size, time_t timestamp) { const time_t now = rtc_get_time(...
_LE_AD_REPORT_DATA_MAX_LENGTH); static uint8_t s_buffer[s_buffer_size]; static BLEAdData * const s_ad_data = (BLEAdData *)s_buffer; static void set_ad_data(uint8_t *data, size_t length) { memcpy(s_ad_data->data, data, length); s_ad_data->ad_data_length = length; } void test_ble_ad_parse__initialize(void) { mems...
{ BLEAdData *ad = ble_ad_create(); ble_ad_start_scan_response(ad); uint8_t expected_scan_resp_data[] = { 1 /* +1 for Type byte */ + strlen("Pebble 1234"), 0x09, // Local Name, Complete 'P', 'e', 'b', 'b', 'l', 'e', ' ', '1', '2', '3', '4' }; // Should fit fine, expect true: cl_assert_equal_b(b...
void test_ble_ad_parse__set_service_uuids_128_bit(void) { BLEAdData *ad = ble_ad_create(); uint8_t uuid_bytes[] = "\x97\x6e\xbb\x18\xd3\xe9\x43\xc0\x8a\x63\x8d\x2b" \ "\x60\xd9\x04\x2a"; Uuid uuid[2]; uuid[0] = UuidMakeFromBEBytes(uuid_bytes); uuid[1] = UuidMakeFromLEBytes(uuid_bytes); // just reversed, ...
#include "services/common/analytics/analytics.h" #include "system/logging.h" #include "system/reboot_reason.h" static void log_reboot_reason_cb(void *reason) { AnalyticsEventCrash *crash_report = (AnalyticsEventCrash *)reason; analytics_event_crash(crash_report->crash_code, crash_report->link_register); kernel_...
DEBUG_LOG(LOG_LEVEL_INFO, "Stuck callback: 0x%" PRIx32, reason.watchdog.stuck_task_callback)
; } } break; case RebootReasonCode_StackOverflow: show_reset_alert = true; PebbleTask task = (PebbleTask) reason.data8[0]; DEBUG_LOG(LOG_LEVEL_INFO, "%s%sStackOverflow: Task #%d (%s)", restarted_safely_string, rebooted_due_to, task, pebble_task_get_name(task)); break; cas...
/* * 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...
{ TimerID timer_id = battery_monitor_get_standby_timer_id(); cl_assert(timer_id != TIMER_INVALID_ID); cl_assert(stub_new_timer_is_scheduled(timer_id)); for (int i = 0; i<count; ++i) { stub_new_timer_fire(timer_id); fake_system_task_callbacks_invoke_pending(); } }
static bool standby_timer_is_scheduled() { TimerID timer_id = battery_monitor_get_standby_timer_id(); return timer_id != TIMER_INVALID_ID && stub_new_timer_is_scheduled(timer_id); } static uint32_t standby_timer_get_timeout() { TimerID timer_id = battery_monitor_get_standby_timer_id(); cl_assert(timer_id !=...
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 in writing, software * distributed under the Li...
gpath_create(&s_duplicates_path_info)
t u"; char fourth_page_one_line[] = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z " "a b c d e f g h j k l m n o p q r s t u v w x y z " "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z " "a b c d e f g h j k l...
GSize(180, 300)
, 1, 1); ctx.draw_state.avoid_text_orphans = false; graphics_draw_text(&ctx, text, &s_font_info, GRect(0, 0, 180, 1000), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, (GTextAttributes *const) &layout); cl_check(gbitmap_pbi_eq(s_dest_bitmap, namecat(namecat(__fu...
mplied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "gdrawmask_demo.h" #include "applib/app.h" #include "applib/app_light.h" #include "process_state/app_state/app_state.h" #include "applib/fonts/fonts.h" #include "applib/ui/app_window_stack.h" ...
graphics_context_mask_use(ctx, mask)
; graphics_context_set_fill_color(ctx, GColorRed); graphics_fill_rect(ctx, &layer_bounds); graphics_context_mask_destroy(ctx, mask); } static void prv_refresh_timer_callback(void *context) { GDrawMaskDemoData *data = context; layer_mark_dirty(window_get_root_layer(&data->window)); app_timer_register(ANIM...
ABEL_OFFSET_Y - GRAPH_OFFSET_Y) #define AVG_LINE_HEIGHT 4 #define AVG_LINE_LEGEND_WIDTH 10 #define AVG_LINE_COLOR GColorYellow #define INFO_PADDING_BOTTOM 6 //! Get the current day in the standard tm format. Sunday is 0 static uint8_t prv_get_weekday(time_t timestamp) { return time_util_get_day_in_week(timestamp);...
graphics_fill_rect(ctx, &thin_box)
; } static int16_t prv_draw_day_bar(GContext *ctx, int weekday, const GRect *box, GColor bar_color, bool wide_bar) { const int bar_inset = 3; GRect box_inset = grect_inset(*box, GEdgeInsets(bar_inset, bar_inset, 0, bar_inset)); if (wide_bar) { prv_draw_day_bar_wide(ctx, box, &...
nce, advance, 1); } void test_cron__dst_simple_from(void) { // Dec 21st, 01:00:00 local CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 0, .hour = 1, .mday = 20, .month = 11, .may_be_instant = true, }; // 2015 Dec 21, 01:00:00 GMT const time_t advan...
ARRAY_LENGTH(jobs)
+ 1); fake_rtc_increment_time(0); cron_service_wakeup(); cl_assert_equal_i((uintptr_t)jobs[0].cb_data, 1); cl_assert_equal_i((uintptr_t)new_job.cb_data, 2); cl_assert_equal_i(cron_service_get_job_count(), 6); fake_rtc_increment_time(SECONDS_PER_DAY * 60); cron_service_wakeup(); cl_assert_equal_i(cro...
}; // Get the IRK and device from the bonding storage, // outside of bt_lock(), because it uses flash. if (!bt_persistent_storage_get_ble_pairing_by_id(bonding_id, &request.bonding.irk, &request.bonding.device, NULL)) { return BTErrnoInvalidParameter; } bt_loc...
if (!intent->client[c].is_used) { // Not all specified clients own the intent ret_value = false; }
} else { // Intent not found ret_value = false; } bt_unlock(); return ret_value; } bool gap_le_connect_has_connection_intent_for_bonding(BTBondingID bonding_id, GAPLEClient c) { bt_lock(); bool ret_value = true; const GAPLEConnectionIntent *i...
tion, CPOL, CPHA, baudrate prescaler and first-bit come from the device config tmpreg |= (uint16_t)((uint32_t)slave->spi_direction | SpiMode_Master | SpiDataSize_8b | slave->spi_cpol | slave->spi_cpha | SpiSlaveSelect_Soft | prescaler | slave->spi_first_bit); // Write result back to CR1 bus->spi->CR1 ...
spi_ll_slave_burst_read_write(slave, out, in, len)
; prv_spi_release_helper(slave); } void spi_slave_burst_read_write_scatter(const SPISlavePort *slave, const SPIScatterGather *sc_info, size_t num_sg) { prv_spi_acquire_helper(slave); spi_ll_slave_burst_read_write_scatter(slave, sc_info, num_sg); prv_spi...
ion.h" #include "kernel/pbl_malloc.h" #include "services/common/system_task.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include <bluetooth/bluetooth_types.h> #include <bluetooth/gap_le_device_name.h> #include <bluetooth/gatt.h> #include <btutil/bt_device.h> #include <inttypes.h>...
(response)
; return success; }
lag_status = 0x70, .erase_suspend = 0x75, .erase_resume = 0x7A, .enter_low_power = 0xB9, .exit_low_power = 0xAB, .enter_quad_mode = 0x35, .reset_enable = 0x66, .reset = 0x99, .qspi_id = 0xAF, .block_lock = 0xE5, .block_lock_status = 0xE8, }, .status_bit_masks = { .busy =...
(QSPI_FLASH, start_addr, buffer_ptr, buffer_size)
_fill_count, 1); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); prv_reset(); // set stroke width to zero - fill should be drawn, but not outline gdraw_command_set_...
cl_assert_equal_b(s_path_open, true)
; cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points2, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(points2, s_fill_points, s_path_num_points)); prv_reset(); // set command to be hidden - nothing should be drawn gd...
ata *window_data = data; TimelineItem *item = prv_get_current_notification(window_data); if (!prv_should_provide_action_menu_for_item(window_data, item)) { return; } LayoutLayer *layout = swap_layer_get_current_layout(&window_data->swap_layer); const LayoutColors *colors = layout_get_notification_colors...
i18n_free_all(data)
; s_in_use = false; } ////////////////////// // Callback Handlers ////////////////////// static void prv_layout_did_appear_handler(SwapLayer *swap_layer, LayoutLayer *layout, int8_t rel_change, void *context) { NotificationWindowData *data = context; TimelineItem *n = l...
/* * 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 CORE_DUMP_FLASH_INVALID_ADDR; }
// Find the region with the highest last_used count for (unsigned int i=0; i<CORE_DUMP_MAX_IMAGES; i++) { if (flash_hdr.unformatted & (1 << i)) { continue; } base_address = core_dump_get_slot_address(i); flash_read_bytes((uint8_t *)&region_hdr, base_address, sizeof(region_hdr)); if (un...
manager_event_loop_upkeep(); cl_assert_equal_i(modal_manager_get_properties(), ModalProperty_Transparent | ModalProperty_Unfocused); // Re-enable all modals modal_manager_set_min_priority(ModalPriorityMin); modal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_manager_get_properties...
cl_assert_equal_i(window_stack_count(app_stack), 1); // Pop the modal window off the stack window_stack_remove(window2, true); cl_assert_equal_i(window_stack_count(modal_stack), 0); cl_assert_equal_i(window2->on_screen, false); // Switch to app happens via the compositor compositor_transition(NULL); ...
// Tests modal and app transitions with a transparent modal window void test_window_stack__transparent_modal_and_app(void) { Window *window1 = window_create(); Window *window2 = window_create(); cl_assert_equal_b(window_is_transparent(window2), false); window_set_transparent(window2, true); cl_assert_equal_...
zerState_Completed); cl_assert(s_manager_state_change); cl_assert_equal_i(event_type, RecognizerEvent_Completed); s_manager_state_change = false; r->handling_touch_event = true; r->state = RecognizerState_Possible; event_type = -1; recognizer_transition_state(r, RecognizerState_Failed); cl_assert(!s_ma...
cl_assert_equal_i(r->state, RecognizerState_Completed)
; cl_assert(!s_manager_state_change); } void test_recognizer__set_failed(void) { bool failed = false; s_test_impl_data.failed = &failed; NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, NULL); recognizer_set_failed(r); cl_assert_equal_i(r->state, RecognizerState_Failed); cl_assert(failed); ...
to_r = GRect(1000, 2000, 100, 200); // x, y, width, height prop_h = property_animation_create_layer_frame(&layer, &from_r, &to_r); Animation *h = property_animation_get_animation(prop_h); void *context = &layer; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); animation_s...
(&implementation, &value, &start_value, &end_value)
; Animation *h = property_animation_get_animation(prop_h); void *context = &value; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); animation_set_delay(h, delay); animation_set_custom_curve(h, prv_custom_curve); animation_set_auto_destroy(h, false); prv_clear_handler_h...
_eq[2] = v_ab[0] * v_ac[1] - v_ab[1] * v_ac[0]; // solve for d plane_eq[3] = -(plane_eq[0] * s_samples[0][0] + plane_eq[1] * s_samples[0][1] + plane_eq[2] * s_samples[0][2]); // Distance^2 = (a * xo + b * yo + c * zo + d) / (a^2 + b^2 + c^2) int64_t distance = ABS((plane_eq[0] * s_samples[idx_pt][0] + ...
pt_to_plane_dist_under_thresh(0, 1, 2, 3, thresh)
/* * 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...
(read_iter, msg + length, &album_ptr, &album_length)
; if (!read_iter) { return; } const char* title_ptr; size_t title_length; read_iter = prv_read_ptr_and_length_from_buffer(read_iter, msg + length, &title_ptr, &title_length); if (!read_iter) { return; } music_update_now_playing(title_ptr, title_len...
is_relevant = (*api_ref)->add_handler(event_name, func); if (is_relevant) { break; } } } if (!is_relevant) { APP_LOG(LOG_LEVEL_WARNING, "Unknown event '%s'", event_name); return jerry_create_undefined(); } prv_add_event_listener_to_list((char *)event_name, func); return jer...
jerry_release_value(event)
; // was acquired in rocky_global_call_event_handlers_async() call } void rocky_global_call_event_handlers_async(jerry_value_t event) { sys_current_process_schedule_callback(prv_call_event_handlers_async_cb, (void *)(uintptr_t)jerry_acquire_value(event)); } jerry_value_t roc...
er_item = { .header = { .id = {0x04}, .parent_id = {0}, .timestamp = 1421049600 + 9 * 60 * 60, // 9am on Jan 12, 2015 .duration = 20, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, } }; cl_assert_equal_i(pin_db_insert_item(&earlier_item), 0); /...
(iter_next(&iterator))
; #endif cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id)); cl_assert(!iter_next(&iterator)); } // 8:16 am, 8:00 event has passed but not 8:15 event void test_timeline__extra_case_middle_past(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; TimelineIterState state...
/* * 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_timer_register(1000, prv_hide_thumbsup, data)
; } static void prv_set_tap_text(AppData *data, uint32_t count, AccelAxisType axis) { char axes[] = {'X', 'Y', 'Z'}; snprintf(data->text, sizeof(data->text), "Axis: %c\nDouble Taps: %6"PRIu32, axes[axis], count); text_layer_set_text(&data->text_layer, data->text); } static void prv_window_load(Window *window) {...
anged. This is (only) useful when the //! connectability mode has changed. static void prv_perform_next_job(bool force_refresh) { // Part of work-around for CC2564 bug (see comment with prv_work_around_should_not_cycle). // When forced, we've just connected or disconnected, in that case cycle as well, because //...
{ return NULL; }
// Each job must have at least 1 term if (num_terms == 0 || terms == NULL) { return NULL; } // Minimum interval is 32 slots (20ms), or 160 slots (100ms) when there is a // scan response: const uint16_t min_threshold = payload->scan_resp_data_length ? 160 : 32; for (int i = 0; i < num_terms; i++) { ...
{ -672, 504, 624}, { -472, 424, 528}, { -296, 272, 408}, { -288, 256, 336}, { -296, 184, 272}, { -352, 152, 216}, { -448, 112, 208}, { -656, 104, 216}, { -888, 112, 232}, { -1432, 104, 480}, { -1928, 216, 616}, { -2424, 400, 560}, { -1752, 536, 416}, { -1120, 232, 48}...
{ -1528, 400, 400}, { -1400, 312, 352}, { -1416, 240, 192}, { -1344, 112, 416}, // 73 seconds { -1224, 48, 288}, { -1008, 104, 184}, { -936, -120, 72}, { -760, -464, 32}, { -848, -80, -24}, { -1232, 8, 56}, { -1464, 280, 152}, { -1720, 608, -16}, { -1792, 344, 288...
{ -1496, 520, -136}, { -1680, 320, 200}, { -1744, 40, 264}, { -1384, 176, 296}, { -1168, 424, 224}, { -1048, 376, 304}, { -944, 288, 320}, { -1000, 280, 312}, { -1120, 208, 376}, { -1120, 248, 432}, { -1144, 120, 528}, { -1176, 240, 688}, { -984, 360, 584}, { -99...
Y, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_origin_layer_aa.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10); graphics_line_draw_precise_stroked_aa(&ctx,...
graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT_XY, END_ON_ORIGIN_RECT_XY, 10)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_offset_layer_non_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 10); graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10); c...
LE; NVIC_Init(&NVIC_InitStructure); // Setup timer 3 for periodic interrupts at TIMER_INTERRUPT_HZ TIM_TimeBaseInitTypeDef tim_config; TIM_TimeBaseStructInit(&tim_config); tim_config.TIM_Prescaler = timer_find_prescaler(&BOARD_BT_WATCHDOG_TIMER.timer, TIMER_...
(&s_spi_transport.rx, s_spi_transport.bytes_receivable_count)
; prv_unlock(); } static void prv_handle_receiving_footer_complete_isr(bool *should_context_switch) { // Check the received CRC uint32_t crc = crc32(CRC32_INIT, s_spi_transport.rx_write_ptr, s_spi_transport.bytes_receivable_count); if (crc != s_spi_transport.rx_footer.crc) { PBL_LOG(...
ubs_passert.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_regular_timer.h" uint16_t gaps_get_starting_att_handle(void) { return 4; } BLEService gatt_client_att_handle_get_service( GAPLEConnection *connection, uint16_t att_handle, const GATTServiceNode **service_node_out) { return ...
{ gap_le_connection_add(&s_device, NULL, false /* local_is_master */); s_connection = gap_le_connection_by_device(&s_device); cl_assert(s_connection); s_connection->gatt_connection_id = s_connection_id; prv_cccd_write(true /* is_subscribing */); if (i < max_times) { prv_expect_service_cha...
} void test_gatt_service_changed_server__disconnect_during_delay(void) { gatt_service_changed_server_handle_fw_update(); prv_cccd_write(true /* is_subscribing */); // Grab the timer ID: TimerID t = s_connection->gatt_service_changed_indication_timer; s_connection->gatt_service_changed_indication_timer = TI...
; uint8_t platform_bits_out = 0; cl_assert_equal_p(shared_prf_storage_get_bt_classic_pairing_data(&out_addr, device_name_out, &link_key_out, &platform_bits_out), true); cl_assert_e...
(device_name, device_name_out)
; } void test_shared_prf_storage_v2__dont_rewrite_if_no_changes(void) { shared_prf_storage_wipe_all(); uint32_t write_count = fake_flash_write_count(); uint32_t erase_count = fake_flash_erase_count(); shared_prf_storage_wipe_all(); // Already wiped, so no change, cl_assert_equal_i(write_count, fake_flash_...
2:00 (T+00:02:00) rtc_set_time(event_time + (2 * SECONDS_PER_MINUTE)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 minutes ago", time_buf); // June 9th 2015, 15:00:00 (T-01:00:00) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR)); clock_get_until_tim...
cl_assert_equal_s("Jun 10", time_buf)
; // June 7th 2015, 12:00:00 (-07:00:00) format_time = event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR); clock_get_month_named_abbrev_date(time_buf, sizeof(time_buf), format_time); cl_assert_equal_s("Jun 7", time_buf); // June 16th 2015, 13:00:00 (-07:00:00) format_time = event_time + (7 * SECONDS_P...
tSizeMedium] = { .layer_width = 14, .crumb_radius = 2, .crumb_spacing = 8, .crumb_space_from_top = 8, }, [PreferredContentSizeLarge] = { .layer_width = 16, .crumb_radius = 2, .crumb_spacing = 10, .crumb_space_from_top = 10, }, //! @note this is the same as Large until ExtraLarge ...
{ if (crumbs_layer == NULL) { return; } layer_deinit((Layer *)crumbs_layer); }
void crumbs_layer_destroy(CrumbsLayer *crumbs_layer) { crumbs_layer_deinit(crumbs_layer); applib_free(crumbs_layer); } int16_t prv_x_getter(void *subject) { CrumbsLayer *crumbs_layer = subject; return crumbs_layer->crumbs_x_increment; } void prv_x_setter(void *subject, int16_t int16) { CrumbsLayer *crumbs...
d Characteristic %s Handle 0x%"PRIx16, uuid_str, item->c.value_handle); } else if (item->type == GATTC_ITEM_TYPE_DESCRIPTOR) { if (char_dest == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "No characteristic found for descriptor! handle=0x%x", (int)item->handle); goto failure; } ...
// bonded device so let's assume this is what happen and notify the main firmware that we are // subscribed. PBL_LOG(LOG_LEVEL_DEBUG, "No cccd found for service changed characteristic, assuming we are " "auto-subscribed"); } // We've got everything we need, record the characteri...
} void gatt_client_discovery_process_service(const ble_evt_gattc_browse_svc_t *service) { uint32_t payload_size; HcProtocolDiscoveryServiceFoundPayload *payload = prv_gatt_client_discovery_build_gatt_service(service, &payload_size); if (!payload) { return; } Connection *connection = connection_by_...
sult, GPointZero); } void test_graphics_circle__gpoint_from_polar_returns_correct_points(void) { const uint16_t radius = 5; GPoint result; const GPoint origin_center = GPointZero; // 90 degrees should be (5, 0) result = gpoint_from_polar_internal(&origin_center, radius, (TRIG_MAX_ANGLE / 4)); cl_assert_eq...
(GPoint(5, 5))
; // GRectZero + standardize cl_assert_equal_grect(GRect(5, 5, 0, 0), grect_centered_internal(&p2, GSize(0, 0))); cl_assert_equal_grect(GRect(5, 4, 1, 2), grect_centered_internal(&p2, GSize(-1, -2))); // handles fixed point cl_assert_equal_grect(GRect(4, 4, 2, 2), grect_centered_internal(&p2, GSize(2, 2)));...
SELECT for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!prv_prf_button_combination_is_pressed()) { // stop waiting if not held down any longer return false; } delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_get_fw_reset_vect...
{ dbgserial_putstr("Force-booting recovery mode..."); }
the timer was set initially. //! @see gap_le_scan_get_dropped_reports_count static uint32_t s_dropped_reports; // ----------------------------------------------------------------------------- bool gap_le_start_scan(void) { bool success = false; bt_lock(); { if (!s_is_scanning) { s_dropped_reports = 0; ...
circular_buffer_consume(&s_circular_buffer, sizeof(GAPLERawAdReport))
= icon_frame_size.h; } else if (render_icon && (icon_align == GAlignLeft)) { // Let the icon extend the container height if it's taller than the title/subtitle combo container_height = MAX(icon_frame_size.h, container_height); } GRect container_rect = (GRect) { .size = GSize(cell_layer_bounds_size.w, cont...
graphics_draw_text(ctx, config->title, title_font, rect, config->overflow_mode, text_alignment, NULL)
; // Add back the cap offset so functions that use the returned title text frame can position // themselves using the actual frame rect.origin.y += cap_offsets_to_apply; return rect; } static ALWAYS_INLINE void prv_menu_cell_basic_draw_custom_two_columns_round( GContext *ctx, const GRect *cell_layer_bounds...
-192}, { 1208, 56, -16}, { 1056, 8, -80}, // 45 seconds { 944, 8, -88}, { 992, 136, -104}, { 968, 120, -96}, { 872, 40, -56}, { 992, 152, -144}, { 1112, 136, -224}, { 968, 8, -272}, { 1152, -8, -304}, { 1072, 32, -272}, { 712, 0, -264}, { 696, 48, -360}, { 87...
{ 1272, 320, -312}, { 1232, 352, -304}, { 992, 432, -304}, { 1208, 640, -328}, { 1040, 560, -336}, { 688, 400, -280}, { 896, 392, -184}, { 1160, 376, -80}, { 1296, 264, -40}, { 1288, 192, -8}, { 1296, 152, -24}, { 1304, 136, -56}, { 1264, 128, -80}, { 1104, 112, -...
{ 1448, 304, -48}, { 1384, 192, 32}, { 1240, 96, 104}, { 1224, 96, 24}, { 1200, 112, 32}, { 1144, 80, 64}, { 944, 64, 32}, { 976, 80, -32}, { 888, 112, -128}, { 784, 64, -272}, { 1000, 0, -208}, { 888, -40, -280}, { 712, -64, -312}, { 792, 32, -352}, { 1120, ...
bool result = prv_flash_read_verify(dev, FLASH_READ_TEST_TABLE[i].size, FLASH_READ_TEST_TABLE[i].offset); if (!result) { ++failures; } else { ++passes; } } } else { if (prv_flash_read_verify(dev, final_size, 3)) { ++passes; ...
(dev, &instruction, &dummy_cycles, &is_ddr)
; PBL_ASSERTN(!is_ddr); qspi_use(QSPI); qspi_indirect_read(dev->qspi, instruction, s_test_addr, dummy_cycles, s_test_buffer, sizeof(s_test_buffer), is_ddr); prv_set_fast_read_ddr_enabled(dev, dev->default_fast_read_ddr_enabled); qspi_release(QSPI); bool success = true; for (uint32_...