prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
size > 0) { steps = ref_accel_data_handler(accel_buf, chunk_size); } steps = ref_finish_epoch(); ref_minute_stats(&orientation, &vmc); PBL_LOG(LOG_LEVEL_DEBUG, "processed %d samples (%d seconds) of data: %d steps", num_samples, num_samples / KALG_SAMPLE_HZ, steps); return steps; } // --------...
strcmp(token, "static")
== 0) { continue; } // Grab a sample if (strcmp(token, "{") == 0) { PBL_ASSERTN(state->test_entry.name[0] != 0); int x, y, z; sscanf(token + strlen(token) + 1, "%d, %d, %d", &x, &y, &z); fflush(stdout); PBL_ASSERTN(state->test_entry.num_samples < ACCEL_SAMPLES_DISCOVER...
equal_i(hr_zone_time_s[HRZone_Zone3], 10); prv_inc_time(10); prv_put_bpm_event(ZONE_0_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10); cl_assert_equal_...
workout_service_frontend_opened()
; prv_inc_time(1 * SECONDS_PER_MINUTE); // Start workout and workout for 5 minutes cl_assert(workout_service_start_workout(ActivitySessionType_Run)); prv_inc_time(5 * SECONDS_PER_MINUTE); // Close app and wait 30 minutes workout_service_frontend_closed(); prv_inc_time(30 * SECONDS_PER_MINUTE); // Mak...
(sizeof(SerializedSendTextContact) * NUM_SEND_TEXT_CONTACTS)) static uint8_t s_send_text_prefs[SEND_TEXT_DATA_LEN]; #define WEATHER_KEY ((uint8_t *)PREF_KEY_WEATHER_APP) #define WEATHER_KEY_LEN (strlen(PREF_KEY_WEATHER_APP)) #define NUM_WEATHER_LOCATIONS (4) #define WEATHER_DATA_SIZE (sizeof(SerializedWeathe...
watch_app_prefs_db_delete(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN)
, S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_get_len(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN), 0); cl_assert_equal_i(watch_app_prefs_db_insert(WEATHER_KEY, WEATHER_KEY_LEN, s_weather_prefs, sizeof(s_weather_prefs)), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_del...
_t ahb3_periphs = RCC_AHB3Periph_FMC | RCC_AHB3Periph_QSPI; const uint32_t apb1_periphs = RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4| RCC_APB1Periph_TIM5 | RCC_APB1Periph_TIM6 | RCC_APB1Periph_TIM7 | RCC_APB1Periph_TIM12 | RCC_APB1Periph_TIM13 | RCC_APB1Periph_TIM14 | RCC_APB1Periph_L...
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE)
; boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 7: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; default: PBL_CROAK("reset loop boot bits overrun"); break; } return false; } static bool prv_check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_...
8, 320, -160}, { 1648, 224, 24}, { 1640, 344, 88}, { 1048, 264, 56}, { 1112, 192, 104}, { 1272, 88, 200}, { 1088, 24, 208}, { 904, 48, 104}, { 816, 40, 48}, { 808, 8, 24}, { 760, -40, 24}, { 688, -72, 48}, { 768, -128, 40}, { 936, -48, -32}, { 1008, -120, -40}, ...
{ 1264, -120, 104}, { 1296, 16, 96}, // 50 seconds { 1512, 288, 0}, { 904, 384, 80}, { 640, 240, 112}, { 728, 176, 160}, { 776, 184, 168}, { 824, 184, 168}, { 928, 240, 88}, { 1008, 352, -88}, { 1152, 328, -88}, { 1304, 304, -24}, { 1776, 352, 96}, { 1544, 440...
{ 960, 56, 232}, { 800, 72, 96}, { 792, 88, 96}, { 792, 88, 64}, { 792, 40, 32}, { 840, -24, 72}, { 984, -72, 56}, // 53 seconds { 952, 24, -48}, { 1240, -80, -24}, { 1544, -32, 72}, { 1176, 288, -120}, { 1224, 288, -176}, { 1136, 200, 48}, { 792, 160, 56}, ...
previous day, display the day separator // by first hiding the pin of the "last" day that is about to come in and placing it there if (layer->layouts[0]) { prv_set_layout_hidden(layer->layouts[0], true); } prv_place_day_separator(layer); } else { // continue to hide the day separator la...
animation_set_custom_interpolation(animation, interpolate_moook_in_only)
; return animation; } static void prv_speed_lines_update(Animation *animation, AnimationProgress progress) {} Animation *timeline_layer_create_speed_lines_animation(TimelineLayer *timeline_layer) { static const AnimationImplementation s_speed_lines_impl = { .update = prv_speed_lines_update, }; Animation ...
// update rect y for the label height if (active_window->layout == WorkoutLayout_TwoStaticAndScrollable) { rect.origin.y += prefer_larger_font ? 11 : 15; } else { rect.origin.y += prefer_larger_font ? 12 : 15; } if (draw_hr_zones) { prv_render_hr_zones(ctx, &rect, active_window); // update rec...
(dialog, true)
; dialog_set_text(dialog, i18n_get("End Workout?", workout_dialog)); dialog_set_background_color(dialog, BACKGROUND_COLOR); dialog_set_text_color(dialog, TEXT_COLOR); dialog_set_icon(dialog, RESOURCE_ID_WORKOUT_APP_END); dialog_set_icon_animate_direction(dialog, DialogIconAnimateNone); dialog_set_destroy_on...
nt is responsible to removing any data that is associated with the layout, including //! itself static void prv_remove_old_layout(SwapLayer *swap_layer, LayoutLayer *layout) { if (!layout) { return; } layer_remove_from_parent((Layer *)layout); if (layout && swap_layer->callbacks.layout_removed_handler) { ...
(cur_frame->origin.y, -96, 66)
|| swap_layer->swap_in_progress; #endif bg_color = layout_get_colors(swap_layer->current)->bg_color; } prv_update_colors(swap_layer, bg_color, color_status_bar); } ///////////////////////// // ARROW LAYER FUNCTIONS ///////////////////////// //! Hides or shows the arrow (or two arrows, on S4) depending on wh...
* 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 in writing, software * distributed u...
GPIO_PinAFConfig(pin_config.gpio, pin_config.gpio_pin_source, pin_config.gpio_af)
; } //! Configure bus pin as input //! Lock bus and peripheral config access before use static void bus_pin_cfg_input(AfConfig pin_config) { // Configure pin as high impedance input GPIO_InitTypeDef gpio_init_struct; gpio_init_struct.GPIO_Pin = pin_config.gpio_pin; gpio_init_struct.GPIO_Mode = GPIO_Mode_IN; ...
= &data[1]; hc_endpoint_enqueue_hci_cmd(hci_cmd, payload_len); kernel_free(hci_data); } //! A barebones HCI CMD parser. Looks for an HCI start byte (0x1) and then //! makes sure the param length is less than the static buffer we have for //! holding a single command. If anything goes wrong, the state machine reset...
(buf, sizeof(buf), "HCI Event:")
ate; } // ------------------------------------------------------------------------------------------------ // Checks the common parameters for a given insight to see if it should be triggered static bool prv_reward_check_common(const ActivityInsightSettings *insight_settings, const ...
(sleep_exit_seconds, SLEEP_SUMMARY_PIN_CONFIG.detail_text, SUBTITLE_BUFFER_LENGTH, &SLEEP_SUMMARY_PIN_CONFIG)
; // Generate short subtitle text with the current step count int hours = sleep_total_seconds / SECONDS_PER_HOUR; int minutes = (sleep_total_seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE; sniprintf(SLEEP_SUMMARY_PIN_CONFIG.short_subtitle, SUBTITLE_BUFFER_LENGTH, i18n_get("%uH %uM Sleep", &SLEEP_...
nt_key_large_numbers = PBL_IF_ROUND_ELSE(FONT_KEY_LECO_32_BOLD_NUMBERS, FONT_KEY_LECO_38_BOLD_NUMBERS); // "disconnected" text const char * const font_key_disconnected = FONT_KEY_GOTHIC_24_BOLD; static const GTextAlignment distance_text_alignment = ...
layer_add_child(background, text_layer_get_layer(text[TextMid]))
_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1); cl_check(gbitmap_pbi_eq(&...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; #endif setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 3); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculati...
/* * 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...
(action_bar)
; return; } } } static void prv_register_redraw_timer(ActionBarLayer *action_bar) { if (!action_bar->redraw_timer) { action_bar->redraw_timer = app_timer_register(MILLISECONDS_PER_FRAME, prv_timed_redraw, action_bar); } } inline static void action_...
ake sure we can receive new data in the middle of a pb_storage_append operation for (int i = 0; i < num_ops; i += 2) { int idx = i * VALID_OBJECT_SIZE; prv_receive_put(s_last_response_cookie, &buffer[idx], VALID_OBJECT_SIZE); idx += VALID_OBJECT_SIZE; memcpy(&s_next_value_to_write, &buffer[idx], VALI...
(VALID_OBJECT_SIZE, ObjectFirmware)
; prv_process_and_reset_test_counters(); prv_receive_install(s_last_response_cookie); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__install_message_too_short(void) { prv_receive_init_put_and_commit_fw_object(); const uint8_t incomplete_install_msg = CmdInstall; prv_receive_data(s_se...
, { 352, 592, 216}, { 408, 704, 224}, { 432, 968, 344}, { 344, 1392, 528}, { 320, 1576, 512}, { 264, 1560, 392}, { 256, 1200, 240}, { 224, 912, 272}, { 304, 872, 248}, { 144, 792, 264}, { 48, 672, 240}, { 64, 480, 160}, { 104, 392, 160}, { 168, 456, 120}, { 17...
{ 160, 1112, 656}, { 256, 1344, 736}, { -24, 1248, 784}, { -48, 1048, 656}, // 35 seconds { -48, 952, 712}, { -80, 904, 672}, { -72, 768, 432}, { 8, 544, 264}, { 8, 448, 240}, { 16, 384, 176}, { 32, 248, 280}, { 136, 576, 336}, { 256, 560, 352}, { 416, 744, 55...
{ 56, 248, 344}, { 280, 848, 272}, { 200, 616, -8}, { -48, 1648, 792}, { -456, 2240, 1088}, { -392, 1272, 1256}, { -304, 976, 712}, { -336, 656, 600}, { -312, 584, 384}, { -120, 464, 256}, // 38 seconds { -8, 304, 232}, { 128, 232, 216}, { 160, 248, 272}, { 1...
values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 4.5, 4.5); cl_assert_fixedS16_3(radius, 4.5); r = GRect(1, 1, 9, 9); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 5, 5); cl_assert_fixedS16_3(radius, 4); r = GRect(2, 2, 8, 8); grect_polar_cal...
cl_assert_equal_i(DEG_TO_TRIGANGLE(0), 0)
rsion 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 distributed on an "...
if (id == BUTTON_ID_BACK) { gpath_rotate_to(&arrow->path, (TRIG_MAX_ANGLE / 2)); gpath_move_to(&arrow->path, GPoint(26, 24)); }
layer_add_child(&data->window.layer, &arrow->layer); } static void prv_handle_init(void) { AppData *data = app_malloc_check(sizeof(AppData)); *data = (AppData) { .seconds_remaining = 10, .buttons_pressed = 0, .test_complete = false, }; app_state_set_user_data(data); Window *window = &data->...
; break; } } // ---------------------------------------------------------------------------------------------- // Set the value of a given metric // The current value will only be overridden if the new value is higher // Historical values can be overridden with any value void activity_metrics_prv_set_metric(A...
(file, &m_info.settings_key, sizeof(m_info.settings_key), &history, sizeof(history))
; for (int i = ACTIVITY_HISTORY_DAYS - 1; i >= 1; i--) { history.values[i] = history.values[i - 1]; } // We just wrapped up yesterday history.values[1] = *m_info.value_p; // Reset stats for today history.values[0] = 0; history.utc_sec = utc_now; ...
rn const char *PREF_KEY_SEND_TEXT_APP; #define SEND_TEXT_KEY ((uint8_t *)PREF_KEY_SEND_TEXT_APP) #define SEND_TEXT_KEY_LEN (strlen(PREF_KEY_SEND_TEXT_APP)) #define INVALID_KEY ((uint8_t *)"thisIsNotAnApp") #define INVALID_KEY_LEN strlen((char *)INVALID_KEY) #define NUM_SEND_TEXT_CONTACTS (5) #define SEND_TEXT_DATA_LE...
watch_app_prefs_db_insert(WEATHER_KEY, WEATHER_KEY_LEN, s_weather_prefs, (data_len - sizeof(SerializedWeatherAppPrefs)))
, E_INVALID_ARGUMENT); } void test_watch_app_prefs_db__insert_remove(void) { cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, sizeof(s_send_text_prefs)), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_delete(SEND_TEXT_K...
calendar__init_with_ongoing_event(void) { cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); rtc_set_time(15 * 60); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert(tim...
rtc_set_time(100 * 60)
/* * 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_ComConfig_InitTypeDef qspi_com_config; QSPI_ComConfig_StructInit(&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_ComCon...
#include "system/passert.h" static bool prv_flash_check_whoami(void) { const unsigned int num_whoami_bytes = 3; prv_set_num_data_bytes(num_whoami_bytes); QSPI_ComConfig_InitTypeDef qspi_com_config; QSPI_ComConfig_StructInit(&qspi_com_config); qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Ind...
reset the // CPU if not fed at least once every 7 seconds), then just coredump now if (s_ticks_since_successful_feed >= (6 * TIMER_INTERRUPT_HZ)) { #if defined(NO_WATCHDOG) PBL_LOG(LOG_LEVEL_DEBUG, "Would have coredumped if built with watchdogs ... enabling lowpowerdebug!"); enable_mc...
task_watchdog_enable_interrupt()
; } void task_watchdog_mask_clear(PebbleTask task) { task_watchdog_disable_interrupt(); s_watchdog_mask &= ~(1 << task); task_watchdog_enable_interrupt(); } void task_watchdog_step_elapsed_time_ms(uint32_t elapsed_ms) { uint32_t timer_ticks = (elapsed_ms * TIMER_CLOCK_HZ) / 1000; timer_ticks += TIM2->CNT; ...
lay_spi_clock() { periph_config_enable(RCC_APB1PeriphClockCmd, DISPLAY_SPI_CLOCK); } static void prv_disable_display_spi_clock() { periph_config_disable(RCC_APB1PeriphClockCmd, DISPLAY_SPI_CLOCK); } static void prv_enable_chip_select(void) { GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET); // required setup t...
(DISP_MODE_WRITE)
; } static void prv_display_write_line(uint8_t line_addr, const uint8_t *line) { // 1-indexed (ugh) 8bit line address (1-168) prv_display_write_byte(prv_reverse_bits(line_addr + 1)); for (int i = 0; i < DISP_LINE_BYTES; ++i) { prv_display_write_byte(prv_reverse_bits(line[i])); } prv_display_write_byte(...
ance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ex...
{ if (id == APP_ID_DEFAULT_WATCHFACE) { static const PebbleProcessMdSystem s_default_watchface_md = { .common.process_type = ProcessTypeWatchface, }; return (const PebbleProcessMd *)&s_default_watchface_md; } else { return launcher_menu_app_get_app_info(); } }
void app_install_release_md(const PebbleProcessMd *md) { } // Stubs /////////////////////////////////////////////////////////// char __APP_RAM__[1024*128]; char __APP_RAM_end__; char __WORKER_RAM__[1024*12]; char __WORKER_RAM_end__; MemorySegment prv_get_app_ram_segment(void) { return (MemorySegment) { __APP_RAM...
onitorDevice VOLTAGE_MONITOR_BATTERY_DEVICE = { .adc = ADC2, .adc_channel = ADC_Channel_1, .clock_ctrl = RCC_APB2Periph_ADC2, .input = { .gpio = GPIOA, .gpio_pin = GPIO_Pin_1, } }; static const VoltageMonitorDevice VOLTAGE_MONITOR_TEMPERATURE_DEVICE = { .adc = ADC1, .adc_channel = ADC_Channel_Tem...
(ICE40LP->spi_port)
; } void board_init(void) { i2c_init(&I2C_PMIC_MAG_BUS); i2c_init(&I2C_MFI_BUS); spi_slave_port_init(BMI160_SPI); voltage_monitor_device_init(VOLTAGE_MONITOR_ALS); voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY); }
btain 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 Licens...
{ if (bt_device_internal_equal(device, &s_connections[i]->device)) { return s_connections[i]; } }
_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a)); animation_get_elapsed(b, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a + duration_a + delay_b)); // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0)...
(start_ms + 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);...
k.h" #include "applib/ui/dialogs/actionable_dialog.h" #include "applib/ui/dialogs/dialog.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/vibes.h" #include "applib/ui/window_manager.h" #include "applib/ui/window_stack.h" #include "drivers/rtc.h" #inclu...
prv_push_first_use_dialog(msg, prv_toggle_manual_dnd_from_settings_menu)
/* * 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...
("Allow All Notifications")
, i18n_noop("Allow Phone Calls Only"), i18n_noop("Mute All Notifications"), }; static const char *prv_alert_mask_to_label(AlertMask mask) { for (uint32_t i = 0; i < NUM_ALERT_MODES_IN_LIST; i++) { if (s_alert_mode_values[i] == mask) { return s_alert_mode_labels[i]; } } return "???"; } static v...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GRect(0, 0, 300, 500)
); } void test_layer_rect__3_x_sync_if_applicable(void) { Layer l; s_process_manager_compiled_with_legacy2_sdk = false; layer_init(&l, &GRect(10, 20, 30, 40)); cl_assert_equal_grect(l.bounds, GRect(0, 0, 30, 40)); // expands layer_set_frame(&l, &GRect(10, 20, 300, 400)); cl_assert_equal_grect(l.bounds,...
request_message, .response = NULL, }; prv_lock(); s_expectations_head = (HcExpectation *) list_prepend((ListNode *)s_expectations_head, &expectation->node); prv_unlock(); return expectation; } static void prv_cleanup_expectation(HcExpectation *expec...
if (endpoint_id >= HcEndpointIDCount) { return NULL; }
return g_hc_protocol_endpoints_table[endpoint_id]; } static void prv_dispatch_message_to_static_handler(HcProtocolMessage *message, bool *should_free) { const HcProtocolMessageHandler handler = prv_get_handler_for_endpoint_id(message->endpoint_id); if (!handler) { PBL_LOG(LOG_LEVEL_ERROR, "No handler for en...
return sizeof(mtu); } static uint8_t prv_handle_conn_params_read(uint16_t conn_idx, uint8_t response_buffer[READ_RESPONSE_BUFFER_SIZE]) { Connection *connection = connection_by_idx_check(conn_idx); BleConnectionParams params; connection_get_conn_params(connection, &par...
prv_handle_trigger_pairing(evt->conn_idx, &request)
; } else if (evt->handle == s_pps_ctx.att_hdl.conn_status_cccd || evt->handle == s_pps_ctx.att_hdl.gatt_mtu_cccd || evt->handle == s_pps_ctx.att_hdl.conn_params_cccd) { response_length = prv_handle_handle_cccd_read(evt->handle, evt->conn_idx, response); } else if (!prv_get_value(evt->c...
= { OTP_HWVER1, OTP_HWVER2, OTP_HWVER3, OTP_HWVER4, OTP_HWVER5 }; #else static const uint8_t OTP_HWVER_SLOT_INDICES[] = {OTP_HWVER1}; #endif static const char DUMMY_SERIAL[MFG_SERIAL_NUMBER_SIZE + 1] = "XXXXXXXXXXXX"; // FIXME: shouldn't the dummy HWVER be 9 X's? static const char DUMMY_HWVER[MFG_HW_VERSION_SIZE ...
(serial, serial_len, &index)
; } else { result = MfgSerialsResultFailIncorrectLength; } mfg_print_feedback(result, index, serial, "Serial"); } void command_hwver_write(const char *hwver) { MfgSerialsResult result; uint8_t index = 0; size_t hwver_len = strlen(hwver); if (hwver_len > 0) { result = prv_mfg_write_hw_version(hw...
/* * 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 0; }
data) { CachedResource *resource = (CachedResource *)found_node; uint32_t resource_id = (uint32_t)data; return (resource->id == resource_id); } static void prv_get_resource(ResAppNum app_num, uint32_t id, ResourceStoreEntry *entry) { if (id < 1) { *entry = (ResourceStoreEntry){0}; return; } mutex...
{ return NULL; }
mutex_lock_recursive(s_resource_mutex); // FIXME PBL-28781: This operation touches flash. Even though this is the cleanest approach // to detect if the resource is a builtin, it is a slow one. We should instead only search // in the builtin table for the resource_ids and if there are no matches, bail early. ...
}, { 1528, 440, 152}, { 1048, 584, 64}, { 1136, 272, 32}, { 1080, 376, -24}, { 1072, 384, -8}, { 1192, 328, 104}, { 1376, 256, 104}, { 1064, 160, 120}, { 1048, -24, 128}, { 1072, -104, 56}, { 1112, -56, 0}, { 1064, 8, 8}, // 27 seconds { 1000, 16, 8}, { 1224, ...
{ 1200, 272, -40}, { 1304, 240, 56}, { 1432, 184, 24}, { 1184, 96, 0}, { 1112, -24, 48}, { 1216, -88, -16}, { 1200, -32, -136}, { 1024, 0, -112}, { 840, -48, -104}, { 920, -152, -64}, { 864, -120, -136}, { 832, -144, -72}, { 1152, -144, 88}, { 1352, 64, -32}, ...
{ 1200, 0, -320}, // 35 seconds { 1008, 48, -280}, { 824, 48, -168}, { 904, 88, -136}, { 1080, 184, -112}, { 1144, 256, -112}, { 1144, 280, -160}, { 1392, 296, -112}, { 1360, 496, -96}, { 936, 408, 16}, { 1120, 392, -24}, { 952, 432, -152}, { 1128, 304, -16}, ...
/* * 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_set_tap_text(data, ++data->count, axis)
; prv_show_thumbsup(data); } static void prv_handle_init(void) { AppData *data = (AppData*) app_malloc(sizeof(AppData)); app_state_set_user_data(data); window_init(&data->window, WINDOW_NAME("Double Tap Test")); window_set_user_data(&data->window, data); window_set_window_handlers(&data->window, &(Window...
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 <stdbool.h> #include <stdint.h> #include <stdio.h> #include <string.h> #include "clar.h" #...
system_flash_erase(FLASH_BASE, 512 KiB, error_in_middle_cb, &countdown)
); cl_assert(flash_locked); cl_assert_(countdown <= 0, "Callback not called enough times"); } void malloc_flash_data(uint32_t size) { flash_data_length = size; flash_written_data = malloc(size * sizeof(uint8_t)); cl_assert(flash_written_data); flash_written_flag = malloc(size * sizeof(bool)); cl_assert(...
cl_assert_equal_i(GColorLightGrayARGB8, gcolor_get_grayscale(GColorLightGray).argb)
; cl_assert_equal_i(GColorDarkGrayARGB8, gcolor_get_grayscale(GColorDarkGray).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_grayscale(GColorYellow).argb); cl_assert_equal_i(GColorBlackARGB8, gcolor_get_grayscale(GColorBlue).argb); cl_assert_equal_i(GColorLightGrayARGB8, gcolor_get_grayscale(GColorTiffan...
d.dialog_text); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_sleep_file_compact(int index, void *context) { ActivityDemoAppData *data = context; // Get sleep file info uint32_t num_records; uint32_t data_bytes; uint32_t minutes; ...
safe_strcat(data->debug_card.dialog_text, prefix, sizeof(data->debug_card.dialog_text))
; // Write start time struct tm local_tm; char temp[32]; localtime_r(&session->start_utc, &local_tm); strftime(temp, sizeof(temp), "%H:%M", &local_tm); safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); // Write end time/elapsed if (deep_sleep) { ...
ged = true; } if (data->to_reel && kino_reel_set_elapsed(data->to_reel, elapsed)) { changed = true; } const int32_t normalized = animation_timing_clip( scale_int32(elapsed, data->duration, ANIMATION_NORMALIZED_MAX)); if (data->normalized == normalized) { return changed; } data->normalized ...
prv_free_list_copy(data)
; if (data->global) { offset = gpoint_sub(GPointZero, data->layer_frame.origin); } offset = gpoint_add(offset, rect.origin); KinoReel *reel = prv_get_current_reel(data); GDrawCommandList *source_list = kino_reel_get_gdraw_command_list(reel); prv_draw_reel_or_command_list_processed(ctx, reel, source_list...
1320, 232, -24}, { 1920, 272, 56}, { 1464, 400, -40}, { 792, 352, -104}, { 912, 296, 0}, { 1104, 192, 168}, { 960, 152, 144}, { 800, 104, 128}, { 752, 168, 88}, { 720, 104, 72}, { 688, 40, 88}, { 744, 72, 40}, { 840, 16, 40}, { 1040, 40, -24}, // 8 seconds { ...
{ 704, 40, 96}, { 720, 48, 80}, { 816, 32, 56}, { 968, -8, 0}, { 1144, 48, 0}, { 1664, -184, 184}, { 1632, 88, 208}, { 1096, 296, -200}, { 920, 224, -280}, { 872, 208, -64}, { 680, 8, 0}, { 736, 88, 64}, { 872, 216, 64}, { 856, 304, -8}, { 832, 288, -96}, ...
{ 1120, 240, -96}, { 1272, 224, -112}, { 1752, 216, 16}, { 1656, 376, 24}, { 936, 368, -72}, { 904, 280, -48}, { 1112, 160, 128}, { 1008, 136, 152}, { 904, 88, 128}, { 848, 96, 152}, { 752, 72, 80}, { 704, 0, 136}, { 704, 0, 112}, { 776, 8, 64}, { 968, -32, -...
CORE_DUMP_SPI_SLAVE_TO_EXT_MASTER(bus, name, _word_mode, pol_mode, _phase_mode, \ _dma_channel) \ const spi_device_config dev_##name = { \ .bus_id = HW_##bus, \ .bus_res_id = RES_ID_##bus, \ .hw_init.smn_role = HW_SPI_MODE_SLAVE, \ .hw_init.cs_pad = { 0, 0 }, \ .hw_init.word_mode = _word_mode,...
prv_timer_get_ticks()
; bool s = (prv_timer_delta(start_ticks, curr_ticks) < delta_ticks); return s; } static void prv_timer_delay_1ms(void) { uint16_t start_ticks = prv_timer_get_ticks(); while (prv_timer_check_delta(start_ticks, TIMER0_1_MS)) {}; } static NORETURN prv_low_power_mode(void) { // Give the host a few seconds to r...
or (unsigned i = 0; i < selection_layer->num_cells; i++) { if (selection_layer->selected_cell_idx == i) { break; } starting_x_offset += selection_layer->cell_widths[i] + selection_layer->cell_padding; } // After the slider is done sliding then active cell is updated and filled in with the // co...
(selection_layer, ctx)
; } if (selection_layer->slide_settle_anim_progress) { prv_draw_slider_settle(selection_layer, ctx); } // Finally the text is drawn over everything prv_draw_text(selection_layer, ctx); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Increment / D...
e_text_frame_height = 0; } } else { icon_frame_size = GSizeZero; } } // We'll reuse this rect to conserve stack space; here it is used as the title text frame GRect rect = (GRect) { .origin = cell_layer_bounds->origin, .size = GSize(cell_layer_bounds_size.w, title_text_frame_height), ...
{ int16_t subtitle_text_frame_origin_y = (int16_t)(title_text_frame_origin_y + title_text_frame_height - subtitle_text_cap_offset); if (icon_align == GAlignLeft) { subtitle_text_frame_origin_y += icon_on_left_title_subtitle_vertical_spacing_offset; } // Reuse rect as the subtitle text fram...
// Draw the title, which we're guaranteed to have room for because otherwise we would have bailed // out at the beginning of this function // Reuse rect as the title text frame rect = (GRect) { .origin = GPoint(cell_layer_bounds_origin_x, title_text_frame_origin_y), .size = GSize(cell_layer_bounds_siz...
/* * 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...
GPoint(-1, -23)
; gdraw_command_frame_draw(ctx, data->pulsing_heart, frame, offset); return; } } static void prv_render_bpm(GContext *ctx, Layer *base_layer) { HealthHrSummaryCardData *data = layer_get_data(base_layer); const int units_offset_y = fonts_get_font_height(data->bpm_font) - fonts_get_font_height(data-...
cess requests until we run into a different command const PutBytesCommand cmd = job->buffer[0]; if (cmd != PutBytesPut) { num_put_jobs = job_idx; break; } token = prv_parse_token(PutBytesPut, (SharedHeader *)job->buffer); if (!prv_do_put((PutRequest *)job->buffer, job->request_length, ...
(s_pb_semaphore)
; if (s_pb_state.timer_id != TIMER_INVALID_ID) { new_timer_delete(s_pb_state.timer_id); } pb_storage_deinit(&s_pb_state.storage, false); prv_deinit_put_job_queue(); s_pb_state = (PutBytesState){}; memset(&s_ready_to_install, 0, sizeof(s_ready_to_install)); } static void prv_expect_init_timeout_cb(voi...
/* * 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...
{ // Truncate if it's more than the max: size_inbound = size_maximum; }
else if (size_inbound == size_maximum) { APP_LOG(LOG_LEVEL_INFO, "app_message_open() called with app_message_inbox_size_maximum()."); APP_LOG(LOG_LEVEL_INFO, "This consumes %"PRIu32" bytes of heap memory, potentially more in the future!", (uint32_t)size_maximum); } if (size_inbound...
neItemActionTypeOpenWatchApp, .attr_list = open_attr_list, }; for (int i = 0; i < num_responses; i++) { ResponseItem *response_item = &response_items[i]; attribute_list_add_cstring(&response_item->attr_list, AttributeIdTitle, i18n_get(response_item->text, pin_attr_list)); ...
("ON AVG")
} return false; } static void prv_sad_watch(uint32_t error_code) { dbgserial_print("SAD WATCH: "); dbgserial_print_hex(error_code); dbgserial_newline(); display_error_code(error_code); static uint8_t prev_button_state = 0; prev_button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK; while (1) ...
display_error_code(0x8badf00d)
; delay_us(200000); display_error_code(0xbad1ce40); delay_us(200000); display_error_code(0xbeefcace); delay_us(200000); display_error_code(0x0defaced); delay_us(200000); display_error_code(0xd15ea5e5); delay_us(200000); display_error_code(0xdeadbeef); delay_us(200000); } #e...
0; i < read_size; i++) { uint8_t want = (offset + i) & 0xff; if (memmap_buffer[i] != want) { char err_buf[80]; prompt_send_response_fmt(err_buf, sizeof(err_buf), "FAIL at ADDR %d Got: %d Wanted %d", (int)offset, (int)memmap_buffer[i], (int)want); brea...
(BOOT_BIT_FW_STABLE)
FlashCRCResponse; typedef struct PACKED { uint8_t region; } FlashFinalizeRequest; typedef FlashFinalizeRequest FlashFinalizeResponse; // they are currently the same typedef struct { bool is_free; bool is_valid; HdlcStreamingContext hdlc_ctx; uint32_t index; union { struct PACKED { ImagingHeade...
(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length)
; return; } prv_send_frame(OPCODE_DISCONNECT, NULL, 0); prv_stop(NULL); } static void prv_handle_reset_request(const void *payload, uint32_t length) { if (length) { // should be 0 PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } PBL_LOG(LOG_LEVEL_WARNING, "Got res...
n = comm_session_open(transport, &s_transport_imp, // TransportDestinationSystem); fake_comm_session_init(); Transport *transport = fake_transport_create(TransportDestinationSystem, NULL, prv_transport_sent_data_cb); s_sessio...
fake_system_task_callbacks_invoke_pending()
; } // This should fill up the file system int bytes_per_session = 2 * DLS_TOTAL_STORAGE_BYTES / num_sessions; for (int i = 0; i < num_sessions; i++) { prv_log_random_data(logging_sessions[i], item_size, bytes_per_session); } // Check the total capacity, it should be no more than DLS_TOTAL_STORAGE_BYT...
_out = state->hr.metrics.previous_median_bpm; } if (heart_rate_total_weight_x100_out) { *heart_rate_total_weight_x100_out = state->hr.metrics.previous_median_total_weight_x100; } } // -------------------------------------------------------------------------------------------- void activity_metrics_prv_reset_...
(cur_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL)
; } else { new_history.values[i] = ROUND(full_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL); } } } // Copy values from old history into correct slot in new history for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { int new_index = i + old_age; ...
/* * 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_get_window(layer))
; // This is the background image's circle. #if PLATFORM_ROBERT || PLATFORM_CALCULUS const unsigned int center_of_circle_y_val = 103; #else const unsigned int center_of_circle_y_val = PBL_IF_RECT_ELSE(72, layer->bounds.size.h / 2); #endif const unsigned int radius_of_path = 37; const unsigned int radius_of_s...
"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOU...
{ PBL_ASSERTN(message->message_length >= sizeof(HcProtocolMessage)); if (!prv_update_enqueue_count(true)) { return false; } bool success = true; // Retry for 500ms TickType_t start_ticks = xTaskGetTickCount(); while (1) { HostTransportEnqueueStatus status = host_transport_tx_enqueue((...
qual_b(music_needs_user_to_start_playback_on_phone(), true); // Received metadata // cl_assert_equal_b(music_needs_user_to_start_playback_on_phone(), false); // Metadata cleared cl_assert_equal_b(music_needs_user_to_start_playback_on_phone(), true); } // Tests: music_request_..._latency //////////////////////...
prv_connect_ams()
; // Receive volume of 0.604925 // 00 02 00 30 2e 36 30 34 39 32 35 ...0.604 925 uint8_t volume_update[] = { 0x00, 0x02, 0x00, 0x30, 0x2e, 0x36, 0x30, 0x34, 0x39, 0x32, 0x35, }; prv_receive_entity_update(volume_update, sizeof(volume_update)); cl_assert_equal_i(music_get_volume_pe...
24, 832, -8}, { -1256, 800, -72}, { -1568, 720, 224}, { -1104, 728, -24}, { -1368, 704, 168}, { -1648, 624, 336}, { -1536, 720, 328}, { -1320, 432, 352}, { -1104, 304, 336}, { -856, 240, 248}, { -672, 160, 216}, { -504, 160, 336}, { -384, 24, 304}, { -496, 400, -224},...
ARRAY_LENGTH(samples)
; return samples; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ceil_log_two(flash_size)
- 1; PBL_ASSERTN(flash_size == (uint32_t)1 << ceil_log_two(flash_size)); // Init QSPI peripheral QSPI_InitTypeDef qspi_config; QSPI_StructInit(&qspi_config); qspi_config.QSPI_SShift = QSPI_SShift_HalfCycleShift; // QSPI clock = AHB / (1 + QSPI_Prescaler) qspi_config.QSPI_Prescaler = prescaler - 1; qsp...
{ SwapLayerDemoData *data = context; data->idx = 0; swap_layer_reload_data(&data->swap_layer); } static void prv_click_config_provider(void *context) { SwapLayerDemoData *data = context; window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_single_click_handler); window_long_click_subscribe(BUTTON_ID...
(window, animated)
; } //////////////////// // App boilerplate static void s_main(void) { handle_init(); app_event_loop(); } const PebbleProcessMd* swap_layer_demo_get_app_info() { static const PebbleProcessMdSystem s_app_info = { .common = { .main_func = s_main, // UUID: 12a32d95-ef69-46d4-a0b9-854cc62f97f9 ...
, dest_color).argb; break; } case GCompOpTintLuminance: { const GColor actual_color = gcolor_perform_lookup_using_color_luminance_and_multiply_alpha( src_color, tint_luminance_lookup_table); dest[dest_x] = gcolor_alpha_blend(actual_color, dest_co...
{ src_y = src_begin_y; }
const GBitmapDataRowInfo dest_row_info = gbitmap_get_data_row_info(dest_bitmap, dest_y); uint8_t *dest = dest_row_info.data; const int16_t dest_delta_begin_x = MAX(dest_row_info.min_x - dest_rect.origin.x, 0); const int16_t dest_begin_x = dest_delta_begin_x ? dest_row_info.min_x : dest...
ef) &l); cl_assert_equal_p(l.flow_data.perimeter.impl, NULL); } // just a fake value to have something to compare against const GPerimeter * const g_perimeter_for_display = (const GPerimeter *) &g_perimeter_for_display; void test_text_layout__enable_text_flow(void) { TextLayoutExtended l = {}; graphics_text_att...
cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX)
; if (!process_manager_compiled_with_legacy2_sdk()) { // 3 lines - but not 4, since the fourth has no chance of appearing ("Jr\nWho-\npper\n 123") cl_assert_equal_i(layout.max_used_size.h, 3 * (FONT_HEIGHT + (FONT_LINE_DELTA - 1))); } else { cl_assert_equal_i(layout.max_used_size.h, 3 * FONT_HEIGHT); ...
ARAM // Should not get re-requested prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); cl_assert_equal_i(s_num_requested_notif_attributes, 1 ); cl_assert_equal_i(s_num_ds_notifications_received, 1); ns_notification.uid = comple_dict_uid; prv_fake_receiving_ns_notifica...
prv_cmp_last_received_notification(&s_unknown_app_unique_title_parsed_item)
; // Test an MMS without a caption prv_send_notification_with_event_flags((uint8_t *)&s_mms_no_caption_dict, EventFlagMultiMedia); prv_cmp_last_received_notification(&s_mms_no_caption_parsed_item); // Test an MMS with a caption prv_send_notification_with_event_flags((uint8_t *)&s_mms_with_caption_dict, Even...
diagram) const uint16_t flip_overlap_region_width = DISP_COLS / 4; // Flip halfway through the animation const uint32_t flip_distance = ANIMATION_NORMALIZED_MAX / 2; if (distance_normalized < flip_distance) { const int16_t flip_boundary_from_x = DISP_COLS; const int16_t flip_boundary_to_x = display_cen...
prv_configure_round_flip_transition_animation(animation, CompositorTransitionDirectionRight)
ight_march_3_utc, .duration = MINUTES_PER_DAY, .type = TimelineItemTypePin, .layout = LayoutIdTest, .all_day = 0, // this is a non-all-day event spanning 24h }, }; cl_assert(timeline_add(&all_day_item)); Iterator iterator = {}; TimelineIterState state = {}; TimelineNode *head = N...
(timeline_init(&head), S_SUCCESS)
; // 1425272400 is 21:00 March 1 2015 PST cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1425272400), S_SUCCESS); time_t midnight_march_2_pst = 1425283200; // day 1 cl_assert(uuid_equal(&state.pin.header.id, &multiday_item.header.id)); cl_assert(uuid_equal(&...
_PERIPHERAL_TASK_PRIORITY (tskIDLE_PRIORITY + 1) /////////////////////////////////////////////////////////////////////////////////////////////////// // Defines to configure the different test scenarios (enable only one) ////////////////////////////////////////////////////////////////////////////////////...
(evt->conn_idx, &conn_evt->is_resolved, &conn_evt->irk)
; hc_endpoint_gap_le_connect_send_connection_complete(&event); } static void prv_handle_conn_param_update_request_response( const ble_evt_gap_conn_param_update_completed_t *event) { // This callback getting invoked means that conn param request was acknowledged. Could be either // successful or not. If a fa...
creen. cl_assert(layer->frame.origin.y < DISP_ROWS); // Peek service hides the peek UI. Not animated for this unit test. prv_set_timeline_item(NULL, false /* animated */); // Peek should now be off-screen. cl_assert(layer->frame.origin.y >= DISP_ROWS); } void test_timeline_peek__peek_visible_to_hidden_outsi...
cl_assert(layer->frame.origin.y < DISP_ROWS)
te/app_state/app_state.h" #include "services/common/new_timer/new_timer.h" #include "services/common/regular_timer.h" #include "system/logging.h" #include "system/passert.h" #include "util/size.h" #define NUM_MAX_TIMERS 10 // ================================================================================= // Applic...
PBL_LOG(LOG_LEVEL_DEBUG, "STT deleting previous regular timer %d", i)
; regular_timer_remove_callback(&s_app_data->reg_timers[i]); s_app_data->reg_timers[i].cb = NULL; } } } // ================================================================================= void single_shot_timer_menu_cb(int index, void *ctx) { uint32_t zero_flags = 0; uint32_t expire_ms; int ...
CKGROUND_COLOR); window_set_window_handlers(window, &(WindowHandlers){ .unload = prv_window_unload_handler, }); GRect base_layer_bounds = window->layer.bounds; #if PBL_RECT base_layer_bounds.size.w -= ACTION_BAR_WIDTH; #endif base_layer_bounds.origin.y = STATUS_BAR_LAYER_HEIGHT; layer_init(&active_win...
action_bar_layer_add_to_window(action_bar, window)
; active_window->heart_icon = gbitmap_create_with_resource(RESOURCE_ID_WORKOUT_APP_HEART), active_window->hr_measuring_icon = gbitmap_create_with_resource(RESOURCE_ID_WORKOUT_APP_MEASURING_HR), active_window->action_bar_start = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_START); activ...
GPoint(10, 15) #define CENTER_OF_OFFSET_RECT_NXNY GPoint(0, 5) void test_graphics_stroke_circle_${BIT_DEPTH_NAME}__offset_layer_aa(void) { #if SCREEN_COLOR_DEPTH_BITS == 8 GContext ctx; test_graphics_context_init(&ctx, fb); // Big circles setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP,...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL)
; graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_bottom_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, S...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
property_animation_set_to_grect(prop_animation, &window_to_end)
frame/bounds // and no, we don't need to check for l->window != NULL as &l->window->layer is just an offset // (an offset of 0 to be precise) if (&layer->window->layer == layer) { break; } // follow how the drawing_box is computed to obtain the global frame // see \ref layer_render_tree ...
{ return true; }
parent = parent->parent; } return false; }
1 * SECONDS_PER_MINUTE, 0, 0, 0, 0})); } // -------------------------------------------------------------------------------------- // Save the current settings file format with known data to the local file system so that it can // be checked in and used for migration tests. static void...
(pfs_name)
/* * 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_REGION_MFG_INFO_BEGIN, FLASH_REGION_MFG_INFO_END - FLASH_REGION_MFG_INFO_BEGIN)
/* * 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 font_cache->offset_table_size; }
size_t num_bytes, offset, num_entries; const uint8_t version = FONT_VERSION(font_res->md.version); if (version == FONT_VERSION_1) { offset = s_font_md_size[FONT_VERSION_1]; num_bytes = font_res->md.number_of_glyphs * prv_offset_table_entry_size(&font_res->md); num_entries = font_res->md.number_of_gl...
nt16_t y1, int16_t y2, GColor color); static void prv_draw_vlines_in_rect(GContext *ctx, HLinePatternDrawFunction draw_func, const GRect *rect, GColor color) { for (int16_t x = 0; x < rect->size.w; x++) { draw_func(ctx, rect->origin.x +...
(&ctx, fb)
; setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_blend_horizontal_line_raw); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_blend_horizontal_line_raw"))); }; void prv_assign_ho...
20, 1160, 424}, { -872, 680, 456}, { -1120, 424, 232}, { -1416, 512, -56}, { -2152, 480, -56}, { -1904, 808, 456}, { -712, 688, -296}, { -1504, 344, -96}, { -1488, 616, 24}, { -1248, 760, -128}, { -1368, 768, -208}, { -872, 616, -72}, // 18 seconds { -1144, 584, -160}...
{ -1176, 264, 224}, // 23 seconds { -1192, 304, 240}, { -1232, 424, 184}, { -1224, 336, 376}, { -1248, 608, 512}, { -1112, 560, 736}, { -936, 672, 384}, { -1136, 912, 352}, { -928, 776, 408}, { -1192, 616, 264}, { -1528, 528, 344}, { -1752, 384, 312}, { -1616, 272...
{ -1696, 328, 344}, { -1384, 216, 208}, { -1208, 168, 240}, { -1208, 136, 248}, { -1224, 152, 248}, { -1120, 144, 240}, { -1152, 72, 280}, { -1432, 0, 312}, { -1352, -272, 336}, { -1296, -304, 200}, { -1600, 368, -184}, // 26 seconds { -1312, 280, -200}, { -1352,...
fs.h" #include "services/normal/notifications/alerts_preferences_private.h" #include "services/normal/settings/settings_file.h" #include <stdint.h> #include <string.h> #include "clar.h" // Stubs #include "stubs_alerts.h" #include "stubs_analytics.h" #include "stubs_app_state.h" #include "stubs_dialog.h" #include "st...
do_not_disturb_set_schedule_enabled(WeekendSchedule, false)
; if (do_not_disturb_is_smart_dnd_enabled()) { do_not_disturb_toggle_smart_dnd(); } alerts_preferences_check_and_set_first_use_complete(FirstUseSourceSmartDND); s_event_ongoing = false; s_num_dnd_events_put = 0; } void test_do_not_disturb__cleanup(void) { // Make sure we start in a common state: ever...
und them. Using memset to set the bezel to // black and using memcpy to copy the app framebuffer into the center is the fastest method // (significantly faster than DMA even). We only support the app framebuffer being smaller than // the system framebuffer and we assume the system framebuffer is always DISP...
if (s_deferred_render.transition_start.pending) { s_deferred_render.transition_start.pending = false; compositor_transition(s_deferred_render.transition_start.compositor_animation); }
} static void prv_compositor_flush(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // Stop the framebuffer_prepare performance timer. This timer was started when the client // first posted the render event to the system. compositor_display_update(prv_handle_display_update_complete); } static void prv_send_d...
0, 40, 10), 4)); } void test_graphics_context_${BIT_DEPTH_NAME}__draw_stroke_width_2(void) { // Stroke width 2, non-antialiased setup_test(&context, false, 2, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, ...
(&context, &GRect(20, 80, 40, 10), 4)
; #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRect(20, 80, 40, 10), 4, 2)); #else ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, 2)); #endif } void test_graphics_context_${BIT_DEPTH_NAME}__draw_antialiased_stroke_width_even(void) { // Stroke width even >...
(i, item_size)
; int64_t got; if (j == -1) { got = analytics_heartbeat_get(heartbeat, metric); } else { got = analytics_heartbeat_get_array(heartbeat, metric, j); } printf("Expected %"PRIx64", got %"PRIx64" (item_size=%"PRIu32")\n", expected, got, item_size); cl_assert(got == expected); } void test_analytic...
{ 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, { 0, 0x8c, 0}, // 120: Local time: 09:29:00 PM { 0, 0x8c, 0}, { 0, 0x8c, 0}, ...
{ 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, // 270: Local time: 11:59:00 PM { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0},...
{ 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, // 345: Local time: 01:14:00 AM { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}, { 0, 0x8b, 0}...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, &data->progress_bar, fill_color, start, end)
; } } static void prv_render_typical_markers(GContext *ctx, HealthSleepSummaryCardData *data) { // Some time fuzz is applied to a couple values to ensure that typical fill touches the sleep // sessions (needed because of how our fill algorithms work) const int time_fuzz = (2 * SECONDS_PER_MINUTE); const int...
d event) fake_notification_storage_set_existing_ancs_notification(&(Uuid)UUID_SYSTEM, UINT32_MAX); prv_send_notification((uint8_t *)&s_complete_dict); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); cl_assert_equal_i(fake_notification_storage_get_store_count(), 2); cl_asse...
(fake_kernel_services_notifications_ancs_notifications_count(), 1)
; } void test_ancs__notification_dismissal(void) { NSNotification ns_notification = { .event_id = EventIDNotificationRemoved, .event_flags = 0, .category_id = CategoryIDSocial, .category_count = 1, }; // Notification removal without DIS service - notification shouldn't be acted upon prv_fake_r...
/* * 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...
{ const uint32_t num_overrides = ARRAY_LENGTH(s_override_table); for (uint32_t i = 0; i < num_overrides; i++) { AppInstallId cur_id = s_override_table[i].install_id; if (cur_id == app_id) { const bool should_move = (!s_override_table[i].move_on_activity || app_install_i...
static int prv_app_override_comparator(AppInstallId app_id, AppInstallId new_id) { return (prv_override_index(app_id) - prv_override_index(new_id)); } static int prv_comparator_ascending_zero_last(unsigned int a, unsigned int b) { return ((a != 0) && (b != 0)) ? (b - a) : // Sort in ascending order ...
icense. */ #include "applib/graphics/graphics_circle.h" #include "util/trig.h" #include "clar.h" #include "pebble_asserts.h" #include <stdio.h> // stubs #include "stubs_process_manager.h" #include "stubs_passert.h" #include "stubs_logging.h" #include "stubs_app_state.h" #include "stubs_heap.h" GBitmap* graphics_c...
(container_rect1, mode, 0, GSize(3, 5))
; cl_assert_equal_grect(resulting_rect1, GRect(3, -2, 3, 5)); // Container rect is offset from GPointZero const GRect container_rect2 = GRect(2, 2, 4, 4); const GRect resulting_rect2 = grect_centered_from_polar(container_rect2, mode, 0, GSize(2, 4)); cl_assert_equal_grect(resulting_rect2, GRect(3, 0, 2, 4));...
pulatedEntry) { // Struct that is written is currently unpopulated. Set it up and write // the struct's Magic and Version prv_write_to_current_page(data, true); } else if ((old_crc == new_crc) && same_data) { // We are trying to write the same data, ignore the write goto cleanup; } else if (old_...
(data, local_name)
; if (!rv) { goto unlock; } if (local_device_name_out) { strncpy(local_device_name_out, data.name, max_size); local_device_name_out[max_size - 1] = 0; } // Is not zero length? rv = (data.name[0] != 0); } unlock: prv_unlock(); return rv; } void shared_prf_storage_set_l...
de(int duration_s, void *i18n_owner, GFont number_font, GFont units_font, GColor color, GTextNodeContainer *container) { int hours; int minutes; ...
{ const int conversion_factor = health_util_get_distance_factor(); health_util_convert_fraction_to_whole_and_decimal_part(distance_m, conversion_factor, whole_part, decimal_part); }
= 1, .attributes = &title_attr, }, }; // not a calendar pin static TimelineItem s_weather_item = { .header = { .id = { 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, .timestamp = 10 * SECONDS_PER_MINUTE, .duration = 10, .type = Time...
stub_new_timer_cleanup()
; fake_settings_file_reset(); } // Tests //////////////////////////////////////////////////////////////// typedef struct AddEventParams { TimelineItem *item; } AddEventParams; #define ADD_EVENT(...) ({ \ AddEventParams params = { __VA_ARGS__ }; \ cl_assert(timeline_add(params.item)); \ timeline_event_handl...
0, 184, -912}, { 32, 208, -904}, { 32, 176, -920}, { 40, 192, -912}, { 48, 312, -928}, { 32, 112, -896}, { 48, 152, -912}, { 32, 272, -944}, { 40, 160, -896}, { 56, 216, -896}, { 48, 144, -928}, { 48, 192, -904}, { 24, 64, -912}, { 40, 64, -896}, // 155 seconds ...
{ 48, 120, -912}, { 48, 128, -912}, { 48, 104, -920}, { 48, 104, -912}, { 48, 120, -920}, { 48, 120, -920}, { 48, 144, -928}, { 40, 120, -912}, { 48, 120, -920}, { 40, 128, -928}, { 48, 136, -920}, { 48, 136, -920}, { 56, 136, -912}, { 32, 88, -920}, // 161 se...
{ 48, 152, -936}, { 32, 120, -904}, { 40, 112, -920}, { 40, 136, -912}, { 40, 128, -912}, { 40, 144, -928}, { 32, 128, -920}, { 32, 136, -928}, { 32, 128, -928}, { 32, 144, -920}, { 40, 152, -912}, { 32, 144, -912}, { 32, 136, -920}, { 48, 136, -896}, { 48, 1...
s_line_draw_precise_stroked(GContext* ctx, GPointPrecise p0, GPointPrecise p1) { record_mock_call(s_graphics_line_draw_precise_stroked) { .ctx = ctx, .pp0 = p0, .pp1 = p1, }; } void graphics_draw_line(GContext* ctx, GPoint p0, GPoint p1) { // TODO: remove me PBL-42458 (still used for drawing arc) record_mo...
( "ctx.beginPath();\n" "ctx.moveTo(1, 2);\n" "ctx.lineTo(3.5, -4.5);\n" "ctx.stroke();\n" )
{ 688, 424, -208}, { 744, 480, -280}, { 824, 560, -376}, { 896, 552, -432}, { 896, 640, -520}, // 75 seconds { 968, 640, -456}, { 968, 560, -344}, { 1176, 600, -280}, { 1232, 720, -392}, { 1552, 736, -280}, { 1768, 672, -88}, { 1752, 496, -40}, { 1456, 408, -64}, ...
{ 744, 528, -384}, { 832, 560, -528}, { 960, 536, -504}, { 1120, 560, -544}, { 992, 552, -440}, { 1176, 544, -344}, { 1264, 576, -328}, { 1360, 672, -376}, { 1648, 568, -120}, { 1680, 488, -8}, { 1320, 352, -16}, { 1016, 336, -24}, { 896, 336, -32}, { 816, 280, -1...
on Prototypes static void prv_send_next_packets(PPoGATTClient *client); static void prv_start_reset(PPoGATTClient *client); //! Gets the GAPLEConnection associated with the characteristic reference. //! @return The connection or NULL in case it could not be found. //! @note The caller MUST own bt_lock() extern GAPLEC...
{ return client->out.payload_sizes[sn]; }
static bool prv_is_packet_with_sn_awaiting_ack(const PPoGATTClient *client, uint32_t sn) { return (prv_get_payload_size_for_sn(client, sn) != 0); } static uint16_t prv_total_num_bytes_awaiting_ack_up_to(const PPoGATTClient *client, uint32_t sn_end_excl) { ui...
cl_assert_equal_i(flags, 0); cl_assert_equal_i(strcmp(DEVICE_NAME, name_out), 0); cl_assert_equal_b(PAIRING_INFO.is_mitm_protection_enabled, pairing_info_out.is_mitm_protection_enabled); cl_assert_equal_b(PAIRING_INFO.is_remote_signing_info_valid, pairing_info_out.is_remote...
(shared_prf_storage_get_valid_page_number(), 1)
; shared_prf_storage_set_local_device_name(DEVICE_NAME); cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 1); } // Test that setting and retrieving a pinned address works. void test_shared_prf_storage_v3__pinned_address(void) { shared_prf_storage_set_ble_pinned_address(&DEVICE_ADDR); BTDeviceAddre...
*/ #include "apps/prf_apps/recovery_first_use_app/getting_started_button_combo.h" #include "clar.h" // Stubs /////////////////////////////////////////////////////////////////////////////// #include "stubs_logging.h" #include "stubs_passert.h" #include "fake_new_timer.h" static bool s_mfg_mode_entered; void mfg_e...
prv_press_button(BUTTON_ID_UP)
; prv_press_button(BUTTON_ID_SELECT); prv_release_button(BUTTON_ID_UP); // Now we're just holding down, which is a different combo StubTimer *timer = prv_find_combo_timer(); cl_assert(timer); cl_assert_equal_i(stub_new_timer_timeout(timer->id), 5000); stub_new_timer_fire(timer->id); cl_assert(!s_m...
ck); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(16, 2, 28, 20), 4); } void across_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRec...
layer_render_tree(&layer, &ctx)
; cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_inside_origin_layer.${BIT...
ail_card__render_no_subtitle(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .fill_color = GColorWhite, #if PBL_BW .outline_color = GColorBlack, #endif }, .bg_color = BG_COLO...
menu_layer_set_selected_index(&card->menu_layer, MenuIndex(0, 1), MenuRowAlignCenter, false)
the wiki page I'm about to write about PIC and relocatable // values // // an array of app-relative pointers to addresses needing an offset uint32_t *reloc_array = prv_offset_to_address(destination, info->load_size); for (uint32_t i = 0; i < info->num_reloc_entries; ++i) { // an absolute...
(app_md, task, destination)
cl_assert_equal_i(s_prepare_count, 0)
; assert_meta_response_sent(MetaResponseCodeDisallowed); // Length: 1, Endpoint ID: PUBLIC_TEST_ENDPOINT_ID, Payload: 0x55 RECEIVE(0x00, 0x01, PUBLIC_TEST_ENDPOINT_ID >> 8, PUBLIC_TEST_ENDPOINT_ID & 0xff, 0x55); cl_assert_equal_i(s_prepare_count, 1); } void test_session_receive_router__ignore_message_if_no_re...