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...
{ PBL_ASSERT_TASK(PebbleTask_App); AppMenuOrderStorage *storage = NULL; bool delete_file = false; mutex_lock(s_data.order_mutex); int fd; if ((fd = pfs_open(ORDER_FILE, OP_FLAG_READ, 0, 0)) < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Could not open app menu order file"); mutex_unlock(s_data.order_mutex); ...
pfs_close(fd); if (delete_file) { pfs_remove(ORDER_FILE); } mutex_unlock(s_data.order_mutex); return storage; } //! Should be called on system task. static void prv_app_order_write_order(AppMenuOrderStorage *storage) { mutex_lock(s_data.order_mutex); int storage_size = sizeof(AppMenuOrderStorage) ...
graphics_context_set_fill_color(ctx, GColorBlack); gpath_draw_filled(ctx, s_current_path); } } 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_...
(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH, SCREEN_HEIGHT)
them. Note: further to the bug in PBL-34010, this function will // remove any resource files that are not related to apps currently in the cache. static void prv_purge_orphaned_resource_files(void) { // create a list of all app resource files in the filesystem PFSFileListEntry *resource_files = pfs_create_file_li...
{ return true; // continue iterating }
uint32_t *cache_size = (uint32_t *)context; AppCacheEntry entry; info->get_val(file, (uint8_t *)&entry, info->val_len); *cache_size += entry.total_size; return true; // continue iterating } uint32_t app_cache_get_size(void) { uint32_t cache_size = 0; mutex_lock_recursive(s_app_cache_mutex); { Se...
s->filter, this->rcc_apb_periph); periph_config_release_lock(); } static void prv_disable_clocks(MicDevice *this) { // Disable DFSDM clock periph_config_acquire_lock(); periph_config_disable(this->filter, this->rcc_apb_periph); periph_config_release_lock(); } //! Configure GPIOs for DFSDM use static void pr...
(this->channel, ENABLE)
/* * 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...
{ *reg = addr; addr += line_size; op_size -= line_size; }
__DSB(); __ISB(); } #endif #if __DCACHE_PRESENT static void prv_dcache_operation_all(volatile uint32_t *reg) { uint32_t ccsidr; uint32_t sets; uint32_t ways; ccsidr = s_dcache_cssidr; sets = CCSIDR_SETS(ccsidr); do { ways = CCSIDR_WAYS(ccsidr); do { *reg = (((sets << SCB_DCISW_SET_Pos...
/* * 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_uint32(list, AttributeIdIconSmall, card_res ?: timeline_res)
; attribute_list_add_uint32(list, AttributeIdIconLarge, card_res ?: timeline_res); } #define ARRAY_RAND(arr) arr[rand() % ARRAY_LENGTH(arr)] static void prv_add_notification(int32_t delta_time_s) { const time_t now = rtc_get_time(); AttributeList list = {}; TimelineResourceId icon_resources[] = { TIME...
n */); periph_config_disable(PWR, RCC_APB1Periph_PWR); vTaskStartScheduler(); for(;;); } static void watchdog_timer_callback(void* data) { task_watchdog_bit_set(PebbleTask_NewTimers); } static void vcom_timer_callback(void* data) { display_pulse_vcom(); } static void register_system_timers(void) { stati...
task_watchdog_init()
; analytics_init(); register_system_timers(); system_task_timer_init(); init_drivers(); #if defined(IS_BIGBOARD) // Program a random S/N into the Bigboard in case it's not been done yet: mfg_write_bigboard_serial_number(); #endif #if defined(MANUFACTURING_FW) mfg_info_update_constant_data(); #endif ...
awake long enough: %"PRId32, sleep_state_seconds); return; } // All criteria have been met, show reward prv_push_reward(now_utc, &SLEEP_REWARD_NOTIF_CONFIG); } // ----------------------------------------------------------------------------------------- // Format a time given in second...
health_util_format_hours_and_minutes(elapsed, max_attr_length, duration_s, &pin_attr_list)
if (!grect_equal(&box, &layout->box)) { return false; } if (overflow_mode != layout->overflow_mode) { return false; } if (alignment != layout->alignment) { return false; } if (font != layout->font) { return false; } return true; } static inline void prv_text_walk_lines(GContext* ctx...
{ APP_TEXT_GET_CONTENT_SIZE(text, font, box, overflow_mode, alignment, NULL); }
uint16_t graphics_text_layout_get_text_height(GContext *ctx, const char *text, GFont const font, uint16_t bounds_width, const GTextOverflowMode overflow_mode, const GTextAlignment ...
key_len)) { return file->iter.hdr.val_len; } else { return 0; } } bool settings_file_exists(SettingsFile *file, const void *key, size_t key_len) { return (settings_file_get_len(file, key, key_len) > 0); } status_t settings_file_get(SettingsFile *file, const void *key, size_t key_len, ...
(&file->iter, overwritten_record)
; set_flag(&file->iter.hdr, SETTINGS_FLAG_OVERWRITE_COMPLETE); settings_raw_iter_write_header(&file->iter, &file->iter.hdr); file->dead_space += record_size(&file->iter.hdr); file->used_space -= record_size(&file->iter.hdr); } return S_SUCCESS; } status_t settings_file_mark_synced(SettingsFile *fi...
(" -Q \t\tQuit as soon as a test fails\n")
; printf(" -l \t\tPrint suite, category, and test names\n"); printf(" -tXX\t\tRun a specifc test by name\n"); exit(-1); } static void clar_parse_args(int argc, char **argv) { int i; for (i = 1; i < argc; ++i) { char *argument = argv[i]; if (argument[0] != '-') clar_usage(argv[0]); swi...
continuing to use the device. // It takes 2.6ms for the LDO rails to ramp. psleep(3); return true; } return false; } } else { if (*ref_count <= 1) { // Set the register byte to XXXXX00X to disable the rail, just mask register_value = (register_value & ~0x06); ...
(PmicRegisters_BUCK1_VSET, buck1_vset)
; } static void prv_clear_any_pending_interrupts(void) { // Read the Int status registers to clear any pending bits. // An interrupt wont fire if the matching bit is already set. uint8_t throwaway_read_result; prv_read_register(PmicRegisters_INTA, &throwaway_read_result); prv_read_register(PmicRegisters_INTB...
/* * 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, grect_inset(DISP_FRAME, GEdgeInsets(-overdraw)), GOvalScaleModeFitCircle, thickness + overdraw, 0, TRIG_MAX_ANGLE)
; } // piecewise interpolator between 0 and to for the first half of ANIMATION_NORMALIZED_MAX // and between -to and 0 for the second half static int16_t prv_interpolate_two_ways_int16(AnimationProgress normalized_progress, int32_t discontinuity_progress, int16_t to) { i...
hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1, expire_s, HRMFeature_BPM, prv_fake_hrm_1_cb, NULL); fake_system_task_callbacks_invoke_pending(); HRMSessionRef session_ref_2 ...
(&cb, (const uint8_t *)&event[i], sizeof(PebbleHRMEvent))
CYCLE_FULL; static bool s_initialized = false; void vibe_init(void) { if (s_initialized) { return; } periph_config_acquire_lock(); if (BOARD_CONFIG_VIBE.options & ActuatorOptions_Ctl) { gpio_output_init(&BOARD_CONFIG_VIBE.ctl, GPIO_OType_PP, GPIO_Speed_2MHz); gpio_output_set(&BOARD_CONFIG_VIBE.ct...
if (out_of_bounds || not_a_number) { prompt_send_response("Invalid argument"); return; }
vibe_set_strength(strength); const bool turn_on = strength != 0; vibe_ctl(turn_on); prompt_send_response("OK"); }
atic bool prv_bootrom_wait_for_char(char *char_received) { const uint32_t wait_time_ticks = (DIALOG_BOOTROM_DEFAULT_CHAR_TIMEOUT_MS * RTC_TICKS_HZ) / 1000; return prv_bootrom_wait_for_char_with_timeout(char_received, wait_time_ticks); } static bool prv_download_patch_from_system_resources(uint16_t bootloader_size)...
(LOG_LEVEL_ERROR, "Failed to send header")
; success = false; goto cleanup; } // Transmit SW code bytes, check received CRC, and ack if correct if (!prv_download_patch_from_system_resources(bootloader_size)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to load second stage BLE bootloader"); success = false; goto cleanup; } cleanup: // We h...
ound_down(void) { // "0.74995" * 2 is approx 1.4999, round down to 1 assert_float_parse("0.74995", 2, true, 1); } void test_ams_util__float_string_parse_multiple_separators(void) { // "1.2.2" * 3 assert_float_parse("1.2.2", 2, false, 0); } void test_ams_util__float_string_positive_multiplier(void) { // "1.6...
ams_util_csv_parse(one_value, sizeof(one_value) - 1 /* omit zero teminator */, NULL, prv_result_callback)
; cl_assert_equal_i(s_results_count, 1); cl_assert_equal_i(count, 1); assert_result(0, "ABCDEF", 6); }
{ const char *title = arg1; const char *subtitle = arg2; const bool highlight = menu_cell_layer_is_highlighted(cell_layer); GBitmap *mark = &cd->fcc_mark; #if PBL_RECT menu_cell_basic_draw(ctx, cell_layer, title, subtitle, NULL); // FCC has a mark in the top right of its cell const GPoint mark_origin = GP...
{ if (cd->num_regulatory_marks_in_current_cell) { prv_append_certification_menu(cd, &(SystemCertificationMenuItem) { .draw_cell_fn = prv_draw_regulatory_marks_cell, .arg1 = (void *)(uintptr_t)cd->current_regulatory_marks_cell_start_idx, .arg2 = (void *)(uintptr_t)cd->num_regulatory_marks_i...
static void prv_draw_regulatory_id_cell( GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd, bool is_selected, const void *arg1, const void *arg2) { const char *title = arg1; const char *subtitle = arg2; menu_cell_basic_draw(ctx, cell_layer, title, subtitle, NULL); } static void prv_dr...
/* * 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...
(&file, PREF_KEY_CLOCK_24H, sizeof(PREF_KEY_CLOCK_24H), &s_is_24h_style, sizeof(s_is_24h_style))
!= S_SUCCESS) { // The setting likely doesn't exist yet so set it to the default (true) s_is_24h_style = true; } if (settings_file_get(&file, PREF_KEY_DEFAULT_WATCHFACE, sizeof(PREF_KEY_DEFAULT_WATCHFACE), &s_default_watchface, sizeof(s_default_watchface)) != S_SUCCESS) { s_defa...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
i18n_set_resource(RESOURCE_ID_STRINGS)
; } void test_i18n__cleanup(void) { } extern I18nString *prv_list_find_string(const char *string, void * owner); void test_i18n__music(void) { const char *first = i18n_get("Music", (void *)0x12345); cl_assert(strcmp(first, "Musique") == 0); cl_assert(prv_list_find_string("Music", (void *)0x12345) != NULL); c...
, [SystemInformationItemLegal] = i18n_noop("Legal") }; static void prv_populate_uptime_string(SystemInformationData* data) { uint32_t seconds_since_reboot = time_get_uptime_seconds(); uint32_t days, hours, minutes, seconds; time_util_split_seconds_into_parts(seconds_since_reboot, &days, &hours, &minutes, &sec...
app_confirmation_dialog_push(confirmation_dialog)
; } } #include "drivers/led_controller.h" #include "system/rtc_registers.h" static void prv_color_led_easter_egg(void) { #if CAPABILITY_HAS_LED static int i = 0; // Simple test code to exercise each of the LEDs in the RGB cluster. // Start after 3 clicks switch (i) { case 3: led_controller_rgb_set...
ns_flip_animation_update(ctx, ANIMATION_NORMALIZED_MAX * 3 / 4, CompositorTransitionDirectionRight, GColorWhite); } void test_graphics_window_stack_animation__right_flip_first_quarter_frame_clipping(void...
TEST_NAMED_PBI_FILE("move_horizontal_right_too_far")
)); graphics_private_move_pixels_horizontally(bitmap, -400, true); cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_left_filled"))); free(ctx); }
/* * 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...
(expected_buf, actual_buf, attributes_actions_get_serialized_payload_size(s_expected_attributes, s_expected_actions))
; } return S_SUCCESS; } void ios_notif_pref_db_free_prefs(iOSNotifPrefs *prefs) { return; } static void prv_compare_notif_prefs(iOSNotifPrefs *prefs1, iOSNotifPrefs *prefs2) { const int buf_size = 256; uint8_t buf1[buf_size]; uint8_t buf2[buf_size]; attributes_actions_serialize_payload(&prefs1->attr_lis...
/* * 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(!sys_mobile_app_is_connected_debounced())
; } static void check_disconnected(void) { // Connected = false cl_assert(!sys_mobile_app_is_connected_debounced()); } static void prv_send_connection_event(bool is_connected) { //! Get connected event PebbleCommSessionEvent event = { .is_open = is_connected, .is_system = true, }; debounced_connec...
/* * 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...
(base_layer)
PBL_LOG(LOG_LEVEL_WARNING, "Wrong number of samples"); success = false; } else { // Default timestamp for next chunk state->timestamp_ms += samples * 1000 / state->sampling_rate; state->num_samples = 0; // Fill it again from accel circular buffer accel_manager_dispatch_data(); ...
accel_remove_consumer(&state->buffer_client)
; list_remove(&state->list_node, &s_data_subscribers /* &head */, NULL /* &tail */); kernel_free(state); // All data subscribes are also tap subscribers prv_tap_remove_subscriber_cb(pebble_task_get_current()); if (!s_data_subscribers) { // If no one left using the data subscripti...
/* * 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 ((BOARD_CONFIG_BACKLIGHT.options & ActuatorOptions_IssiI2C) == 0 || !s_initialized) { return; }
s_rgb_current_color = rgb_color; uint8_t red = (s_rgb_current_color & 0x00FF0000) >> 16; uint8_t green = (s_rgb_current_color & 0x0000FF00) >> 8; uint8_t blue = (s_rgb_current_color & 0x000000FF); prv_shutdown(false); i2c_use(I2C_LED); write_register(RegPwmOut4, red); write_register(RegPwmOut6, blu...
= 0, .layout = LayoutIdGeneric, .timestamp = 0x53f0dda5, }, .attr_list = { .num_attributes = ARRAY_LENGTH(attributes), .attributes = attributes, }, .action_group = { .num_actions = ARRAY_LENGTH(actions), .actions = actions, } }; Uuid i2; uuid_generate(&i2)...
cl_assert_equal_m(&e1.header, &h, sizeof(CommonTimelineItemHeader)); test.action_group.num_actions = 2; cl_assert_equal_b(notification_storage_find_ancs_notification_by_timestamp(&test, &h), false); test = e2; test.header.id = UUID_INVALID; cl_assert(notification_storage_find_ancs_noti...
void test_notification_storage__should_detect_corruption(void) { Uuid i1; uuid_generate(&i1); TimelineItem e1 = { .header = { .id = i1, .type = TimelineItemTypeNotification, .status = TimelineItemStatusRead, .ancs_uid = 0, .layout = LayoutIdGeneric, .timestamp = 0x53f0dda...
menu node for the glance that is about to be selected AppMenuDataSource *data_source = launcher_menu_layer->data_source; AppMenuNode *node = app_menu_data_source_get_node_at_index(data_source, row); // Instruct the launcher app glance service to play the glance for the node launcher_app_glance_service_play_gl...
layer_add_child(container_layer, down_arrow_layer)
; ContentIndicator *content_indicator = scroll_layer_get_content_indicator(&menu_layer->scroll_layer); ContentIndicatorConfig content_indicator_config = (ContentIndicatorConfig) { .layer = up_arrow_layer, .colors.background = GColorWhite, .colors.foreground = GColorDarkGray, }; content_indica...
st_call.pp1); EXECUTE_SCRIPT( "ctx.fill();\n" ); // only first shape has at least 3 points cl_assert_equal_i(1, s_gpath_draw_filled.call_count); MockCallRecording *lc = &s_gpath_draw_filled.last_call; cl_assert_equal_i(4, lc->path.num_points); cl_assert_equal_point(GPoint(0, 1), lc->path.points[0]); ...
(1, s_graphics_draw_arc_precise.call_count)
; MockCallRecording *lc = &s_graphics_draw_arc_precise.last_call; cl_assert_equal_point_precise(PP(59.5, 79.5), lc->draw_arc.center); cl_assert_equal_i(20 * 8, lc->draw_arc.radius.raw_value); cl_assert_equal_i(TRIG_MAX_ANGLE * 3 / 4, lc->draw_arc.angle_start); cl_assert_equal_i(TRIG_MAX_ANGLE * 5 / 4, lc->dra...
se) { return i; } } return -1; } int registry_private_add(const char* key, const uint8_t key_length, const uint8_t* uuid, uint8_t description, const uint8_t* value, uint8_t value_length, Registry* registry) { if (value_length >= MAX_VALUE_SIZE_BYTES) { PBL_LOG(LOG_LEVEL_WARNING, "Length of reco...
{ Record* r = registry->records + idx; r->active = false; registry->is_different_from_flash = true; return 0; }
return -1; } //////////////////////////////////////////////////////////// // Read and write from flash //////////////////////////////////////////////////////////// static void registry_set_header(uint32_t cursor, bool active) { const uint8_t* header = s_inactive_header; if (active) { header = s_active_head...
ancs_perform_action(ancs_uid, ActionIDNegative)
; } break; } case ActionResultTypeChaining: prv_handle_chaining_response(data, e); break; case ActionResultTypeDoResponse: prv_handle_do_response_response(data); break; default: prv_cleanup_action_result(data, false /* success */); PBL_LOG(LOG_LEVEL_WARNIN...
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 WARRANTIES OR CONDITIONS OF ANY KIND, eit...
prv_get_config(PebbleTask_Unknown)
cking the same event twice and assume everything went well #define ASSERT_LAST_EVENT(event) \ cl_assert_equal_i(s_last_phone_ui_event, event); \ s_last_phone_ui_event = PhoneEventType_Invalid; static void prv_put_comm_session_event(bool app_connected) { PebbleEvent comm_session_event = { .type = PEBBLE_COMM_...
{ // We should only allow the incoming call if we're connected to the app for polling reasons prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, false); ASSERT_LAST_EVENT(PhoneEventType_Invalid); prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, true); ASSERT_LAST_EVENT(PhoneEventType_Incoming);...
// --------------------------------------------------------------------------------------- // Basic test for incoming calls on iOS 9 and up void test_phone_call__ancs_incoming(void) { // We should allow incoming calls with or without a mobile app on iOS 9 prv_put_incoming_call_event(PhoneCallSource_ANCS, false);...
Key *remote_irk = e->is_resolved ? &e->irk : NULL; if (connection->irk) { PBL_LOG(LOG_LEVEL_WARNING, "Connection already has IRK!?"); } gap_le_connection_set_irk(connection, remote_irk); } unlock: bt_unlock(); } void bt_driver_handle_peer_version_info_event(const BleRemoteVersionInfoReceivedEvent...
prv_mutate_whitelist(&event->peer_address, false /* remove */)
/* * 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...
(DBGMCU_SLEEP | DBGMCU_STOP, ENABLE)
>node); graphics_text_node_container_add_child(&horizontal_container_node->container, vertically_centered_battery_icon_node); if (settings_glance->glance_state.battery_charge_state.is_plugged) { GTextNodeCustom *charging_icon_node = graphics_text_node_create_cus...
(structured_glance)
; LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); PBL_ASSERTN(settings_glance); switch (event->type) { case PEBBLE_BATTERY_STATE_CHANGE_EVENT: settings_glance->glance_state.battery_charge_state = battery_state_service_peek(); break; ...
{ 168, 256, 680}, { 232, 360, 776}, { 232, 376, 840}, { 232, 416, 872}, { 280, 464, 944}, { 136, 528, 864}, { 16, 592, 1072}, { 32, 712, 904}, { 48, 568, 1040}, { 72, 456, 1432}, { 184, 856, 704}, { 272, 552, 736}, { 240, 480, 600}, { 280, 496, 584}, { 344, 48...
{ 240, 480, 768}, { 264, 584, 632}, { 344, 576, 616}, { 344, 624, 704}, { 248, 608, 1040}, // 50 seconds { 208, 664, 968}, { 288, 592, 1656}, { 32, 608, 1080}, { 128, 336, 1200}, { 208, 360, 896}, { 168, 328, 904}, { 184, 328, 864}, { 248, 320, 872}, { 256, 3...
ontent_height) }; GRect indicator_frame = (GRect) { .size = GSize(label_text_container->size.w, indicator_height) }; grect_align(&content_frame, label_text_container, GAlignCenter, true); grect_align(&indicator_frame, &content_frame, GAlignBottom, true); graphics_draw_text(ctx, INDICATOR, aml->layout_...
(aml, cell_index->row)
; const bool selected = menu_layer_is_index_selected(&aml->menu_layer, cell_index); prv_cell_item_draw(ctx, cell_layer, aml, item, selected); } else { const int base_idx = (cell_index->row - aml->num_items) * SHORT_COL_COUNT; const int sel_idx = aml->selected_index - (base_idx + aml->num_items); c...
urned Manual OFF, scheduled should be overriden cl_assert(do_not_disturb_is_manually_enabled() == false); cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true); active = do_not_disturb_is_active(); cl_assert(active == false); // Both OFF } void test_do_not_disturb__disable_manual_dnd_when_sche...
(active == false)
; } void test_do_not_disturb__weekday_weekend_schedule(void) { bool active; cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); cl_assert(do_not_disturb_is_manually_enabled() == false); cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == false); cl_assert(do_not_disturb_is_schedule_enab...
10000] = "11110000", [BTLEPayloadType_10101010] = "10101010", [BTLEPayloadType_PRBS15] = "PRBS15", [BTLEPayloadType_11111111] = "11111111", [BTLEPayloadType_00000000] = "00000000", [BTLEPayloadType_00001111] = "00001111", [BTLEPayloadType_01010101] = "01010101" }; typedef struct { // Main Menu Window...
{ bt_driver_stop_unmodulated_tx(); wait_for_result = false; }
else { bt_driver_le_test_end(); wait_for_result = true; } break; default: WTF; } // Waiting for results is OK because it should not block the app task for very long. // The result is not for the entire test, it is a result for the step itself. // The test result for an RX...
/* * 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 (WhitelistEntry *) list_find(&s_head->node, prv_whitelist_filter, (void *) model); }
int HCI_LE_Rand(unsigned int BluetoothStackID, Byte_t *StatusResult, Random_Number_t *Random_NumberResult) { uint8_t *data = (uint8_t *) Random_NumberResult; for (int i = 0; i < sizeof(*Random_NumberResult); ++i) { data[i] = i; } *StatusResult = 0; return 0; } int HCI_LE_Add_Device_To_W...
x, GPoint(0, 20), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 22), MAX_NUM_COLS + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_even_rows_no_clip"))); // Odd rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RE...
(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_even_cols_no_clip"))
ow(ctx, menu_layer, cell_layer, highlight); const GRect prev_bounds = cell_layer->bounds; // in theory, we could decrement the origin by cell_content_origin_offset_y after the call // in practice once shouldn't trust the draw_row implementation const int16_t draw_box_origin_y = ctx->draw_state.drawing_box.orig...
{ // Draw section header: prv_menu_layer_draw_section_header(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx); // Draw the separator on top of the cell: if (top_diff >= it->it.cursor.sep) { prv_menu_layer_draw_separator(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx); ...
} static void prv_menu_layer_render_row_from_iterator(MenuIterator *iterator) { MenuRenderIterator *it = (MenuRenderIterator*)iterator; const int16_t iter_y = it->it.cursor.y; const int16_t top_diff = it->it.cursor.y - it->content_top_y; const bool is_row_in_frame = (top_diff >= 0 && it->it.cursor.y <= it->c...
erFromNumber(3), GTransformNumberFromNumber(4), GTransformNumberFromNumber(5), GTransformNumberFromNumber(6)); int32_t test_array[6] = {1 * (1 << FIXED_S32_16_PRECISION), 2 * (1 << FIXED_S32_16_PRECISION), 3 * (1 << FIXED_S32_16_PRECISION), ...
GTransformNumberFromNumber((float)cosine / TRIG_MAX_RATIO)
// when it wants to retrieve the layouts it wants to. notifications_presented_list_set_current(second_id); swap_layer_attempt_layer_swap(&data->swap_layer, ScrollDirectionUp); return; } #else // On round displays, just set the new notification as the current one and show // the peek ani...
if (alerts_should_vibrate_for_type(prv_alert_type_for_notification_type(type))) { #if CAPABILITY_HAS_VIBE_SCORES VibeScore *score = vibe_client_get_score(VibeClient_Notifications); if (score) { vibe_score_do_vibe(score); vibe_score_destroy(score); } #else vibes_short_pulse(); #endif // T...
alories(distance_mm, rate_elapsed_ms); } } mutex_unlock_recursive(s_activity_state.mutex); if (s_activity_state.step_data.steps != prev_steps) { // Post a steps changed event PebbleEvent e = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventMovementUpdate...
if (!s_activity_state.started) { return; }
cron_job_unschedule(&s_activity_job); if (s_activity_state.accel_session) { accel_session_data_unsubscribe(s_activity_state.accel_session); accel_session_delete(s_activity_state.accel_session); s_activity_state.accel_session = NULL; } // Close down heart rate support prv_heart_rate_deinit(); ...
prv_spi_send_data(slave->spi_bus, *(cptr++)); prv_spi_transmit_flush_blocking(slave->spi_bus); } } void spi_ll_slave_burst_read_write(const SPISlavePort *slave, const void *out, void *in, size_t len) { ...
PBL_ASSERTN(slave->slave_state->initialized)
TIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "debug/power_tracking.h" #include "drivers/mcu.h" #include "drivers/rtc.h" #include "drivers/task_watchdog.h" #include "kernel/memory_layout....
if (eTaskConfirmSleepModeStatus() != eAbortSleep) { if (xExpectedIdleTime < MIN_STOP_TICKS || !stop_mode_is_allowed()) { // We assume that a WFI to trigger sleep mode will not last longer than 1 // SysTick. (The SysTick INT doesn't automatically get suppressed) Thus, // we use the SysTick timer to...
RtcTicks ticks_elapsed = rtc_alarm_get_elapsed_ticks(); vTaskStepTick(ticks_elapsed); // Update the task watchdog every time we come out of STOP mode (which is // at least once/second) since the timer peripheral will not have been // incremented task_watchdog_step_elapsed_time_ms((...
(&(const Uuid)UUID_SYSTEM)); } void test_app_install_manager__compare_app_entry_retrieve_methods(void) { AppInstallEntry id_entry; AppInstallEntry uuid_entry; cl_assert_equal_b(true, app_install_get_entry_for_install_id(tictoc_id, &id_entry)); cl_assert_equal_b(true, app_install_get_entry_for_uuid(&tictoc_uui...
(-1000000)
); cl_assert_equal_b(true, app_install_id_from_system(-1)); cl_assert_equal_b(false, app_install_id_from_system(0)); cl_assert_equal_b(false, app_install_id_from_system(1)); cl_assert_equal_b(false, app_install_id_from_system(1000000)); } void test_app_install_manager__is_from_app_db(void) { cl_assert_equal_...
(cell_layer->bounds.size.h - data->plus_icon.bounds.size.h) / 2); box.size = data->plus_icon.bounds.size; graphics_context_set_compositing_mode(ctx, GCompOpTint); graphics_draw_bitmap_in_rect(ctx, &data->plus_icon, &box); return; } AlarmNode *node = (AlarmNode*) list_get_a...
expandable_dialog_set_header(expandable_dialog, header)
; #if defined(PBL_ROUND) expandable_dialog_set_header_font(expandable_dialog, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); #endif // Show immediately since this is the first window and there is already a compositor animation app_window_stack_push(&expandable_dialog->dialog...
_REGION_SIZE; } void pfs_set_size(uint32_t new_size, bool new_region_erased) { uint32_t prev_size = s_pfs_size; s_pfs_size = new_size; s_pfs_page_count = new_size / PFS_PAGE_SIZE; // re-build the flags cache prv_build_page_flags_cache(); if (new_region_erased) { prv_write_erased_header_on_page_range(...
if (!s_gc_block.block_valid || (s_gc_block.block_writes > 5)) { int free_region_start = prv_find_free_erase_region(s_gc_block.block_valid); if (free_region_start >= 0) { s_gc_block = (GCBlock) { .block_valid = true, .block_writes = 0, .gc_start_page = free_region_start }; ...
if (prv_handle_configure_request(this, packet)) { prv_transition_to(this, LinkState_Opened); } break; default: break; } } static void prv_on_configure_ack(PPPControlProtocol *this, struct LCPPacket *packet) { if (packet->identifier != this->state-...
prv_send_configure_request(this)
ndle_desired_state_granted(GAPLEConnection *hdl, ResponseTimeState granted_state); static void prv_watchdog_timer_callback(void *ctx); static const GAPLEConnectRequestParams *prv_params_for_state(const GAPLEConnection *connection, ...
new_timer_start(connection->param_update_info.watchdog_timer, retry_ms, prv_watchdog_timer_callback, connection, 0)
; } static void prv_watchdog_timer_callback(void *ctx) { // This should all take very little time, so just execute on NewTimer task: bt_lock(); GAPLEConnection *connection = (GAPLEConnection *)ctx; if (gap_le_connection_is_valid(connection)) { // Override the flag: connection->param_update_info.is_requ...
ox_failed(DictionaryIterator *it, AppMessageResult reason, void *ctx) { APP_LOG(APP_LOG_LEVEL_WARNING, "Failed to send message: Reason %d", reason); ++s_state.out.failure_count; prv_handle_outbox_result(reason); } //////////////////////////////////////////////////////////////////////////////// // Unsupported Pro...
dict_find(it, PostMessageKeyResetRequest)
) { prv_awaiting_reset_complete_remote_initiated_enter(); prv_session_open__after_exit(); } else if (dict_find(it, PostMessageKeyResetComplete)) { PBL_LOG(LOG_LEVEL_ERROR, "Resetting because got RC while open"); prv_session_open__exit_and_initiate_reset(); } } //////////////////////////////////////...
#include "applib/ui/window.h" #include "applib/pbl_std/pbl_std.h" #include "applib/legacy2/ui/menu_layer_legacy2.h" #include "kernel/pbl_malloc.h" #include "process_management/process_manager.h" #include "shell/system_theme.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include <str...
(BUTTON_ID_DOWN, 100 /*ms*/, (ClickHandler)menu_down_click_handler)
if (!prv_read_register(dev, ADDR_APP_IDS, &running_apps)) { return false; } PBL_LOG(LOG_LEVEL_DEBUG, "Apps running: 0x%"PRIx8, running_apps); if (app == AS7000AppId_Idle) { // no apps should be running return running_apps == AS7000AppId_Idle; } return running_apps & app; } //! Set the application...
if (dev->state->enabled_state != HRMEnabledState_Enabled) { goto exit; }
// If we have gone too long without getting an interrupt, let's reset the device if (s_missing_interrupt_count >= AS7000_MAX_WATCHDOG_INTERRUPTS) { PBL_LOG(LOG_LEVEL_ERROR, "Watchdog logic detected frozen sensor. Resetting now."); analytics_inc(ANALYTICS_DEVICE_METRIC_HRM_WATCHDOG_TIMEOUT, AnalyticsClient...
/* * 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 (decimal_divisor) { decimal_divisor *= base; }
break; } case '-': { if (number_started || is_negative) { return false; // Encountered minus in the middle of a number or multiple minus signs } is_negative = true; break; } case ',': case '.': { number_started = true; i...
, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, }, }, .identity = (BTDeviceInternal) { .address = (BTDeviceAddress) { .octets = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, }, }, .is_classic = false, .is_random_address = false, }, .is_remote_identity_info_valid = true, ...
cl_assert_equal_i(platform_bits_1, platform_bits_out)
m.app_uuid); cl_assert(client); ppogatt_close(client); cl_assert_equal_p(NULL, ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid)); } void test_ppogatt__missing_inbound_packet(void) { test_ppogatt__open_session_when_found_pebble_app(); // Receive data: prv_receive_short_data_fragment(s_characteristics[...
cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment)), true)
; ppogatt_send_next(transport); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment)); } } void test_ppogatt__handle_client_disappearing_for_send_callback(void) { // ppogatt_send_next() is called from the Ker...
{ 1120, 128, -200}, { 1168, 152, -224}, { 1168, 184, -208}, { 1088, 128, -184}, { 1184, 104, -296}, { 952, 112, -280}, { 984, 56, -304}, { 1024, -64, -128}, { 944, 32, -288}, { 1104, 96, -376}, { 1344, 104, -464}, { 1128, 104, -488}, { 872, 136, -336}, { 904, 280, -4...
{ 1048, 144, -296}, { 1240, 104, -344}, { 1480, 16, -360}, { 1232, 104, -392}, { 928, 168, -456}, { 976, 256, -448}, { 1184, 208, -424}, { 1240, 288, -392}, { 1200, 416, -424}, { 1472, 608, -568}, // 39 seconds { 1016, 712, -384}, { 1440, 568, -456}, { 1232, 472, ...
{ 1112, 528, -360}, { 1208, 480, -360}, { 1088, 352, -176}, { 1072, 312, -152}, { 1296, 256, -224}, { 1360, 208, -160}, { 1264, 168, -176}, { 1312, 176, -288}, { 1136, 88, -344}, { 848, -40, -304}, { 1064, -96, -160}, { 984, -32, -184}, { 1072, 88, -328}, { 1152,...
is exceeded PmicInt1_LowBat = (1 << 7), //!< Low Battery detected. Set when BSUP drops below ResVoltFall }; enum PmicRail { PmicRail_SD1, //!< 1.8V PmicRail_LDO1, //!< 3.0V PmicRail_LDO2, //!< 2.0V }; #define AS3701B_CHIP_ID 0x11 #define AS3701B_WRITE_ADDR 0x80 #define AS3701B_READ_ADDR 0x81 static bool ...
{ // ResetControl (Fig. 79) // Bit 1: power_off - Start a reset cycle, and wait for ON or charger to complete the reset. if (prv_register_set_bit(PmicRegisters_RESET_CNTL, 1)) { while (1) {} __builtin_unreachable(); } return false; }
// On the as3701b, a power_off will cut power to all rails. We want to keep the // RTC alive, so rather than performing a sw_power_off, enter the pmic's standby // mode, powering down all but LDO2. bool pmic_power_off(void) { // Only enable interrupts that should be able to wake us out of standby // - Wake on ...
- // Fills in the range structure based on time_start and time_end. This computes the following // values: // * How many whole days of data are needed to include time_start and time_end (range->num_days). // This will alway be >= 1. // * The index of the last day in the range relative to today (0 means today, 1 means...
prv_get_metric_daily_history(state, metric, daily_history)
) { return HealthServiceAccessibilityMaskNotAvailable; } if (!prv_calculate_time_range(time_start, time_end, time_range)) { return HealthServiceAccessibilityMaskNotAvailable; } return HealthServiceAccessibilityMaskAvailable; } // -----------------------------------------------------------------------...
ight_of(rtc_get_time()) + 1 * SECONDS_PER_DAY); ActivityInsightSettings original_settings; activity_insights_settings_read(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD, &original_settings); ActivityInsightSettings disabled_settings = original_settings; disabled_settings.enabled = false; activity_insights_sett...
health_service_sum_today(HealthMetricStepCount)
; APP_LOG(APP_LOG_LEVEL_DEBUG, "Got steps update event.(today value: %d)", (int) steps_today); data->steps_updated_value = steps_today; } } // ------------------------------------------------------------------------------- // Tests typedef struct { const char *title; AppTimerCallback cal...
224, -56}, { 1056, 256, -88}, { 936, 224, -56}, { 1072, 248, -64}, { 888, 248, -152}, { 920, 176, -120}, { 1256, 240, -24}, { 1208, 240, -56}, { 1344, 336, -176}, { 1432, 320, -112}, // 72 seconds { 1240, 360, -96}, { 952, 288, -160}, { 920, 344, -136}, { 1008, 36...
{ 1088, 320, 8}, { 1080, 232, -32}, { 1224, 232, -16}, { 928, 216, -144}, { 1160, 168, -136}, { 1000, 160, 0}, { 1128, 264, -112}, { 1264, 320, -280}, { 1416, 352, -192}, { 1216, 288, -80}, { 1008, 208, -160}, { 1008, 424, -208}, { 984, 408, -80}, { 1072, 432, -56...
{ 320, 752, -192}, { 416, 808, -344}, { 320, 832, -352}, { 336, 808, -248}, { 344, 792, -384}, { 336, 672, -336}, { 344, 696, -440}, { 368, 728, -416}, { 384, 688, -424}, // 5 seconds { 392, 680, -440}, { 400, 608, -416}, { 392, 680, -448}, { 392, 696, -408}, { 38...
{ -992, 120, -88}, { -992, 104, -16}, { -1040, 56, 32}, { -1088, 72, 8}, { -1112, 112, 0}, { -1184, 112, 8}, { -984, -64, 8}, { -1024, -128, -80}, { -1064, 40, -344}, { -960, 32, -504}, { -1272, -136, -392}, { -1384, -240, -160}, { -1424, -32, -136}, { -1192, 248,...
{ -1544, -144, -160}, { -1712, 72, -152}, { -1544, 440, -40}, { -1272, 624, -192}, { -1048, 488, -216}, // 13 seconds { -1248, 424, -168}, { -1072, 248, -152}, { -1192, 488, -184}, { -1096, 744, -232}, { -1560, 552, -104}, { -1160, 376, -176}, { -1112, 360, -312}, ...
eader.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_tim...
timeline_model_iter_prev(&new_idx, NULL)
/* * 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...
{ delay_us(1000); }
of_elapsed = false; bool reached_end_elapsed = false; uint64_t time_ms; while (s_stopped_handler_calls.num_calls < 2) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("rescheduled count: %d\n", s_stopped_handler_calls.num_calls); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_m...
("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, layer.frame.size.w, layer.frame.size.h)
; if (layer.frame.origin.x == to_r.origin.x && layer.frame.origin.y == to_r.origin.y) { reached_end_elapsed = true; } if (reached_end_elapsed && s_stopped_handler_calls.num_calls == 1 && layer.frame.origin.x < to_r.origin.x) { detected_reset_of_elapsed = true; } cl_assert(max_l...
jerry_value_t input; char *expected_output; } cases[] = { { .input = jerry_create_boolean(false), .expected_output = "false", }, { .input = jerry_create_number(0.0), .expected_output = "0", }, { .input = jerry_create_number(1.234e+60), .expected_output =...
jerry_create_number(0)
, [3] = jerry_create_null(), }, .argc = 4, .error_msg = "TypeError: Argument at index 3 is not a Number", }, { .argv = { [0] = jerry_create_number(0), [1] = jerry_create_number(0), [2] = jerry_create_number(0), [3] = jerry_create_string((const jerr...
/* * 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...
(HealthMetricStepCount, day_start, day_start + SECONDS_PER_DAY)
; APP_LOG(APP_LOG_LEVEL_INFO, "%d days ago steps: %d", i, (int)steps); day_start -= SECONDS_PER_DAY; } // Test getting steps for part of a day day_start = time_start_of_today(); time_t seconds_today_so_far = time(NULL) - day_start; steps = health_service_sum(HealthMetricStepCount, day_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...
{ // Allocate mutable types Iterator word_iter = ITERATOR_EMPTY; WordIterState word_iter_state = WORD_ITER_STATE_EMPTY; Line line = { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "Foo bar"); cl_assert(success); const TextBoxParams te...
void test_line_layout__test_line_add_word_exact_bounds(void) { // Allocate mutable types Iterator word_iter = ITERATOR_EMPTY; WordIterState word_iter_state = WORD_ITER_STATE_EMPTY; Line line = { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&suc...
box, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } else { graphics_draw_text(ctx, i18n_get("Open the Pebble app on your phone to connect.", data), font, box, GTextOverflowModeTrailingEllipsis, GTextAlignmentCent...
{ gbitmap_deinit(&data->icon_heap_bitmap[idx]); }
app_free(data); } static Window *prv_init(void) { SettingsBluetoothData *data = app_malloc_check(sizeof(SettingsBluetoothData)); *data = (SettingsBluetoothData){}; for (unsigned int idx = 0; idx < NumIcons; ++idx) { gbitmap_init_with_resource(&data->icon_heap_bitmap[idx], ICON_RESOURCE_ID[idx]); } d...
ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, 2, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&...
MIN(RECT_WIDTH, RECT_HEIGHT)
) / 2) - 1, GCornersBottom); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_bottom.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_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, GCorne...
EVENTED_TIMER_INVALID_ID != s_state.out.session_closed_object_queue_timer) { AppTimer *t = s_state.out.session_closed_object_queue_timer; s_state.out.session_closed_object_queue_timer = EVENTED_TIMER_INVALID_ID; app_timer_cancel(t); DBG("Cancelled 3s timeout"); } } static void prv_session_closed_obje...
{ memset(&s_state, 0, sizeof(s_state)); // Pebble comm session events to transition in & out of PostMessageStateDisconnected s_state.comm_session_event_info = (EventServiceInfo) { .type = PEBBLE_COMM_SESSION_EVENT, .handler = prv_handle_comm_session_event, }; event_service_client_subscribe(&s_state.c...
static bool prv_free_control_msg_for_each_cb(ListNode *node, void *context) { task_free(node); return true; } static bool prv_free_outbound_object_for_each_cb(ListNode *node, void *context) { OutgoingObject *object = (OutgoingObject *)node; task_free(object->data_buffer); task_free(object); return true; ...
nst ANCSAttribute *attr_action_neg) { if (!pstring_equal_cstring(&app_id->pstr, IOS_REMINDERS_APP_ID)) { return false; } // copy out reminder title to a char buffer char reminder_title_buffer[title->length + 1]; pstring_pstring16_to_string(&title->pstr, reminder_title_buffer); TimelineItem reminder; ...
ancs_filtering_is_muted(app_notif_prefs)
; } static bool prv_should_ignore_notification(uint32_t uid, time_t timestamp, ANCSAttribute **notif_attributes, iOSNotifPrefs *app_notif_prefs) { const ANCSAttribute *app_id = notif_attri...
{ return 0; } int GAP_LE_Diversify_Function(unsigned int BluetoothStackID, Encryption_Key_t *Key, Word_t DIn, Word_t RIn, Encryption_Key_t *Result) { return 0; } int GAP_LE_Generate_Long_Term_Key(unsigned int BluetoothStackID, Encryption_Key_t *DHK, ...
memset(&s_ad_data, 0, sizeof(s_ad_data))
; s_ad_data_length = 0; s_le_create_connection_event_callback = NULL; s_le_create_connection_callback_param = 0; memset(&s_scan_resp_data, 0, sizeof(s_scan_resp_data)); s_scan_resp_data_length = 0; }
Version NOW, // Timestamp 1234, // Sleep Duration 1111, // Deep Sleep Duration 2222, // Fall Asleep Time 3333, // Wakeup Time 4444, // Active Time 5555, // Typical sleep duration 6666, // Typical deep sleep duration 7777, // Ty...
(health_db_get_typical_value(ActivityMetricSleepExitAtSeconds, Monday, &val_out))
_layer_update_callback); layer_render_tree(&layer, &ctx); #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_clear"))); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } #define MAX_NUM_ROWS 168 #define M...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_ODD, ORIGIN_RECT_NO_CLIP, false, 1)
; for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_odd_clip"))); } #define OFFSET_RECT_EVEN GRect(14, 14, MAX_NUM_COLS, ...
PPoGATTClient *client, uint32_t sn) { if (prv_is_packet_with_sn_awaiting_ack(client, sn)) { client->out.timeouts_counter = 0; client->out.ack_timeout_state = AckTimeoutState_Inactive; // Ack'd one of the packets in flight const uint32_t next_sn = prv_next_sn(sn); const uint16_t num_bytes_acked = ...
if (LIKELY(packet->type == PPoGATTPacketTypeAck)) { prv_handle_ack(client, packet->sn); } else if (UNLIKELY(packet->type == PPoGATTPacketTypeResetComplete)) { PBL_LOG(LOG_LEVEL_ERROR, "Got reset complete while open!?"); }
} else if (client->state == StateConnectedClosedAwaitingResetCompleteSelfInitiatedReset || client->state == StateConnectedClosedAwaitingResetCompleteRemoteInitiatedReset) { if (LIKELY(packet->type == PPoGATTPacketTypeResetComplete)) { prv_handle_reset_complete(client, packet, value_length - si...
time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 11 H", time_buf); // June 12th 2015, 00:30:01 (T-11:29:59) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (30 * SECONDS_PER_MINUTE) + 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_...
cl_assert_equal_s("59 MIN AGO", time_buf)
; // June 9th 2015, 12:59:58 (T+00:59:58) rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 58); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 12:59:59 (T+00:59:59) rtc_set_time(event_time + (59 ...
/* * 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...
(strcmp(first, "Musique") == 0)
; cl_assert(prv_list_find_string("Music", (void *)0x12345) != NULL); const char *second = i18n_get("Music", (void *)0x12345); cl_assert(first == second); const char *third = i18n_get("Music", (void *)0xdeadbeef); cl_assert(first != third); i18n_free_all((void *)0x12345); cl_assert(prv_list_find_string("Mu...
TimelineItemAction[]) { { .id = 0, .type = TimelineItemActionTypeComplete, .attr_list = completed_attr_list, }, { .id = 1, .type = TimelineItemActionTypePostpone, .attr_list = postpone_attr_list, }, { .id = 2, .type = Timeline...
strlen(tmp)
der 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 <stdio.h> #include <setjmp.h> #include "debug/power_tracking.h" #includ...
dbgserial_putstr_fmt(buf, sizeof(buf), "Non Analog P%s cfg: 0x%"PRIx16, name, (int)pin_cfg_mask)
; name[0]++; } } #endif /* DUMP_GPIO_CFG_STATE */ int main(void) { gpio_init_all(); #if defined(MICRO_FAMILY_STM32F4) && !defined(LOW_POWER_DEBUG) // If we're on a snowy board using the stm32f4, we experience random hardfaults after leaving a // wfi instruction if we have mcu debugging enabled. For now, j...
obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licen...
{ struct tm time_tm = { .tm_min = rule->minute, .tm_hour = rule->hour, .tm_mday = rule->mday, .tm_mon = rule->month, .tm_year = year, .tm_gmtoff = 0, .tm_isdst = 0, }; // A few countries actually have their DST rule on the midnight AFTER a day // This is subtly different from the mi...
} else { // Wall time time_tm.tm_gmtoff = tz_info->tm_gmtoff; time_tm.tm_isdst = is_end; } // Lord Howe Island has a half-hour DST if (tz_info->dst_id == DSTID_LORDHOWE) { uxtime -= time_tm.tm_isdst ? SECONDS_PER_HOUR / 2 : 0; } else { uxtime -= time_tm.tm_isdst ? SECONDS_PER_HOUR : 0; } ...
.a) { selection_layer_set_active_bg_color(&time_selection_window->selection_layer, config->color); } if (config->range.update) { time_selection_window->range_text = config->range.text; time_selection_window->range_duration_m = config->range.duration_m; layer_set_hidden(&time_selection_window->range_...
time_selection_window_configure(time_selection_window, config)
; } void time_selection_window_deinit(TimeSelectionWindowData *time_selection_window) { if (time_selection_window) { status_bar_layer_deinit(&time_selection_window->status_layer); selection_layer_deinit(&time_selection_window->selection_layer); } }
bleTask_App), HCI_ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST); // Verify that the connection intent has been removed after disconnection: cl_assert_equal_i(gap_le_connect_connection_intents_count(), 0); } void __disabled_test_gap_le_connect__two_clients_one_without_autoreconnect(void...
gap_le_connect_connect_by_bonding(bonding_id, false /* no auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp)
; BTErrno e = gap_le_connect_cancel_by_bonding(bonding_id, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoOK); prv_assert_no_event(); // Verify there are no more intents: cl_assert_equal_i(gap_le_connect_connection_intents_count(), 0); cl_assert_equal_b(gap_le_connect_has_pending_create_connection(), false...
ner = GCornerNone; break; } graphics_fill_round_rect(ctx, &rect, radius - margin, corner); } GRect icon_rect = icon->bounds; const bool clip = true; grect_align(&icon_rect, &rect, GAlignCenter, clip); const GCompOp op = (is_white != is_highlighted) ? GCompOpAssign : GCompOp...
window_set_click_config_provider_with_context( action_bar->window, (ClickConfigProvider) action_bar_legacy2_click_config_provider, action_bar)
; } } void action_bar_layer_legacy2_set_click_config_provider(ActionBarLayerLegacy2 *action_bar, ClickConfigProvider click_config_provider) { action_bar->click_config_provider = click_config_provider; action_bar_legacy2_update_click_config_provider(action_b...
unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert(job); gap_le_advert_deinit(); cl_assert_equal_i(s_unscheduled_cb_count, 1); cl_assert_equal_p(s_unscheduled_job, job); cl_assert_equal_b(s_unscheduled_completed, false); cl_assert_equal_i(regular_timer_seconds_count(), 0); free(ad); } void ...
gap_le_advert_unschedule_job_types(&tag, 1)
; cl_assert_equal_i(s_unscheduled_cb_count, 4); cl_assert_equal_b(gap_le_is_advertising_enabled(), false); free(ad); }
est_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax2_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW ...
(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1)
; graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2), GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax1_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Should draw same as rmax1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT...
equal_i(platform_bits_1, platform_bits_out); ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_2, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_2, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&li...
(&addr_in, &link_key_out, name_out, &platform_bits_out)
; cl_assert_equal_i(id, id_out); cl_assert_equal_m(&link_key_in, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_in, name_out); cl_assert_equal_i(platform_bits_in, platform_bits_out); // Now try to read out a pairing that doesn't exist addr_in.octets[0] = 0xff; id_out = bt_persistent_storage...
back, NULL, 0 /* flags */); } break; case LIGHT_STATE_OFF: new_brightness = BACKLIGHT_BRIGHTNESS_OFF; new_timer_stop(s_timer_id); break; } if (s_current_brightness != new_brightness) { prv_change_brightness(new_brightness); } } static bool prv_light_allowed(void) { if (!s...
{ prv_change_state(LIGHT_STATE_OFF); }
mutex_unlock(s_mutex); } void light_toggle_ambient_sensor_enabled(void) { mutex_lock(s_mutex); backlight_set_ambient_sensor_enabled(!backlight_is_ambient_sensor_enabled()); if (prv_light_allowed() && !ambient_light_is_light()) { prv_change_state(LIGHT_STATE_ON_TIMED); } else { prv_change_state(LIGHT...
c InhibitorTickProfile s_inhibitor_profile[InhibitorNumItems]; void enter_stop_mode(void) { // enable the interrupt on the debug RX line so that we can use the serial // console even when we are in stop mode. dbgserial_enable_rx_exti(); flash_power_down_for_stop_mode(); // Turn on the power control periphe...
{ s_sleep_mode_allowed = enable; }
bool sleep_mode_is_allowed(void) { #ifdef PBL_NOSLEEP return false; #endif return s_sleep_mode_allowed; } static RtcTicks prv_get_nostop_ticks(StopModeInhibitor inhibitor, RtcTicks now_ticks) { RtcTicks total_ticks = s_inhibitor_profile[inhibitor].total_ticks_while_disabled; if (s_inhibitor_profile[inhib...
already allocated 1 pg so just subtract 1 to roundup // We assume all pages are the same size int pgs_needed = (f->file_size + FILEDATA_LEN + strlen(f->name) - 1) / free_bytes_in_page(start_page); uint16_t curr_page = start_page; uint16_t next_page = start_page; for (; pgs_needed >= 0; pgs_needed--) {...
if (PFS_FD(fd).file.pg_cache != NULL) { kernel_free(PFS_FD(fd).file.pg_cache); PFS_FD(fd).file.pg_cache = NULL; PFS_FD(fd).file.pg_cache_len = 0; }
PFS_FD(fd).fd_status = FD_STATUS_FREE; return (S_SUCCESS); } typedef enum { FDBusy = 2, FDAlreadyLoaded = 1, FDAvail = 0, NoFDAvail = -1 } AvailFdStatus; //! @param is_tmp specified to indicate whether or not you are looking for //! a tmp file static AvailFdStatus get_avail_fd(const char *name, ...
(s_accel_manager_mutex); { PBL_ASSERTN(s_shake_subscribers_count > 0); if (--s_shake_subscribers_count == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Stopping accel shake service"); accel_enable_shake_detection(false); prv_setup_subsampling(accel_get_sampling_interval()); } } mutex_unlock_recursi...
( &state->buffer_client, numerator, denominator)
; state = (AccelManagerState *)state->list_node.next; } } //! Should be called after any change to a subscriber. Handles re-configuring //! the accel driver to satisfy the requirements of all consumers (i.e setting //! sampling rate and max number of samples which can be batched). If there are no //! subscribers...
/* * 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_stack_id = BluetoothStackID; s_connection_event_callback = ConnectionEventCallback; s_connection_callback_param = CallbackParameter; return 0; }
-16, 128}, { 696, -40, 48}, { 904, 32, -96}, { 1288, -72, -40}, { 1712, -248, 344}, { 1528, 160, 176}, { 1376, 512, -232}, { 1312, 384, -120}, { 1168, 304, 264}, { 1024, 288, 224}, { 968, 240, 272}, { 912, 328, 120}, { 816, 320, 64}, { 840, 424, -56}, // 97 second...
{ 1568, -72, 8}, { 1712, -128, 320}, { 1224, 320, -8}, { 1128, 392, -240}, { 1224, 232, 96}, { 1104, 224, 272}, { 1040, 264, 232}, { 976, 288, 200}, { 888, 360, 72}, { 848, 320, 48}, { 896, 408, -56}, { 936, 384, -32}, { 1168, 432, -128}, { 1320, 320, -64}, { ...
// 105 seconds { 1704, 368, 96}, { 1816, 456, 96}, { 1072, 312, 136}, { 1080, 184, 104}, { 1336, 144, 176}, { 1368, 88, 280}, { 1184, 88, 264}, { 1056, 8, 248}, { 952, -16, 232}, { 848, -24, 216}, { 760, 8, 128}, { 728, -40, 104}, { 816, -48, 32}, { 960, 64, ...
/* * 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...
pfs_init(false)
; pfs_format(false); cron_service_init(); alarm_init(); alarm_service_enable_alarms(true); } void test_alarm_smart__cleanup(void) { cron_service_deinit(); } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Smart alarms #define SMART_ALARM_UPDATE_MIN...
{ const uint32_t transition_progress_threshold = ANIMATION_NORMALIZED_MAX / 2; const int32_t ring_max_thickness = 40; const bool direction_negative = ((s_data.direction == CompositorTransitionDirectionRight) || (s_data.direction == CompositorTransitionDirectionDown)); const bo...
graphics_private_move_pixels_vertically(&ctx->dest_bitmap, diff); } else { graphics_private_move_pixels_horizontally(&ctx->dest_bitmap, diff, false /* patch_garbage */); } } compositor_port_hole_transition_draw_outer_ring(ctx, ABS(current_offset_...
xFhoWTzJxDOmyBX2g3n7wdoPKxeleBR7iwKGn7utn8qTEj0tB7aw65EEFZ5QldgAkg6lctSmamf2p95l2CpHXNgVL22hQFx", }, { .key = "saturday_steps", .val = "SSxw7WtwGnhobAOXwqbvGDDwElpRG6cll8CwM9Wysh01Mj0aFWxEVN0z5w7yQHt8bwiWVabrMeUUAek2J5zCoXiGIkav4cW8" \ "SSxw7WtwGnhobAOXwqbvGDDwElpRG6cll8CwM9Wysh01Mj0aFWxEVN...
((uint8_t *)key, strlen(key), (uint8_t *)s_movement_data, sizeof(s_movement_data))