prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
en, .stroke_width = 1, .fill_color = GColorPurple, .path_open = false, .num_points = 3, }; GPoint points2[] = { { 6, 7 }, {5, 5}, { 0, 0 } }; memcpy(command->points, points2, sizeof(points2)); return command_list; } void test_gdraw_command__draw_command_list(void) { GDrawCommandList *command...
gdraw_command_image_get_data_size(image)
); image->version = 2; cl_assert(!gdraw_command_image_validate(image, size)); free(image); } void test_gdraw_command__clone_image(void) { cl_assert_equal_p(gdraw_command_image_clone(NULL), NULL); size_t size = sizeof(GDrawCommandImage) + (3 * sizeof(GDrawCommand)) + (sizeof(GPoint) * 6); ...
his one won't be scheduled yet const int delay_d = 230; const int delay_spawn = 170; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); // Create the animations Animation *a...
animation_set_duration(a, duration_a)
; animation_set_delay(a, delay_a); animation_set_auto_destroy(a, auto_destroy); animation_schedule(a); Animation *b = prv_create_test_animation(); animation_set_implementation(b, &implementation); animation_set_duration(b, duration_a); animation_set_delay(b, delay_a); animation_set_auto_destroy(b, auto...
/* * 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(id, 1)
; }
NABLE; NVIC_Init(&NVIC_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = BOARD_CONFIG.i2c_bus_configs[i].er_irq_channel; NVIC_Init(&NVIC_InitStructure); I2C_DeInit(i2c_buses[i].i2c); } s_initialized = true; for (uint32_t i = 0; i < ARRAY_LENGTH(i2c_buses); i++) { if (BOARD_CONFIG.i2c_bu...
if (!wait_for_busy_clear(bus_idx)) { // Bus did not recover after reset bus_unlock(bus); return false; }
} // Take binary semaphore so that next take will block PBL_ASSERT(semaphore_take(bus), "Could not acquire semaphore token"); // Set up transfer bus->transfer.device_address = device_address; bus->transfer.register_address = register_address; bus->transfer.read_not_write = read_not_write; bus->transf...
finished) { return; } // This stopped handler is used to defer the transition from recording to the wait for response // screen until the folding animation is complete. prv_handle_stop_transition(context); } static void prv_show_unfold_animation(VoiceUiData *data, bool is_reversed) { KinoReel *reel = ki...
if (fly_in) { to = dot_frame; from = dot_frame; from.origin.x = -to.size.w; } else { from = dot_frame; to = dot_frame; to.origin.x = -from.size.w; }
data->mic_window.mic_dot_radius = MIC_DOT_MAX_RADIUS; PropertyAnimation *anim = property_animation_create_layer_frame(dot_layer, &from, &to); if (!anim) { return; } layer_set_frame(dot_layer, &from); layer_set_hidden(dot_layer, false); animation_set_custom_interpolation((Animation *)anim, prv_inte...
!set */, QSPI_NO_TIMEOUT); } qspi_release(dev->qspi); return (already_enabled) ? S_NO_ACTION_REQUIRED : S_SUCCESS; } status_t qspi_flash_lock_sector(QSPIFlash *dev, uint32_t addr) { #if TARGET_QEMU return S_SUCCESS; #endif qspi_use(dev->qspi); prv_write_enable(dev); // Lock or unlock the sector co...
("Check whoami")
; if (!qspi_flash_check_whoami(dev)) { ++failures; prompt_send_response("ERROR: Who am I failed"); } else { ++passes; } prompt_send_response("Enter low power mode"); flash_impl_enter_low_power_mode(); // WHOAMI should fail in low-power mode prompt_send_response("Check whoami, should fail in ...
, 192, -40}, { 984, 328, 144}, { 872, 320, 32}, { 896, 320, 160}, { 952, 336, 96}, { 920, 320, 40}, { 912, 432, -112}, { 952, 416, -136}, { 1168, 416, -128}, { 1312, 304, 88}, { 1744, 376, 152}, { 1280, 384, 136}, { 1096, 264, 136}, { 1216, 128, 224}, { 1192, 88, ...
{ 1176, 168, 128}, { 1192, 136, 112}, { 1016, 104, 136}, { 832, 72, 88}, { 824, 64, 32}, { 784, 24, 24}, { 744, 8, 0}, { 776, -24, 24}, { 872, -80, 0}, { 952, -8, -8}, { 1416, -144, 208}, { 1592, 72, 64}, { 1184, 152, -8}, { 1384, 184, -160}, { 1208, 312, -56}...
{ 1000, 360, -32}, { 1328, 272, 80}, // 64 seconds { 1368, 304, 56}, { 1728, 320, -16}, { 1280, 480, -96}, { 1016, 336, -56}, { 1008, 168, 136}, { 1184, 72, 112}, { 1064, 40, 160}, { 848, 32, 248}, { 848, 80, 160}, { 816, 32, 112}, { 704, -24, 152}, { 648, -2...
se DataLoggingSessionCommStateOpening: //Currently, these messages never get NACK'd PBL_LOG(LOG_LEVEL_ERROR, "Unexpected NACK"); break; case DataLoggingSessionCommStateSending: //Maybe queue a resend logging_session->comm.num_bytes_pending = 0; if (++logging_session->comm.nack_co...
if (logging_session == NULL) { dls_endpoint_close_session(session_id); }
} // If the bluetooth connection is flaky, a session reopen could take a few seconds, so we will chain them // and only do 1 re-open per system callback so that we don't trigger a watchdog timeout. DataLoggingReopenEntry *head = NULL; dls_list_for_each_session(dls_endpoint_add_reopen_sessions_cb, (void *)&h...
r_modal(); } } static NOINLINE void prv_render_transition_rect(GContext *ctx, Animation *animation, uint32_t distance_normalized) { // If the modal is the destination, just draw the frame and fill its inner ring with the app's // frame buffer if (s_data.modal_is_...
ctx->draw_state.draw_implementation = saved_draw_implementation; }
static void prv_modal_push_transition_animation_update_round(GContext *ctx, Animation *animation, uint32_t distance_normalized) { prv_render_modal_if_necessary(); prv_render_transition_round(ctx, animation, distance_normalized); } static void prv_modal...
_focus_animation_teardown, } }; static const PropertyAnimationImplementation s_center_focus_selection_animation_out_only_impl = { .base = { .setup = prv_center_focus_animation_setup, .update = prv_center_focus_animation_update_out_only, .teardown = prv_center_focus_animation_teardown, ...
{ index.row = num_rows - 1; }
// when called from iteration triggered by menu_layer_set_selected_next() the // selection.index.section could be MENU_INDEX_NOT_FOUND (a very large value) // in this case, walk forward from {0, 0| to avoid a very long loop run const bool is_invalid_section = menu_layer->selection.index.section == MENU_INDEX_...
rame; } void layer_set_bounds(Layer *layer, const GRect *bounds) { if (grect_equal(bounds, &layer->bounds)) { return; } layer->bounds = *bounds; layer_mark_dirty(layer); } void layer_set_bounds_by_value(Layer *layer, GRect bounds) { layer_set_bounds(layer, &bounds); } void layer_get_bounds(const Layer ...
{ while (prev_sibling->next_sibling != below_layer) { prev_sibling = prev_sibling->next_sibling; } prev_sibling->next_sibling = layer_to_insert; }
layer_to_insert->next_sibling = below_layer; } // Above means lower down in the hierarchy so it gets drawn later, // and as a result the drawn on top of what's below it. void layer_insert_above_sibling(Layer *layer_to_insert, Layer *above_layer) { if (above_layer->parent == NULL) { return; } if (layer_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...
{ uint8_t *src = (uint8_t *)p; for (uint32_t i=0; i<size; i++) { qemu_test_add_byte_from_isr(&s_state, *src++); } }
// ------------------------------------------------------------------------------------ static void prv_send_hdr(uint16_t protocol, uint16_t data_len) { QemuCommChannelHdr hdr = (QemuCommChannelHdr) { .signature = htons(QEMU_HEADER_SIGNATURE), .protocol = htons(protocol), .len = htons(data_len) }; ...
(DCDC, DCDC_TEST_0_REG, DCDC_OUTPUT_MONITOR, 0x0)
; REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_ANA_TEST, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_IDLE, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18P, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_VDD, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCD...
1, 7, 4, 2, 1, 88, 52, 38, 28, 21, 15, 10, 7, 4, 2, 1, 96, 58, 43, 33, 25, 19, 13, 9, 6, 4, 2, 1, 104, 64, 49, 38, 29, 23, 17, 12, 8, 6, 3, 2, 1 }; MOCKABLE void graphics_line_draw_1px_non_aa(GContext* ctx, GPoint p0, GPoint p1) { p0.x += ctx->draw_state.drawing_box.origin.x; p1.x += ctx->draw_state.drawing_...
if (dx == dy) { // Diagonal line while (dy-- != 0) { x1 += xi; y1++; graphics_private_plot_pixel(framebuffer, &ctx->draw_state.clip_box, x1, y1, MAX_PLOT_OPACITY, stroke_color); } } else { // Line is not horizontal, diagonal, or vertical // Erro...
stroke_color); graphics_private_plot_pixel(framebuffer, &ctx->draw_state.clip_box, x1 + xi, y1, (weighting ^ weighting_complement_mask), stroke_color); } // Draw final pixel graphics_private_plot_pixel(framebuffer, &ctx->...
_flags); PBL_ASSERTN(success); psleep(50); // Stop and then delete it success = new_timer_stop(s_app_data->timer[0]); PBL_ASSERTN(!success); /* stop returns false if callback is running */ new_timer_delete(s_app_data->timer[0]); s_app_data->timer[0] = TIMER_INVALID_ID; } // ========================...
(&s_app_data->reg_timers[0])
; // Wait for timer to run at least twice PBL_LOG(LOG_LEVEL_DEBUG, "waiting for callback to run 2 times"); psleep(2200); PBL_ASSERT(s_reg_timer_3_callback_count >= 2, "Callback didn't run at least twice"); } // ================================================================================= void croak_menu_...
w_create(); Window *window2 = window_create(); cl_assert_equal_b(window_is_transparent(window2), false); window_set_transparent(window2, true); cl_assert_equal_b(window_is_transparent(window2), true); WindowStack *app_stack = app_state_get_window_stack(); WindowStack *modal_stack = modal_manager_get_window...
compositor_transition(NULL)
; // Call the upkeep function so the change in state is handled modal_manager_event_loop_upkeep(); // The app is now obstructed by a unfocusable modal, it should remain active cl_assert_equal_b(s_app_idle, false); // The app should retain focus PebbleEvent event = fake_event_get_last(); cl_assert_equal_...
} else if (state->test_entry.version == 2) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d", &steps, &orientation, &vmc, &light); } else if (state->test_entry.version == 3) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc, &light, &plugg...
{ if (!prv_sample_discovery_next_file(&state->common)) { return false; } }
ceId resource, TimelineResourceId fallback_resource, const Uuid *app_id); static void prv_deinit_icon(TimelineLayout *timeline_layout); static void prv_init_colors(TimelineLayout *timeline_layout); static void prv_update_proc(Layer *layer, GContext *ctx); static GTextNode *prv_create_pin_view_...
i18n_free_all(timeline_layout)
; } void timeline_layout_init_info(TimelineLayoutInfo *info, TimelineItem *item, time_t current_day) { *info = (TimelineLayoutInfo) { .timestamp = item->header.timestamp, .duration_s = item->header.duration * SECONDS_PER_MINUTE, .current_day = current_day, .all_day = item->header.all_day, }; inf...
r, sizeof(buffer)); //dbgserial_putstr(buffer); //dbgserial_putstr("Done"); } static void save_rtc_time_state(RtcIntervalTicks current_rtc_ticks) { // Floor it to the latest second const RtcIntervalTicks current_rtc_ticks_at_second = (current_rtc_ticks / RTC_TICKS_HZ) * RTC_TICKS_HZ; save_rtc_time_state_exa...
RTC_ClearITPendingBit(RTC_IT_ALRA)
; exti_configure_other(ExtiLineOther_RTCAlarm, ExtiTrigger_Rising); exti_enable_other(ExtiLineOther_RTCAlarm); s_tick_alarm_initialized = true; } void rtc_alarm_set(RtcTicks num_ticks) { PBL_ASSERTN(s_tick_alarm_initialized); RTC_ITConfig(RTC_IT_ALRA, DISABLE); RTC_AlarmCmd(RTC_Alarm_A, DISABLE); RTC...
/* * 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...
(r->value, value, value_length)
== 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Key & value already exist."); return 0; } PBL_LOG(LOG_LEVEL_DEBUG, "Key already exists. Updating record."); r->description = description; memcpy(r->value, value, value_length); r->value_length = value_length; registry->is_different_from_flash = true...
to_destroy) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. PBL_ASSERTN(!auto_dest...
prv_animation_state_get(PebbleTask_Current)
PBL_LOG(LOG_LEVEL_ERROR, "No subscription found for ATT handle %u", att_handle); } goto unlock; } // Mask to mask out all tasks const PebbleTaskBitset task_mask_none = ~0; PebbleTaskBitset task_mask = task_mask_none; for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) { if (UNLIKELY(subscription->...
if (subscription->pending_confirmation[c]) { subscription->pending_confirmation[c] = false; if (subscription->subscriptions[c] == BLESubscriptionNone) { // Client unsubscribed in the mean-time. Confirmation should already have been sent. continue; } if (has_error) { // Su...
} if (task_mask != task_mask_none) { prv_send_subscription_event(subscription->characteristic, task_mask, type, error); } // In the error case, clean up the subscription data structure, if no longer used: if (has_error && prv_prevailing_subscription_type(subscription) == BLESubscriptionNone) { prv_...
->accessors.setter.int16; setter(property_animation->subject, result); } #endif // ----------------------------------------------------------------------------------------- void property_animation_update_gcolor8(PropertyAnimation *property_animation_h, c...
implementation->accessors.getter.uint32(subject)
; } else if (property_animation->animation.implementation->update == (AnimationUpdateImplementation) property_animation_update_gpoint) { property_animation->values.to.gpoint = to_value ? *((GPoint*)to_value) : implementation->accessors.getter...
cl_assert_equal_i(s_num_alarm_events_put, 4)
; cl_assert_equal_i(s_num_timeline_adds, 17); cl_assert_equal_i(s_num_timeline_removes, 11); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm__just_once_alarm_timeout_ahead(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind =...
conds(void) { #if CAPABILITY_HAS_HEALTH_TRACKING int32_t sleep_seconds; const bool rv = activity_get_metric(ActivityMetricSleepStateSeconds, 1, &sleep_seconds); return rv ? sleep_seconds : 0; #else return 0; #endif } // -------------------------------------------------------------------------------------------...
(alarm, cron_job_get_execute_time(cron))
; time_t last_alarm = 0; for (int i = 0; alarm_time <= current_time + SECONDS_PER_DAY * 3; i++) { if (last_alarm != alarm_time) { last_alarm = alarm_time; localtime_r(&alarm_time, local_alarm_time); if (alarm->config.scheduled_days[local_alarm_time->tm_wday]) { Uuid *pinid = (Uuid *)&...
/* * 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...
{ // Couldn't capture framebuffer return; }
pandableDialog *expandable_dialog = expandable_dialog_create_with_params( header, RESOURCE_ID_SMART_ALARM_TINY, first_use_text, GColorBlack, GColorWhite, NULL, RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_alarms_app_opened_click_handler); expandable_dialog_set_action_bar_background_color(expandable_dialo...
prv_clear_alarm_list(data)
; event_service_client_unsubscribe(&data->alarm_event_info); app_free(data); } static void s_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* alarms_app_get_info() { static const PebbleProcessMdSystem s_alarms_app_info = { .common = { .main_func =...
read_count; static uint32_t s_analytics_read_bytes_count; static uint32_t s_analytics_write_bytes_count; static uint32_t s_system_analytics_read_bytes_count = 0; static uint32_t s_system_analytics_write_bytes_count = 0; static uint8_t s_system_analytics_erase_count = 0; void analytics_external_collect_system_flash_st...
PBL_LOG(LOG_LEVEL_ERROR, "Flash erase failed, status %"PRIi32, status)
/* * 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_create()
; window_stack_push(window, false); rocky_event_loop_with_resource(RESOURCE_ID_JS_SNAPSHOT); }
assert(receiver != NULL); g_default_kernel_receiver_implementation.write(receiver, (uint8_t *)data, strlen(data)); prv_assert_no_handler_calls(); g_default_kernel_receiver_implementation.finish(receiver); // CBs shouldn't immediately execute since they are pended on KernelBG prv_assert_no_handler_calls(); ...
(receiver != NULL)
ow->num_scrollable_metrics++] = metrics[i]; } } static const char* prv_get_label_for_hr_metric(int bpm) { switch (hr_util_get_hr_zone(bpm)) { case HRZone_Zone1: /// Zone 1 HR Label return i18n_noop("FAT BURN"); case HRZone_Zone2: /// Zone 2 HR Label return i18n_noop("ENDURANCE"); ...
graphics_text_node_create_horizontal(MAX_TEXT_NODES)
; GTextNodeContainer *container = &horiz_container->container; horiz_container->horizontal_alignment = TEXT_ALIGNMENT; const GFont number_font = prv_get_number_font(prefer_larger_font); const GFont units_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD); const int units_offset_y = fonts_get_font_height(...
state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == ti...
(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(2))
; cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(4)); cl_assert(timeline_model_iter_prev(&new_idx, NULL)); cl_assert_equal_i(new_idx, 1); cl_assert_equal_i(timelin...
/* * 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_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler)click_handler)
; (void)window; } static void prv_window_load(Window *window) { AppState *data = window_get_user_data(window); data->text_layer_size = GSize(144, 168); text_layer_init(&data->text_layer, &GRect(0, 0, data->text_layer_size.w, data->text_layer_size.h)); text_layer_set_background_color(&data-...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uint16_t bytes_read; uint8_t byte; bool exit = false; bool got_msg = false; time_t cur_time = rtc_get_time(); // Reset our state if too much time has passed since we detected start of a packet if (state->recv_state != QemuRecvState_WaitingHdrSignatureMSB && cur_time > state->start_recv_packet_ti...
s_num_buttons_down--; if (s_num_buttons_down < 0) { PBL_LOG(LOG_LEVEL_ERROR, "More buttons were released than have been pressed."); s_num_buttons_down = 0; } if (s_num_buttons_down == 0 && s_light_state == LIGHT_STATE_ON && !s_user_controlled_state) { // no more buttons pressed: wait for ...
(ANALYTICS_DEVICE_METRIC_SETTING_BACKLIGHT, behaviour, AnalyticsClient_System)
; analytics_set(ANALYTICS_DEVICE_METRIC_SETTING_SHAKE_TO_LIGHT, is_motion_enabled, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_SETTING_BACKLIGHT_INTENSITY_PCT, backlight_intensity_pct, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_SETTING_BACKLIG...
/* * 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...
gdraw_command_get_stroke_color(processed_command)
; const GColor tinted_stroke_color = gcolor_perform_lookup_using_color_luminance_and_multiply_alpha(stroke_color, luminance_tint_lookup_table); gdraw_command_set_stroke_color(processed_command, tinted_stroke_color); } typedef struct Generic...
ypes.h" #include "applib/graphics/text.h" #include "applib/ui/ui.h" #include "drivers/rtc.h" #include "font_resource_keys.auto.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/kernel_ui.h" #include "process_state/app_state/app_state.h" #include "services/common/clock.h" #include "services/common/i18n/i18n.h" #incl...
PBL_IF_RECT_ELSE(&s_time_config.text.extent.node, &s_title_config.text.extent.node)
, PBL_IF_RECT_ELSE(&s_icon_config.node, &s_time_config.text.extent.node), &s_subtitle_config.text.extent.node, }; static const LayoutNodeVerticalConfig s_vertical_config = { .container.extent.node.type = LayoutNodeType_Vertical, .container.num_nodes = ARRAY_LENGTH(s_vertical_config_nodes), .cont...
/* * 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_external_collect_accel_xyz_delta()
; analytics_external_collect_app_cpu_stats(); analytics_external_collect_app_flash_read_stats(); analytics_external_collect_cpu_stats(); analytics_external_collect_stop_inhibitor_stats(rtc_get_ticks()); analytics_external_collect_chip_specific_parameters(); analytics_external_collect_bt_pairing_info(); an...
/* * 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)
; cl_assert(*output == input); } void test_lru_cache__one_put_two_get(void) { uint32_t input = 0xdeadbeef; lru_cache_put(&s_cache, 1, &input); uint32_t *output; for (int i = 0; i < 2; i++) { output = lru_cache_get(&s_cache, 1); cl_assert(output); cl_assert(*output == input); } } void test_lru...
/* * 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_enqueue(conn_idx, context_ref, resp_dest, GattOpType_Read)
ntext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(2, 2, 28, 20), 4); } void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_context_set_ant...
(&ctx.dest_bitmap, "draw_round_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")
); } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__clear(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 32, 24)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.d...
ine TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(num_steps_increment) \ ROCKY_RETURN_IF_ERROR(prv_try_allocate_steps(num_steps_increment)) static jerry_value_t prv_add_pt(jerry_length_t argc, const jerry_value_t *argv, RockyAPIPathStepType step_type) { const double raw_x = argc > 0 ? (jerry_g...
{ RockyAPIPathStep *const step = &s_rocky_path_steps[i]; switch (step->type) { case RockyAPIPathStepType_MoveTo: { prv_fill_points(points, points_num); points_num = 0; ADD_P(step->pt); break; } case RockyAPIPathStepType_LineTo: { ADD_P(step->pt); ...
rv = jerry_create_undefined(); prv_fill_points(points, points_num); cleanup: task_free(points); return rv; } JERRY_FUNCTION(prv_arc) { GPointPrecise center; Fixed_S16_3 radius; double angle_1, angle_2; ROCKY_ARGS_ASSIGN_OR_RETURN_ERROR( ROCKY_ARG(center.x), ROCKY_ARG(center.y), ROCKY_ARG...
GAPLEConnectHCIReasonExtensionCancelConnect); } bt_unlock(); return ret_value; } // ------------------------------------------------------------------------------------------------- BTErrno gap_le_connect_connect_by_bonding(BTBondingID bonding_id, bool auto_reconnect, ...
bt_unlock()
ze(AnalyticsHeartbeatKind kind) { AnalyticsMetric last = ANALYTICS_METRIC_INVALID; switch (kind) { case ANALYTICS_HEARTBEAT_KIND_DEVICE: last = ANALYTICS_DEVICE_METRIC_END - 1; break; case ANALYTICS_HEARTBEAT_KIND_APP: last = ANALYTICS_APP_METRIC_END - 1; break; } PBL_ASSERTN(last != ANALYTI...
{ uint8_t *location = prv_heartbeat_get_array_location(heartbeat, metric, index); prv_location_set_value(location, val, analytics_metric_element_type(metric)); }
void analytics_heartbeat_set_entire_array(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, const void* data) { uint8_t *location = prv_heartbeat_get_array_location(heartbeat, metric, 0); uint32_t size = analytics_metric_size(metric); memcpy(location, data, size); } ///////// // Get int64_t analytics_hear...
onst Uuid uuid = gatt_client_characteristic_get_uuid(characteristic_ref); cl_assert(uuid_equal(&uuid, &expected_characteristic->uuid)); // Test gatt_client_characteristic_get_properties(): cl_assert_equal_i(gatt_client_characteristic_get_properties(characteristic_ref), expecte...
(&device, service_refs, num_services, &bp_service->uuid)
; Uuid matching_uuids[3]; matching_uuids[0] = bp_service->characteristics[1].uuid; matching_uuids[1] = bt_uuid_expand_16bit(0xffff); // not expected to match matching_uuids[2] = bp_service->characteristics[0].uuid; BLECharacteristic characteristics[3]; const uint8_t found = gatt_client_service_get...
/* * 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_default_connection_state; }
/* * 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...
{ delay_us(dev->state->part->reset_latency_ms * 1000); }
else { psleep(dev->state->part->reset_latency_ms); } // Return the flash to Quad SPI mode, all our commands are quad-spi and it'll just cause // problems/bugs for someone if it comes back in single spi mode qspi_indirect_write_no_addr_1line(dev->qspi, dev->state->part->instructions.enter_quad_mode); if...
); // Get s_tx_window_size packets in flight: for (sn = 0; sn < s_tx_window_size; ++sn) { cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, si...
for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); }
ircular); cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE)); } // Tests 2-bit palettized PBI loading into gbitmap // Result: // - gbitmap matches platform loa...
graphics_context_set_fill_color(ctx, GColorBlack)
; graphics_fill_rect(ctx, &framebuffer_bounds); bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE)); } void test_bitblt_circular__8_bit_converted_circular_offset(void) { GBitmap *bitmap = setup_png_test(TE...
ct_origin_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif } #define OFFSET_RECT_NO_CLIP GRect(20, 10, 144, 168) #define OFFSET_RECT_CLIP_XY GRect(20, 10, 20, 20) #define OFFSET_RECT_CLIP_NXNY GRect(20, 10, 144, 168) #define OFFSET_DRAW_RECT_NO_CLIP GRect(6, 6, 30, 40) #define OFFSET_DRAW_RECT_CL...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 5); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if ...
_HOUR + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 H AGO", time_buf); // June 9th 2015, 14:00:00 (T+02:00:00) rtc_set_time(event_time + (2 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, si...
(event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR))
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Tue, 4:00 PM", time_buf); // June 16th 2015, 17:00:00 (T+7DAY+01:00:00) rtc_set_time(event_time + (7 * SECONDS_PER_DAY) + (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeo...
nt_plus_icon_resource_id); } box.origin = GPoint((cell_layer->bounds.size.w - data->plus_icon.bounds.size.w) / 2, (cell_layer->bounds.size.h - data->plus_icon.bounds.size.h) / 2); box.size = data->plus_icon.bounds.size; graphics_context_set_compositing_mode(ctx, GCompOpTint); ...
{ const char *first_use_text = i18n_get( "Let us wake you in your lightest sleep so you're fully refreshed! " "Smart Alarm wakes you up to 30min before your alarm.", data); const char *header = i18n_get("Smart Alarm", data); ExpandableDialog *expandable_dialog = expandable_dialog_create_with_params( ...
#endif /////////////////////////////////////////////////////////////////////////////////////////////////// //! App boilerplate static void prv_handle_init(void) { AlarmsAppData *data = app_malloc_check(sizeof(*data)); *data = (AlarmsAppData) {{ .user_data = NULL }}; Window *window = &data->window; window_in...
ppData *data, bool animated) { if (data->action_bar_state == ActionBarStateVolume) { action_bar_layer_set_click_config_provider(&data->action_bar, prv_volume_click_config_provider); } action_bar_layer_set_icon_animated(&data->action_bar, BUTTON_ID_UP, &data->icon...
app_timer_register(VOLUME_REPEAT_INTERVAL_MS, prv_handle_volume_repeat, data)
rame is valid - transition the FSM and queue up processing of it smartstrap_fsm_state_set(SmartstrapStateReadComplete); ReadCompleteContext context = { .success = true, .is_notify = is_notify }; system_task_add_callback_from_isr(prv_read_complete_system_task_cb, context.context_ptr, ...
(read_data)
; } else { result = prv_send_byte(read_data); } if (mbuf_iterator_is_finished(iter)) { // we just sent the last byte if (s_send_info.is_read) { // We just successfully sent a read request, so should move to ReadInProgress to prepare to // read the response. We do this here to ensure we do...
ash // TODO: Will we successfully recover if the flash HW was left midstream in a command from // before? prv_flash_wait_for_write_bounded(64000000); prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ_ID); uint32_t manufacturer = prv_flash_read_next_byte(); uint32_t type = prv_flash_re...
(start_addr)
= WITHIN(cur_frame->origin.y, TEXT_VISIBLE_LOWER_THRESHOLD(cur_frame->size.h), TEXT_VISIBLE_UPPER_THRESHOLD); if (!viewing_entire_notif && !at_bottom && text_visible) { hide_it = false; } #else const bool at_top = (cur_frame->origin.y == 0); if (at_top && (!viewing_entire_n...
{ SwapLayer *swap_layer = (SwapLayer *) context; if (swap_layer->is_deiniting) { return; } // remove the layout prv_remove_old_layout(swap_layer, swap_layer->next); // shift all of the indexes swap_layer->next = swap_layer->current; swap_layer->current = swap_layer->previous; swap_layer->previou...
static Animation *prv_create_swap_up_animation(SwapLayer *swap_layer, bool full_swap) { int16_t dy; const GRect *prev_frame = &swap_layer->previous->layer.frame; const GRect *current_frame = &swap_layer->current->layer.frame; if (full_swap) { dy = prev_frame->size.h - current_frame->origin.y; } 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...
(123, gbitmap_get_bytes_per_row(&bmp))
i/display/DEV/PBW+3.0 #if PLATFORM_TINTIN || PLATFORM_SILK || UNITTEST #define APP_SPACE_BUFFER KiBYTES(300) #else #define APP_SPACE_BUFFER MiBYTES(4) #endif #define MAX_PRIORITY ((uint32_t)~0) // 4 quick launch apps, 1 default watchface, 1 default worker #define DO_NOT_EVICT_LIST_SIZE (NUM_BUTTONS + 2) static Pebbl...
{ // check entry is valid if ((info->key_len != sizeof(AppInstallId)) || (info->val_len != sizeof(AppCacheEntry))) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid cache entry with key_len: %u and val_len: %u, flushing", info->key_len, info->val_len); system_task_add_callback(prv_delete_cache_c...
////////////////////////// // AppCache API's ////////////////////////// //! Updates metadata within the cache entry for the given AppInstallId. Will update such fields as //! launch count, last launch, and priority status_t app_cache_app_launched(AppInstallId app_id) { status_t rv; mutex_lock_recursive(s_app_cac...
urn S_SUCCESS; } status_t return_error(void) { return E_ERROR; } status_t flash_impl_init(bool coredump_mode) { return S_SUCCESS; } void flash_impl_use(void) {} void flash_impl_release_many(uint32_t num_locks) {} int get_subsector_base_calls = 0; FlashAddress flash_impl_get_subsector_base_address(FlashAddress ...
(0, callback, NULL)
; cl_assert_equal_i(erase_sector_begin_calls, 1); cl_assert_equal_i(erase_subsector_begin_calls, 0); } /////////////////////////////////////////////////////////////////////// status_t erase_status_return_error_once(void) { get_erase_status_fn = return_success; return E_ERROR; } void test_flash_api__retry_era...
/* * 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...
gbitmap_get_data_row_info(framebuffer_bitmap, (uint16_t)y)
; result->mask_row_infos[y] = (GDrawMaskRowInfo) { .type = transparent ? GDrawMaskRowInfoType_SemiTransparent : GDrawMaskRowInfoType_Opaque, .min_x.integer = row_info.min_x, .min_x.fraction = (uint16_t)(transparent ? fixed_s16_s3_fraction_max_value : 0), .max_x.integer = row_info.m...
{ return -1; }
else if (entry_a->exp_steps == 0 && entry_b->exp_steps > 0) { return +1; } else { return strcmp(entry_a->name, entry_b->name); } } // -------------------------------------------------------------------------------------- // Callback provided to the qsort() routine for sorting sleep tests by name int prv_...
term is silent: cl_assert(job_b); cl_assert_equal_b(gap_le_is_advertising_enabled(), true); assert_ad_data("A"); gap_le_assert_advertising_interval(advert_terms_a[0].min_interval_slots, advert_terms_a[0].max_interval_slots); // After A's first term, expect that B's seco...
free(ad_a)
; free(ad_b); } void test_gap_le_advert__expiring_job(void) { // Test that a job is expired correctly after the set duration: uint16_t seconds_left = 5; GAPLEAdvertisingJobTerm advert_term = { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = seconds_left, }; BLEAdData *ad...
window2, prv_click_config_provider); modal_window_push(window1, base_priority, false); cl_assert_equal_i(window1->on_screen, true); modal_window_push(window2, base_priority - 1, false); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_i(window2->on_screen, false); modal_window_push(window1,...
modal_manager_get_window_stack(ModalPriorityGeneric)
; cl_check(app_stack); cl_check(modal_stack); cl_check(!app_stack->list_head); cl_check(!modal_stack->list_head); // Switch to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); window_stack_push(app_stack, window1, true); cl_assert_equal_i(window_stack_count(app_stack), ...
pped_handler_calls, 0, sizeof(AnimTestHandlerHistory)); memset(&s_setup_handler_calls, 0, sizeof(AnimTestHandlerHistory)); memset(&s_teardown_handler_calls, 0, sizeof(AnimTestHandlerHistory)); memset(&s_update_handler_calls, 0, sizeof(AnimTestHandlerHistory)); } // -----------------------------------------------...
prv_now_ms()
, (int)animation); animation_schedule(animation); } else { DPRINTF("%"PRIu64" ms: NOT rescheduling from stopped handler for %d\n", prv_now_ms(), (int)animation); } } // -------------------------------------------------------------------------------------- // setup handler void prv_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, text, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD), *layer_bounds, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, text_attributes)
; graphics_text_attributes_destroy(text_attributes); } void prv_fill_mask_shape(GContext *ctx, const GRect *layer_bounds, const GSize *shape_size, int32_t current_angle) { const GOvalScaleMode oval_scale_mode = GOvalScaleModeFitCircle; // Calculate the radial rect const GRect inset_la...
22 uT */ // Note: All of the following helper routines operate on the s_samples array // defined above and populated by add_raw_mag_sample static bool pt_to_pt_dist_under_thresh(int idx_a, int idx_b, int32_t thresh) { int32_t v_ab[3] = { s_samples[idx_b][0] - s_samples[idx_a][0], s_samples[idx_b][1] - s_sam...
(calib_val[1], 3)
; z_delta = min_max_diff(calib_val[2], 3); if ((x_delta < max_delta_thresh) && (y_delta < max_delta_thresh) && (z_delta < max_delta_thresh)) { int corrs[N_AXIS] = { 0 }; for (int i = 0; i < N_AXIS; i++) { for (int j = 0; j < N_COMP_SAMPS; j++) { corrs[i] += calib_val[i][j];...
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
m the left after animating the progress % to 100% static void prv_shrink_progress_bar(VoiceUiData *data) { animation_unschedule((Animation *)data->mic_window.progress_anim); uint16_t progress = data->mic_window.progress_bar.progress_layer.progress_percent; uint32_t duration = MAX_PROGRESS_PERCENT - progress; ...
dialog_set_destroy_on_pop(dialog, false /* free_on_pop */)
; transcription_dialog_push(transcription_dialog, prv_get_window_stack()); sys_light_reset_to_timed_mode(); } else { prv_exit_and_send_result_event(data, DictationSessionStatusSuccess); } break; } default: WTF; } } // This function gets the next state to trans...
ort_data_fragment), BLEGATTErrorSuccess); free(packet); } static void prv_receive_ack(BLECharacteristic characteristic, uint8_t sn) { const PPoGATTPacket ack = (const PPoGATTPacket) { .sn = sn, .type = PPoGATTPacketTypeAck, }; ppogatt_handle_read_or_notification(characteristic, (const uint8_t *) &ack, ...
(s_num_service_instances)
; // Assert GATT reads requests to Meta characteristics happened: fake_gatt_client_op_assert_read(s_characteristics[0][PPoGATTCharacteristicMeta], GAPLEClientKernel); fake_gatt_client_op_assert_read(s_characteristics[1][PPoGATTCharacteristicMeta], ...
PurpleARGB8); cl_assert_equal_i(s_fill_color.argb, GColorGreenARGB8); cl_assert_equal_i(s_stroke_width, 2); cl_assert_equal_i(s_path_num_points, 2); cl_assert_equal_b(s_path_open, true); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points...
(NULL, command)
; cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8); cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_stroke_width, 0); cl_assert_equal_i(s_path_num_points, 0); cl_assert_equal_b(s_radius, 0); cl_assert_equal_i(s_circle_fill_count, 0); cl_assert_equal_i(s_circle_stroke_co...
48}, { 1544, -960, -128}, { 1752, -296, 0}, { 1352, -360, 312}, { 1488, 272, 224}, { 2216, 3464, -832}, { 1600, 4000, -1424}, { 648, 3744, -1752}, { -432, 1736, -944}, { -672, 968, -744}, { -608, 96, -576}, { -1176, -688, 8}, { -1072, -632, -88}, { -1128, 200, -336}, ...
{ 928, 3208, -608}, { 856, 1040, 432}, { 1216, 568, 176}, { 1400, -176, 0}, { 1312, -568, -64}, { 1216, 8, 88}, { 936, -272, 216}, { 1048, 48, -40}, { 2344, 4000, -1224}, { 2056, 4000, -1872}, { -216, 2712, -1360}, { -424, 1592, -688}, { -680, 520, -224}, { -872, ...
{ 952, -152, 520}, { 1128, 800, -456}, { 1096, 3408, -1112}, { 1040, 4000, -2376}, { -256, 2688, -1576}, { -560, 1296, -848}, { -632, 552, -368}, { -504, -16, -152}, { -904, -384, 8}, { -1080, -376, -320}, { -672, -280, -296}, { -584, 232, -568}, { -1776, 1952, -1752...
, s_total_step_count); cl_assert_equal_i(distance_m, 1201 /* 1.2km in 5 mins is reasonable */); cl_assert_equal_i(duration_s, 5 * SECONDS_PER_MINUTE); // Get some HR info prv_put_bpm_event(100, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, ...
cl_assert_equal_i(stored_session->step_data.steps, 3800)
; cl_assert_equal_i(stored_session->step_data.active_kcalories, 200 + calculated_active_kcalories); cl_assert_equal_i(stored_session->step_data.resting_kcalories, ROUND(activity_private_compute_resting_calories(stored_session->length_min), ACTIVITY_CALORIES_PER_KCAL)); ...
const uint16_t value_length) { const int32_t idx = prv_parse_queue_value(update->value_str, value_length); PBL_LOG(LOG_LEVEL_DEBUG, "Queue index update: %"PRId32, idx); // TODO: Do something with this info } static void prv_handle_queue_count_update(const AMSEntityUpdateNotification *update, ...
prv_handle_queue_shuffle_mode_update(update, value_length)
ed until the animation updates them cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0 * basic_cell_height, l.selection.y); cl_assert_equal_i(initial_scroll_offset, l.scroll_layer.content_sublayer.bounds.origin.y); // in this test setup, we can directly cast an animation to Animat...
menu_layer_reload_data(&l)
may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTI...
strncpy(formatted_phone_number, phone_number, length)
required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #inc...
(prv_is_known_misaligned_serial_number(s_mfg_serial_failing))
; }
/* * 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(strspn(testbuf, "Heo"), 2)
; cl_assert_equal_i(strspn(testbuf, "B"), 0); cl_assert_equal_i(strspn(testbuf, "Helo!B"), 7); } void test_strspn__c_basic(void) { char testbuf[8] = "Hello!B"; cl_assert_equal_i(strcspn(testbuf, "o!B"), 4); cl_assert_equal_i(strcspn(testbuf, "o"), 4); cl_assert_equal_i(strcspn(testbuf, "!"), 5); cl_asser...
umber so it's considered "valid" res_info->res_id = s_test_state.resource_is_valid ? 1337 : 0; } // Stubs //////////////////////////////////////////////////////////////// #include "stubs_app_cache.h" #include "stubs_app_install_manager.h" #include "stubs_app_state.h" #include "stubs_events.h" #include "stubs_event...
app_glance_add_slice(session, slice)
, APP_GLANCE_RESULT_SUCCESS); num_slices_added++; // Check that adding a slice with an invalid icon fails s_test_state.resource_is_valid = false; slice = (AppGlanceSlice) { .expiration_time = APP_GLANCE_SLICE_NO_EXPIRATION, .layout.icon = RESOURCE_ID_SETTINGS_ICON_AIRPLANE, .layout.subtitle_templat...
nge_state(BacklightState new_state); static void light_timer_callback(void *data) { mutex_lock(s_mutex); prv_change_state(LIGHT_STATE_ON_FADING); mutex_unlock(s_mutex); } static uint16_t prv_backlight_get_intensity(void) { // low_power_mode backlight intensity (25% of max brightness) const uint16_t backligh...
(LOG_LEVEL_ERROR, "More buttons were pressed than have been released.")
; s_num_buttons_down = 0; } // set the state to be on; releasing buttons will start the timer counting down if (prv_light_allowed()) { prv_change_state(LIGHT_STATE_ON); } mutex_unlock(s_mutex); } void light_button_released(void) { mutex_lock(s_mutex); s_num_buttons_down--; if (s_num_buttons_...
/* * 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_INFO, "Updating PRF!")
; flash_prf_set_protection(false); bool saved_sleep_when_idle = flash_get_sleep_when_idle(); flash_sleep_when_idle(false); FirmwareDescription description = firmware_storage_read_firmware_description(FLASH_REGION_FIRMWARE_SCRATCH_BEGIN); if (!firmware_storage_check_valid_firmware_description(FLASH_RE...
c(sizeof(TaskTimer)); if (!timer) { return TASK_TIMER_INVALID_ID; } // Grab lock on timer structures, create a unique ID for this timer and put it into our idle // timers list mutex_lock(manager->mutex); *timer = (TaskTimer) { .id = manager->next_id++, }; // We don't expect to wrap around, thi...
list_contains(manager->running_timers, &timer->list_node)
); list_remove(&timer->list_node, &manager->running_timers /* &head */, NULL /* &tail */); manager->idle_timers = list_insert_before(manager->idle_timers, &timer->list_node); } // Clear the repeating flag so that if they call this method from a callback it won't get // rescheduled. timer->repeating = f...
w > TXMenuIdx_UnmodulatedContinuousWave) { // Payload length and payload type rows are removed when unmodulated continuous wave is // enabled, compensate so the enum still matches: row += TX_MENU_NUM_PAYLOAD_ROWS; } return row; } static void prv_menu_draw_row(GContext *ctx, const Layer *cell, MenuIndex...
if (prv_test_is_running(data) && index->row != RXMenuIdx_RunStop) { // Can't change params while running return; }
switch (index->row) { case RXMenuIdx_Channel: prv_txrx_number_window(39, &data->channel, "Channel", data); break; #if CAPABILITY_HAS_BUILTIN_HRM case RXMenuIdx_HRM: data->is_hrm_enabled = !data->is_hrm_enabled; menu_layer_reload_data(menu_layer); break; #endif #i...
= { .num_actions = ARRAY_LENGTH(actions), .actions = actions, } }; notification_storage_store(&e); TimelineItem r; cl_assert(notification_storage_get(&i, &r)); compare_notifications(&e, &r); free(r.allocated_buffer); notification_storage_remove(&i); cl_assert_equal_b(notification_stor...
notification_storage_store(&e2)
; notification_storage_remove(&i2); TimelineItem r; cl_assert(notification_storage_get(&i1, &r)); compare_notifications(&e1, &r); free(r.allocated_buffer); cl_assert_equal_b(notification_storage_get(&i2, &r), false); notification_storage_store(&e3); cl_assert(notification_storage_get(&i1, &r)); c...
/* * 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_HEXDUMP(LOG_LEVEL_DEBUG, received_data, num_bytes_to_copy)
; } bool comm_session_send_data(CommSession *session, uint16_t endpoint_id, const uint8_t *data, size_t length, uint32_t timeout_ms) { SendBuffer *sb = comm_session_send_buffer_begin_write(session, endpoint_id, length, timeout_ms); if (!sb) { return false; } comm_session_send_bu...
pclk1 % (desired_maximum_frequency * DUTY_CYCLE_DIVIDERS[duty_cycle]); if (remainder != 0) { prescalar += 1; } return prescalar; } void i2c_hal_enable(I2CBus *bus) { periph_config_enable(bus->hal->i2c, bus->hal->clock_ctrl); I2C_InitTypeDef I2C_init_struct; I2C_StructInit(&I2C_init_struct); if (bu...
{ // Write the I2C bus address to select it in write mode. i2c->DR = transfer->device_address & ~I2C_READ_WRITE_BIT; transfer->state = I2CTransferState_WriteRegAddress; }
else { if (transfer->direction == I2CTransferDirection_Read) { // Write the I2C bus address to select it in read mode. i2c->DR = transfer->device_address | I2C_READ_WRITE_BIT; transfer->state = I2CTransferState_WaitForData; } else { // Write the I2C bus address t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ sys_psleep(millis); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(buffer, size)
; } bool cond(const char *font_key) { return &cond == font_key; } void conditional_syscall(const char *font_key) { syscall_internal_elevate_privilege(); if (font_key) { if (!cond(font_key)) { do_stuff(font_key, 5); } } } void store_syscall(char * buf, int size) { syscall_internal_elevate_p...
e "kernel/util/stop.h" #include "kernel/util/task_init.h" #include "kernel/util/sleep.h" #include "kernel/events.h" #include "kernel/kernel_heap.h" #include "kernel/fault_handling.h" #include "kernel/memory_layout.h" #include "kernel/panic.h" #include "kernel/pulse_logging.h" #include "services/services.h" #include "se...
("BOOTLOADER TEST STAGE 2")
rv_unload_removed_windows(WindowStack *window_stack) { // Copy the removed windows list into a local array and then call the unload callback on // each removed window. WindowStackItem *items_to_unload[WINDOW_STACK_ITEMS_MAX]; unsigned int num_items = 0; while (window_stack->removed_list_head) { if (num_it...
(prev_list_node, list_node_closest_to_head)
fective_checksum_init(&checksum); // grab the pfs lock to prevent lock inversion with crc lock mutex_lock_recursive(s_pfs_mutex); // go to offset pfs_seek(fd, offset, FSeekSet); const unsigned int chunk_size = 128; uint8_t buffer[chunk_size]; while (num_bytes > chunk_size) { pfs_read(fd, buffer, ch...
(buf, sizeof(buf), "fd open err: %d", fd)
/* * 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...
{ uint8_t tmp = *a_ptr; *a_ptr++ = *b_ptr; *b_ptr++ = tmp; }
rams(uint16_t slave_latency_events, uint16_t supervision_to_10ms) { bt_lock(); s_le_conn_params.slave_latency_events += slave_latency_events; s_le_conn_params.supervision_to_ms += (supervision_to_10ms * 10); s_le_conn_params.num_samps++; bt_unlock(); } static void prv_updat...
(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_ENCRYPTED_TIME)
; prv_update_conn_event_timer(0, true); } } void bluetooth_analytics_handle_encryption_change(void) { analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_ENCRYPTED_TIME, AnalyticsClient_System); } void bluetooth_analytics_handle_no_intent_for_connection(void) { analyti...
ayer); if (page_height) { // Force offset to start (and stay) page aligned offset.y = ROUND_TO_MOD_CEIL(offset.y, page_height); scroll_height = page_height; } } switch (direction) { case ScrollDirectionUp: offset.y += scroll_height; break; case ScrollDirectionDown: ...
scroll_layer_get_content_offset(scroll_layer)
.y; const bool content_available_up = (scroll_layer_content_offset_y < 0); content_indicator_set_content_available(content_indicator, ContentIndicatorDirectionUp, content_available_up); const bool content_available_down = (sc...
/* * 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...
EXECUTE_SCRIPT( "var c = typeof console;\n" "var cl = typeof console.log;\n" "var cw = typeof console.warn;\n" "var ce = typeof console.error;\n" )
{ graphics_text_layout_cache_deinit(&text_layer->layout_cache); text_layer->layout_cache = NULL; }
} GSize text_layer_get_content_size(GContext* ctx, TextLayer *text_layer) { PBL_ASSERTN(text_layer); if (!text_layer->should_cache_layout) { text_layer_set_should_cache_layout(text_layer, true); } GTextLayoutCacheRef layout = prv_text_layer_get_cache_handle(text_layer); PBL_ASSERTN(layout); // content...
/* * 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...
(-10, 2, 18, 4)
, 4, GCornersAll); } void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(4, 5, 18, 10), 4, GCornersAll); } void across_ny_layer_update_callback(Layer* me, GContext* c...
and subsecond registers and only exit this method if we are in the same // second both before and after. int max_loops = 4; // If we loop more than this many times, something is seriously wrong while (--max_loops) { RTC_TimeTypeDef rtc_time_before; RTC_GetTime(RTC_Format_BIN, &rtc_time_before); RTC...
(RTC_FLAG_WUTF)
; exti_clear_pending_other(ExtiLineOther_RTCWakeup); RTC_ClearITPendingBit(RTC_IT_WUT); RTC_WakeUpCmd(ENABLE); RTC_ITConfig(RTC_IT_WUT, ENABLE); s_alarm_set_time_milliseconds_since_epoch = prv_get_time_milliseconds_since_epoch(); } RtcTicks rtc_alarm_get_elapsed_ticks(void) { uint64_t now = prv_get_time_...
240, 152, -112}, { 1296, 184, -96}, { 1112, 224, -168}, { 736, 184, -248}, { 488, 152, -168}, { 400, 144, -128}, { 456, 160, -104}, { 656, 208, -112}, // 51 seconds { 920, 264, -144}, { 1176, 344, -264}, { 1112, 376, -296}, { 1208, 352, -208}, { 1264, 368, -184}, ...
{ 792, 440, -376}, { 664, 344, -512}, { 584, 280, -560}, { 472, 176, -680}, { 376, 72, -688}, { 288, 72, -760}, { 224, 0, -832}, { 280, -80, -920}, { 168, -48, -848}, { 184, -40, -976}, { 152, -144, -928}, { 56, -8, -944}, { 24, -32, -976}, { 40, -40, -984}, {...
{ 784, 216, -264}, { 840, 240, -360}, { 952, 184, -312}, { 1128, 232, -424}, { 1176, 224, -416}, { 1544, 264, -384}, { 1448, 264, -352}, { 856, 208, -192}, { 736, 200, -120}, { 1008, 304, -72}, { 1184, 272, 0}, { 1080, 192, -16}, { 864, 160, -16}, { 784, 192, -32...
assert_equal_i(recognizers[1]->state, RecognizerState_Cancelled); cl_assert_equal_i(recognizers[2]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); // Window recognizer becomes triggered e....
prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset)
; cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_p(manager.triggered, NULL); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); // A touchdown occurs and the active layer goes fro...
us_idx].duty_cycle; } i2c_init_struct.I2C_ClockSpeed = BOARD_CONFIG.i2c_bus_configs[bus_idx].clock_speed; i2c_init_struct.I2C_Ack = I2C_Ack_Enable; I2C_Init(i2c_buses[bus_idx].i2c, &i2c_init_struct); I2C_Cmd(i2c_buses[bus_idx].i2c, ENABLE); } //! Configure the bus pins, enable the peripheral clock and initi...
(s_initialized)
; PBL_ASSERTN(device_id < BOARD_CONFIG.i2c_device_count); uint8_t bus_idx = BOARD_CONFIG.i2c_device_map[device_id]; I2cBus *bus = &i2c_buses[bus_idx]; // Take control of bus; only one task may use bus at a time bus_lock(bus); if (bus->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted reset of di...