prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
.duration_secs = 4, }, { .min_interval_slots = 640, .max_interval_slots = 800, .duration_secs = 4, }, }; GAPLEAdvertisingJobRef job; job = gap_le_advert_schedule(ad, advert_terms, sizeof(advert_terms)/sizeof(GAPLEAdvertis...
create_ad("D", NULL)
; GAPLEAdvertisingJobRef infinite_job_d; infinite_job_d = gap_le_advert_schedule(ad_d, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); // It should get immediate ...
-16}, { 1000, 320, 8}, { 944, 352, -32}, { 800, 408, -120}, { 1416, 448, 56}, { 1312, 672, 32}, // 13 seconds { 1008, 1032, -152}, { 1448, 520, -168}, { 888, 416, -168}, { 1024, 536, -16}, { 1448, 576, -8}, { 1520, 456, -40}, { 1416, 320, 40}, { 1152, -304, 184}, ...
{ 1016, -272, -424}, { 1008, 24, -232}, { 992, 240, -152}, { 840, 152, -152}, { 824, 264, -48}, { 1304, 424, -112}, { 1280, 520, -168}, { 1520, 512, -72}, { 1376, 960, -448}, { 704, 408, -376}, { 864, 512, -560}, { 1264, 392, -560}, { 1504, 264, -144}, { 1232, -56...
{ 824, 456, -320}, { 1072, 424, -168}, { 1376, 448, -136}, { 1288, 384, -64}, { 1216, 304, -32}, { 1160, 304, 120}, { 1184, 72, -8}, { 1064, 128, -96}, { 888, 32, -176}, { 832, 128, -184}, { 1248, 88, -216}, { 1032, 104, -272}, { 1160, 112, -128}, { 1424, 48, 24}...
ANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ancs_item.h" #include "ancs_notifications_util.h" #include "applib/graphics/utf8.h" #include "kernel/pbl_malloc.h" #include "services/com...
((char *)buffer + pos, max_msg_length - pos, "\n\"%s\"", stripped_caption)
; if (caption->length == caption_max_length) { // Overwrite the last quote with ellipsis const size_t quote_len = 1; pos += prv_add_ellipsis((char *)buffer, pos - quote_len); } } return buffer + pos + 1; } static int prv_set_multimedia_action_msg(char *buffer, size_t length) { #if PLATFOR...
-168, -136, -992}, { -160, -128, -984}, { -168, -120, -992}, { -168, -144, -992}, { -160, -144, -1000}, { -160, -144, -992}, { -168, -136, -992}, { -160, -136, -1000}, { -160, -136, -976}, // 168 seconds { -168, -112, -992}, { -176, -120, -1008}, { -168, -160, -976}, ...
{ -160, -128, -992}, { -160, -152, -992}, { -184, -168, -968}, { -176, -96, -984}, { -168, -112, -1000}, { -152, -136, -1024}, { -160, -120, -1008}, // 173 seconds { -176, -112, -968}, { -176, -96, -984}, { -168, -104, -1000}, { -168, -112, -992}, { -168, -112, -1008}...
ayout; } return NULL; } static void prv_announce_layout_will_appear(SwapLayer *swap_layer, LayoutLayer *layout) { swap_layer->swap_in_progress = true; if (swap_layer->callbacks.layout_will_appear_handler) { return swap_layer->callbacks.layout_will_appear_handler(swap_layer, layout, ...
{ hide_it = false; }
#endif } layer_set_hidden(&swap_layer->arrow_layer.layer, hide_it); } static void prv_arrow_layer_update_proc(Layer *layer, GContext* ctx) { ArrowLayer *arrow_layer = (ArrowLayer *)layer; const GRect *layer_bounds = &layer->bounds; #if PBL_RECT graphics_context_set_fill_color(ctx, GColorWhite); graphic...
cl_assert(strncmp(tuple->value->cstring, SOME_EMPTY_STRING, strlen(SOME_EMPTY_STRING) + 1) == 0); // Check zero termination: cl_assert(tuple->value->cstring[strlen(SOME_EMPTY_STRING)] == 0); empty_cstring_found = true; break; } tuple = dict_read_next(&iter); } cl_assert(co...
ARRAY_LENGTH(source_tuplets)
" #include "process_management/app_install_manager.h" #include "resource/resource_ids.auto.h" #include "services/common/clock.h" #include "services/normal/alarms/alarm.h" #include "services/normal/timeline/attribute.h" #include "system/passert.h" #include "util/attributes.h" #include "util/string.h" #include "util/stru...
(current_time)
; const time_t alarm_midnight = time_util_get_midnight_of(alarm_time_epoch); const bool is_alarm_for_today = (alarm_midnight == today_midnight); const size_t alarm_subtitle_size = sizeof(alarms_glance->subtitle); // Only show the day of the week if the alarm is not for today if (!is_alarm_for_toda...
/* * 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...
(&notification)
; return S_SUCCESS; } int notif_db_get_len(const uint8_t *key, int key_len) { if (key_len < UUID_SIZE) { return 0; } return notification_storage_get_len((Uuid *)key); } status_t notif_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) { // NYI return S_SUCCESS; } status_t no...
= ActivitySleepStateAwake; s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 30 * SECONDS_PER_MINUTE; s_data.metric_history[ActivityMetricSleepExitAtSeconds][0] = midnight_local; s_data.metric_history[ActivityMetricSleepEnterAtSeconds][0] = midnight_local; s_data.metric_history[ActivityMetricSleepTota...
(&s_init_time_tm)
; prv_set_activation_time(now); activity_insights_process_minute_data(now); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); now += SECONDS_PER_DAY; // Jan 2 @ 10:00am rtc_set_time(now); activity_insights_process_minute_data(now); cl_assert_equal_i(fake_kernel_service...
PEBBLE_PUT_BYTES_EVENT); \ cl_assert_equal_i(event.put_bytes.type, PebblePutBytesEventTypeCleanup); \ cl_assert_equal_i(event.put_bytes.object_type, object_type_); \ cl_assert_equal_i(event.put_bytes.total_size, object_size_); \ cl_assert_equal_i(event.put_bytes.progress_percent, 0); \ cl_assert_equal_b(event...
prv_receive_init(4, ObjectFirmware)
; // Release it: xSemaphoreGive(put_bytes_get_semaphore()); fake_queue_set_yield_callback(put_bytes_get_semaphore(), NULL); assert_nack_count(1); } static void prv_hold_lock_before_write(void) { // Take and hold for a long time: xSemaphoreTake(put_bytes_get_semaphore(), portMAX_DELAY); fake_queue_set_y...
ype of the installable object. //! Also doubles as a marker for whether this object type has been committed recently, //! see prv_set_fw_update_bootbits_if_completed() PutBytesObjectType type; uint32_t index; } s_ready_to_install[NumObjects]; static SemaphoreHandle_t s_pb_semaphore; //! Marks that the receive...
{ PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs; // Things are already initialized if at least the first job buffer is non-NULL if (put_jobs->job[0].buffer != NULL) { return true; } #if !CAPABILITY_HAS_PUTBYTES_PREACKING put_jobs->enable_preack = false; #else put_jobs->enable_preack = tr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_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_origin_layer_non_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_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...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ graphics_context_set_stroke_color(ctx, GColorBlack); #if 0 // Guidelines int num_segments = 4; int segment_width = SCREEN_WIDTH / num_segments; int segment_height = SCREEN_HEIGHT / num_segments; for (int i = 1; i < num_segments; ++i) { graphics_draw_line(ctx, GPoint(segment_width * i, 0), ...
static void prv_reset(void) { gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)); s_outline_mode = false; s_path_angle = 0; } // setup and teardown void test_graphics_gpath_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS...
ess of whether it was copied: cl_assert_equal_b(has_more, false); cl_assert_equal_i(next_length, 0); } void test_gatt_client_subscriptions__consume_but_nothing_in_buffer(void) { // Subscribe app: BLECharacteristic characteristic = prv_get_indicatable_characteristic(); BTErrno e = gatt_client_subscriptions_su...
(GAPLEClientKernel)
, false); cl_assert_equal_b(gatt_client_get_event_pending_state(GAPLEClientApp), false); } void test_gatt_client_subscriptions__cleanup_by_connection(void) { fake_kernel_malloc_mark(); // Subscribe app and kernel: BLECharacteristic characteristic = prv_get_indicatable_characteristic(); BTErrno e = gatt_clie...
// This message should help us determine if iOS is publishing the service PBL_LOG(LOG_LEVEL_INFO, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!", client->debug_name, range.start, range.end); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16...
(GAPLEClientKernel)
; return; // yield } // This is ugly and causes double-copying the data... // TODO: https://pebbletechnology.atlassian.net/browse/PBL-14164 uint8_t *buffer = (uint8_t *) kernel_malloc(header.value_length); if (UNLIKELY(header.value_length && !buffer)) { PBL_LOG(LOG_LEVEL_ERROR, "OOM fo...
ck, white, dark_grey, light_grey, transparent) // Tests 1-bit jazzberry_jam colored palettized PNG loading into gbitmap // tests covers an old bug in image tooling where 1 color was 2 power 0 // so bitdepth was detected as 0 (incorrectly) // Result: // - gbitmap matches platform loaded PNG void test_png__color_1_bi...
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(1bitpalette)))
; cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette); } // Tests 2-bit greyscale PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__greyscale_2_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(2bitpalette)); cl_assert(gbitmap_pbi_eq(bi...
/* * 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...
analytics_external_collect_ble_pairing_info()
tributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/wind...
(&ctx, fb)
; layer_init(&layer, &GRect(10, 10, 10, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&laye...
8, 16, -1000}, { 48, 24, -1000}, { 40, 32, -992}, { 48, 16, -1000}, { 48, 24, -992}, { 48, 24, -1000}, { 40, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -992}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -992}, ...
{ 40, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 8, -1000}, { 40, 16, -1000}, { 48, 16, -1008}, { 48, 16, -1000}, { 48, 24, -1000}, { 40, 8, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, ...
{ 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1008}, { 48, 32, -1000}, { 40, 24, -1000}, { 40, 16, -1000}, { 48, 24, -992}, { 48, 16, -1000}, { 48, 24, -1000}, { 40, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1008}, { 48, 16...
calls, b0), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b1), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b2), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b3), 0); // Let it finish completely prv_advance_to_ms_with_time...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0);...
(0, 0) // Result: // - Pattern repeated vertically x2, plus 4 rows of red. void test_bitblt__8bit_wrap_y(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__8bit_wrap_y.8bit.pbi"); uint8_t dest_data[50*50]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 50, .info.format =...
(dest_data, GColorBlue.argb, sizeof(dest_data))
; bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpSet, GColorWhite); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_set-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Setup: // - Source is an image of a white cross // - Dest is blue, same size as source // Res...
d) { timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); cl_assert(!stub_new_timer_is_scheduled(timer_id)); cl_assert(timeline_add(&item1)); timeline_eve...
stub_new_timer_fire(timer_id)
); cl_assert_equal_i(fake_event_get_count(), 2); cl_assert(prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); rtc_set_time(20 * 60); cl_assert(stub_new_timer_fire(timer_id)); cl_assert_equal_i(fake_event_get_co...
(ActionMenuLayer *aml, int selected_index) { prv_unschedule_item_animation(aml); if (aml->layout_cache.item_heights != NULL) { applib_free(aml->layout_cache.item_heights); aml->layout_cache.item_heights = NULL; } if (aml->num_items > 0) { // Update the cache of heights. We do this here to avoid r...
action_menu_layer_deinit(aml)
; applib_free(aml); } void action_menu_layer_set_align(ActionMenuLayer *aml, ActionMenuAlign align) { if (!aml) { return; } aml->layout_cache.align = align; } void action_menu_layer_set_items(ActionMenuLayer *aml, const ActionMenuItem* items, int num_items, unsigned defaul...
e_variable, .protocol = hton16(app_protocol), .length = hton16(packet_size), }; memcpy(&packet->i.information[0], information, info_length); pulse_link_send(packet, packet_size); } static void prv_process_ack(uint8_t ack_number) { if ((ack_number - 1) % MODULUS == s_send_variable) { pulse2_reliable...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Received Information packet response; this is " "not permitted by the protocol (Information packets can only be " "commands). Discarding."); return; }
prv_process_ack(packet->s.ack_number); if (packet->s.kind != SupervisoryKind_ReceiveReady && packet->s.kind != SupervisoryKind_Reject) { PBL_LOG(LOG_LEVEL_DEBUG, "Received a command packet of type %" PRIu8 " which is not supported by this implementation.", (uint8_t)packet->s.kin...
/* * 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_get_user_data(window)
; sniprintf(data->text_buffer, TEXT_BUFFER_SIZE, up ? "Raw UP" : "Raw DOWN"); if (up) { // PBL_LOG requires a fixed const string, so can't use ternary PBL_LOG(LOG_LEVEL_DEBUG, "Raw UP"); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Raw DOWN"); } text_layer_set_text(&data->text, data->text_buffer); toggle_col...
4, 24}, { 904, 80, 48}, { 872, 176, 0}, { 832, 208, -40}, { 840, 192, -56}, { 824, 160, -64}, { 824, 200, -104}, { 896, 184, -96}, { 1064, 168, -24}, { 1168, 136, 40}, { 1280, 168, 64}, { 1264, 184, 80}, { 1152, 128, 120}, { 960, 104, 24}, { 912, 128, 16}, { 9...
{ 824, 48, 88}, { 784, 64, 40}, { 832, 120, 48}, { 832, 160, 64}, { 896, 184, 48}, { 920, 184, -32}, { 1208, 192, 40}, { 1208, 160, 72}, { 1024, 184, -72}, { 920, 184, -120}, { 832, 144, -88}, { 856, 48, 0}, { 896, 32, 56}, { 912, 88, 48}, { 880, 152, 8}, ...
{ 1200, 184, 0}, { 1072, 224, -112}, { 944, 208, -152}, { 824, 128, -128}, { 800, 16, -48}, { 832, -24, 40}, { 848, 16, 56}, { 848, 72, 48}, { 864, 168, 16}, { 888, 248, -40}, { 880, 240, -96}, { 864, 256, -152}, { 856, 200, -120}, { 920, 176, -96}, { 1016, 1...
CT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerTopRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_topright.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORI...
(GSize(0, 0), GCornersAll, 8)
{ -1104, 608, -80}, { -1448, 584, 24}, { -1600, 280, 120}, { -1440, 136, -32}, { -1120, 24, -160}, { -1088, 128, -160}, // 28 seconds { -1152, 128, -56}, { -1184, 112, -72}, { -1312, 136, -8}, { -1328, -200, 216}, { -968, -368, 200}, { -1328, -264, 32}, { -1288, ...
{ -1000, 200, 616}, { -1200, -176, 168}, { -904, 64, 0}, { -848, 96, 184}, { -1048, 984, 144}, { -632, 1464, 144}, { -608, 1136, 256}, { -456, 1096, 112}, { -320, 864, 32}, { -128, 600, 24}, { -40, 464, -8}, { -88, 456, 168}, { -104, 432, 448}, { 80, 632, 480}, ...
{ -1168, 504, -152}, { -1592, 392, -120}, { -1456, 528, -184}, { -1120, 440, -232}, { -1304, 400, -80}, { -1384, 328, 40}, { -1200, 208, 48}, // 36 seconds { -1024, 152, 56}, { -1008, 64, 104}, { -1032, 64, 120}, { -1128, 184, 128}, { -1304, 168, 200}, { -1528, -...
ITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "status_bar_layer.h" #include "animation_timing.h" #include "applib/app_logging.h" #include "applib/applib_malloc.auto.h" #inclu...
event_service_client_subscribe(&(status_bar_layer->tick_event))
; status_bar_layer->config = (StatusBarLayerConfig){ .foreground_color = GColorWhite, .background_color = GColorBlack, .separator.mode = StatusBarLayerSeparatorModeNone, }; status_bar_layer->title_timer_id = TIMER_INVALID_ID; } StatusBarLayer *status_bar_layer_create(void) { StatusBarLayer *layer...
------------------------------------------------------------------------------------- bool workout_service_is_workout_ongoing(void) { prv_lock(); bool rv = (s_workout_data.current_workout != NULL); prv_unlock(); return rv; } // -----------------------------------------------------------------------------------...
workout_service_is_workout_ongoing()
) { *active = ROUND(s_workout_data.current_workout->active_calories, ACTIVITY_CALORIES_PER_KCAL); } } void workout_service_reset(void) { if (s_workout_data.current_workout) { kernel_free(s_workout_data.current_workout); } s_workout_data = (WorkoutServiceData) {}; } #endif
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
progress_callback(sector - first_sector + 1, count, progress_context)
; } } FLASH_Lock(); return true; } bool system_flash_write(uint32_t address, const void *data, size_t length) { // enable programming of flash FLASH_Unlock(); // clear errors FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPER...
// Setting the tint color to blue should result in a gradient from blue to yellow tint_color = GColorBlue; gcolor_tint_luminance_lookup_table_init(tint_color, lookup_table_out); cl_assert(gcolor_equal(lookup_table_out[0], GColorBlue)); cl_assert(gcolor_equal(lookup_table_out[1], GColorLiberty)); cl_assert(g...
cl_assert_equal_i(gcolor_component_multiply(2, 2), 1)
; cl_assert_equal_i(gcolor_component_multiply(1, 3), 1); cl_assert_equal_i(gcolor_component_multiply(2, 1), 1); }
y * 2), .accel_z = hton16(data->z * 2) }; prv_write_register_block(dev, ADDR_ACCEL_SAMPLE_IDX, &sample_data, sizeof(sample_data)); } static void prv_read_hrm_data(HRMDevice *dev, HRMData *data) { struct PACKED { uint16_t led_current; uint8_t hrm_status; uint8_t bpm; uint8_t sqi; } hrm_data_...
PROFILER_NODE_STOP(hrm_handling)
; mutex_unlock(HRM->state->lock); // PPG_DBG log out each PPG data sample that we recorded for (int i = 0; i < data.ppg_data.num_samples; i++) { PPG_DBG_VERBOSE("idx %-2"PRIu8" ppg %-6"PRIu16" tia %-6"PRIu16, data.ppg_data.indexes[i], data.ppg_data.ppg[i], data.ppg_data.tia[i]); } h...
buted under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "util/size.h" #include "util/stats.h" #include "clar.h" #includ...
cl_assert_equal_i(result.max_streak, num_data)
; cl_assert_equal_i(result.first_streak, num_data); cl_assert_equal_i(result.median, 10); } void test_stats__all_basic_ops_filtered(void) { const int32_t data[] = { 10, 0, 40, 6, 0, 0, 0, 32, 73, 0, 80, 34, 25, 62, 0 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = (StatsBasicOp_S...
e "stubs_hexdump.h" #include "stubs_layout_layer.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_regular_timer.h" #include "stubs_reminders.h" #include "s...
cl_assert(reminder_db_get_len((uint8_t*)&item1.header.id, sizeof(Uuid)) > 0)
; cl_assert(reminder_db_get_len((uint8_t*)&item2.header.id, sizeof(Uuid)) > 0); cl_assert(reminder_db_get_len((uint8_t*)&item3.header.id, sizeof(Uuid)) > 0); // remove #1 and confirm it's deleted cl_assert(S_SUCCESS == reminder_db_delete((uint8_t*)&item1.header.id, sizeof(Uuid))); cl_assert(reminder_db_get_l...
scillator"); RCC_LSEConfig(RCC_LSE_ON); for (int i = 0; i < LSE_READY_TIMEOUT_MS; i++) { if (prv_clocksource_is_lse_started()) { return true; } delay_us(1000); } dbgserial_putstr("LSE oscillator did not start"); return false; } //! This routine relies on bootbits already having enabled //!...
((time_register & (RTC_TR_MNT | RTC_TR_MNU)) >> 8)
; const uint32_t seconds = prv_bcd_to_byte(time_register & (RTC_TR_ST | RTC_TR_SU)); return (((hours * 60) + minutes) * 60) + seconds; } static uint32_t prv_elapsed_ticks(uint32_t before, uint32_t after) { int32_t result = after - before; if (result < 0) { result = (TICKS_IN_INTERVAL - before) + after; ...
ntext_mask_debug(ctx, mask); graphics_context_mask_destroy(ctx, mask); } /////////////////////////////////////// // APPLYING HORIZONTAL LINE HELPERS // /////////////////////////////////////// static const int16_t hline_applying_test_column_width = num_mask_values * num_pixels_per_mask_value; static void prv_prep...
(ctx, GPoint(x, y))
; } } } } static GDrawMask *prv_create_mask_for_vline_applying_test(GContext *ctx) { // The initial transparency doesn't really matter since we're about to overwrite it const bool transparent = false; GDrawMask *mask = graphics_context_mask_create(ctx, transparent); cl_assert(mask); const GSize ...
ONDS_PER_MINUTE)); return true; } static void prv_debug_cmd_sleep_sessions(int index, void *context) { HealthAPITestAppData *data = context; // These will be filled in by the activity callback data->bed_time_utc = 0; data->awake_time_utc = 0; time_t now = time(NULL); uint32_t num_activities_found = 0; ...
{ APP_LOG(APP_LOG_LEVEL_DEBUG, "No data available in last %d minutes", k_print_batch_size); }
const int k_num_last_minutes = 6; if (num_minutes >= k_num_last_minutes) { for (int i = num_minutes - k_num_last_minutes; i < num_minutes; i++) { HealthMinuteData *m_data = &minute_data[i]; APP_LOG(APP_LOG_LEVEL_DEBUG, "%"PRId8", 0x%"PRIx8", %"PRIu16", %"PRId8" ", m_data->steps, m_d...
spi_flash_init(0, 0x1000000); pfs_init(false); weather_db_init(); weather_shared_data_init(); } void test_weather_db__cleanup(void) { weather_shared_data_cleanup(); } // Tests //////////////////////////////////////////////////////////////// static void prv_db_iterator_cb(WeatherDBKey *key, WeatherDBEntry *ent...
(S_SUCCESS, weather_db_get_keys(keys))
; for(int x = 0; x < WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; x++) { cl_assert(weather_shared_data_get_key_exists(&keys[x])); } } void test_weather_db__read_stale_entries(void) { WeatherDBKey key = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; size_t entry_size = weather_shared_data_insert_stal...
/* * 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_state.storage[start_addr + i] == 0xff)
; } } int32_t fake_spi_flash_find_next_write(int32_t offset) { if(offset < s_state.offset || offset >= s_state.offset + s_state.length) { return E_RANGE; } do { if(s_state.storage[offset] != 0xff) { return offset; } offset++; } while(offset < s_state.offset + s_state.length); return E...
d_size_for_sn(PPoGATTClient *client, uint32_t sn, uint16_t payload_size) { client->out.payload_sizes[sn] = payload_size; } static void prv_clear_payload_sizes_up_to(PPoGATTClient *client, uint32_t sn_end_excl) { for (uint32_t sn = client->out.next_expected_ack_sn; s...
if (!client) { return NULL; }
*client = (PPoGATTClient){}; client->app_uuid = UUID_INVALID; client->rx_ack_timer = new_timer_create(); s_ppogatt_head = (PPoGATTClient *) list_prepend((ListNode *)s_ppogatt_head, &client->node); if (!regular_timer_is_scheduled(&s_ack_timer)) { s_ack_timer.cb = prv_timer_callback; regular_timer_add_...
the video const uint32_t full_duration_ms = ANIMATION_TARGET_FRAME_INTERVAL_MS * 7; uint32_t duration = full_duration_ms; if (was_animating) { // only show second half of animation if uses presses repetitive // as it's only the bounce back, then duration /= 2; animation_set_delay(anim, duration);...
prv_apply_selection_change(menu_layer, scroll_align, up, it.did_change_selection, &before_state.prev_selection, before_state.was_animating, animated)
static_var_type> new_value) static bool prv_set_s_clock_24h(bool *new_value) { s_clock_24h = *new_value; return true; } static bool prv_set_s_clock_timezone_source_is_manual(bool *new_value) { s_clock_timezone_source_is_manual = *new_value; return true; } static bool prv_set_s_clock_phone_timezone_id(int16_t ...
{ s_activity_activation_timestamp = *timestamp; return true; }
nit(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&s_ctx, fb); framebuffer_clear(fb); } void test_emoji_fonts__cleanup(void) { free(fb); fb = NULL; gbitmap_destroy(s_dest_bitmap); s_dest_bitmap = NULL; } // Helpers ////////////////////// static char s_emoji_string[] = "😄😃😀😊☺😉�...
(RESOURCE_ID_GOTHIC_24_EMOJI)
; cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_emoji_fonts__gothic_28_emoji(void) { prv_prepare_canvas_and_render_emoji(RESOURCE_ID_GOTHIC_28_EMOJI); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); }
/* * 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...
(RTC_TIMEZONE_ABBR_START, raw[0])
; RTC_WriteBackupRegister(RTC_TIMEZONE_ABBR_END_TZID_DSTID, raw[1]); RTC_WriteBackupRegister(RTC_TIMEZONE_GMTOFFSET, raw[2]); RTC_WriteBackupRegister(RTC_TIMEZONE_DST_START, raw[3]); RTC_WriteBackupRegister(RTC_TIMEZONE_DST_END, raw[4]); } void rtc_get_timezone(TimezoneInfo *tzinfo) { uint32_t *raw = (uint3...
arge(void) { prv_receive_init_fw_object(); prv_process_and_reset_test_counters(); size_t chunk_size = 1024 * 1024; uint8_t *chunk = kernel_malloc(chunk_size); prv_receive_put(s_last_response_cookie, chunk, chunk_size); kernel_free(chunk); assert_ack_count(0); assert_nack_count(1); } void test_put_byt...
(max_put_ops)
; // For the Put(s) assert_nack_count(1); // For the Commit } void test_put_bytes__commit_message_cookie_mismatch(void) { prv_receive_init_and_put_fw_object(); prv_receive_commit(~s_last_response_cookie, EXPECTED_CRC); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__commit_message_while_...
ic void prv_flash_start(void) { gpio_use(FLASH_CONFIG.spi_gpio); // Enable the GPIOA clock RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); uint8_t altfunc = GPIO_AF_SPI1; // Connect pins to their SPI functionality GPIO_PinAFConfig(FLASH_CONFIG.spi_gpio, FLASH_CONFIG.sclk_pin, altfunc); GPIO_PinAF...
prv_flash_send_and_receive_byte(FLASH_CMD_WAKE)
; prv_flash_end_cmd(); // wait a sufficient amount of time to enter standby mode // It appears violating these timing conditions can lead to // random bit corruptions on flash writes! delay_us(100); } static uint32_t prv_flash_whoami(void) { prv_enable_flash_spi_clock(); prv_flash_wait_for_write_bounde...
-176}, { -152, 904, -168}, { -160, 912, -168}, { -160, 912, -168}, { -160, 912, -168}, { -160, 920, -168}, { -160, 912, -160}, { -152, 920, -168}, { -152, 912, -168}, { -152, 912, -168}, { -152, 912, -168}, { -152, 912, -168}, { -152, 912, -168}, { -152, 920, -168}, ...
{ -152, 912, -176}, { -152, 912, -168}, { -160, 920, -168}, { -152, 912, -176}, { -152, 912, -168}, // 39 seconds { -152, 912, -176}, { -152, 904, -168}, { -152, 912, -176}, { -152, 912, -168}, { -152, 912, -168}, { -152, 920, -168}, { -152, 912, -168}, { -152, 91...
{ -144, 912, -184}, { -144, 920, -176}, { -144, 920, -184}, { -144, 912, -176}, { -144, 912, -176}, { -144, 920, -176}, { -144, 904, -176}, { -144, 920, -184}, { -144, 912, -176}, { -144, 920, -176}, { -144, 920, -176}, { -144, 920, -176}, { -144, 912, -176}, { -...
ER_RAM__[]; extern const uint32_t __FLASH_start__[]; extern const uint32_t __FLASH_size__[]; extern const uint32_t __kernel_main_stack_start__[]; extern const uint32_t __kernel_bg_stack_start__[]; #endif // Kernel read only RAM. Parts of RAM that it's kosher for unprivileged apps to read static const MpuRegion s_rea...
{ return &s_readonly_bss_region; }
app_glance_db.settings_file); mutex_unlock(s_app_glance_db.mutex); } ///////////////////////// // Blob DB API ///////////////////////// void app_glance_db_init(void) { s_app_glance_db.mutex = mutex_create(); } status_t app_glance_db_flush(void) { mutex_lock(s_app_glance_db.mutex); pfs_remove(SETTINGS_FILE_NA...
(app_uuid)
; if (app_install_id_from_app_db(app_id)) { // Bump the app's priority by telling the cache we're using it if (app_cache_entry_exists(app_id)) { app_cache_app_launched(app_id); } else { // The app isn't cached. Fetch it! PebbleEvent e = { .type = PEBBLE_APP_FETCH_REQUEST_EVENT, ...
the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "util/iterator.h" #include "applib/graphics/framebuffer.h" #include "applib/g...
(&char_iter)
); } void test_char_iterator__decode_test_string_with_initial_formatting_char(void) { Iterator char_iter; CharIterState char_iter_state; Utf8IterState* utf8_iter_state = (Utf8IterState*) &char_iter_state.utf8_iter_state; // Skip over codepoints that aren't newline and < 0x20 bool success = false; const Ut...
/* * 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...
{ // Ceil! size_t num_words = (length_bytes + (sizeof(uint32_t) - 1)) / sizeof(uint32_t); // Ensure our accesses are aligned by using this temporary buffer: uint32_t temp_buffer[num_words]; bool rv = hw_otpc_fifo_read(temp_buffer, prv_get_cell_offset_for_address(otp_addr), HW_OT...
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 # error "Unsupported s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(INT16_MAX, interpolate_int16(ANIMATION_NORMALIZED_MAX, -20000, 20000))
; } void test_animation_interpolate__moook(void) { const int expected[] = {-20000, -19999, -19980, 20004, 20002, 20001, 20000}; const int num_frames = ARRAY_LENGTH(expected); for (int i = 0; i < num_frames; i++) { printf("frame: %d\n", i); cl_assert_equal_i(interpolate_moook((i * ANIMATION_NORMALIZED_MAX...
KING int32_t vmc; const bool rv = activity_get_metric(ActivityMetricLastVMC, 1, &vmc); return rv ? vmc : 0; #else return 0; #endif } // ---------------------------------------------------------------------------------------------- static bool prv_should_smart_alarm_trigger(const AlarmConfig *config) { if (s_...
if (last_alarm != alarm_time) { last_alarm = alarm_time; localtime_r(&alarm_time, local_alarm_time); if (alarm->config.scheduled_days[local_alarm_time->tm_wday]) { Uuid *pinid = (Uuid *)&settings_file_buffer[num_pin_adds++ * UUID_SIZE]; prv_add_pin(alarm->id, &alarm->config, alarm_time...
/* * 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...
(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(1)))
; gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(2))); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(3))); gbitmap_sequence_update_bitmap_next_frame(bitmap_se...
stroke should be drawn, but no fill gdraw_command_set_stroke_width(command, 2); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_stroke_color.argb, GColorRedARGB8); cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_stroke_width, 2); cl_assert_equal_i(s_path_num_points, 2); ...
cl_assert_equal_i(1, s_path_stroke_precise_count)
; cl_assert_equal_b(false, s_path_open); cl_assert(prv_compare_points((GPoint*)points, s_stroke_points, s_path_num_points)); prv_reset(); // change to open path and ensure that only draws 2 lines command->path_open = true; gdraw_command_draw(NULL, command); cl_assert_equal_i(1, s_path_stroke_precise_coun...
/* * 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_destroy(data->text_layer)
; window_destroy(data->window); task_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* ambient_light_reading_get_info() { static const PebbleProcessMdSystem s_ambient_light_info = { .common.main_func = s_main, .name = "Amb Reading" ...
broken into 2 framents leaving a fragment that is of the */ /* requested size and one that is at least as larger as the */ /* MINIMUM_MEMORY_SIZE. */ #define MINIMUM_MEMORY_SIZE 1 /* The following defines the structure that describes a memory */ /* frag...
{ free_segments++; /* Accumulate the total number of free Bytes. */ *free += heap_info_ptr->Size * ALIGNMENT_SIZE; /* Check to see if the current fragment is larger that any */ /* we have seen and update the Max Value if it is larger. */ if(heap_info_ptr->Size > *m...
/* Adjust the pointer to the next entry. */ heap_info_ptr = get_next_block(heap, heap_info_ptr); } while (heap_info_ptr < heap->end); UTIL_ASSERT(heap_info_ptr == heap->end); char format_str[80]; snprintf(format_str, sizeof(format_str), "alloc: %u (%u bytes), free: %u (%u byte...
ar.progress_layer.progress_percent; uint32_t duration = MAX_PROGRESS_PERCENT - progress; data->mic_window.progress_anim = prv_create_int16_prop_anim(progress, MAX_PROGRESS_PERCENT, duration, &s_progress_bar_impl, data); // use a stopped handler instead of a sequence animation because we need to be able to ...
(data, DictationSessionStatusSuccess)
; } break; } default: WTF; } } // This function gets the next state to transition to and whether that transition should be deferred // until the current animation is complete. static VoiceUiState prv_get_next_state(VoiceUiState current_state, VoiceUiState next_state, ...
) { if (!bus->rail_ctl_fn) { return; } static const uint32_t MIN_STOP_TIME_MS = 10; // check that at least enough time has elapsed since the last turn-off RtcTicks time_stopped_ms = ((rtc_get_ticks() - bus->state->last_rail_stop_ticks) * RTC_TICKS_HZ) / 1000; I2C_DEBUG("Bus %s rail start after a...
mutex_lock(slave->bus->state->bus_mutex)
; if (slave->bus->state->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted bitbang recovery on disabled bus %s", slave->bus->name); mutex_unlock(slave->bus->state->bus_mutex); return false; } InputConfig in_sda = { .gpio = slave->bus->sda_gpio.gpio, .gpio_pin = slave->bus->sda_gpio.gpio...
t16_t dest_y = dest_begin_y; dest_y < dest_end_y; ++dest_y, ++src_y) { // Wrap-around source bitmap vertically: if (src_y >= src_bitmap->bounds.origin.y + src_bitmap->bounds.size.h) { src_y = src_bitmap->bounds.origin.y; } const GBitmapDataRowInfo dest_row_info = gbitmap_get_data_row_info(dest_bi...
for (int i = src_start_idx; i < src_end_idx; ++i, ++dest_x) { const uint32_t bit = (1 << i); const bool set = src & bit; dest[dest_x] = (set) ? GColorWhite.argb : GColorBlack.argb; }
break; } row_bits_left -= number_of_bits; if (row_bits_left != 0) { ++src_block; if (src_block == src_block_end) { // Wrap-around source bitmap horizontally: src_block = src_block_begin; src_start_idx = src_line_wrap_idx; src_end_id...
ache.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 ...
if (level > max_crumbs) { PBL_LOG(LOG_LEVEL_WARNING, "exceeded max number of crumbs"); level = max_crumbs; }
crumbs_layer->level = level; layer_mark_dirty((Layer *)crumbs_layer); } void crumbs_layer_init(CrumbsLayer *crumbs_layer, const GRect *frame, GColor bg_color, GColor fg_color) { layer_init(&crumbs_layer->layer, frame); crumbs_layer->level = 0; crumbs_layer->fg_color = fg_color; crum...
8, -104}, { 832, 184, -88}, { 784, 144, -56}, // 91 seconds { 768, 120, -32}, { 848, 16, 32}, { 888, 24, -24}, { 1144, 160, -72}, { 1288, 240, -64}, { 1472, 304, -312}, { 1584, 320, -224}, { 1424, 336, -328}, { 1024, 360, -376}, { 800, 376, -232}, { 720, 448, -248...
{ 792, 168, -96}, { 808, 176, -96}, { 800, 8, -16}, { 1072, 48, 72}, { 1208, 152, -72}, { 1552, 352, -248}, { 1504, 232, 8}, { 1360, 160, -80}, { 1048, 384, -360}, { 808, 488, -440}, { 728, 320, -192}, { 832, 312, -248}, { 936, 456, -344}, { 928, 528, -400}, /...
ously"; } // Keep hourly logging to keep track of hours without crashes. analytics_set(ANALYTICS_DEVICE_METRIC_SYSTEM_CRASH_CODE, 0xDEAD0000 | reason.code, AnalyticsClient_System); uint32_t lr = reason.extra; // Leave this NULL to do your own printing. const char *reason_string = NULL; s...
(LOG_LEVEL_INFO, reason_string, restarted_safely_string, rebooted_due_to, reason.extra)
; } analytics_set(ANALYTICS_DEVICE_METRIC_SYSTEM_CRASH_LR, lr, AnalyticsClient_System); // We need to wait for the logging service to initialize. AnalyticsEventCrash *crash_report = kernel_malloc_check(sizeof(AnalyticsEventCrash)); *crash_report = (AnalyticsEventCrash) { .crash_code = reason.code, ....
* distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "transform.h" #include "applib/graphics/gdraw_command_p...
{ // We want to make sure the transform duration is at least as long as the to_reel duration // so that the resource transition runs to completion if it's animated const uint32_t to_duration = kino_reel_get_duration(data->to_reel); duration = MAX(duration, to_duration); }
, } UserSpaceBufferValidity; static UserSpaceBufferValidity s_addr_result; uint32_t dcache_line_size(void) { return cl_mock_type(size_t); } uint32_t icache_line_size(void) { return cl_mock_type(size_t); } bool dcache_is_enabled(void) { return cl_mock_type(bool); } bool icache_is_enabled(void) { return cl_mo...
(s_invalidate_size, 0x10)
// 13 seconds { 1008, 1032, -152}, { 1448, 520, -168}, { 888, 416, -168}, { 1024, 536, -16}, { 1448, 576, -8}, { 1520, 456, -40}, { 1416, 320, 40}, { 1152, -304, 184}, { 1160, 184, -112}, { 1064, 96, -56}, { 896, 256, -144}, { 816, 256, -72}, { 1112, 200, -40}, ...
{ 1144, 232, 40}, { 1128, 272, -72}, { 1056, 248, -200}, { 1232, 168, -48}, { 1120, 232, -160}, { 1048, 184, -280}, { 1312, 224, -320}, { 1248, 176, -320}, // 16 seconds { 816, 152, -232}, { 816, 208, -272}, { 960, 272, -128}, { 1168, 336, -192}, { 1120, 312, -18...
= {}; vars.current_time = s_truncation_tests[i].intime; cond.eval_time = EVAL_FALL_THROUGH; memset(s_output, 'Z', sizeof(s_output)); template_string_evaluate(s_truncation_tests[i].instr, s_output, s_truncation_tests[i].size, &cond, &vars, &err); cl_assert_equal_s(s_o...
printf("result: %jd\n", s_time_since_tests[i].done_state)
; #endif prv_state_init(); s_vars.current_time = s_time_since_tests[i].current_time; prv_template_evaluate_filter(&s_state, "time_since", s_time_since_tests[i].params); cl_assert_equal_b(s_state.filters_complete, false); cl_assert_equal_i(s_state.filter_state, s_time_since_tests[i].done_state); ...
ource_load_file_as_resource(TEST_IMAGES_PATH, GET_APNG_NAME); cl_assert(resource_id != UINT32_MAX); GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id); cl_assert(bitmap_sequence); GBitmap *bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(bitmap_sequence), ...
(bitmap, shift_bounds)
; gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); gbitmap_set_bounds(bitmap, orig_bounds); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(2))); gbitmap_set_bounds(bitmap, shift_bounds); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); gbitmap_set_bounds(bi...
ndle_connection(void); T_STATIC void prv_handle_disconnection(void); // App message mocks static AppMessageInboxReceived s_received_callback; AppMessageInboxReceived app_message_register_inbox_received( AppMessageInboxReceived received_callback) { AppMessageIn...
fake_pbl_malloc_check_net_allocs()
; fake_app_timer_deinit(); } static const PostMessageResetCompletePayload VALID_RESET_COMPLETE = { .min_supported_version = POSTMESSAGE_PROTOCOL_MIN_VERSION, .max_supported_version = POSTMESSAGE_PROTOCOL_MAX_VERSION, .max_tx_chunk_size = POSTMESSAGE_PROTOCOL_MAX_TX_CHUNK_SIZE, .max_rx_chunk_size = POSTMESSAG...
al_m(msg->msrmt.values, &values[num_samples_encoded * num_values_per_sample], msg->msrmt.num_values * sizeof(uint32_t)); } } // Delete the session now protobuf_log_session_delete(session_ref); } // --------------------------------------------------------------------------------------...
ARRAY_LENGTH(events)
; i++) { success = protobuf_log_session_add_event(session_ref, &events[i]); cl_assert(success); } prv_test_decode_payload(&input, false /*use_data_logging*/, session_ref); }
, 699}, { -1483, -1439, 780}, { -1315, -512, 416}, { -1284, -263, 155}, { -1824, -255, 705}, { -3984, 3999, 386}, { -1591, 3999, -227}, { 32, 2229, -182}, { 424, 1006, -60}, { 674, 708, -241}, { 1195, 460, -882}, { 1949, 400, -667}, { 1064, 314, -395}, { 569, 2136, -6...
{ -1402, 3999, -9}, { 156, 2292, -52}, { 574, 810, -50}, { 861, 764, -143}, { 2078, 149, -484}, { 1284, 108, -402}, { 821, 9, -326}, { 489, 799, -261}, { 231, 3999, -791}, { -857, 3999, -1064}, { -1667, 2775, 551}, { -958, 244, 489}, { -919, -180, -26}, { -860, 30...
{ -1064, 2712, 145}, { -1882, 911, 581}, { -581, 243, -42}, { -724, -124, 619}, { -1976, -1696, 1094}, { -1200, -174, 756}, { -1539, -263, 659}, { -2475, 445, 1054}, { -3570, 3999, -637}, { -1005, 3562, -460}, { 190, 1943, -176}, { 595, 1083, 150}, { 2701, 1149, -377...
void test_ams__receive_player_name_update(void) { prv_connect_ams(); // 0000 00 00 00 4d 75 73 69 63 ...Music uint8_t player_name_update[] = { 0x00, 0x00, 0x00, 0x4d, 0x75, 0x73, 0x69, 0x63, }; prv_receive_entity_update(player_name_update, sizeof(player_name_update)); char...
(incomplete_playback_info_update, sizeof(incomplete_playback_info_update))
; prv_assert_initial_playback_state(); } void test_ams__receive_malformed_player_volume_update(void) { prv_connect_ams(); cl_assert_equal_i(music_get_volume_percent(), 0); // Receive volume of 0.604925 // 00 02 00 30 2e 41 30 34 39 32 35 ...0.A04 925 uint8_t volume_update[] = { 0x0...
/* * 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...
update("78", 2)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pb_encode_string(stream, (uint8_t *)uuid_p, sizeof(Uuid))
; } bool protobuf_log_util_encode_string(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) { if (!pb_encode_tag_for_field(stream, field)) { return false; } const char *str = *(char **)arg; return pb_encode_string(stream, (uint8_t *)str, strlen(str...
rkout_service__expire_hr_reading(void) { int32_t steps, duration_s, distance_m, bpm; HRZone hr_zone; cl_assert(workout_service_start_workout(ActivitySessionType_Run)); prv_put_bpm_event(100, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, ...
cl_assert_equal_b(s_hrm_subscribed, false)
; cl_assert_equal_i(s_hrm_expiration, 0); } // --------------------------------------------------------------------------------------- // Open the app, start a workout, close the app. Make sure the HR stays on for // WORKOUT_ACTIVE_HR_SUBSCRIPTION_TS_EXPIRE void test_workout_service__app_open_close_active_workout(vo...
s("2 H AGO", time_buf); // June 9th 2015, 13:59:59 (T+01:59:59) rtc_set_time(event_time + SECONDS_PER_HOUR + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 H AGO", time_buf); // June 9th 2015, 14:00:00 (T+02:0...
cl_assert_equal_s(" 4:00 PM", time_buf)
imitations under the License. */ #include "mcu/interrupts.h" #include "os/assert.h" #include "os/malloc.h" #include "os/mutex.h" #include "os/tick.h" #include "FreeRTOS.h" #include "light_mutex.h" #include "task.h" #include <string.h> typedef struct { uint32_t lr; LightMutexHandle_t freertos_mutex; } Pebbl...
xLightMutexLockRecursive(mutex, timeout_ticks)
== pdTRUE) { LOG_LOCKED(handle->common.lr, myLR); return (true); } return (false); } bool mutex_lock_recursive_with_timeout(PebbleRecursiveMutex * handle, uint32_t timeout_ms) { uintptr_t myLR = (uintptr_t) __builtin_return_address(0); OS_ASSERT(!mcu_state_is_isr()); TickType_t timeout_ticks = mi...
nternal_circle_quadrant_fill_aa(GContext* ctx, GPoint p, uint16_t radius, GCornerMask quadrant) { // Radius cannot be smaller than 1 PBL_ASSERTN(radius > 0); prv_fill_oval_quadrant(ctx, p, radius, radius, 0, 0, quadrant); } #endif // PBL_COLOR // Returns x...
if (center.y.raw_value + y.raw_value <= bottom.y.raw_value) { *bottom_edge = prv_intersection_between_horizontal_and_line((Fixed_S16_3){.raw_value = (center.y.raw_value + y.raw_value)}, top, bottom); } else { *bottom_edge = bottom.x.raw_value; }
} else { *bottom_edge = top.x.raw_value; } } } T_STATIC EllipsisDrawConfig prv_calc_draw_config_ellipsis(int32_t angle_start, int32_t angle_end) { PBL_ASSERTN(angle_start <= angle_end); EllipsisDrawConfig config = (EllipsisDrawConfig){(EllipsisPartDrawConfig){0, GCornerNone}, GCornerNone, ...
/* * 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...
{ net16 protocol; unsigned char information[]; }
+ (z^2 - 2*z*z0 + z0^2) = r^2 // -2*x*x0 - 2*y*y0 - 2*z*z0 + (x^2 + y^2 + z^2) + r0^2 = 0 // b) A*(x^2 + y^2 + x^2) + B*x + C*y + D*z + E = 0 // // Ideally, we would be able to build a large cloud of points and apply a least // squares or ellipsoid fit to that dataset. However, this quickly becomes // expensive (f...
for (int i = 0; i < N_SAMPS; i++) { matrix[i][0] = r[i]; // m[i][1] = y, m[i][2] = z }
solution[0] = shift_factor[0] + sphere_determinant4x4(matrix, c00 * 2); // compute cofactor02 to solve for y0 for (int i = 0; i < N_SAMPS; i++) { matrix[i][1] = raw_data[i][0]; // m[i][0] = r^2, m[i][2] = z } solution[1] = shift_factor[1] - sphere_determinant4x4(matrix, c00 * 2); // compute cofactor0...
CHEDULE "dndSchedule" static DoNotDisturbSchedule s_legacy_dnd_schedule = { .from_hour = 0, .to_hour = 6, }; #define PREF_KEY_LEGACY_DND_SCHEDULE_ENABLED "dndEnabled" static bool s_legacy_dnd_schedule_enabled = false; #define PREF_KEY_LEGACY_DND_MANUAL_FIRST_USE "dndManualFirstUse" #define PREF_KEY_LEGACY_DND_SMA...
SET_PREF_ALREADY_OPEN(PREF_KEY_VIBE_SCORE_NOTIFICATIONS, s_vibe_score_notifications)
/* * 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...
{ -184, 520, -840}, { -184, 584, -832}, { -184, 560, -832}, { -168, 568, -824}, { -160, 584, -816}, { -160, 576, -800}, { -168, 528, -832}, { -168, 552, -840}, { -168, 536, -832}, { -176, 528, -824}, { -168, 544, -832}, { -168, 544, -800}, { -168, 544, -816}, { -1...
{ -136, 520, -840}, { -144, 536, -832}, { -152, 528, -840}, { -144, 528, -856}, { -144, 536, -848}, { -144, 528, -832}, { -152, 536, -840}, { -152, 536, -848}, // 5 seconds { -144, 528, -848}, { -152, 528, -848}, { -152, 536, -840}, { -152, 536, -848}, { -152, 54...
tatic void prv_detected_workout_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_detected_workout_up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_detected_workout_down_click_handler); } static void prv_show_workout_detected_dialog(WorkoutAppData *data) { ...
app_zalloc_check(sizeof(WorkoutAppData))
; app_state_set_user_data(data); workout_service_frontend_opened(); if (workout_service_is_workout_ongoing()) { if (app_launch_get_args() == WorkoutLaunchArg_EndWorkout) { workout_service_stop_workout(); prv_show_workout_ended_dialog(data); } else { ActivitySessionType existing_workout...
/* * 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 (pebble_task_get_current() == PebbleTask_Worker) { // Not allowed from workers syscall_failed(); }
// num_bytes_out is optional, so it's perfectly safe for an app to pass in NULL here. if (num_bytes_out) { syscall_assert_userspace_buffer(num_bytes_out, sizeof(*num_bytes_out)); } } return resource_get_readonly_bytes(app_num, resource_id, num_bytes_out, caller_is_privileged); } DEFINE_SYSCALL...
el_receiver_buffer_idx = 0; memset(s_kernel_receiver_buffer, 0, sizeof(s_kernel_receiver_buffer)); s_app_message_pp_received_length = 0; memset(s_app_message_pp_buffer, 0, sizeof(s_app_message_pp_buffer)); fake_kernel_malloc_init(); fake_kernel_malloc_enable_stats(true); s_communication_timestamp_updated = ...
(true, s_communication_timestamp_updated)
; prv_destroy_inbox(); } void test_app_message_receiver__receive_push_then_cleanup(void) { Receiver *r = prv_create_inbox_prepare_and_write(); s_rcv_imp->cleanup(r); cl_assert_equal_b(false, s_kernel_receiver_is_receiving); cl_assert_equal_b(false, s_kernel_receiver_finish_called); cl_assert_equal_i(s_a...
quat sapien tincidunt vitae. " "Duis ipsum nunc, tristique sit amet blandit non, scelerisque non diam. " "Etiam condimentum aliquam dictum. Nam nisi ex, cursus in ligula sit amet, " "ultricies egestas libero. Aliquam luctus, metus quis ultricies sagittis, " "nisi orci viverra felis, vitae luctus massa dolor sit...
{ char data[] = { 1, 2, 3, 4, 5, 6 }; cl_assert_equal_i(persist_write_data(0, data, sizeof(data)), sizeof(data)); cl_assert_equal_i(persist_get_size(0), sizeof(data)); }
void test_persist__exists(void) { cl_assert_equal_i(persist_exists(0), S_FALSE); cl_assert(PASSED(persist_write_int(0, 0))); cl_assert_equal_i(persist_exists(0), S_TRUE); } void test_persist__delete(void) { cl_assert_equal_i(persist_delete(0), E_DOES_NOT_EXIST); cl_assert(PASSED(persist_write_int(0, 0))); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
mfg_info_set_watch_color(WATCH_INFO_COLOR_GREEN)
; cl_assert_equal_i(mfg_info_get_watch_color(), WATCH_INFO_COLOR_GREEN); } void test_spalding_mfg_info__rtc_freq(void) { cl_assert_equal_i(mfg_info_get_rtc_freq(), 0); mfg_info_set_rtc_freq(0xfefefefe); cl_assert_equal_i(mfg_info_get_rtc_freq(), 0xfefefefe); mfg_info_set_rtc_freq(1337); cl_assert_equ...
enses/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 * limitatio...
graphics_draw_text(ctx, buffer, font, GRect(0, y, base_layer->bounds.size.w, 35), GTextOverflowModeFill, GTextAlignmentCenter, NULL)
; } static void prv_render_typical_steps(GContext *ctx, Layer *base_layer) { HealthActivitySummaryCardData *data = layer_get_data(base_layer); char steps_buffer[12]; if (data->typical_steps) { snprintf(steps_buffer, sizeof(steps_buffer), "%"PRId32, data->typical_steps); } else { snprintf(steps_buffer,...
ze(value); if (str_size == 0 || buffer_size < str_size || buffer_p == NULL) { return 0; } EM_ASM_INT({ var str = __jerryRefs.get($0); // Add one onto the buffer size, since Module.stringToUTF8 adds a null // character at the end. This will lead to truncation if we just use // buffer_s...
if (!str_p) { return jerry_create_undefined(); }
return jerry_create_string_utf8_sz(str_p, strlen((const char *)str_p)); } jerry_value_t jerry_create_string_sz(const jerry_char_t *str_p, jerry_size_t str_size) { return jerry_create_string_utf8_sz(str_p, str_size); } jerry_value_t jerry_create_string_utf8(const jerry_char_t *str_p) { if (!str_p) { return ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, GColorBlack)
; graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_st...
* is_connected */); prv_simulate_transport_connection_event(false /* is_connected */); EXPECT_OUTBOX_NO_MESSAGE_PENDING(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateDisconnected); } static void prv_init_and_goto_awaiting_reset_complete_remote_initiated(void) { prv_init_api(true /* st...
prv_rcv_app_message_ack(APP_MSG_OK)
"No more room for additional activities"); return; } // Add this activity in s_activity_sessions[s_activity_sessions_count++] = *session; } // ------------------------------------------------------------------------------------ void activity_sessions_prv_delete_activity_session(ActivitySession *session) { ...
rtc_get_time()
; } // Set these to simulate a sleep session (that should result in zeroing out any steps taken) static time_t s_kalg_sleep_start_utc; static uint16_t s_kalg_sleep_m; void kalg_get_sleep_stats(KAlgState *alg_state, KAlgOngoingSleepStats *stats) { time_t now = rtc_get_time(); if (s_kalg_sleep_start_utc == 0 || now...
/* * 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...
new_timer_delete(s_alarm_popup_data->vibe_timer)
; s_alarm_popup_data->vibe_timer = TIMER_INVALID_ID; #if CAPABILITY_HAS_VIBE_SCORES if (s_alarm_popup_data->vibe_score) { vibe_score_destroy(s_alarm_popup_data->vibe_score); s_alarm_popup_data->vibe_score = NULL; } #endif } vibes_cancel(); } // ----------------------------------------------...
------------------------------------------------------------------------------ static void prv_clear_snooze_timer(void) { new_timer_stop(s_snooze_timer_id); } // ---------------------------------------------------------------------------------------------- // Put a trigger event if applicable based on the type of al...
(file, alarm, true /* refresh */)
n, &s_workout_data, &s_workout_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__workout_render_open_workout(void) { s_workout_data = (WorkoutData) { .steps = 0, .duration_s = 84, .distance_m = 0, ...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_workout_active__sports_pace_long_values(void) { s_sports_data = (SportsData) { .current_bpm = 71, .duration_string = "04:20:39", .distance_string = "115.12", .pace_string = "12:34", }; WorkoutMetricType top_metric = WorkoutMetricType_Duration; WorkoutMetricType middle_metric = W...
OLD_NUMBERS)); text_layer_set_background_color(data->steps_card.time_layer, GColorClear); text_layer_set_text_color(data->steps_card.time_layer, GColorElectricBlue); layer_add_child(window_layer, text_layer_get_layer(data->steps_card.time_layer)); // Lap counter data->steps_card.delta_step_layer = text_layer...
window_single_click_subscribe(BUTTON_ID_BACK, prv_results_back_click_handler)
; } // ------------------------------------------------------------------------------- static void results_update_text(HealthAPITestAppData *data, const char* text) { strncpy(data->results_card.text, text, sizeof(data->results_card.text)); data->results_card.text[sizeof(data->results_card.text) - 1] = 0; text_l...
use_simple_dialog ? DIALOG_TIMEOUT_DEFAULT : DIALOG_TIMEOUT_INFINITE; dialog_set_timeout(dialog, dialog_timeout_ms); if (data->action_menu) { action_menu_set_result_window(data->action_menu, &dialog->window); } else { dialog_push(dialog, prv_get_w...
prv_cleanup_action_result(data, success)
; } } typedef struct { TimelineItem *item; void *event_ref; bool standalone_action; } ChainingWindowCBData; static void prv_cleanup_chaining_action_menu(void *context) { ChainingWindowCBData *data = context; timeline_item_destroy(data->item); event_service_free_claimed_buffer(data->event_ref); applib_...
nput_config = { .gpio = dev->tx_gpio.gpio, .gpio_pin = dev->tx_gpio.gpio_pin }; gpio_input_init(&input_config); } if (dev->rx_gpio.gpio) { const InputConfig input_config = { .gpio = dev->rx_gpio.gpio, .gpio_pin = dev->rx_gpio.gpio_pin }; gpio_input_init(&input_config); ...
PBL_ASSERTN(dev->state->initialized)
; dev->state->tx_irq_handler = irq_handler; } void uart_set_rx_interrupt_enabled(UARTDevice *dev, bool enabled) { PBL_ASSERTN(dev->state->initialized); if (enabled) { dev->state->rx_int_enabled = true; dev->periph->CR1 |= USART_CR1_RXNEIE; prv_set_interrupt_enabled(dev, true); } else { // disab...
atus_t rv = E_ERROR; mutex_lock(s_mutex); { SettingsFile file = {{0}}; if (settings_file_open(&file, SHELL_PREFS_FILE_NAME, SHELL_PREFS_FILE_LEN) == S_SUCCESS) { // Keys in the backing store include the null terminator, so we add 1 to key_len rv = settings_file_set(&file, entry->key, strlen(entr...
(event->key, event->key_len, entry->value, entry->value_len)
; if (success) { // Call the state update handler in case this pref needs to take other action besides // just updating the global if (!entry->handler(entry->value, entry->value_len)) { // If the handler returns false, that means it reset the global back to the default, // so we should write t...