prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
write_register(PmicRegisters_GPIO5_CNTL, 0b10100000) && prv_set_pmic_gpio_outputs(0, PmicGpio5); if (!success) { PBL_LOG(LOG_LEVEL_ERROR, "Could not configure the battery measure control GPIO"); } } static bool prv_is_alive(void) { uint8_t chip_id; if (!prv_read_register(PmicRegisters_CHIP...
{ case 0: return 4400; case 1: return 4500; case 2: return 4600; case 3: return 4700; case 4: return 4800; case 5: return 4900; case 6: return 5000; case 7: return 5500; }
e); for (int16_t x = 0; x < mask_size.w; x++) { test_graphics_context_mask_set_value_for_coordinate(ctx, mask, mask_pixel_value, GPoint(x, y)); } } return mask; } typedef void (*VerticalClippingMaskRecordFunc)(GContext *ctx, int16_t x, int16_...
{ int16_t x1 = (int16_t)((dest_color_index * hline_applying_test_column_width) + (mask_value_index * num_pixels_per_mask_value)); int16_t x2 = (int16_t)(x1 + num_pixels_per_mask_value - 1); apply_func(ctx, y, x1, x2, src_color); }
} } graphics_context_mask_destroy(ctx, mask); } ////////////////////////////////////// // APPLYING VERTICAL LINE HELPERS // ////////////////////////////////////// static const int16_t vline_applying_test_row_height = hline_applying_test_column_width; static void prv_prepare_canvas_for_vline_applying_test...
0, 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, GPoi...
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 ev...
/ critical -> good fake_battery_set_charging(true); fake_battery_set_connected(true); fake_battery_set_millivolts(good_mv); periodic_timer_trigger(20); cl_assert(!battery_monitor_critical_lockout()); cl_assert(!s_in_low_power); cl_assert_equal_i(s_power_state, PowerStateGood); } void test_battery_monitor...
(60, true)
; int okay_mv = battery_curve_lookup_voltage_by_percent(5, false); int discharge_mv = battery_curve_lookup_voltage_by_percent(3, false); // Begin in LPM, unplugged and discharging. fake_battery_init(okay_mv, false, false); battery_monitor_init(); periodic_timer_trigger(1); fake_battery_set_millivolts(dis...
/* * 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 (prv_has_invalid_length(sizeof(AppMessagePush), length)) { return false; }
bool success = false; // Scan the dictionary: const size_t dict_size = length - sizeof(AppMessagePush) + sizeof(Dictionary); DictionaryIterator iter; const Tuple *tuple = dict_read_begin_from_buffer(&iter, (const uint8_t *) &push_message->dictionary, ...
return; } const uint16_t next_value_length = gatt_client_subscriptions_consume_notification(&header.characteristic, buffer, &header.value_length, GAPLEClientKernel, &has_more...
PBL_LOG(LOG_LEVEL_DEBUG, "Disconnected from Gateway!")
oints = (GPoint[]) { { arrow_base_x, arrow_base_center_y - (arrow_size.h / 2) }, { arrow_base_x + arrow_point_x_offset, arrow_base_center_y }, { arrow_base_x, arrow_base_center_y + (arrow_size.h / 2) } } }; if (timeline_layer->scroll_direction == TimelineScro...
((Layer *)&layer->day_separator, true)
int)((f) * FIXED_S16_3_ONE.raw_value)) #define cl_assert_gpoint_precise(p, px, py) \ do { \ cl_assert_fixedS16_3(p.x, px); \ cl_assert_fixedS16_3(p.y, py); \ } while(0) void test_graphics_circle__grect_polar_calc_values_handles_null(void) { GPointPrecise center = {}; Fixed_S16_3 radius = {}; const ...
GRect(0, 0, 10, 12)
__draw_stroke_width_even(void) { // Stroke width even > 2, non-antialiased setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_EVEN)); setu...
{ // Stroke width even > 2, antialiased setup_test(&context, true, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); #if PBL_COLOR ASSERT_CALLED(graphics_line_draw_stroked_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_EVEN)); #else ASSERT_CALLED(graphics_li...
void test_graphics_context_${BIT_DEPTH_NAME}__draw_antialiased_stroke_width_odd(void) { // Stroke width odd > 1, antialiased setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); #if PBL_COLOR ASSERT_CALLED(graphics_line_draw_stroked_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...
PBL_LOG(LOG_LEVEL_DEBUG, "deinit timeout expired, killing app forcefully")
; PebbleTask task = (PebbleTask)data; process_manager_put_kill_process_event(task, false /*gracefully*/); } // --------------------------------------------------------------------------------------------- static bool prv_force_stop_task_if_unprivileged(ProcessContext *context) { vTaskSuspend((TaskHandle_t) con...
t) { WorkerCrashDialogData *data = context; // Have the worker manager launch the next worker worker_manager_launch_next_worker(data->app_install_id); // Pop the worker crash dialog actionable_dialog_pop(data->actionable_dialog); } static void prv_worker_crash_click_config_provider(void *context) { windo...
light_enable_interaction()
; } void crashed_ui_show_worker_crash(const AppInstallId install_id) { launcher_task_add_callback(prv_push_worker_crash_dialog, (void *) install_id); } // --------------------------------------------------------------------------- #if (defined(SHOW_BAD_BT_STATE_ALERT) || defined(SHOW_PEBBLE_JUST_RESET_ALERT)) #defi...
n't service an interrupt, the controller will retry every 10ms. We never want to lose a // touch event, so we set the number of retries to a very high value (currently 1 minute worth). // HACK WARNING: This is a bit of a hack to get around their very low default retry count which // could cause us to lose events if the...
PBL_ASSERTN((response.data[2] & 0x0F) == PACKET_FOOTER)
; *(uint16_t *)result = (response.data[0] << 4) | (response.data[1] >> 4); *(uint16_t *)result <<= 8; *(uint16_t *)result |= (response.data[1] << 4) | (response.data[2] >> 4); } else { // invalid type WTF; } } #endif // Memory Operations ////////////////////////////////////////////////////////...
6_t radius, uint8_t stroke_width, GCornerMask quadrant) { // This algorithm will draw stroked circle with vairable width (only odd numbers for now) const uint8_t half_stroke_width = stroke_width / 2; const int16_t inner_radius = radius - half_stroke_width; const uint8...
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_pixel(ctx, GPoint(p.x - radius, p.y)); } #if PBL_COLOR T_STATIC void graphics_circle_draw_1px_aa(GContext* ctx, GPoint p, uint16_t radius) { graphics_circle_quadrant_d...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_INFO, "Pausing address cycling (pinned_addr="BT_DEVICE_ADDRESS_FMT")", BT_DEVICE_ADDRESS_XPLODE(s_pinned_addr))
; prv_allow_cycling(false); } ++s_pra_cycling_pause_count; } bt_unlock(); } void bt_local_addr_resume_cycling(void) { bt_lock(); { PBL_ASSERTN(s_pra_cycling_pause_count); --s_pra_cycling_pause_count; if (s_pra_cycling_pause_count == 0) { PBL_LOG(LOG_LEVEL_INFO, "Resuming address...
/////////////////////////////////////////////////////////////////////////// //! More Advanced Tests void test_alarm__recurring_daily_alarm_timeout_ahead(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id, 10, 30, false, ALARM_...
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time())
; // Second alarm goes off. First one should be up again s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 6); cl_assert_equal_i(s_num_alarm_events_put, 6); cl_assert_equal_i(s_num_timeline_adds, 48); cl_assert_equal_i(s_num_timeline_removes, 36); ...
/* * 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...
sys_system_pp_has_capability(CommSessionVoiceApiSupport)
) { PBL_LOG(LOG_LEVEL_INFO, "No phone connected or phone app does not support app-initiated " "dictation sessions"); return NULL; } DictationSession *session = applib_type_malloc(DictationSession); if (!session) { return NULL; } char *buffer = NULL; if (buffer_size > 0) { buffer = ...
o write for the current log uint8_t log_chunk_id; // the id of the current page being logged to uint8_t log_file_id; // the id of the current log generation } CurrentLoggingState; static CurrentLoggingState s_curr_state; #define CHUNK_ID_BITWIDTH (sizeof(((FlashLoggingHeader *)0)->log_chunk_id) * 8) #define LO...
for (sector_addr = FLASH_REGION_DEBUG_DB_BEGIN; sector_addr < FLASH_REGION_DEBUG_DB_END; sector_addr += ERASE_UNIT_SIZE) { prv_erase_unit(sector_addr); }
} static uint8_t generation_to_log_file_id(int generation) { int log_id = (int)s_curr_state.log_file_id - generation; if (log_id < 0) { log_id += MAX_LOG_FILE_ID; } return (log_id); } //! Scans the flash log region and checks the FlashLoggingHeader magic and //! version of each log page for validity. I...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_ERROR, "Could not open settings file '%s', %d", name, fd); if (fd == E_BUSY) { // This is very bad. Someone didn't use a mutex. There could already be // silent corruption, so it's better to crash now rather than let things // get even more scrambled. PBL_CROAK("Setti...
*file = (SettingsFile) { .name = kernel_strdup_check(name), .max_used_space = max_used_space, .max_space_total = max_space_total, }; settings_raw_iter_init(&file->iter, fd, file->name); SettingsFileHeader file_hdr = file->iter.file_hdr; if (file_hdr_is_uninitialized(&file_hdr)) { // Newly ...
ty_hr_preferences(HeartRatePreferences *new_settings) { if (new_settings->resting_hr > new_settings->elevated_hr || new_settings->elevated_hr > new_settings->max_hr) { return false; } if (new_settings->zone1_threshold > new_settings->zone2_threshold || new_settings->zone2_threshold > new_settings-...
if (settings_file_exists(file, PREF_KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED, sizeof(PREF_KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED))) { bool temp; BacklightBehaviour backlight_behaviour = BacklightBehaviour_Auto; settings_file_get(file, PREF_KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED, ...
yAPIContext *rocky_memory_api_context; #if CAPABILITY_HAS_APP_GLANCES AppGlance glance; #endif TextRenderState text_render_state; bool text_perimeter_debugging_enabled; TimelineItemActionSource current_timeline_item_action_source; GBitmap *legacy2_framebuffer; } AppState; KERNEL_READONLY_DATA static App...
(&s_app_state_ptr->animation_state)
{ } uint16_t gaps_get_starting_att_handle(void) { return 4; } void gatt_service_changed_server_cleanup_by_connection(GAPLEConnection *connection) { } void bt_pairability_update_due_to_bonding_change(void) { } void launcher_task_add_callback(void (*callback)(void *data), void *data) { callback(data); } bool sy...
bt_persistent_storage_store_ble_pairing(&pairing_2, true /* is_gateway */, NULL, false /* requires_address_pinning */, false /* auto_acce...
; prv_fire_writeback_timer(); cl_assert(id_2 != BT_BONDING_ID_INVALID); cl_assert_equal_i(s_bonding_change_count, 2); cl_assert_equal_i(s_bonding_change_ops[0], BtPersistBondingOpWillDelete); cl_assert_equal_i(s_bonding_change_ops[1], BtPersistBondingOpDidAdd); // Read it back ret = bt_persistent_storage...
/* * 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_create_ancs_attr("")
; calculated = ancs_notifications_util_parse_timestamp(zero_length_date); prv_destroy_ancs_attr(zero_length_date); cl_assert_equal_i(calculated, 0); }
0320,1311768467463790320"); snprintf(dstbuf, 256, "%zi,%ti", hurf, hurf); cl_assert_equal_s(dstbuf, "-1698898192,-1698898192"); } void test_sprintf__percent_u(void) { char dstbuf[256]; // Simple %u snprintf(dstbuf, 256, "There are %u lights, %u", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, 4294...
(dstbuf, "There are 10 lights, the absolute value of 37777777774")
; // Minimum digits output snprintf(dstbuf, 256, "There are %.3o lights, %.3o", 8, -4); cl_assert_equal_s(dstbuf, "There are 010 lights, 37777777774"); // Minimum digits output (zero digits) snprintf(dstbuf, 256, "%.0ozero%.0o", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (unspe...
lable_ram = end_addr - start_addr; uint16_t circular_buffer_size = sizeof(s_log_buffer_ram); if (circular_buffer_size < available_ram) { circular_buffer_size = MIN(available_ram, USHRT_MAX); } circular_buffer_init_ex(&s_log_buffer.circular_buffer, s_log_buffer_ram, circular_buffe...
{ // length + strlen(string) + padding (round up to nearest uint32_t). msg_size += 1 + str2_len + (3 - (1 + str2_len + 3) % 4); }
} // Buffer for UART ASCII log output char expanded_fmt_buffer[64]; memset(expanded_fmt_buffer, 0, sizeof(expanded_fmt_buffer)); // Craft a buffer that will hold HcProtocolMessage followed by BinLogMessage. int msg_buffer_size = MAX((msg_size + sizeof(HcProtocolMessage)), 130); uint8_t msg_buffer[msg_b...
data->hrm_quality, (int)stable_sensor); HRM_LOG("PPG samples: %d", data->ppg_data.num_samples); HRM_HEXDUMP(data->ppg_data.ppg, data->ppg_data.num_samples * sizeof(uint16_t)); HRM_LOG("TIA samples: %d", data->ppg_data.num_samples); HRM_HEXDUMP(data->ppg_data.tia, data->ppg_data.num_samples * sizeof(ui...
event_service_client_subscribe(&s_manager_state.charger_subscription)
/* * 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(&ctx.dest_bitmap, "test_gdraw_command_transforms__to_square.8bit.pbi"))
; } // re-enable this "test" to debug per-frame transitions void _test_gdraw_command_transforms__to_square_sequence(void) { GContext ctx; test_graphics_context_init(&ctx, fb); graphics_context_set_antialiased(&ctx, true); int32_t dt = ANIMATION_NORMALIZED_MAX / 16; int32_t t = 0; while (t <= ANIMATION_N...
/* * 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, s_current_path)
; } } static void prv_reset(void) { gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)); s_outline_mode = false; s_path_angle = 0; } // setup and teardown void test_graphics_gpath_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DI...
&text_crc_matches, s_rx_buffer, sizeof(text_crc_matches)); // Get the Build ID cmd = (CoreDumpSPICmd) { .cmd = CoreDumpCmd_GetBuildID }; if (!prv_spi_transaction(&cmd, s_rx_buffer, sizeof(build_id))) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Build ID"); goto spi_failed; } memcpy(build_id, s_rx_buffer...
{ PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Extra Thread Info"); goto spi_failed; }
flash_write_bytes((const uint8_t *)&chunk_hdr, flash_addr, sizeof(chunk_hdr)); flash_addr += sizeof(chunk_hdr); flash_write_bytes(s_rx_buffer, flash_addr, sizeof(CoreDumpExtraRegInfo)); flash_addr += sizeof(CoreDumpExtraRegInfo); // Terminate the core dump chunk_hdr.key = CORE_DUMP_CHUNK_KEY_TERMINATOR; ...
ntext_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, 15)); } void outside_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, -5)); } void outside_x_y_layer_update_callback(Layer* me, GContext* ctx) ...
cl_check(framebuffer_is_empty("outside_x_ny_offset_layer", ctx.parent_framebuffer, GColorWhite))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_nx_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_nx_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)); } void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__clear(void) { G...
/* * 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...
{ send_golf_cmd(CMD_PREV); }
static void down_click_handler(ClickRecognizerRef recognizer, AppData *data) { send_golf_cmd(CMD_NEXT); } static void select_click_handler(ClickRecognizerRef recognizer, AppData *data) { send_golf_cmd(CMD_SELECT); } static void config_provider(AppData *data) { window_single_click_subscribe(BUTTON_ID_UP, (Clic...
/* * 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...
{ // Time's up! next_state = RuninStateFail; data->countdown_running = false; PBL_LOG(LOG_LEVEL_ERROR, "Failed runin testing"); }
} data->test_state = next_state; sniprintf(data->status_string, sizeof(data->status_string), "RUNIN\n%s", status_text[data->test_state]); text_layer_set_text(&data->status, data->status_string); int mins_remaining = data->seconds_remaining / 60; int secs_remaining = data->seconds_remaining %...
tain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License...
gpio_output_set(&BOARD_CONFIG_BACKLIGHT.ctl, true)
; } s_led_enable |= enabler; } // TODO: PBL-36077 Move to a generic 4v5 disable void led_disable(LEDEnabler enabler) { s_led_enable &= ~enabler; if (s_led_enable == 0) { gpio_output_set(&BOARD_CONFIG_BACKLIGHT.ctl, false); } } void backlight_set_brightness(uint16_t brightness) { if (BOARD_CONFIG_BACKL...
ense, 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 distributed...
if (op & StatsBasicOp_Max) { basic_out[out_index++] = max; }
if (op & StatsBasicOp_Count) { basic_out[out_index++] = num_values; } if (op & StatsBasicOp_Consecutive) { basic_out[out_index++] = MAX(consecutive_max, consecutive_current); } if (op & StatsBasicOp_ConsecutiveFirst) { basic_out[out_index++] = consecutive_first; } if (op & StatsBasicOp_Median...
/* * 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...
{ // Ensure that there are no other write operations in progress while (SPI_I2S_GetFlagStatus(SPI3, SPI_I2S_FLAG_TXE) == RESET) {} // Send the byte on the SPI bus SPI_I2S_SendData(BMA255_SPI, byte); // Wait for the response byte to be received while (SPI_I2S_GetFlagStatus(BMA255_SPI, SPI_I2S_FLAG_RXNE) == ...
void bma255_send_byte(uint8_t byte) { // Ensure that there are no other write operations in progress while (SPI_I2S_GetFlagStatus(SPI3, SPI_I2S_FLAG_TXE) == RESET) {} // Send the byte on the SPI bus SPI_I2S_SendData(BMA255_SPI, byte); } //! Set SCS for transaction, start spi clock, and send address void bma2...
------------------------- static bool prv_set_alarm_custom_op(AlarmId id, AlarmConfig *config, void *context) { const bool (*scheduled_days)[DAYS_PER_WEEK] = context; config->kind = ALARM_KIND_CUSTOM; memcpy(&config->scheduled_days, scheduled_days, sizeof(config->scheduled_days)); return true; } void alarm_set...
{ is_next_alarm_smart = s_next_alarm.config.is_smart; }
mutex_unlock(s_mutex); return is_next_alarm_smart; } // ---------------------------------------------------------------------------------------------- bool alarm_get_time_until(AlarmId id, time_t *time_out) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return false; } bool alarm_is_sch...
/* * 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...
(&creset_input)
) { dbgserial_putstr("CRESET not high after reset"); return false; } delay_ms(1); // Program the FPGA prv_spi_write(fpga_bitstream, bitstream_size); // Set SCS high so that we don't process any of these clocks as commands. gpio_output_set(&ICE40LP->spi.scs, false); // SCS not asserted (high) ...
x45, 282, 0x0}, { 0, 0x45, 39, 0x0}, { 0, 0x47, 4348, 0x1}, { 0, 0x74, 583, 0x1}, // 555: Local time: 08:20:00 AM { 0, 0x74, 0, 0x1}, { 0, 0x74, 39, 0x1}, { 0, 0x86, 1111, 0x1}, { 0, 0x85, 48, 0x1}, { 0, 0x84, 0, 0x1}, { 0, 0x84, 48, 0x1}, { 0, 0x84, 0, 0x1}, { 0, 0x84, 0...
{ 0, 0x44, 287, 0x0}, { 8, 0x35, 1249, 0x0}, { 0, 0x34, 794, 0x0}, { 0, 0x37, 525, 0x0}, { 0, 0x35, 1752, 0x0}, { 0, 0x46, 1318, 0x0}, { 0, 0x54, 3408, 0x0}, { 15, 0x43, 3375, 0x0}, { 0, 0x43, 1718, 0x0}, // 675: Local time: 10:20:00 AM { 0, 0x35, 3253, 0x0}, { 0, 0x54, 3...
// 720: Local time: 11:05:00 AM { 8, 0x35, 3147, 0x0}, { 11, 0x67, 2486, 0x0}, { 22, 0x66, 4699, 0x0}, { 0, 0x74, 1135, 0x0}, { 15, 0x66, 1971, 0x0}, { 0, 0x47, 594, 0x0}, { 0, 0x48, 383, 0x0}, { 0, 0x56, 1030, 0x0}, { 0, 0x65, 910, 0x0}, { 0, 0x7c, 2461, 0x0}, { 0, 0x9,...
irst, all commands are QSPI qspi_indirect_write_no_addr_1line(dev->qspi, dev->state->part->instructions.enter_quad_mode); // Reset the flash to stop any program's or erase in progress from before reboot prv_write_cmd_no_addr(dev, dev->state->part->instructions.reset_enable); prv_write_cmd_no_addr(dev, dev->sta...
(buffer, (uint32_t *)(QSPI_MMAP_BASE_ADDRESS + addr), length)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(s_command_list_index, 1)
rompt_send_response("Starting BT sleep check test"); s_sleep_test_timer = new_timer_create(); new_timer_start(s_sleep_test_timer , 10, prv_sleep_timer_test_cb, (void *)(uintptr_t)0, 0); prompt_command_continues_after_returning(); } void command_btle_unmod_tx_start(char *tx_channel) { bt_driver_start_unmodulat...
(ctx, GPoint(0, 0), GPoint(DISP_COLS, DISP_ROWS))
; // ~63 degrees graphics_draw_line(ctx, GPoint(DISP_COLS/2, 0), GPoint(DISP_COLS, DISP_ROWS)); // ~33 degrees graphics_draw_line(ctx, GPoint(0, DISP_ROWS/3), GPoint(DISP_COLS, DISP_ROWS)); // ~53 degrees graphics_draw_line(ctx, GPoint(DISP_COLS/4, 0), GPoint(DISP_COLS, DISP_ROWS)); // ~39 degrees graph...
/* * 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_create_card_and_render(&health_data)
; #if PBL_ROUND menu_layer_set_selected_index(&card->menu_layer, MenuIndex(0, 2), MenuRowAlignCenter, false); #endif window_render(&card->window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
otals.totals), health_service_private_weekend_filter, (void *)(uintptr_t)local_tm->tm_wday, &stats->weekend.sum); // We want to sum only the days that are this far from index 0 (which is local_tm.tm_wday) int day_offset = local_tm->tm_wday - weekly_day; if (day_offs...
for (int i = 0; i < ACTIVITY_NUM_METRIC_AVERAGES; i++) { if (averages->average[i] == ACTIVITY_METRIC_AVERAGES_UNKNOWN) { averages->average[i] = default_value; } // If this entry is cached, fix up the cache entry if (state->cache && (metric == HealthMetricStepCount)) { if (state->cache->step_...
return true; } // ---------------------------------------------------------------------------------------------- // Compute the sum of the chunks in the averages array that comprise the given time range from // time_start to time_end. The averages array represents all the chunks for a day, and time_start // to time...
/* * 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...
(countdown_window->timer)
; layer_deinit(&countdown_window->base_layer); window_deinit(&countdown_window->window); app_free(countdown_window); } } void workout_countdown_start(ActivitySessionType type, StartWorkoutCallback start_workout_cb) { WorkoutCountdownWindow *countdown_window = app_zalloc_check(sizeof(WorkoutCountdownWin...
t_mfg_serials__pcba_serial_number(void) { const char* pcba_serial; // Initially, bunch of XXs: pcba_serial = mfg_get_pcba_serial_number(); cl_assert_equal_s(pcba_serial, "XXXXXXXXXXXX"); // Test writing & reading back: const char* written_pcba_serial1 = "01234567901"; command_pcba_serial_write(written_p...
(r == MfgSerialsResultFailNoMoreSpace)
; }
int8_t percent_intensity) { PBL_ASSERTN(percent_intensity > 0 && percent_intensity <= 100); uint16_t intensity = prv_convert_backlight_percent_to_intensity(percent_intensity); PBL_ASSERTN(intensity > BACKLIGHT_BRIGHTNESS_OFF); prv_pref_set(PREF_KEY_BACKLIGHT_INTENSITY, &intensity, sizeof(intensity)); } bool ba...
prv_pref_set(PREF_KEY_WELCOME_VERSION, &version, sizeof(version))
; } } uint8_t welcome_get_welcome_version(void) { return s_welcome_version; } static bool prv_set_default_any_watchface_enumerate_callback(AppInstallEntry *entry, void *data) { if (!app_install_entry_is_watchface(entry) || app_install_entry_is_hidden(entry)) { return true; // continue search } wa...
GColor collapse_dot_color, GColor final_dot_color, GColor background_color, CompositorTransitionDirection direction, ...
{ if (compositor_transition_app_to_app_should_be_skipped()) { return NULL; } if (timeline_is_future) { if (timeline_is_destination) { static const CompositorTransition s_impl = { .init = prv_dot_transition_to_timeline_future_animation_init, .update = prv_static_dot_transition_animat...
const CompositorTransition* compositor_dot_transition_app_fetch_get(void) { if (compositor_transition_app_to_app_should_be_skipped()) { return NULL; } static const CompositorTransition s_impl = { .init = prv_dot_transition_from_app_fetch_animation_init, .update = prv_static_dot_transition_animatio...
er, &GRect(0, 0, 28, 28)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_u...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r1_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; // Testing of the special cases for radius: // Radius of 3 - starting point for calculated edges setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MIN_CALCULATED); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_cir...
_queue || activated_queue == s_from_worker_event_queue) { result = xQueueReceive(activated_queue, event, 0); } if (!result) { result = xQueueReceive(s_from_app_event_queue, event, 0); } if (!result) { result = xQueueReceive(s_from_worker_event_queue, event, 0); } // If there w...
xQueueReset(s_system_event_queue_set)
; event_queue_cleanup_and_reset(reset_queue); int num_kernel_events_enqueued = uxQueueMessagesWaiting(s_kernel_event_queue); for (int i = 0; i < num_kernel_events_enqueued; ++i) { xQueueSend(s_system_event_queue_set, &s_kernel_event_queue, 0); } int num_client_task_events_enqueued = uxQueueMessagesWaiti...
&label_text_frame); #if !defined(RECOVERY_FW) && SCREEN_COLOR_DEPTH_BITS == 8 const int16_t fade_height = 10; graphics_context_set_compositing_mode(ctx, GCompOpSet); if (draw_top_shading) { GRect top_bounds = label_text_container; top_bounds.origin.y += VERTICAL_P...
MAX(menu_cell_small_cell_height() - line_height, default_sep_height)
MAReq_Rx, ENABLE); // Enable I2S I2S_Cmd(BOARD_CONFIG.mic_config.spi, ENABLE); // DMA config - use single buffer circular mode. Pointer to buffer is a 2-D array for ease of // access void *periph_addr = (void *)&BOARD_CONFIG.mic_config.spi->DR; stop_mode_disable(InhibitorMic); dma_request_start_circular...
((uint8_t *)pdm_buffer, pcm16_buffer, s_volume, (PDMFilter_InitStruct *)&s_pdm_filter)
; pdm_buffer += DECIMATION_FACTOR; // while the filter is settling discard samples (about 100 ms) // each iteration of this loop writes 1 ms of data to the buffer if (s_discarded < MS_TO_SETTLE) { s_discarded++; } else if (!circular_buffer_write(&s_circ_buffer, (const uint8_t *) pcm16_buffer,...
2, -608, 40}, { -688, -616, 8}, { -728, -640, -8}, { -720, -656, -16}, { -752, -576, -24}, { -696, -616, 32}, { -688, -536, 0}, { -688, -560, -24}, { -696, -584, 40}, { -696, -592, 72}, { -704, -632, 32}, { -736, -656, 16}, { -712, -640, -8}, { -712, -584, 48}, { ...
{ -880, 424, 152}, { -864, 440, 144}, { -856, 416, 160}, { -864, 432, 152}, { -856, 456, 136}, { -864, 440, 120}, { -864, 432, 136}, { -864, 440, 136}, { -864, 448, 144}, { -856, 432, 136}, // 463 seconds { -856, 432, 144}, { -856, 424, 144}, { -856, 424, 152}, ...
{ -864, 544, 520}, { -904, 552, 392}, { -768, 496, 360}, { -688, 384, 432}, { -672, 424, 464}, { -704, 416, 488}, { -728, 384, 496}, { -776, 424, 480}, { -776, 424, 464}, { -776, 432, 472}, { -744, 432, 456}, { -736, 416, 440}, { -728, 416, 408}, { -736, 416, 416...
w_rect_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_rect_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } //////////////////////////////////// static void inside_layer_update_callback(Layer* me...
(&layer, &across_ny_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__color(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 20, 10));...
60, 0x42, 6457, 186, 0}, { 4, 0x53, 8492, 184, 0}, { 0, 0x42, 7645, 180, 0}, { 31, 0x52, 6601, 164, 0}, { 24, 0x53, 5901, 177, 0}, { 49, 0x42, 6183, 182, 0}, { 0, 0x41, 1487, 183, 0}, { 0, 0x41, 1158, 175, 0}, { 0, 0x64, 6016, 179, 0}, { 0, 0x75, 7902, 180, 0}, { 20, 0x75, 7532,...
{ 0, 0x56, 0, 146, 0}, { 0, 0x56, 0, 146, 0}, { 0, 0x56, 0, 146, 0}, { 0, 0x56, 0, 146, 0}, { 0, 0x56, 0, 148, 0}, { 0, 0x56, 0, 146, 0}, { 0, 0x56, 0, 146, 0}, { 0, 0x56, 0, 146, 0}, { 0, 0x56, 0, 145, 0}, { 0, 0x56, 0, 141, 0}, { 0, 0x56, 0, 145, 0}, { 0, 0x56, 0, 146, ...
{ 0, 0x24, 0, 148, 0}, { 0, 0x24, 0, 145, 0}, { 0, 0x24, 0, 149, 0}, { 0, 0x24, 0, 149, 0}, { 0, 0x24, 0, 149, 0}, { 0, 0x24, 0, 149, 0}, { 0, 0x24, 0, 145, 0}, // 180: Local time: 2015-11-12 10:21:00 PM { 0, 0x24, 0, 149, 0}, { 0, 0x24, 0, 149, 0}, { 0, 0x24, 0, 149, 0}, ...
t packet_len; uint32_t data_len = 0; if (state->sent_header) { uint32_t max_buf_len = comm_session_send_buffer_get_max_payload_length(state->session); if (max_buf_len == 0) { // Session disconnected in the mean time packet_len = 0; } else { data_len = MIN(remaining_bytes, max_buf_len ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Non NULL terminated filename"); return false; }
info.filename = hdr->filename; bool rv = gb_storage_setup(&state->storage, state->object_type, &info); return rv; } case GET_BYTES_CMD_GET_FLASH: { state->object_type = GetBytesObjectFlash; GetBytesFlashHeader *hdr = (GetBytesFlashHeader *)data; info.flash_start_addr = ntohl...
bounds->origin, GPoint(offset_x, offset_y)); graphics_context_set_stroke_color(ctx, PBL_IF_COLOR_ELSE(GColorDarkGray, GColorWhite)); separator_start_point.y += config->separator.h; for (int i = 0; i < config->separator.h; i++) { // First point from bottom...
(ctx, &arrow_rect, ContentIndicatorDirectionUp, fg_color, bg_color, GAlignTop)
; } if (num_rows - row >= SHORT_ITEM_MAX_ROWS_SPALDING) { grect_align(&arrow_rect, aml_bounds, GAlignBottom, true /* clip */); content_indicator_draw_arrow(ctx, &arrow_rect, ContentIndicatorDirectionDown, fg_color, bg_color, GAlignBottom); } } #endif } stati...
/* * 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...
(buffer, buffer_size)
) { buffer += sizeof(ROCKY_EXPECTED_SNAPSHOT_HEADER); buffer_size -= sizeof(ROCKY_EXPECTED_SNAPSHOT_HEADER); PBL_ASSERTN((uintptr_t)buffer % 8 == 0); rv = jerry_exec_snapshot(buffer, buffer_size, false); } else { PBL_LOG(LOG_LEVEL_INFO, "Not a snapshot, interpreting buffer as JS source code"); ...
ivitySessionType_Run: default: return kino_reel_create_with_resource(RESOURCE_ID_WORKOUT_APP_RUN); } } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Drawing static void prv_render_activity_type(GContext *ctx, Layer *layer, KinoReel *icon, ...
layer_init(&summary_window->base_layer, &layer_bounds)
; layer_set_update_proc(&summary_window->base_layer, prv_base_layer_update_proc); layer_add_child(&window->layer, &summary_window->base_layer); StatusBarLayer *status_layer = &summary_window->status_layer; status_bar_layer_init(status_layer); status_bar_layer_set_colors(status_layer, GColorClear, TEXT_COLOR)...
ar *artist, char *album) { mutex_lock_recursive(s_music_ctx.mutex); if (title) { strcpy(title, s_music_ctx.title); } if (artist) { strcpy(artist, s_music_ctx.artist); } if (album) { strcpy(album, s_music_ctx.album); } mutex_unlock_recursive(s_music_ctx.mutex); } bool music_get_player_name...
mutex_unlock_recursive(s_music_ctx.mutex)
; return func_ptr; } void music_command_send(MusicCommand command) { const off_t o = offsetof(__typeof__(*s_music_ctx.implementation), command_send); void (*command_send)(MusicCommand) = prv_implementation_function_for_offset(o); if (command_send) { command_send(command); } } void music_request_reduced_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (int k = num_output_coefficients - 1; k > 0; k--) { state_y[k] = state_y[k-1]; }
state_y[0] = ytmp; return ytmp; }
read_status_register(sector_base_addr)) & S29VSStatusBit_DeviceReady) == 0) { delay_us(10); } return (status); } //! Issue the second part of a two-cycle command. This is not merged with the //! prv_issue_command as not all commands have an argument. //! //! @param sector_address The address of the s...
flash_impl_get_sector_base_address(end_sector)
.update = (AnimationUpdateImplementation) property_animation_update_int16, }, .accessors = { .setter = { .int16 = prv_set_dot_width, }, }, }; static Animation *prv_create_pulse_dot_anim(VoiceUiData *data, int16_t min, int16_t max, int16_t overshoo...
kino_layer_pause(&data->mic_window.icon_layer)
; layer_set_hidden((Layer *) &data->mic_window.icon_layer, true); } static void prv_show_mic_dot_pulse(VoiceUiData *data) { // Dot is already animating if (animation_is_scheduled(data->mic_window.mic_dot_anim)) { animation_unschedule(data->mic_window.mic_dot_anim); } const GRect *root_frame = &window_ge...
ics_context_get_current_context(void) { return &s_ctx; } static bool s_is_watchface_running; bool app_manager_is_watchface_running(void) { return s_is_watchface_running; } // Setup and Teardown //////////////////////////////////// static FrameBuffer s_fb; static GBitmap *s_dest_bitmap; void test_timeline_peek...
(true, 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...
{ AttributeList notif_attr_list = {}; attribute_list_add_uint32(&notif_attr_list, AttributeIdIconTiny, TIMELINE_RESOURCE_NOTIFICATION_FLAG); attribute_list_add_cstring(&notif_attr_list, AttributeIdTitle, /// Welcome title text welcoming a 3.x user to 4.x ...
id2 = bt_persistent_storage_store_ble_pairing(&pairing, true /* is_gateway */, NULL, false /* requires_address_pinning */, false /* auto_accept_re_pairing */); cl_assert(id2 != BT_BONDING_ID_INVALI...
(fake_shared_prf_storage_get_bt_classic_store_count(), 2)
; // Read both pairings back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_1, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_1, &lin...
); if (!read_size || old_active_gateway != bonding) { 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_stora...
prv_lock()
; { // If we were passed a null pointer, we'll just clear the cached capability bits if (capabilities) { diff.flags = s_cached_system_capabilities.flags ^ capabilities->flags; s_cached_system_capabilities = *capabilities; } else { diff.flags = s_cached_system_capabilities.flags; 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...
if (p[i] == ch) { return (void*)&p[i]; }
} return NULL; }
priority, primask, etc. void flash_hw_init(void) { // Connect PA5 to SPI1_SCLK GPIO_PinAFConfig(FLASH_GPIO, GPIO_PinSource5, GPIO_AF_SPI1); // Connect PA6 to SPI1_MISO GPIO_PinAFConfig(FLASH_GPIO, GPIO_PinSource6, GPIO_AF_SPI1); // Connect PA7 to SPI1_MOSI GPIO_PinAFConfig(FLASH_GPIO, GPIO_PinSource7, GPI...
{ const uint32_t bufsize = 128; uint8_t buffer[bufsize]; sector_addr &= SECTOR_ADDR_MASK; for (uint32_t offset = 0; offset < SECTOR_SIZE_BYTES; offset += bufsize) { flash_read_bytes(buffer, sector_addr + offset, bufsize); for (uint32_t i = 0; i < bufsize; i++) { if (buffer[i] != 0xff) { re...
dest_delta_begin_x ? dest_row_info.min_x : dest_rect.origin.x; const int16_t dest_end_x = MIN(grect_get_max_x(&dest_rect), dest_row_info.max_x + 1); if (dest_end_x < dest_begin_x) { continue; } const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y...
MIN(32, src_bitmap->bounds.size.w + src_line_wrap_idx)
; uint8_t row_bits_left = dest_rect.size.w; uint32_t * const src_block_begin = (uint32_t *)src_block_x_begin + (src_y * src_row_length_words); uint32_t *src_block = src_block_begin; uint32_t src = *src_block; uint8_t src_start_idx = src_line_start_idx; uint8_t src_end_idx = MIN(src_lin...
just set the // order for the new node. prv_set_storage_order(source, menu_node, source->order_storage ?: app_order_read_order(), (source->order_storage == NULL)); // If we're adding the Settings app node to the list and it hasn't received a storage order, // then give it its default or...
(&entry, source)
) { if (node == NULL) { // Changed and still excluded: return; } // Changed and is now excluded: prv_unload_node(source, node); } else { // Changed and is now included: if (node == NULL) { add_app_with_install_id(&entry, source); } } prv_alert_data_source_changed(sour...
/* * 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...
malloc(sizeof(FrameBuffer))
; framebuffer_init(fb, &(GSize) { DISP_COLS, DISP_ROWS }); test_graphics_context_init(&ctx, fb); GBitmap *background_0_100 = get_gbitmap_from_pbi("blendtest_0_100_backdrop.pbi"); GBitmap *background_33_66 = get_gbitmap_from_pbi("blendtest_33_66_backdrop.pbi"); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ...
pp_subscribe(app_id + 2, 1, expire_s, HRMFeature_BPM|HRMFeature_LEDCurrent); HRMSessionRef no_session = sys_hrm_manager_app_subscribe(app_id + 3, 1, expire_s, 0 /* no features */); prv_fake_send_...
(s_cb_events_1[0].event_type, HRMEvent_BPM)
; cl_assert_equal_i(s_cb_events_1[0].bpm.bpm, s_hrm_event_data.hrm_bpm); cl_assert_equal_i(s_cb_events_1[0].bpm.quality, s_hrm_event_data.hrm_quality); sys_hrm_manager_unsubscribe(session_ref_1); sys_hrm_manager_unsubscribe(session_ref_2); } void test_hrm_manager__set_features(void) { AppInstallId app_id =...
ing, true); cl_assert_equal_i(flags, 0xff); cl_assert_equal_b(sm_is_pairing_info_equal_identity(&PAIRING_INFO, &pairing_info_out), true); cl_assert_equal_s(device_name_out, DEVICE_NAME); // Check getting started cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), GETTING_STARTED_COMPLETE); ...
(shared_prf_storage_get_valid_page_number())
+ offsetof(SharedPRFData, getting_started) + offsetof(SprfGettingStarted, crc), sizeof(new_crc)); // Should be corrupt, so it should return false cl_assert_equal_b(shared_prf_storage_get_getting_started_comple...
/* * 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 ((sequence->play_count != GDRAW_COMMAND_SEQUENCE_PLAY_COUNT_INFINITE_STORED) && (elapsed >= gdraw_command_sequence_get_total_duration(sequence))) { // return the last frame if the elapsed time is longer than the total duration return gdraw_command_sequence_get_frame_by_index(sequence, sequence->num_fra...
ate.h" #include "system/die.h" #include "system/reboot_reason.h" #include "system/reset.h" #include "util/attributes.h" #include "util/bitset.h" #include "util/size.h" #include "util/string.h" #define CMSIS_COMPATIBLE #include <mcu.h> #include <inttypes.h> #include <stdarg.h> #include <stdio.h> #include "kernel/pebb...
{ PBL_LOG_FROM_FAULT_HANDLER(" Memory Management Fault Status Register:"); if (mmfsr & (1 << 7)) { PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, " MMFARVALID = yes 0x%"PRIx32, SCB->MMFAR); } print_set_indexes(buffer, &mmfsr, mmfsr_mappings, ARRAY_LENGTH(mmfsr_mappings)); }
} void fault_handler_dump(char buffer[80], unsigned int *stacked_args) { fault_handler_dump_stacked_args(buffer, stacked_args); fault_handler_dump_cfsr(buffer); PBL_LOG_FROM_FAULT_HANDLER_FMT( buffer, 80, "Task: %s", pebble_task_get_name(pebble_task_get_current())); } static void hard_fault_handler_c(uns...
odd numbers for stroke_width - even numbers will be rounded up. //! Minimal supported stroke_width is 3 T_STATIC void graphics_circle_draw_stroked_non_aa(GContext* ctx, GPoint p, uint16_t radius, uint8_t stroke_width) { graphics_circle_quadrant_draw_stroked_non_aa(ct...
if (section & GCornersBottom) { prv_fill_horizontal_line(ctx, GPoint(x0 - x, y0 + y), 2 * x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 + x), 2 * y + 1); }
// top if (section & GCornersTop) { prv_fill_horizontal_line(ctx, GPoint(x0 - x, y0 - y), 2 * x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 - x), 2 * y + 1); } } } MOCKABLE void graphics_circle_fill_non_aa(GContext* ctx, GPoint p, uint16_t radius) { prv_fill_horizontal_line(ctx,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(emx_resources_get_size(1, id_4) == 0)
; ASSERT(s_size_4_called == 2); }
0; } return true; } bool bt_persistent_storage_get_ble_pairing_by_addr(const BTDeviceInternal *device, SMIdentityResolvingKey *IRK_out, char name[BT_DEVICE_NAME_BUFFER_SIZE]) { BTDeviceInternal device_out = {}; b...
if (name_out) { strncpy(name_out, name, BT_DEVICE_NAME_BUFFER_SIZE); name_out[BT_DEVICE_NAME_BUFFER_SIZE - 1] = 0; }
if (platform_bits_out) { *platform_bits_out = platform_bits; } return true; } BTBondingID bt_persistent_storage_get_bt_classic_pairing_by_addr(BTDeviceAddress* addr_in, SM128BitKey *link_key_out, ...
n_source = GPIO_PinSource6, .gpio_af = GPIO_AF4_I2C1 }, .sda_gpio = { .gpio = GPIOB, .gpio_pin = GPIO_Pin_9, .gpio_pin_source = GPIO_PinSource9, .gpio_af = GPIO_AF4_I2C1 }, .stop_mode_inhibitor = InhibitorI2C1, .name = "I2C_TOUCH_ALS" }; #endif static I2CBusState I2C_HRM_BUS_STATE = {}; ...
IRQ_MAP(I2C2_EV, i2c_hal_event_irq_handler, &I2C_HRM_BUS)
; IRQ_MAP(I2C2_ER, i2c_hal_error_irq_handler, &I2C_HRM_BUS); IRQ_MAP(I2C4_EV, i2c_hal_event_irq_handler, &I2C_PMIC_MAG_BUS); IRQ_MAP(I2C4_ER, i2c_hal_error_irq_handler, &I2C_PMIC_MAG_BUS); #if BOARD_CUTTS_BB IRQ_MAP(I2C1_EV, i2c_hal_event_irq_handler, &I2C_TOUCH_ALS_BUS); IRQ_MAP(I2C1_ER, i2c_hal_error_irq_handler, &I2...
/* * 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...
(BITS_BETWEEN(0, 7), erased_sector)
; cl_assert(flash_locked); } void test_system_flash__erase_sector_0(void) { cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_16KB_sectors(void) { cl_assert(system_flash_erase(FLASH_BA...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(array && num)
vity_get_minute_history_values.stage++; cl_assert(stage < ARRAY_LENGTH(s_sys_activity_get_minute_history_values.out)); sys_activity_get_minute_history_out_values *out = &s_sys_activity_get_minute_history_values.out[stage]; cl_assert_equal_b(out->asserts, false); cl_assert(minute_data); cl_assert(num_re...
(time_util_get_midnight_of(now), now, &range)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
flash_read_bytes(buffer, flash_addr, num_bytes)
; return crc32(crc, buffer, num_bytes); }
/* * 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_calculate_incremental_words(data_words, num_words)
_app_custom_icon.h" #include "stubs_app_fetch_endpoint.h" #include "stubs_app_manager.h" #include "stubs_app_state.h" #include "stubs_bootbits.h" #include "stubs_build_id.h" #include "stubs_comm_session.h" #include "stubs_event_loop.h" #include "stubs_event_service_client.h" #include "stubs_events.h" #include "stubs_fo...
fake_spi_flash_init(0, 0x1000000)
; pfs_init(false); pfs_format(false); app_install_manager_init(); app_db_init(); app_cache_init(); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false); resource_init(); // simulate installing bg_counter_app on flash app_db_insert((uint8_t *)&bg_counter_app....
); // Expect to have written the command to register for the Player entity: fake_gatt_client_op_assert_write(entity_update, s_register_player_entity, sizeof(s_register_player_entity), GAPLEClientKernel, true /* is_response_required */); ams_ha...
music_command_send(MusicCommandPlay)
)); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Small circles setup_test_aa_sw...
graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT_NXNY, RADIUS_MEDIUM)
pplib/ui/path_layer.h" #include "applib/ui/text_layer.h" #include "kernel/pbl_malloc.h" #include "mfg/mfg_info.h" #include "process_state/app_state/app_state.h" #include "process_management/pebble_process_md.h" #include "util/bitset.h" #include "util/size.h" #include <stdbool.h> #include <stdint.h> #include <stdio.h> ...
(FONT_KEY_GOTHIC_24_BOLD)
); text_layer_set_text_alignment(title, GTextAlignmentCenter); text_layer_set_text(title, "BUTTON TEST"); layer_add_child(&window->layer, &title->layer); TextLayer *status = &data->status; text_layer_init(status, &GRect(5, 110, window->layer.bounds.size.w - 5, windo...
/* * 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...
(str_buffer)
; return jerry_create_undefined(); } static bool prv_text_align_from_value(jerry_value_t value, GTextAlignment *result) { char str[10] = {0}; jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)str, sizeof(str)); #define HANDLE_CASE(identifer, value) \ if (strcmp(identifer, str) == 0) { \ *resu...
/* * 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_add(GPoint((spacing + width) * i - width, offsets_y ? offsets_y[i] : 0), offset)
, .size = { width, heights[i] }, }; graphics_fill_rect(ctx, &box); } } void peek_animations_draw_compositor_foreground_speed_lines(GContext *ctx, GPoint offset) { static const uint16_t s_upper_heights[] = { 48, 73, 78, 48, 48, 48, 61, 48 }; prv_draw_vertical_lines(ctx, ARRAY_LENGTH(s_upper_heights)...
bool requires_address_pinning, uint8_t flags) { // We only have one slot in PRF and all pairing info (except the device // name) will arrive in one-shot so anytime this routine gets called it // means we have 'added' a new pairing bool is_updating...
(&device->opaque, &device_out.opaque)
); } void bt_persistent_storage_set_active_ble_gateway(BTBondingID bonding) { } BTBondingID bt_persistent_storage_get_ble_ancs_bonding(void) { return BLE_BONDING_ID; } bool bt_persistent_storage_is_ble_ancs_bonding(BTBondingID bonding) { return bt_persistent_storage_get_ble_pairing_by_id(BLE_BONDING_ID, NULL, NU...
t JS context as global Layer l = {.bounds = GRect(0, 0, 144, 168)}; const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l); cl_assert_equal_b(jerry_value_is_object(ctx), true); jerry_set_object_field(jerry_get_global_object(), "ctx", ctx); } void test_rocky_api_graphics_path2d__initialize(void) {...
( "ctx.lineTo(5, 6);\n" "ctx.fill();\n" )
; cl_assert_equal_i(1, s_gpath_draw_filled.call_count); MockCallRecording *lc = &s_gpath_draw_filled.last_call; cl_assert_equal_i(3, lc->path.num_points); cl_assert_equal_point(GPoint(0, 1), lc->path.points[0]); cl_assert_equal_point(GPoint(2, 3), lc->path.points[1]); cl_assert_equal_point(GPoint(4, 5), lc-...
te = BlobDBSyncSessionStateIdle; session->db_id = db_id; session->dirty_list = dirty_list; session->session_type = session_type; session->timeout_timer = (const RegularTimerInfo) { .cb = prv_timeout_timer_callback, .cb_data = session, }; s_sync_sessions = (BlobDBSyncSession *)list_prepend((ListNode ...
if (regular_timer_is_scheduled(&session->timeout_timer)) { regular_timer_remove_callback(&session->timeout_timer); }
if (session->session_type == BlobDBSyncSessionTypeDB) { // Only send the sync done when syncing an entire db blob_db_endpoint_send_sync_done(session->db_id); } list_remove((ListNode *)session, (ListNode **)&s_sync_sessions, NULL); kernel_free(session); } } }
xt* ctx, uint8_t stroke_width) { s_stroke_width = stroke_width; } void gpath_draw_stroke(GContext* ctx, GPath* path, bool open) { s_stroke_points = prv_copy_points(path->points, path->num_points, s_offset); s_path_open = open; s_path_stroke_count++; } void gpath_fill_precise_internal(GContext *ctx, GPointPrec...
cl_assert_equal_i(s_path_fill_count, 1)
; cl_assert_equal_i(s_path_stroke_count, 0); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); cl_assert_equal_p(s_stroke_points, NULL); prv_reset(); // make fill color transparent (nothing should be drawn because the stroke width is zero and the // fill is transparent GColor color...
" extern void prv_apply_tint_color(GColor *color, GColor tint_color); static uint8_t s_dest_data[100 * 100]; static GBitmap s_dest_bitmap = { .addr = s_dest_data, .row_size_bytes = 16, .info.format = GBitmapFormat1Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = GRect(0, 0, 100, 100) }; /...
(src_bitmap)
; } // Tests assign, from same size to same size. // Setup: // - Source is 50x50, alternating lines between orange and blue for the top half. // The bottom half is a diagonal orange line over blue. // The left half is semi-transparent and the right half is completely opaque // - Dest is 50x50, white. // Re...
DBSyncSession *session = data; blob_db_sync_cancel(session); } static void prv_timeout_timer_callback(void *data) { system_task_add_callback(prv_timeout_kernelbg_callback, data); } static void prv_send_writeback(BlobDBSyncSession *session) { // we want to write-back the first item in the dirty list BlobDBDirt...
blob_db_get_dirty_list(db_id)
; if (!dirty_list) { blob_db_endpoint_send_sync_done(db_id); return S_NO_ACTION_REQUIRED; } BlobDBSyncSession *session = blob_db_sync_get_session_for_id(db_id); if (session) { // already have a session in progress! return E_BUSY; } session = prv_create_sync_session(db_id, dirty_list, BlobD...
utes, minute_data); // Write first half of the data prv_feed_minute_data(num_minutes / 2, minute_data, false /*simulate_bg_delays*/); // Now, simulate a reboot, re-initialize of the algorithm. This will trigger a re-read // of the sleep data file activity_algorithm_deinit(); activity_algorithm_init(&s_sam...
rtc_get_time()
S 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 "watchface.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "apps/system_app_ids.h" #include "apps/...
app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = system_app_state_machine_get_last_registered_app(), .common.reason = APP_LAUNCH_USER, .common.button = e->button.button_id, })
; } #endif } void watchface_reset_click_manager(void) { WatchfaceData *data = &s_watchface_data; click_manager_reset(&data->click_manager); }
tributes = layout->attributes; const time_t last_updated_time = attribute_get_uint32(attributes, AttributeIdLastUpdated, 0); clock_get_since_time(buffer, config->buffer_size, last_updated_time); } GTextNode *timeline_layout_create_card_view_from_config(const TimelineLayout *layout, ...
{ *size_out = (GSize) { bounds->size.w, height }; }
} GTextNodeCustom *timeline_layout_create_page_break_node(const TimelineLayout *layout) { GTextNodeCustom *page_break_node = graphics_text_node_create_custom(prv_page_break_node_callback, (void *)layout); return page_break_node; } void timeline_layout_time_text_update(const LayoutLayer *layout_ref, ...
.id = 40, .priority = 8, .size = 23717 }, // priority rank 6 { .id = 41, .priority = 61, .size = 266668 }, // priority rank 49 { .id = 42, .priority = 58, .size = 61228 }, // priority rank 46 { .id = 43, .priority = 12, .size = 23513 }, // priority rank 7 { .id = 44, .priority = 60, .size = 267049 }, // pr...
itoa_int(id, buffer, 10)
; int fd = pfs_open(buffer, OP_FLAG_READ, FILE_TYPE_STATIC, 0); if (fd < 0) { return false; } pfs_close(fd); return true; } static void prv_create_file_for_id(AppInstallId id) { char buffer[30]; itoa_int(id, buffer, 10); int fd = pfs_open(buffer, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); pfs_close(...
static void prv_push_manual_dnd_first_use_dialog(ManualDNDFirstUseSource source) { const char *msg = i18n_get("Press and hold the Back button from a notification to turn " \ "Quiet Time on or off.", &s_data); if (source == ManualDNDFirstUseSourceActionMenu) { prv_push_first_use_dialog(msg, prv_toggle_man...
PBL_ASSERTN(success)
; } static bool prv_is_current_schedule_enabled() { return (do_not_disturb_is_schedule_enabled(prv_current_schedule_type())); } static bool prv_is_schedule_active(void) { return (prv_is_current_schedule_enabled() && s_data.is_in_schedule_period && !s_data.manually_override_dnd); } static bool prv_is_sm...