prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
" #include "clar.h" #include "util.h" #include <string.h> #include <stdio.h> // Stubs //////////////////////////////////// #include "graphics_common_stubs.h" #include "stubs_applib_resource.h" #include "test_graphics.h" static GContext ctx; static FrameBuffer framebuffer; // Helpers ///////////////////////////////...
get_gbitmap_from_pbi("test_bitblt__8bit_assign.8bit.pbi")
; GRect bounds = gbitmap_get_bounds(src_bitmap); uint8_t dest_data[bounds.size.w * bounds.size.h]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = bounds.size.w, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = src_bitmap->bounds }; uint8_...
type check fails, so nothing is supposed to be written. ROCKY_ARGS_ASSIGN( ROCKY_ARG_MAKE(buffer_untouched, type, {}), ); ASSERT_JS_ERROR(error_value, "TypeError: Argument at index 0 is not a Number"); } jerry_release_value(arg); mismatch_args[i] = 0; } } static jerry_value_t...
cl_assert_equal_s(output, cases[i].expected_output)
ength, 5); ResponseMsg *response_msg = (ResponseMsg *)data; s_last_response_cookie = ntohl(response_msg->cookie); if (response_msg->response == ResponseAck) { ++s_acks_received; } else if (response_msg->response == ResponseNack) { ++s_nacks_received; } } void test_put_bytes__initialize(void) { fak...
cl_assert_equal_i(event.put_bytes.object_type, ObjectFirmware)
; cl_assert_equal_i(event.put_bytes.total_size, VALID_OBJECT_SIZE); cl_assert_equal_i(event.put_bytes.progress_percent, 0); cl_assert_equal_b(event.put_bytes.failed, false); } void test_put_bytes__init_while_already_busy(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); prv_receive_init(VALID_OBJE...
); const uint16_t action_bar_width = show_action_bar ? ACTION_BAR_WIDTH : 0; const uint16_t content_and_action_bar_horizontal_spacing = PBL_IF_RECT_ELSE(left_margin_px, show_action_bar ? 11 : left_margin_px); const uint16_t right_margin_px = action_bar_width + content_and_action_bar_horizontal_spacing; co...
layer_add_child(&window->layer, &text_layer->layer)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable)
rs e.type = TouchEvent_Touchdown; s_next_state = RecognizerState_Started; s_idx_to_change = 1; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_handled); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_asser...
(recognizers[0]->state, RecognizerState_Started)
; cl_assert_equal_i(recognizers[1]->state, RecognizerState_Cancelled); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed); // Touchdown occurs, Window recognizer completes, active layer becomes non-null e.type = TouchEvent_Touchd...
s_set_mask(AlertMaskAllOff); cl_assert(!alerts_should_notify_for_type(AlertInvalid)); cl_assert(!alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_notify_for_type(AlertPhoneCall)); } void test_alerts__do_not_disturb(void) { cl_ass...
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS)
; cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertOther)); cl_assert(!alerts_should_vibrate_for_type(AlertOther)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!ale...
} } T_STATIC void graphics_circle_draw_1px_non_aa(GContext* ctx, GPoint p, uint16_t radius) { graphics_circle_quadrant_draw_1px_non_aa(ctx, p, radius, GCornersAll); p.x += ctx->draw_state.drawing_box.origin.x; p.y += ctx->draw_state.drawing_box.origin.y; graphics_private_set_pixel(ctx, GPoint(p.x, p.y + ra...
if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0, y0), radius + 1); }
prv_fill_horizontal_line(ctx, GPoint(x0, y0 + y), x + 1); prv_fill_horizontal_line(ctx, GPoint(x0, y0 + x), y + 1); } if (quadrant & GCornerTopLeft) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0 - radius, y0), radius + 1); } prv_fill_horizontal_line(ctx, GPoint(...
tubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_syscall_internal.h" #include "stubs_syscalls.h" #include "stubs_system_reset.h" #include "stubs_task_watchdog.h" #include "stubs_ui_window.h" #include ...
(ctx, GColorBlack)
; graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(80, 4, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } // Word Wrap Tests void draw_text_single_line_wordwrap_clip_across_ny(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); ...
nction //! is called, we need to record the duration of the scrolling animation in this function so the //! glance's KinoReel reports the correct duration for the overall selection animation. static void prv_adjust_subtitle_node_for_scrolling_animation( LauncherAppGlanceStructured *structured_glance, GContext *ctx,...
(structured_glance)
2_t dist = serial_distance32(0x0, 0x1); cl_assert_equal_i(dist, 1); } { int32_t dist = serial_distance32(0x1, 0x0); cl_assert_equal_i(dist, -1); } { int32_t dist = serial_distance32(0x0, 0xffffffff); cl_assert_equal_i(dist, -1); } { int32_t dist = serial_distance32(0xffffffff, 0x0...
(10, gcd(10, 10))
; }
case ToStringFormatHour2Digit: case ToStringFormatLocaleDate: case ToStringFormatDay2Digit: case ToStringFormatDayShort: case ToStringFormatDayLong: case ToStringFormatMonthShort: case ToStringFormatMonthLong: case ToStringFormatMonth2Digit: return false; case ToStringFormatYe...
((jerry_char_t *)result_buffer)
; } JERRY_FUNCTION(prv_to_locale_time_string) { return prv_to_locale_time_or_date_string(this_val, argc, argv, ToStringFormatEmpty, ToStringFormatLocaleTime); } JERRY_FUNCTION(prv_to_locale_date_string) { return prv_to_locale_time_or_date_string(this_val, argc, argv, ...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("10 MIN AGO", time_buf); // June 9th 2015, 12:10:30 (T+00:10:30) rtc_set_time(event_time + (10 * SECONDS_PER_MINUTE) + 30); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MA...
("Yesterday, 12:00 PM", time_buf)
; // June 11th 2015, 13:00:00 (T+2DAY+01:00:00) rtc_set_time(event_time + (2 * SECONDS_PER_DAY) + (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Tue, 12:00 PM", time_buf); // June 16th 2015, 13:00:00 (T+7DAY+01:00:00) ...
/* * 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...
{ exit(EXIT_FAILURE); }
void wtf(void) { exit(EXIT_FAILURE); } bool process_manager_compiled_with_legacy2_sdk(void) { return false; } const uint8_t *resource_get_builtin_bytes(ResAppNum app_num, uint32_t resource_id, uint32_t *num_bytes_out) { return NULL; } // Get the path of the filename ...
_offset_y; GTextNode *vertically_centered_charging_icon_node = prv_wrap_text_node_in_vertically_centered_container(&charging_icon_node->node); graphics_text_node_container_add_child(&horizontal_container_node->container, vertically_centered_charging_icon_node);...
{ settings_glance->glance_state.is_pebble_app_connected = event->bluetooth.comm_session_event.is_open; }
break; case PEBBLE_BT_STATE_EVENT: settings_glance->glance_state.is_airplane_mode_enabled = bt_ctl_is_airplane_mode_on(); break; case PEBBLE_DO_NOT_DISTURB_EVENT: settings_glance->glance_state.is_quiet_time_enabled = do_not_disturb_is_active(); break; #if CAPABILITY_HAS_BUILTIN_HR...
to_free, pfs_space); app_cache_free_up_space(to_free); } } static void prv_delete_cache_callback(void *data) { app_cache_flush(); } static void prv_delete_cached_files(void) { pfs_remove_files(is_app_file_name); } static bool prv_is_in_list(AppInstallId id, const AppInstallId list[], uint8_t len) { ...
quick_launch_get_app(BUTTON_ID_DOWN)
, quick_launch_get_app(BUTTON_ID_BACK), #endif watchface_get_default_install_id(), worker_preferences_get_default_worker(), }, }; settings_file_each(&file, prv_each_free_up_space, &evict_data); settings_file_close(&file); // remove all nodes found EvictListNode *node ...
{ case PhoneCallSource_PP: // We require the this to be a valid number when coming from PP if (prv_is_string_a_phone_number(number)) { return ANDROID_PHONE_KEY; } break; case PhoneCallSource_ANCS: case PhoneCallSource_ANCS_Legacy: return IOS_PHONE_KEY; break; }
return NULL; } // Checks for the existance of a call reply action in the notif pref db and loads it into // a timeline item static bool prv_load_sms_reply_action(const char *number, PhoneCallSource source) { const char *app_id = prv_get_app_id(number, source); if (!app_id) { return false; } // Load a...
ition_context, ctx); } else { PROFILER_NODE_START(render_modal); window_render(window, ctx); PROFILER_NODE_STOP(render_modal); } return true; } static void prv_update_modal_stacks(UpdateContext *context) { context->highest_idx = ModalPriorityInvalid; context->properties = ModalPropertyDefault; ...
{ info->disabled = true; }
xSemaphoreGive(info->interlock); } void command_modal_stack_info(void) { WindowStackInfoContext info = { .interlock = xSemaphoreCreateBinary(), }; if (!info.interlock) { prompt_send_response("Couldn't allocate semaphore for modal stack"); return; } launcher_task_add_callback(prv_modal_window_...
ID_CONNECTIVITY_BLUETOOTH_DND; } else if (!prv_is_pebble_app_connected()) { new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_DISCONNECTED; } else if (alert_mask != AlertMaskAllOn) { if (alert_mask == AlertMaskPhoneCalls) { new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_CALL...
(&data->battery_icon, GAlignRight)
; layer_add_child(&window->layer, kino_layer_get_layer(&data->battery_icon)); prv_reload_status_bar_icons(data); bounds = grect_inset(bounds, GEdgeInsets(STATUS_BAR_LAYER_HEIGHT, 0, 0, 0)); MenuLayer *menu_layer = &data->menu_layer; menu_layer_init(menu_layer, &bounds); app_menu_data_source_init(&data->d...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if ((*compositing_mode == GCompOpTint) || (*compositing_mode == GCompOpTintLuminance)) { // Force our interpretation of the tint color to be black, white, or clear tint_color = gcolor_get_bw(tint_color); if (gcolor_equal(tint_color, GColorBlack)) { *compositing_mode = GCompOpAnd; } else if (gc...
BarLayer *action_bar, GContext *ctx, GColor bg_color) { const uint32_t action_bar_circle_diameter = DISP_ROWS * 19 / 9; GRect action_bar_circle_frame = (GRect) { .size = GSize(action_bar_circle_diameter, action_bar_circle_diameter) }; grect_align(&action_bar_circle_frame, &action_bar->layer.bounds, GAlign...
action_bar_layer_init(layer)
; } return layer; } void action_bar_layer_deinit(ActionBarLayer *action_bar_layer) { if (action_bar_layer->redraw_timer) { app_timer_cancel(action_bar_layer->redraw_timer); } layer_deinit(&action_bar_layer->layer); } void action_bar_layer_destroy(ActionBarLayer *action_bar_layer) { if (action_bar_laye...
subtitle_buffer, 10); subtitle = subtitle_buffer; break; case TXMenuIdx_UnmodulatedContinuousWave: title = "Unmodulated CW"; subtitle = data->is_unmodulated_cw_enabled ? "Enabled" : "Disabled"; break; case TXMenuIdx_PayloadLength: title = "Payload Length"; ...
if (data->current_test_step == BTLETestStep_None) { prv_run_test(data); } else { prv_stop_test(data); }
break; } } else { WTF; } } static void prv_txrx_window_load(Window *window) { AppData *data = app_state_get_user_data(); Layer *window_layer = window_get_root_layer(&data->txrx_window); menu_layer_init(&data->txrx_menu_layer, &window_layer->bounds); menu_layer_set_callbacks(&data->txrx_me...
_response_cookie); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__install_message_prf_boot_bit_set(void) { prv_receive_init_put_commit_and_install(ObjectRecovery); assert_ack_count(1); assert_nack_count(0); cl_assert_equal_i((s_boot_bits_orred & BOOT_BIT_NEW_PRF_AVAILABLE), BOOT_BIT_NEW_...
(event.put_bytes.progress_percent, 0)
; cl_assert_equal_b(event.put_bytes.failed, true); } //////////////////////////////////////////////////////////////////////////////////////////////////// // put_bytes_handle_remote_app_event void test_put_bytes__session_closed_after_fw_init(void) { prv_receive_init_fw_object(); PebbleCommSessionEvent app_event...
/* * 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...
{ kino_area = data->discharging_kino_area; res_id = RESOURCE_ID_RECOVERY_LOW_POWER_DISCHARGING; }
else { goto reschedule; } layer_set_frame((Layer *) &data->kino_layer, &kino_area); kino_layer_set_reel_with_resource(&data->kino_layer, res_id); layer_mark_dirty(&data->kino_layer.layer); reschedule: data->saved_state = current_state; data->timer = app_timer_register(LOW_POWER_APP_STATE_UPDATE...
/* * 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_swap(val1, val2, elem_size)
; } } } }
-72, -320, -984}, { -80, -320, -992}, { -88, -328, -984}, { -96, -320, -976}, { -112, -320, -976}, { -120, -304, -976}, { -128, -312, -984}, { -136, -304, -968}, { -128, -304, -968}, { -144, -296, -968}, { -144, -296, -968}, { -136, -296, -976}, { -144, -296, -984}, ...
{ -248, -144, -992}, { -248, -144, -984}, { -256, -144, -992}, { -256, -136, -984}, { -256, -136, -984}, { -248, -128, -992}, { -256, -136, -992}, { -248, -136, -992}, { -248, -136, -984}, { -240, -136, -992}, { -248, -136, -992}, { -240, -144, -992}, { -240, -152, -9...
// 287 seconds { -24, 856, 304}, { -32, 1096, 152}, { 144, 1168, -144}, { 264, 1192, -200}, { 312, 1280, -456}, { 392, 624, -416}, { 472, 560, -296}, { 560, 672, -320}, { 536, 968, -472}, { 520, 920, -376}, { 416, 776, -272}, { 344, 720, -256}, { 384, 776, -312},...
= 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) { return s_firmware_update_is_in_progress; } void ...
prv_receive_data(s_session, buffer, sizeof(buffer))
== PmicRail_LDO3) { rail_control_reg = PmicRegisters_LDO3_CONFIG; ref_count = &s_ldo3_ref_count; } else { WTF; } uint8_t register_value; bool success = prv_read_register(rail_control_reg, &register_value); if (!success) { // Failed to read the current register value return false; } ...
(0x00, &val)
; if (val == 0x01) { PBL_LOG(LOG_LEVEL_DEBUG, "Found the max14690"); return true; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error: read max14690 whomai byte 0x%x, expecting 0x%x", val, 0x01); return false; } } static bool prv_set_pin_config(void) { periph_config_acquire_lock(); gpio_use...
R_ADMODE | \ QUADSPI_CCR_ADSIZE | \ QUADSPI_CCR_ABMODE | \ QUADSPI_CCR_ABSIZE | \ QUADSPI_CCR_DCYC | \ QUADSPI_CCR_DMODE | \ QUADSPI_C...
prv_set_num_data_bytes(length)
; prv_config_indirect_read(dev, instruction, start_addr, dummy_cycles, is_ddr); if (leading_bytes > 0) { prv_read_bytes(buffer, leading_bytes); } if (dma_size > 0) { // Do 4 bytes at a time for DMA QSPI_SetFIFOThreshold(QSPI_DMA_READ_WORD_SIZE); QSPI_DMACmd(ENABLE); stop_mode_disable(Inh...
hics_context_move_draw_box(GContext* ctx, GPoint offset) { s_offset = offset; } void graphics_line_draw_precise_stroked(GContext* ctx, GPointPrecise p0, GPointPrecise p1) { s_precise_lines = realloc(s_precise_lines, (s_num_precise_lines + 1) * sizeof(*s_precise_lines)); s_precise_lines[s_num_precise_lines...
(s_path_num_points, 2)
; cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // set stroke color to be transparent and restore fi...
/* * 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...
(filename, output)
; // Write out each frame as a PNG for (int i = 0; i < gdraw_command_sequence_get_num_frames(sequence); i++) { // Set up the context for every frame GContext ctx; prv_setup_context(&ctx, gdraw_command_sequence_get_bounds_size(sequence)); GDrawCommandFrame *frame = gdraw_command_sequence_get_frame_...
S" 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 "board/board.h" #include "drivers/flash/flash_impl.h" #include "drivers/flash/qspi_flash.h" #include "drivers/flash...
qspi_flash_is_erase_complete(QSPI_FLASH)
; } status_t flash_impl_erase_subsector_begin(FlashAddress subsector_addr) { 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 */); } ...
void prv_disallowed_sent_handler(AppOutboxStatus status, void *cb_ctx) { } void test_app_outbox__send_disallowed_sent_handler(void) { prv_register(); cl_assert_passert(app_outbox_send(s_test_data, s_test_data_length, prv_disallowed_sent_handler, s_expected_cb_ctx)); assert_sy...
(s_num_app_outbox_events_sent, 1)
; fake_kernel_malloc_mark_assert_equal(); } void test_app_outbox__cleanup_all_with_pending_message(void) { fake_kernel_malloc_mark(); prv_register(); app_outbox_send(s_test_data, s_test_data_length, test_app_outbox_sent_handler, s_expected_cb_ctx); cl_assert(s_last_message); app_outbox...
けこさしすせそたちつてとなに" "ぬねのはひふへほまみむめもやゆよらりるれろわ" "をんアイウエオサシスセソタチツテトナニヌネノ" "ハヒフヘホマミムメモヤユヨラリルレロワヲン", .lengths = { #if PLATFORM_ROBERT [TestStringFont_Gothic18] = 579, [TestStringFont_Gothic24B] = 291, [TestStringFont_Other] = STRING_LENGTH_MAX, #elif PLATFORM_SNOWY ...
if (length == 0) { length = STRING_LENGTH_MAX; }
#else size_t length = s_perftest_text_strings[text_index].lengths[font_index]; #endif length = MIN(length, sizeof(s_text_test_str)); strncpy(s_text_test_str, s_perftest_text_strings[text_index].string, length); s_text_test_str[length] = '\0'; #if TEXT_PERFTEST_MODAL prv_display_modal(modal_manage...
/* * 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...
comm_session_app_session_capabilities_init()
; comm_session_init(); bt_ctl_init(); #if CAPABILITY_HAS_TOUCHSCREEN touch_init(); #endif #if CAPABILITY_HAS_BUILTIN_HRM hrm_manager_init(); #endif // We only use the factory registry on tintins and biancas #ifdef MICRO_FAMILY_STM32F2 factory_registry_init(); #endif } static struct ServiceRunLevelSetti...
llows a grid pt.x += 30; if (pt.x > 120) { pt.x = CENTER_OF_ORIGIN_RECT.x; pt.y += 30; } } } #define TO_TRIG(deg) (((deg) * TRIG_MAX_ANGLE) / 360) void test_graphics_draw_circle_${BIT_DEPTH_NAME}__zero_swX_black(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Draw black...
(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_start, angle_end)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_arc_origin_aa_letter_c.${BIT_DEPTH_NAME}.pbi")); // More negative angle letter C (both angle are actually negative) angle_end -= TRIG_MAX_ANGLE; angle_start -= TRIG_MAX_ANGLE; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4); gr...
/* * 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...
(&notification->header.id)
; notifications_add_notification(notification); timeline_item_destroy(notification); } static void prv_handle_ancs_update(TimelineItem *notification, CommonTimelineItemHeader *existing_header) { if (existing_header->dismissed) { // this should be dismissed from iOS. Dismiss...
{ 896, 56, 160}, { 832, 120, 48}, { 832, 104, -8}, { 856, 144, -48}, { 832, 160, -72}, { 832, 224, -96}, { 880, 192, -80}, { 1008, 208, -32}, { 1016, 160, 16}, { 1112, 120, 80}, { 1256, 136, 112}, { 1128, 208, 88}, { 1008, 144, 80}, { 984, 104, 64}, { 992, 136, ...
{ 800, 80, 112}, { 792, 72, 104}, { 816, 88, 80}, { 888, 128, 128}, { 920, 176, 112}, { 912, 184, 24}, { 920, 192, -88}, { 1256, 184, 56}, { 1088, 152, -8}, { 968, 208, -168}, { 808, 176, -176}, { 824, 152, -64}, { 920, 80, 80}, { 976, 80, 200}, { 944, 168, 11...
{ 1368, 176, 128}, { 1080, 176, -48}, { 944, 192, -232}, { 792, 176, -152}, { 816, 96, -16}, { 856, 48, 88}, { 888, 80, 104}, { 856, 128, 56}, { 808, 144, 16}, { 808, 168, -32}, { 832, 160, -40}, { 872, 192, -48}, { 880, 208, -80}, { 920, 192, -80}, { 1088, 1...
stributed 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. */ #include "clar.h" #include "applib/ui/recognizer/recognizer.h" #inclu...
cl_assert(s_manager_state_change)
; cl_assert_equal_i(event_type, RecognizerEvent_Completed); s_manager_state_change = false; r->handling_touch_event = true; r->state = RecognizerState_Possible; event_type = -1; recognizer_transition_state(r, RecognizerState_Failed); cl_assert(!s_manager_state_change); cl_assert_equal_i(r->state, Recog...
ou 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 WARRAN...
{ BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_mock_put_service_discovery_events(); const Service *bp_service = fake_gatt_get_blood_pressure_service(); const Service *thermo_service = fake_gatt_g...
const uint8_t num_found_characteristics = gatt_client_service_get_characteristics(service_ref, characteristic_refs, num_characteristics); cl_assert_equal_i(num_characteristics, num_found_characteristics); for (uint8_t c = 0; c < num_found_characteristics; ++c) { BLECharacteri...
ayer->frame.size}; } else { // Legacy 2.x behavior needed for ScrollLayer // Grow the bounds if it doesn't cover the area that the frame is showing. // This is not a necessity, but supposedly a handy thing. const int16_t visible_width = layer->bounds.size.w + layer->bounds.origin.x; const int16_t...
{ break; }
sibling = sibling->next_sibling; } sibling->next_sibling = child; } // Below means higher up in the hierarchy so it gets drawn earlier, // and as a result the one below gets occluded by what's draw on top of it. void layer_insert_below_sibling(Layer *layer_to_insert, Layer *below_layer) { if (below_layer->p...
-80, 344, -632}, { -104, 352, -648}, { -80, 336, -808}, { -32, 384, -912}, { -160, 456, -1080}, { -80, 400, -1184}, { 16, 416, -1136}, { -24, 456, -1168}, { 64, 552, -1120}, { 136, 576, -1048}, { 64, 552, -1016}, { 80, 488, -912}, { 56, 320, -696}, { -80, 272, -640}, ...
{ 16, 296, -1056}, { 40, 456, -1144}, { 96, 536, -1048}, { 72, 424, -960}, { 0, 344, -840}, { -72, 288, -768}, { -112, 224, -776}, { -144, 232, -824}, { -120, 240, -936}, { -192, 208, -984}, { -224, 312, -1168}, { -64, 344, -1208}, // 21 seconds { -200, 504, -1328...
{ 8, 504, -1008}, { -8, 496, -872}, { 56, 376, -720}, { 48, 320, -640}, { -24, 272, -640}, { -40, 264, -752}, { -24, 304, -928}, { 24, 344, -1024}, { -24, 360, -1168}, { 104, 360, -1176}, { 56, 408, -1152}, { 72, 544, -1192}, { 264, 512, -1152}, { 272, 456, -984}...
{-2, 1}); cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 1); cl_assert_equal_i(mfg_info_get_watch_color(), 3); cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); // Make sure we have s...
flash_write_bytes((const uint8_t*) "xxxx", BOOT_FPGA_FLASH_ADDR + HEADER_SIZE, 4)
; // Make sure it's corrupted flash_read_bytes(fpga_buffer, BOOT_FPGA_FLASH_ADDR, sizeof(fpga_buffer)); cl_assert(memcmp(fpga_buffer + HEADER_SIZE, s_boot_fpga, sizeof(s_boot_fpga)) != 0); // Now update it and make sure we healed the corruption mfg_info_update_constant_data(); flash_read_bytes(fpga_buffe...
ion file, creating it if necessary. If space_needed is > 0, then make sure there is // enough space in the file to add 'space_needed' more bytes, compacting, growing, or lopping off // older data in the file if necessary. Returns true if there is enough space and the file was // successfully opened. // If space_needed ...
goto exit; } // Reallocate which removes the consumed bytes from the beginning of the file. if (!prv_realloc_storage(session, file_size)) { goto exit; } // Re-open it now success = prv_open_file(&session->storage, OP_FLAG_WRITE | OP_FLAG_READ, DLS_FILE_INIT_SIZE_BYTES, ses...
// ----------------------------------------------------------------------------------------- static bool prv_write_data(DataLoggingSessionStorage *storage, const void *data, uint32_t remaining_bytes) { const uint8_t *data_ptr = data; // Write out in chunks while (remaining_bytes > 0...
glyph) { return ((glyph->header.width_px * glyph->header.height_px) + (8 - 1)) / 8; } void test_text_resources__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NA...
(text_resources_init_font(0, font_fallback, 0, &s_font_info))
; cl_assert_equal_i(FONT_VERSION(s_font_info.base.md.version), 3); cl_assert_equal_i(s_font_info.base.md.wildcard_codepoint, WILDCARD_CODEPOINT); } void test_text_resources__test_backup_wildcard(void) { const uint8_t wildcard_bytes[] = {0x3f, 0xc6, 0x18, 0x63, 0x8c, 0x31, 0xc6, 0x0f}; uint32_t font_fallback =...
roll_layer) { animation_destroy(property_animation_get_animation(scroll_layer->animation)); content_indicator_destroy_for_scroll_layer(scroll_layer); layer_deinit(&scroll_layer->layer); } void scroll_layer_destroy(ScrollLayer *scroll_layer) { if (scroll_layer == NULL) { return; } scroll_layer_deinit(sc...
prv_scroll_layer_set_content_offset_internal(scroll_layer, offset)
; } } void scroll_layer_set_content_size(ScrollLayer *scroll_layer, GSize size) { GRect bounds = scroll_layer->content_sublayer.bounds; bounds.size = size; layer_set_bounds(&scroll_layer->content_sublayer, &bounds); // Ensure our content offset is clipped to the new size. // We call prv_scroll_layer_set_co...
/* * 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...
graphics_context_set_fill_color(ctx, GColorWhite)
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License...
(&app[sizeof(s_message_header)], s_message_buffer, s_message_length)
; crc = crc32(CRC32_INIT, raw_packet, raw_length - sizeof(crc)); memcpy(&raw_packet[raw_length - sizeof(crc)], &crc, sizeof(crc)); unsigned char cooked_packet[MAX_SIZE_AFTER_COBS_ENCODING(raw_length)]; size_t cooked_length = cobs_encode(cooked_packet, raw_packet, raw_length); prv_putchar(FRAME_DELIMITER); ...
er(source, menu_node, source->order_storage ?: app_order_read_order(), (source->order_storage == NULL)); // If we're adding the Settings app node to the list and it hasn't received a storage order, // then give it its default order if ((menu_node->install_id == APP_ID_SETTINGS) && (...
{ // Changed and still excluded: return; }
// Changed and is now excluded: prv_unload_node(source, node); } else { // Changed and is now included: if (node == NULL) { add_app_with_install_id(&entry, source); } } prv_alert_data_source_changed(source); } static void prv_app_icon_name_updated_callback(const AppInstallId install_id...
MusicAppData *data) { // Animation structure: // - Master animation // - Cassette animation // - Move to left // - Move in from right // - Bounceback // - Upwards animation // - Per-layer animations // - (flip text) // - Bounceback animation // - Per-layer animations ...
{ action_bar_layer_set_icon_animated(&data->action_bar, BUTTON_ID_SELECT, &data->icon_ellipsis, animated); }
} static void prv_update_ui_state_volume(MusicAppData *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_anim...
/* * 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...
regular_timer_add_multisecond_callback(&s_pairability_timer_info, duration_secs)
; } void bt_pairability_release(void) { PBL_ASSERT(s_allow_bt_pairing_refcount != 0 && s_allow_ble_pairing_refcount != 0, ""); --s_allow_bt_pairing_refcount; --s_allow_ble_pairing_refcount; prv_schedule_evaluation(); } void bt_pairability_release_bt(void) { PBL_ASSERT(s_allow_bt_pairing_refcount != 0, ""); ...
Fakes /////////////////////////////////////////////////////////// #include "fake_events.h" #include "fake_rtc.h" #include "fake_session.h" #include "fake_system_task.h" #include "stubs_app_manager.h" #include "stubs_app_install_manager.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_bt_loc...
{ cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT); }
} static void prv_receive_and_assert_all(bool expect_is_handled) { prv_receive_and_assert_now_playing(expect_is_handled); prv_receive_and_assert_play_state(expect_is_handled); prv_receive_and_assert_volume_info(expect_is_handled); prv_receive_and_assert_player_info(expect_is_handled); } static const MusicSe...
PBL_ASSERTN(s_window_timeouts_ms[DEFAULT_IDX] == NOTIF_WINDOW_TIMEOUT_DEFAULT)
; const uint32_t timeout_ms = alerts_preferences_get_notification_window_timeout_ms(); for (size_t i = 0; i < ARRAY_LENGTH(s_window_timeouts_ms); i++) { if (s_window_timeouts_ms[i] == timeout_ms) { return i; } } // Should never happen (only should happen if we remove a timeout and don't migrate t...
_lock_with_timeout(s_mutex, portMAX_DELAY); const bool alarm_is_scheduled = s_next_alarm_time != 0; if (alarm_is_scheduled && next_alarm_time_out) { *next_alarm_time_out = prv_get_alarm_time(&s_next_alarm, s_next_alarm_time); } mutex_unlock(s_mutex); return alarm_is_scheduled; } // ------------------...
{ return true; // continue iterating }
ffer, pc_str, lr_str); PBL_LOG(LOG_LEVEL_ERROR, "%s fault! %s", process_string, buffer); PBL_LOG(LOG_LEVEL_ERROR, " --> PC: %s LR: %s", pc_str, lr_str); analytics_event_app_crash(&crash_info->app_uuid, (crash_info->pc_known) ? crash_info->pc : 0, (crash_in...
(prv_log_app_lr_and_pc_system_task, &s_current_app_crash_info)
; prv_kill_user_process(stashed_lr); for (;;) {} // Not Reached } static void hardware_fault_landing_zone(void) { prv_log_app_lr_and_pc_system_task(&s_current_app_crash_info); prv_kill_user_process(0); } static void prv_return_to_landing_zone(uintptr_t stacked_pc, uintptr_t stacked_lr, unsigned int* stacked...
ense, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed...
menu_layer_deinit(&data->menu_layer)
*)data; AppInstallId app_id = app_install_get_id_for_uuid(app_uuid); if (app_id == INSTALL_ID_INVALID) { PBL_LOG(LOG_LEVEL_DEBUG, "Attempting to launch an invalid app"); return false; } app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = app_id, .common.reason = APP...
if (request->write_mbuf && request->read_mbuf) { type = GenericServiceTypeWriteRead; } else if (request->write_mbuf) { type = GenericServiceTypeWrite; } else if (request->read_mbuf) { type = GenericServiceTypeRead; } else { type = GenericServiceTypeRead; // stop lint from complaining WTF; }
return prv_do_send(type, request->service_id, request->attribute_id, request->write_mbuf, request->read_mbuf, request->timeout_ms); } static bool prv_send_control(void) { // make sure we're not spamming the smartstrap with service discovery messages static time_t s_last_service_discovery_ti...
equal_i(s_hrm_expiration, 0); prv_inc_time(1 * SECONDS_PER_MINUTE); cl_assert(workout_service_start_workout(ActivitySessionType_Run)); // Workout of 30 seconds duration. Should be invalid, not keep HR on after leaving prv_inc_time(30); cl_assert(workout_service_stop_workout()); workout_service_frontend_cl...
workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)
); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 10); prv_inc_time(10); prv_put_bpm_event(ZONE_0_HR, HRMQuality_Good); cl_assert(workout_service_...
cl_assert(pfs_remove(file_name) == S_SUCCESS); } cl_assert(pfs_active_in_region(0, pfs_get_size())); // continuation page on region and make sure pfs is active pfs_format(true); int fd = pfs_open("testfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, 68000); cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCE...
cl_assert(fd >= 0)
; cl_assert(pfs_close(fd) == S_SUCCESS); } } static uint32_t s_watch_file_callback_called_count = 0; static void prv_file_changed_callback(void *data) { s_watch_file_callback_called_count++; } void test_pfs__watch_file_callbacks(void) { const char* file_name = "newfile"; PFSCallbackHandle cb_handle = pfs...
/* * 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, &s_ctx)
; return window; } // Tests ////////////////////// void test_health_hr_detail_card__render_no_data(void) { prv_create_card_and_render(&(HealthData) {}); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_hr_detail_card__render_zones(void) { HealthData health_data = { .hr_zone...
); cl_assert(child_c.next_sibling == &child_a); cl_assert(child_a.next_sibling == NULL); } void test_layer__insert_above(void) { Layer parent, child_a, child_b, child_c; Layer *layers[] = {&parent, &child_a, &child_b, &child_c}; for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRec...
__layer_tree_traverse_next__test_accessor(stack, 3, &current_stack, true)
; cl_assert_equal_p(ab, actual); cl_assert_equal_i(1, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(ab, stack[1]); // not necessary to free memory on unit tests } void test_layer__is_ancestor(void) { Layer parent, child_a, child_b, child_c; Layer *layers[] = {&parent, &child_a, &chil...
PIO_MODER_MODER0) != GPIO_Mode_AN) { pin_cfg_mask |= (0x1 << pin); } mode >>= 2; } dbgserial_putstr_fmt(buf, sizeof(buf), "Non Analog P%s cfg: 0x%"PRIx16, name, (int)pin_cfg_mask); name[0]++; } } #endif /* DUMP_GPIO_CFG_STATE */ int main(void) { gpio_init_all(); #if defined(...
voltage_monitor_init()
; battery_init(); vibe_init(); #if CAPABILITY_HAS_ACCESSORY_CONNECTOR accessory_init(); #endif flash_init(); flash_sleep_when_idle(true); flash_enable_write_protection(); flash_prf_set_protection(true); #if CAPABILITY_HAS_PMIC pmic_init(); #endif // CAPABILITY_HAS_PMIC #if CAPABILITY_HAS_MICROPHONE...
/* * 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...
{ result->cache = applib_type_zalloc(HealthServiceCache); }
return result; } // ---------------------------------------------------------------------------------------------- static void prv_health_service_deinit_cache(HealthServiceState *state) { if (state) { applib_free(state->cache); state->cache = NULL; } } // ----------------------------------------------...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ gpio_output_init(&BOARD_CONFIG.lcd_com, GPIO_OType_PP, GPIO_Speed_50MHz); }
bool prv_check_serial_log_enabled(int level) { return (g_pbl_log_enabled) && (level == LOG_LEVEL_ALWAYS || (level <= g_pbl_log_level)); } #if !PULSE_EVERYWHERE #define TIMESTAMP_BUFFER_SIZE 14 static void prv_log_timestamp(void) { // Enough stack space to use sprintfs? uint32_t stack_space = ...
(buffer, buffer_size, fmt, ap)
unlikely to be something people want, but it currently works // just fine, and is actually a fairly well-defined operation (after all, // keys & values are just binary data, so the zero-length key is just as // unique a key as any other). set_and_verify(&file, key, 0, val, val_len); } static bool prv_each_cb(...
settings_file_set_byte(&file, key, key_len, 3, 0x40)
/* * 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...
(0b10100101)
== 0b10100101); } // Each of the following tests depend on a PNG being converted into 1-bit PBI, // as well as loading in a b&w PNG, which internally will be converted to a // 1-bit palettized image. // The palettized PNG loaded in is to be used as the expected value #define TEST_1BIT_FILE TEST_PBI_FILE_FMT(1bit) #d...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_get_point_between_points(segment->points[3], segment->points[2], end)
; p4 = prv_get_point_between_points(segment->points[0], segment->points[1], end); } else { p1 = segment->points[0]; p2 = segment->points[1]; p3 = segment->points[2]; p4 = segment->points[3]; } GPathBuilder *builder = gpath_builder_create(5); gpath_builder_move_to_point(builder, p1); gpath...
/* * 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 (connection->gatt_service_changed_att_handle != att_handle) { return false; } if (value_length != sizeof(ATTHandleRange)) { PBL_LOG(LOG_LEVEL_ERROR, "Service Changed Indication incorrect length: %u", value_length); // Pretend we ate the indication. There will be no GAPLECharacteristic in the sy...
/* * 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...
(page.origin, origin)
; cl_assert_equal_gsize(page.size, GSize(text_layer.layer.frame.size.w, TEXT_LAYER_FLOW_DEFAULT_PAGING_HEIGHT)); } void test_text_layer_flow__paging_container(void) { Layer container; layer_init(&container, &GRect(30, 40, 100, 10)); layer_add_child(&window.layer, &contai...
sf, 0xe = PWM uint8_t val = (1 << 4) | 0x0e; success = prv_write_register(PmicRegisters_GPIO2_CNTL, val); } PBL_ASSERT(success, "Failed to start PMIC 120Hz PWM"); } static void prv_configure_charging(void) { // Set charge control to low current range, constant current ctl to 118mA. bool success = false...
(PmicRegisters_INT_MASK_1, int_mask)
; prv_write_register(PmicRegisters_INT_MASK_2, 0xff); // Clear interrupt status so we're not woken immediately (read the regs) prv_clear_pending_interrupts(); // Set Reg_Standby_mod1 to specify which rails to turn off / keep on // - SD1, LDO1 off // - LDO2 on // - Disable regulator pulldowns 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...
if (!s_app_event_pending) { e.callback.data = (void *)app_state_get_animation_state(); s_app_event_pending = process_manager_send_event_to_process(task, &e); }
break; default: PBL_CROAK("Invalid task %s", pebble_task_get_name(pebble_task_get_current())); } } // ------------------------------------------------------------------------------------------ DEFINE_SYSCALL(void, animation_service_timer_event_received, void) { PebbleTask task = pebble_task_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...
__atomic_clear(&s_cb_scheduled, __ATOMIC_RELAXED)
; prv_update_status(); } static void prv_update_status_async(void) { if (__atomic_test_and_set(&s_cb_scheduled, __ATOMIC_RELAXED)) { return; // we already have a cb scheduled } system_task_add_callback(prv_update_status_system_task_callback, NULL); } static void prv_new_timer_callback(void *unused) { p...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(result, 362)
; } static void *s_context = NULL; static bool prv_filter(int index, int32_t value, void *context) { cl_assert_equal_p(context, &s_context); return (value > 0); } void test_stats__filtered_count(void) { const int32_t data[] = { 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0 }; const size_t num...
/* * 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...
(AnalyticsEvent_AppLaunch, uuid)
e called from the KernelMain task) PBL_ASSERT_TASK(PebbleTask_KernelMain); app_manager_close_current_app(true /* gracefully */); #endif } // ----------------------------------------------------------------------------------------- // List of incoming message handlers static const QemuMessageHandler s_qemu_endpoin...
{ PBL_LOG(LOG_LEVEL_ERROR, "ISR buf too small 0x%x", byte); s_qemu_state.recv_error_count++; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(NULL == bmp)
gnizerState_Possible); cl_assert_equal_b(reset, true); cl_assert_equal_b(cancelled, false); reset = false; r->state = RecognizerState_Cancelled; recognizer_reset(r); cl_assert_equal_i(r->state, RecognizerState_Possible); cl_assert_equal_b(reset, true); cl_assert_equal_b(cancelled, false); reset = fa...
(r, &(TouchEvent) { .type = TouchEvent_Liftoff })
; cl_assert_equal_i(last_touch_event.type, TouchEvent_Liftoff); cl_assert_equal_b(updated, true); cl_assert_equal_i(rec_event, RecognizerEvent_Cancelled); // Should not pass touch events to recognizers that are not active cl_assert_passert(recognizer_handle_touch_event(r, &(TouchEvent) {})); // Should not...
static void prv_configure_system_flash(void) { // Enable flash instruction and data caches FLASH->ACR = FLASH_ACR_ICEN | FLASH_ACR_DCEN; } // RTC and bootbit assume access to the backup // registers has been enabled static void prv_enable_backup_access() { RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); PW...
{ dbgserial_putstr("Force-booting recovery mode..."); }
if (force_boot_recovery_mode || prv_check_for_fw_start_failure()) { if (!switch_to_recovery_fw()) { // We've failed to load recovery mode too many times. prv_sad_watch(ERROR_CANT_LOAD_FW); } } else { check_update_fw(); } if (prv_check_and_increment_reset_loop_detection_bits()) { p...
timer_id, LIGHT_FADE_TIME_MS / LIGHT_FADE_STEPS, light_timer_callback, NULL, 0 /* flags */); } break; case LIGHT_STATE_OFF: new_brightness = BACKLIGHT_BRIGHTNESS_OFF; new_timer_stop(s_timer_id); break; } if (s_current_brightness != new_brightness) { prv_change_brightness(new_b...
{ mutex_lock(s_mutex); backlight_set_enabled(!backlight_is_enabled()); if (prv_light_allowed()) { prv_change_state(LIGHT_STATE_ON_TIMED); } else { prv_change_state(LIGHT_STATE_OFF); } mutex_unlock(s_mutex); }
void light_toggle_ambient_sensor_enabled(void) { mutex_lock(s_mutex); backlight_set_ambient_sensor_enabled(!backlight_is_ambient_sensor_enabled()); if (prv_light_allowed() && !ambient_light_is_light()) { prv_change_state(LIGHT_STATE_ON_TIMED); } else { prv_change_state(LIGHT_STATE_OFF); // FIXME: ...
/* * 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, "Writing boot FPGA bitstream to flash...")
; mfg_info_write_boot_fpga_bitstream(); } }
ocaleDateString" #define ROCKY_DATE_TOLOCALESTRING "toLocaleString" #define ROCKY_DATE_FORMAT_NUMERIC "numeric" #define ROCKY_DATE_FORMAT_2DIGIT "2-digit" #define ROCKY_DATE_FORMAT_SHORT "short" #define ROCKY_DATE_FORMAT_LONG "long" #define BUFFER_LEN_DATE 40 #define BUFFER_LEN_TIME 20 // 2 = strlen(", ") #define BUFF...
{ *is_24h_style = !jerry_get_boolean_value(hour12); }
struct { const jerry_value_t field; const char *value; ToStringFormat format; } option_values[] = { {.field = second, .value = ROCKY_DATE_FORMAT_NUMERIC, .format = ToStringFormatSecondNumeric}, {.field = second, .value = ROCKY_DATE_FORMAT_2DIGIT, .format = ToStringFormatSecond2Digit}, {.fi...
(&window->layer, &data->topleft_layer.layer)
; const GRect menu_layer_rect = GRect(navbar_width, 0, full_rect->size.w - navbar_width, full_rect->size.h); menu_layer_init(&data->action_list1, &menu_layer_rect); menu_layer_set_callbacks(&data->action_list1, NULL, &(MenuLayerCallbacks){ .get_num_rows = prv_get_num_rows, .draw_row = prv_draw_...
/* * 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...
{ *tloc = t_s; }
return (t_ms); } uint16_t pbl_override_time_ms_legacy(time_t *tloc, uint16_t *out_ms) { uint16_t t_ms; time_t t_s; sys_get_time_ms(&t_s, &t_ms); time_t legacy_time = sys_time_utc_to_local(t_s); if (out_ms) { *out_ms = t_ms; } if (tloc) { *tloc = legacy_time; } return (t_ms); } extern siz...
/* * 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(DICT_OK == dict_serialize_tuplets_to_buffer( &tuplet, 1, (uint8_t *)&push_message->dictionary, &size))
conds { 8, 200, -888}, { 48, 128, -856}, { 80, 120, -824}, { 56, 96, -864}, { 32, 56, -832}, { -8, 24, -888}, { 0, 0, -896}, { 8, -40, -864}, { 8, 56, -888}, { 16, 40, -792}, { -120, 408, -1016}, { 16, 424, -784}, { -352, 648, -640}, { -368, 968, -352}, { -368...
{ -1000, 296, -320}, { -1032, 72, -240}, { -1616, 616, -576}, { -1376, -40, -56}, { -1120, 120, -184}, { -1064, 16, -48}, { -792, -136, 120}, { -496, 120, -88}, { -640, 128, 32}, { -816, 128, 0}, { -912, 216, -72}, { -872, 672, -472}, { -1312, 40, -48}, // 8 secon...
{ -1664, 216, -120}, { -680, 424, -568}, { -1112, 280, -296}, { -992, -40, -56}, { -648, 56, -128}, { -400, 48, -192}, { -312, 56, -128}, { -432, 232, -280}, { -656, 488, -312}, { -1264, 664, -456}, { -1112, 568, -512}, { -1288, 184, -144}, { -2240, 736, -432}, {...
40}, { -720, 496, 448}, { -712, 496, 448}, { -712, 504, 440}, { -720, 496, 448}, { -712, 504, 432}, { -712, 496, 432}, { -720, 496, 440}, { -720, 488, 440}, { -712, 496, 440}, { -720, 496, 448}, { -712, 504, 448}, { -720, 504, 448}, { -712, 504, 448}, { -720, 496,...
{ -712, 496, 448}, { -704, 512, 456}, { -712, 496, 432}, { -712, 512, 432}, { -704, 504, 448}, { -712, 504, 456}, { -704, 504, 440}, // 161 seconds { -712, 504, 456}, { -704, 504, 456}, { -712, 504, 440}, { -704, 504, 448}, { -712, 504, 448}, { -712, 496, 448}, ...
{ -712, 496, 456}, { -704, 488, 456}, { -712, 472, 448}, { -720, 512, 472}, { -704, 496, 456}, { -720, 496, 440}, { -696, 520, 456}, { -720, 504, 456}, { -696, 504, 424}, { -720, 496, 448}, { -704, 496, 448}, { -720, 512, 456}, { -704, 488, 432}, { -720, 504, 448...
X_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_odd_clip"))); } void test_graphics_draw_line___odd_offset_horizontal_dotted(void) { GContext ctx; test_g...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_odd_clip")))
; } void test_graphics_draw_line___origin_vertical_dotted(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test odd and even cols draw appropriately setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 6), 10); gr...
= window->bitmap.bounds.size; const GRect NO_MUSIC_IMAGE_RECT = GRect(config->no_music_img_pos.x, config->no_music_img_pos.y, NO_MUSIC_IMAGE_SIZE.w, NO_MUSIC_IMAGE_SIZE.h); bitmap_layer_init(&window->bitmap_layer, &NO_MUSIC_IMAGE_RE...
app_state_get_user_data()
; music_get_pos(&data->track_pos, &data->track_length); prv_update_track_progress(data); } static void prv_handle_tick_time(struct tm *time, TimeUnits units_changed) { if (music_get_playback_state() == MusicPlayStatePlaying) { prv_update_pos(); } } static void prv_set_pos_update_timer(MusicAppData* data, ...
buted 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 "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/voltage_monitor.h" #include ...
(ADC1, DISABLE)
/* * 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 ((SettingsOptionMenuData *)context)->num_rows; }
/* * 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...
{ glance->handlers = *handlers; }
launcher_app_glance_update_current_slice(glance); } void launcher_app_glance_update_current_slice(LauncherAppGlance *glance) { if (!glance || !glance->should_consider_slices) { return; } const Uuid *uuid = &glance->uuid; AppGlanceSliceInternal current_slice = {}; // If there's no current slice, thi...
/* * 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...
(l, t += dt)
; gdraw_command_image_draw(&ctx, l, GPoint(48, 48)); l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoint(0, 96)); l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_d...
oving our power at any time now. while(1); __builtin_unreachable(); } return false; } static bool prv_set_mon_config_register(uint8_t value) { return prv_write_register(PmicRegisters_MON_CFG, value); } static bool prv_set_mon_config(const PmicMonConfig *config) { const uint8_t ratio_config = 4 - con...
prv_update_rail_state(PmicRail_LDO3, enabled)
; i2c_release(I2C_DEVICE_MAX14690); } void set_4V5_power_state(bool enabled) { gpio_use(GPIOF); GPIO_WriteBit(GPIOF, GPIO_Pin_2, enabled?Bit_SET:Bit_RESET); gpio_release(GPIOF); } void set_6V6_power_state(bool enabled) { gpio_use(GPIOF); GPIO_WriteBit(GPIOF, GPIO_Pin_3, enabled?Bit_SET:Bit_RESET); gpio_...
(GContext* ctx, GPoint p, uint16_t radius, GCornerMask quadrant) { // Radius cannot be smaller than 1 PBL_ASSERTN(radius > 0); prv_fill_oval_quadrant(ctx, p, radius, radius, 0, 0, quadrant); } #endif // PBL_COLOR // Returns x for f(x) = g(x) with f(x)=y an...
((Fixed_S16_3){.raw_value = (center.y.raw_value + y.raw_value)}, top, bottom)
/* * 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...
memcpy(s_last_permitted_devices, permitted_devices, sizeof(*permitted_devices) * num_permitted_devices)
; } static BLEHRMSharingRequest *s_last_sharing_request; static int s_ble_hrm_push_sharing_request_window_call_count; void ble_hrm_push_sharing_request_window(BLEHRMSharingRequest *sharing_request) { ++s_ble_hrm_push_sharing_request_window_call_count; cl_assert_equal_p(s_last_sharing_request, NULL); s_last_shari...
" #include "applib/preferred_content_size.h" #include "applib/ui/ui.h" #include "apps/system_apps/timeline/text_node.h" #include "drivers/rtc.h" #include "font_resource_keys.auto.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "services/common/clock.h" #include "services/common...
PBL_IF_RECT_ELSE(2, 0)
, /* medium */ PBL_IF_RECT_ELSE(2, 0), /* large */ 1, //! @note this is the same as Large until ExtraLarge is designed /* extralarge */ 1), // title margin height }; static const LayoutNodeTextAttributeConfig s_subtitle_config = { .attr_id = AttributeIdSubtitle, .text.font_key = PREF...
/* * 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...
{ f->dirty_rect = grect_union(&f->dirty_rect, &rect); }
const GRect clip_rect = (GRect) { GPointZero, f->size }; grect_clip(&f->dirty_rect, &clip_rect); f->is_dirty = true; }
app_db_init(); app_db_flush(); app_cache_init(); app_cache_flush(); tictoc_id = app_install_get_id_for_uuid(&tictoc_uuid); music_id = app_install_get_id_for_uuid(&music_uuid); sports_id = app_install_get_id_for_uuid(&sports_uuid); cl_assert_equal_i(-69, tictoc_id); cl_assert_equal_i(-3, music_id);...
cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &uuid_entry))
; } void test_app_install_manager__is_watchface_via_install_id(void) { cl_assert_equal_b(true, app_install_is_watchface(tictoc_id)); cl_assert_equal_b(false, app_install_is_watchface(music_id)); cl_assert_equal_b(false, app_install_is_watchface(sports_id)); cl_assert_equal_b(false, app_install_is_watchface(bg...
date->value_str, value_length); } static void prv_handle_track_duration_update(const AMSEntityUpdateNotification *update, const uint16_t value_length) { int32_t duration_ms = 0; // Default to 0 in case value_length is 0 const bool success = (!value_length || ...
PBL_ASSERTN(characteristics)