prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
///////////////////////// // Timeline Iterator ///////////////////////// // Order of events in timeline: // * All day events appear first // * (All day events should be timestamped at midnight, the first second in the day) // * Order all other events by time // * For concurrent events: order by duration (shortest to l...
{ TimelineNode *current = head; while (current) { if (prv_show_event(current, timestamp, today_midnight, TimelineIterDirectionFuture, show_all_day_events)) { break; } current = (TimelineNode *)current->node.next; } return current; }
static TimelineNode *prv_find_first(TimelineNode *head, TimelineIterDirection direction, time_t timestamp, time_t today_midnight, bool show_all_day_events) { if (direction == TimelineIterDirectionPast) { return prv_find_first_past(head, timestamp, today_midnight, show_all_day_events); } else { return pr...
fg->axes_inverts[AXIS_X] ? -1 : 1) * prv_raw_to_mgs(readings[cfg->axes_offsets[AXIS_X]]), .y = (cfg->axes_inverts[AXIS_Y] ? -1 : 1) * prv_raw_to_mgs(readings[cfg->axes_offsets[AXIS_Y]]), .z = (cfg->axes_inverts[AXIS_Z] ? -1 : 1) * prv_raw_to_mgs(readings[cfg->axes_offsets[AXIS_...
{ const AccelConfig *cfg = &BOARD_CONFIG_ACCEL.accel_config; IMUCoordinateAxis axis = AXIS_X; bool invert = false; if (int2_status & BMA255_INT_STATUS_2_SLOPE_FIRST_X) { axis = AXIS_X; invert = cfg->axes_inverts[AXIS_X]; } else if (int2_status & BMA255_INT_STATUS_2_SLOPE_FIRST_Y) { ...
ng_enabled(), false); regular_timer_fire_seconds(1); cl_assert_equal_b(gap_le_is_advertising_enabled(), true); assert_ad_data("B"); } void test_gap_le_advert__round_robin_two_jobs_incl_silent_terms(void) { GAPLEAdvertisingJobTerm advert_terms_a[] = { { .min_interval_slots = 160, .max_interva...
(advert_terms_a[3].min_interval_slots, advert_terms_a[3].max_interval_slots)
; regular_timer_fire_seconds(1); // Expect A to be done as well: cl_assert_equal_i(s_unscheduled_cb_count, 2); cl_assert_equal_p(s_unscheduled_job, job_a); cl_assert_equal_b(s_unscheduled_completed, true); } void test_gap_le_advert__job_round_robin_multiple_terms(void) { GAPLEAdvertisingJobTerm advert_t...
ication on wake up, slept similar to their typical sleep duration i18n_noop("Good mornin’. You slept for %dH %dM. " "Every good day begins with a solid night’s sleep..." "kinda like that one 😉 Keep it up!"), i18n_noop("Good morning! You slept for %dH %dM. Consistency...
i18n_get("%u Steps", &ACTIVITY_SUMMARY_PIN_CONFIG)
, steps); i18n_free_all(&ACTIVITY_SUMMARY_PIN_CONFIG); return prv_push_summary_pin(pin_time_utc, now_utc, uuid, steps, total_steps_avg, &ACTIVITY_SUMMARY_PIN_CONFIG); } // ------------------------------------------------------------------------------------------------ // Checks to s...
prv_read_register(PmicRegisters_CHIP_REV, chip_revision); prv_read_register(PmicRegisters_BUCK1_VSET, buck1_vset); } static void prv_clear_any_pending_interrupts(void) { // Read the Int status registers to clear any pending bits. // An interrupt wont fire if the matching bit is already set. uint8_t throwawa...
for (size_t i = 0; i < ARRAY_LENGTH(MON_CONFIG); ++i) { prv_set_mon_config(&MON_CONFIG[i]); ADCVoltageMonitorReading reading = battery_read_voltage_monitor(); uint32_t millivolts = battery_convert_reading_to_millivolts(reading, MON_CONFIG[i].ratio, 1); char buffer[40]; prompt_send_response_fmt(buff...
// Turn this off again now that we're done measuring. This is refcounted so there's no concern // that we may be turning it off if it was on before we started measuring. set_ldo3_power_state(false); prv_mon_config_unlock(); } #endif // RECOVERY_FW void set_ldo3_power_state(bool enabled) { i2c_use(I2C_MAX1...
aw_row, .select_click = prv_menu_layer_select, .get_cell_height = prv_menu_layer_get_cell_height, .selection_will_change = prv_menu_layer_selection_will_change, }); // Only setup the content indicator on round #if PBL_ROUND const GSize arrow_layer_frame_size = GSize(frame.size.w, ...
(&launcher_menu_layer->menu_layer.scroll_layer, new_scroll_offset, animated)
; } void launcher_menu_layer_get_selection_vertical_range(const LauncherMenuLayer *launcher_menu_layer, GRangeVertical *vertical_range_out) { if (!launcher_menu_layer || !vertical_range_out) { return; } GRect selection_global_rect; layer_get_global_fra...
OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "transform.h" #include "applib/graphics/gdraw_command_private.h" #include "applib/graphics/gdraw_command_transforms.h" #include "applib/ui/animat...
(data->to_reel)
; duration = MAX(duration, to_duration); } return duration; } static bool prv_elapsed_setter(KinoReel *reel, uint32_t elapsed) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data->elapsed == elapsed) { return false; } bool changed = false; data->elapsed = elapsed; if (da...
75, 2825, 213}, { 0, 0x80, 395, 195}, { 0, 0x80, 0, 189}, { 0, 0x7f, 316, 228}, { 12, 0x75, 636, 192}, { 0, 0x65, 3513, 199}, { 0, 0x63, 3997, 223}, // 825: Local time: 12:59:00 PM { 16, 0x66, 3591, 205}, { 0, 0x56, 4017, 204}, { 0, 0x54, 2269, 203}, { 0, 0x52, 3810, 189}, ...
{ 0, 0x67, 0, 205}, { 0, 0x67, 1319, 203}, { 0, 0x55, 4751, 207}, { 0, 0x67, 1840, 226}, { 0, 0x57, 1355, 203}, { 0, 0x56, 2166, 220}, { 0, 0x66, 2641, 212}, { 0, 0x46, 299, 221}, { 0, 0x56, 89, 231}, { 0, 0x56, 2430, 210}, { 37, 0x44, 4839, 221}, { 100, 0x45, 4862, 234},...
{ 0, 0x54, 402, 204}, { 0, 0x54, 1875, 222}, { 0, 0x54, 335, 229}, // 990: Local time: 03:44:00 PM { 0, 0x54, 131, 230}, { 0, 0x44, 5, 216}, { 0, 0x44, 0, 214}, { 0, 0x44, 488, 233}, { 0, 0x44, 1322, 227}, { 0, 0x44, 1317, 226}, { 0, 0x44, 1301, 226}, { 0, 0x44, 852, 221...
FO_CURRENT_SDK_VERSION_MINOR + 10 } }, .should_pass = false }, { .entry = (AppInstallEntry) { .install_id = 6, .sdk_version = (Version) { .major = PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR + 1, .minor = PROCESS_INFO_CURRENT_SDK_VERSION_MINOR + 10 } }, .should_p...
(&(ProcessLaunchConfig){.id=1})
; // app wasn't launched, instead we see a fetch request cl_assert_equal_b(0, s_app_manager_launch_new_app__callcount); cl_assert(s_event_put__event != NULL); cl_assert_equal_i(PEBBLE_APP_FETCH_REQUEST_EVENT, s_event_put__event->type); }
rt_equal_rect((GRect(-11, 5000, 60, large_int)), s_graphics_draw_text.last_call.draw_text.box); } void test_rocky_api_graphics__fill_text_coordinates(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT("ctx.fillText('some text', 0, 1.5);"); cl_assert_equal_rect((GRect(0, 2, large_int, la...
((GFont)-1, s_rocky_text_state.font)
return; } if (generic_glance->slice_subtitle_template_string_reeval_timer) { app_timer_cancel(generic_glance->slice_subtitle_template_string_reeval_timer); generic_glance->slice_subtitle_template_string_reeval_timer = NULL; } // Set the next re-evaluation time to "never" generic_glance->next_slice_...
_Static_assert((APP_GLANCE_MIN_SUPPORTED_SDK_VERSION_MAJOR > TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MAJOR) || ((APP_GLANCE_MIN_SUPPORTED_SDK_VERSION_MAJOR == TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MAJOR) && (APP_GL...
; timeline_resources_get_id_system(timeline_res_id, LAUNCHER_APP_GLANCE_GENERIC_ICON_SIZE_TYPE, resource_info.res_app_num, &resource_info); } prv_generic_glance_set_icon(generic_glance, &resource_info); prv_cancel_subtitle_reeval_timer(generic_glance); // The glance w...
ribe_from_kernel_main(PebbleSubscriptionEvent *subscription) { PBL_ASSERT_TASK(PebbleTask_KernelMain); prv_event_service_subscribe(subscription); } static bool prv_event_service_send_event(QueueHandle_t queue, PebbleEvent *e) { PBL_ASSERTN(queue != NULL); bool success = (xQueueSendToBack(queue, e, 0) == pdTRUE...
worker_manager_get_current_worker_md()
->is_unprivileged) { worker_manager_close_current_worker(false); } else { PBL_ASSERTN(0); } #endif } } } } if (!prv_task_is_masked_out(e, cur_task) && service->subscribers[cur_task]) { // we are on the current task, so we just tell the client to han...
/* * 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...
{ QemuProtocolBatteryHeader *hdr = (QemuProtocolBatteryHeader *)data; if (len != sizeof(*hdr)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid packet length"); return; } PBL_LOG(LOG_LEVEL_DEBUG, "Got battery msg: pct: %d, charger_connected:%d", hdr->battery_pct, hdr->charger_connected); s_percent = MIN(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_ERROR, "No system session"); return; }
/* * 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(analytics_storage_has_lock())
/* * 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...
animation_get_context(animation)
; window_transition_context_appearance_call_all(context); // make sure we don't render the to_window accidentally at a default origin if (animation_private_using_legacy_2(NULL)) { // on 2.x we don't need to consider any easing animation_get_implementation(animation)->update(animation, 0); } else { ...
/* * 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...
(PebbleTask_App, real_callback, NULL)
= scroll_layer_create(scroll_bounds); GSize content_size = GSize(180, 2000); scroll_layer_set_content_size(scroll_layer, content_size); int32_t scroll_height = DEFAULT_SCROLL_HEIGHT; int32_t offset = 0; for (offset = 0; offset < content_size.h - scroll_bounds.size.h; offset += scroll_height) { // s...
(scroll_layer)
.y); } // once the last full page of content has been displayed // another scroll down shouldn't advance the offset scroll_layer_scroll(scroll_layer, ScrollDirectionDown, false); cl_assert_equal_i(page_height * pages, -scroll_layer_get_content_offset(scroll_layer).y); }
_COLOR_DEPTH_BITS == 8 // SW = 4 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_...
(&ctx, 2, CLIP_OFFSET, 0)
; prv_draw_rects(&ctx, 3, 2 * CLIP_OFFSET, 0); prv_draw_rects(&ctx, 4, 3 * CLIP_OFFSET, 0); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_clip_rect.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); prv_draw_rects(&ctx, 1, 0, 1); prv_draw_rects(&c...
// Set to not sleeping s_kalg_sleep_start_utc = 0; s_kalg_sleep_m = 0; activity_algorithm_metrics_changed_notification(); uint16_t steps_awake_60m; uint16_t steps_awake_100m; uint16_t steps_awake_120m; // Call the minute handler, which should zero out steps that occur while sleeping prv_feed_minute_da...
{ cl_assert_equal_i(retrieve[i].steps, minute_data[i].base.steps); }
cl_assert_equal_i(retrieve[i].orientation, minute_data[i].base.orientation); cl_assert_equal_i(retrieve[i].vmc, minute_data[i].base.vmc); cl_assert_equal_i(retrieve[i].light, ambient_light_level_to_enum( minute_data[i].base.light * ALG_RAW_LIGHT_SENSOR_DIVIDE_BY)); cl_assert_equal_i(retrieve[i].h...
eiver_imp = &g_put_bytes_receiver_impl, .receiver_opt = NULL, }; // Fakes ////////////////////////////////////////////////////////// uint32_t s_boot_bits_orred; void boot_bit_set(BootBitValue bit) { s_boot_bits_orred |= bit; } static bool s_firmware_update_is_in_progress; bool firmware_update_is_in_progress(void...
memcpy(&put_msg->payload[0], payload, payload_size)
; prv_receive_data(s_session, buffer, sizeof(buffer)); } static void prv_receive_commit(uint32_t cookie, uint32_t crc) { CommitRequest commit_msg = (CommitRequest) { .cmd = CmdCommit, .cookie = htonl(cookie), .crc = htonl(crc), }; prv_receive_data(s_session, (const uint8_t *)&commit_msg, sizeof(com...
al_point(layer.frame.origin, stopped_at_r.origin); // Make sure our started and stopped handlers got called at cl_assert_equal_i(s_started_handler_calls.num_calls, 1);; cl_assert(s_started_handler_calls.entries[0].fired_time_ms - start_ms <= 1); cl_assert(s_started_handler_calls.entries[0].context == context);...
(h, duration)
; prv_clear_handler_histories(); animation_schedule(h); int max_loops = 20; uint64_t start_ms = prv_now_ms(); bool detected_reset_of_elapsed = false; bool reached_end_elapsed = false; uint64_t time_ms; while (s_stopped_handler_calls.num_calls < 2) { prv_fire_animation_timer(); time_ms = prv_...
rom); prv_get_frame(timeline_layer, to_index, &to); timeline_layer_get_icon_frame(timeline_layer, from_index, &icon_from); timeline_layer_get_icon_frame(timeline_layer, to_index, &icon_to); layer_set_frame((Layer *)timeline_layout, &from); return timeline_layout_create_up_down_animation(timeline_layout, &from...
if (slide) { const bool align_in_frame = true; frame.origin.y += PEEK_LAYER_ICON_OFFSET_Y; peek_layer_set_scale_to_image(&timeline_layer->day_separator, &timeline_res, TimelineResourceSizeLarge, frame, align_in_frame); peek_layer_set_fields_hidden(&timeline_layer->day_s...
peek_layer_set_fields(&timeline_layer->day_separator, "", friendly_date, month_and_day); peek_layer_play(&timeline_layer->day_separator); } void timeline_layer_unfold_day_sep(TimelineLayer *timeline_layer) { const bool slide = false; prv_show_day_sep(timeline_layer, slide); } void timeline_layer_slide_day_s...
id) { // Clear pending interrupts in case we were woken from standby prv_clear_pending_interrupts(); exti_configure_pin( BOARD_CONFIG_POWER.pmic_int, ExtiTrigger_Falling, prv_as3701b_interrupt_handler); exti_enable(BOARD_CONFIG_POWER.pmic_int); const uint8_t mask = (uint8_t) ~(PmicInt1_LowBat | PmicIn...
{ uint8_t reset_cntl; if (!prv_read_register(PmicRegisters_RESET_CNTL, &reset_cntl)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read the RESET_CNTL register"); return; } s_last_reset_reason = reset_cntl >> 4; }
uint32_t pmic_get_last_reset_reason(void) { return s_last_reset_reason; } bool pmic_init(void) { s_debounce_charger_timer = new_timer_create(); prv_init_gpio(); if (!prv_is_alive()) { return false; } prv_stash_last_reset_reason(); prv_init_pmic_gpio_outputs(); prv_set_sd1_voltage(); prv_start...
here. if (!watchdog_check_reset_flag() && !boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { // We're good, we're just starting normally. dbgserial_putstr("Booting normally"); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); return false; ...
boot_bit_test(BOOT_BIT_STANDBY_MODE_REQUESTED)
) { boot_bit_clear(BOOT_BIT_STANDBY_MODE_REQUESTED); enter_standby_mode(); } else if (PWR_GetFlagStatus(PWR_FLAG_SB) == SET) { // Woke up from standby // Clear the standby flag since only a power reset clears it PWR_ClearFlag(PWR_FLAG_SB); // Before coming out of standby make sure we should be wa...
estamp = rtc_get_time(); prv_pref_set(PREF_KEY_ACTIVITY_ACTIVATED_TIMESTAMP, &s_activity_activation_timestamp, sizeof(s_activity_activation_timestamp)); } } bool activity_prefs_has_activation_delay_insight_fired(ActivationDelayInsightType type) { return (s_activity_activation_delay_insight & (...
{ if (s_alarms_app_opened != version) { s_alarms_app_opened = version; prv_pref_set(PREF_KEY_ALARMS_APP_OPENED, &s_alarms_app_opened, sizeof(s_alarms_app_opened)); } }
uint8_t alarm_prefs_get_alarms_app_opened(void) { return s_alarms_app_opened; } #endif /* CAPABILITY_HAS_HEALTH_TRACKING */ #if PLATFORM_SPALDING void shell_prefs_set_display_offset(GPoint offset) { const GPoint user_offset = gpoint_sub(offset, mfg_info_get_disp_offsets()); prv_pref_set(PREF_KEY_DISPLAY_USER_O...
kernel_free(temp); } } unlock: mutex_unlock_recursive(s_app_cache_mutex); return rv; } ////////////////////// // AppCache Helpers ////////////////////// // Remove the filename entry in the PFSFileList (via context) that corresponds to the // app install id passed in via info static bool prv_remove_matchin...
pfs_close(fd)
; } unlock: mutex_unlock_recursive(s_app_cache_mutex); prv_purge_orphaned_resource_files(); } //! Adds an entry with the given AppInstallId to the cache status_t app_cache_add_entry(AppInstallId app_id, uint32_t total_size) { status_t rv; mutex_lock_recursive(s_app_cache_mutex); { SettingsFile file; ...
cl_assert(seq != NULL); // Setup started/stopped handlers for the sequence const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; animation_set_handlers(seq, handlers, seq); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animati...
(&s_stopped_handler_calls, seq)
bled = true; uart_start_rx_dma(ACCESSORY_UART, s_rx_buffer, sizeof(s_rx_buffer)); } static void prv_disable_dma(void) { if (!s_dma_enabled) { return; } s_dma_enabled = false; uart_stop_rx_dma(ACCESSORY_UART); } //! The interval timer callback. static void prv_timer_interval_expired_cb(void *data) { if...
if ((baudrate != s_baudrate) || force_update) { PBL_LOG(LOG_LEVEL_DEBUG, "Changing accessory connector baud rate to %"PRIu32, baudrate); prv_initialize_uart(baudrate); if (s_dma_enabled) { // we need to reset DMA after resetting the UART prv_disable_dma(); prv_enable_dma(); } }
} void accessory_init(void) { s_send_semaphore = xSemaphoreCreateBinary(); xSemaphoreGive(s_send_semaphore); s_blocked_lock = mutex_create_recursive(); prv_initialize_hardware(); accessory_set_power(false); accessory_enable_input(); } void accessory_block(void) { prv_lock(); accessory_send_stream_sto...
/* * 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...
ARRAY_LENGTH(s_sys_activity_get_metric_values.out.history)
); s_sys_activity_get_metric_values.in.metric = metric; s_sys_activity_get_metric_values.in.history_len = history_len; // Check if this value is in our overrides. If it is return it and quit. if (prv_handle_override(metric, history_len, history)) { return true; } // yes, actual implementation can han...
/* * 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 false; }
status_t reminder_db_delete_with_parent(const TimelineItemId *id) { return S_SUCCESS; } void timeline_action_endpoint_invoke_action(const Uuid *id, uint8_t action_id, AttributeList *attributes) { } const PebbleProcessMd *timeline_get_app_info(void) { return NULL; } void launcher_task_add_callback(void *dat...
Length modifiers uint64_t hurf = 0x123456789ABCDEF0ULL; snprintf(dstbuf, 256, "%hhx,%hx,%x,%lx", hurf, hurf, hurf, hurf); cl_assert_equal_s(dstbuf, "f0,def0,9abcdef0,9abcdef0"); snprintf(dstbuf, 256, "%llx,%jx", hurf, hurf); cl_assert_equal_s(dstbuf, "123456789abcdef0,123456789abcdef0"); snprintf(dstbuf, 25...
cl_assert_equal_s(dstbuf, "You know Bagu? Then I can let you cross")
; // Space padded minimum character output snprintf(dstbuf, 256, "You know Bagu? %25s", "Then I can let you cross"); cl_assert_equal_s(dstbuf, "You know Bagu? Then I can let you cross"); // Space for positive signed // No signed conversion occurs, so this is a no-op snprintf(dstbuf, 256, "You know Bagu? ...
/* * 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...
(window, WINDOW_NAME("Morph Square Demo"))
; window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .appear = prv_window_appear, .unload = prv_window_unload, }); window_set_click_config_provider_with_context(window, prv_click_config_provider, data); const bool animated = true; ...
t8_t stroke_width, GCornerMask quadrant) { // This algorithm will draw stroked circle with vairable width (only odd numbers for now) const uint8_t half_stroke_width = stroke_width / 2; const int16_t inner_radius = radius - half_stroke_width; const uint8_t outer_radius = radius + half_stroke_width; if (inner_...
(ctx, GPoint(p.x, p.y - radius))
; graphics_private_set_pixel(ctx, GPoint(p.x + radius, p.y)); graphics_private_set_pixel(ctx, GPoint(p.x - radius, p.y)); } #if PBL_COLOR T_STATIC void graphics_circle_draw_1px_aa(GContext* ctx, GPoint p, uint16_t radius) { graphics_circle_quadrant_draw_1px_aa(ctx, p, radius, GCornersAll); } //! Draws an antial...
num_erases++) { for (int i = 0; i < num_pages(); i++) { snprintf(file_small, sizeof(file_small), "file%d", i); snprintf(buf, sizeof(buf), "This is small buf %d!", i); int len = strlen(buf); int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len); cl_assert(fd >= 0); c...
pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(buf))
; cl_assert(fd >= 0); cl_assert_equal_i(pfs_write(fd, &buf[0], sizeof(buf)), sizeof(buf)); if (i == 0) { start_page = test_get_file_start_page(fd); } if ((i % 2) != 0) { pfs_close_and_remove(fd); } else { pfs_close(fd); } } // force partial garbage collection test_...
/* * 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...
(dialog, true)
; app_simple_dialog_push(simple_dialog); } ////////////////////// // Confirmation Dialog static void prv_confirm_click_handler(ClickRecognizerRef recognizer, void *context) { app_window_stack_pop(true); } static void prv_confirm_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, ...
e "popups/timeline/peek.h" #include "process_management/app_install_manager.h" #include "process_management/app_manager.h" #include "process_management/process_manager.h" #include "services/common/analytics/analytics.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/shared...
(&e->reminder)
/* * 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...
GColorFromHEX(0x0055aa)
).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xff5500)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xaaaaaa)).argb); // // expectation as derived from Appfaces_generic_colors.psd cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x0000aa)).argb); cl_assert_equal_i(GColo...
tial_sp == 0xffffffff) { dbgserial_putstr("Firmware is 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...
delay_us(200000)
; display_error_code(0xfeedface); 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(0xd15...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
action_button_draw(ctx, layer, SELECT_INDICATOR_COLOR)
; } static void prv_refresh_select_indicator(HealthCardView *health_card_view) { Layer *card_layer = health_card_view->card_layers[health_card_view->current_card_index]; const bool is_hidden = !s_card_view_show_select_indicator[health_card_view->current_card_index]( card_layer); layer_set_hidden(&health_...
s_read_cfm(evt->conn_idx, evt->handle, response_status, response_length, response); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_read_cfm: %u", e); } } static void prv_send_notification(uint16_t conn_idx, uint16_t value_handle) { uint8_t data[READ_RESPONS...
{ return (att_error_t)PebblePairingServiceGATTError_ConnParamsMinSlotsTooSmall; }
if (settings->connection_parameter_sets[i].interval_min_1_25ms > LL_CONN_INTV_MAX_SLOTS) { return (att_error_t)PebblePairingServiceGATTError_ConnParamsMinSlotsTooLarge; } if (settings->connection_parameter_sets[i].interval_min_1_25ms + settings->connection_parameter_sets[i].interval...
= prv_default_kernel_receiver_prepare, .write = prv_default_kernel_receiver_write, .finish = prv_default_kernel_receiver_finish, .cleanup = prv_default_kernel_receiver_cleanup, }; void app_message_app_protocol_system_nack_callback(CommSession *session, const uin...
cl_assert_equal_p(r, NULL)
r the generation we // are searching for, continue looking if (!in_use_and_valid || (hdr.log_file_id != log_file_id)) { continue; } num_log_pages++; int32_t dist = serial_distance(prev_chunk_id, hdr.log_chunk_id, LOG_ID_BITWIDTH); if (log_start_addr == FLASH_LOG_INVALID_ADDR) { ...
{ LogRecordHeader record_hdr; memset((uint8_t *)&record_hdr, 0xff, sizeof(record_hdr)); record_hdr.length = msg_length; uint32_t addr = s_curr_state.page_start_addr + s_curr_state.offset_in_log_page; flash_write_bytes((uint8_t *)&record_hdr, addr, sizeof(record_hdr)); s_curr_state.offset_in_log_page += si...
uint32_t flash_logging_log_start(uint8_t msg_length) { if ((msg_length == 0) || (msg_length > MAX_MSG_LEN) || !s_flash_logging_enabled) { return FLASH_LOG_INVALID_ADDR; } // bytes_remaining should always be 0, but if for some reason this gets called // again, just skip onto the next record spot s...
st *attributes = layout->attributes; StringList *headings = attribute_get_string_list(attributes, AttributeIdHeadings); StringList *paragraphs = attribute_get_string_list(attributes, AttributeIdParagraphs); const size_t num_headings = string_list_count(headings); if (num_headings == 0) { return NULL; } ...
ARRAY_LENGTH(vertical_config_nodes)
armDetailData *data = (AlarmDetailData *) context; alarm_delete(data->alarm_id); if (data->alarm_editor_callback) { data->alarm_editor_callback(DELETED, data->alarm_id, data->callback_context); } } static ActionMenuLevel *prv_create_main_menu(void) { ActionMenuLevel *level = task_malloc(sizeof(ActionMenuLe...
alarm_get_snooze_delay()
; for (int i = 0; i < NUM_SNOOZE_MENU_ITEMS; i++) { snooze_level->items[i] = (ActionMenuItem) { .label = i18n_get(snooze_delay_strs[i], data), .perform_action = prv_edit_snooze_delay, .action_data = (void *) (uintptr_t) snooze_delays[i], }; if (current_snooze_delay == snooze_delays[i]) ...
< ANIMATION_NORMALIZED_MAX / 2)); } static KinoReel *prv_get_current_reel(KinoReelTransformData *data) { return prv_is_currently_from(data) ? data->from_reel : data->to_reel; } static GSize prv_get_current_size(KinoReelTransformData *data) { return prv_is_currently_from(data) ? data->from.size : data->to.size; } ...
kino_reel_custom_get_data(reel)
; return prv_get_duration(data); } static GSize prv_size_getter(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); return interpolate_gsize(data->normalized, data->from.size, data->to.size); } static void prv_transform_list(KinoReelTransformData *data) { KinoReel *reel = prv_get_...
ble = prv_activity_allowed_to_be_enabled(); if (enable == s_activity_state.started) { // No change in enabled state, we're done. goto cleanup; } if (enable) { // We just got enabled, re-start activity tracking if it should be in the started state if (s_activity_state.should_be_star...
(file, utc_now)
/* * 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 (!list || !context) { return; } ScaleSegmentedData *data = context; GDelayCreatorContext delay_ctx = { .list = list, .size = size, }; if (!data->lookup.creator) { return; } GPointIndexLookup *index_lookup = data->lookup.creator(&delay_ctx, data->lookup.userdata); GRect intermedi...
data->stroke_width.from_op, data->stroke_width.to_op, stroke_width_progress); if (delay_ctx.owns_lookup) { applib_free(index_lookup); } } static GPoint prv_calc_bounce_offset(GRect from, GRect to, int16_t bounce) { GPoint bounce_offset = GPointZero; const int16_t delta_x = to.origin.x - from.origi...
ref); // Starts off with BPM enabled cl_assert_equal_i(state->features, HRMFeature_BPM); // Change to only LED Current sys_hrm_manager_set_features(session_ref, HRMFeature_LEDCurrent); cl_assert_equal_i(state->features, HRMFeature_LEDCurrent); // Change to LEDCurrent + BPM sys_hrm_manager_set_features(...
hrm_is_enabled(HRM)
, false); sys_hrm_manager_unsubscribe(session_ref); } // Advance time the given number of milliseconds static void prv_advance_time_ms(uint32_t ms) { RtcTicks delta_ticks = milliseconds_to_ticks(ms); fake_rtc_set_ticks(rtc_get_ticks() + delta_ticks); rtc_set_time(rtc_get_time() + ms / MS_PER_SECOND); } // T...
vent_handlers("minutechange")); cl_assert_equal_b(true, rocky_global_has_event_handlers("hourchange")); cl_assert_equal_b(true, rocky_global_has_event_handlers("daychange")); cl_assert_equal_i(4, s_tick_timer_service_subscribe.call_count); cl_assert_equal_i(MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT | YEAR...
fake_time_init(cur_time, cur_millis)
; EXECUTE_SCRIPT( "var s = null;\n" "var m = null;\n" "var h = null;\n" "var d = null;\n" "_rocky.on('secondchange', function(e) { s = e.date.getSeconds(); });\n" "_rocky.on('minutechange', function(e) { m = e.date.getMinutes(); });\n" "_rocky.on('hourchange', function(e) { h = e.date.g...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
heap_malloc(&s_kernel_heap, bytes, saved_lr)
; } void *kernel_malloc(size_t bytes) { return prv_heap_malloc(bytes); } void *kernel_zalloc(size_t bytes) { void *ptr = prv_heap_malloc(bytes); if (ptr) { memset(ptr, 0, bytes); } return ptr; } void *kernel_malloc_check(size_t bytes) { void *ptr = prv_heap_malloc(bytes); PBL_ASSERTN(ptr); return...
/* * 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...
(src_bitmap)
); const GColor *palette = src_bitmap->palette; int16_t src_y = src_begin_y + src_origin_offset.y; for (int16_t dest_y = dest_begin_y; dest_y < dest_end_y; ++dest_y, ++src_y) { // Wrap-around source bitmap vertically if (src_y >= src_end_y) { src_y = src_begin_y; } const GBitmapDataRowInfo...
/* * 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...
mfg_info_get_model(buffer)
; cl_assert_equal_s(buffer, "test_model"); } void test_spalding_mfg_info__1_to_3_conversion(void) { // Force in an old data version. typedef struct { uint32_t data_version; uint32_t color; uint32_t rtc_freq; } MfgDataV1; MfgDataV1 old_data = { .data_version = 1, .color = 3, ....
s 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 "clar.h" #include "services/normal/blob_db/reminder_db.h" // Fixture ///////////////////...
reminder_db_insert_item(&item2)
); cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item1)); cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item3)); } // Setup //////////////////////////////////////////////////////////////// void test_reminder_db__initialize(void) { reminder_db_init(); } void test_reminder_db__cleanup(void) { ...
simple_dialog.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/menu_cell_layer.h" #include "applib/ui/ui.h" #include "applib/ui/window_stack_private.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/system_icons.h" #include "popups/notifications/notification_window.h" #include "process_state/app_state...
{ NotificationNode *node = notification_list; notification_list = (NotificationNode*) list_pop_head((ListNode*) notification_list); app_free(node); }
} static void prv_unload_loaded_notification(LoadedNotificationNode *loaded_notif) { timeline_item_free_allocated_buffer(&loaded_notif->notification); gdraw_command_image_destroy(loaded_notif->icon); app_free(loaded_notif); } static NOINLINE LoadedNotificationNode *prv_loaded_notification_list_load_item( L...
/* * 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 &s_ctx; }
.input = jerry_create_array(0), .expected_output = "", // Kinda weird? }, { .input = jerry_create_object(), .expected_output = "[object Object]", }, }; for (int i = 0; i < ARRAY_LENGTH(cases); ++i) { jerry_value_t input = cases[i].input; JERRY_ARGS_MAKE(input); // Exerci...
(error_value, cases[i].error_msg)
; if (!cases[i].error_msg) { cl_assert_equal_i(output.origin.x.raw_value, cases[i].expected_output.origin.x.raw_value); cl_assert_equal_i(output.origin.y.raw_value, cases[i].expected_output.origin.y.raw_value); cl_assert_equal_i(output.size.w.raw_value, cases[i].expected_output.size.w.raw_value); ...
rce_end_offset) { // overflow PBL_LOG(LOG_LEVEL_ERROR, "Overflow while validating resource"); return 0; } // Make sure the store's calculated length is not past the end of the store. if (prv_get_length(entry) < store_length) { return 0; } // Return the length of the store's resource data r...
{ ResourceManifest manifest; if (!prv_get_manifest_by_id(app_num, resource_id, &manifest)) { return 0; } return manifest.num_resources; }
60, -232}, { -208, 872, -224}, { -224, 744, -160}, { -296, 672, -88}, { -344, 696, -80}, { -384, 744, -80}, { -456, 800, -80}, { -488, 912, -88}, { -496, 952, -48}, { -344, 952, -104}, { -648, 1320, 168}, { -240, 1312, 0}, { -304, 952, 96}, { -296, 1016, 88}, { -1...
{ -296, 616, -224}, { -272, 720, -8}, { -192, 944, -128}, { -240, 952, -56}, { -304, 952, -32}, { -352, 1032, -64}, { -352, 1080, -8}, { -344, 1088, -184}, { -272, 1024, -152}, { -192, 912, -152}, { -224, 728, -144}, { -288, 608, -112}, { -344, 568, -80}, { -376, ...
_version3); hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version3, hw_version); // Write fourth time const char* written_hw_version4 = "VWXYZ12"; command_hwver_write(written_hw_version4); hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version4, hw_version); // Write...
strlen(third_sn)
, &index); sn = mfg_get_serial_number(); cl_assert_equal_i(r, MfgSerialsResultSuccess); cl_assert_equal_s(sn, third_sn); cl_assert_equal_i(index, 4); // SERIAL3 lives at index 4 // Fourth time: const char *fourth_sn = "mnbvcxzlkjhg"; r = mfg_write_serial_number(fourth_sn, strlen(fourth_sn), &index); sn...
PBL_ASSERTN(buffer_size); mutex_assert_held_by_curr_task(s_flash_state.mutex, true /* is_held */); // Writing a zero-length buffer is a no-op. if (buffer_size < 1) { return; } flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_PAGE_PROGRAM); flash_send_24b_address(...
flash_write_page(buffer, start_addr, bytes_to_write)
rvices/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/comm_session/protocol.h" #include "services/common/comm_session/session_remote_version.h" #include "services/common/comm_session/session_send_buffer.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "process_manageme...
bt_unlock()
; } // ------------------------------------------------------------------------------------------------- // Interfaces towards Transport (reading from the send buffer to actually transmit the data): // ------------------------------------------------------------------------------------------------- static const Uuid ...
pdate" instead of deletion+addition, // because there is only one bonding ID that gets re-used, a deletion would otherwise cause a // disconnection to happen. See PBL-24737. PBL_LOG(LOG_LEVEL_INFO, "Re-pairing previously paired LE device"); is_updating_existing = true; } else { // Sinc...
{ return bt_persistent_storage_get_ble_pairing_by_id(BLE_BONDING_ID, NULL, NULL, NULL); }
void bt_persistent_storage_for_each_ble_pairing(BtPersistBondingDBEachBLE cb, void *context) { return; } void bt_persistent_storage_register_existing_ble_bondings(void) { BleBonding bonding = {}; uint8_t flags; if (!shared_prf_storage_get_ble_pairing_data(&bonding.pairing_info, NULL, NULL, &flags)) { ret...
is, 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(AccelServiceState *state, uint16_t time_interval_ms) { ...
accel_session_set_samples_per_update((AccelServiceState *)state, samples_per_update)
; } // ---------------------------------------------------------------------------------------------- void accel_data_service_subscribe(uint32_t samples_per_update, AccelDataHandler handler) { AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_data_subscribe(session...
db_get_dirty_list(BlobDBIdTest); cl_assert(dirty_list == NULL); blob_db_util_free_dirty_list(dirty_list); char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { "val1", "val2", "val3", "val4", "val5" }; int value_len = strlen(values[0]); // insert al...
for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { blob_db_insert(BlobDBIdTest, (uint8_t *)keys[i], key_len, (uint8_t *)values[i], value_len); }
s_num_until_timeout = 3; s_num_writebacks = 0; cl_assert(blob_db_sync_db(BlobDBIdTest) == S_SUCCESS); prv_generate_responses_from_phone(); cl_assert_equal_i(s_num_writebacks, s_num_until_timeout); s_num_until_timeout = 0; cl_assert(blob_db_sync_db(BlobDBIdTest) == S_SUCCESS); prv_generate_responses_fr...
size_t length, GAPLEClient client) { cl_assert_equal_i(characteristic, s_characteristics[ANCSCharacteristicControl]); if (s_gatt_client_op_write_should_fail_once) { s_gatt_client_op_write_should_fail_once = false; return BTErrnoInvalidParameter; } if (s_gatt_...
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_invalid_attribute_length), (uint8_t*) s_invalid_attribute_length)
; s_num_ds_notifications_received++; } else if (uid == loading_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_loading_response), (uint8_t*) s_loading_response); s_num_ds_notifications_received++; } else if (uid == no_content_uid) { prv_fake_receiving_ds_notifi...
erty_animation_set_from_int16(prop_h, &set_value); property_animation_get_from_int16(prop_h, &test_value); cl_assert_equal_i(test_value, set_value); set_value = 43; property_animation_set_to_int16(prop_h, &set_value); property_animation_get_to_int16(prop_h, &test_value); cl_assert_equal_i(test_value, set_v...
property_animation_create(&implementation, &value, &start_value, NULL)
; Animation *h = property_animation_get_animation(prop_h); void *context = &value; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(h); // Test the accessor functions GTransform te...
d *context) { const BatteryWarningDisplayData *data = context; const uint32_t percent = data->percent; dialog_set_background_color(dialog, data->background_color); const size_t warning_length = 64; char buffer[warning_length]; const uint32_t battery_hours_left = battery_curve_get_hours_remaining(percent); ...
prv_display_modal(stack, prv_update_ui_warning, &display_data)
; } void battery_ui_dismiss_modal(void) { if (s_dialog) { dialog_pop(s_dialog); s_dialog = NULL; } }
tion *animation, AnimationCurve curve) { return true; } bool WEAK animation_set_custom_interpolation(Animation *animation_h, InterpolateInt64Function interpolate_function) { return true; } bool WEAK animation_set_handlers(Animation *animation, AnimationHandlers callbacks...
{ if (!property_animation) { return false; } void *field = &((PropertyAnimationPrivate *)property_animation)->values.to; memcpy((set ? field : to), (set ? to : field), size); return true; }
void WEAK property_animation_update_gpoint(PropertyAnimation *property_animation, const uint32_t distance_normalized) {} Animation *WEAK property_animation_get_animation(PropertyAnimation *property_animation) { return (Animation *)property_animation; } InterpolateInt64Fu...
_appear, .disappear = prv_window_disappear, .unload = prv_window_unload, }); window_set_user_data(window, data); // Initialize some variables early Layer *root_layer = window_get_root_layer(window); const GRect *window_frame = &root_layer->frame; // prepare the swap layer frame using notificat...
swap_layer_attempt_layer_swap(&data->swap_layer, ScrollDirectionUp)
; return; } #else // On round displays, just set the new notification as the current one and show // the peek animation notifications_presented_list_set_current(id); prv_show_peek_for_notification(data, id, false /* is_first_notification */); return; #endif } // Animated was set to fa...
orted subscription type return BTErrnoInvalidParameter; } // Try to find existing subscription GATTClientSubscriptionNode *subscription = prv_find_subscription_for_characteristic(characteristic_ref, connection); bool did_create_new_subscription = false; if (subscription) { ...
prv_remove_subscription(connection, subscription); } return ret_val; }
BTErrno gatt_client_subscriptions_subscribe(BLECharacteristic characteristic_ref, BLESubscription subscription_type, GAPLEClient client) { bt_lock(); BTErrno ret_val = prv_subscribe(characteristic_ref, subscription_type, clien...
eric_attribute__cleanup(void) { } // tests void test_generic_attribute__find_attribute(void) { uint8_t data1[] = { 0x02, // attribute list - num attributes 0x02, // attribute type - transcription 0x2F, 0x00, // attribute length // Transcription 0x01, // Transcription ...
cl_assert_equal_p(attr2->data, &data2[offset])
; GenericAttribute *attr3 = generic_attribute_find_attribute(attr_list1, VEAttributeIdAppUuid, sizeof(data1) - 1); cl_assert(!attr3); attr3 = generic_attribute_find_attribute(attr_list1, VEAttributeIdAppUuid, ...
ager_render(GContext *ctx) { ++s_modal_manager_render_count; } ModalProperty modal_manager_get_properties(void) { return s_modal_window_present ? ModalProperty_Exists : ModalPropertyDefault; } GContext* kernel_ui_get_graphics_context(void) { static GContext s_context; return &s_context; } void framebuffer_cl...
cl_assert_equal_i(s_count_animation_create, 2)
; cl_assert_equal_i(s_count_animation_schedule, 1); cl_assert_equal_i(s_count_compositor_init_func_a, 1); cl_assert_equal_i(s_count_compositor_init_func_b, 1); // Make the app render, now the animation should be scheduled compositor_app_render_ready(); cl_assert_equal_i(s_count_animation_schedule, 2); /...
/////////////////// // View //////////////////////// void timeline_layout_init_view(TimelineLayout *layout, LayoutLayerMode mode) { GTextNode *view_node = NULL; switch (mode) { case LayoutLayerModeCard: view_node = layout->impl->card_view_constructor(layout); break; case LayoutLayerModePeek: ...
ARRAY_LENGTH(s_horizontal_config_nodes)
, .container.nodes = (LayoutNodeConfig **)&s_horizontal_config_nodes, }; GTextNodeHorizontal *horizontal_node = (GTextNodeHorizontal *)layout_create_text_node_from_config( &layout->layout_layer, &s_horizontal_config.container.extent.node); horizontal_node->horizontal_alignment = TIMELINE_LAYE...
0 /* no features */); prv_fake_send_new_data(); fake_system_task_callbacks_invoke_pending(); // Expect 4 events: 1 for BPM, 1 for LED, 2 for subscribing to all, none for no feature. cl_assert_equal_i(s_event_count, 4); sys_hrm_manager_unsubscribe(bpm_session); sys_hrm_ma...
sys_hrm_manager_unsubscribe(session_ref_2)
" #define APNG_MEMORY_ERROR "APNG memory allocation failed" #define APNG_FORMAT_ERROR "Unsupported APNG format, only APNG8 is supported!" #define APNG_LOAD_ERROR "Failed to load APNG" #define APNG_UPDATE_ERROR "gbitmap_sequence failed to update bitmap" #define APNG_ELAPSED_WARNING "invalid elapsed_ms for gbitmap_sequen...
(APP_LOG_LEVEL_ERROR, APNG_FORMAT_ERROR)
; goto cleanup; } // Create a color palette in RGBA8 format from RGB24 + ALPHA8 PNG Palettes upng_format png_format = upng_get_format(upng); if (png_format >= UPNG_INDEXED1 && png_format <= UPNG_INDEXED8) { bitmap_sequence->png_decoder_data.palette_entries = gbitmap_png_load_palette(upng, &bitm...
eof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 11 H", time_buf); // June 12th 2015, 01:30:00 (T-10:30:00) rtc_set_time(event_time - (11 * SECONDS_PER_HOUR) + (30 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_...
cl_assert_equal_s("1 H AGO", time_buf)
; // June 9th 2015, 13:29:30 (T+01:29:30) rtc_set_time(event_time + SECONDS_PER_HOUR + (29 * SECONDS_PER_MINUTE) + 30); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("1 H AGO", time_buf); // June 9th 2015, 13:30:00 (T+01:30:00) rtc_set_time(e...
e(size_t); } bool dcache_is_enabled(void) { return cl_mock_type(bool); } bool icache_is_enabled(void) { return cl_mock_type(bool); } void icache_invalidate(void *addr, size_t size) { s_invalidate_size = size; s_invalidate_addr = (uintptr_t)addr; } void dcache_flush(const void *addr, size_t size) { s_flush...
(dcache_is_enabled, true)
teps != 0) /*stepping*/); #endif // Run through reference code int ref_steps = prv_feed_reference_samples(entry->samples, entry->num_samples); //int ref_steps = -1; int error = abs(steps - entry->exp_steps); float weighted_error = (float)error * entry->weight; printf("\nRESULTS: exp_steps: %d...
{ act->passed = true; printf("\nRESULTS for %s: exp: (NA), act: %d, error: NA, weighted_error: NA", name, (int)act->value); }
return weighted_error; } // ========================================================================================= // Support for capturing sleep sessions detected by the algorithm typedef struct { KAlgActivityType activity; time_t start_utc; uint16_t len_m; } KAlgTestSleepSession; KAlgTestSleepSession ...
/* * 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...
(GPIOC, GPIO_PinSource10, GPIO_AF_USART3)
; /* Connect PXx to USARTx_Rx*/ GPIO_PinAFConfig(GPIOC, GPIO_PinSource11, GPIO_AF_USART3); /* Configure USART Tx as alternate function */ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Spee...
static const uint32_t FLASH_ERASE_BLOCKING_TIMEOUT_MS = 5000; if (total_time_spent_waiting_ms < FLASH_ERASE_BLOCKING_TIMEOUT_MS) { #if IS_BIGBOARD // Our bigboards have had a hard life and they have some fairly abused flash chips, and we // run into 5+ second erases pretty regularly. We're not holding...
flash_impl_get_subsector_base_address(sector_addr)
); } void flash_use(void) { mutex_lock(s_flash_lock); flash_impl_use(); mutex_unlock(s_flash_lock); } void flash_release_many(uint32_t num_locks) { mutex_lock(s_flash_lock); flash_impl_release_many(num_locks); mutex_unlock(s_flash_lock); } #include "console/prompt.h" void command_flash_unprotect(void) { ...
, uint8_t stroke_width) {} void gpath_draw_stroke(GContext* ctx, GPath* path, bool open) {} void gpath_draw_filled(GContext* ctx, GPath *path) {} void graphics_draw_circle(GContext* ctx, GPoint p, uint16_t radius) {} void graphics_fill_circle(GContext* ctx, GPoint p, uint16_t radius) {} void graphics_context_move_draw_...
(!gdraw_command_sequence_validate(sequence, size))
; sequence->num_frames = 3; cl_assert(!gdraw_command_sequence_validate(sequence, size)); sequence->num_frames = 2; sequence->version = 0xFF; cl_assert(!gdraw_command_sequence_validate(sequence, size)); free(sequence); } void test_gdraw_command_sequence__get_frame_by_elapsed(void) { GDrawCommandSequence...
/* * 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...
framebuffer_init(fb, &(GSize) { DISP_COLS, DISP_ROWS })
; } // Teardown void test_framebuffer_clipping__cleanup(void) { free(fb); } // Tests //////////////////////////////////// void test_framebuffer_clipping__off_screen_left_aa_clipping(void) { cl_assert_equal_i(GBITMAP_NATIVE_FORMAT, GBitmapFormat8BitCircular); GContext ctx; test_graphics_context_init(&ctx, fb...
_pixel(ctx, GPoint(layer->bounds.size.w - mask - 1, layer->bounds.size.h - offset - 1)); graphics_draw_pixel(ctx, GPoint(layer->bounds.size.w - offset - 1, layer->bounds.size.h - mask - 1)); } } static void prv_draw_border(Layer *layer, GCon...
(sizeof(AppData))
idChange: *intent->bonding = updated_bonding; break; case BtPersistBondingOpWillDelete: for (GAPLEClient c = GAPLEClientKernel; c < GAPLEClientNum; ++c) { if (!intent->client[c].is_used) { continue; } prv_unregister_intent(intent, c, true /* should_send_disconnect...
(intent, client, false /* should_send_disconnection_event */, GAPLEConnectHCIReasonExtensionCancelConnect)
; intent = next; } } bt_unlock(); } // ------------------------------------------------------------------------------------------------- bool gap_le_connect_is_connected_as_slave(void) { bool connected; bt_lock(); { connected = s_is_connected_as_slave; } bt_unlock(); return connected; } ...
level), prv_mute_notification_weekends, window_data); action_menu_level_add_action(mute_level, i18n_get("Mute Weekdays", root_level), prv_mute_notification_weekdays, ...
prv_setup_reminder_watchdog(data)
; prv_refresh_pop_timer(data); // update status bar to the current info prv_update_status_layer(data); // Reload notification data from notification_storage in case of an action/remove if (data->notifications_modified) { data->notifications_modified = false; prv_reload_swap_layer(data); } } stati...
-88, -296, -976}, { -88, -304, -992}, { -88, -304, -984}, { -80, -304, -984}, { -80, -304, -984}, { -80, -296, -984}, { -88, -296, -992}, { -88, -288, -984}, { -80, -296, -992}, { -88, -296, -976}, { -88, -304, -984}, { -88, -288, -992}, { -96, -288, -984}, { -96, -2...
{ 72, -368, -960}, { 64, -376, -952}, // 277 seconds { 64, -360, -960}, { 72, -360, -968}, { 72, -360, -960}, { 72, -368, -960}, { 64, -368, -960}, { 64, -360, -960}, { 72, -368, -960}, { 64, -376, -960}, { 72, -368, -968}, { 64, -360, -960}, { 64, -368, -960}, ...
{ -120, -304, -976}, { -128, -312, -984}, { -136, -304, -968}, { -128, -304, -968}, { -144, -296, -968}, { -144, -296, -968}, { -136, -296, -976}, { -144, -296, -984}, { -152, -288, -992}, { -152, -296, -976}, { -144, -288, -984}, { -152, -288, -976}, { -152, -296, -...
/* * 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 (!item->is_leaf && item->next_level) { prv_cleanup_helper(item->next_level, each_cb, context); }
if (each_cb) { each_cb(item, context); } } applib_free((void *)level); } void action_menu_hierarchy_destroy(const ActionMenuLevel *root, ActionMenuEachItemCb each_cb, void *context) { if (root) { prv_cleanup_helper(root, ea...
oup.actions; cl_assert_equal_i(alarm_action->id, dummy_alarm_id); cl_assert_equal_i(alarm_action->type, TimelineItemActionTypeOpenWatchApp); const AttributeList *action_attr_list = &alarm_action->attr_list; const char *action_title = attribute_get_string(action_attr_list, AttributeIdTitle, NULL); cl_assert_...
cron_service_wakeup()
text) { HealthCardView *health_card_view = context; layer_set_hidden(health_card_view->card_layers[health_card_view->current_card_index], false); layer_set_hidden(&health_card_view->select_indicator_layer, true); prv_hide_content_indicators(health_card_view); } static void prv_bg_animation_stopped_handler(A...
s_card_view_select_click_handler[health_card_view->current_card_index](layer)
; health_card_view_mark_dirty(health_card_view); } // Click config provider static void prv_click_config_provider(void *context) { window_set_click_context(BUTTON_ID_UP, context); window_set_click_context(BUTTON_ID_SELECT, context); window_set_click_context(BUTTON_ID_DOWN, context); window_single_click_subsc...
permissions and * limitations under the License. */ #include "board/board.h" #include "drivers/flash/flash_impl.h" #include "drivers/flash/qspi_flash.h" #include "drivers/flash/qspi_flash_part_definitions.h" #include "flash_region/flash_region.h" #include "system/passert.h" #include "system/status_codes.h" #include ...
{ return qspi_flash_erase_begin(QSPI_FLASH, subsector_addr, true /* is_subsector */); }
status_t flash_impl_erase_sector_begin(FlashAddress sector_addr) { return qspi_flash_erase_begin(QSPI_FLASH, sector_addr, false /* !is_subsector */); } status_t flash_impl_erase_suspend(FlashAddress sector_addr) { return qspi_flash_erase_suspend(QSPI_FLASH, sector_addr); } status_t flash_impl_erase_resume(FlashA...
/* * 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...
clock_is_24h_style()
&& (i == (num_cells - 1))) { return config->ampm_cell_width; } else { return config->cell_width; } } static void prv_update_selection_layer(TimeSelectionWindowData *time_selection_window) { const TimeSelectionSizeConfig * const config = prv_selection_config(); const int top_offset = time_selection_win...
etooth.comm_session_event = (PebbleCommSessionEvent) { .is_system = true, .is_open = app_connected, } }; prv_handle_mobile_app_event(&comm_session_event, NULL); } static void prv_put_phone_event(PhoneEventType type, PhoneCallSource source, uint32_t call_identifier) {...
(false /* app_connected */)
; ASSERT_LAST_EVENT(PhoneEventType_End); } // --------------------------------------------------------------------------------------- // Basic test for incoming calls on iOS 9 and up void test_phone_call__ancs_incoming(void) { // We should allow incoming calls with or without a mobile app on iOS 9 prv_put_incom...
*context) { new_timer_start(s_stop_mode_monitor.timer, ACCESSORY_STOP_INTERVAL_PERIOD_MS, prv_timer_interval_expired_cb, NULL, TIMER_START_FLAG_REPEATING); } //! Callback run whenever the EXTI fires static void prv_exti_cb(bool *should_context_switch) { if (!s_stop_mode_monitor.active) { // F...
{ // The send buffer is full. This means that the receive interrupt hasn't fired to clear the // buffer which indicates that there is bus contention preventing a stop bit from occuring. s_bus_contention_detected = true; }
n_menu, int selection, void *context) { alerts_preferences_set_notification_window_timeout_ms(s_window_timeouts_ms[selection]); app_window_stack_remove(&option_menu->window, true /* animated */); } static void prv_window_timeout_menu_push(SettingsNotificationsData *data) { const int index = prv_window_timeout_ge...
{ SettingsNotificationsData *data = (SettingsNotificationsData *) context; data->battery_connection_event_info = (EventServiceInfo) { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .handler = prv_settings_notifications_event_handler, }; event_service_client_subscribe(&data->battery_connection_event_info); }
static void prv_hide_cb(SettingsCallbacks *context) { SettingsNotificationsData *data = (SettingsNotificationsData *) context; event_service_client_unsubscribe(&data->battery_connection_event_info); } static Window *prv_init(void) { SettingsNotificationsData* data = app_malloc_check(sizeof(*data)); *data = ...
us = prv_read_status_register(sector_base_addr)) & S29VSStatusBit_DeviceReady) == 0) { delay_us(10); } return (status); } //! Issue the second part of a two-cycle command. This is not merged with the //! prv_issue_command as not all commands have an argument. //! //! @param sector_address The address...
{ PBL_ASSERTN(start_sector <= end_sector); flash_impl_use(); prv_issue_command(0, S29VSCommand_SectorLock); prv_issue_command_argument(0, S29VSCommand_SectorLock); start_sector = flash_impl_get_sector_base_address(start_sector); end_sector = flash_impl_get_sector_base_address(end_sector); ((__IO uint1...
ode, and attempt to reconnect to // the phone. void accel_enable_high_sensitivity(bool high_sensitivity) { mutex_lock_recursive(s_accel_manager_mutex); accel_set_shake_sensitivity_high(high_sensitivity); mutex_unlock_recursive(s_accel_manager_mutex); } /* * Driver Callbacks - See accel.h header for more context...
{ AccelData data; int result = sys_accel_manager_peek(&data); PBL_LOG(LOG_LEVEL_DEBUG, "result: %d", result); char buffer[20]; prompt_send_response_fmt(buffer, sizeof(buffer), "X: %"PRId16, data.x); prompt_send_response_fmt(buffer, sizeof(buffer), "Y: %"PRId16, data.y); prompt_send_response_fmt(buffer, ...
void command_accel_num_samples(char *num_samples) { int num = atoi(num_samples); mutex_lock_recursive(s_accel_manager_mutex); accel_set_num_samples(num); mutex_unlock_recursive(s_accel_manager_mutex); } #if UNITTEST /* * Helper routines strictly for unit tests */ void test_accel_manager_get_subsample_info...
me(x)))) ^ \ ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))) \ #endif // MixColumns function mixes the columns of the state matrix. // The method used to multiply may be difficult to understand for the inexperienced. // Please use the references to gain more information. static void InvMixColumns(void) { in...
for(i = 0; i < KEYLEN; ++i) { buf[i] ^= Iv[i]; }
} void AES128_CBC_encrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv) { uintptr_t i; uint8_t remainders = length % KEYLEN; /* Remaining bytes in the last non-full block */ BlockCopy(output, input); state = (state_t*)output; // Skip the key expansion if k...
k); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); } #define RECT_WIDTH 30 #define RECT_HEIGHT 40 #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20)...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
ert(bitmap); // Since frame 1 has 0 delay, it renders then immediately we render frame 2 gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 0); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(2))); // Frame 2 has delay 1000 ms, so at time 1000 ms, we expect frame 3 gbitmap_sequence_update_bitma...
GET_PBI_NAME(3)
)); #endif } void test_gbitmap_sequence__1bit_to_1bit_notification(void) { uint32_t resource_id = sys_resource_load_file_as_resource(TEST_IMAGES_PATH, GET_APNG_NAME); cl_assert(resource_id != UINT32_MAX); GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id); GBitmap *bitmap = g...