prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
uld be set to test_pattern since existing data should be 0xFF and we are writing // test_pattern status = prv_write_read_verify_byte(test_addr, test_pattern, test_pattern, true); VERIFY_TEST_STATUS(status); // Confirm write into base_addr did not take place // If test_pattern was written over the data_patter...
PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - ADDR TEST 2: Check for address bits stuck at low or shorted")
; return FLASH_TEST_SUCCESS; } /***********************************************************/ /******************* Stress Test Functions *****************/ /***********************************************************/ #define FLASH_TEST_STRESS_ADDR1 0x00A5A5A5 #define FLASH_TEST_STRESS_DATA1 0x5A5A #define FLASH...
le); cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_timeline_removes, 3); id2 = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); cl_assert_equal_i(s_num_timeline_adds, 9); cl_assert_equal_i(s_num_timeline_removes, 3); alarm_set_enabled(id2, false); ...
(s_monday, dummy_alarm_id, AlarmType_Basic, alarm_kind, &added_pin_uuid)
; cl_assert(uuid_equal(&added_pin_uuid, &s_last_timeline_item_added->header.id)); AttributeList *pin_attr_list = &s_last_timeline_item_added->attr_list; const uint32_t pin_icon_tiny = attribute_get_uint32(pin_attr_list, AttributeIdIconTiny, 0); cl_assert_equal_i((int)pin_icon_tiny, TIMELINE_RESOURCE_ALARM_CLO...
tmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 0); cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(1))); // each frame has delay 100ms, so (33 - 1) * 100 ms shows 33rd frame status = gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, (33 - 1) * 1...
gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 2 * 1000)
; cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); // Since loop only equals 1, make sure that huge elapsed time leaves us at final frame gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 12345 * 1000); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); #endif } // Tests APNG file with 8-bi...
RebootReasonCode_ResetButtonsHeld: // Since we forced the reset, it isn't unexpected show_reset_alert = false; reason_string = "%s%sResetButtonsHeld"; break; case RebootReasonCode_ShutdownMenuItem: reason_string = "%s%sLowBattery"; break; case RebootReasonCode_FactoryResetReset: reason_s...
*crash_report = (AnalyticsEventCrash) { .crash_code = reason.code, .link_register = lr }; launcher_task_add_callback(log_reboot_reason_cb, crash_report); if (is_unread_coredump_available()) { DEBUG_LOG(LOG_LEVEL_INFO, "Unread coredump file is present!"); } DEBUG_LOG(LOG_LEVEL_INFO, "MCU reset ...
ommSessionTransportType prv_get_type(struct Transport *transport) { return CommSessionTransportType_PPoGATT; } static const TransportImplementation s_ppogatt_transport_implementation = { .send_next = &ppogatt_send_next, .close = &ppogatt_close, .reset = &ppogatt_reset, .set_connection_responsiveness = prv_se...
prv_send_next_packets_async(client)
; } static bool prv_has_timeout(const PPoGATTClient *client) { return (client->out.ack_timeout_state != AckTimeoutState_Inactive && client->out.ack_timeout_state >= AckTimeoutState_TimedOut); } static void prv_increment_timeout_counter_if_necessary(PPoGATTClient *client) { if (client->out.ack_timeout_st...
eset the filter since we're // probably switching to a new curve. battery_state_reset_filter(); bool is_charging = battery_charge_controller_thinks_we_are_charging(); if (is_charging) { analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BATTERY_CHARGE_TIME, AnalyticsClient_System); } else { analytics...
{ prv_transition(&s_last_battery_state, next_state); state_changed = true; }
} s_last_battery_state.voltage = prv_filter_voltage(s_last_battery_state.voltage, battery_get_millivolts()); bool charging = (s_last_battery_state.connection == ConnectionStateChargingPlugged); // Update Percent & Filtering const uint32_t ALWAYS_UPDATE_T...
test_override_last_written_page(start_page_offset)
; test_force_recalc_of_gc_region(); pfs_init(false); int expected_remaing_files = pages_per_sector - 1; // scatter files across two sectors for (int i = 0; i < (pages_per_sector + start_page_offset); i++) { char filename[20]; sprintf(filename, "test%d", i + start_page_offset); int fd = pfs_open(...
_window_shown; static bool s_warning_window_shown; static bool s_stop_mode_allowed; static PebbleEvent s_last_event_put; bool battery_is_usb_connected_raw(void) { return false; } void low_power_standby(void) { s_entered_standby = true; } void low_power_exit(void) { s_in_low_power = false; } void low_power_ent...
battery_curve_lookup_voltage_by_percent(high_percent, true)
; int low_mv = battery_curve_lookup_voltage_by_percent(low_percent, true); fake_battery_init(high_mv, true, true); battery_monitor_init(); periodic_timer_trigger(1); // For the first sample, it will be identical cl_assert_equal_i(battery_get_charge_state().charge_percent, high_percent); // ...and shoul...
erwise the text will not be centered prv_action_bar_setup(PhoneCallActions_None); prv_set_status_text(DECLINED); } static void prv_decline_click_handler(ClickRecognizerRef recognizer, void *unused) { prv_decline_call(); prv_window_pop_with_delay(DECLINE_DELAY_MS); } static void prv_sms_reply_click_handler(Cli...
layer_set_hidden(&s_phone_ui_data->action_bar.layer, true /* hide */)
; layer_set_bounds(&s_phone_ui_data->core_ui_container, &onscreen); #endif } //! Action bar setup functions static void prv_set_action_bar_icon(ButtonId button, ResourceId resource, GBitmap *storage) { if (resource == RESOURCE_ID_INVALID) { action_bar_layer_clear_icon(&s_phone_ui_data->action_bar, button); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_DEBUG, "State: Draw Non-Antialiased; SW: N/A (but currently: %d)", data->stroke_width)
; break; case APP_STATE_DRAW_AA_NO_SW: PBL_LOG(LOG_LEVEL_DEBUG, "State: Draw Antialiased; SW: N/A (but currently: %d)", data->stroke_width); break; case APP_STATE_DRAW_NON_AA_SW: PBL_LOG(LOG_LEVEL_DEBUG, "State: Draw Non-Antialiased; SW: %d", data->stroke_width); brea...
bool shutting_down); // ------------------------------------------------------------------------------------ // This is called when the activity services is doing down. This tells all of our state machines // that are are going to be shut down, and to save off any unsaved data/sleep/step sessions. ...
m_rec->heart_rate_bpm = (uint8_t)median; m_rec->heart_rate_total_weight_x100 = (uint16_t)heart_rate_total_weight_x100; m_rec->heart_rate_zone = activity_metrics_prv_get_hr_zone(); return minute_distance_mm; }
static void NOINLINE prv_reset_state_minute_handler(const AlgMinuteDLSSample *m_rec) { s_alg_state->prev_resting_calories = activity_metrics_prv_get_resting_calories(); s_alg_state->prev_active_calories = activity_metrics_prv_get_active_calories(); s_alg_state->prev_distance_mm = activity_metrics_prv_get_...
stics[0][PPoGATTCharacteristicData], BLESubscriptionNotifications, GAPLEClientKernel); // Simulate getting the subscription confirmation: ppogatt_handle_subscribe(s_characteristics[0][PPoGATTCharacteristicData], ...
fake_gatt_client_op_assert_no_write()
; } void test_ppogatt__timeout_waiting_for_reset_complete_remote_initiated(void) { test_ppogatt__open_session_when_found_pebble_app(); prv_receive_reset_request(s_characteristics[0][PPoGATTCharacteristicData]); prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]); // Timeout waitin...
/* * 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...
(sizeof(MovementData) % sizeof(uint32_t) == 0, "MovementData size is invalid")
; typedef struct PACKED SleepData { uint32_t version; uint32_t last_processed_timestamp; uint32_t sleep_duration; uint32_t deep_sleep_duration; uint32_t fall_asleep_time; uint32_t wakeup_time; uint32_t typical_sleep_duration; uint32_t typical_deep_sleep_duration; uint32_t typical_fall_asleep_time; ...
{ 1480, 328, 16}, { 1304, 304, -32}, { 1376, 168, -56}, { 1080, -344, 56}, { 968, -96, 232}, { 728, -272, -224}, { 1128, 144, -264}, { 1280, 104, -184}, { 1224, 176, -216}, { 1120, 376, -360}, { 1192, 392, -256}, { 1432, 472, -248}, { 1824, 664, -288}, { 1480, 952, ...
{ 1504, 464, -176}, { 1648, 648, -128}, { 1664, 752, -88}, { 1480, 936, -88}, { 1048, 1128, -184}, { 736, 1320, -192}, { 864, 1272, -104}, { 1112, 960, -96}, { 1064, 728, -88}, // 81 seconds { 1256, 760, -8}, { 1736, 744, -8}, { 1824, 424, 8}, { 1584, 256, -72}, ...
{ 1320, 176, -128}, { 1192, 160, -112}, { 952, -136, -8}, { 504, -256, -96}, { 888, -224, -32}, { 1024, 32, -224}, { 1168, 56, -328}, { 1248, 216, -360}, { 1096, 168, -288}, { 1040, 256, -272}, { 1312, 344, -216}, { 1656, 560, -248}, { 1528, 856, -248}, { 1152, 8...
, -264}, { 584, 616, -136}, { 680, 832, -120}, { 656, 872, 48}, { 656, 672, -104}, { 1168, 848, 8}, { 1656, 688, -200}, { 1968, 608, -184}, { 2576, 448, -24}, { 2496, 264, -112}, { 2064, 72, 16}, { 1744, -24, -72}, // 34 seconds { 1304, -176, -88}, { 904, -144, -1...
{ 1608, 832, -184}, { 2016, 616, -160}, { 2368, 528, -96}, { 2536, 360, -152}, { 2208, 64, 200}, { 1592, -136, 120}, { 1672, -32, -264}, { 1368, 48, -224}, { 1064, -48, -80}, { 808, -64, 16}, { 624, -144, -32}, { 488, -216, -64}, { 368, -184, -208}, { 688, -56, -1...
{ 704, -232, -208}, { 728, -56, -208}, { 1192, 16, -360}, { 1832, 0, -344}, { 2736, 48, -344}, { 2912, 320, -624}, // 42 seconds { 2088, 384, -248}, { 1656, 392, -552}, { 1560, 368, -312}, { 1120, 704, -240}, { 728, 976, -152}, { 696, 1040, -64}, { 816, 824, 104}...
al_i(s_num_event_puts, 0); cl_assert_equal_i(s_num_packets_sent, 2); cl_assert_equal_i(s_num_bytes_sent, LOG_METADATA_LENGTH + 20); cl_assert_equal_s(s_log_message_buffer, "TestTestTestTestTest"); } void test_pulse_logging__simple_trucate(void) { pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestT...
(s_log_message_buffer, "ISR Message Dropped!")
; }
*action_bar, uint8_t index) { PBL_ASSERTN(index < NUM_ACTION_BAR_ITEMS); return (bool) (action_bar->is_highlighted & (1 << index)); } static void prv_register_redraw_timer(ActionBarLayer *layer); static void prv_timed_redraw(void *context) { ActionBarLayer *action_bar = context; layer_mark_dirty(&action_bar->...
(prv_draw_background_rect, prv_draw_background_round)
(action_bar, ctx, bg_color); } for (unsigned int index = 0; index < NUM_ACTION_BAR_ITEMS; ++index) { const GBitmap *icon = action_bar->icons[index]; if (icon) { GRect rect = GRect(1, 0, prv_width(), MAX_ICON_HEIGHT); const int button_id = index + 1; const int vertical_icon_margin = prv_ve...
ID_MUSIC, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, APP_ID_WORKOUT, BG_COUNTER_APP_ID, MENU_LAYER_APP_ID}; app_menu_data_source_init(&data_source, &(Ap...
cl_assert_equal_i(node->install_id, order[i])
hServiceTimeRange range; // clamps value that goes into the future result = prv_calculate_time_range(now - 10, now + 11, &range); cl_assert_equal_b(result, true); cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 0, .num_days = 1, .seconds_first_day = 10, .seconds_last_day...
cl_assert_equal_i(values[2], 1000)
truct ElfExternalNote { uint32_t name_length; uint32_t data_length; uint32_t type; // NT_GNU_BUILD_ID = 3 uint8_t data[]; // concatenated name ('GNU') + data (build id) }; //! This symbol and its contents are provided by the linker script, see the //! .note.gnu.build-id section in src/fw/stm32f2xx_flash_fw.ld ...
sscanf(version_str, "v%u.%u", major, minor)
; } //! Compares its two arguments for order. Returns a negative integer, zero, or a positive integer //! if the first argument is less than, equal to, or greater than the second. static int8_t prv_version_compare_fw_version_tags(char *fw1_version, char *fw2_version) { unsigned int major1, minor1, major2, minor2; ...
ent* event) {} HRMSessionRef sys_hrm_manager_get_app_subscription(AppInstallId app_id) { return HRM_INVALID_SESSION_REF; } static bool s_activity_prefs_heart_rate_enabled; bool sys_activity_prefs_heart_rate_is_enabled(void) { return s_activity_prefs_heart_rate_enabled; } bool sys_hrm_manager_get_subscription_inf...
memcpy(averages, &s_sys_activity_get_step_averages_values_weekend.out.averages, sizeof(*averages))
; return s_sys_activity_get_step_averages_values_weekend.out.result; } else { s_sys_activity_get_step_averages_values_weekday.in.day_of_week = day_of_week; memcpy(averages, &s_sys_activity_get_step_averages_values_weekday.out.averages, sizeof(*averages)); return s_sys_activity_get_step_aver...
rdown_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); #endif } static Animation *s_parent_for_sequence_unschedule_from_child; static void prv_unschedule_parent(Animation *animati...
prv_count_handler_entries(&s_started_handler_calls, b)
_ticks)) { break; } } mutex_lock_recursive(s_pfs_mutex); s_last_page_written = last_written_page; // reset our tracker mutex_unlock_recursive(s_pfs_mutex); } // In the future, the next_page field may be updated dynamically (i.e to resize // a file). Use a CRC to catch corruption issues in this field...
(&file_hdr, start_page)
; prv_flash_write((uint8_t *)f->name, strlen(f->name), prv_page_to_flash_offset(start_page) + FILE_NAME_OFFSET); if (!f->is_tmp) { update_curr_state(f->start_page, TMP_STATE_OFFSET, TMP_STATE_DONE); } // finally, mark the creation as complete update_curr_state(start_page, CREATE_STATE_OFFSET, CRE...
make it point to itself: job->node.next = &job->node; job->node.prev = &job->node; s_jobs = job; return true; } list_insert_after(&s_jobs->node, &job->node); // Make it the next one up, unless the first term is silent: if (!prv_is_current_term_silent(job)) { s_jobs = job; return true; ...
{ bool force_update = false; bt_lock(); { if (!s_current || !bt_driver_advert_client_has_cycled() || !s_gap_le_advert_is_initialized) { // Job got removed in the meantime. goto unlock; } prv_increment_time_elapsed_for_all_silent_terms_except_current(); GAPLEAdvertisingJob *job = s_c...
nfig(file, i, &config)) { Alarm alarm = { .id = i, .config = config }; prv_check_and_schedule_alarm(file, &alarm, false /* refresh */); alarm_found = true; } } timeline_event_refresh(); return alarm_found; } // -------------------------------------------------------------------------------...
(file, id, config)
; // This will reload the alarms } else { prv_reload_alarms(file); } cleanup: prv_file_close_and_unlock(file); kernel_free(file); PBL_LOG(LOG_LEVEL_INFO, "Alarm %u timeout", id); s_most_recent_alarm_recorded = false; s_most_recent_alarm_id = rv ? id : ALARM_INVALID_ID; prv_clear_snooze_timer(); ...
/* * 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){.origin.y = 1, .size.h = INT16_MAX})
< 0); text_layer.layer.frame.origin.y = 1; layer_add_child(&window.layer, &text_layer.layer); GPoint origin; GRect page; cl_assert(text_layer_calc_text_flow_paging_values(&text_layer, &origin, &page)); cl_assert_equal_i(page.origin.y, text_layer.layer.frame.origin.y); // must not overflow cl_assert(...
&s_buffer, &state->buffer_client, 1, 1); // Update the sampling rate and num samples of the driver considering the new // subscriber's request prv_update_driver_config(); } mutex_unlock_recursive(s_accel_manager_mutex); return state; } DEFINE_SYSCALL(bool, sys_accel_manager_data_unsubscribe, Ac...
PBL_LOG(LOG_LEVEL_DEBUG, "Dropping %d accel samples", (int)(state->num_samples - samples))
; success = false; } state->event_posted = false; state->num_samples = 0; // Fill it again from circular buffer prv_dispatch_data(); mutex_unlock_recursive(s_accel_manager_mutex); return success; } /* * TODO: APIs that still need to be implemented */ void accel_manager_enable(bool on) { } void...
ionMenuCallbacks callbacks = { .select = prv_timeout_menu_select, }; const char *title = PBL_IF_RECT_ELSE(i18n_noop("TIMEOUT"), i18n_noop("Timeout")); settings_option_menu_push( title, OptionMenuContentType_SingleLine, index, &callbacks, ARRAY_LENGTH(s_timeout_labels), true /* icons_enabled */, s_...
prv_should_show_backlight_sub_items()
pId wakeup_id) { WakeupEntry entry = prv_wakeup_settings_get_entry(wakeup_id); // Only allow owner to delete its own wakeup events if (uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) { if (wakeup_id == s_wakeup_state.current_wakeup_id && new_timer_scheduled(s_current_timer_id, NULL...
{ mutex_lock(s_mutex); { SettingsFile wakeup_settings; if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) == S_SUCCESS) { // Update settings file removing all events with UUID = uuid settings_file_rewrite(&wakeup_settings, prv_delete_events_by_uuid_callback, NULL); ...
DEFINE_SYSCALL(time_t, sys_wakeup_query, WakeupId wakeup_id) { status_t status = E_DOES_NOT_EXIST; WakeupEntry entry = {}; if (wakeup_id < 0) { return status; } mutex_lock(s_mutex); { SettingsFile wakeup_settings; if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZ...
data->effect_duration); } else { intermediate = *from; second_normalized = normalized; } gdraw_command_list_scale_segmented_to( list, size, intermediate, *to, second_normalized, data->interpolate, index_lookup, data->point_duration, two_stage); const AnimationProgress stroke_width_progress...
if (data) { data->effect_duration = effect_duration; }
} void kino_reel_scale_segmented_set_interpolate(KinoReel *reel, InterpolateInt64Function interpolate) { ScaleSegmentedData *data = kino_reel_transform_get_context(reel); if (data) { data->interpolate = interpolate; } } void kino_reel_scale_segmented_set_defla...
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 simplicity, the implementation also moves the layer even though it is not necessary. cl_assert(layer->frame.origin.y >= DISP_ROWS); // Peek service shows the peek UI using...
{ 1024, -136, -48}, { 1024, -120, -96}, { 1016, -136, -64}, { 1032, -120, -56}, { 1032, -112, -64}, { 1000, -88, -56}, { 1048, -96, -72}, { 1072, -96, -80}, { 1040, -112, -112}, { 1056, -96, -152}, { 1048, -168, -144}, { 1032, -256, -120}, { 1064, -344, -112}, { 1080...
{ 1416, -32, -224}, { 1144, -8, -320}, { 792, -64, -304}, { 888, -104, -192}, { 1200, -88, -152}, { 1096, -104, -112}, { 1056, -88, -96}, { 1024, -32, -88}, { 1032, 40, -80}, { 1032, 24, -40}, { 1040, 0, 0}, // 21 seconds { 1048, 0, 8}, { 1048, 16, 48}, { 1104...
{ 856, -216, -440}, { 768, -216, -448}, { 768, -240, -416}, { 1056, -200, -232}, { 1424, -128, -288}, { 1256, -200, -304}, { 888, -296, -360}, { 976, -288, -304}, { 1112, -256, -304}, { 1064, -248, -200}, { 1000, -320, -184}, { 888, -240, -168}, { 792, -224, -240}, ...
DictionaryIterator *iter, const Tuplet * const tuplets, const uint8_t tuplets_count, uint8_t *buffer, uint32_t *size_in_out) { if (size_in_out == NULL || buffer == NULL || tuplets == NULL) { return DICT_INVALID_ARGS; } DictionaryResult result; if ((result = dict_write_begin(iter, buffer,...
(key, dest, orig, context)
; } // Then, write any old keys which were not updated this round. // We still call update_key_callback here, even though the values // themselves have not changed, because we have shuffled them // around in memory, so their old buffers are no longer valid. for (Tuple* orig = dict_read_first(orig_iter); or...
/* * 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...
applib_free(items_to_unload[i])
; } } static void prv_transition_to(Window *window_from, Window *window_to, const WindowTransitionImplementation *transition) { PBL_ASSERTN(window_to && transition); WindowStack *window_stack = window_to->parent_window_stack; WindowTransitioningContext *context = &window_stack->tr...
uint16_t right_margin_px = action_bar_width + content_and_action_bar_horizontal_spacing; const uint16_t text_single_line_text_offset_px = 17; const int16_t text_layer_line_spacing_delta = -4; const GFont dialog_text_font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); const GFont dialog_subtext_font = fonts_...
(x, y, w, h)
, workout_dialog->subtext_buffer, dialog_subtext_font, dialog->text_color, GColorClear, text_alignment, GTextOverflowModeWordWrap); #if PBL_ROUND text_layer_enable_screen_text_flow_and_paging(subtext_layer, T...
; } PBL_LOG(LOG_LEVEL_WARNING, "App requires support for SDK version (%"PRIu8".%"PRIu8"), " "we only support version (%"PRIu8".%"PRIu8").", entry.sdk_version.major, entry.sdk_version.minor, (uint8_t) PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR, (uint8_t) PROCES...
{ PBL_LOG(LOG_LEVEL_WARNING, "Tried to launch an app with an unsupported SDK version."); AppInstallEntry entry; if (!app_install_get_entry_for_install_id(id, &entry)) { // can't retrieve app install entry for id PBL_LOG(LOG_LEVEL_ERROR, "Failed to get entry for id %"PRId32, id); ...
} #endif if (is_worker) { worker_manager_launch_new_worker_with_args(md, NULL); } else { app_manager_launch_new_app(&(AppLaunchConfig) { .md = md, .common = config->common, .forcefully = config->forcefully, }); } } // -------------------------------------------------------------...
--------------------------------------------------------------------- static bool prv_parse_serial_group_type_data(AttributeGroupType type, const uint8_t *data, const uint8_t *end, cons...
prv_get_action_group_buffer_size(type, num_group_type_elements, attributes_per_group_type_element)
; buffer_size += required_size_for_strings; return buffer_size; } // ----------------------------------------------------------------------------- static void prv_init_attribute_list(AttributeList *attr_list, uint8_t **buffer, const uint8_t ...
Ensure within test data region and aligned to sector boundary uint32_t addr_region = (FLASH_TEST_ADDR_START + SECTOR_SIZE_BYTES) & SECTOR_ADDR_MASK; // Loop on each data bit - erase the sector, then write the next data value and verify that data // was written for (data_buffer = 1; data_buffer != 0; data_buff...
(test_addr, 0xFF, FLASH_TEST_ERR_ERASE, 0, display_logs)
Update our copy of the steps after grabbing the mutex. We guard these globals with a // mutex because activity_get_metric() provides access to the current metrics from any task. // The current sleep data is only recomputed every few minutes in order to reduce overhead and // is done so from prv_minute_system_task...
{ PBL_ASSERTN(s_activity_state.accel_session == NULL); s_activity_state.accel_session = accel_session_create(); accel_session_raw_data_subscribe(s_activity_state.accel_session, sampling_rate, ACTIVITY_ALGORITHM_MAX_SAMPLES, prv_accel_cb); // Subscribe to g...
// Set the user data ActivityGender gender = activity_prefs_get_gender(); uint16_t weight_dag = activity_prefs_get_weight_dag(); uint16_t height_mm = activity_prefs_get_height_mm(); uint8_t age_years = activity_prefs_get_age_years(); activity_algorithm_set_user(height_mm, ...
/* * 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 false; }
if (prv_get_ms_since_last_notification_vibe() < NOTIFICATION_VIBE_HOLDOFF_MS) { return false; } return alerts_preferences_get_vibrate(); } bool alerts_get_vibrate(void) { return alerts_preferences_get_vibrate(); } AlertMask alerts_get_mask(void) { return alerts_preferences_get_alert_mask(); } AlertM...
a bytes are ST PQ R1 (in hex) with ST being the address and RPQ being the value. PBL_ASSERTN(response.data[0] == address); PBL_ASSERTN((response.data[2] & 0x0F) == PACKET_FOOTER); *(uint16_t *)result = response.data[1] | ((uint16_t)(response.data[2] & 0xF0) << 4); } else if (type == StatusReadType_16bit) ...
if (message.packet_id == PACKET_ID_TOUCH_STATUS) { for (uint32_t i = 0; i < ARRAY_LENGTH(message.touch.finger_data); i++) { const uint8_t msbs = message.touch.finger_data[i][0]; const uint8_t x_lsb = message.touch.finger_data[i][1]; const uint8_t y_lsb = message.touch.finger_data[i][2]; ...
} } static void prv_exti_cb(bool *should_context_switch) { if (s_callback_scheduled) { return; } PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback.callback = prv_process_pending_messages }; *should_context_switch = event_put_isr(&e); s_callback_scheduled = true; } // Initializatio...
/* * 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...
(!ancs_util_is_complete_notif_attr_response(s_invalid_attribute_length, sizeof(s_invalid_attribute_length), &error))
; cl_assert(error); } void test_ancs_util__should_parse_incomplete_last_attribute(void) { bool error = false; cl_assert(!ancs_util_is_complete_notif_attr_response(s_chunked_dict_part_one, sizeof(s_chunked_dict_part_one), &error)); cl_assert(!error); } void test_ancs_util__should_not_parse_malformed_no...
ax_interval_slots); cl_assert_equal_i(s_unscheduled_cb_count, 0); } void test_gap_le_advert__single_job_multiple_terms(void) { const char ad_data[] = "ad data"; const char scan_resp_data[] = "scan resp data"; BLEAdData *ad = create_ad(ad_data, scan_resp_data); GAPLEAdvertisingJobTerm advert_terms[3] = { ...
gap_le_advert_schedule(ad_c, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0)
; cl_assert(infinite_job_c); assert_ad_data("C"); // Round-robin 5 times: for (int i = 0; i < 5; ++i) { regular_timer_fire_seconds(1); assert_ad_data("A"); regular_timer_fire_seconds(1); assert_ad_data("B"); regular_timer_fire_seconds(1); assert_ad_data("C"); } // Introduce a secon...
yer->bounds; GRect unobstructed_bounds; layer_get_unobstructed_bounds(layer, &unobstructed_bounds); #if UNITTEST unobstructed_bounds.size.h = bounds.size.h - s_unobstructed_area_height; #endif const bool screen_is_obstructed = (unobstructed_bounds.size.h != bounds.size.h); bounds.size.h = unobstructed_bou...
time_start_of_today()
, time_start_of_today() + SECONDS_PER_DAY, HealthServiceTimeScopeWeekly); } static void prv_update_hrm_bpm(KickstartData *data) { data->current_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM); } sta...
} // use the first non-horizontal path segment's direction as the start direction if (rot_end.y != rot_start.y) { start_is_down = rot_end.y > rot_start.y; found_start_direction = true; } rot_end = rot_start; } const int16_t clip_min_x = ctx->draw_state.clip_box.origin.x - ctx...
(points[i])
; } GPath path = { .num_points = (uint32_t)num_points, .points = imprecise_points }; gpath_draw_filled(ctx, &path); applib_free(imprecise_points); } void gpath_draw_outline_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points, bool open) {...
T_SIZE, object_type); prv_process_and_reset_test_counters(); const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc, 0xdd }; prv_receive_put(s_last_response_cookie, chunk, sizeof(chunk)); prv_process_and_reset_test_counters(); prv_receive_commit(s_last_response_cookie, EXPECTED_CRC); prv_process_and_reset_test_counte...
assert_nack_count(1)
; } void test_put_bytes__invalid_command_opcode(void) { uint8_t invalid_cmd[] = { CmdInvalid }; prv_receive_data(s_session, (const uint8_t *) invalid_cmd, sizeof(invalid_cmd)); // Messages with invalid command opcodes are NACK'd: assert_ack_count(0); assert_nack_count(1); } ////////////////////////////////...
nternal(GContext *ctx, GPointPrecise *points, size_t num_points) {} void gpath_draw_outline_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points, bool open) {} typedef uint16_t ResourceId; const uint8_t *resource_get_builtin_bytes(ResAppNum app_num, uint32_t ...
(sequence, 0)
; cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(sequence, 0)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 14)); frame = gdraw_command_sequence_get_frame_by_elapsed(sequence, 15); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(sequence...
call_count); } void test_rocky_api_graphics_path2d__more_lines(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT( "ctx.beginPath();\n" "ctx.moveTo(1, 2);\n" "ctx.lineTo(3, 4);\n" "ctx.lineTo(5, 6);\n" "ctx.lineTo(7, 8);\n" "ctx.moveTo(9, 10);\n" "ct...
cl_assert_equal_point_precise(PP(59.5, 79.625), lc->draw_arc.center)
; cl_assert_equal_i(20.5 * 8, lc->draw_arc.radius.raw_value); cl_assert_equal_i(TRIG_MAX_ANGLE * 1 / 4, lc->draw_arc.angle_start); cl_assert_equal_i(TRIG_MAX_ANGLE * 3 / 4, lc->draw_arc.angle_end); } void test_rocky_api_graphics_path2d__anti_clockwise(void) { rocky_global_init(s_graphics_api); prv_create_gl...
/* * 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(global_lock)
; } inline void __attribute__((always_inline)) unlocker() { mutex_unlock(global_lock); } static inline void __attribute__((always_inline)) lock_wrap() { locker(); if (decision()) { unlocker(); } } static inline void __attribute__((always_inline)) unlock_wrap() { unlocker(); } void lockme() { lock_wr...
/* * 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...
{ (void) recognizer; set_text(window, "Going down for reboot..."); system_task_add_callback(system_reset_callback, NULL); }
static void down_click_handler(ClickRecognizerRef recognizer, Window *window) { (void) recognizer; set_text(window, "Erasing recovery firmware"); system_task_add_callback(erase_callback, (void *)ERASE_RECOVERY_FW); } static void back_click_handler(ClickRecognizerRef recognizer, Window *window) { (void) recog...
bus->hal->clock_speed); // Convert it back to a frequency since the I2C_Init function wants a frequency, not a raw // prescalar value. const uint32_t frequency = prv_prescalar_to_frequency(bus->hal->duty_cycle, ...
if (transfer->direction == I2CTransferDirection_Read) { transfer->state = I2CTransferState_RepeatStart; } else { // Enable TXE interrupt for writing i2c->CR2 |= I2C_CR2_ITBUFEN; transfer->state = I2CTransferState_WriteData; }
break; case I2CTransferState_RepeatStart: // Generate a repeat start i2c->CR1 |= I2C_CR1_START; transfer->state = I2CTransferState_WriteAddressRx; break; case I2CTransferState_WriteAddressRx: // Write the I2C bus address again, but this time in read mode. i2c->DR = t...
/* * 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...
reset_due_to_software_failure()
; } static NORETURN prv_handle_passert_failed(const char* filename, int line_number, uintptr_t lr, const char *expr, const char* fmt, ...) { va_list fmt_args; va_start(fmt_args, fmt); prv_handle_passert_failed_vargs(filename, line_number, lr, expr, fmt, fmt_args); va_end(fmt_args); } void passert_failed...
fine GET_APNG_NAME prv_get_image_name(__func__, 0, "apng") // Used to work around __func__ not being a string literal (necessary for macro concatenation) static const char *prv_get_image_name(const char* func_name, int index, const char *extension) { char *filename = malloc(PATH_STRING_LENGTH); if (index) { sn...
(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(49)))
; // Since loop only equals 2, make sure that huge elapsed time leaves us at final frame status = gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 12345 * 100); cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(88))); #endif } // Tests APNG file with 8-bit color,...
/* * 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 s_clock_is_24h_style; }
void clock_set_24h_style(bool is_24h_style) { s_clock_is_24h_style = is_24h_style; }
F(PREF_KEY_MASK, s_mask); } uint32_t alerts_preferences_get_notification_window_timeout_ms(void) { return s_notif_window_timeout_ms; } void alerts_preferences_set_notification_window_timeout_ms(uint32_t timeout_ms) { s_notif_window_timeout_ms = timeout_ms; SET_PREF(PREF_KEY_NOTIF_WINDOW_TIMEOUT, s_notif_window_...
alerts_preferences_dnd_is_manually_enabled()
<< 0); alerts_dnd_prefs_bitmask |= (alerts_preferences_dnd_is_smart_enabled() << 1); alerts_dnd_prefs_bitmask |= (alerts_preferences_dnd_is_schedule_enabled(WeekdaySchedule) << 2); alerts_dnd_prefs_bitmask |= (alerts_preferences_dnd_is_schedule_enabled(WeekendSchedule) << 3); analytics_set(ANALYTICS_DEVICE_MET...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_context_set_fill_color(ctx, progress_layer->background_color)
; graphics_fill_round_rect(ctx, bounds, corner_radius, GCornersAll); // Draw the progress bar graphics_context_set_fill_color(ctx, progress_layer->foreground_color); graphics_fill_round_rect(ctx, &progress_bar, corner_radius, GCornersAll); #if SCREEN_COLOR_DEPTH_BITS == 1 graphics_context_set_stroke_color(c...
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 License for ...
cl_assert_equal_m(a_tuple->value, b_tuple->value, a_tuple->length)
; a_tuple = dict_read_next(a); b_tuple = dict_read_next(b); } if (b_tuple) { cl_fail("Dictionary `B` contained more tuples than dictionary `A`."); } else if (a_tuple) { cl_fail("Dictionary `A` contained more tuples than dictionary `B`."); } } // Callbacks //////////////////////////////////// s...
ure_reject(PPPControlProtocol *this, struct LCPPacket *bad_packet) { if (ntoh16(bad_packet->length) > pulse_link_max_send_size()) { // Too big to send and truncation will corrupt the packet. // There isn't really anything we can do. PBL_LOG(LOG_LEVEL_ERROR, "Configure...
(this, -1)
; break; case LinkState_Stopped: this->state->restart_count = MAX_CONFIGURE; // fallthrough case LinkState_Opened: prv_send_configure_request(this); // fallthrough case LinkState_RequestSent: case LinkState_AckSent: if (prv_handle_configure_request(this, packet)) { ...
_font(FONT_KEY_GOTHIC_24_BOLD); text_layer_set_font(&data->text_layer, gothic_24_bold); text_layer_set_text_alignment(&data->text_layer, GTextAlignmentCenter); text_layer_set_overflow_mode(&data->text_layer, GTextOverflowModeTrailingEllipsis); } static void click_handler(ClickRecognizerRef recognizer, Window *wi...
GRect(5, 100, 135, 20)
heap->corrupt_block = ptr; return; } UTIL_ASSERT(0); // Error: Heap corrupt around <ptr> } static HeapInfo_t *find_segment(Heap* const heap, unsigned long n_units); static HeapInfo_t *allocate_block(Heap* const heap, unsigned long n_units, HeapInfo_t* heap_info_ptr); //! Advance the block pointer to the next...
UTIL_ASSERT(heap->begin)
; /* Convert the requested memory allocation in bytes to alignment */ /* size. */ unsigned long allocation_size = (nbytes + (ALIGNMENT_SIZE - 1)) / ALIGNMENT_SIZE; /* Add the beginer size to the requested size. */ allocat...
prv_create_test_sequence(&sequence); cl_assert_equal_i(size, gdraw_command_sequence_get_data_size(sequence)); cl_assert(gdraw_command_sequence_validate(sequence, size)); cl_assert(!gdraw_command_sequence_validate(sequence, size - 1)); cl_assert(!gdraw_command_sequence_validate(sequence, size + 1)); cl_assert...
gdraw_command_list_get_command(&frame->command_list, 0)
; cl_assert_equal_i(command->type, GDrawCommandTypePath); cl_assert_equal_i(command->num_points, 3); cl_assert_equal_i(command->stroke_color.argb, GColorRedARGB8); cl_assert_equal_i(command->fill_color.argb, GColorBlackARGB8); cl_assert_equal_i(command->points[0].x, 7); cl_assert_equal_p(gdraw_command_sequ...
/* * 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_database_read(offsetof(TimezoneDatabaseFlashHeader, link_count), &link_count, sizeof(link_count))
e_metric, ARRAY_LENGTH(scrollable_metrics), scrollable_metrics, &s_sports_data, &s_sports_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__sports_pace_long_values(void) { s_sports_data = (SportsData) { ...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_workout_active__sports_hr_z2(void) { s_sports_data = (SportsData) { .current_bpm = 165, .duration_string = "30:00", .distance_string = "5.0", .pace_string = "6:00", }; WorkoutMetricType top_metric = WorkoutMetricType_Duration; WorkoutMetricType middle_metric = WorkoutMetricType_D...
/* * 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...
(cursor, buffer, bytes_written)
; cursor[bytes_written] = '\0'; list->serialized_byte_length += (has_last_terminator ? 1 : 0) + bytes_written; return bytes_written; }
le_metric_layer, &scrollable_metric_bounds); layer_set_update_proc(&active_window->scrollable_metric_layer, prv_scrollable_layer_update_proc); layer_add_child(&active_window->base_layer, &active_window->scrollable_metric_layer); } else if (active_window->layout == WorkoutLayout_TwoSt...
(active_window, workout_data, workout_controller)
; return active_window; } WorkoutActiveWindow *workout_active_create_double_layout(WorkoutMetricType top_metric, int num_scrollable_metrics, WorkoutMetricType *scrollable_metrics, ...
/* * 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_disable_display_spi_clock()
; } //! Write a single byte synchronously to the display. This is the only practical //! way to write to the display in the bootloader since we don't have interrupts. static void prv_display_write_byte(uint8_t d) { // Block until the tx buffer is empty SPI_I2S_SendData(DISP_SPI, d); while (!SPI_I2S_GetFlagStatus...
+ (int32_t)b.x.raw_value) / 2), (int16_t)(((int32_t)a.y.raw_value + (int32_t)b.y.raw_value) / 2)); } GPointPrecise gpointprecise_add(const GPointPrecise a, const GPointPrecise b) { return GPointPrecise(a.x.raw_value + b.x.raw_value, a.y.raw_value + b.y.raw_v...
{ // edge case for non-standardized rects: int16_t temp = max_x; max_x = min_x; min_x = temp; }
int16_t min_y = rect->origin.y; int16_t max_y = rect->origin.y + rect->size.h; if (min_y > max_y) { // edge case for non-standardized rects: int16_t temp = max_y; max_y = min_y; min_y = temp; } return (point->x >= min_x && point->x < max_x && point->y >= min_y && point->y < max_y); ...
/* * 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 s_charging; }
T .qspi_id_value = 0x18BB20, .name = "MT25Q128", #else #error "Unsupported board" #endif }; bool flash_check_whoami(void) { return qspi_flash_check_whoami(QSPI_FLASH); } FlashAddress flash_impl_get_sector_base_address(FlashAddress addr) { return (addr & SECTOR_ADDR_MASK); } FlashAddress flash_impl_get_subsec...
{ return qspi_flash_blank_check(QSPI_FLASH, addr, true /* is_subsector */); }
uint32_t flash_impl_get_typical_sector_erase_duration_ms(void) { return 150; } uint32_t flash_impl_get_typical_subsector_erase_duration_ms(void) { return 50; }
cro. #define PFS_FD(fd) s_pfs_avail_fd[(fd)-FD_INDEX_OFFSET] typedef struct GCBlock { bool block_valid; uint8_t block_writes; uint16_t gc_start_page; } GCBlock; static GCBlock s_gc_block; // This is used by unit tests to clear out static state and simulate a reboot. void pfs_reset_all_state(void) { s_gc...
(page_flags)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_context_set_fill_color(ctx, cl->bg_color)
; graphics_fill_rect(ctx, &layer->bounds); for (int i = cl->level; i > 0; --i) { p.x = xpos + (cl->crumbs_x_increment / i); graphics_context_set_fill_color(ctx, cl->fg_color); graphics_fill_circle(ctx, p, crumb_radius); p.y += crumb_spacing; } } static void prv_crumbs_layer_update_proc_round(Lay...
->id; } // setup and teardown void test_circular_cache__initialize(void) { memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); circular_cache_init(&s_test_cache, (uint8_t *)s_cache_buffer, sizeof(TestCacheItem), NUM_TEST_ITEMS, prv_comparator); for (int i = 0; i < ARRAY_LENGTH(s_test_item); ...
(!(*s_test_item[1].freed))
; cl_assert(!(*s_test_item[2].freed)); memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); *s_test_item[0].freed = false; circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_push(&s_test_cache, &s_test_item[1]); circular_cache_push(&s_test_cache, &s_test_item[2]); circular_cache_flush(&s_...
///////////// void inside_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, 5)); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_pixel(ctx, ...
test_graphics_context_reset(&ctx, fb)
; layer_set_update_proc(&layer, &outside_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_y_layer_update_callback); laye...
sult = health_service_sum(HealthMetricStepCount, time_util_get_midnight_of(now) - SECONDS_PER_DAY, now); cl_assert_equal_i(result, 1000 + 2000); } void test_health__process_range(void) { HealthValue values[4] = {1000, 1000, 1000, 1000}; HealthServiceTim...
{ cl_assert_equal_p(s_health_service.cache, NULL); health_service_events_subscribe(NULL, NULL); HealthServiceCache *const cache = s_health_service.cache; cl_assert(cache != NULL); // cache is preserved health_service_events_subscribe(NULL, NULL); cl_assert_equal_p(s_health_service.cache, cache); healt...
{ 1177, 431, -2}, { 1374, 547, -16}, { 1109, 518, 67}, { 1053, 450, 58}, { 1119, 440, 66}, { 1164, 422, 110}, { 992, 307, 145}, { 851, 194, 182}, { 841, 128, 208}, { 913, 149, 241}, { 865, 184, 206}, { 884, 209, 211}, { 1113, 196, 278}, { 1092, 179, 249}, { 11...
{ 1154, 317, 63}, { 901, 435, -185}, { 918, 342, -82}, { 895, 217, 30}, { 821, 145, 52}, { 771, 217, 46}, { 755, 291, 33}, { 810, 313, 22}, { 825, 300, -13}, { 775, 293, -34}, { 984, 309, -15}, { 1312, 374, -9}, { 1200, 386, 27}, { 1317, 457, 21}, { 1507, 567...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
flash_read_bytes(buffer, FLASH_REGION_FIRMWARE_SCRATCH_BEGIN + offset, chunk_size)
; flash_write_bytes(buffer, FLASH_REGION_SAFE_FIRMWARE_BEGIN + offset, chunk_size); offset += chunk_size; } done: flash_prf_set_protection(true); flash_sleep_when_idle(saved_sleep_when_idle); PBL_LOG(LOG_LEVEL_DEBUG, "Done!"); } #endif void check_prf_update(void) { if (!boot_bit_test(BOOT_BIT_NEW_P...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(" w sector %u", logging_session->storage.write_sector)
; WRITE_LINE(" w offset %"PRIu32, logging_session->storage.write_offset); #undef WRITE_LINE } #endif void command_dls_erase_all(void) { dls_clear(); } void command_dls_send_all(void) { // Use this to trigger a send of all data logging data to the phone, helpful for testing dls_send_all_sessions(); }
{ if (!ctx || !selection_rect || (delta == 0)) { return; } // Move the selection rectangle prv_move_region_of_bitmap_horizontally(&ctx->dest_bitmap, selection_rect, delta); const int16_t abs_delta = (int16_t)ABS(delta); // Move everything above the selection rectangle (if there is anything) and stret...
area_below_selection_rect_height); prv_move_region_of_bitmap_horizontally(&ctx->dest_bitmap, &area_below_selection_rect, -delta); const GRect stretch_rect_below_selection_rect = GRect(0, row_below_selection_rect_bottom, ...
t_palette_1bit__2bit_palette_to_1bit_assign(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt_palette_1bit__2bit_palette_to_1bit.pbi"); bitblt_bitmap_into_bitmap(&s_dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&s_dest_bitmap, "test...
(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_private_get_1bit_grayscale_pattern(GColorBlack, 1), 0x00000000); } void test_bitblt_palette_1bit__prv_apply_tint_color(void) { GColor color = GColorBlack; GColor tinted_color = GColorBlack; ...
lor(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(15, 5)); } void outside_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(-5, 5)); } void outside_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_...
layer_render_tree(&layer, &ctx)
; cl_check(framebuffer_is_empty("outside_nx_y_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_x_ny_offset_layer", ctx.parent...
bg_uart_dma_request_state; static DMARequest DBG_UART_RX_DMA_REQUEST = { .state = &s_dbg_uart_dma_request_state, .stream = &DMA1_STREAM1_DEVICE, .channel = 4, .irq_priority = 0, // no interrupts .priority = DMARequestPriority_High, .type = DMARequestType_PeripheralToMemory, .data_size = DMARequestDataSize...
IRQ_MAP(I2C1_ER, i2c_hal_error_irq_handler, &I2C_MAIN_BUS)
; IRQ_MAP(I2C2_EV, i2c_hal_event_irq_handler, &I2C_2V5_BUS); IRQ_MAP(I2C2_ER, i2c_hal_error_irq_handler, &I2C_2V5_BUS); // VOLTAGE MONITOR DEVICES static const VoltageMonitorDevice VOLTAGE_MONITOR_ALS_DEVICE = { .adc = ADC2, .adc_channel = ADC_Channel_12, .clock_ctrl = RCC_APB2Periph_ADC2, .input = { .gpi...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_context_set_stroke_color(ctx, GColorClear)
; graphics_draw_pixel(ctx, GPoint(5, 5)); } void outside_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(15, 5)); } void outside_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, ...
ActionGroup action_group = { .num_actions = num_actions, .actions = (TimelineItemAction[]) { { .id = 0, .type = TimelineItemActionTypeDismiss, .attr_list = dismiss_action_attr_list, }, { .id = 1, .type = TimelineItemActionTypeOpenWatchApp, .attr_...
("Dismiss", &notif_attr_list)
); AttributeList open_app_action_attr_list = {0}; prv_set_open_app_action(&open_app_action_attr_list, HealthCardType_Activity, &notif_attr_list); const int num_actions = 2; TimelineItemActionGroup action_group = { .num_actions = num_actions, .actions...
/* * 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...
(&t, &time)
; if (time.tm_sec == 0) { // If the phone sets the time, we may actually skip a regular_timer minute callback. Let's // get an idea of how often this happens by logging const time_t now_ts = rtc_get_ticks() / configTICK_RATE_HZ; if ((now_ts - s_last_minute_fire_ts) > MISSING_MINUTE_CB_LOG_THRESHOLD_S)...
ctx, GPoint(0, 3), MAX_NUM_COLS + 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 5), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 9), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3); graphics_draw_horizontal_li...
graphics_draw_vertical_line_dotted(&ctx, GPoint(9, 0), 2)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(11, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); gra...
utc_now - ALG_MINUTE_FILE_MAX_ENTRIES * ALG_MINUTES_PER_FILE_RECORD * SECONDS_PER_MINUTE; time_t oldest_requested_utc = *utc_start; oldest_requested_utc = MAX(oldest_possible, oldest_requested_utc); // Create the context AlgReadMinutesContext context = (AlgReadMinutesContext) { .minute_data = minute...
{ heart_rate = 50; }
} else { record.samples[j].heart_rate_bpm = 0; } record.samples[j].v5_fields.steps = i + 10; } success = prv_write_minute_file_record(&record); if (!success) { break; } system_task_watchdog_feed(); if ((i % 25) == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "wrote ...
bitstream.auto.h" #include "drivers/display/ice40lp.h" #include "drivers/display/ice40lp_definitions.h" #include "system/passert.h" #include "util/delay.h" #include "util/misc.h" #include "util/sle.h" #define CMD_NULL (0) #define CMD_SET_PARAMETER (1) #define CMD_DISPLAY_OFF (2) #define CMD_DISPLAY_ON (3) #define CMD_...
("Display initialized after ")
; dbgserial_print_hex(retries); dbgserial_putstr(" retries."); #ifdef DISPLAY_DEMO_LOOP prv_play_demo_loop(); #endif return; } if (!prv_reset_fpga()) { dbgserial_putstr("FPGA configuration failed."); return; } } // It's taken too many attempts and the FPGA still isn...
{ kino_reel_destroy(image); } data->voice_event_sub = (EventServiceInfo) { .type = PEBBLE_VOICE_SERVICE_EVENT, .handler = prv_voice_event_handler, .context = data }; event_service_client_subscribe(&data->voice_event_sub); prv_disable_select_click(data); } // Mic window unload called last wh...
prv_mic_window_disappear(&voice_window->mic_window.window)
/* * 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...
kino_reel_get_duration(data->from_reel)
; // If we don't have a 'to_reel' then we are looping back to the 'from_reel' so it's okay for // the 'from_reel' to have an infinite duration // // If we have a 'to_reel' then ignore infinite duration requests because we will never get to // it and burn a lot of power along the way! if ((data->...
nt8_t platform_bits_4 = 0x44; // Don't add the platform bits BTBondingID id_4 = bt_persistent_storage_store_bt_classic_pairing(&addr_4, &link_key_4, name_4, NULL); cl_assert(id_4 != BT_BONDING_ID_INVALID); cl_assert_equal_i(fake_shared_prf_storage_get_bt_classic_store_count(), 4); // Update with platform bi...
fake_shared_prf_storage_get_bt_classic_delete_count()
, 4); // Try to read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(!ret); } void test_bluetooth_persistent_storage__delete_bt_classic_pairing_by_addr(void) { bool ret; ...
tings_file_get will clear them on error uint8_t manual_dnd_first_use_complete; bool smart_dnd_first_use_complete; // Migrate the old first use dialog prefs #define RESTORE_AND_DELETE_PREF(key, var) \ do { \ if (settings_file_get(file, key, strlen(key), &var, sizeof(var)) == S_SUCCESS) { \ settings_fi...
settings_file_exists(file, PREF_KEY_VIBE, strlen(PREF_KEY_VIBE))
) { if (!s_vibe_on_notification) { s_vibe_score_notifications = VibeScoreId_Disabled; s_vibe_score_incoming_calls = VibeScoreId_Disabled; } settings_file_delete(file, PREF_KEY_VIBE, strlen(PREF_KEY_VIBE)); } } #endif void alerts_preferences_init(void) { s_mutex = mutex_create(); Settings...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_state_set_rocky_runtime_context(NULL, NULL)
; } double jerry_port_get_current_time (void) { time_t seconds; uint16_t millis; time_ms(&seconds, &millis); return ((double)seconds * 1000.0) + millis; } /* jerry_port_get_current_time */ DEFINE_SYSCALL(bool, jerry_port_get_time_zone, jerry_time_zone_t *tz_p) { if (PRIVILEGE_WAS_ELEVATED) { syscall_ass...
-128, -976}, { 136, -136, -968}, { 136, -136, -976}, { 136, -136, -968}, { 136, -144, -968}, { 136, -136, -968}, { 144, -152, -976}, { 136, -152, -968}, { 144, -144, -976}, { 144, -136, -968}, { 136, -160, -968}, { 144, -144, -976}, { 136, -152, -968}, { 128, -160, -...
{ 112, -144, -976}, { 120, -96, -976}, { 128, -136, -960}, { 88, -144, -1016}, { 112, -144, -1000}, { 136, -112, -944}, { 80, -128, -984}, { 72, -136, -1016}, { 104, -208, -952}, { 88, -200, -1000}, // 89 seconds { 80, -192, -984}, { 104, -184, -968}, { 96, -152, ...
{ 136, -152, -984}, { 128, -168, -968}, { 136, -168, -976}, { 128, -136, -992}, { 136, -184, -960}, { 144, -216, -960}, { 112, -216, -968}, { 128, -216, -968}, { 128, -208, -976}, { 128, -184, -960}, { 128, -192, -976}, { 136, -224, -968}, { 128, -224, -968}, { 1...
-192, -200}, { 880, -232, -224}, { 1392, -96, 24}, // 44 seconds { 1424, 64, -312}, { 1456, 160, -296}, { 1368, 160, -352}, { 984, 192, -344}, { 744, 216, -328}, { 824, 272, -264}, { 1080, 344, -320}, { 1200, 424, -208}, { 1224, 520, -232}, { 1368, 816, -336}, { 9...
{ 1120, 288, -280}, { 1312, 368, -280}, { 1208, 528, -368}, { 1432, 600, -520}, { 1224, 656, -392}, { 1096, 584, -376}, { 1088, 608, -384}, { 1032, 512, -448}, { 1288, 464, -344}, { 1440, 408, -264}, { 1400, 272, -168}, { 1224, 200, -104}, { 1272, 240, -184}, { 13...
{ 1208, 128, -216}, { 992, 40, -320}, { 1096, -152, -352}, // 52 seconds { 744, -328, -224}, { 792, -200, -160}, { 1136, 16, -128}, { 1240, 96, -264}, { 1488, 144, -280}, { 1560, 184, -376}, { 1152, 216, -304}, { 936, 288, -360}, { 1088, 352, -408}, { 1256, 336, ...
s_hrm_subscribed = false; s_abandoned_workout_notification_sent = false; const bool assert_all_unlocked = true; fake_mutex_reset(assert_all_unlocked); workout_service_init(); } void test_workout_service__cleanup(void) { workout_service_stop_workout(); const bool assert_all_unlocked = true; fake_mutex_r...
cl_assert_equal_i(200, active_kcalories)
r_bounceback_animation(Layer *layer, GRect origin) { GRect target = origin; origin.origin.y -= BOUNCEBACK_OFFSET; Animation *animation = property_animation_get_animation( property_animation_create(&s_frame_layer_implementation, layer, &origin, &target)); animation_set_duration(animation, 4 * ANIMATION_FRA...
animation_sequence_create(scroll_up, bounceback, 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...
layer_add_child(window_get_root_layer(&data->window), &data->layer)
; const bool animated = false; app_window_stack_push(window, animated); } static void handle_deinit(void) { BatteryCriticalAppData* app_data = app_state_get_user_data(); gbitmap_deinit(&app_data->bitmap); app_free(app_data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deini...
/* * 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...
(sizeof(FrameBuffer))
; framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); ctx = (GContext){}; // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); re...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Task %s stack has %d bytes free", pcTaskGetTaskName(task), ((int)uxTaskGetStackHighWaterMark(task) * sizeof(StackType_t))); }
ount(), 0); cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), false); } void test_ppogatt__handles_meta_v1(void) { struct { const PPoGATTMetaV1 *meta; TransportDestination expected_destination; } metas[] = { { .meta = &s_meta_v1_hybrid, .expected_destination = Tra...
ppogatt_handle_service_removed(&s_characteristics[0][0], PPoGATTCharacteristicNum)
; const bool can_handle = ppogatt_can_handle_characteristic(s_characteristics[0][PPoGATTCharacteristicData]); cl_assert_equal_b(can_handle, false); } void test_ppogatt__handle_subscribe_to_unknown_characteristic(void) { ppogatt_handle_subscribe(s_unknown_characteristics, BLESubscriptionNotificat...