prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
uintptr_t object_ref, uint16_t value_length, BLEGATTError gatt_error) { PebbleEvent e = { .type = PEBBLE_BLE_GATT_CLIENT_EVENT, .task_mask = ~(gap_le_pebble_task_bit_for_client(client)), .bluetooth = { .le = { .gatt_client = { .subtype = subtype, ...
prv_send_event(data->subtype, data->client, data->obj_ref, gatt_value_length, gatt_err_code)
; } cleanup: list_remove(event->context, (ListNode **)&s_client_event_ctxs[data->client], NULL); kernel_free(event->context); unlock: bt_unlock(); } typedef uint16_t (*HandleAndConnectionGetter)(uintptr_t obj_ref, GAPLEConnection **connection_out); static GattCl...
3 | RCC_APB1Periph_UART4 | RCC_APB1Periph_UART5 | RCC_APB1Periph_I2C1 | RCC_APB1Periph_I2C2 | RCC_APB1Periph_I2C3 | RCC_APB1Periph_CAN1 | RCC_APB1Periph_CAN2 | RCC_APB1Periph_PWR | RCC_APB1Periph_DAC | RCC_APB1Periph_UART7 | RCC_APB1Periph_UART8; const uint32_t apb2_periphs = RCC_APB2Periph_TIM1 |...
if (watchdog_check_reset_flag()) { dbgserial_putstr("Watchdog caused a reset"); }
of(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_second...
(ad_a, advert_terms_a, sizeof(advert_terms_a)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0)
; cl_assert(job_a); assert_ad_data("A"); regular_timer_fire_seconds(1); cl_assert_equal_b(gap_le_is_advertising_enabled(), false); cl_assert_equal_p(s_unscheduled_job, job_a); // Schedule job "B": BLEAdData *ad_b = create_ad("B", NULL); GAPLEAdvertisingJobRef job_b; job_b = gap_le_advert_schedule(ad_...
lar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 5.5, 5.5); cl_assert_fixedS16_3(radius, 3.5); } void test_graphics_circle__grect_polar_calc_values_mode(void) { GPointPrecise center = {}; Fixed_S16_3 radius = {}; GRect r = GRect(0, 0, 144, 168); grect_polar_calc_values(&r, GOv...
(-TRIG_MAX_ANGLE)
, -360); cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_PI / 2), 90); cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_PI / 2), -90); cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_MAX_ANGLE / 2), 180); cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_MAX_ANGLE / 2), -180); cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_PI), 180); cl_assert...
/* * 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_dest_bitmap)
; s_dest_bitmap = NULL; } #define RECT_TEXT_0_0 GRect(0, 0, DISP_COLS, DISP_ROWS) GRangeHorizontal perimeter_for_display_round(const GPerimeter *perimeter, const GSize *ctx_size, GRangeVertical vertical_range, ...
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 the specific language governing p...
bt_test_reset_callback(app_data)
} bt_unlock(); } //! bt_lock is assumed to be taken before calling this function. void bt_driver_handle_le_connection_complete_event(const BleConnectionCompleteEvent *event) { bt_lock(); const BleConnectionParams *params = &event->conn_params; PBL_LOG(LOG_LEVEL_INFO, "LE Conn Compl: addr="BT_DEVI...
PBL_LOG(LOG_LEVEL_INFO, "No intent for connection")
ctx, START_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_inside_origin_layer_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_XY, ...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_point_offset_layer_aa.${BIT_DEPTH_NAME}.pbi"))
; #endif } void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__offset_layer_non_aa(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 10); graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT, END_ON_ORI...
/* * 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...
(keys_out)
; } }
{ 1200, 40, -160}, { 688, -64, -128}, { 944, -64, -104}, { 760, -32, -320}, { 1016, 128, -208}, { 1168, 352, -200}, { 1064, 248, -168}, { 984, 368, -176}, { 1168, 416, -80}, { 1384, 600, -80}, { 1480, 832, 8}, { 1176, 752, -168}, { 920, 1112, 32}, { 832, 1336, 144},...
{ 896, 936, -120}, { 1120, 800, -56}, { 1264, 664, -80}, { 1256, 504, -96}, { 1184, 408, -64}, { 1272, 240, -120}, { 1264, 280, -80}, { 1512, 256, -80}, // 37 seconds { 1424, 200, -24}, { 1264, 232, -48}, { 1296, 224, -88}, { 848, -544, -32}, { 816, -64, -88}, ...
{ 1208, 240, -144}, { 1224, 408, -168}, { 1520, 480, -24}, { 1776, 744, -8}, { 1504, 856, 144}, { 1296, 776, -8}, { 984, 1168, 280}, { 1000, 1208, 360}, { 968, 1096, 288}, { 840, 928, 144}, { 944, 808, 96}, { 1312, 704, 56}, { 1336, 504, -24}, { 1304, 384, -88}, ...
Point s_display_user_offset = {0, 0}; #define PREF_KEY_SHOULD_PROMPT_DISPLAY_CALIBRATION "promptDisplayCal" static bool s_should_prompt_display_calibration = true; #endif #if CAPABILITY_HAS_TIMELINE_PEEK #define PREF_KEY_TIMELINE_SETTINGS_OPENED "timelineSettingsOpened" static uint8_t s_timeline_settings_opened = 0; ...
{ s_quick_launch_back = *pref; return true; }
static bool prv_set_s_quick_launch_setup_opened(uint8_t *version) { s_quick_launch_setup_opened = *version; return true; } static bool prv_set_s_default_watchface(Uuid *uuid) { s_default_watchface = *uuid; return true; } static bool prv_set_s_welcome_version(uint8_t *version) { s_welcome_version = *versio...
{ prv_show_error_dialog(data, i18n_noop("Error occurred. Try again.")); } static void prv_show_connectivity_error_and_exit(VoiceUiData *data) { data->error_count = MAX_ERROR_COUNT; // exit UI after the dialog is shown if (data->show_error_dialog) { const GColor dialog_bg_color = PBL_IF_COLOR_ELSE(GColorLi...
prv_handle_ready_error(data)
; break; default: WTF; } if (event->status != VoiceStatusSuccess) { data->last_session_successful = false; } } static bool prv_handle_dictation_success(VoiceUiData *data, PebbleVoiceServiceEvent *event) { if (data->buffer_size == 0) { // If buffer size is set to 0, the buffer was alloca...
OUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/app_message/app_message_internal.h" #include "applib/app_message/app_message_receiver.h" #include "process_state/app_state/a...
app_inbox_consume(consumer_info)
; // ... only then send the ACK: app_message_inbox_send_ack_nack_reply(session, transaction_id, CMD_ACK); }
EVEL_DEBUG, "Trigger pairing! should_pin_address=%d, no_slave_security_request=%d, auto_acc=%d " "rev_ppogatt=%d", req->should_pin_address, req->no_slave_security_request, req->should_auto_accept_re_pairing, req->is_reversed_ppogatt_enabled); gap_sec_level_t level = G...
if (!prv_get_value(conn_idx, value_handle, data, &length)) { PBL_LOG(LOG_LEVEL_ERROR, "Unexpected handle! %u", value_handle); return; }
ble_error_t e = ble_gatts_send_event(conn_idx, value_handle, GATT_EVENT_NOTIFICATION, length, data); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_send_event: %u", e); } } static att_error_t prv_handle_cccd_write(const ble_evt_gatts_write_req_t *evt) {...
/* * 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...
(REBOOT_REASON_REGISTER_1)
; raw[1] = RTC_ReadBackupRegister(REBOOT_REASON_REGISTER_2); raw[2] = RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_PC); raw[3] = RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_LR); raw[4] = RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_CALLBACK); raw[5] = RTC_ReadBackupRegister(REBOOT_REASON_DROPPED_EVE...
s)) typedef struct SwapLayerDemoData { Window window; StatusBarLayer status_layer; SwapLayer swap_layer; LayoutLayer *layout_layers[NUM_NOTIFS]; uint32_t idx; } SwapLayerDemoData; static LayoutLayer *prv_get_layout_handler(SwapLayer *swap_layer, int8_t rel_position, ...
("Swap Layer")
); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); for (int i = 0; i < NUM_NOTIFS; i++) { TestNotification notif = notifications[i]; AttributeList attr_list = {0}; if (notif.bg_color != GColorClearARGB8) { attribute...
te_app_outbox_subscription_info = (EventServiceInfo) {}; // set to something that is not expected anywhere in the tests: s_last_sent_status = AppOutboxStatusUserRangeEnd; app_outbox_service_init(); app_outbox_init(); } void test_app_outbox__cleanup(void) { app_outbox_service_deinit(); kernel_free(s_test_...
(s_last_message)
); message[i] = s_last_message; } for (uint32_t i = 0; i < max_pending_messages; ++i) { app_outbox_service_consume_message(message[i], AppOutboxStatusSuccess); cl_assert_equal_i(s_num_app_outbox_events_sent, i + 1); assert_sent_cb_last_status(AppOutboxStatusSuccess); } fake_kernel_malloc_mark...
ct" #define PREF_KEY_QUICK_LAUNCH_BACK "qlBack" static QuickLaunchPreference s_quick_launch_up = { .enabled = true, .uuid = UUID_INVALID_INIT, }; static QuickLaunchPreference s_quick_launch_down = { .enabled = true, .uuid = UUID_INVALID_INIT, }; static QuickLaunchPreference s_quick_launch_select = { .enabl...
if (*new_unit >= UnitsDistanceCount) { s_units_distance = UnitsDistance_Miles; return false; }
s_units_distance = *new_unit; return true; }; static bool prv_set_s_backlight_enabled(bool *enabled) { s_backlight_enabled = *enabled; return true; } static bool prv_set_s_backlight_ambient_sensor_enabled(bool *enabled) { s_backlight_ambient_sensor_enabled = *enabled; return true; } static bool prv_set_...
(!(flag_status_register & N25QFlagStatusBit_SectorLockStatus))
; } // This will clear the protection flag error from a previous error. // We call this because the error bits persist across reboots static void prv_clear_flag_status_register(void) { flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_CLEAR_FLAG_STATUS_REG); flash_end_cmd(); } /** * Write up to 1 page (...
SE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under th...
for (unsigned int i = 0; i < 1024 / (sizeof(DataTransferMsg) + sizeof(s_test_frame)); i++) { audio_endpoint_add_frame(s_session_id, s_test_frame, sizeof(s_test_frame)); }
rmConfig *config, void *context); // Private globals static bool s_alarms_enabled = false; static time_t s_next_alarm_time; //! This is only valid when s_next_alarm_time is not 0. static Alarm s_next_alarm; static CronJob s_next_alarm_cron; static AlarmId s_most_recent_alarm_id = ALARM_INVALID_ID; static AlarmConfig ...
{ Uuid *pinid = (Uuid *) &buffer[UUID_SIZE * i]; if (uuid_is_invalid(pinid)) { continue; } alarm_pin_remove(pinid); settings_file_delete(fd, &key, sizeof(key)); success = true; }
} } return success; } // ---------------------------------------------------------------------------------------------- //! Converts an alarm's cron time to its actual alarm time. //! Smart alarms execute earlier than their actual alarm time in order to opportunistically alarm. static time_t prv_get_alarm_tim...
ze * SECONDS_PER_MINUTE); utc_end = time(NULL); uint64_t start_ms = prv_ms(); num_minutes = health_service_get_minute_history(minute_data, k_print_batch_size, &utc_start, &utc_end); uint64_t elapsed_ms = prv_ms() - start_ms; char time_start_text[64]; local_...
prv_display_alert(data->debug_card.dialog_text)
; } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_daily_step_avg(int index, void *context) { HealthAPITestAppData *data = context; prv_daily_metric_avg(data, HealthMetricStepCount, "Steps:"); } // ------------------------------------------...
stributed 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 "debug/power_tracking.h" #include "drivers/mcu.h" #include "drivers/rtc.h" #include "drivers/t...
{ // 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 get a better estimate of our sleep time // // TODO: It would be nice if there was a clean way to actually 'sup...
else { const RtcTicks stop_duration = MIN(xExpectedIdleTime - EARLY_WAKEUP_TICKS, MAX_STOP_TICKS); // Go into stop mode until the wakeup_tick. rtc_alarm_set(stop_duration); enter_stop_mode(); RtcTicks ticks_elapsed = rtc_alarm_get_elapsed_ticks(); vTaskStepTick(ticks_elapsed); ...
el/pbl_malloc.h" #include "popups/phone_ui.h" #include "services/common/analytics/analytics.h" #include "services/common/comm_session/session.h" #include "services/common/phone_pp.h" #include "services/common/system_task.h" #include "services/normal/notifications/alerts.h" #include "services/normal/notifications/ancs/a...
(ANALYTICS_DEVICE_METRIC_PHONE_CALL_TIME)
; } static void prv_handle_incoming_call(const PebblePhoneEvent *event) { // Only 1 call at a time is supported if (s_call_in_progress) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring incoming call. A call is already in progress"); return; } // If we're not on iOS9+, we need to be connected to the mobile app sinc...
led cl_assert(stub_new_timer_is_scheduled(get_dnd_timer_id())); do_not_disturb_set_schedule_enabled(WeekdaySchedule, false); active = do_not_disturb_is_active(); cl_assert(active == false); // Neither schedules enabled, timer should not be scheduled cl_assert(!stub_new_timer_is_scheduled(get_dnd_timer_id())...
(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_enabled(WeekendSchedule) == false); active = do_not_disturb_is_active(); cl_assert(active == false); // First toggles are no-ops in unit ...
; cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, true); cl_assert_equal_i(window1->on_screen, true); window_stack_remove(window1, true); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window_stack_count(app_stack), 0); w...
cl_assert_equal_i(window_stack_count(app_stack), 1)
; cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to the kernel to push a modal window stub_pebble_tasks_set_current(PebbleTask_KernelMain); window_stack_push(modal_stack, window2, true); cl_assert_equal_i(window_stack_count(modal_stack),...
/* * 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_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_detail_card__render_one_heading(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .fill_color = GColorWhite, #if PBL_BW .outline_color = GColorBlack, #endif }...
&p->framebuffer_offset); } } else { // Original SVGs use Red for the stroke, replace it here const GColor8 key_stroke_color = GColorRed; gdraw_command_replace_color(processed_command, key_stroke_color, p->stroke_color); // replace surrounding color gdraw_command_replace_color(processed_comma...
{ #if CAPABILITY_HAS_MASKING const GDrawMask *mask = ctx->draw_state.draw_mask; for (int x = x1.integer; x < x1.integer + width; x++) { graphics_private_raw_mask_apply(output, mask, data_row_offset, x1.integer, 1, *input); input++; output++; } #else memcpy((uint8_t *)output, (uint8_t *...
// Last pixel with blending (don't render first AND last pixel if line length is 1) if (x2.fraction != 0) { graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, *input, x2.integer, (uint8_t)x2.fraction); } } //! Copy vertical lines from the app f...
event)); status_bar_layer->config = (StatusBarLayerConfig){ .foreground_color = GColorWhite, .background_color = GColorBlack, .separator.mode = StatusBarLayerSeparatorModeNone, }; status_bar_layer->title_timer_id = TIMER_INVALID_ID; } StatusBarLayer *status_bar_layer_create(void) { StatusBarLayer...
memset(str, 0 , INFO_TEXT_BUFFER_SIZE)
; if (total > MAX_INFO_TOTAL) { // total is large; display as a percentage itoa_int(current * 100 / total, str, 10); strcat(str, "%"); } else { // display as an X/Y itoa_int(current, str, 10); strcat(str, "/"); char buffer[(INFO_TEXT_BUFFER_SIZE - 1) / 2]; itoa_int(total, buf...
EConnection *const connection) { PBL_LOG(LOG_LEVEL_INFO, "Requesting BLE HRM sharing permission"); BLEHRMSharingRequest *const sharing_request = kernel_zalloc_check(sizeof(*sharing_request)); sharing_request->connection = connection; launcher_task_add_callback(prv_push_sharing_request_window_kernel_main_cb, sha...
{ prv_update_permission(connection, HrmSharingPermission_Declined); prv_disconnect_to_kill_subscription(connection); }
bt_unlock(); analytics_event_ble_hrm(BleHrmEventSubtype_SharingRevoked); } static void prv_revoke_gap_le_connection_for_each_cb(GAPLEConnection *connection, void *unused) { prv_update_permission(connection, HrmSharingPermission_Declined); prv_disconnect_to_kill_subscription(connection); } void ble_hrm_revok...
t %d FPS (%d ms/frame)", fps, frame_period); } app_window_stack_pop_all(false); } static const char *prv_row_texts[] = { "Row 1", "Row 2", "Row 3", "Row 4", "Row 5", "Row 6", }; static uint16_t prv_get_num_rows(struct MenuLayer *menu_layer, uint16_t section_index, void *callback_conte...
menu_layer_set_callbacks(&data->action_list1, NULL, &(MenuLayerCallbacks){ .get_num_rows = prv_get_num_rows, .draw_row = prv_draw_row_1, .get_separator_height = prv_get_separator_height, })
; layer_set_hidden(&data->action_list1.inverter.layer, true); scroll_layer_set_shadow_hidden(&data->action_list1.scroll_layer, true); layer_add_child(&window->layer, menu_layer_get_layer(&data->action_list1)); menu_layer_init(&data->action_list2, &menu_layer_rect); menu_layer_set_callbacks(&data->action_lis...
true, false, false, false, false}; char alarm_day_text_4[32] = {0}; alarm_get_string_for_custom(schedule_4, alarm_day_text_4); cl_assert_equal_s(alarm_day_text_4, "Tuesdays"); bool schedule_5[7] = {false, false, false, true, false, false, false}; char alarm_day_text_5[32] = {0}; alarm_get_string_for_custom...
{ alarm_set_snooze_alarm(); cl_assert_equal_i(s_snooze_timer_timeout_ms, 10 * 1000); cl_assert_equal_i(s_num_alarm_events_put, 0); s_current_minute = 10; cl_assert_equal_i(s_num_alarm_events_put, 1); }
void test_alarm__get_string_for_kind(void) { bool all_caps = false; cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "Every Day"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKDAYS, all_caps), "Weekdays"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKENDS...
number of steps equal to (% 255) of the timestamp of that minute. bool activity_algorithm_get_minute_history(HealthMinuteData *minute_data, uint32_t *num_records, time_t *utc_start) { // Get the current time time_t now = rtc_get_time(); // Get the minute index uint32_...
{ accel_data[j] = (AccelData) { .x = samples[i].x, .y = samples[i].y, .z = samples[i].z, .did_vibrate = false, .timestamp = start_ms }; }
fake_accel_service_invoke_callbacks(accel_data, j); // Advance time fake_rtc_increment_time(1); fake_rtc_increment_ticks(configTICK_RATE_HZ); // Is it time to call the minute callback? utc_secs += 1; if ((utc_secs % 60) == 0) { fake_cron_job_fire(); fake_system_task_callbacks...
title; TimelineItemActionGroup *action_group; ActionChainingMenuSelectCb select_cb; ActionChainingMenuClosedCb closed_cb; void *select_cb_context; void *closed_cb_context; } ChainingWindowData; #if PBL_ROUND static int16_t prv_get_header_height(struct MenuLayer *menu_layer, ...
PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack)
{ 1968, 736, 144}, { 1416, 744, 272}, { 592, 464, 144}, { 696, 288, 80}, { 920, 328, 88}, { 1088, 608, 72}, { 1040, 928, 72}, { 1152, 944, -64}, { 1384, 784, 168}, { 2152, 632, 232}, { 1496, 456, 392}, { 1816, 240, 432}, { 1696, 208, 456}, { 1240, 408, 328}, {...
{ 1888, 920, -88}, // 49 seconds { 1776, 880, 112}, { 1328, 656, 464}, { 608, 376, 160}, { 688, 296, 24}, { 832, 288, -48}, { 1000, 528, -80}, { 1088, 920, -64}, { 1208, 744, 32}, { 1440, 608, 216}, { 2184, 528, 216}, { 1448, 536, 296}, { 1728, 256, 368}, { 16...
h_draw_filled.last_call.path.points, path->points, sizeof(path->points[0]) * path->num_points); } void graphics_fill_rect(GContext *ctx, const GRect *rect) {} void graphics_fill_round_rect_by_value(GContext *ctx, GRect rect, uint16_t corner_radius, GCornerMask corner_m...
cl_assert_equal_point_precise(PP(10.5, 11.5), s_graphics_line_draw_precise_stroked.last_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]); cl_assert_...
VISIBLE_ITEMS + 2] = {}; int num_animations = 0; for (int i = 0; i < TIMELINE_NUM_VISIBLE_ITEMS; i++) { TimelineLayout *layout = layer->layouts[s_visible_items[i]]; if (layout) { GRect frame; prv_get_frame(layer, i + 1, &frame); animations[num_animations++] = prv_create_bounce_back_animat...
((Layer *)&layer->day_separator, true)
; layer_add_child((Layer *)layer, (Layer *)&layer->day_separator); // end-of-timeline indicator // TODO: PBL-21716 Fin icon layout on Spalding prv_get_end_of_timeline_frame(layer, 3, &frame); kino_layer_init(&layer->end_of_timeline, &frame); kino_layer_set_reel_with_resource(&layer->end_of_timeline, RESOUR...
/ attempt to issue another read request assert_result_busy(app_smartstrap_attribute_read(attr)); // trigger the read request to be sent and expect a did_write handler call stub_pebble_tasks_set_current(PebbleTask_KernelBackground); prv_prepare_for_did_write(attr); cl_assert(smartstrap_attribute_send_pending(...
{ // create the attribute SmartstrapAttribute *attr = app_smartstrap_attribute_create(0x1111, 0x2222, 100); // start a write request stub_pebble_tasks_set_current(PebbleTask_App); uint8_t *write_buffer = NULL; size_t write_length = 0; assert_result_ok(app_smartstrap_attribute_begin_write(attr, &write_buf...
prv_prepare_for_did_read(attr, 100); smartstrap_attribute_send_event(SmartstrapDataReceivedEvent, SmartstrapProfileGenericService, SmartstrapResultOk, 0x1111, 0x2222, 100); cl_assert(!s_pending_did_read.active); // destroy the attribute app_smartstrap_attribute_destroy(attr...
.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * l...
(LOG_LEVEL_WARNING, "exceeded max number of crumbs")
; level = max_crumbs; } crumbs_layer->level = level; layer_mark_dirty((Layer *)crumbs_layer); } void crumbs_layer_init(CrumbsLayer *crumbs_layer, const GRect *frame, GColor bg_color, GColor fg_color) { layer_init(&crumbs_layer->layer, frame); crumbs_layer->level = 0; crumbs_layer...
/* * 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...
(1, buf, 10)
/* * 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...
("s1", "Mon Jul 25 2005 20:04:05 GMT-03:00")
; ASSERT_JS_GLOBAL_EQUALS_S("f", "function"); // yes, JerryScript provides some default behavior but it's not what we want ASSERT_JS_GLOBAL_EQUALS_S("s2", "23:04:05.000"); ASSERT_JS_GLOBAL_EQUALS_S("s3", "2005-07-25"); ASSERT_JS_GLOBAL_EQUALS_S("s4", "Mon Jul 25 2005 20:04:05 GMT-03:00"); } void test_rocky_a...
/* * 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...
(Fixed_S16_3_size == sizeof(int16_t))
; test_num = 1 << FIXED_S16_3_PRECISION; num = (Fixed_S16_3){ .integer = 1, .fraction = 0 }; // Test number creation test_num = (int16_t)((float)1 * (1 << FIXED_S16_3_PRECISION)); cl_assert(num.raw_value == test_num); cl_assert((FIXED_S16_3_ONE.raw_value == test_num)); cl_assert(memcmp(&num, &test_num, ...
return (GBitmapDataRowInfo) { .data = (uint8_t*)bitmap->addr + y * bitmap->row_size_bytes, .min_x = 0, // while this is conceptually wrong for .max_x as it should be // (.row_size_bytes / .bytes_per_pixel) - 1 // it's still a valid value as we assume grect_get_max_x(.bounds) <...
if (BITMAP_FORMAT_IS_CIRCULAR_FULL_SCREEN(size, format)) { return DISPLAY_FRAMEBUFFER_BYTES; }
#endif return gbitmap_format_get_row_size_bytes(size.w, format) * size.h; } static bool prv_gbitmap_allocate_data_for_size(GBitmap *bitmap, GSize size, GBitmapFormat format) { if (!bitmap) { return false; } bitmap->row_size_bytes = gbitmap_format_get_row_size_bytes(size.w, format); bitmap->bounds.size....
ce we figure out PBL-20973 void pfs_collect_diagnostic_data(int fd, void *diagnostic_buf, size_t diagnostic_buf_len) { mutex_lock_recursive(s_pfs_mutex); memcpy(diagnostic_buf, &PFS_FD(fd), MIN(diagnostic_buf_len, sizeof(FileDesc))); mutex_unlock_recursive(s_pfs_mutex); } // pass in either 0 or 1 to as argument...
(start_page / PFS_PAGES_PER_ERASE_SECTOR , &free_page)
; garbage_collect_sector(&free_page, start_page, active_sectors); } status_t test_scan_for_last_written(void) { for (uint16_t pg = 0; pg < s_pfs_page_count; pg++) { PageHeader hdr; prv_flash_read((uint8_t *)&hdr.last_written, sizeof(hdr.last_written), prv_page_to_flash_offset(pg) + offsetof(PageHe...
/* * 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...
shared_prf_storage_get_ble_pinned_address(&addr)
) { prompt_send_response_fmt(buf, DISPLAY_BUF_LEN, "\nPinned address: "BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE_PTR(&addr)); } SM128BitKey link_key; uint8_t platform_bits; if (bt_driver_supports_bt_classic()) { if (shared_prf_storage_get_bt_classic_pairing_data(&add...
{ return; } BTBondingID key = prv_get_key_for_bt_classic_addr(bd_addr); bt_persistent_storage_delete_bt_classic_pairing_by_id(key); } bool bt_persistent_storage_get_bt_classic_pairing_by_id(BTBondingID bonding, BTDeviceAddress *address_out, ...
prv_file_set(&ACTIVE_GATEWAY_KEY, sizeof(ACTIVE_GATEWAY_KEY), &bonding, sizeof(bonding))
; bt_persistent_storage_set_unfaithful(true); if (bt_driver_supports_bt_classic()) { bt_driver_classic_update_connectability(); } bt_persistent_storage_set_cached_system_capabilities(NULL); } } bool bt_persistent_storage_get_active_gateway(BTBondingID *bonding_out, ...
------------ void test_ble_ad_parse__ad_and_scan_resp_boundaries(void) { } void test_ble_ad_parse__start_scan_response(void) { BLEAdData *ad = ble_ad_create(); ble_ad_start_scan_response(ad); uint8_t expected_scan_resp_data[] = { 1 /* +1 for Type byte */ + strlen("Pebble 1234"), 0x09, // Local Name, Co...
ble_ad_set_service_uuids(ad, uuid, 14)
, true); ble_ad_destroy(ad); // 15x 16-bit UUIDs does not fit, expect false: ad = ble_ad_create(); cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 15), false); ble_ad_destroy(ad); } void test_ble_ad_parse__set_local_name(void) { BLEAdData *ad; ad = ble_ad_create(); uint8_t expected_ad_data[] = {...
} typedef uint16_t ResourceId; const uint8_t *resource_get_builtin_bytes(ResAppNum app_num, uint32_t resource_id, uint32_t *num_bytes_out) { return NULL; } // setup and teardown void test_gdraw_command_sequence__initialize(void) { } void test_gdraw_command_sequence__cleanup(void) { } size_t prv_create_test...
gdraw_command_sequence_get_frame_by_elapsed(sequence, 15)
; cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(sequence, 1));; cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 44)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 45)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame...
/* * 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; }
// Initialize the tint luminance lookup table if necessary GColor8 tint_luminance_lookup_table[GCOLOR8_COMPONENT_NUM_VALUES] = {}; if (compositing_mode == GCompOpTintLuminance) { gcolor_tint_luminance_lookup_table_init(tint_color, tint_luminance_lookup_table); } const int16_t dest_begin_y = dest_rect.o...
/system_apps/timeline/timeline.h" #include "kernel/pbl_malloc.h" #include "kernel/pebble_tasks.h" #include "kernel/ui/kernel_ui.h" #include "kernel/ui/modals/modal_manager.h" #include "process_state/app_state/app_state.h" #include "services/normal/timeline/actions_endpoint.h" #include "services/normal/timeline/layout_l...
(item_layer->animation)
/* * 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...
while (!REG_GETF(CRG_TOP, SYS_STAT_REG, BLE_IS_UP)) {}
// Start the CW pattern hw_rf_start_continuous_wave(0x1, cmd->tx_channel); } extern void cm_lp_clk_force_available(bool force_available); static void prv_handle_sleep_test_cmd(const HcProtocolMessage *msg) { const HcTestSleep *sleep_test = (HcTestSleep *)&msg->payload[0]; // Dialog gives the 32K clock time...
lude "util/trig.h" #include "util/math.h" // lookup points on the first quarter sin wave // generated by tintin/tools/trigTable.py static const uint16_t SIN_LOOKUP[] = { 0, 401, 801, 1202, 1602, 2002, 2403, 2803, 3203, 3603, 4003, 4403, 4802, 5202, 5601, 6000, 6399, 6797, 7195, 7593, 7991, 8389, 8786, 9182, 9579, 99...
if (angle >= TRIG_MAX_ANGLE) { angle %= TRIG_MAX_ANGLE; }
->app_md), process_metadata_get_name(s_next_app.md), (int)gracefully); // Shouldn't be called from app. Use app_manager_put_kill_app_event() instead. PBL_ASSERT_TASK(PebbleTask_KernelMain); // We have to call this here, in addition to calling it in prv_app_cleanup(), // because the timer c...
uuid_equal(&(app_md->uuid), &(s_app_task_context.app_md->uuid))
) { PBL_LOG(LOG_LEVEL_WARNING, "Ignoring launch for app <%s>, app is already running", process_metadata_get_name(app_md)); app_install_release_md(app_md); return false; } if (process_metadata_get_run_level(app_md) < s_minimum_run_level) { PBL_LOG(LOG_LEVEL_WARNING, "Ignoring la...
; return; } // Got all the data, pass up to parser! prv_reassembly_handle_complete_response(response_data, response_length); } static void prv_put_ancs_message(ANCSAttribute **app_attrs) { ancs_notifications_handle_message(s_ancs_client->queue->uid, s_ancs_client->queue...
{ *request_data_ptr = s_fetched_app_attributes[i].id; request_data_ptr++; }
prv_set_state(ANCSClientStateRequestedApp); bool success = prv_write_control_point_request((const CPDSMessage *) request, request_size); kernel_free(request); if (!success) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to fetch app attributes for notification"); ANCSAttribute *empty_attrs[NUM_FETCHED_APP_AT...
/* * 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...
(reading, 1, 1)
; cl_assert_equal_i(result, 0); } void test_battery__reading_conversion_40_samples(void) { ADCVoltageMonitorReading reading = { .vref_total = prv_convert_millivolts_to_12bit_reading(VREF_VOLTAGE) * 40, .vmon_total = prv_convert_millivolts_to_12bit_reading(1800) * 40 }; uint32_t result = battery_conver...
ard_and_render(&health_data); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_sleep_summary_card__render_sleep_late_start_early_end1(void) { const time_t start_of_today = time_util_get_midnight_of(s_now_utc); HealthData health_data = { // Used for text .sleep_data[0] = (8...
prv_create_card_and_render(&health_data)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_sleep_summary_card__render_sleep_early_start_late_end1(void) { const time_t start_of_today = time_util_get_midnight_of(s_now_utc); HealthData health_data = { // Used for text .sleep_data[0] = (8 * SECONDS_PER_HOUR) + (12 *...
:00:00) rtc_set_time(event_time - (14 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s(" 4:00 PM", time_buf); // June 8th 2015, 16:00:00 (T-48:00:00) rtc_set_time(event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR)); clock_get_until_...
rtc_set_time(jun10th_noon_2015)
; // Our test event is at June 9th 2015, 16:00:00 // Now - one day const time_t event_time = jun10th_noon_2015 - SECONDS_PER_DAY + (4 * SECONDS_PER_HOUR); time_t format_time; clock_set_24h_style(true); // June 9th 2015, 12:00:00 (-07:00:00) format_time = event_time + SECONDS_PER_HOUR; clock_get_month_...
/* * 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_clip(&ctx->draw_state.clip_box, &window->layer.frame)
/* * 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...
music_get_playback_rate_percent()
, 0xAA); } else { cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT); } } static void prv_receive_and_assert_volume_info(bool expect_is_handled) { uint8_t msg[] = { 0x12, 0x33 }; prv_receive_pp_data(msg, sizeof(msg)); PebbleEvent e = fake_event_get_last(); if (expect_is_handled) { cl_assert_equal_i(e.t...
CornersAll); p.x += ctx->draw_state.drawing_box.origin.x; p.y += ctx->draw_state.drawing_box.origin.y; graphics_private_set_pixel(ctx, GPoint(p.x, p.y + radius)); graphics_private_set_pixel(ctx, GPoint(p.x, p.y - radius)); graphics_private_set_pixel(ctx, GPoint(p.x + radius, p.y)); graphics_private_set_pi...
(x0, y0 + x)
, y + 1); } if (quadrant & GCornerTopLeft) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0 - radius, y0), radius + 1); } prv_fill_horizontal_line(ctx, GPoint(x0 - x, y0 - y), x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 - x), y + 1); } if (quadrant & ...
rs, so this is a no-op snprintf(dstbuf, 256, "There are % X lights, the absolute value of % X", 16, -4); cl_assert_equal_s(dstbuf, "There are 10 lights, the absolute value of FFFFFFFC"); // Plus for positive signed // No signed conversion occurs, so this is a no-op snprintf(dstbuf, 256, "There are %+X lights...
(dstbuf, 256, "You know Bagu? %.19s", "Then I can let you cross")
; cl_assert_equal_s(dstbuf, "You know Bagu? Then I can let you "); // Left-align, Space padded minimum + maximum character output snprintf(dstbuf, 256, "You know Bagu? %-25.19s", "Then I can let you cross"); cl_assert_equal_s(dstbuf, "You know Bagu? Then I can let you "); } void test_sprintf__percent_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...
{ AppData *data = app_state_get_user_data(); app_free(data); }
static void s_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* double_tap_test_get_info() { static const PebbleProcessMdSystem s_accel_config_info = { .common.main_func = s_main, .name = "Double Tap Test" }; return (const PebbleProcessMd*) &s_accel...
writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ecompass.h" #include "applib/accel_...
atan2_lookup(-d->x, (d->y * sin_lookup(roll) + d->z * cos_lookup(roll)) / TRIG_MAX_RATIO)
; // solution repeats every 180 degrees if (pitch > (TRIG_MAX_ANGLE / 4)) { // > 90 degrees if (pitch < ((270 * TRIG_MAX_ANGLE) / 360)) { pitch -= (TRIG_MAX_ANGLE / 2); } else { pitch -= TRIG_MAX_ANGLE; } } *rollp = roll; *pitchp = pitch; } static int32_t prv_correct_for_roll_and_pi...
{ -608, 680, 312}, { -616, 680, 328}, { -624, 672, 360}, { -616, 656, 360}, { -624, 680, 352}, { -608, 688, 344}, { -608, 696, 336}, // 86 seconds { -608, 696, 344}, { -608, 704, 312}, { -608, 672, 320}, { -608, 664, 312}, { -608, 664, 328}, { -608, 664, 344}, ...
{ -608, 704, 320}, { -608, 672, 320}, { -600, 672, 336}, { -616, 688, 328}, { -608, 696, 360}, { -608, 696, 328}, { -608, 680, 344}, { -592, 704, 344}, { -608, 696, 328}, { -592, 688, 336}, { -600, 704, 320}, { -600, 672, 352}, { -600, 680, 336}, { -600, 688, 328...
m/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util/math.h" #include "system/version.h" #include <inttypes.h> //! @file debug_db.c //! //! The flash space is divided into multiple files, and those files are further divided into multiple chunks. Every time //! the system boots up a dif...
{ // If we find an unused slot, use that one. We fill in slots from left to right, // so the first one we find when searching left to right is the one we should use. if (file_id[i] == INVALID_FILE_ID) { *current_file_index = i; if (i == 0) { *current_file_id = 0; } else { *...
// Everything was increasing which means everything was in order from oldest to newest // and we need to wrap around. *current_file_index = 0; *current_file_id = get_next_file_id(file_id[DEBUG_DB_NUM_FILES - 1]); } void debug_db_init(void) { // Scan the flash to find out what the two file ids are uint8_t...
; cl_assert(line.height_px == 10); cl_assert(line.width_px == 1 * HORIZ_ADVANCE_PX); // reset line line = (Line) { 0 }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_a...
cl_assert(*word_iter_state.current.start == 'a')
/* * 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...
(fmt_args)
dint.h> // Bootloader images #include "drivers/display/resources/hex_digits.h" #include "drivers/display/resources/dead_face.xbm" #include "drivers/display/resources/empty_bar.xbm" #include "drivers/display/resources/error_url.xbm" #include "drivers/display/resources/pebble_logo.xbm" #define DISP_LINE_BYTES (DISP_COL...
(DISP_LCD_GPIO, &s_disp_gpio_init)
; // Set up a SPI bus on SPI2 SPI_I2S_DeInit(DISP_SPI); SPI_Init(DISP_SPI, &s_disp_spi_init); SPI_Cmd(DISP_SPI, ENABLE); // Hold LCD on GPIO_WriteBit(DISP_LCD_GPIO, DISP_PIN_LCD, Bit_SET); } // Clear-all mode is entered by sending 0x04 to the panel void display_clear(void) { prv_enable_display_access...
ache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is dis...
{ uint8_t msg[] = { 0x12, 0x33 }; prv_receive_pp_data(msg, sizeof(msg)); PebbleEvent e = fake_event_get_last(); if (expect_is_handled) { cl_assert_equal_i(e.type, PEBBLE_MEDIA_EVENT); cl_assert_equal_i(e.media.type, PebbleMediaEventTypeVolumeChanged); cl_assert_equal_i(music_get_volume_percent(), ...
static void prv_receive_and_assert_player_info(bool expect_is_handled) { uint8_t msg[] = { 0x13, 17, 'c', 'o', 'm', '.', 's', 'p', 'o', 't', 'i', 'f', 'y', '.', 'm', 'u', 's', 'i', 'c', 7, 'S', 'p', 'o', 't', 'i', 'f', 'y' }; prv_receive_pp_data(msg, sizeof(msg)); PebbleEvent e = fake_event...
static void prv_draw_circle(GContext *ctx, GDrawCommand *command) { // draw all values of alpha, except fully transparent if ((command->fill_color.a != 0) && (command->radius > 0)) { graphics_context_set_fill_color(ctx, command->fill_color); graphics_fill_circle(ctx, command->points[0], command->radius); ...
{ if (!command || ((command->type != GDrawCommandTypePath) && (command->type != GDrawCommandTypePrecisePath))) { return; } command->path_open = path_open; }
bool gdraw_command_get_path_open(GDrawCommand *command) { if (!command || ((command->type != GDrawCommandTypePath) && (command->type != GDrawCommandTypePrecisePath))) { return false; } return command->path_open; } void gdraw_command_set_hidden(GDrawCommand *command, bool hidden) { if (!comma...
t_failure(&data->window, icon, message, PROGRESS_WINDOW_DEFAULT_FAILURE_DELAY_MS); if (!battery_is_usb_connected()) { vibes_short_pulse(); } } static void prv_progress_window_finished(ProgressWindow *window, bool success, void *context) { AppFetchUIData *data = context; ...
(&data->next_app_args, temp_fetch_args, sizeof(AppFetchUIArgs))
; kernel_free(temp_fetch_args); // Create and set up window progress_window_init(&data->window); progress_window_set_callbacks(&data->window, (ProgressWindowCallbacks) { .finished = prv_progress_window_finished, }, data); window_set_click_config_provider((Window *)&data->window, config_provider); //...
152, 88, 56}, { 1192, 184, -136}, { 1288, 240, -192}, { 1280, 240, -72}, { 1248, 224, -88}, { 1312, 184, -48}, { 1040, 152, -32}, { 968, 112, -96}, { 936, 80, -96}, { 960, 32, -208}, { 1040, -8, -288}, // 34 seconds { 1176, 24, -288}, { 1144, 64, -248}, { 1016, 32...
{ 864, 56, -96}, { 888, 16, -120}, { 904, -16, -128}, { 1088, 32, -216}, { 1320, 0, -232}, { 1632, -24, -328}, { 1336, 56, -224}, { 1008, 104, -264}, { 992, 208, -312}, { 1096, 248, -296}, { 1152, 248, -264}, { 1144, 304, -240}, { 1336, 352, -232}, { 1560, 488, -2...
{ 1664, 496, -152}, { 1144, 664, -224}, { 1552, 584, -384}, { 1024, 544, -352}, { 1192, 488, -288}, { 1184, 408, -208}, // 42 seconds { 1344, 352, -168}, { 1248, 224, -48}, { 1080, 128, 24}, { 1112, 192, -120}, { 1176, 240, -112}, { 1112, 160, 0}, { 1144, 176, -1...
status_layer = &pin_window->status_layer; status_bar_layer_init(status_layer); status_bar_layer_set_separator_mode(status_layer, StatusBarLayerSeparatorModeNone); layer_add_child(&pin_window->layer, &status_layer->layer); const LayoutColors *colors = layout_get_colors((LayoutLayer *)pin_window->item_deta...
timeline_pin_window_init(pin_window, item, time_util_get_midnight_of(rtc_get_time()))
; window_set_window_handlers((Window *)pin_window, &(WindowHandlers) { .load = prv_pin_window_load, .unload = prv_pin_window_unload_modal, }); // Subscribe to pin removal events (handled by timeline app when not modal) pin_window->blobdb_event_info = (EventServiceInfo) { .type = PEBBLE_BLOBDB_EVENT...
errupt uint8_t int_en = (BMI160_INT_EN_0_ANYMOTION_Z_EN | BMI160_INT_EN_0_ANYMOTION_Y_EN | BMI160_INT_EN_0_ANYMOTION_X_EN); prv_read_modify_write(BMI160_REG_INT_EN_0, int_en, int_en); // configure the anymotion interrupt to fire after 4 successcive // samples are over the threhold specified accel_set_s...
{ return s_double_tap_detection_enabled; }
{ s_graphics_draw_line.call_count++; s_graphics_draw_line.last_call = (MockCallRecording){.ctx = ctx, .p0 = p0, .p1 = p1}; } static MockCallRecordings s_graphics_fill_rect; void graphics_fill_rect(GContext *ctx, const GRect *rect) { s_graphics_fill_rect.call_count++; s_graphics_fill_rect.last_call = (MockC...
EXECUTE_SCRIPT(script)
ata *glyph) { return ((glyph->header.width_px * glyph->header.height_px) + (8 - 1)) / 8; } void test_text_resources__initialize(void) { 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_FIXTU...
cl_assert(text_resources_init_font(0, font_fallback, 0, &s_font_info))
/* * 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...
(&dismiss_attr_list, AttributeIdTitle, i18n_get("Dismiss", &notif_attr_list))
; AttributeList end_workout_attr_list = {0}; attribute_list_add_cstring(&end_workout_attr_list, AttributeIdTitle, i18n_get("End Workout", &notif_attr_list)); attribute_list_add_uint32(&end_workout_attr_list, AttributeIdLaunchCode, WorkoutLaunchArg_EndWorko...
/* * 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_timer = new_timer_create(); }
if (s_timer != TIMER_INVALID_ID && !s_app_paused && s_app_started) { bool success = new_timer_start(s_timer, WATCHFACE_TIMEOUT_MS, prv_timeout_expired, NULL, 0 /* flags */); PBL_ASSERTN(success); } } #endif void app_idle_timeout_start(void) { PBL_ASSERTN(s_timer == TIMER_INVALID_ID); s_app_s...
"applib/graphics/graphics.h" #include "applib/ui/content_indicator_private.h" #include "applib/ui/shadows.h" #include "applib/ui/window.h" #include "process_management/app_manager.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include "animation_timing.h" #include <string.h> T_ST...
{ ScrollLayer *layer = applib_type_malloc(ScrollLayer); if (layer) { scroll_layer_init(layer, &frame); } return layer; }
bool scroll_layer_is_instance(const Layer *layer) { return layer && layer->property_changed_proc == scroll_layer_property_changed_proc; } void scroll_layer_deinit(ScrollLayer *scroll_layer) { animation_destroy(property_animation_get_animation(scroll_layer->animation)); content_indicator_destroy_for_scroll_laye...
(HRMSessionRef, sys_hrm_manager_app_subscribe, AppInstallId app_id, uint32_t update_interval_s, uint16_t expire_sec, HRMFeature features)
{ return hrm_manager_subscribe_with_callback(app_id, update_interval_s, expire_sec, features, NULL, NULL); } DEFINE_SYSCALL(bool, sys_hrm_manager_unsubscribe, HRMSessionRef session) { HRM_LOG("Unsubscribing"); bool success = false; mutex_lock_recursive(s_manager_s...
0}, { -160, -120, -992}, { -168, -136, -992}, { -168, -120, -984}, { -168, -144, -992}, { -168, -128, -1000}, { -160, -128, -992}, { -160, -152, -992}, { -184, -168, -968}, { -176, -96, -984}, { -168, -112, -1000}, { -152, -136, -1024}, { -160, -120, -1008}, // 173 se...
{ -168, -128, -984}, { -168, -120, -1000}, { -168, -128, -1008}, { -168, -136, -1000}, { -160, -168, -968}, { -160, -104, -1008}, { -168, -144, -1016}, { -168, -144, -960}, { -176, -72, -968}, { -168, -72, -1016}, // 178 seconds { -176, -160, -1008}, { -152, -208, -98...
// elapsed: 3 minutes { -176, -128, -992}, { -160, -120, -984}, { -160, -120, -992}, { -176, -128, -1000}, { -176, -128, -992}, { -168, -120, -992}, { -160, -136, -992}, { -168, -144, -1000}, { -176, -128, -984}, { -168, -112, -984}, { -168, -128, -992}, { -176, -144...
(success) { prv_show_result_window(data, data->dialog.icon, data->dialog.message, data->dialog.success); } else { prv_cleanup_action_result(data, success); } } static void prv_show_progress_window(void *data_ptr) { ActionResultData *data = data_ptr; data->progress_window = applib_zalloc(sizeof(Progres...
action_chaining_window_push(prv_get_window_stack(data), title, &action_result->action_group, prv_invoke_chaining_action, cb_data, prv_cleanup_chaining_action_menu, cb_data)
yer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_inside_origin_layer"))); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx.p...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS)
sfer.size == 1) { // Last byte, we want to NACK this one to tell the slave to stop sending us bytes. bus->i2c->CR1 &= ~I2C_CR1_ACK; } bus->transfer.state = TRANSFER_STATE_WAIT_FOR_DATA; break; case TRANSFER_STATE_WAIT_FOR_DATA: //This state just ensures that the transition t...
irq_event_handler(&i2c_buses[1])
); } void I2C2_ER_IRQHandler(void) { portEND_SWITCHING_ISR(irq_error_handler(&i2c_buses[1])); } /*------------------------COMMAND FUNCTIONS--------------------------*/ void command_power_2v5(char *arg) { // Intentionally ignore the s_running_count and make it so! // This is intended for low level electrical te...
rite_register(PmicRegisters_INT_MASK_2, ~0); } // Set up 160Hz clock which is used for VCOM. // This setting is a divisor of 16 and a high/low duration of 195us, as // given in the following: 1000000 / (16 * 195 * 2) = ~160Hz static void prv_start_160hz_clock(void) { const uint8_t pwm_high_low_time_us = (195 - 1); ...
prv_set_sd1_voltage()
; prv_start_160hz_clock(); prv_configure_battery_measure(); prv_configure_interrupts(); prv_configure_charging(); // Override OTP setting for 'onkey_lpress_ reset=1' so that we shutdown instead of triggering a // reset on a long button hold prv_set_register_bit(PmicRegisters_REFERENCE_CNTL, 5, false); ...
/* * 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 ((read_result < (int)sizeof(field))) { if (PASSED(read_result) || read_result == E_RANGE) { return E_DOES_NOT_EXIST; } PBL_LOG(LOG_LEVEL_WARNING, "seek_map failed: %d", read_result); return read_result; } else if (field.id == EOF_PERSIST_ID_TAG) { break; } else if ((fou...
} return ((found) ? S_SUCCESS : E_DOES_NOT_EXIST); } static int search_map(SearchCallback callback, void *data) { int fd = prv_pmap_open_debug_wrapper(s_map_filename, OP_FLAG_READ, 0, 0); if (fd < 0) { PBL_LOG(LOG_LEVEL_WARNING, "pmap search (open) failed: %d", fd); return (fd); } int seek_resul...
rtc_get_time()
+ 15 * SECONDS_PER_MINUTE); // Puts us at midnight activity_insights_recalculate_stats(); // Process the midnight rollover logic // Advance to 7:05am and add a sleep session from midnight to 7am rtc_set_time(rtc_get_time() + 7 * SECONDS_PER_HOUR + 5 * SECONDS_PER_MINUTE); // Puts us at 7:05 ...
/* * 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_get_current_callbacks(data)
; if (callbacks->selection_will_change) { callbacks->selection_will_change(callbacks, &new_index->row, old_row); } } static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) { SettingsData *data = context; uint16_t ro...
_lut pointer for the provided res_app_num is non-NULL const TimelineResourceTestAppData *data = prv_get_data_for_app_with_id(res_app_num); return data ? (data->resource_lut != NULL) : false; } uint32_t prv_get_app_resource_id(ResAppNum res_app_num, TimelineResourceId timeline_id, T...
cl_assert(timeline_resources_get_id_system(TIMELINE_RESOURCE_AUDIO_CASSETTE, TimelineResourceSizeSmall, SYSTEM_APP, &res_info))
; cl_assert_equal_i(res_info.res_app_num, SYSTEM_APP); cl_assert_equal_i(res_info.res_id, RESOURCE_ID_AUDIO_CASSETTE_SMALL); // Even if the provided ResAppNum != SYSTEM_APP cl_assert(timeline_resources_get_id_system(TIMELINE_RESOURCE_AUDIO_CASSETTE, TimelineResourceS...
curr_pg); } } else if (page_type_bits_set(page_flags, DELETED_START_PAGE_MASK) && !is_delete_complete(curr_pg)) { PBL_LOG(LOG_LEVEL_WARNING, "Delete of %d did not complete", curr_pg); unlink_flash_file(curr_pg); } } update_last_written_page(); } static void prv_handle_sector_eras...
{ PFSFileChangedCallbackNode *callback_node = (PFSFileChangedCallbackNode *)s_head_callback_node_list; while (callback_node) { if (!strcmp(callback_node->name, file_name) && (callback_node->event_flags & event)) { callback_node->callback(callback_node->data); } callba...
status_t pfs_close(int fd) { mutex_lock_recursive(s_pfs_mutex); int res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; goto cleanup; } File *f = &PFS_FD(fd).file; if (f->is_tmp) { // TODO: For safety, could disallow this op if user has orig file hdl open pfs_remove(f->name);...
C_CTRLMODE_REG, QSPIC_AUTO_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_DMY_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_ADR_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA...
REG_SETF(CACHE, CACHE_CTRL1_REG, CACHE_RES1, 0x0)
; REG_SETF(CACHE, CACHE_CTRL1_REG, CACHE_FLUSH, 0x0); REG_SETF(CACHE, CACHE_LNSIZECFG_REG, CACHE_LINE, 0x0); REG_SETF(CACHE, CACHE_ASSOCCFG_REG, CACHE_ASSOC, 0x2); REG_SETF(CACHE, CACHE_CTRL2_REG, ENABLE_ALSO_QSPIFLASH_CACHED, 0x0); REG_SETF(CACHE, CACHE_CTRL2_REG, ENABLE_ALSO_OTP_CACHED, 0x0); REG_SETF(...
metric(ActivityMetricSleepState, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "sleep state: %d", (int)value); activity_get_metric(ActivityMetricSleepStateSeconds, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "sleep state minutes: %d", (int)(value / SECONDS_PER_MINUTE)); prv_test_end(context, passed); } // -----------------...
(false /* reset_settings */, true /*tracking_on*/, NULL, NULL)
; // Walk a little first prv_feed_steps_min(15); // Sleep for 100 minutes: 20 light, 30 deep, 10 light, 30 deep, 10 light prv_feed_light_sleep_min(20); prv_feed_deep_sleep_min(30); prv_feed_light_sleep_min(10); prv_feed_deep_sleep_min(30); prv_feed_light_sleep_min(10); // We should have no nap sess...
typedef struct FrameBufferState { FrameBuffer *fb; uint32_t row; uint32_t col; uint32_t width; uint32_t height; } FrameBufferState; typedef struct ScreenshotState { CommSession *session; FrameBufferState framebuffer; bool sent_header; } ScreenshotState; static ScreenshotState s_screenshot_state; typ...
if (!state->sent_header) { max_buf_len -= sizeof(ScreenshotHeader); session_len += sizeof(ScreenshotHeader); }
void *buffer = kernel_zalloc(max_buf_len); if (!buffer) { PBL_LOG(LOG_LEVEL_WARNING, "Screenshot aborted, OOM."); prv_send_error_response(session, SCREENSHOT_OOM_ERROR); prv_finish(state); } uint32_t len = prv_framebuffer_next_chunk(&state->framebuffer, max_buf_len, buffer); session_len += len; ...
writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "kino_reel_custom.h" #include "applib...
{ reel->base.impl = &KINO_REEL_IMPL_CUSTOM; reel->canary = CUSTOM_REEL_CANARY; reel->impl = custom_impl; reel->data = data; }
return (KinoReel *)reel; } static bool prv_kino_reel_custom_is_custom(KinoReel *reel) { KinoReelImplCustom *custom_reel = (KinoReelImplCustom *)reel; return (custom_reel->canary == CUSTOM_REEL_CANARY); } void *kino_reel_custom_get_data(KinoReel *reel) { if (!prv_kino_reel_custom_is_custom(reel)) { retur...
("read memory %p %d\n", cmd.addr, cmd.len)
; prv_send_response(cmd.addr, cmd.len); } break; case CoreDumpCmd_ReadRunningThreadInfo: printf("read TI\n"); prv_send_response((uint8_t *)&s_thread_info.ti, sizeof(s_thread_info.ti)); break; case CoreDumpCmd_ReadExtraThreadInfo: printf("read ExtraTB...
_id); settings_file_delete(&file, (uint8_t *)&app_id, sizeof(AppInstallId)); } settings_file_close(&file); } unlock: mutex_unlock_recursive(s_app_cache_mutex); return rv; } //! Asks the app cache to remove 'bytes_needed' bytes of application binaries to free up space //! for other things. status_t...
(s_app_cache_mutex)
; // resource_list now only contains filenames of resource files that don't have corresponding // entries in the app cache. We can safely delete these files. PFSFileListEntry *iter = *resource_list; while (iter) { PBL_LOG(LOG_LEVEL_INFO, "Orphaned resource file removed: %s", iter->name); pfs_remove(ite...
(timer_id != TIMER_INVALID_ID); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(5*60, stub_new_timer_timeout(timer_id) / 1000); } void test_calendar_handle__ongoing_event_added_and_removed(void) { rtc_set_time(15 * 60); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); ...
cl_assert(stub_new_timer_fire(timer_id))
; cl_assert_equal_i(fake_event_get_count(), 6); cl_assert(!prv_get_calendar_ongoing()); cl_assert(!stub_new_timer_is_scheduled(timer_id)); } void test_calendar__handle_non_calendar_pins(void) { // Insert a random pin (non calendar event) cl_assert(timeline_add(&item5)); timeline_event_handle_blobdb_event()...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&qspi_com_config)
; qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write; qspi_com_config.QSPI_ComConfig_IMode = QSPI_ComConfig_IMode_4Line; qspi_com_config.QSPI_ComConfig_Ins = MT25QCommand_ResetEnable; QSPI_ComConfig_Init(&qspi_com_config); prv_wait_for_qspi_transfer_complete(QSPIFlag_ClearTC); QSPI...
0) { sscanf(token + strlen(token) + 1, "%s", state->test_entry.name); } } // If this is a "static AlgDlsMinuteData samples[] = {" line, skip it if (strcmp(token, "static") == 0) { continue; } // Grab a sample if (strcmp(token, "{") == 0) { PBL_ASSERTN(state->test_ent...
strlen(token)
+ 1, "%d", &state->test_entry.len.max); } else if (strcmp(token, "TEST_START_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.value); } else if (strcmp(token, "TEST_START_AT_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.mi...
} unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- // Interfaces towards Transport (reading from the send buffer to actually transmit the data): // -------------------------------------------------------------------------------------------...
prv_put_comm_session_event(true, is_system)
; if (is_system && (session->destination == TransportDestinationHybrid)) { // For Android, if the app is connected, PebbleKit should be // working as well prv_put_comm_session_event(true, false); } return session; } // --------------------------------------------------------------------------------...