prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_data.log_layer, "Closed all logging sessions.")
; } static void start_logging(void) { const uint8_t item_size[] = {4, 2, 16}; const DataLoggingItemType types[] = {DATA_LOGGING_INT, DATA_LOGGING_UINT, DATA_LOGGING_BYTE_ARRAY}; for (int i = 0; i < 3; ++i) { text_layer_set_text(&s_data.info[i].text_layer, "Empty"); s_data.info[i].item_size = item_size[i...
{ // mask the app task if we're already animating e->task_mask |= 1 << PebbleTask_App; return; }
const bool is_modal_focused = (modal_manager_get_enabled() && !(modal_manager_get_properties() & ModalProperty_Unfocused)); if (is_modal_focused) { // mask the app task if a modal is on top e->task_mask |= 1 << PebbleTask_App; modal_manager_handle_button_event(e); ...
loaded_node->icon_is_default = (timeline_res_id == NOTIF_FALLBACK_ICON) || (timeline_res_id == TIMELINE_RESOURCE_NOTIFICATION_GENERIC); *loaded_list = (LoadedNotificationNode*) list_prepend((ListNode*) *loaded_list, (ListNode*)loaded_node); return loaded_node; } static v...
(color, GColorBlack)
) { return GColorWhite; } else if (gcolor_equal(color, GColorWhite)) { return GColorBlack; } return color; } static void prv_invert_pdc_colors(GDrawCommandProcessor *processor, GDrawCommand *processed_command, size_t processed_command_ma...
/* * 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...
attribute_list_add_uint8(&notif_attr_list, AttributeIdBgColor, PBL_IF_COLOR_ELSE(GColorYellowARGB8, GColorDarkGrayARGB8))
; AttributeList dismiss_attr_list = {0}; attribute_list_add_cstring(&dismiss_attr_list, AttributeIdTitle, i18n_get("Dismiss", &notif_attr_list)); AttributeList end_workout_attr_list = {0}; attribute_list_add_cstring(&end_workout_attr_list, AttributeIdTitle, ...
/* * 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...
(AHB1PERIPH_BASE < AHB2PERIPH_BASE, "Clock mapping assumptions don't hold")
; _Static_assert(AHB2PERIPH_BASE < AHB3_BASE, "Clock mapping assumptions don't hold"); // Note: this works only with peripheral (<...>Typedef_t *) defines, not with RCC defines static ClockCmd prv_get_clock_cmd(uintptr_t periph_addr) { PBL_ASSERTN(periph_addr >= APB1PERIPH_BASE); if (periph_addr < APB2PERIPH_BASE)...
nclude "stubs_watchface.h" #include "stubs_worker_manager.h" // Fake Includes //////////////////////////////////// #include "fake_spi_flash.h" const uint32_t g_num_file_resource_stores = 0; const FileResourceData g_file_resource_stores[] = {}; #define APP_REGISTRY_FIXTURE_PATH "app_registry" #define BG_COUNTER_APP_...
(&big_time_app.uuid)
; app_cache_add_entry(big_time_app_id, 10701); cl_assert_equal_i(BIG_TIME_APP_ID, big_time_app_id); menu_layer_init(&menu_layer, &GRect(0,0,144,76)); rtc_set_time(100); } extern ListNode *s_head_callback_node_list; void test_app_menu_data_source__cleanup(void) { s_head_callback_node_list = NULL; app_ins...
{ return E_ERROR; } status_t flash_impl_init(bool coredump_mode) { return S_SUCCESS; } void flash_impl_use(void) {} void flash_impl_release_many(uint32_t num_locks) {} int get_subsector_base_calls = 0; FlashAddress flash_impl_get_subsector_base_address(FlashAddress addr) { get_subsector_base_calls++; retur...
(erase_sector_begin_calls, 1)
; cl_assert_equal_i(erase_subsector_begin_calls, 0); } /////////////////////////////////////////////////////////////////////// status_t erase_status_return_error_once(void) { get_erase_status_fn = return_success; return E_ERROR; } void test_flash_api__retry_erase_on_first_error(void) { get_erase_status_fn = ...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_health_activity_detail_card__render_current_calories_and_distance(void) { HealthData health_data = { .current_calories = 123, .current_distance_meters = 4000, }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_ac...
on_res_info); const ResourceId resource = icon_res_info.res_id; // Resetting the same icon shouldn't be animated. if (resource == s_phone_ui_data->current_icon_id) { return; } KinoReel *new_image = kino_reel_create_with_resource(resource); #if !PLATFORM_TINTIN KinoReel *old_image = s_phone_ui_data->cu...
{ s_phone_ui_data->bg_color.right = s_phone_ui_data->bg_color.left; }
else { s_phone_ui_data->bg_color.left = s_phone_ui_data->bg_color.right; } if (left_to_right) { s_phone_ui_data->bg_color.left = color; color_animation = property_animation_get_animation( property_animation_create(&s_color_slide_animation_impl, NULL, &zero, &width)); s_phone_ui_data->bg_co...
nd_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RA...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); // SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN...
{ 1232, 408, -104}, { 1120, 456, -104}, // 61 seconds { 1344, 544, -72}, { 1592, 696, -8}, { 1000, 768, 208}, { 1272, 872, -152}, { 952, 632, -96}, { 952, 600, -96}, { 928, 656, -56}, { 1168, 696, 0}, { 1448, 576, 72}, { 1384, 352, 72}, { 1368, 224, 80}, { 136...
{ 1200, 248, -400}, { 1176, 256, -296}, { 1232, 312, -320}, { 1336, 376, -256}, { 1392, 432, -360}, { 1232, 568, -288}, { 1120, 704, -256}, { 1496, 560, -80}, { 1192, 616, -64}, { 840, 568, -72}, { 1280, 752, 128}, { 1192, 1080, 32}, { 1088, 712, 16}, { 1136, 584,...
{ 1128, 632, -40}, { 1176, 624, 56}, { 1392, 616, 72}, { 1400, 432, 80}, { 1320, 256, 104}, { 1336, 192, 80}, { 1320, 232, 0}, { 1192, 272, -48}, { 1016, 256, 8}, { 1080, 272, 0}, { 1024, 280, -80}, { 1000, 248, -96}, { 1376, 224, -104}, { 1184, 112, 80}, { 1...
g.h" #include "system/passert.h" #include "util/dict.h" #define LAUNCHER_MESSAGE_ENDPOINT_ID (0x31) typedef enum { //! Used as reply from the watch to the phone, to indicate the app is not running. //! Or, when pushed from phone to watch, this value will have the effect of killing the app. NOT_RUNNING_DEPRECA...
prv_has_invalid_length(sizeof(AppMessageHeader), length)
value size and data to exist if (!iter || (iter > (data + length - VALUE_DATA_LENGTH))) { prv_send_response(session, token, BLOB_DB_INVALID_DATA); return; } // read value length and value bytes ptr uint16_t value_size; const uint8_t *value_bytes = NULL; iter = prv_read_value_size(iter, data + leng...
{ PBL_LOG(LOG_LEVEL_ERROR, "Got a blob_db message that was too short, len: %zu", length); prv_send_response(session, 0, BLOB_DB_INVALID_DATA); 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...
if (success) { break; }
--tries_left; } } if (tries_left == 0) { PBL_LOG(LOG_LEVEL_WARNING, "rng_rand() failed too many times, falling back to rand()"); // Fall back to rand(): for (uint32_t i = 0; i < (sizeof(SM128BitKey) * SMRootKeyTypeNum); ++i) { rand_buffer[i] = rand(); } } } void ble_root_keys_get...
_SIZE || val_len > (int) MAX_ENTRY_SIZE) { return E_INVALID_ARGUMENT; } const WeatherDBEntry *entry = (WeatherDBEntry *)val; if (entry->version != WEATHER_DB_CURRENT_VERSION) { PBL_LOG(LOG_LEVEL_WARNING, "Version mismatch on insert! Entry version: %" PRIu8 ", WeatherDB version: %u", ...
settings_file_set(&s_weather_db.settings_file, key, key_len, val, val_len)
; prv_close_file_and_unlock_mutex(); return rv; } #endif
_set_selected_next(&l, false, MenuRowAlignNone, true); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); // these values are unchanged until the animation updates them cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0 * basic_cell_height, l.selection.y); cl_assert...
(&l, MenuIndex(0, s_num_rows - 1), MenuRowAlignNone, false)
; cl_assert_equal_i(focused_height, l.selection.h); s_num_rows--; cl_assert_equal_i(2, s_num_rows); menu_layer_reload_data(&l); cl_assert_equal_i(s_num_rows - 1, l.selection.index.row); cl_assert_equal_i(focused_height, l.selection.h); s_num_rows--; cl_assert_equal_i(1, s_num_rows); menu_layer_reloa...
(e->launch_app.data, common, (LaunchConfigCommon) {})
, }); } return; case PEBBLE_WORKER_LAUNCH_EVENT: if (!app_install_is_worker_running(e->launch_app.id)) { process_manager_launch_process(&(ProcessLaunchConfig) { .id = e->launch_app.id, .common = NULL_SAFE_FIELD_ACCESS(e->launch_app.data, common, (LaunchConfigCo...
k(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_bw_corner_45.Xbit.pbi")); // Top-left center rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPoin...
test_graphics_context_init(&ctx, fb)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(prv_is_session_task())
; } // -------------------------------------------------------------------------------------------- // Return the session ref for the given task. This should ONLY be used by 3rd party tasks // (app or worker). AccelServiceState * accel_service_private_get_session(PebbleTask task) { if (task == PebbleTask_Unknown) {...
/* * 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_use(gpio)
; // enable the bus supply GPIO_WriteBit(gpio, gpio_pin, active_high ? Bit_SET : Bit_RESET); // wait for the bus supply to stabilize and the peripherals to start up. // the MFI chip requires its reset pin to be stable for at least 10ms from startup. delay_ms(20); gpio_release(gpio); } else { ...
== AttributeTransactionEndWrite) && (attr->state == SmartstrapAttributeStateWritePending)) { prv_set_attribute_state(attr, SmartstrapAttributeStateRequestPending); return true; } return false; } //! Note; This should only be called from the consumer task static void prv_cancel_transaction(Sma...
process_manager_send_event_to_process(CONSUMER_TASK, &event)
; return true; } void smartstrap_attribute_send_event(SmartstrapEventType type, SmartstrapProfile profile, SmartstrapResult result, uint16_t service_id, uint16_t attribute_id, uint16_t read_length) { PBL_ASSERT_TASK(PebbleTask_KernelBackgrou...
.title = ":parrot: :parrot:", .subtitle = ":parrot: :parrot: :parrot:", .icon = TIMELINE_RESOURCE_GENERIC_CONFIRMATION, .num_concurrent = 3, }); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_timeline_peek__peek_title_only(void) { prv_render_timeline_peek(&(TimelinePeekItemConf...
timeline_peek_get_peek()
; const Layer *layer = &peek->layout_layer; // Normally it is animated, but for this unit test, we don't request `animated` cl_assert(layer->frame.origin.y >= DISP_ROWS); // Transition away from the watchface s_is_watchface_running = false; timeline_peek_set_visible(false, false /* animated */); // For s...
_get_time(); AttributeList list = {}; prv_set_timeline_icon(&list, TIMELINE_RESOURCE_TIMELINE_SPORTS, 0); attribute_list_add_uint8(&list, AttributeIdSecondaryColor, secondary_color.argb); attribute_list_add_cstring(&list, AttributeIdTitle, "Avalanche at Sharks"); attribute_list_add_cstring(&list, AttributeId...
attribute_list_add_cstring(&list, AttributeIdLocationName, "145 Williams John\n" "Palo Alto")
; static StringList headings = StringListLiteral("Attendees\0Organizer"); static StringList paragraphs = StringListLiteral("Ryan Case\nBrad Murray\0Sarah Otten"); attribute_list_add_string_list(&list, AttributeIdHeadings, &headings); attribute_list_add_string_list(&list, AttributeIdParagraphs, &paragraphs); a...
text; int num_will_change_calls; int num_change_calls; int num_did_change_calls; GRect last_will_change_final_area; AnimationProgress last_change_progress; } UnobstructedAreaTestData; UnobstructedAreaTestData s_data; static void prv_will_change(GRect final_area, void *context) { s_data.last_will_change_fi...
(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler)
ndlers(BTBondingID bonding, BtPersistBondingOp op) { prv_update_active_gateway_if_needed(bonding, op); if (!bt_ctl_is_bluetooth_running()) { return; } prv_call_common_bonding_change_handlers(bonding, op); } typedef struct { BTDeviceAddress address;...
bt_persistent_storage_set_active_gateway(key)
; } prv_call_bt_classic_bonding_change_handlers(key, op); } return key; } void bt_persistent_storage_delete_bt_classic_pairing_by_id(BTBondingID bonding) { BtPersistBondingData deleted_data; if (!prv_delete_pairing_with_type_by_id(bonding, BtPersistBondingTypeBTClassic, &deleted_data)) { return; ...
m 4am to 9am. This should use the // daily totals since we don't havce 15-minute averages maintained for this metric exp_value = (k_daily_total * 5 * MINUTES_PER_HOUR) / MINUTES_PER_DAY; // Since "today" is Monday, going back 24 hours puts us on a weekend value = health_service_sum_averaged(HealthMetricActiveS...
health_service_peek_current_value(HealthMetricHeartRateBPM)
; cl_assert_equal_i(0, result); // Asking for a cumulative metric should return error (0) result = health_service_peek_current_value(HealthMetricStepCount); cl_assert_equal_i(0, result); } static void prv_update_stats(HealthServiceStats *stats, HealthValue value) { stats->sum += value; stats->min = MIN(v...
(BMI160SampleRate_50_HZ <= interval_us) { sample_rate = BMI160SampleRate_50_HZ; } else if (BMI160SampleRate_100_HZ <= interval_us) { sample_rate = BMI160SampleRate_100_HZ; } else if (BMI160SampleRate_200_HZ <= interval_us) { sample_rate = BMI160SampleRate_200_HZ; } else if (BMI160SampleRate_400_HZ <= ...
if (curr_sample_size > num_samples) { // flush what we have in the fifo, if any BMI160_DBG("Curr Sample Size = %"PRId16, curr_sample_size); prv_drain_fifo(); }
if (num_samples < 2) { prv_write_reg(BMI160_REG_FIFO_CONFIG_1, 0); // power down the fifo curr_fifo_num_samples_wm = 0; } else { curr_fifo_num_samples_wm = num_samples; // Set the new fifo watermark // TODO: I think we will want to try and make this a multiple of the frame size uint8_t fif...
list = NULL; } static void prv_compare_recognizers_processed(int indices[], uint32_t count, ListNode **list) { printf(list == &s_recognizers_handled ? "Handle touch: " : ""); printf(list == &s_recognizers_reset ? "Reset: " : ""); printf("{ "); for (uint32_t i = 0; i < count; i++) { printf("%d, ", indices[i...
((int[]) {0}, 1, &s_recognizers_handled)
; // Two recognizers attached to the active layer - processed in order that they were added recognizer_add_to_list(recognizers[1], &layer_c.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...
l_i(0b00010000, BITS_BETWEEN(4, 4)); } // Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. // The remaining sectors are 128 KiB. // Bitset of sectors that have been "erased" static uint32_t erased_sector; static bool flash_locked, flash_flags_set; static F...
(testdata, (const char *)&flash_written_data[10])
; assert_flash_unwritten(0, 10); assert_flash_unwritten(10 + sizeof(testdata), 90 - sizeof(testdata)); cl_assert(callback_called); } void test_system_flash__write_error(void) { return_status = FLASH_ERROR_OPERATION; malloc_flash_data(10); flash_data_start = FLASH_BASE; cl_assert(!system_flash_write(FLASH...
/* * 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(mutex_2)
; cl_assert_equal_b(fake_mutex_all_unlocked(), false); mutex_unlock(mutex_2); cl_assert_equal_b(fake_mutex_all_unlocked(), false); mutex_unlock(mutex_1); cl_assert_equal_b(fake_mutex_all_unlocked(), true); }
e(session, DataLoggingSessionCommStateIdle, false /*reschedule*/); } return true; } static void check_ack_timeout(void) { RtcTicks current_ticks = rtc_get_ticks(); dls_list_for_each_session(check_ack_timeout_for_session, &current_ticks); reschedule_ack_timeout(); } static void ack_timer_cb(void *cb_data)...
{ CommSession *session = comm_session_get_system_session(); if (!session) { return; } DataLoggingCloseSessionMessage msg = { .command = DataLoggingEndpointCmdClose, .session_id = session_id, }; dls_endpoint_print_message((uint8_t *)&msg, 0); comm_session_send_data(session, ENDPOINT_ID_DATA_...
NE_1_HR, HRMQuality_Good); prv_inc_time(10); prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10); cl_assert_equal_i(hr_zone_time_s[H...
(workout_service_get_avg_hr(&avg_hr))
; cl_assert_equal_i(avg_hr, 140); prv_put_bpm_event(160, HRMQuality_Good); prv_put_bpm_event(160, HRMQuality_Good); cl_assert(workout_service_get_avg_hr(&avg_hr)); cl_assert_equal_i(avg_hr, 150); cl_assert(workout_service_pause_workout(true)); prv_put_bpm_event(200, HRMQuality_Good); prv_put_bpm_even...
_equal_b(false, prv_app_install_is_watchface(sports_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(bg_counter_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(menu_layer_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(CRAZY_ID)); } void test_app_install_manager__get_uuid_for_...
cl_assert(bg_counter_md_worker != NULL)
orced) { } void launcher_task_add_callback(void (*callback)(void *data), void *data) { callback(data); } uint16_t gaps_get_starting_att_handle(void) { return 4; } // Helpers /////////////////////////////////////////////////////////// extern void gatt_client_subscriptions_handle_server_notification(GAPLEConnecti...
memset(buffer, 0, assert_value_length)
; if (kernel) { GATTBufferedNotificationHeader header = {}; gatt_client_subscriptions_get_notification_header(GAPLEClientKernel, &header); cl_assert_equal_i(header.value_length, assert_value_length); cl_assert_equal_i(header.characteristic, characteristic); if (should_consume) { uint16_t va...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(fb, &(GSize) {DISP_COLS, DISP_ROWS})
y = true, .task=PebbleTask_App } }; sys_send_pebble_event_to_kernel(&event); return; } // Check to see if handling the previous event requires us to rerender ourselves. if (prv_app_is_render_scheduled() && !*app_state_get_framebuffer_render_pending()) { prv_render_app(); } } static void prv_...
e->callback.callback(e->callback.data)
-416, -192}, { -1312, -128, -168}, { -1120, 208, 64}, { -1784, 2824, -1200}, { -408, 4000, -2128}, { 928, 3208, -608}, { 856, 1040, 432}, { 1216, 568, 176}, { 1400, -176, 0}, { 1312, -568, -64}, { 1216, 8, 88}, { 936, -272, 216}, { 1048, 48, -40}, { 2344, 4000, -1224}...
{ -448, 2232, -1512}, { -752, 1456, -800}, { -912, 768, -376}, { -768, -96, -40}, { -1280, -568, 368}, { -1112, -304, 168}, { -928, 176, 120}, { -1208, 1032, -280}, { -984, 4000, -1512}, { -256, 4000, -2200}, { 448, 1728, -800}, { 432, 576, 128}, // 61 seconds { 1...
{ -792, -56, -56}, { -712, 424, -8}, { -1568, 3376, -1216}, { -432, 4000, -1528}, { 304, 2872, -456}, { 456, 1200, 264}, { 1016, 672, 64}, { 1456, 88, -128}, { 1416, -272, 16}, { 1192, -400, 192}, { 864, -128, 104}, { 1112, 672, -544}, { 1440, 3944, -1232}, { 103...
/* * 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...
GRect(0, 0, DISP_COLS, DISP_ROWS)
; #else cl_assert(!memcmp(&framebuffer.dirty_rect, &expected_dirty, sizeof(GRect))); cl_assert(false); #endif cl_assert(framebuffer.is_dirty == true); }
CompositorTransitionDirectionRight, GColorWhite); } void test_graphics_window_stack_animation__right_flip_first_quarter_frame_clipping(void) { prv_test_clipping_mask(prv_right_flip_first_quarter_frame_...
graphics_private_move_pixels_horizontally(bitmap, -400, true)
; cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_left_filled"))); free(ctx); }
name; const uint8_t op_flags = OP_FLAG_READ | OP_FLAG_SKIP_HDR_CRC_CHECK | OP_FLAG_USE_PAGE_CACHE; const int fd = prv_file_open_by_name(name, op_flags); const uint32_t file_length = prv_file_common_get_length_and_close(fd); PBL_LOG(LOG_LEVEL_INFO, "File %s has length %"PRIu32, name, file_length); ...
(entry, op_flags)
, offset, data, num_bytes); } const ResourceStoreImplementation g_app_file_impl = { .type = ResourceStoreTypeAppFile, .init = resource_storage_generic_init, .clear = resource_storage_app_file_clear, .check = resource_storage_generic_check, .metadata_size = resource_storage_generic_metadata_size, .find_re...
nce_update_bitmap_next_frame(GBitmapSequence *bitmap_sequence, GBitmap *bitmap, uint32_t *delay_ms) { bool retval = false; uint8_t* buffer = NULL; // Disabled if play count is 0 and not the very first frame if (!bitmap_sequence || (bitmap_sequence->play_coun...
(upng, &fctl)
Down, &GPoint(13, 13), 6, 3686420); touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(13, 13), 40, 6, true); touch_handle_update(0, TouchState_FingerUp, &GPoint(18, 5), 0, 3686440); // Test th...
GPoint(13, 13)
, 3686420, 6, &GPoint(2, 2), 20, 0, true); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); cl_assert_equal_p(touch_event, NULL); } void test_touch__dispatch_touch_events_two_fingers(void) { TouchEventContext ctx = { .idx = 0 }; touch_dispatch_touch_events(0, prv_touch_...
apps like "Light // config" that we don't bother to declare a UUID for return false; } // FIXME: The sdkshell doesn't have a launcher menu so this causes a linker error. Maybe the // mapping of events to analytics should also be shell-specific? #ifndef SHELL_SDK // No need to log the launcher menu app...
prv_simple_pin_event(timestamp, parent_id, AnalyticsEvent_PinUpdated, "updated")
; } // ------------------------------------------------------------------------------------------ // Log a pin action event. void analytics_event_pin_action(time_t timestamp, const Uuid *parent_id, TimelineItemActionType action_type) { // Format the event specifc info in the blob. Th...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert_equal_i(snprintf(NULL, 0, "Hello!\nI am error"), 17); }
void test_sprintf__percent_d(void) { char dstbuf[256]; // Simple %d snprintf(dstbuf, 256, "There are %d lights, %d", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, -4"); // Alternate form snprintf(dstbuf, 256, "There are %#d lights, %#d", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, ...
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, inner_seq), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls,...
&list, NULL); pin_db_insert_item_without_event(item); timeline_item_destroy(item); attribute_list_destroy_list(&list); } static void prv_add_activity_session_pin(int32_t delta_time_s, int32_t duration_m) { const time_t now = rtc_get_time(); AttributeLis...
(4 * 60 * 60, 60, !is_all_day, recurring, 0, 0)
; prv_add_calendar_pin(6 * 60 * 60, 60, !is_all_day, recurring, 0, 0); prv_add_generic_pin(7 * 60 * 60, has_subtitle); prv_add_generic_pin(8 * 60 * 60, !has_subtitle); prv_add_weather_pin(1 * 24 * 60 * 60); prv_add_weather_pin(2 * 24 * 60 * 60); prv_add_weather_pin(3 * 24 * 60 * 60);...
icks); return s; } static void prv_timer_delay_1ms(void) { uint16_t start_ticks = prv_timer_get_ticks(); while (prv_timer_check_delta(start_ticks, TIMER0_1_MS)) {}; } static NORETURN prv_low_power_mode(void) { // Give the host a few seconds to reboot the chip before we attempt to power everthing off (If //...
{ return true; }
} } // Pulse the INT line to wake the host host_transport_set_mcu_int(true); prv_timer_delay_1ms(); // The timer IRQ just fired so the counter won't be near roll-over host_transport_set_mcu_int(false); } return false; } // Callback for SPI DMA complete static void prv_spi_dma_tx_cb(voi...
ored_data.type == BtPersistBondingTypeBLE && prv_is_pairing_info_equal_identity(&stored_data.ble_data.pairing_info, &itr_data->pairing_info)) { itr_data->key_out = key; return false; // stop iterating } return true; } static BTBondingID prv_get_key_for_sm_pai...
(data.ble_data.name, device_name, BT_DEVICE_NAME_BUFFER_SIZE)
; data.ble_data.name[BT_DEVICE_NAME_BUFFER_SIZE - 1] = '\0'; GapBondingFileSetStatus status; status = prv_file_set(&bonding, sizeof(bonding), &data, sizeof(data)); // If this is the gateway, update SPRF so our pairing info betwen PRF and normal // FW is in sync if (data.ble_data.is_gateway && (status == G...
trics for the new day prv_shift_history(utc_sec); } // Update the derived metrics prv_update_real_time_derived_metrics(); prv_update_step_derived_metrics(utc_sec); prv_update_hr_derived_metrics(); } // -------------------------------------------------------------------------------------------- Activity...
if (hrm_event->bpm.bpm > 0) { // This should get reset about once a minute, so X minutes worth of samples means something // is terribly wrong. PBL_ASSERT(state->hr.num_samples <= ACTIVITY_MAX_HR_SAMPLES, "Too many samples"); state->hr.samples[state->hr.num_samples] = hrm_event->bpm.bpm; s...
// Update the timestamp used for figuring out when we should change the sampling period. // This is based on uptime so that it doesn't get messed up if the mobile changes the // UTC time on us. state->hr.last_sample_ts = now_uptime; // Save the BPM, quality, and update time (UTC) of the last readi...
r_le_conn(hdl); unlock: bt_unlock(); } static void prv_bt_le_gateway_response_latency_watchdog_cb(void *data) { // offload handling onto KernelBG so we don't stall the timer thread // trying to get the bt lock system_task_add_callback(prv_bt_le_gateway_response_latency_watchdog_handler, data); } static bool ...
(curr_request, NULL, NULL)
; kernel_free(curr_request); curr_request = temp; } kernel_free(*info); *info = NULL; } void command_change_le_mode(char *mode) { // assume we only have one connection for debug GAPLEConnection *conn_hdl = gap_le_connection_any(); ResponseTimeState state = atoi(mode); conn_mgr_set_ble_conn_resp...
CONDS_PER_HOUR) - 2); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Wed, 2:00 PM", time_buf); // June 9th 2015, 23:59:59 (T-14:00:01) rtc_set_time(event_time - (14 * SECONDS_PER_HOUR) - 1); clock_get_until_time_capitalized(time_buf, sizeof(tim...
rtc_set_time(jun10th_noon_2015)
static void prv_dismiss_fully_charged(void); // TODO PBL-39883: Replace w/ QUIRK_RESET_ON_SHUTDOWN_WHILE_CHARGING once arbitrary prefixes land #if PLATFORM_TINTIN || PLATFORM_SILK static void prv_shutdown(void *ignored); #else static void prv_enter_shutdown_charging(void *ignored); #endif static const BatteryUIState u...
{ vibes_short_pulse(); }
_file_get(&file_new, key, key_len, val_out, val_len_out)); if (val_len_out == original_value_length) { printf("original! %d\n", original_value_length); cl_assert_equal_m(original_value, val_out, val_len_out); free(val_out); return RecordResultOld; } else if (val_len_out == new_value_len...
for (int i = 0; i < 255; i++) { cl_assert_equal_i(counts[i], 1); }
task_free(counts); } static const uint8_t STOPPING_NUM = 117; static bool prv_each_cb_quit_early(SettingsFile *file, SettingsRecordInfo *info, void *context) { uint8_t *key = malloc(info->key_len + 1); uint8_t *val = malloc(info->val_len + 1); info->get_key(file, key, info->key_len); ...
/* * 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 launcher_app_glance_structured_create_subtitle_text_node( structured_glance, prv_workout_glance_subtitle_dynamic_text_node_update); }
static void prv_destructor(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceWorkout *workout_glance = launcher_app_glance_structured_get_data(structured_glance); if (workout_glance) { kino_reel_destroy(workout_glance->icon); app_timer_cancel(workout_glance->timer); } app_free(w...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uint8_t data[4] = {0, 0, 0, 0}; crc = crc32(crc, data, 4); assert_equal_hex(crc, CRC32_RESIDUE); }
SIZE when non-buffered const int item_size = 2 * DLS_SESSION_MAX_BUFFERED_ITEM_SIZE; // Create sessions for (int i = 0; i < 10; i++) { logging_sessions[i] = (DataLoggingSessionRef)dls_create(i, DATA_LOGGING_BYTE_ARRAY, item_size, false /*buffered*/, false /*resume*/, &system_uuid...
(LOG_LEVEL_INFO, "total bytes: %d", total_bytes)
s 0 - * Armenia gave this up in 2012 Mar 28th 2015 22:00 UTC ~ Oct 24th 2015 22:00 UTC, GMT+4 */ [28]={ 0, 0, 4 * SECONDS_PER_HOUR }, /* Syria (Syria) [Asia/Damascus] Rule Syria 2012 max - Mar lastFri 0:00 1:00 S Rule Syria 2009 max - Oct lastFri 0:00 0 ...
time_util_update_timezone(&tz_info)
; prv_set_current_time(jan_1); cl_assert_equal_i(clock_to_timestamp(MONDAY, 17, 30), mktime(&jan_6)); } void test_clock__clock_to_timestamp(void) { s_prefs_24h_style = false; fake_rtc_init(0, 0); rtc_timezone_clear(); static const time_t jan1st_noon_2005 = 1104580800; static const int32_t min_gmtoff = -...
back_rate_percent(), 0); } void test_ams__receive_player_volume_update(void) { prv_connect_ams(); // Receive volume of 0.604925 // 00 02 00 30 2e 36 30 34 39 32 35 ...0.604 925 uint8_t volume_update[] = { 0x00, 0x02, 0x00, 0x30, 0x2e, 0x36, 0x30, 0x34, 0x39, 0x32, 0x35, }; prv_re...
cl_assert_equal_s(album, "Kind Of Blue (Legacy Edition)")
; } // Tests: Music service capabilities /////////////////////////////////////////////////////////// void test_ams__supported_capabilities(void) { prv_connect_ams(); // music_is_progress_reporting_supported() relies on a valid track duration uint8_t track_duration_update[] = { 0x02, 0x03, 0x00, 0x33, 0x31,...
/* * 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 (FLASH_ProgramByte((uint32_t)&field[i], value[i]) != FLASH_COMPLETE) { failed = true; } }
// Lock the OTP sector if (FLASH_ProgramByte((uint32_t)lock, 0) != FLASH_COMPLETE) { failed = true; } FLASH_Lock(); if(failed) { return OtpWriteFailCorrupt; } else { return OtpWriteSuccess; } }
= session->data->buffer_storage } }; PebbleTask task = pebble_task_get_current(); process_manager_send_event_to_process(task, &e); } } // --------------------------------------------------------------------------------------- // Unlock a session previous locked by dls_lock_session(). If inactive ...
{ mutex_lock_recursive(s_list_mutex); DataLoggingSession **iter = &s_logging_sessions; for (int i = 0; i < logging_session->comm.session_id; i++) { if (*iter == NULL) { break; } PBL_ASSERTN(logging_session->comm.session_id != (*iter)->comm.session_id); if ((*iter)->comm.session_id > logging...
// The newlib headers do not expose this because of the __STRICT_ANSI__ define extern int rand_r(unsigned *seed); uint8_t dls_list_add_new_session(DataLoggingSession *logging_session) { // generate random ID int loops = 0; uint8_t session_id; unsigned seed = rtc_get_time() ^ (uintptr_t)&session_id; do { ...
/* * 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...
{ node->event.callback.callback(node->event.callback.data); }
(void* data) { display_pulse_vcom(); } static void register_system_timers(void) { static RegularTimerInfo watchdog_timer = { .list_node = { 0, 0 }, .cb = watchdog_timer_callback }; regular_timer_add_seconds_callback(&watchdog_timer); if (BOARD_CONFIG.lcd_com.gpio != 0) { static RegularTimerInfo vcom_timer...
mfg_write_bigboard_serial_number()
; #endif #if defined(MANUFACTURING_FW) mfg_info_update_constant_data(); #endif debug_init(s_mcu_reboot_reason); services_early_init(); debug_print_last_launched_app(); // Do this early before things can screw ith it. check_prf_update(); // When there are new system resources waiting to be installed,...
ntLeft, fonts_get_system_font(config->music_time_font_key)); layer_add_child(&data->window.layer, &data->position_text_layer.layer); prv_configure_music_text_layer(&data->length_text_layer, data->length_buffer, &time_rect, TIME_BOUNDS_OFFSET, GTextA...
(data, event->media.playback_state)
ntainer) { const int indicator_height = fonts_get_font_height(aml->layout_cache.font); const int text_height = aml->layout_cache.item_heights[aml->selected_index]; const int content_height = MIN(label_text_container->size.h, text_height + indicator_height); GRect content_frame = (GRect) { .size = GSize(lab...
graphics_draw_bitmap_in_rect(ctx, &aml->item_animation.fade_bottom, &bottom_bounds)
; } #endif } static void prv_draw_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callback_context) { ActionMenuLayer *aml = callback_context; if (cell_index->row < aml->num_items) { const ActionMenuItem *item = prv_get_item_for_index(aml, cell_index->row); ...
e deleted. This is an extremely small window, but // could be resolved by checking on reboot to see if both versions exist. // If both exist, the orig is valid. Iff tmp exists, the tmp file is valid update_curr_state(f->start_page, TMP_STATE_OFFSET, TMP_STATE_DONE); f->is_tmp = false; } // Note: We...
(s_pfs_mutex)
; return (PFSFileListEntry *)head; } void pfs_delete_file_list(PFSFileListEntry *head) { ListNode *node = (ListNode *)head; ListNode *next; while (node) { next = node->next; kernel_free(node); node = next; } } // PBL-19098 Refactor this to share code with pfs_create_file_list void pfs_remove_fil...
the s_kernel_event_queue queue before it's activated so likely, the activated queue was // s_kernel_event_queue. if (!result) { return false; } } s_current_event = prv_get_fancy_type_from_event(event); return true; } void **event_get_buffer(PebbleEvent *event) { switch (event->type) { ...
for (int i = 0; i < num_client_task_events_enqueued; ++i) { xQueueSend(s_system_event_queue_set, &preserve_queue, 0); }
} QueueHandle_t event_kernel_to_kernel_event_queue(void) { return s_from_kernel_event_queue; } BaseType_t event_queue_cleanup_and_reset(QueueHandle_t queue) { int num_events_in_queue = uxQueueMessagesWaiting(queue); PebbleEvent event; for (int i = 0; i < num_events_in_queue; ++i) { PBL_ASSERTN(xQueueRec...
uffer(buffer, samples_per_update * sizeof(AccelRawData)); } mutex_lock_recursive(s_accel_manager_mutex); { state->raw_buffer = buffer; state->samples_per_update = samples_per_update; state->num_samples = 0; prv_update_driver_config(); } mutex_unlock_recursive(s_accel_manager_mutex); return...
(&s_buffer, (uint8_t *)&accel_buffer_data, sizeof(accel_buffer_data), false /*advance_slackers*/)
; if (!rv) { PBL_LOG(LOG_LEVEL_WARNING, "Accel subscriber fell behind, truncating data"); rv = shared_circular_buffer_write(&s_buffer, (uint8_t *)&accel_buffer_data, sizeof(accel_buffer_data), true /*advance_slackers*/); } PBL_ASSERTN(rv); prv_dispatch_data(); } ...
; * 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 License is distributed on an "AS IS" BASIS, * WITHOUT ...
("major", VERSION_MAJOR)
; EXECUTE_SCRIPT("var minor = _rocky.watchInfo.firmware.minor"); ASSERT_JS_GLOBAL_EQUALS_I("minor", VERSION_MINOR); EXECUTE_SCRIPT("var patch = _rocky.watchInfo.firmware.patch"); ASSERT_JS_GLOBAL_EQUALS_I("patch", VERSION_PATCH); EXECUTE_SCRIPT("var suffix = _rocky.watchInfo.firmware.suffix"); ASSERT_JS_...
/* * 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; }
const char* album_ptr; size_t album_length; read_iter = prv_read_ptr_and_length_from_buffer(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_l...
_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); // 2 pins should be added (for Thursday / Friday) cl_assert_equal_i(s_num_timeline_adds, 2); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minu...
cl_assert_equal_i(s_num_alarm_events_put, 1)
; cl_assert_equal_i(s_num_timeline_adds, 4); cl_assert_equal_i(s_num_timeline_removes, 2); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. No alarms should be up s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal...
/* * 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...
(__noreturn__)
) void Reset_Handler(void) { // Disable all interrupts __asm__("cpsid i" : : : "memory"); volatile uint32_t *flash_sr = (volatile uint32_t *)FLASH_SR_ADDR; volatile p_size_t *data = (volatile p_size_t *)DATA_ADDR; volatile Header *header = (volatile Header *)HEADER_ADDR; header->state = STATE_WAITING; w...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_unlock()
; return connection; } Connection *connection_by_idx_check(uint16_t conn_idx) { Connection *connection; prv_lock(); { connection = connection_by_idx(conn_idx); PBL_ASSERTN(connection); } prv_unlock(); return connection; } static bool prv_connection_by_address_list_filter_cb(ListNode *found_node,...
rt_no_event(); } void test_gatt_client_subscriptions__subscribe_unsupported_subscription_type(void) { BTErrno e; BLECharacteristic characteristic = prv_get_indicatable_characteristic(); fake_kernel_malloc_mark(); // Try to subscribe for notifications to the indicatable (but not notify-able) characteristic: ...
gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionNone, GAPLEClientKernel)
; cl_assert_equal_i(e, BTErrnoInvalidState); fake_kernel_malloc_mark_assert_equal(); prv_assert_no_event(); } void test_gatt_client_subscriptions__unsubscribe_not_subscribed_but_other_client_is(void) { BTErrno e; BLECharacteristic characteristic = prv_get_indicatable_characteristic(); e = gatt_client_subsc...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (uint32_t i = 0; i < data->count; i++) { SerializedAnalytic analytic = data->analytics[i]; const AnalyticsMetric metric = prv_get_fw_metric(analytic.metric); if (metric != ANALYTICS_METRIC_INVALID) { analytics_set(metric, analytic.value, AnalyticsClient_System); } }
kernel_free(msg); } bool hc_endpoint_analytics_get_conn_event_stats(SlaveConnEventStats *stats) { HcProtocolMessage *msg = hc_protocol_enqueue_with_payload_and_expect( HcEndpointID_Analytics, HcMessageID_Analytics_GetConnEventStats, NULL, 0); if (!msg) { // Should be a basic log for timed out e...
rigin); } offset = gpoint_add(offset, rect.origin); KinoReel *reel = prv_get_current_reel(data); GDrawCommandList *source_list = kino_reel_get_gdraw_command_list(reel); prv_draw_reel_or_command_list_processed(ctx, reel, source_list, offset, processor); } static void prv_draw_processed_func(KinoReel *reel, GC...
{ return data->from; }
return GRectZero; } GRect kino_reel_transform_get_to_frame(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data) { return data->to; } return GRectZero; } void kino_reel_transform_set_global(KinoReel *reel, bool global) { KinoReelTransformData *data = kino_reel_cus...
/* * 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...
(timer_id)
; } static uint32_t standby_timer_get_timeout() { 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)); return stub_new_timer_timeout(timer_id); } void enter_standby(RebootReasonCode reason) { s_entered_standby ...
er_block(I2C_MAG3110, reg_addr, 1, &data); } static void mag3110_interrupt_handler(bool *should_context_switch) { if (s_use_refcount == 0) { // Spurious interrupt firing after we've already turned off the mag. Just ignore. return; } // TODO: May want to use a timer, lowers worst case latency PebbleEve...
{ mutex_lock(s_mag_mutex); if (s_use_refcount == 0) { mutex_unlock(s_mag_mutex); return (MagReadMagOff); } MagReadStatus rv = MagReadSuccess; uint8_t raw_data[7]; // DR_STATUS_REG is immediately before data registers if (!mag3110_read(DR_STATUS_REG, sizeof(raw_data), raw_data)) { rv = MagRe...
bool mag_change_sample_rate(MagSampleRate rate) { mutex_lock(s_mag_mutex); if (s_use_refcount == 0) { mutex_unlock(s_mag_mutex); return (true); } bool success = false; // Enter standby state since we can only change sample rate in this mode. if (!prv_enter_standby_mode()) { goto done; } ...
che 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 License is dist...
clock_get_friendly_date(buffer, config->buffer_size, layout->info->timestamp)
; } } static GTextNode *prv_card_view_constructor(TimelineLayout *timeline_layout) { static const LayoutNodeTextDynamicConfig s_title_config = { .text.extent.node.type = LayoutNodeType_TextDynamic, .update = prv_title_update, .buffer_size = WEATHER_CARD_TITLE_LENGTH, .text.style = LayoutContentSize...
(min_buf, sizeof(min_buf), ".%d", min_offset_percent); } snprintf(region_name, buffer_size, "UTC%+d%s", hour_offset, min_buf); } } else { strncpy(region_name, "---", buffer_size); } } int16_t clock_get_timezone_region_id(void) { return rtc_get_timezone_id(); } void clock_set_timezone_by_regi...
("%b %e, %l:%M %p")
; } else { time_fmt = i18n_noop("%B %e"); } break; case FullStyleLower24h: case FullStyleCapital24h: if (with_fulltime) { time_fmt = i18n_noop("%b %e, %R"); } else { time_fmt = i18n_noop("%B %e"); } break; } } else {...
(init_info->config)
; ble_error_t e = ble_enable(); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_enable: %u", e); } PBL_LOG(LOG_LEVEL_DEBUG, "go go go"); ble_register_app(); advert_init(); local_addr_init(); // Do all the things that clear the ATT table before registering the local services: prv_config...
/* * 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...
{ case ProtobufLogActivityType_UnknownType: return ActivitySessionType_None; case ProtobufLogActivityType_Sleep: return ActivitySessionType_Sleep; case ProtobufLogActivityType_DeepSleep: return ActivitySessionType_RestfulSleep; case ProtobufLogActivityType_Nap: return ActivitySes...
WTF; } // ----------------------------------------------------------------------------------------- // Convert ActivitySessionType to the internal protobuf representation. static ProtobufLogActivityType prv_activity_type_to_proto_type(ActivitySessionType type) { switch (type) { case ActivitySessionType_None: ...
/* * 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...
storage->impl->read_next_chunk(storage, buffer, len)
; } return false; } void gb_storage_cleanup(GetBytesStorage *storage, bool successful) { if (storage->impl->setup) { storage->impl->cleanup(storage, successful); } }
< FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 5); test_num = (int32_t)((float)-0.250 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 6)...
cl_assert_equal_i(2, Fixed_S16_3_rounded_int(Fixed_S16_3(12)))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (cur_worker_id == INSTALL_ID_INVALID) { // If there is no worker running, we can simply launch the new one without confirming worker_manager_put_launch_worker_event(new_worker_id); return; } else if (cur_worker_id == new_worker_id) { // Or if the new one is already running, then there is nothing to...
AppInstallEntry old_entry; if (!app_install_get_entry_for_install_id(cur_worker_id, &old_entry)) { return; } AppInstallEntry new_entry; if (!app_install_get_entry_for_install_id(new_worker_id, &new_entry)) { return; } s_is_on_screen = true; ConfirmationDialog *confirmation_dialog = confirma...
cl_assert_equal_i(value, ROUND(k_bmr_cal * k_minute_start / MINUTES_PER_DAY, ACTIVITY_CALORIES_PER_KCAL)); cl_assert_equal_i(health_service_sum_today(HealthMetricRestingKCalories), value); // Feed in 100 steps/minute over 1 hour (walking rate) prv_feed_cannned_accel_data(SECON...
(value, exp_active_kcalories_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...
(test2, 5, 2, 1, 1)
== 1); cl_assert(raw_image_get_value_for_bitdepth(test2, 6, 2, 1, 1) == 0); cl_assert(raw_image_get_value_for_bitdepth(test2, 5, 0, 2, 2) == 3); cl_assert(raw_image_get_value_for_bitdepth(test2, 5, 0, 2, 2) == 3); cl_assert(raw_image_get_value_for_bitdepth(test2, 1, 1, 2, 8) == 3); cl_assert(raw_image_get_va...
x10, 0x00, 0x00, 0x00, 0x32, 0x8e, 0x0f, 0xbb, 0xc6, 0x42, 0x1a, 0xa6, 0x69, 0x9b, 0xda, 0xda, // Discovery Generation 0x00, // RSVD 0x00, // Size Bytes 0x51, 0x00, // Att Handle EMULATED_PPOGATT_SERVICE_HANDLE_LSB, EMULATED_PPOGATT_SERVICE_HANDLE_MSB, // Num characteristics 0x02, // Num Descripto...
{ PBL_LOG(LOG_LEVEL_DEBUG, "WOAH"); kernel_free(state->pending_response_data); }
const uint32_t alloc_size = sizeof(HcGattWriteRespData); state->pending_data_size = alloc_size; HcGattWriteRespData *data = kernel_zalloc_check(alloc_size); *data = (HcGattWriteRespData) { .status = BLEGATTErrorSuccess, .hdr.addr = hdr->addr, .att_handle = att_hdl, .context_ref = ((HcGattReadDa...
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 License is distributed on an "AS IS" BASIS, *...
(exti_line)
; prv_unlock(); } void exti_disable_other(ExtiLineOther exti_line) { prv_lock(); uint32_t exti_bit = prv_exti_line_to_bit(exti_line); EXTI->IMR &= ~exti_bit; EXTI->PR = exti_bit; // No need to disable the NVIC ISR. If all the EXTIs that feed a given shared ISR are disabled // the ISR won't fire. p...
cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorLightGray, 1), 0xAAAAAAAA)
; cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorDarkGray, 0), 0x55555555); cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorDarkGray, 1), 0xAAAAAAAA); cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorBlack, 0), 0x00000000); cl_assert_equal_i(graphics_p...
{ 672, -48, 112}, { 648, -112, 96}, { 784, 0, -96}, { 960, -16, -104}, { 1440, -232, 120}, { 1632, 0, 240}, { 1472, 368, 0}, // 55 seconds { 1576, 472, -112}, { 1384, 352, 232}, { 1120, 176, 320}, { 1104, 216, 232}, { 1048, 264, 200}, { 944, 376, 80}, { 848, 432, ...
{ 1200, 0, 40}, { 1712, -216, 320}, { 1792, 88, 360}, { 1352, 848, -120}, { 920, 432, 144}, { 952, 160, 280}, { 944, 176, 288}, { 856, 80, 312}, { 816, 256, 224}, { 760, 312, 152}, { 736, 304, 112}, { 840, 320, 80}, { 968, 360, 0}, { 1184, 288, 56}, // 61 seco...
{ 1680, 248, 48}, { 1728, 368, 40}, { 1088, 296, 96}, { 1120, 192, 32}, { 1328, 136, 152}, { 1280, 112, 192}, { 1104, 48, 200}, { 960, 16, 176}, { 888, -24, 160}, { 832, 0, 88}, { 800, 32, 72}, { 784, -64, 96}, { 768, -136, 16}, { 832, -80, -112}, { 1256, -26...
/* * 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...
qspi_indirect_write_no_addr_1line(dev->qspi, dev->state->part->instructions.enter_quad_mode)
ve->slave_state->scs_selected); uint8_t *cptr = in; while (len--) { *(cptr++) = spi_ll_slave_read_write(slave, 0); // useless write-data } } void spi_ll_slave_burst_write(const SPISlavePort *slave, const void *out, size_t len) { PBL_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state...
(slave->spi_bus, SpiI2sDma_ReqTx, true)
; dma_request_start_direct(slave->tx_dma, (void *)&slave->spi_bus->spi->DR, out, len, prv_dma_irq_handler, (void *)slave); } void spi_ll_slave_write_dma_stop(const SPISlavePort *slave) { if (slave->slave_state->dma_state != SPISlavePortDMAState_Write) { return; } dma_request_stop...
static SessionState s_state = SessionState_Idle; static PebbleMutex* s_lock = NULL; // Handle requests from apps static bool s_from_app; static Uuid s_app_uuid; static AudioEndpointSessionId s_session_id = AUDIO_ENDPOINT_SESSION_INVALID_ID; static TimerID s_timeout = TIMER_INVALID_ID; static void prv_send_event(Voi...
PBL_LOG(LOG_LEVEL_WARNING, "Received audio transfer message when no session was in progress (" "%d)", session_id)
; return; } mutex_lock(s_lock); prv_handle_subsystem_started(SessionState_AudioEndpointSetupReceived); mutex_unlock(s_lock); } static void prv_session_result_timeout(void * data) { mutex_lock(s_lock); PBL_ASSERTN(s_state == SessionState_WaitForSessionResult); prv_reset(); PBL_LOG(LOG_LEVEL_WARNI...
}, { -128, 168, 1424}, { -344, 176, 1856}, { -528, 296, 1928}, { -336, 216, 1480}, { -304, 288, 1152}, { -264, 160, 1128}, { -248, 192, 1064}, { -160, 224, 800}, { -88, 264, 528}, // 105 seconds { -64, 248, 464}, { -32, 216, 576}, { 48, 256, 592}, { 16, 368, 744},...
{ 184, 48, 1088}, { 184, 64, 1088}, { 176, 72, 1072}, { 272, 64, 920}, { 216, 80, 1024}, { 192, 192, 928}, { 192, -48, 1048}, { 160, 24, 1088}, { 192, -64, 1072}, { 184, -80, 1080}, { 200, -136, 1024}, { 176, -48, 1000}, { 168, 24, 960}, { 152, -128, 1008}, { ...
bTerm advert_terms[] = { { .min_interval_slots = 160, .max_interval_slots = 240, .duration_secs = 1, }, { .min_interval_slots = 320, .max_interval_slots = 480, .duration_secs = 1, }, { .min_interval_slots = GAPLE_ADVERTISING_SILENCE_INTERVAL_SLOTS, ....
(s_unscheduled_cb_count, 1)
5_INT_EN_1_FIFO_WATERMARK; } bma255_write_register(BMA255Register_INT_MAP_1, map_value); bma255_write_register(BMA255Register_INT_EN_1, en_value); prv_update_accel_interrupts(enable_int, AccelOperatingMode_Data); } void accel_set_num_samples(uint32_t num_samples) { // Disable interrupts so they won't fire ...
(BMA255Register_INT_6, BOARD_CONFIG_ACCEL.accel_config.shake_thresholds[AccelThresholdHigh])
; } } bool accel_get_shake_detection_enabled(void) { return s_shake_detection_enabled; } //////////////////////////////////////////////////////////////////////////////// // Selftest Support //////////////////////////////////////////////////////////////////////////////// static void prv_soft_reset(void) { bma25...
/* * 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...
(effective_interval, false)
; prv_update_conn_params(params->slave_latency_events, params->supervision_timeout_10ms); } void bluetooth_analytics_handle_connection_disconnection_event( AnalyticsEvent type, uint8_t reason, const BleRemoteVersionInfo *vers_info) { static uint32_t last_reset_counter_ticks = 0; static uint8_t num_events_log...
ypedef struct I2cTransfer { uint8_t device_address; bool read_not_write; //True for read, false for write uint8_t register_address; uint8_t size; uint8_t idx; uint8_t *data; enum TransferState { TRANSFER_STATE_WRITE_ADDRESS_TX, TRANSFER_STATE_WRITE_REG_ADDRESS, TRANSFER_STATE_REPEAT_...
GPIO_WriteBit(pin_config.gpio, pin_config.gpio_pin, (pin_state) ? Bit_SET : Bit_RESET)
; gpio_release(pin_config.gpio); } //! Power down I2C bus power supply //! Always lock bus and peripheral config access before use static void bus_rail_power_down(uint8_t bus_idx) { if (BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_fn == NULL) { return; } BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_f...
tems[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id)); cl_assert(state.node->all_day); // check that the item we see is timestamped at local midnight rather than utc midnight // 1421136000 is midnight Jan 13, PST cl_assert_equal_i(state.pin.header.timestamp, 1421136000); ...
cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[0].header.id))
; cl_assert(!iter_next(&iterator)); } static void prv_insert_extra_case_items(void) { pin_db_flush(); for (int i = 0; i < ARRAY_LENGTH(s_extra_case_items); i++) { cl_assert_equal_i(pin_db_insert_item(&s_extra_case_items[i]), 0); } } // 5am, no events passed void test_timeline__extra_case_forwards(void) {...
32, -696}, { -576, -216, -720}, { -536, -216, -728}, { -576, -232, -704}, { -600, -240, -760}, { -592, -224, -736}, { -592, -224, -728}, { -616, -272, -752}, { -600, -256, -736}, { -632, -224, -712}, { -640, -248, -728}, { -624, -160, -704}, { -664, -176, -752}, { -54...
ARRAY_LENGTH(samples)