prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ocessed_command, size_t processed_command_max_size, const GDrawCommandList* list, const GDrawCommand *command) { CompositorColorReplacementProcessor *p = (Composi...
PBL_ASSERTN(app_framebuffer.info.format == framebuffer->info.format)
; PBL_ASSERTN(app_framebuffer.data_row_infos == framebuffer->data_row_infos); const GBitmapDataRowInfo source_data_row_info = gbitmap_get_data_row_info(&app_framebuffer, y); GColor8 *input = (GColor8 *)(source_data_row_info.data + x1.integer); GColor8 *output = (GColor8 *)(destination_data_row_info.data + x1.i...
en an even number of elements, it will return the lower of the two values // Torben median algorithm from http://ndevilla.free.fr/median/median/index.html static int32_t prv_calculate_median(const int32_t *data, uint32_t num_data, int32_t min, int32_t max, uint32_t num_values, StatsB...
if (t_a > t_b) { return 1; } else { return 0; }
} //! Source: //! http://artax.karlin.mff.cuni.cz/r-help/library/matrixStats/html/weightedMedian.html //! Description: (copied here in case website goes down) //! For the n elements x = c(x[1], x[2], ..., x[n]) with positive weights //! w = c(w[1], w[2], ..., w[n]) such that sum(w) = S, the weighted median is 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...
cl_will_return_count(rng_rand, true, RNG_ROUNDS * SMRootKeyTypeNum)
; cl_will_return_count(bt_persistent_storage_set_root_keys, true, 1); SM128BitKey keys[SMRootKeyTypeNum]; ble_root_keys_get_and_generate_if_needed(keys); prv_assert_key_is_equal_to_rng_key(&keys[SMRootKeyTypeEncryption], SMRootKeyTypeEncryption); prv_assert_key_is_equal_to_rng_key(&keys[SMRootKeyTypeIdentit...
176}, { 568, 40, -224}, { 592, -32, -192}, { 736, 160, -208}, { 912, 152, -312}, { 1104, 16, -296}, { 1080, 0, -352}, { 1272, -64, -352}, { 872, 200, -296}, { 928, 96, -464}, { 1016, 80, -456}, { 864, 48, -384}, { 680, 40, -368}, // 59 seconds { 544, 112, -176}, ...
{ 1264, 176, -384}, { 1376, 184, -400}, { 1368, 184, -304}, { 1368, 112, -216}, { 1312, -8, -152}, { 976, -8, -152}, { 624, -16, -184}, { 432, -24, -176}, { 456, -32, -120}, { 576, -8, -168}, { 856, -72, -88}, { 1144, -72, -176}, { 1256, -8, -280}, { 1568, -128, -...
{ 504, 176, -272}, { 624, 200, -280}, { 808, 288, -320}, { 1040, 352, -496}, { 1352, 232, -344}, { 1112, 360, -424}, { 1224, 232, -288}, // 67 seconds { 1216, 176, -224}, { 1056, 104, -96}, { 872, 56, -184}, { 584, 112, -240}, { 480, 112, -280}, { 536, 80, -176},...
color); simple_dialog_push(simple_dialog, prv_get_window_stack()); } static void prv_push_long_error_dialog(VoiceUiData *data, const char* header, const char *text, uint32_t resource_id) { prv_set_mic_window_state(data, StateError); ExpandableDialog *long_error_dialog = &data->long_error_dialog; expandabl...
("Handling ready event")
; switch (event->status) { case VoiceStatusSuccess: VOICE_LOG("Session setup successfully"); data->start_ms = prv_get_time_ms(); data->speech_detected = false; data->dictation_timeout = app_timer_register(DICTATION_TIMEOUT, prv_dictation_timeout_cb, data); // Update UI ...
/* * 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...
strlen(name)
e_t s; uint16_t ms; rtc_get_time_ms(&s, &ms); vibe->time_start = ((uint64_t)s) * 1000 + ms; vibe->time_end = END_NOT_SET; PBL_ASSERTN(s_vibe_history_mutex); mutex_lock(s_vibe_history_mutex); if (s_vibe_history == NULL) { s_vibe_history = vibe; } else { list_append((ListNode*)s_vibe_history, (Li...
{ return s_vibe_strength_default; }
void vibes_set_default_vibe_strength(int32_t vibe_strength_default) { s_vibe_strength_default = vibe_strength_default; } DEFINE_SYSCALL(int32_t, sys_vibe_get_vibe_strength, void) { return vibes_get_vibe_strength(); } bool prv_vibe_pattern_enqueue_step_raw(uint32_t duration_ms, int32_t strength) { mutex_lock(s...
= PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventSignificantUpdate, .data.significant_update = { .day_id = 0, }, }, }; sys_send_pebble_event_to_kernel(&event); return true; #endif } // -------------------------------------------------------------------------...
if (hrm_session == HRM_INVALID_SESSION_REF) { return 0; } else { return HRM_MANAGER_APP_EXIT_EXPIRATION_SEC; }
#endif } // ---------------------------------------------------------------------------------------------- uint32_t health_service_get_minute_history(HealthMinuteData *minute_data, uint32_t max_records, time_t *time_start, time_t *time_end) { #if !CAPABILITY_HAS_HEALTH_TRACK...
, ATTRIBUTE_Y, ATTRIBUTE_COUNT } LineAttribute; typedef struct AppData { Layer *canvas_layer; // UI state LineAttribute selection; // Line attributes PixelBit pixel_bit; LineHue hue; GPoint intersection; } AppData; static void up_handler(ClickRecognizerRef recognizer, void *context) { // Increm...
(ctx, GRect(30, 100, 35, 20), "Both", data->pixel_bit == PIXEL_BIT_BOTH, data->selection == ATTRIBUTE_PIXEL_BIT)
e value by 1. Since this is a higher order field, this is guaranteed to put the result ahead of the local epoch. */ // 'any' assignment defaults to using the local epoch's values. CronAssignMode assign_mode = CronAssignMode_LocalEpoch; // Iterate over all the fields for (int i = CRON_INDEX_YEAR; i < CRON_INDEX...
prv_get_execute_time_from_epoch(job, offset_epoch)
; t = rv < local_epoch ? t : rv; if (job->offset_seconds > 0 && t == t_last) { break; } } } return t; } time_t cron_job_get_execute_time(const CronJob *job) { return cron_job_get_execute_time_from_epoch(job, rtc_get_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...
{ AncsAppNameStorageEntry *entry_a = (AncsAppNameStorageEntry *)a; AncsAppNameStorageEntry *entry_b = (AncsAppNameStorageEntry *)b; if (entry_a->app_id == NULL || entry_b->app_id == NULL) { return -1; } if (entry_a->app_id->length != entry_b->app_id->length) { return -1; } return (memcmp(entry_...
ode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(pin_config.gpio, &GPIO_InitStructure); } //! Configure bus pins for use by I2C peripheral //! Lock bus and peripheral config access bef...
bus_pin_cfg_i2c(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda)
; // Enable peripheral clock periph_config_enable(RCC_APB1PeriphClockCmd, BOARD_CONFIG.i2c_bus_configs[bus_idx].clock_ctrl); bus_init(bus_idx); } //! De-initialize and gate the clock to the peripheral //! Power down rail if the bus supports that and no devices are using it //! Always lock the bus and periphera...
andler_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), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); // Start B prv_advance_to_ms_with_timers(start_ms + d...
prv_count_handler_entries(&s_stopped_handler_calls, a)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); // Complete sequence prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_...
set_vector(&reset_handler, &initial_stack_pointer); dbgserial_print("Booting firmware @ "); dbgserial_print_hex((uintptr_t)reset_handler); dbgserial_newline(); dbgserial_newline(); prv_hw_reset(); // The Cortex-M user guide states that the reset values for the core registers // are as follows: // R...
boot_bit_test(BOOT_BIT_FORCE_PRF)
) { boot_bit_clear(BOOT_BIT_FORCE_PRF); return true; } if (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)) { dbgserial_putstr("Hold down UP + BACK for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed...
/* * 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 (!src_bitmap->palette) { return; } const int8_t dest_begin_x = (dest_rect.origin.x / 32); const uint32_t * const dest_block_x_begin = ((uint32_t *)dest_bitmap->addr) + dest_begin_x; const int dest_row_length_words = (dest_bitmap->row_size_bytes / 4); // The number of bits between the beginning of d...
prv_calc_two_row_look_ups(&look_ups, compositing_mode, palette, src_palette_size, tint_color); while (dest_y < dest_y_end) { if (src_y >= src_end_y) { src_y = src_begin_y; } uint8_t dest_shift = dest_shift_at_line_begin; RowLookUp look_up = look_ups[dest_y % 2]; int16_t src_x = src_beg...
/* * 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...
{ size = num_group_type_elements * sizeof(TimelineItemAction); }
else { size = num_group_type_elements * sizeof(Address); } for (int i = 0; i < num_group_type_elements; i++) { size += attributes_per_group_type_element[i] * sizeof(Attribute); } return size; } size_t attribute_group_get_required_buffer_size(AttributeGroupType type, ...
tExtended layout = { 0 }; graphics_text_attributes_enable_screen_text_flow((GTextLayoutCacheRef) &layout, TEXT_FLOW_INSET_PX); return graphics_text_layout_get_max_used_size(ctx, text, ...
(&dialog->window.layer, &dialog->icon_layer.layer)
; } dialog_load(dialog); } static void prv_simple_dialog_appear(Window *window) { SimpleDialog *simple_dialog = window_get_user_data(window); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_appear(dialog); } static void prv_simple_dialog_unload(Window *window) { SimpleDialog *simple_dial...
(APP_ID_WORKOUT != INSTALL_ID_INVALID) ? 1 : 0; #endif #if CAPABILITY_HAS_JAVASCRIPT versions_msg.capabilities.javascript_bytecode_version_appended = 0x1; versions_msg.javascript_bytecode_version = hton16(CAPABILITY_JAVASCRIPT_BYTECODE_VERSION); #endif versions_msg.capabilities.continue_fw_install_across_disconne...
(buffer, sizeof(buffer), "FPC Variant: %"PRIu8, fpc_pinstrap + 1)
DROOM_DESIRED_SIZE_BYTES) { prv_deallocate_headroom(ctx); prv_allocate_headroom_or_die(ctx); } } static void prv_collect_all_garbage(void) { ecma_free_unused_memory(JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH, 0, true); jmem_pools_collect_empty(); } static void prv_memorypressure_app_log(const char *level, co...
strcmp(event_name, ROCKY_EVENT_MEMORYPRESSURE)
== 0) { RockyMemoryAPIContext *ctx = app_state_get_rocky_memory_api_context(); if (!prv_is_headroom_allocated(ctx)) { prv_allocate_headroom_or_die(ctx); } return true; } return false; } const RockyGlobalAPI MEMORY_APIS = { .init = prv_init, .deinit = prv_deinit, .add_handler = prv_add_...
nclude "system/logging.h" #include "system/passert.h" #include "services/common/evented_timer.h" #define FAIL_PAUSE_MS 1000 #define SCROLL_OUT_MS 250 #define BAR_HEIGHT 6 #define BAR_WIDTH 80 #define BAR_TO_TRANS_MS 160 #define TRANS_TO_DOT_MS 90 #define DOT_TRANSITION_RADIUS 13 #define DOT_COMPOSITOR_RADIUS 7 #define...
(&data->window, icon, message, PROGRESS_WINDOW_DEFAULT_FAILURE_DELAY_MS)
; if (!battery_is_usb_connected()) { vibes_short_pulse(); } } static void prv_progress_window_finished(ProgressWindow *window, bool success, void *context) { AppFetchUIData *data = context; if (success) { prv_app_fetch_launch_app(data); } } //////////////////////////// // Internal Helper Functions ...
icense is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "switch_worker_ui.h" #include <stdio.h> #include <string.h> #include "applib/ui/...
(msg_buffer, DIALOG_MAX_MESSAGE_LEN, fmt, new_entry.name, old_entry.name)
; confirmation_dialog_set_click_config_provider(confirmation_dialog, prv_click_config_provider); dialog_set_background_color(dialog, GColorCobaltBlue); dialog_set_text_color(dialog, GColorWhite); dialog_set_text(dialog, msg_buffer); task_free(msg_buffer); i18n_free_all(confirmation_dialog); SwitchWork...
int generation; uint32_t cookie; } BluetoothDumpLineCallbackData; BluetoothDumpLineCallbackData s_bt_dump_chunk_callback_data; static void prv_put_status_event(DebugInfoEventState state) { PebbleEvent event = { .type = PEBBLE_GATHER_DEBUG_INFO_EVENT, .debug_info = { .source = DebugInfoSourceFWLog...
prv_flash_logging_bluetooth_dump(session, 0, cookie)
/* * 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_millivolts = millivolts; }
void fake_battery_set_connected(bool usb_connected) { s_usb_connected = usb_connected; // Trigger a connection event! PebbleEvent event = { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .battery_connection = { .is_connected = usb_connected, } }; event_put(&event); } void fake_battery_set_cha...
ob is 10 seconds: for (int i = 0; i < 9; ++i) { regular_timer_fire_seconds(1); assert_ad_data("A"); cl_assert_equal_i(s_unscheduled_cb_count, 0); regular_timer_fire_seconds(1); assert_ad_data("B"); cl_assert_equal_i(s_unscheduled_cb_count, 0); } // Unschedule job "B", air job "A" regula...
gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_INFO, "PUSHING WINDOW")
OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "drivers/gpio.h" #include <stdint.h> #define MAX_GPIO (9) #include "FreeRTOS.h" #include "debug/power_tracking.h" static const PowerSystem s_gp...
GPIO_ReadInputDataBit(input_config->gpio, input_config->gpio_pin)
; gpio_release(input_config->gpio); return bit != 0; } void gpio_analog_init(const InputConfig *input_config) { GPIO_InitTypeDef gpio_init = { .GPIO_Pin = input_config->gpio_pin, .GPIO_Mode = GPIO_Mode_AN, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_PuPd = GPIO_PuPd_NOPULL }; prv_init_common(inpu...
/* * 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...
{ IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); IWDG_SetPrescaler(IWDG_Prescaler_64); // ~8 seconds IWDG_SetReload(0xfff); IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable); DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP, ENABLE); }
void watchdog_start(void) { IWDG_Enable(); IWDG_ReloadCounter(); } bool watchdog_check_reset_flag(void) { return RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET; }
/* * 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...
periph_config_enable(RCC_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG)
; initialize_button_common(); for (int i = 0; i < NUM_BUTTONS; ++i) { initialize_button(&BOARD_CONFIG_BUTTON.buttons[i]); } periph_config_disable(RCC_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG); periph_config_release_lock(); } bool button_selftest(void) { return button_get_state_bits() == 0; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ANALYTICS_DEVICE_METRIC_ACCEL_DOUBLE_TAP_COUNT, AnalyticsClient_System)
; state->double_tap_handler(e->accel_tap.axis, e->accel_tap.direction); } // ----------------------------------------------------------------------------------------------- // Handle a chunk of data received for a data subscription. Called by prv_do_data_handle. static uint32_t prv_do_data_handle_chunk(AccelService...
steps_64 * MS_PER_SECOND * SECONDS_PER_MINUTE, ms_64) + k_b_x10000; // Multiply by height to get stride_len, then by steps to get distance, then factor out our // constant multiplier at the very end to minimize rounding errors. uint32_t distance_mm = ROUND(stride_len_com...
if (gender == ActivityGenderMale) { calories_per_day += 5000; } else if (gender == ActivityGenderFemale) { calories_per_day -= 161000; } else { // midpoint of 5000 and -161000 calories_per_day -= 78000; }
// Scale by the requested number of minutes uint32_t resting_calories = ROUND(calories_per_day * elapsed_minutes, MINUTES_PER_DAY); ACTIVITY_LOG_DEBUG("resting_calories: %"PRIu32"", resting_calories); return resting_calories; }
/* * 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...
{ uint32_t last_word = 0; for (unsigned int i = 0; i < data_length; ++i) { last_word = (last_word << 8) | data[i]; } crc_value = CRC_CalcCRC(last_word); }
de "applib/ui/animation_timing.h" #include "applib/ui/kino/kino_reel.h" #include "applib/ui/kino/kino_reel_pdci.h" #include "applib/ui/kino/kino_reel_custom.h" #include "applib/applib_malloc.auto.h" #include "syscall/syscall.h" #include "util/math.h" #include "util/net.h" #include "util/struct.h" typedef struct { GR...
(data->from_reel, elapsed)
/* * 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...
(!strncmp(testbuf1, testbuf2, 5), true)
; }
.attributes = (Attribute[1]) {{ .id = AttributeIdTitle, .cstring = "test 1" }} } }; static TimelineItem title_item2 = { .header = { .id = {0xac, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .timestamp = 1, .duration = 0, .type = TimelineIte...
reminder_db_delete_item(&temp.header.id, true /* send_event */)
); cl_assert(reminder_db_get_len((uint8_t *) &item4, sizeof(Uuid)) == 0); memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp)); temp.attr_list.attributes = NULL; cl_assert(memcmp(&item3, &temp, sizeof(TimelineItem)) == 0); cl_assert(S_SUCCESS == re...
origin.x = x; box.origin.y += 8; box.size.w -= x; box.size.h -= 8; const GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_18); graphics_draw_text(ctx, text, font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL); } static void prv_draw_rt_cell_round(GContext *ctx, const Layer *cell_layer, GBitmap *mar...
if (cell_is_selected) { const int16_t fcc_number_subtitle_width = 60; box.size = GSize(fcc_number_subtitle_width, fcc_number_subtitle_height); // Note that we don't clip when we align the subtitle frame because it is wider than the // combined width of the title and icon grect_align(&box, &container...
// Align the FCC mark icon to be drawn in the top right of the container box.size = fcc_mark_icon->bounds.size; grect_align(&box, &container_rect, GAlignTopRight, true /* clip */); prv_draw_mark_with_inversion(ctx, fcc_mark_icon, &box, cell_is_highlighted); } static void prv_draw_fcc_cell( GContext *ctx,...
ortState_WaitingForSending, SPITransportState_Sending, SPITransportState_WaitingForSending_Footer, SPITransportState_Sending_Footer, SPITransportState_CoreDump, } SPITransportState; typedef struct SPITransport { SPITransportState state; size_t bytes_receivable_count; size_t bytes_sendable_count; bool s...
(&should_context_switch)
; } #if !defined(DIALOG_TIMER_IRQ_HANDLER) #error "DIALOG_TIMER_IRQ_HANDLER must be defined in the board_*.h file!" #endif void DIALOG_TIMER_IRQ_HANDLER(void *ctx) { dbgserial_putstr("BT Trans TO!"); prv_watchdog_stop(); prv_trigger_core_dump_from_isr(); TIM_ClearITPendingBit(BOARD_BT_WATCHDOG_TIMER.timer.p...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pfs_read(fd, (uint8_t *)app_info, sizeof(PebbleProcessInfo))
!= sizeof(PebbleProcessInfo)) { pfs_close(fd); return (GET_APP_INFO_COULD_NOT_READ_FORMAT); } if (build_id_out) { const uint8_t padding_size = sizeof(PebbleProcessInfo) % 4; // The note.gnu.build-id section seems to have a hard-coded word-alignment requirement... uint8_t note_buffer[BUILD_ID_TO...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(app_manager_get_current_app_id())
; } AppInstallId system_app_state_machine_get_last_registered_app(void) { // If we're rooted in the watchface but we're not the watchface itself, or the launcher // is closing, we should launch the watchface. if ((s_rooted_in_watchface && !prv_current_app_is_watchface()) || (app_manager_get_current_app_md(...
/* * 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...
bus->rail_ctl_fn(bus, enable)
erased"); return true; } return false; } static void prv_sad_watch(uint32_t error_code) { dbgserial_print("SAD WATCH: "); dbgserial_print_hex(error_code); dbgserial_newline(); display_error_code(error_code); static uint8_t prev_button_state = 0; prev_button_state = button_get_state_bits() & ~SEL...
delay_us(200000)
; display_error_code(0x8badf00d); delay_us(200000); display_error_code(0xbad1ce40); delay_us(200000); display_error_code(0xbeefcace); delay_us(200000); display_error_code(0x0defaced); delay_us(200000); display_error_code(0xd15ea5e5); delay_us(200000); display_error_code(0xdea...
size_bytes) + (sx * step_w); } typedef enum { RenderMoveTextBox, RenderMoveDrawBox, } RenderMoveMode; void render_steps(TextLayoutExtended *layout, RenderMoveMode mode, int delta, int16_t height, char **texts) { const GTextLayoutCacheRef layout_cache = (GTextLayoutCacheRef const)layout; int...
(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
; } void test_graphics_draw_text_flow__avoid_repeat_text_to_avoid_orphans(void) { TextLayoutExtended layout = { .flow_data = { .perimeter.impl = &(GPerimeter){.callback=perimeter_for_display_round}, .perimeter.inset = 8, .paging.page_on_screen = { .origin_y = 25, .size_h = 100 ...
_watch_dst, .cb_data = (void*)time_get_isdst(rtc_get_time()), }; regular_timer_add_seconds_callback(&s_dst_checker); } void clock_get_time_tm(struct tm* time_tm) { rtc_get_time_tm(time_tm); } size_t clock_format_time(char *buffer, uint8_t size, int16_t hours, int16_t minutes, bool a...
("Now", word_buffer, word_buffer_size)
; strncpy(number_buffer, "", number_buffer_size); } else { prv_copy_time_string_timestamp(number_buffer, number_buffer_size, word_buffer, word_buffer_size, timestamp); } } } // number: 10 // word: min to void clock_get_event_relative_time_string(char *number_buffer, int number_buffer_size...
if (row_index < (int)ARRAY_LENGTH(s_rounded_corner_width)) { return s_rounded_corner_width[row_index]; } else if (num_rows - row_index - 1 < (int)ARRAY_LENGTH(s_rounded_corner_width)) { return s_rounded_corner_width[num_rows - row_index - 1]; } return 0; } void compositor_set_modal_transition_offset(G...
memset(dst, GColorBlack.argb, bottom_bezel_length)
; } if (s_state == CompositorState_AppAndModal) { compositor_render_modal(); } PROFILER_NODE_STOP(compositor); framebuffer_dirty_all(&s_framebuffer); } void compositor_render_modal(void) { GContext *ctx = kernel_ui_get_graphics_context(); // We make this GDrawState static to save stack space, th...
256}, { -696, 288, 200}, { -688, 728, 360}, { -576, 1248, 232}, { -568, 776, 304}, { -656, 480, 208}, { -696, 616, 472}, // 62 seconds { -792, 704, 720}, { -880, 656, 728}, { -704, 184, 384}, { -736, 360, 256}, { -952, 360, 408}, { -760, 448, 320}, { -792, 672, 52...
{ -800, 672, -40}, { -816, 528, -40}, { -728, 520, -48}, { -784, 608, 48}, { -832, 520, 128}, { -808, 672, 88}, { -856, 616, 192}, { -840, 768, 120}, { -768, 568, -104}, { -728, 448, -168}, { -752, 712, -168}, { -832, 648, -104}, { -760, 672, -232}, { -736, 712, -...
{ -696, 656, -464}, // 70 seconds { -704, 552, -256}, { -760, 688, -176}, { -712, 560, -80}, { -704, 552, 136}, { -776, 544, 232}, { -760, 672, 304}, { -696, 856, 8}, { -696, 656, 152}, { -648, 744, 224}, { -608, 784, 272}, { -648, 1032, 264}, { -632, 760, 368}, ...
/* * 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...
serial_console_write_log_message(buffer)
; } static void prv_log_serial( uint8_t log_level, const char* src_filename, int src_line_number, const char* message) { if (!serial_console_is_logging_enabled() && log_level != LOG_LEVEL_ALWAYS) { return; } // Log the log level and the current task+privilege level { unsigned char task_char = pebb...
ize / sizeof(st_val); int idx = 0; int fd, rv; while (true) { snprintf(name, sizeof(name), "file%d", idx); if ((fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, f_size)) < 0) { break; } for (int i = 0; i < num_vals; i++) { st_val = st_val + i; rv = pfs_write(fd, (uint8_t *)...
pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10)
ear_handler_histories(); s_custom_curve_call_count = 0; animation_schedule(h); int max_loops = 20; int num_loops = 0; uint64_t start_ms = prv_now_ms(); uint64_t time_ms; while (s_stopped_handler_calls.num_calls == 0) { num_loops++; prv_fire_animation_timer(); time_ms = prv_now_ms(); DP...
(test_value, start_value)
; property_animation_get_to_gpoint(prop_h, &test_value); cl_assert_equal_point(test_value, end_value); GPoint set_value; set_value = GPoint(42, 43); property_animation_set_from_gpoint(prop_h, &set_value); property_animation_get_from_gpoint(prop_h, &test_value); cl_assert_equal_point(test_value, set_valu...
APP_ID_MUSIC, APP_ID_SETTINGS, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, BG_COUNTER_APP_ID, MENU_LAYER_APP_ID}; uint8_t num_entries = ARRAY_LENGTH(written_order); prv_write_order_to_file(written_order, num_entries); app_install_ma...
for (uint16_t i = 0; i < num_apps; i++) { AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); cl_assert_equal_i(node->install_id, desired_order[i]); }
app_menu_data_source_deinit(&data_source); } int prv_app_node_comparator(void *app_node_ref, void *new_node_ref); void test_app_menu_data_source__app_node_comparator_equality_cases(void) { // Test handling of storage and record equality cases AppMenuNode app_menu_nodes[] = {{ .install_id = APP_ID_ALARMS, ...
(prop_h, &set_value)
; property_animation_get_to_int16(prop_h, &test_value); cl_assert_equal_i(test_value, set_value); // Destroy it animation_destroy(h); #endif } // -------------------------------------------------------------------------------------- // Test a basic gpoint property animation void test_animation__property_gpoi...
/* * 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...
{ ActionMenuLayer *aml = callback_context; return (uint16_t)(aml->num_items + (aml->num_short_items + SHORT_COL_COUNT - 1) / SHORT_COL_COUNT); }
/* * 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...
{ bool rc = false; PBL_ASSERTN(s_vibe_history_mutex); mutex_lock(s_vibe_history_mutex); VibeHistory *node = s_vibe_history; while (node) { if (node->time_end == END_NOT_SET && time_search >= node->time_start) { rc = true; break; } if (time_search >= node->time_start && time_search <= ...
// @param cutoff The time to cut off the list at. 0 means to clear the list. static void prv_vibe_history_clear(uint64_t cutoff) { PBL_ASSERTN(s_vibe_history_mutex); mutex_assert_held_by_curr_task(s_vibe_history_mutex, true); while (s_vibe_history && s_vibe_history->time_end != END_NOT_SET) { VibeHistory *v...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert(system_flash_erase(FLASH_BASE + 12345, 1, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); }
void test_system_flash__erase_some_sectors_from_beginning(void) { cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_assert(system_flash_erase(FLASH_BASE, 1024 KiB...
it now if (expired_state) { PBL_LOG(LOG_LEVEL_DEBUG, "Subscription %"PRIu32" expired", expired_state->session_ref); prv_remove_and_free_subscription(expired_state); } } // Update the HRM enable state. If no subscribers need an update for a while, we can turn off the // HR sensor and set a ti...
(app_id, update_interval_s, expire_sec, features, NULL, NULL)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(output == NULL)
; } void test_lru_cache__evict(void) { for (int i = 0; i <= CACHE_BUFFER_SIZE / (sizeof(CacheEntry) + sizeof(uint32_t)); ++i) { uint32_t input = i; lru_cache_put(&s_cache, i, &input); } uint32_t *output = lru_cache_get(&s_cache, 0); // check that the oldest entry got evicted cl_assert(output == NULL)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
shared_circular_buffer_add_client(&buffer, &client)
; // We should start out empty cl_assert(!shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length)); cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "123", 3, false)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 5); cl_assert(shared_circular_buff...
t = LayoutIdTest, }, .attr_list = (AttributeList) { .num_attributes = 1, .attributes = (Attribute[1]) {{ .id = AttributeIdTitle, .cstring = "test 1" }} } }; static TimelineItem title_item2 = { .header = { .id = {0xac, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x...
(&item4, &temp, sizeof(TimelineItem))
== 0); cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl_assert(reminder_db_get_len((uint8_t *) &item4, sizeof(Uuid)) == 0); memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp)); temp.attr_list.attributes = NU...
(prev_written_page) + offsetof(PageHeader, last_written)); if (hdr.last_written == LAST_WRITTEN_TAG) { hdr.last_written = LAST_WRITTEN_UNMARK; prv_flash_write((uint8_t *)&hdr.last_written, sizeof(hdr.last_written), prv_page_to_flash_offset(prev_written_page) + offsetof(PageHeader, last_...
__builtin_popcount(sectors_active)
< PFS_PAGES_PER_ERASE_SECTOR) { // we can erase this region and have at least 1 free page after uint16_t sector_start_pg = curr_region * PFS_PAGES_PER_ERASE_SECTOR; garbage_collect_sector(&next_page, sector_start_pg, sectors_active); break; } } } if (next_page != INVALID_...
*bitmap = setup_png_test(TEST_PNG_FILE); GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); cl_assert(native_framebuffer->info.format == GBitmapFormat8BitCircular); cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColo...
(native_framebuffer->info.format == GBitmapFormat8BitCircular)
; cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); // Set screen to black to match empty region with test image graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &framebuffer_bounds); bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_...
/* * 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...
peek_animations_draw_compositor_foreground_speed_lines(ctx, offset)
; } static void prv_init_peek_transition_animation(Animation *animation) { animation_set_curve(animation, AnimationCurveLinear); animation_set_duration(animation, NUM_FRAMES * ANIMATION_TARGET_FRAME_INTERVAL_MS); } const CompositorTransition *compositor_peek_transition_timeline_get(void) { s_data = (CompositorP...
nts(void) { WakeupId wakeup_id = 0; sys_wakeup_cancel_all_for_app(); // Schedule 8 (max), at 1 minute offsets, then fail on 9th for (int i = 1; i <= MAX_WAKEUP_EVENTS_PER_APP; i++) { wakeup_id = sys_wakeup_schedule(sys_get_time() + (i * WAKEUP_EVENT_WINDOW), 0, false); cl_assert_equal_i(sys_wakeup_quer...
cl_assert_equal_i(first_timer, test_timer)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAnd, GColorWhite)
; cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi")); memset(dest_data, GColorGreen.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpClear, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit...
tributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "dialogs_demo.h" #include "applib/app.h" #include "applib/graphics/gdraw_command_image.h" #inc...
(actionable_dialog)
; } ////////////////////////////////////////// // ActionableDialog with custom action bar static void prv_custom_action_bar_click_up(ClickRecognizerRef recognizer, void *context) { Dialog *dialog = context; dialog_set_text(dialog, "The text has changed!"); layer_mark_dirty(&dialog->text_layer.layer); } static ...
imation_set_elapsed(complex, duration_a + duration_b/2); 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), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(pr...
cl_assert(spawn != NULL)
; // Create a sequence by putting a in front // We now have a -> (b | c) Animation *seq = animation_sequence_create(a, spawn, NULL); // Make it repeat animation_set_play_count(seq, repeat_count); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start A ...
T_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_x_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_upd...
(p.x + 7, p.y + 1)
); graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 2, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTest")
; cl_assert_equal_i(s_num_event_puts, 0); cl_assert_equal_i(s_num_packets_sent, 2); cl_assert_equal_i(s_num_bytes_sent, LOG_METADATA_LENGTH + 20); cl_assert_equal_s(s_log_message_buffer, "TestTestTestTestTest"); } void test_pulse_logging__simple_trucate(void) { pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "Tes...
icense, 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 distribut...
(s_allow_ble_pairing_refcount != 0, "")
, 312}, { 192, -408, 440}, { 264, 40, 416}, { 656, 520, 400}, { 968, 496, 432}, { 1392, 960, 496}, // 13 seconds { 1808, 800, 456}, { 2568, 1128, 512}, { 3448, 1040, 560}, { 3952, 2192, 112}, { 2160, 1848, 504}, { 2184, -328, 880}, { 2512, -1256, 1216}, { 2472, 19...
{ 760, 728, -120}, { 1064, 864, -136}, { 1160, 728, 48}, { 1168, 536, 8}, { 952, 384, 64}, { 904, 408, 64}, { 992, 328, 0}, { 1008, 192, 136}, { 992, 248, 48}, { 880, 176, 8}, { 872, 32, 40}, { 1040, 104, 16}, { 1032, -16, -32}, // 19 seconds { 1456, 0, -56}, ...
("Missed that. Try again.")); } else { prv_show_generic_error_dialog(data); } } else { if (!speech_detected) { VOICE_LOG("No speech detected! Exiting..."); prv_exit_and_send_result_event(data, DictationSessionStatusFailureNoSpeechDetected); } else { prv_exit_and_send_result_eve...
if (event->type == VoiceEventTypeSessionResult) { // Recording stopped by voice service, capture time recording prv_update_analytics_metrics(data); app_timer_cancel(data->dictation_timeout); prv_handle_dictation_result(data, event); }
break; case StateTransitionToText: case StateError: case StateFinished: case StateExiting: // Discard event VOICE_LOG("Ignoring event"); break; default: WTF; } } static void prv_start_dictation(VoiceUiData *data) { VOICE_LOG("Start dictation session"); PBL_ASSE...
ate, Iterator *dst_iter, Iterator *src_iter) { PBL_ASSERTN(dst_state && src_state && dst_iter && src_iter); timeline_item_free_allocated_buffer(&dst_state->pin); *dst_state = *src_state; dst_state->pin = (TimelineItem){}; *dst_iter = *src_iter; dst_iter->state = dst_state; }...
(&item->header.id, i18n_get("Removed", &i18n_key), TIMELINE_RESOURCE_RESULT_DELETED, ActionResultTypeSuccess)
; } else { const bool do_async = true; prv_do_remote_action(&item->header.id, action->type, action->id, attributes, do_async); } } static void prv_dismiss_local_notification_action(const TimelineItem *item) { // TODO: PBL-23915 // We leak this i18n'd string because not leaking ...
y_sessions = ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT; if (!activity_get_sessions(&health_data->num_activity_sessions, health_data->activity_sessions)) { PBL_LOG(LOG_LEVEL_ERROR, "Fetching activity sessions failed"); } else { ActivitySession *previous_session = NULL; for (unsign...
{ // current_step_average is stale health_data->current_step_average = prv_health_data_get_n_average_chunks(health_data, today_min / k_minutes_per_step_avg); health_data->step_average_last_updated_time = (today_min / k_minutes_per_step_avg) * k_minutes_per_step_avg; }
return health_data->current_step_average; } int32_t health_data_steps_get_cur_wday_average(HealthData *health_data) { return prv_health_data_get_n_average_chunks(health_data, ACTIVITY_NUM_METRIC_AVERAGES); } int32_t health_data_steps_get_monthly_average(HealthData *health_data) { return health_data->monthly_st...
/* * 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(out[index], 0xcc); }
static void assert_out_equal(const void * restrict expected, size_t length) { cl_assert(memcmp(out, expected, length) == 0); } static void assert_encode(const void * restrict src, size_t in_length, size_t expected_length) { size_t out_length = cobs_encode(out, src, in_length); cl_asse...
tions.h" #include "system/logging.h" #include "util/pstring.h" void ancs_filtering_record_app(iOSNotifPrefs **notif_prefs, const ANCSAttribute *app_id, const ANCSAttribute *display_name, const ANCSAttribute *title) { // When...
(&new_attr_list, &(*notif_prefs)->attr_list, new_action_group, &(*notif_prefs)->action_group, buffer, buffer + buf_size)
; ios_notif_pref_db_free_prefs(app_notif_prefs); } kernel_free(app_name_buff); attribute_list_destroy_list(&new_attr_list); } uint8_t ancs_filtering_get_mute_type(const iOSNotifPrefs *app_notif_prefs) { if (app_notif_prefs) { return attribute_get_uint8(&app_notif_prefs->attr_list, ...
E_MS); Animation *animation = animation_sequence_create(upward, bounceback, NULL); s_phone_ui_data->call_status_animation = animation; animation_schedule(animation); #else s_phone_ui_data->call_status_text_layer.layer.bounds.origin = GPointZero; #endif } static void prv_update_call_time(void *unused) { if (...
modal_manager_get_window_stack(ModalPriorityNotification)
, TimelineItemActionSourcePhoneUi, true /* standalone_reply */); break; case TimelineItemActionTypeAncsResponse: // Mark this window so we know to pop it when we get a response s_phone_ui_data->waiting_for_action_r...
num_windows_per_stack; i++) { window_stack_remove(windows[idx][i], false); window_destroy(windows[idx][i]); } } } void test_window_stack__modal_properties_unfocused(void) { const int num_windows_per_stack = 2; Window *windows[NumModalPriorities][num_windows_per_stack]; WindowStack *window_stac...
(s_last_click_configured_window, windows[3][0])
aw_text(ctx, s_text_buffer, &s_font_info, GRect(-44, 4, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_across_x(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_...
layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_ny)
; layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_y); layer_render_tree(&canvas, &ctx); cl_...
e watch is pointing // at them.) Flip the heading back around in this case. corr = TRIG_MAX_ANGLE / 2; } mx_rot = (mx * cos_lookup(pitch)) / TRIG_MAX_RATIO; mx_rot += (((my * sin_lookup(pitch)) / TRIG_MAX_RATIO) * sin_lookup(roll)) / TRIG_MAX_RATIO; mx_rot += (((mz * sin_lookup(pitch)) / TRIG_MAX...
{ s_saved_corr_present = prv_load_calibration_values(); if (s_saved_corr_present) { s_current_cal_status = CompassStatusCalibrating; for (int i = 0; i < 3; i++) { s_active_corr[i] = s_saved_corr[i]; } } s_service_init = true; }
event_service_init(PEBBLE_COMPASS_DATA_EVENT, &prv_compass_data_service_start, &prv_compass_data_service_stop); } void ecompass_service_handle(void) { static int samples_collected = 0; // read magnetometer sample MagData mag_data; MagReadStatus rv = mag_read_data(&mag_data); if (rv != MagReadSucces...
ing.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_serial.h" #include "stubs_tick.h" void analytics_event_ams(uint8_t type, int32_t aux_info) { } struct { ResponseTimeState state; uint16_t max_period_secs; } s_conn_mgr_states[NumBtConsumer]; void conn_mgr_set...
{ prv_discover_ams(1 /* num_instances */); // Not connected yet (still need to subscribe): cl_assert_equal_s(music_get_connected_server_debug_name(), NULL); // Simulate successful subscription: BLECharacteristic entity_update = s_characteristics[0][AMSCharacteristicEntityUpdate]; ams_handle_subscribe(entit...
void test_ams__dont_connect_music_service_if_subscribe_entity_update_characteristic_fails(void) { prv_discover_ams(1 /* num_instances */); // Simulate failed subscription: BLECharacteristic entity_update = s_characteristics[0][AMSCharacteristicEntityUpdate]; ams_handle_subscribe(entity_update, BLESubscriptio...
/* * 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...
{ // Set the current time to the provided time rtc_set_time(time); AppGlanceSliceInternal slice_out; if (expected_slice_data) { // Request the current slice from the glance, expecting it to return true cl_assert_equal_b(app_glance_service_get_current_slice(&APP_GLANCE_TEST_UUID, &slice_out), ...
void test_app_glance_service__get_current_slice_basic(void) { AppGlanceSliceInternal slice_out; // Requesting the current slice with a NULL UUID should return false cl_assert_equal_b(app_glance_service_get_current_slice(NULL, &slice_out), false); // Requesting the current slice with an invalid UUID should r...
tal perimeter_horizontal_range = flow_data->perimeter.impl->callback(flow_data->perimeter.impl, &ctx_size, vertical_range, flow_data->perimeter.inset); prv_debug_perimeter(ctx, &perimeter_horizontal_range, line); // protect against range expanding: clip ...
{ return false; }
// Don't set the line height if there is a vertical overflow const int line_height = fonts_get_font_height(text_box_params->font); // We used to re-check for vertical overflow here // but this is protected by a call to prv_line_iter_is_vertical_overflow, // which will handle the truncation/clipping logic. ...
/* * 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_pop_if_failing_rv(conn_idx, rv)
; return rv; } ble_error_t gatt_wrapper_read_by_uuid(uint16_t conn_idx, uint16_t start_h, uint16_t end_h, const att_uuid_t *uuid, uintptr_t context_ref, GattReqSource source) { GATT_LOG_DEBUG("gatt_wrapper_read_uuid: context_ref: %d, sourc...
rwise the Pebble won't // show up as an HRM device in Strava for Android... if (ble_hrm_is_supported_and_enabled()) { service_uuids[num_uuids++] = bt_uuid_expand_16bit(0x180D); // Heart Rate Service } #endif // Pebble Pairing Service UUID: service_uuids[num_uuids++] = bt_uuid_expand_16bit(PEBBLE_BT_PAIR...
PBL_ASSERTN(!s_discovery_advert_job)
/* * 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...
{ // Set rect to GRectZero so the processor's .post function knows that nothing was drawn rect = GRectZero; goto call_processor_post_function_and_return; }
iceUiData *data = context; VOICE_LOG("Single session timeout"); prv_stop_dictation(data); } static void prv_handle_ready_error(VoiceUiData *data) { data->session_id = VOICE_SESSION_ID_INVALID; data->error_count++; if (data->error_count < MAX_ERROR_COUNT) { if (data->show_error_dialog) { prv_handle...
prv_handle_dictation_success(data, event)
; if (success) { if (data->state == StateRecording) { // Transition to unfold state (StateStopRecording) before pending a transition to the text // window prv_set_mic_window_state(data, StateTransitionToText); } prv_set_mic_window_state(data, StateTransitionTo...
/* * 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 (s_write_return_value != BTErrnoOK) { return s_write_return_value; } Write *write = malloc(sizeof(Write)); uint8_t *buffer; if (value_length) { cl_assert(value); buffer = malloc(value_length); memcpy(buffer, value, value_length); } else { cl_assert_equal_p(value, NULL); buffer =...
BTErrno gatt_client_op_write(BLECharacteristic characteristic, const uint8_t *value, size_t value_length, GAPLEClient client) { return fake_gatt_client_write(characteristic, value, value_length, client, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return fd; }
*resp = (void*)(uintptr_t)fd; return S_SUCCESS; } static status_t pfs_domain_close(void *context) { int fd = prv_fd_from_context(context); return pfs_close(fd); } #if !RECOVERY_FW PulseBulkIODomainHandler pulse_bulkio_domain_pfs = { .id = PulseBulkIODomainType_PFS, .open_proc = pfs_domain_open, .read_...
pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_aa_swX_clear.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_circle_${BIT_DEPTH_NAME}__arc_stroked(void){ GContext ctx; test_graphics_context_init(&ctx, fb); // Letter C uint32_t angle_end = TRIG_MAX_ANGLE + (TRIG_MAX_ANGLE / 8); uint32_t angle_start = (TRIG_MAX_...
pt.x = CENTER_OF_ORIGIN_RECT.x; pt.y += (radius + stroke_width) * 2; } } char filename[100]; snprintf(filename, sizeof(filename), "draw_arc_offset_aa_end_angle_%s.${BIT_DEPTH_NAME}.pbi", test_angles[i].filename_part); cl_check_(gbitmap_pbi_eq(&ctx.dest_bitmap, filenam...
angle_start += TRIG_MAX_ANGLE/4; angle_end += TRIG_MAX_ANGLE/4; pt.x += RADIUS_BIG * 4; if (pt.x > 120) { pt.x = CENTER_OF_ORIGIN_RECT.x; pt.y += RADIUS_BIG * 4; } } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_arc_aa_end_angle_on_divider.${BIT_DEPTH_NAME}.pbi")); } void test_g...
schedule_1); bool schedule_2[7] = {false, false, true, false, false, true, false}; bool verify_schedule_2[7] = {false, false, false, false, false, false, false}; id2 = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); alarm_set_custom(id2, schedule_2); prv_assert_alarm_conf...
alarm_delete(id1)
; prv_assert_alarm_config_absent(id1); assert_alarm_pins_absent(id1); alarm_delete(id2); prv_assert_alarm_config_absent(id2); assert_alarm_pins_absent(id2); id3 = alarm_create(&(AlarmInfo) { .hour = 13, .minute = 13, .kind = ALARM_KIND_WEEKDAYS }); id4 = alarm_create(&(AlarmInfo) { .hour = 14, .minute = 1...
he License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distr...
{ return NULL; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
button_is_pressed(button_id)
) { button_counter[button_id] = 0; continue; } if (button_counter[button_id] >= STUCK_BUTTON_THRESHOLD) { dbgserial_putstr("Stuck button register is invalid, clearing."); dbgserial_print_hex(button_counter_register); RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, 0); return...
8, 24, -1000}, { 48, 16, -1000}, { 56, 24, -1000}, { 40, 16, -1000}, { 48, 16, -1000}, { 48, 16, -1008}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 8, -1008}, { 48, 32, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}...
{ 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 40, 16, -1008}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 40, 24, -992}, { 48, 8, ...
{ 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 8, -1000}, { 48, 32, -1000}, { 48, 16, -1008}, { 48, 8, -1000}, { 48, 24, -1008}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1008}, { 48, 24, -1000}, { 48, 24,...
uint32_t index, const jerry_value_t value_to_set) { if (jerry_value_has_error_flag(value_to_set) || !jerry_value_is_object(obj_val)) { return TYPE_ERROR_ARG; } return (jerry_value_t)EM_ASM_INT({ var obj = __jerryRefs.get($0); var to_se...
__jerryRefs.ref(rv)
; }, func_obj_val, this_val, args_p, args_count); } jerry_value_t jerry_construct_object(const jerry_value_t func_obj_val, const jerry_value_t args_p[], jerry_size_t args_count) { if (!jerry_value_is_constructor(func_obj_val)) { return...
aphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "clar.h" #include "util.h" #include <stdio.h> // Helper Functions //////////////////////////////////// #include "test_graphics.h" #include "${BIT_DEPTH_NAME}/test_framebuffer.h" // Stubs ...
{ GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(10, 15, 20, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_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)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap...
/* * 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(cell_index->row < ARRAY_LENGTH(s_tests))
; prv_start_test(s_tests[cell_index->row], (AppData *)callback_context); } static void prv_handle_results_click(ClickRecognizerRef recognizer, void *context) { app_window_stack_pop(false); } static void prv_results_window_load(Window *window) { AppData *app_data = window_get_user_data(window); uint32_t total...
THOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/l...
layer_render_tree(&layer, &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...
{ if (mcu_state_is_isr()) { return DialogTask_ISR; } return task_to_dialogtask(xTaskGetCurrentTaskHandle()); }
void task_unregister_task(OS_TASK task) { DialogTask index = task_to_dialogtask(task); if (index >= DialogTask_Last) { return; } DialogTaskList[index] = NULL; } void task_unregister_dialogtask(DialogTask task) { if (task >= DialogTask_Last) { return; } DialogTaskList[task] = NULL; }
eturn; } ActivityInsightType type; TimelineResourceId icon; const int body_buf_size = 100; char *body = kernel_zalloc_check(body_buf_size); const char *intro_str = prv_get_intro_str_for_activity(session); snprintf(body, body_buf_size, "%s", i18n_get(intro_str, body)); const int headings_buf_size = 12...
("Not adding session pin - not long enough (%"PRIu16" < %"PRIu16")", session->length_min, s_activity_session_settings.session.activity.trigger_elapsed_minutes)
; return; } if (session->manual) { // The workout service will handle the notifications for these return; } s_session_pin_state.start_utc = session->start_utc; prv_save_state(ActivitySettingsKeyInsightActivitySessionTime, &s_session_pin_state.start_utc, sizeof(...
stubs_comm_session.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_serial.h" #include "stubs_sys_exit.h" extern PostMessageState rocky_api_app_message_get_state(void); extern AppTimer *rocky_api_app_message_get_app_msg_retry_timer(void); extern AppTimer *rocky_api_app_message_get_session_close...
(s_app_message_api)
; } // Setup void test_rocky_api_app_message__initialize(void) { fake_app_timer_init(); fake_pbl_malloc_clear_tracking(); prv_app_message_setup(); s_process_manager_callback = NULL; s_process_manager_callback_data = NULL; rocky_runtime_context_init(); jerry_init(JERRY_INIT_EMPTY); } void test_rocky_a...
LL, 0 /*flags*/); PBL_ASSERTN(success); } light_button_pressed(); } else if (e->type == PEBBLE_BUTTON_UP_EVENT) { if (button_id == BUTTON_ID_BACK) { launcher_cancel_force_quit(); } light_button_released(); } app_idle_timeout_refresh(); if (c...
(&entry.uuid, e->app_fetch_request.id, has_worker)
; } static NOINLINE void prv_extended_event_handler(PebbleEvent* e) { switch (e->type) { case PEBBLE_APP_OUTBOX_MSG_EVENT: e->app_outbox_msg.callback(e->app_outbox_msg.data); return; case PEBBLE_APP_FETCH_REQUEST_EVENT: prv_handle_app_fetch_request_event(e); return; case PEBBLE_...
if (data->steps_card.cur_step_layer) { snprintf(data->steps_card.cur_step_text, sizeof(data->steps_card.cur_step_text), "%d", (int) data->cur_steps); text_layer_set_text(data->steps_card.cur_step_layer, data->steps_card.cur_step_text); } // Show time if (data->steps_card.time_layer) { ...
(window_layer)
; layer_set_update_proc(window_layer, steps_base_layer_update_proc); // Total steps data->steps_card.cur_step_layer = text_layer_create(CUR_STEP_RECT); text_layer_set_text_alignment(data->steps_card.cur_step_layer, GTextAlignmentCenter); text_layer_set_font(data->steps_card.cur_step_layer, ...
0x0F, PmicRegisters_LDO1_CONFIG = 0x12, PmicRegisters_LDO2_CONFIG = 0x14, PmicRegisters_LDO3_CONFIG = 0x16, PmicRegisters_MON_CFG = 0x19, PmicRegisters_HAND_SHK = 0x1D, PmicRegisters_PWR_CFG = 0x1F } PmicRegisters; //! The different power rails that our PMIC controls typedef enum PmicRail { PmicRail_BUC...
{ // We enabled the rail! *ref_count = 1; // We need to wait a bit for the rail to stabilize before continuing to use the device. // It takes 2.6ms for the LDO rails to ramp. delay_ms(3); return true; }
return false; } } else { if (*ref_count <= 1) { // Set the register byte to XXXXX00X to disable the rail, just mask register_value = (register_value & ~0x06); success = prv_write_register(rail_control_reg, register_value); if (success) { // We disabled the rail! ...