prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
, 832, 144}, { 2048, 664, 32}, { 1872, 760, 32}, { 1752, 1048, 120}, { 1576, 1248, 184}, { 1320, 1464, 328}, { 1016, 1464, 336}, { 720, 1216, 304}, { 472, 472, 88}, { 240, 408, -160}, { 104, 272, -616}, { -200, -8, -656}, { -712, 192, -400}, { -688, 584, -240}, { ...
{ 1224, 528, -160}, { 1160, 680, -168}, { 1368, 712, 0}, { 1680, 696, 200}, { 1960, 520, 304}, // 59 seconds { 1888, 464, 96}, { 1608, 528, 8}, { 1448, 752, -200}, { 1256, 832, -128}, { 968, 688, -48}, { 672, 528, -176}, { 472, 256, -296}, { 328, 8, -424}, { 2...
e(); mag3110_read(WHO_AM_I_REG, 1, &whoami); mag_release(); PBL_LOG(LOG_LEVEL_DEBUG, "Read compass whoami byte 0x%x, expecting 0x%x", whoami, COMPASS_WHOAMI_BYTE); return (whoami == COMPASS_WHOAMI_BYTE); } void mag3110_init(void) { if (s_initialized) { return; } s_mag_mutex = mutex_create(); ...
mag_change_sample_rate(MagSampleRate5Hz)
igh_sensitivity(false); services_set_runlevel(RunLevel_Normal); } static void prv_enter_peek_state(void) { analytics_event_stationary_state_change(rtc_get_time(), StationaryAnalyticsExitToPeek); //! When exiting out of stationary, we aren't certain that this wasn't caused by noise yet //! we set the counter to...
prv_action_jump_table[s_current_state](action)
; } static void prv_setup_callback_info(void) { //! Timer callback to check whether the watch is stationary every minute s_accel_stationary_timer_info = (RegularTimerInfo) { .cb = prv_stationary_check_timer_cb }; //! Button press events s_button_event_info = (EventServiceInfo) { .type = PEBBLE_BUTTO...
/* * 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...
(SYSTEM_APP, &SYSTEM_RESOURCE_VERSION)
) { // System resources are missing! #if defined(IS_BIGBOARD) pbl_log(LOG_LEVEL_ERROR, __FILE_NAME__, __LINE__, "System resources are missing or corrupt, time to sad watch"); launcher_panic(ERROR_BAD_RESOURCES); #else PBL_LOG(LOG_LEVEL_ERROR, "System resources are missing or corrupt! Going to PR...
ius, 2); r = GRect(0, 0, 6, 6); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 2.5, 2.5); cl_assert_fixedS16_3(radius, 2.5); r = GRect(0, 0, 10, 10); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 4.5, 4.5); cl_assert_fixedS...
cl_assert_equal_i(DEG_TO_TRIGANGLE(180), TRIG_PI)
; cl_assert_equal_i(DEG_TO_TRIGANGLE(-180), -TRIG_PI); cl_assert_equal_i(DEG_TO_TRIGANGLE(90), TRIG_PI / 2); cl_assert_equal_i(DEG_TO_TRIGANGLE(-90), -TRIG_PI / 2); cl_assert_equal_i(DEG_TO_TRIGANGLE(0), 0); } void test_graphics_circle__TRIGANGLE_TO_DEG(void) { cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_MAX_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...
{ s_manager_state_change = true; }
static TestImplData s_test_impl_data; // setup and teardown void test_recognizer__initialize(void) { s_test_impl_data = (TestImplData) {}; } void test_recognizer__cleanup(void) { } // tests void test_recognizer__create_with_data(void) { int sub_data; void *dummy = &sub_data; RecognizerImpl s_test_impl = {...
/ Start timer that will periodically check for the erase to complete new_timer_start(s_erase_poll_timer, remaining_ms, prv_flash_erase_timer_cb, NULL, 0); } } static void prv_blocking_erase_complete(void *context, status_t status) { PBL_ASSERT(PASSED(status), "Flash erase failure: %" PRId32, status); } static...
mutex_unlock(s_flash_lock)
; } #endif void flash_sleep_when_idle(bool enable) { // the S29VS flash automatically enters and exits standby } bool flash_get_sleep_when_idle(void) { return false; } bool flash_is_initialized(void) { return (s_flash_lock != NULL); } void flash_stop(void) { if (!flash_is_initialized()) { // Not yet ini...
flash_region_erase_optimal_range_no_watchdog(FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, FLASH_REGION_SHARED_PRF_STORAGE_END, FLASH_REGION_SHARED...
; s_valid_page_idx = 0; prv_write_to_current_page(data, false); } static void prv_invalidate_current_page(void) { PBL_LOG(LOG_LEVEL_DEBUG, "Invalidating current page: #%"PRIu32, s_valid_page_idx); // First, check if the page is Unpopulated SprfMagic magic = prv_get_magic_for_page(s_valid_page_idx); if (mag...
al); int64_t sdk_major_version = 0x14; analytics_heartbeat_set(heartbeat, ANALYTICS_APP_METRIC_SDK_MAJOR_VERSION, sdk_major_version); // Verify that things were set as expected, and adjacent metrics were not // overwritten. int64_t got_time_interval = analytics_heartbeat_get(heartbeat, ANALYTICS_APP_METRIC_T...
(heartbeat, metric, i, -1)
; i++; } } kernel_free(heartbeat); }
hics_private_set_pixel(ctx, GPoint(p.x, p.y + radius)); graphics_private_set_pixel(ctx, GPoint(p.x, p.y - radius)); graphics_private_set_pixel(ctx, GPoint(p.x + radius, p.y)); graphics_private_set_pixel(ctx, GPoint(p.x - radius, p.y)); } #if PBL_COLOR T_STATIC void graphics_circle_draw_1px_aa(GContext* ctx, GPoi...
if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0 - radius, y0), radius + 1); }
prv_fill_horizontal_line(ctx, GPoint(x0 - x, y0 - y), x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 - x), y + 1); } if (quadrant & GCornerTopRight) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0, y0), radius + 1); } prv_fill_horizontal_line(ctx, GPoint(...
/* * 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_is_advertising_for_reconnection()
) { gap_le_advert_unschedule(s_reconnect_advert_job); } } static void prv_evaluate(ReconnectType prev_type) { ReconnectType cur_type = prv_current_reconnect_type(); if (cur_type == prev_type) { return; } if (cur_type != ReconnectType_None) { prv_unschedule_adv_if_needed(); #if CAPABILITY_HAS_BU...
ELINE_COUNT; const TimelineItemActionSource current_item_source = kernel_ui_get_current_timeline_item_action_source(); if (current_item_source == TimelineItemActionSourceModalNotification) { metric = ANALYTICS_DEVICE_METRIC_ACTION_INVOKED_FROM_MODAL_NOTIFICATION_COUNT; } else if (current_item_source == ...
( "Dismiss First Use", RESOURCE_ID_QUICK_DISMISS, tutorial_msg, gcolor_legible_over(GColorLightGray), GColorLightGray, NULL, RESOURCE_ID_ACTION_BAR_ICON_CHECK, expandable_dialog_close_cb)
} cl_assert_equal_i(num_stats, s_stats_num_columns); // Create a new row of stats StatsRow *stats = malloc(sizeof(StatsRow)); memset(stats, 0, sizeof(*stats)); // Collect the stats and also print them out for (int i = 0; i < num_stats; i++) { printf("%s: %d, ", names[i], values[i]); stats->values...
kalg_minute_stats(s_kalg_state, &minute_data.vmc, &minute_data.orientation, &still)
; PBL_ASSERTN(num_minutes_captured < *minute_data_len); minute_data_array[num_minutes_captured++] = minute_data; minute_steps = 0; } num_samples_left -= chunk_size; data += chunk_size; } // ------------------------------------------------------- // Leftover data in epoch, if any ...
n_layer() call below KinoReel *icon = dialog_create_icon(dialog); const GSize icon_size = icon ? kino_reel_get_size(icon) : GSizeZero; const bool show_action_bar = !workout_dialog->hide_action_bar; const GRect *bounds = &window_root_layer->bounds; const uint16_t icon_single_line_text_offset_px = 9; const ...
(x, y, w, h)
, dialog->buffer, dialog_text_font, dialog->text_color, GColorClear, text_alignment, GTextOverflowModeWordWrap); #if PBL_ROUND text_layer_enable_screen_text_flow_and_paging(text_layer, TEXT_FLOW_INSET_PX); #endif t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&buffer, &client, 5)
_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x1F, 0x2); cl_assert_equal_i(s_flush_addr, 0x1F); cl_assert_equal_i(s_flush_size, 0x02); cl_assert_equal_i(s_invalidate_addr, 0x1F); cl_assert_equal_i(s_invalidate_size, 0x02); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid); ...
cl_assert_equal_i(s_invalidate_addr, 0xAA55)
; cl_assert_equal_i(s_invalidate_size, 0x55AA); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid); }
(LOG_LEVEL_DEBUG, "sleep state: %d", (int)value)
; activity_get_metric(ActivityMetricSleepStateSeconds, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "sleep state minutes: %d", (int)(value / SECONDS_PER_MINUTE)); prv_test_end(context, passed); } // ------------------------------------------------------------------------------- // Test that we don't crash or get a we...
app_message_register_inbox_dropped(AppMessageInboxDropped dropped_callback) { AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx(); AppMessageInboxDropped retval = app_message_ctx->inbox.dropped_callback; app_message_ctx->inbox.dropped_callback = dropped_callback; return retval; } AppMessageOutboxS...
app_state_get_app_message_ctx()
; return app_message_ctx->inbox.is_open; } bool app_message_is_accepting_outbound(void) { AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx(); return (app_message_ctx->outbox.phase == OUT_ACCEPTING); } bool app_message_is_closed_inbound(void) { AppMessageCtx *app_message_ctx = app_state_get_app_m...
alarm_is_scheduled) { 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; ...
itr_data->cb(key.id, &alarm_info, itr_data->cb_data)
; return true; } void alarm_for_each(AlarmForEach cb, void *context) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return; } ForEachAlarmItrData itr_data = { .cb = cb, .cb_data = context, }; settings_file_each(&file, alarm_for_each_itr, &itr_data); prv_file_close_and_unlock(&...
ock_recursive(s_app_inbox_mutex); } static void prv_unlock(void) { mutex_unlock_recursive(s_app_inbox_mutex); } static bool prv_list_filter_by_storage(ListNode *found_node, void *data) { return ((AppInboxNode *)found_node)->buffer.storage == (uint8_t *)data; } static AppInboxNode *prv_find_inbox_by_storage(uint8...
(tag, &info)
) { // Inbox wasn't there any more return; } if (!info.message_handler) { // Shouldn't ever happen, but better not PBL_ASSERTN on app task PBL_LOG(LOG_LEVEL_ERROR, "No AppInbox message handler!"); return; } if (!info.num_success && !info.num_failed) { // Shouldn't ever happen, but better...
olorSunsetOrange, GColorBlack)) #define CARD_BACKGROUND_COLOR (PBL_IF_COLOR_ELSE(GColorBulgarianRose, GColorWhite)) static void prv_pulsing_heart_timer_cb(void *context) { Layer *base_layer = context; HealthHrSummaryCardData *data = layer_get_data(base_layer); const uint32_t duration = gdraw_command_sequence_g...
(0, y, base_layer->bounds.size.w, 52)
; /// HRM disabled const char *text = i18n_get("Enable heart rate monitoring in the mobile app", base_layer); graphics_context_set_text_color(ctx, TEXT_COLOR); graphics_draw_text(ctx, text, data->timestamp_font, rect, GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } static void ...
owing block of code was lifted from sys_power_mgr.c:apply_wfi(). // // TODO: It's not entirely clear what's going on, but it does reduce current draw to ~0 uA. At // some point, it's probably worth figuring out how to cleanly hibernate (PBL-42430) hw_cpm_enable_clockless(); hw_cpm_disable_xtal32k(); S...
{ NVIC_ClearPendingIRQ(DMA_IRQn); DMA_Handler(); }
prv_lock()
; { SettingsFile fd; status_t rv = settings_file_open(&fd, BT_PERSISTENT_STORAGE_FILE_NAME, BT_PERSISTENT_STORAGE_FILE_SIZE); if (rv) { return; } settings_file_rewrite(&fd, prv_delete_all_pairings_itr, NULL); settings_file_close(&fd); } prv_unloc...
gacy) { return false; } s_current_completion_status.use_legacy_mode = true; LegacyFwUpdateCompletionStatus *status = &s_current_completion_status.legacy_status; *status = (LegacyFwUpdateCompletionStatus) { .recovery_percent_completion = 0, .resource_percent_completion = 0, .firmware_perc...
(false /* failed */)
; break; default: break; } } static void prv_handle_progress(PebblePutBytesEvent *event) { if (prv_legacy_handle_progress(event)) { return; } if (event->type != PebblePutBytesEventTypeProgress) { return; // Only progress events report bytes_transferred updates } FwUpdateCompletio...
nclude "comm/ble/gatt_service_changed.h" #include "clar.h" #include <btutil/bt_device.h> #include <btutil/bt_uuid.h> #include "FreeRTOS.h" #include "semphr.h" // Fakes /////////////////////////////////////////////////////////// #include "fake_events.h" #include "fake_pbl_malloc.h" #include "fake_GATTAPI.h" #includ...
(event.bluetooth.le.gatt_client.object_ref, characteristic)
; cl_assert_equal_i(event.bluetooth.le.gatt_client.gatt_error, error); PebbleTaskBitset task_mask = ~0; if (kernel) { task_mask &= ~gap_le_pebble_task_bit_for_client(GAPLEClientKernel); } if (app) { task_mask &= ~gap_le_pebble_task_bit_for_client(GAPLEClientApp); } cl_assert_equal_i(event.task_mas...
ationshipBarTypeNone; } const time_t current_end = current->end_time; if ((next->timestamp > current_end) && (current->current_day == next->current_day)) { // Next pin starts after the end of the current pin return RelationshipBarTypeFreeTime; } else if ((next->timestamp == current_end) && (current->cu...
(prev_rel_bar_anim, duration / 3)
on *animation_h, uint32_t delay_ms) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. ...
(state, animation_h, false /*quiet*/)
health_card_type = HealthCardType_Activity, }, }; analytics_event_health_insight_created(notif_time, type, 0); prv_create_and_push_notification(&config); cleanup: i18n_free_all(body); i18n_free_all(headings); i18n_free_all(values); kernel_free(body); kernel_free(headings); kernel_free(values); }...
prv_process_activity_sessions(now_utc)
d *process_manager_address_to_offset(PebbleTask task, void *system_address) { ProcessContext *context = prv_get_context_for_task(task); if (system_address >= context->load_start && system_address < context->load_end) { return (void*)((uintptr_t) system_address - (uintptr_t)context->load_start); } // N...
DEFINE_SYSCALL(bool, process_manager_compiled_with_legacy2_sdk, void)
{ PebbleTask task = pebble_task_get_current(); if (task != PebbleTask_App && task != PebbleTask_Worker) { return false; } const ProcessAppSDKType sdk_type = process_metadata_get_app_sdk_type(sys_process_manager_get_current_process_md()); return sdk_type == ProcessAppSDKType_Legacy2x; } // ------...
her express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "mag3110.h" #include "board/board.h" #include "console/prompt.h" #include "drivers/exti.h" #include "drivers/gpio.h" #include "drivers/i2c.h" #include "drivers/mag.h" #include ...
(DR_STATUS_REG, sizeof(raw_data), raw_data)
/* * 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_data(base_layer)
e); cl_assert_equal_point(test_value, set_value); // Destroy it animation_destroy(h); #endif } // -------------------------------------------------------------------------------------- // Test a basic gtransform property animation void test_animation__property_gtransform(void) { #ifdef TEST_INCLUDE_BASIC Pr...
animation_schedule(h)
; // Test the accessor functions Fixed_S32_16 test_value; property_animation_get_from_fixed_s32_16(prop_h, &test_value); cl_assert_equal_fixed_s32_16(test_value, start_value); property_animation_get_to_fixed_s32_16(prop_h, &test_value); cl_assert_equal_fixed_s32_16(test_value, end_value); Fixed_S32_16...
se if (cmd->num_params == 2) { ((CommandFuncTwoParams) cmd->func)(args.args[0], args.args[1]); } else if (cmd->num_params == 1) { ((CommandFuncOneParam) cmd->func)(args.args[0]); } else if (cmd->num_params == 0) { ((CommandFuncNoParam) cmd->func)(); } done: if (!s_command_continues_after_return && ...
s_current_context->response_callback(response)
(OTP_HWVER_SLOT_INDICES, ARRAY_LENGTH(OTP_HWVER_SLOT_INDICES), hwver, hwver_size, out_index); } void command_serial_read(void) { prompt_send_response(mfg_get_serial_number()); } void command_hwver_read(void) { prompt_send_response(mfg_get_hw_version()); } void command_pcba_ser...
if (prv_get_more_unique_serial(serial_number)) { mfg_write_serial_number(serial_number, MFG_SERIAL_NUMBER_SIZE, NULL); }
} #endif
ce on the phone. #define EMULATED_PPOGATT_SERVICE_HANDLE_MSB 0xE0 #define EMULATED_PPOGATT_SERVICE_HANDLE_LSB 0x00 #define EMULATED_PPOGATT_SERVICE_HDL \ ((EMULATED_PPOGATT_SERVICE_HANDLE_MSB) << 8 | (EMULATED_PPOGATT_SERVICE_HANDLE_LSB)) #define EMULATED_META_CHAR_OFFSET 0x02 #define EMULATED_DATA_CHAR_OFFSET 0x04 ...
(conn_idx)
/* * 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...
PWR_WakeUpPinCmd(PWR_WakeUp_Pin1, enable ? ENABLE : DISABLE)
; #else PWR_WakeUpPinCmd(enable ? ENABLE : DISABLE); #endif } void pwr_flash_power_down_stop_mode(bool power_down) { PWR_FlashPowerDownCmd(power_down ? ENABLE : DISABLE); } void pwr_access_backup_domain(bool enable_access) { periph_config_enable(PWR, RCC_APB1Periph_PWR); PWR_BackupAccessCmd(enable_access ? EN...
charge_mv = battery_curve_lookup_voltage_by_percent(0, true); int full_mv = battery_curve_lookup_voltage_by_percent(100, false); int charge_terminate_mv = battery_curve_lookup_voltage_by_percent(95, false); fake_battery_init(charge_mv, true, true); battery_monitor_init(); periodic_timer_trigger(1); fake...
cl_assert(battery_monitor_critical_lockout())
.timestamp = midnight_march_3_utc, .duration = MINUTES_PER_DAY, .type = TimelineItemTypePin, .layout = LayoutIdTest, .all_day = 1, }, }; cl_assert(timeline_add(&all_day_item)); Iterator iterator = {}; TimelineIterState state = {}; TimelineNode *head = NULL; cl_assert_equal_...
{ const time_t midnight_march_2_pst = 1425283200; TimelineItem all_day_item = { .header = { .id = { 0x29, 0xac, 0xd8, 0xb5, 0x09, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x03, 0x64, 0xd0, 0x5b, 0x9b, 0xc2 }, .timestamp = midnight_march_2_pst, .duration = MINUTES_PER_DAY, .type = Time...
void test_timeline__all_day_multiday(void) { TimelineItem multiday_item = { .header = { .id = {0x29, 0xac, 0xd8, 0xb5, 0x9, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x3, 0x64, 0xd0, 0x5b, 0x9b, 0xc2}, .parent_id = {0}, .timestamp = 1425254400, // midnight March 2 2015 UTC .durati...
>all_day); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[0].header.id)); cl_assert(state.node->all_day); cl_assert(!iter_next(&iterator)); cl_assert(iter_prev(&iterator)); cl_assert(!iter_prev(&iterator)); } void test_timeline__all_day_middle_past(void) { ...
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id))
f led_session = sys_hrm_manager_app_subscribe(app_id + 1, 1, expire_s, HRMFeature_LEDCurrent); HRMSessionRef all_session = sys_hrm_manager_app_subscribe(app_id + 2, 1, expire_s, HRMFeature_BPM|HRMFe...
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); cl_assert_equal_i(s_num_cb_events_1, 1); cl_assert_equal_i(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_...
.overrun_error = (errors & USART_ISR_ORE) != 0, .framing_error = (errors & USART_ISR_FE) != 0, .noise_detected = (errors & USART_ISR_NE) != 0, }; return flags; } bool uart_is_rx_ready(UARTDevice *dev) { return dev->periph->ISR & USART_ISR_RXNE; } bool uart_has_rx_overrun(UARTDevice *dev) { return de...
{ if (dev->state->tx_irq_handler(dev)) { should_context_switch = true; } }
portEND_SWITCHING_ISR(should_context_switch); } void uart_clear_all_interrupt_flags(UARTDevice *dev) { dev->periph->RQR |= USART_RQR_RXFRQ; dev->periph->ICR |= USART_ICR_ORECF; } // DMA //////////////////////////////////////////////////////////////////////////////// void uart_start_rx_dma(UARTDevice *dev, vo...
printf(".text from image CRC32 = 0x%08" PRIX32 "\n", text_crc_from_image)
; if (text_crc_calculated != text_crc_from_image) { printf(".text CRC32 does not match!\n"); } // Reset the DMA controller for (HW_DMA_CHANNEL channel = HW_DMA_CHANNEL_0; channel < HW_DMA_CHANNEL_INVALID; channel++) { hw_dma_channel_enable(channel, HW_DMA_STATE_DISABLED); } // Configure the SPI mo...
/* * 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...
{ settings_file_set(&settings_file, &app_uuid, sizeof(app_uuid), &new_capabilities, sizeof(new_capabilities)); }
t_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 0); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r0_aa_sw11_no_clip....
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"))
; // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_sw1_no_clip.${BIT_DEPTH_NAME}.pb...
rmware. // // No attempt is made to set CONTROL to zero as it should already be set to // the reset value when this code executes. __asm volatile ( "cpsie if\n" // Clear PRIMASK and FAULTMASK "mov lr, 0xFFFFFFFF\n" "mov sp, %[initial_sp]\n" "bx %[reset_handler]\n" : : [initial...
if (!prv_prf_button_combination_is_pressed()) { // stop waiting if not held down any longer return false; }
delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_get_fw_reset_vector(&reset_vector, &initial_sp); if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initial_sp == 0xffffffff) { dbgserial_putstr("Firmware is erased"); return true; } return false; } stati...
See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "./blob_db/weather_data_shared.h" #include "applib/event_service_client.h" #include "kernel/events.h" #include "services/common/comm_session/session_remote_version.h" #include "service...
cl_assert_equal_i(to_check->tomorrow_high, original->tomorrow_high)
; cl_assert_equal_i(to_check->tomorrow_low, original->tomorrow_low); cl_assert_equal_i(to_check->tomorrow_weather_type, original->tomorrow_weather_type); } void test_weather_service__get_data_for_all_locations(void) { size_t count_out; WeatherDataListNode *head = weather_service_locations_list_create(&count_ou...
/* * 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, flash_addr, chunk_size)
; legacy_defective_checksum_update(&checksum, buffer, chunk_size); num_bytes -= chunk_size; flash_addr += chunk_size; } flash_read_bytes(buffer, flash_addr, num_bytes); legacy_defective_checksum_update(&checksum, buffer, num_bytes); kernel_free(buffer); return legacy_defective_checksum_finish(...
return; // Not ready yet, consume nothing. } // Flash_logging_log_start can trigger a flash erase. Release the buffer mutex // to allow logging while the (slow) erase completes. mutex_unlock(s_buffer_mutex); uint32_t flash_addr = flash_logging_log_start(msg_length); mutex_lock(s_buffer_mutex); if (flash_...
{ switch (log_level) { case LOG_LEVEL_ALWAYS: return '*'; case LOG_LEVEL_ERROR: return 'E'; case LOG_LEVEL_WARNING: return 'W'; case LOG_LEVEL_INFO: return 'I'; case LOG_LEVEL_DEBUG: return 'D'; case LOG_LEVEL_DEBUG_VERBOSE: return 'V'; default: return '?'; } }
gcolor_equal(context.draw_state.fill_color, GColorWhite)); // Compositing Mode graphics_context_set_compositing_mode(&context, GCompOpOr); cl_assert(context.draw_state.compositing_mode == GCompOpOr); // Text Color graphics_context_set_text_color(&context, GColorClear); cl_assert_equal_i(context.draw_state...
(&context, &GRect(20, 80, 40, 10), 4)
; ASSERT_CALLED(prv_draw_round_rect(&context, &GRect(20, 80, 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)); ...
(animation_get_duration(b, true, false), delay_b + duration_b); cl_assert_equal_i(animation_get_duration(b, true, true), total_duration_b); cl_assert_equal_i(animation_get_duration(seq, false, false), total_duration_a + total_duration_b); cl_assert_equal_i(animation_get_duration(seq, false, true), ...
cl_assert_equal_i(prv_count_scheduled_animations(), 0)
; // Make sure just the setup and teardown handlers were called cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 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_eq...
int8_t *value, size_t value_length, BLEGATTError error) { PBL_ASSERTN(client->state == StateDisconnectedReadingMeta); if (error != BLEGATTErrorSuccess) { goto handle_error; } if (value_length < sizeof(PPoGATTMetaV0)) { goto handle_error; } const PPoGATTMetaV0 *meta =...
{ if (client->characteristics.meta == characteristics[i] || client->characteristics.data == characteristics[i]) { client_removed = true; prv_delete_client(client, true, DeleteReason_ServiceRemoved); break; } }
client = next; } // PBL-42768 - In the logs in this ticket it looks to me like we missed that the service // was removed. Add some diagnostic logging to hopefully reveal more info on a failure if (!client_removed) { BLECharacteristic meta = 0; BLECharacteristic data = 0; // as...
0); } void test_ppogatt__cleanup_client_when_data_subscription_cccd_write_failed(void) { fake_gatt_client_subscriptions_set_subscribe_return_value(BTErrnoInvalidParameter); prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], ...
fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment))
; cl_assert_equal_b(success, true); ppogatt_send_next(transport); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment)); } // Receive ACK for first data packet with sn=0: prv_receive_ack(s_characteristi...
// Sleep and activity metric stats static ActivityInsightMetricHistoryStats s_sleep_stats; static ActivityInsightMetricHistoryStats s_activity_stats; // ----------------------------------------------------------------------------------------- // Reward notification configurations - notification attributes, settings ke...
i18n_noop("You're being consistent and that's important, keep at it!")
, .detail_text = i18n_noop("CONSISTENT!"), }, { // PercentTier_BelowAverage .body = i18n_noop("Resting is fine, but try to recover and step it up tomorrow!"), .detail_text = i18n_noop("NOT VERY ACTIVE"), }, { // PercentTier_Fail .body = i18n_noop("Resting is fine, but try to reco...
PBL_LOG(LOG_LEVEL_DEBUG, "WRITEBACK Response")
; prv_handle_wb_response(session, data, data_length); break; case BLOB_DB_COMMAND_SYNC_DONE_RESPONSE: PBL_LOG(LOG_LEVEL_DEBUG, "SYNC DONE Response"); prv_handle_sync_done_response(session, data, data_length); break; default: PBL_LOG(LOG_LEVEL_ERROR, "Invalid BlobDB2 message 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...
if (is_active == s_data.was_active) { // No change return; }
s_data.was_active = is_active; PBL_LOG(LOG_LEVEL_INFO, "Quiet Time: %s", prv_bool_to_string(is_active)); prv_update_active_time(is_active); prv_put_dnd_event(is_active); } static void prv_toggle_smart_dnd(void *e_dialog) { alerts_preferences_dnd_set_smart_enabled(!alerts_preferences_dnd_is_smart_enabled())...
G(LOG_LEVEL_DEBUG, "Master requesting conn param change, Conn Idx: %d - (%d %d %d %d)", evt->conn_idx, (int)conn_params.interval_min, (int)conn_params.interval_max, (int)conn_params.slave_latency, (int)conn_params.sup_timeout); // accept the change ble_gap_conn_param_update_reply(evt->conn_idx,...
(LOG_LEVEL_DEBUG, "Auto-accepting pairing request")
; extern void pair_reply(uint16_t conn_idx, bool is_confirmed); pair_reply(conn_idx, true); return; } hc_endpoint_pairing_send_pairing_request(&device); } static void prv_handle_address_resolved(const ble_evt_gap_address_resolved_t *evt) { PBL_LOG(LOG_LEVEL_DEBUG, "IRK exchanged and address resolved...
This command will insert a key and value into the database specified. //! //! \code{.c} //! 0x01 <uint16_t token> <uint8_t DatabaseId> //! <uint8_t key_size M> <uint8_t[M]> key_bytes> //! <uint16_t value_size N> <uint8_t[N]> value_bytes> //! \endcode //! //! <b>DELETE:</b> This command will delete an entry with the key...
{ prv_send_response(session, token, BLOB_DB_INVALID_DATA); return; }
// read value length and value bytes ptr uint16_t value_size; const uint8_t *value_bytes = NULL; iter = prv_read_value_size(iter, data + length, &value_size); iter = prv_read_ptr(iter, data + length, &value_bytes, value_size); // If we read too many bytes or didn't read all the bytes (2nd test) if (!it...
ata == characteristic); } return client; } // ------------------------------------------------------------------------------------------------- static bool prv_uuid_filter_callback(ListNode *found_node, void *data) { const PPoGATTClient *client = (const PPoGATTClient *) found_node; const Uuid *uuid = (const U...
MIN(PPOGATT_V1_DESIRED_RX_WINDOW_SIZE, PPOGATT_SN_MOD_DIV - 1); client->out.rx_window_size = desired_rx_window; } else { client->out.tx_window_size = client->out.rx_window_size = PPOGATT_V0_WINDOW_SIZE; }
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); // Complete A and start B prv_advance_to_ms_with_timers(start_ms + delay_...
de "process_management/app_install_manager.h" #include "process_management/pebble_process_md.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/persist.h" #include "system/logging.h" // Stubs //////////////////////////////////// #include "fake_rtc.h" #include "fake_spi_flash.h" #include "stubs_an...
persist_service_init()
; persist_service_client_open(&test_uuid_a); } void test_persist__cleanup(void) { persist_service_client_close(&test_uuid_a); } void test_persist__int(void) { const uint32_t key = 0; const uint32_t value = ~0; cl_assert_equal_i(persist_read_int(key), 0); cl_assert_equal_i(persist_write_int(key, value), s...
itten_hw_version1); hw_version = mfg_get_hw_version(); cl_assert(strcmp(written_hw_version1, hw_version) == 0); #if (BOARD_SILK_BB || BOARD_CALCULUS) // Write a second time, too long. const char* written_hw_version2_long = "abcdefghijkxyz"; command_hwver_write(written_hw_version2_long); hw_version = mfg_ge...
(sn, "XXXXXXXXXXXX")
; // First time: const char *first_sn = "ABCDEFGHIJKL"; r = mfg_write_serial_number(first_sn, strlen(first_sn), &index); sn = mfg_get_serial_number(); cl_assert_equal_i(index, 0); cl_assert_equal_i(r, MfgSerialsResultSuccess); cl_assert_equal_s(sn, first_sn); // Second time: const char *second_sn = ...
case_items[2].header.id)); cl_assert(!iter_next(&iterator)); } // 5am, no events passed void test_timeline__extra_case_none_backwards(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeli...
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), init_net_allocs)
; } void test_timeline__delete_on_iterator(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); // s_items[0] is the earliest pin, follow...
unsubscribe from HRM manager because A is still subscribed: ble_hrm_handle_disconnection(&s_conn_a); cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(&s_conn_a)); prv_assert_event_service_subscribed(true); cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1); cl_assert_equal_i(s_sy...
(s_device_a, true)
; // No sharing request UI: cl_assert_equal_p(NULL, s_last_sharing_request); // Fake disconnection: ble_hrm_handle_disconnection(&s_conn_a); // Fake reconn & subscribe: bt_driver_cb_hrm_service_update_subscription(s_device_a, true); // No sharing request UI: cl_assert_equal_p(NULL, s_last_sharing_re...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ ISCTYPE_TEST(isspace) }
void test_ctype__ispunct(void) { ISCTYPE_TEST(ispunct) } void test_ctype__isalnum(void) { ISCTYPE_TEST(isalnum) } void test_ctype__isprint(void) { ISCTYPE_TEST(isprint) } void test_ctype__isgraph(void) { ISCTYPE_TEST(isgraph) } void test_ctype__iscntrl(void) { ISCTYPE_TEST(iscntrl) } void test_ctype__isascii(void) { 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...
if (address < 0) { prompt_send_response("Invalid address"); return; }
int length = atoi(length_str); if (length <= 0) { prompt_send_response("Invalid length"); return; } char buffer[128]; prompt_send_response_fmt(buffer, 128, "Erasing sectors from 0x%"PRIx32" for %ub", address, length); const uint32_t end_address = address + length; co...
ILL_AA)); data->antialiased = ((data->state_index == APP_STATE_DRAW_AA_NO_SW) || (data->state_index == APP_STATE_DRAW_AA_SW) || (data->state_index == APP_STATE_FILL_AA)); } static void back_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = app_sta...
if (data->rect.origin.y < 0 || data->rect.origin.y + data->rect.size.h > data->window.layer.bounds.size.h) { data->rect_velocity_y = data->rect_velocity_y * -1; }
} else if (shape == RECTANGLE_ROUND) { // Move rounded line X per 4*Y data->rectr.origin.x += (data->rectr_velocity_x * PIXEL_SPEED_PER_FRAME); if (data->rectr.origin.x < 0 || data->rectr.origin.x + data->rectr.size.w > data->window.layer.bounds.size.w) { data->rectr_velocity_x ...
1288, 680, -336}, { 1208, 728, -344}, { 1504, 728, -240}, { 1792, 568, -56}, { 1560, 352, -32}, { 1240, 304, -64}, { 1064, 312, -96}, { 960, 280, -96}, { 840, 208, -104}, { 728, 136, -24}, { 560, 80, 8}, { 576, 136, -16}, { 808, 224, -184}, { 800, 144, -136}, { 95...
{ 1440, 160, -120}, { 1384, 264, -144}, { 1088, 384, -256}, // 112 seconds { 888, 496, -304}, { 840, 472, -176}, { 864, 424, -152}, { 904, 432, -168}, { 904, 464, -216}, { 856, 464, -312}, { 864, 520, -368}, { 944, 656, -432}, { 1032, 648, -352}, { 1360, 736, -336...
language governing permissions and * limitations under the License. */ #if PLATFORM_SPALDING #include "display_calibration_prompt.h" #include "applib/ui/dialogs/confirmation_dialog.h" #include "apps/system_apps/settings/settings_display_calibration.h" #include "kernel/event_loop.h" #include "kernel/ui/modals/moda...
mfg_get_serial_number()
); } void display_calibration_prompt_show_if_needed(void) { if (!prv_is_potentially_misaligned_watch()) { shell_prefs_set_should_prompt_display_calibration(false); return; } if (shell_prefs_should_prompt_display_calibration()) { s_timer = new_timer_create(); const uint32_t prompt_delay_time_ms =...
v_advance_by_ms_no_timers(dst_time - now); return; } // Advance time to when timer would fire and fire it uint32_t ms_delta = stub_new_timer_timeout(sys_timer_id); if (ms_delta < dst_time - now) { prv_fire_animation_timer(); } else { prv_advance_by_ms_no_timers(dst_time - now); ...
{ prv_add_handler_entry(&s_started_handler_calls, animation, false, context); DPRINTF("%"PRIu64" ms: Executing started handler for %d\n", prv_now_ms(), (int)animation); }
// -------------------------------------------------------------------------------------- // Stopped handler static void prv_stopped_handler(Animation *animation, bool finished, void *context) { prv_add_handler_entry(&s_stopped_handler_calls, animation, finished, context); DPRINTF("%"PRIu64" ms: Executing stopped...
/* * 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...
GSize(144, 168)
; const int row_1bit_size_words = 1 + (size.w - 1) / 32; GBitmap *bitmap = gbitmap_create_blank(size, GBitmapFormat8Bit); uintptr_t base = (uintptr_t)bitmap->addr; int dest_x = 0; int dest_y = 0; uint32_t *block_addr = NULL; block_addr = (uint32_t *)(uintptr_t)(((dest_y * row_1bit_size_words) + (dest_x...
onst bool descend) { return prv_layer_tree_traverse_next(stack, max_depth, current_depth, descend); } void layer_render_tree(Layer *node, GContext *ctx) { // NOTE: make sure to restore ctx->draw_state before leaving this function const GDrawState root_draw_state = ctx->draw_state; uint8_t current_depth = 0; ...
MAX(frame->size.w - visible_width, 0)
; layer->bounds.size.h += MAX(frame->size.h - visible_height, 0); } } layer_mark_dirty(layer); } void layer_set_frame_by_value(Layer *layer, GRect frame) { layer_set_frame(layer, &frame); } void layer_get_frame(const Layer *layer, GRect *frame) { *frame = layer->frame; } GRect layer_get_frame_by_v...
//////////////////////////////////////////////////// //! Counter variables static int s_num_timer_register_calls = 0; static int s_alarm_timer_timeout_ms = 0; static int s_snooze_timer_timeout_ms = 0; static int s_snooze_timer_id = 0; ///////////////////////////////////////////////////////////////////////////////////...
(id, 4, 14, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule)
; id = alarm_create(&(AlarmInfo) { .hour = 5, .minute = 14, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id, 5, 14, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); id = alarm_create(&(AlarmInfo) { .hour = 6, .minute = 14, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id, 6, 14, false, ALAR...
HOUT 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 "clar.h" #include "util/attributes.h" #include "util/pstring.h" #include "services/normal/blob_db/weather_db.h" #include "service...
{ const WeatherDBEntry *existing_entry = weather_shared_data_get_entry(0); const size_t entry_size = sizeof(*existing_entry); WeatherDBEntry *new_entry = task_zalloc_check(entry_size); *new_entry = *existing_entry; new_entry->version = version; WeatherDBKey key = (WeatherDBKey) { 0, 0, 0, 0, 0, 0, 0, ...
void test_weather_db__lower_version_not_inserted(void) { for (size_t version = 0; version < WEATHER_DB_CURRENT_VERSION; version++) { prv_check_invalid_version_code_not_inserted(version); } } void test_weather_db__higher_version_not_inserted(void) { prv_check_invalid_version_code_not_inserted(WEATHER_DB_CUR...
nt NUM_GOTHIC_CODEPOINTS = sizeof(s_valid_gothic_codepoints) / sizeof(uint32_t); bool is_valid = utf8_is_valid_string(s_valid_gothic_codepoints_string); cl_assert(is_valid); utf8_t* valid_gothic_codepoints_utf8 = (utf8_t*) s_valid_gothic_codepoints_string; for (int i = 0; i < NUM_GOTHIC_CODEPOINTS; i++) { ...
("Hello", output_buffer, 5)
; cl_assert_equal_s(output_buffer, "H\xe2\x80\xa6"); cl_assert_equal_i(trunc_size, 5); // test that if we don't need to truncate, we don't output_buffer = realloc(output_buffer, 12); trunc_size = utf8_truncate_with_ellipsis("Hello there", output_buffer, 12); cl_assert_equal_s(output_buffer, "Hello there");...
*timestamp_us) { int retries = 0; while (retries < 10) { uint8_t ts_before[3], ts_after[3]; // We want to find the timestamp of the latest sample in the fifo so: // 1. read the current sensor timestamp // 2. read the current length of the fifo // 3. read the sensor timestamp again // ...
BMI160_DBG("%s", "We fell behind on data handling")
; } } // in order to actually enter 'low power' mode, we have to set up accel to do // undersampling. The more samples we use for one reading, the higher the power // consumption but the lower the RMS noise static void prv_accel_enable_undersampling(bool enable) { const uint8_t acc_us_bwp_mask = (BMI160_ACC_...
me = name, .value = value, .icon_info = &icon_res_info, .icon_layer = i == 0 ? &layout->icon_layer : layout->metric_icon_layers[i - 1], }, }; GTextNodeText *metric_node = (GTextNodeText *)layout_create_text_node_from_config( layou...
(&frame, box, kino_layer_get_alignment(kino_layer), false)
; frame.origin.y = box->origin.y; layer_set_frame(&kino_layer->layer, &frame); } if (size_out) { *size_out = frame.size; } } GTextNodeCustom *layout_node_create_kino_layer_wrapper(KinoLayer *kino_layer) { return graphics_text_node_create_custom(prv_kino_layer_wrapper_callback, (void *)kino_layer); ...
"Alarm"); const char *pin_subtitle = attribute_get_string(pin_attr_list, AttributeIdSubtitle, NULL); cl_assert_equal_s(pin_subtitle, alarm_get_string_for_kind(alarm_kind, false /* all_caps */)); const AlarmKind pin_alarm_kind = (AlarmKind)attribute_get_uint8(pin_attr_list, ...
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time())
; // Copy the types array directly after the Session bytes. memcpy(types_copy, config->measurements.types, extra_space); // Generate a new UUID Uuid uuid; uuid_generate(&uuid); PLogTypesEncoderArg types_encoder_arg = { .num_types = session->config.measurements.num_types, .types = session->config.m...
if (!session) { kernel_free(msg_buffer); kernel_free(data_buffer); return NULL; }
*session = (PLogSession) { .config = *config, .msg_buffer = msg_buffer, .data_buffer = data_buffer, .max_msg_size = max_msg_size, .max_data_size = max_data_size, .transport = transport, }; // Start a new encoding const bool success = prv_session_encode_start(session); if (!success) ...
/* * 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...
{ new_timer_delete(s_timer); s_timer = TIMER_INVALID_ID; s_app_started = false; }
} void app_idle_timeout_pause(void) { if (s_timer != TIMER_INVALID_ID) { new_timer_stop(s_timer); } s_app_paused = true; } void app_idle_timeout_resume(void) { s_app_paused = false; #ifndef NO_WATCH_TIMEOUT prv_start_timer(false /* do not create a timer */); #endif } void app_idle_timeout_refresh(void...
k to very EOF if ((new_offset >= 0) && (new_offset <= (int)PFS_FD(fd).file.file_size)) { if (PFS_FD(fd).file.offset != (uint32_t)new_offset) { PFS_FD(fd).file.offset = (uint32_t)new_offset; PFS_FD(fd).file.curr_page = INVALID_PAGE; } res = new_offset; } else { res = E_RANGE; } ...
(page_flags, PAGE_FLAG_START_PAGE)
rtificationMenuItem) { .draw_cell_fn = prv_draw_regulatory_id_cell, .arg1 = "IFETEL", .arg2 = prv_get_mexico_ifetel_id(), }); } if (flags->has_korea_kcc) { prv_append_regulatory_compliance_mark(cd, &cd->kcc_mark); } if (flags->has_eu_ce) { prv_append_regulatory_compliance_ma...
(window_bounds.size.w, fonts_get_font_height(info_text_font))
; const int16_t vertical_spacing = 3; GRect certification_rect = (GRect) { .size = GSize(window_bounds.size.w, bmp_size.h + title_text_size.h + info_text_size.h + vertical_spacing) }; grect_align(&certification_rect, &window_bounds, GAlignCenter, true /* clip */); GRect bmp_frame = (GRe...
{ 1280, 240, -88}, { 1312, 144, -24}, { 1216, 128, -64}, { 1016, -112, -80}, { 744, -104, -136}, { 720, -224, -256}, { 768, -16, -384}, { 1104, 32, -320}, { 1160, 160, -352}, { 1104, 160, -288}, { 1008, 336, -312}, { 1224, 368, -240}, { 1424, 552, -272}, { 1632, 728, ...
{ 1464, 616, -320}, { 1072, 704, -280}, { 864, 528, -440}, { 880, 848, -376}, { 1256, 936, -248}, { 1520, 904, -232}, { 1208, 464, -264}, { 968, 496, -256}, { 1056, 512, -176}, { 1112, 336, -112}, { 1064, -112, -24}, { 976, 128, -224}, // 50 seconds { 1080, 96, -1...
, .size = 42163 }, // priority rank 19 { .id = 48, .priority = 56, .size = 72854 }, // priority rank 42 { .id = 49, .priority = 49, .size = 217548 }, // priority rank 37 { .id = 50, .priority = 1, .size = 207357 }, // priority rank 1 }; extern uint32_t app_cache_get_size(void); void prv_load_lotta_apps(void)...
cl_assert_equal_b(true, prv_file_for_id_exists(17))
; // confirm binaries are deleted app_cache_remove_entry(17); cl_assert_equal_b(false, prv_file_for_id_exists(17)); } void test_app_cache__free_up_space_save_defaults(void) { uint32_t to_free; uint32_t before_size; uint32_t after_size; // lets save ids 17, 25, 42, and 47 because they are my favorite nu...
GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 40, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_outside_nx(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_...
(&layer, &draw_text_single_line_ellipsis_clip_outside_x)
; layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_x.${BIT_DEPTH_NAME}.pbi")); // Word Wrap tests test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_ny); layer_render_tree(&...
to_copy; } static size_t prv_send_job_impl_get_read_pointer(const SessionSendQueueJob *send_job, const uint8_t **data_out) { SendBuffer *sb = (SendBuffer *)send_job; *data_out = prv_get_read_pointer(sb); return prv_get_remaining_length(sb); } static void prv_send...
{ CommSession *session = sb->session; // Clear out the ListNode and set impl: sb->queue_job = (const SessionSendQueueJob) { .impl = &s_default_kernel_send_job_impl, }; sb->header.length = ntohs(sb->written_length); comm_session_send_queue_add_job(session, (SessionSendQueueJob **)&sb); }
// ------------------------------------------------------------------------------------------------- // Interfaces for testing SemaphoreHandle_t comm_session_send_buffer_write_semaphore(void) { return s_default_kernel_sender_write_semaphore; } void comm_default_kernel_sender_deinit(void) { vSemaphoreDelete(s_de...
s a chance to access the flash in between // each page write. // TODO: uncomment the lines below to resolve PBL-17503 // if (buffer_size) { // mutex_unlock(s_flash_lock); // mutex_lock(s_flash_lock); // } } stop_mode_enable(InhibitorFlash); mutex_unlock(s_flash_lock); } // Returns 0 i...
{ return s_erase.expected_duration / 8; }
) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 200; const int duration_c = 500; const int repeat_count = 5; int duration_total = duration_a + MAX(duration_b, duration_c); // Create 3 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, dur...
(spawn_b, handlers, (void *)spawn_a)
; break; } } // Create the sequence Animation *seq = animation_sequence_create(spawn_a, spawn_b, NULL); // Schedule it prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); fake_rtc_auto_increment_ticks(0); // Let the first spawn finish prv_advanc...
{ PBL_LOG(LOG_LEVEL_WARNING, "Failed to load glyph bitmap from resources; cp: %"PRIx32", addr: %"PRIx32, codepoint, bitmap_addr); return false; } if (HAS_FEATURE(font_res->md.version, VERSION_FIELD_FEATURE_RLE4)) { SYS_PROFILER_NODE_START(text_render_compress); ...
SYS_PROFILER_NODE_START(text_render_flash)
; num_bytes_loaded = sys_resource_load_range(font_res->app_num, font_res->resource_id, data->resource_offset, (uint8_t *)&g->header, sizeof(GlyphHeaderData)); SYS_PROFILER_NODE_STOP(text_render_flash); } if (!num_...
_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); } void test_workout_active__cleanup(void) { } // Helpers ////////////////////// static void prv_create_window_and_render(WorkoutActiveWindow *active_window, ...
(active_window, 0)
3); cl_assert(list_count(&a) == 3); cl_assert(list_count(&b) == 3); cl_assert(list_count(&c) == 3); cl_assert(list_count_to_tail_from(&a) == 3); cl_assert(list_count_to_tail_from(&b) == 2); cl_assert(list_count_to_tail_from(&c) == 1); cl_assert(list_count_to_head_from(&c) == 3); cl_assert(list_count_to_...
list_find_prev(NULL, filter_odd, false, NULL)
== NULL); } void test_list__concatenate(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL; ListNode d = LIST_NODE_NULL, e = LIST_NODE_NULL, f = LIST_NODE_NULL; cl_assert_equal_p(list_concatenate(&a, &b), &a); cl_assert_equal_p(a.next, &b); cl_assert_equal_p(b.prev, &a); cl_asse...
/* * 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...
(MHZ_TO_HZ(36), I2CBusMode_FastMode, KHZ_TO_HZ(400), 0, 0)
, 1, 54, 30, 4); } void test_i2c_timingr__valid_prescaler_no_rise_fall_time(void) { // We'll use a base clock speed of 360Mhz and try to get to 100kHz I2C. This requires a prescaler // of 8 which gets us down to a base clock speed of 45MHz. // // 45MHz / 100kHz = 450 cycles => 450 - ceil(6 /...
/* * 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_render_tree(&layer, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_nx_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_y_origin_...
t(gtransform_is_equal(&t, &t_c)); cl_assert(gtransform_is_identity(&t)); cl_assert(gtransform_is_identity(&t_c)); // Test Scale Matrix t = GTransformScale(GTransformNumberFromNumber(2), GTransformNumberFromNumber(5)); t_c = GTransformFromNumbers(2, 0, 0, 5, 0, 0); cl_assert(gtransform_is_equal(&t, &t_c));...
(gtransform_is_equal(&t1, &t2))
; // ensure t1 has not changed gtransform_scale_number(&t_new, &t1, 10, 200); cl_assert(gtransform_is_equal(&t_new, &t_c)); cl_assert(gtransform_is_equal(&t1, &t2)); // ensure t1 has not changed // Test pointer re-use gtransform_scale(&t1, &t1, GTransformNumberFromNumber(10), GTransformNumberFromNumber(200)...
wa_state(conn); if (!state) { state = (PPoGATTWorkAroundState *)kernel_zalloc_check(sizeof(PPoGATTWorkAroundState)); connection_set_ppogatt_wa_state(conn, state); } return state; } void ppogatt_destroy_state(PPoGATTWorkAroundState *state) { if (state->pending_response_data) { kernel_free(state->pen...
hc_endpoint_gatt_send_notification(&addr, EMULATED_DATA_CHAR_HANDLE, evt->length, evt->value)
; } else if (evt->handle == s_ppogatt_ctx.att_hdl.cccd) { if (evt->offset == 0) { uint16_t value; memcpy(&value, evt->value, sizeof(value)); bool subscribed = (GATT_CCC_NOTIFICATIONS == value); prv_handle_cccd_write(conn, subscribed); PBL_LOG(LOG_LEVEL_DEBUG, "Wrote reversed PPoGATT ...
white / black lines. // - Dest is Blue, 100x100. // - Dest offset is (0,0) to blit to top left corner. // Result: // - 25x25 alternating black / white lines in top left corner. void test_bitblt__1bit_to_8bit_compop(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__1bit_to_8bit_assign.1bit.pbi"); ...
(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorWhite)
n ((int16_t[NumPreferredContentSizes]) { //! @note this is the same as Medium until Small is designed [PreferredContentSizeSmall] = PBL_IF_RECT_ELSE(46, MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT), [PreferredContentSizeMedium] = PBL_IF_RECT_ELSE(46, MENU_...
layer_set_hidden((Layer *) &data->text_layer, true)
; } } static void prv_handle_notification_removed(Uuid *id) { prv_remove_notification(s_data, id); app_notification_window_remove_notification_by_id(id); } static void prv_handle_notification_acted_upon(Uuid *id) { app_notification_window_handle_notification_acted_upon_by_id(id); } static void prv_handle_not...
&ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_y.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_nx); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest...
(framebuffer_is_empty("draw_text_null", fb, GColorWhite))
; setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL_W, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null_w...
(32 * 1024, 32 * 1024, (32 + 18) * 1024, (32 + 96) * 1024)
; cl_assert_equal_i(s_command_list_index, 5); cl_assert_equal_i(s_command_list[0].addr, 32 * 1024); cl_assert_equal_i(s_command_list[0].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[1].addr, 36 * 1024); cl_assert_equal_i(s_command_list[1].type, SubsectorEraseCommand); cl_assert_equal_i(...
ME}__lock(void) { // Test all the setup test combinations as above setup_test(&context, false, 1, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_dra...
(&draw_state, &context.draw_state, sizeof(GDrawState))
== 0); // Compositing Mode draw_state = graphics_context_get_drawing_state(&context); graphics_context_set_compositing_mode(&context, GCompOpOr); cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0); // Text Color draw_state = graphics_context_get_drawing_state(&context); graphi...
= NULL; static void prv_schedule_retry(); static void prv_create_event_session_cb(void *ignored); static void prv_reset_local_session_ptrs(void) { s_device_heartbeat_session = NULL; s_app_heartbeat_session = NULL; s_event_session = NULL; } static void prv_timer_callback(void *data) { if (!dls_initialized()) ...
{ uint32_t size = analytics_heartbeat_kind_data_size(ANALYTICS_HEARTBEAT_KIND_APP); s_app_heartbeat_session = prv_create_dls(ANALYTICS_BLOB_KIND_APP_HEARTBEAT, size); if (!s_app_heartbeat_session) return; }
// Tell the watchdog timer that we are still awake. dls_create() could take up to 4 seconds if // we can't get the ispp send buffer system_task_watchdog_feed(); analytics_external_update(); // Tell the watchdog timer that we are still awake. Occasionally, analytics_external_update() // could take a whil...