prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
uble close an fd cl_assert(rv == E_INVALID_ARGUMENT); } void test_pfs__remove(void) { cl_assert(pfs_remove(NULL) == E_INVALID_ARGUMENT); char *fname = "abc"; int fd = pfs_open(fname, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10 * 1024); cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); cl_assert(pfs_rem...
pfs_format(true)
; cl_assert(pfs_active_in_region(0, pfs_get_size())); // write something on every page and make sure pfs is active char file_name[10]; for (int i = 0; i < num_pages(); i++) { snprintf(file_name, sizeof(file_name), "file%d", i); int fd = pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_a...
_rect_origin_r4_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_clip_nxny.${BIT_DEPT...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3)
; graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 3); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_REC...
st ActionMenuItem *item, void *context) { NotificationWindowData *data = &s_notification_window_data; data->action_menu = NULL; } static void prv_select_single_click_handler(ClickRecognizerRef recognizer, void *data) { NotificationWindowData *window_data = data; TimelineI...
{ NotificationWindowData *data = window_get_user_data(window); if (!data) { return; } vibes_cancel(); prv_cleanup_timers(data); // clean up peek layer if (data->peek_layer) { peek_layer_destroy(data->peek_layer); data->peek_layer = NULL; } animation_unschedule(data->peek_animation); s...
////////////////////// // Callback Handlers ////////////////////// static void prv_layout_did_appear_handler(SwapLayer *swap_layer, LayoutLayer *layout, int8_t rel_change, void *context) { NotificationWindowData *data = context; TimelineItem *n = layout_get_context(layou...
)); cl_assert(uuid_equal(&state.node->id, &multiday_item.header.id)); cl_assert(!state.node->all_day); cl_assert_equal_i(state.node->timestamp, 1425312000); cl_assert_equal_i(state.node->duration, 16 * 60); cl_assert_equal_i(state.current_day, midnight_march_2_pst); // day 2 cl_assert(iter_next(&iterator...
cl_assert(uuid_equal(&state.pin.header.id, &all_day_item.header.id))
ion_get_system_session(); comm_session_set_responsiveness( comm_session, BtConsumerPpAudioEndpoint, ResponseTimeMax, 0); } s_session.id = AUDIO_ENDPOINT_SESSION_INVALID_ID; s_session.setup_completed = NULL; s_session.stop_transfer = NULL; bt_unlock(); if (s_dropped_frames > 0) { PBL_LOG(LO...
PBL_ASSERTN(session_id != AUDIO_ENDPOINT_SESSION_INVALID_ID)
; if (s_session.id != session_id) { return; } prv_session_deinit(false /* call_stop_handler */); } void audio_endpoint_stop_transfer(AudioEndpointSessionId session_id) { PBL_ASSERTN(session_id != AUDIO_ENDPOINT_SESSION_INVALID_ID); if (s_session.id != session_id) { return; } StopTransferMsg m...
, .s8 = -128.0, .s16 = -32768.0, .s32 = -2147483648.0, .s64 = -9223372036854775808.0, .d = 2.2250738585072014e-308, .expected_error_msg = NULL, }, [WithinUpperBounds] = { .u8 = 255.0, .u16 = 65535.0, .u32 = 4294967295.0, .u64 = 9223372036854775807.0, ...
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 prv_dummy(const jerry_value_t function_obj_p, const jerry_value_t this_val, const jerry_value_t args_p[], const jerry_length_t args_co...
system. This is the sum of the // file sizes of all the DLS files. static uint32_t prv_get_total_file_system_bytes(void) { uint32_t size = 0; dls_list_for_each_session(prv_accumulate_size_cb, &size); PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Total used space: %d", (int)size); return size; } // ---...
(session->storage.fd != DLS_INVALID_FILE)
; status_t status = pfs_close(session->storage.fd); if (status != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Error %d closing file for session %d", (int)status, session->comm.session_id); } session->storage.fd = DLS_INVALID_FILE; } // --------------------------------------------------------------...
*icon; bool icon_is_default; } LoadedNotificationNode; typedef struct NotificationNode { ListNode node; Uuid id; } NotificationNode; typedef struct NotificationsData { Window window; MenuLayer menu_layer; TextLayer text_layer; NotificationNode *notification_list; LoadedNotificationNode *loaded_notifi...
if (list_count((ListNode*) *loaded_list) > MAX_ACTIVE_NOTIFICATIONS) { LoadedNotificationNode *old_node = (LoadedNotificationNode*) list_get_tail( (ListNode*) *loaded_list); list_remove((ListNode*) old_node, (ListNode**) loaded_list, NULL); prv_unload_loaded_notification(old_node); }
>fd, (uint8_t*)&iter_state->header, sizeof(iter_state->header)); // Restore flags & status iter_state->header.common.flags = ~iter_state->header.common.flags; iter_state->header.common.status = ~iter_state->header.common.status; if ((result == E_RANGE) || (uuid_is_invalid(&iter_state->header.common.id))) { ...
(read_buffer)
; } return found; } bool notification_storage_find_ancs_notification_by_timestamp( TimelineItem *notification, CommonTimelineItemHeader *header_out) { PBL_ASSERTN(s_notif_storage_mutex && notification && header_out); int fd = prv_file_open(OP_FLAG_READ); if (fd < 0) { return false; } //Seriali...
/* * 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...
accel_double_tap_service_subscribe(prv_handle_tap)
* SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("16:00", time_buf); // June 8th 2015, 16:00:00 (T-48:00:00) rtc_set_time(event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, size...
rtc_set_time(jun10th_noon_2015)
; // Our test event is at June 9th 2015, 16:00:00 // Now - one day const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY + (4 * SECONDS_PER_HOUR); // if the event is within 24 hours, then show the actual time instead of "X hours ago" const int MAX_RELATIVE_HRS = 13; clock_set_24h_style(true); // J...
rning permissions and * limitations under the License. */ #include "drivers/display/ice40lp/ice40lp_internal.h" #include "board/board.h" #include "debug/power_tracking.h" #include "drivers/display/ice40lp/ice40lp_definitions.h" #include "drivers/periph_config.h" #include "drivers/gpio.h" #include "drivers/spi.h" #i...
spi_ll_slave_release(ICE40LP->spi_port)
; // PBL-19516 #if !defined(TARGET_QEMU) prv_wait_programmed(); if (!gpio_input_read(&ICE40LP->cdone)) { PBL_LOG(LOG_LEVEL_ERROR, "CDONE not high after programming"); return false; } #endif return true; } void display_program(const uint8_t *fpga_bitstream, uint32_t bitstream_size) { periph_config_...
if (0 == memcmp(&nil_key, &data.keys[key_type], sizeof(nil_key))) { rv = false; goto unlock; } if (key_out) { memcpy(key_out, &data.keys[key_type], sizeof(*key_out)); } rv = true; } unlock: prv_unlock(); return rv; } void shared_prf_storage_set_root_keys(SM128BitKey *keys...
(pairing_info->is_remote_identity_info_valid, SprfValidFields_RemoteIdentityInfoValid)
/* * 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...
{ case '+': sign = 1; nptr++; break; case '-': sign = -1; nptr++; break; }
if (nptr[0] == '0' && nptr[1] == 'x' && (base == 0 || base == 16)) { base = 16; nptr += 2; } else if (nptr[0] == '0' && (base == 0 || base == 8)) { base = 8; nptr++; } else if (base == 0) { base = 10; } // We break on '\0' anyways for (;;) { char ch = *nptr; if (ch >= '0' && ch ...
not constant static GDrawState prev_state; prev_state = ctx->draw_state; gpoint_add_eq(&ctx->draw_state.drawing_box.origin, s_animation_state.modal_offset); modal_manager_render(ctx); ctx->draw_state = prev_state; } // Compositor implementation /////////////////////////////////////////////////////////// ...
if ((s_state == CompositorState_AppTransitionPending) && (modal_manager_get_properties() & ModalProperty_Transparent)) { // Don't render if modals are transparent while the app is not ready yet return; }
if (s_state == CompositorState_Modal) { compositor_render_modal(); prv_compositor_flush(); } else if (s_state == CompositorState_AppAndModal) { prv_send_app_render_request(); } } void compositor_transition_render(CompositorTransitionUpdateFunc func, Animation *animation, ...
/* * 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_get_user_data(window)
; if (!data) { // Sanity check return; } kino_layer_deinit(&data->kino_layer); app_timer_cancel(data->timer); app_free(data); } static void prv_window_load_handler(Window* window) { LowPowerAppData *data = window_get_user_data(window); data->discharging_kino_area = GRect(PBL_IF_RECT_ELSE(4, 5),...
eZero; GSize to = GSize(20, 40); GPoint point = GPoint(10, 10); GPoint result = GPointZero; result = gpoint_scale_by_gsize(point, from, to); cl_assert_equal_i(result.x, 0); cl_assert_equal_i(result.y, 0); } void test_gtypes__gpoint_scale_by_gsize_to_zero(void) { GSize from = GSize(10, 20); GSize to = ...
PBL_IF_BW_ELSE(1,2)
); #elif defined(PLATFORM_SPALDING) cl_assert_equal_i(2, PBL_IF_BW_ELSE(1,2)); #else #error "unknown platform" #endif } void test_gtypes__pbl_if_color_else(void) { #if defined(PLATFORM_TINTIN) cl_assert_equal_i(2, PBL_IF_COLOR_ELSE(1,2)); #elif defined(PLATFORM_SNOWY) cl_assert_equal_i(1, PBL_IF_COLOR_ELSE(1,2))...
-744}, { -656, 336, -712}, { -640, 328, -736}, { -680, 312, -632}, { -680, 432, -504}, { -672, 416, -664}, { -736, 400, -600}, { -648, 456, -632}, { -648, 544, -496}, { -688, 592, -320}, { -696, 640, -168}, { -704, 688, -56}, { -720, 736, -72}, { -648, 752, -168}, ...
{ -720, 136, -696}, { -728, 8, -752}, { -720, 160, -736}, { -776, 160, -608}, { -800, 264, -576}, { -728, -40, -688}, { -768, 280, -720}, { -800, 160, -576}, { -752, 280, -632}, { -784, 296, -456}, { -768, 400, -512}, { -776, 408, -496}, { -784, 664, -384}, { -728...
{ -752, 632, -248}, { -736, 880, -256}, { -696, 616, -152}, { -712, 552, -80}, { -704, 712, -64}, { -736, 776, -224}, { -696, 528, -272}, { -704, 576, -304}, { -680, 624, -424}, { -696, 664, -320}, { -712, 656, -224}, { -664, 632, -288}, { -696, 640, -304}, { -72...
gatt_service_changed_server_handle_fw_update(); reason_string = "%s%sSoftwareUpdate"; break; case RebootReasonCode_ResetButtonsHeld: // Since we forced the reset, it isn't unexpected show_reset_alert = false; reason_string = "%s%sResetButtonsHeld"; break; case RebootReasonCode_ShutdownMe...
(LOG_LEVEL_INFO, "MCU reset reason mask: 0x%x", (int)mcu_reboot_reason.reset_mask)
EALTH_TRACKING #define PREF_KEY_ACTIVITY_PREFERENCES "activityPreferences" static ActivitySettings s_activity_preferences = ACTIVITY_DEFAULT_PREFERENCES; #define PREF_KEY_ACTIVITY_ACTIVATED_TIMESTAMP "activityActivated" static time_t s_activity_activation_timestamp = 0; #define PREF_KEY_ACTIVITY_ACTIVATION_DELAY_INSI...
if (*intensity > BACKLIGHT_BRIGHTNESS_OFF) { s_backlight_intensity = *intensity; return true; }
s_backlight_intensity = prv_convert_backlight_percent_to_intensity(BOARD_CONFIG.backlight_on_percent); return false; } static bool prv_set_s_backlight_motion_enabled(bool *enabled) { s_backlight_motion_enabled = *enabled; return true; } static bool prv_set_s_stationary_mode_enabled(bool *enabled) { s_s...
r, NULL); window_set_click_context(BUTTON_ID_SELECT, data); } /////////////////// // Window callbacks static void prv_window_load(Window *window) { SwapLayerDemoData *data = app_state_get_user_data(); Layer *root = window_get_root_layer(window); data->idx = 0; // configure scroll layer SwapLayer *swap_l...
{ static const PebbleProcessMdSystem s_app_info = { .common = { .main_func = s_main, // UUID: 12a32d95-ef69-46d4-a0b9-854cc62f97f9 .uuid = {0x12, 0xa3, 0x2d, 0x95, 0xef, 0x69, 0x46, 0xd4, 0xa0, 0xb9, 0x85, 0x4c, 0xc6, 0x2f, 0x97, 0xf9}, }, .name = "SwapLayer Demo", }; ...
nclude "stubs_task_watchdog.h" #define CONTACT_1_UUID 0x0a, 0x04, 0x98, 0x00, 0x39, 0x18, 0x47, 0xaa, 0x9c, 0x16, 0x8e, 0xa0, 0xa8, 0x2a, 0x2e, 0xb8 #define ADDRESS_1_UUID 0xd3, 0x72, 0x2d, 0x75, 0x6b, 0x21, 0x49, 0x2a, 0x9c, 0xc7, 0x5f, 0xf8, 0x4d, 0xd2, 0x5a, 0x9c #define ADDRESS_2_UUID 0x43, 0x03, 0x91, 0x06, 0x8...
((Uuid *)&contact, &serialized_contact)
; cl_assert_equal_i(serialized_contact->flags, 0); cl_assert_equal_i(serialized_contact->num_attributes, 1); cl_assert_equal_i(serialized_contact->num_addresses, 2); contacts_db_free_serialized_contact(serialized_contact); }
S OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "grenade_launcher.h" #include "applib/app.h" #include "applib/fonts/fonts.h" #include "applib/ui/ui.h" #include "applib/ui/window.h" #include "a...
{ AppData *data = window_get_user_data(window); TextLayer *text = &data->text; text_layer_init(text, &window->layer.bounds); text_layer_set_text(text, "UP: Erase Normal+Sys FW\nUP LONG:Erase Normal+Recov+Sys\nSEL: Reboot FW\nDOWN: Erase Recovery\nBACK: Crash"); text_layer_set_font(text, fonts_get_system_font(...
static void push_window(AppData *data) { Window *window = &data->window; window_init(window, WINDOW_NAME("Grenade Launcher")); window_set_user_data(window, data); window_set_overrides_back_button(window, true); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); windo...
----------------------------------------------------- //! Apple's iBeacon AD DATA format. //! The byte-order of Apple's fields (uuid, major and minor) is Big Endian (!!!) //! @see Apple's docs for more info: http://goo.gl/iOrnpj //! @see StackOverflow distance/accuracy calculations: http://goo.gl/yH0ubM static const ui...
ble_ad_set_manufacturer_specific_data(ad_out, COMPANY_ID_APPLE, (uint8_t *) &raw_ibeacon, sizeof(raw_ibeacon))
; }
c language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/graphics/gtypes.h" #include "mfg/mfg_info.h" #include "mfg/snowy/mfg_private.h" #include "flash_region/flash_region_s29vs.h" #include "fake_spi_flash.c" #include "stubs_logging.h" #include "stubs_pbl_malloc....
(mfg_info_get_rtc_freq(), 4)
ccessed any longer after returning. static bool prv_update_clients(GAPLEConnectionIntent *intent, uint8_t hci_reason, GAPLEConnectionEvent event) { const BTDeviceInternal *device = &intent->device; const bool connected = (event == GAPLEConnectionEventCon...
PBL_LOG(LOG_LEVEL_INFO, "LE Conn Compl: addr="BT_DEVICE_ADDRESS_FMT", is_random_addr=%u,", BT_DEVICE_ADDRESS_XPLODE(event->peer_address.address), event->peer_address.is_random_address)
; PBL_LOG(LOG_LEVEL_INFO, " hdl=%u, status=0x%02x, master=%u, %u, slave lat=%u, " "supervision timeout=%u, is_resolved=%c", event->handle, event->status, event->is_master, params->conn_interval_1_25ms, params->slave_latency_events, params->supervision_timeout_10ms...
x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xe...
(tempa[2])
*)node)->stored_resource; return; } resource_storage_get_resource(app_num, id, entry); mutex_unlock_recursive(s_resource_mutex); } //! initialize components needed for one apps resources bool resource_init_app(ResAppNum app_num, const ResourceVersion *expected_version) { // resource_id is ignored in this ...
(&resource, has_privileged_access)
; } ResourceVersion resource_get_version(ResAppNum app_num, uint32_t resource_id) { mutex_lock_recursive(s_resource_mutex); ResourceVersion v = resource_storage_get_version(app_num, resource_id); mutex_unlock_recursive(s_resource_mutex); return v; } ResourceVersion resource_get_system_version(void) { return...
); // Complete spawn prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_entrie...
{ #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 500; const int duration_c = 200; const int duration_d = 400; const int total_duration = duration_c + duration_d; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; ...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, inner_seq), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls...
/* * 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...
(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite)
the subscription confirmation: ppogatt_handle_subscribe(s_characteristics[0][PPoGATTCharacteristicData], BLESubscriptionNotifications, BLEGATTErrorSuccess); // Expect Reset to be initiated ("Reset Request" sent by FW): prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacter...
(s_characteristics[0][PPoGATTCharacteristicData])
; prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]); // Timeout waiting for "Reset Complete": for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } // Expect "Reset Request" sent by FW: prv_assert_sent_reset_re...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ char buffer[160]; pbl_log_sync(LOG_LEVEL_ALWAYS, filename, line_number, "*** ASSERTION FAILED: %s", expr); if (fmt) { vsniprintf(buffer, sizeof(buffer), fmt, fmt_args); pbl_log_sync(LOG_LEVEL_ALWAYS, filename, line_number, "%s", buffer); } trigger_fault(RebootReasonCode_Assert, lr); }
{ 736, 200, 32}, { 736, 224, 40}, { 856, 272, 72}, { 864, 368, -16}, { 936, 400, -48}, { 976, 440, -144}, { 1136, 368, -136}, { 1288, 272, 40}, { 1752, 392, 72}, { 1296, 384, 56}, { 1048, 296, 56}, { 1168, 200, 160}, { 1088, 120, 176}, { 928, 120, 120}, { 784, 9...
{ 912, 112, 96}, { 792, 88, 48}, { 728, 96, -24}, { 728, 0, 16}, { 736, -24, -80}, { 664, -40, 40}, { 928, -104, -8}, { 1048, 96, -120}, { 1504, -392, 144}, { 1768, 0, 232}, { 1400, 432, -104}, { 1328, 472, -24}, { 824, 328, -8}, { 592, 32, 104}, { 680, 104, 8...
// 78 seconds { 968, 368, -120}, { 1200, 360, -144}, { 1208, 200, 8}, { 1848, 344, 40}, { 1384, 392, 0}, { 872, 288, 16}, { 1064, 192, 88}, { 1080, 72, 184}, { 888, 96, 152}, { 824, 104, 64}, { 744, 96, 8}, { 664, 0, 24}, { 656, -32, -8}, { 736, -16, -16}, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ARRAY_LENGTH(s_test_cases)
; i++) { const struct SelfTestCase* test = s_test_cases + i; char *pass_fail; if (test->func != 0) { // Test is implemented pass_fail = bool_to_pass_fail(bitset32_get(&result, i)); } else { pass_fail = "NYI"; } prompt_send_response_fmt(buffer, 32, "%15s: %s", test->name, pass_fail);...
/* * 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, 32, BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(bd_addr))
; } else { prompt_send_response("?"); } } //! @param bt_name A custom Bluetooth device name. void command_bt_set_name(const char *bt_name) { bt_local_id_set_device_name(bt_name); } // BT FCC tests void command_bt_test_start(void) { // take down the BT stack and put the OS in a mode where it will not // ...
ss_metadata_get_app_sdk_platform(s_app_task_context.app_md); if (sdk_platform == PBL_PLATFORM_TYPE_CURRENT) { *size = GSize(DISP_COLS, DISP_ROWS); return; } // We cannot use the SDK type for this compatibility check but there's // also no easy way to get the resolutions per platform. // so we re-use...
app_manager_get_current_app_md()
->uuid; } DEFINE_SYSCALL(Version, sys_get_current_app_sdk_version, void) { return process_metadata_get_sdk_version(app_manager_get_current_app_md()); } DEFINE_SYSCALL(bool, sys_get_current_app_is_js_allowed, void) { return (app_manager_get_current_app_md()->allow_js); } DEFINE_SYSCALL(bool, sys_get_current_app_i...
nst bool has_timestamp = true; const bool is_all_day = true; const bool is_ingame = true; const bool recurring = true; switch (pin_set) { case TimelinePinsDemo_Default: { // Past pins (deprecated) prv_add_calendar_pin(-4 * 60 * 60, 60, !is_all_day, !recurring, 0, 0); prv_add_generic_pin(-6...
(PREFIX_PIN_SET(TIMELINE_PIN_SET))
; #else OptionMenu *option_menu = option_menu_create(); const OptionMenuConfig config = { .title = "Select Type of Pins to Add", .choice = OPTION_MENU_CHOICE_NONE, .status_colors = { GColorDarkGray, GColorWhite }, .highlight_colors = { GColorLightGray, GColorBlack }, }; option_menu_configure(op...
x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x4c, 0x6f, 0x6f, 0x6b, 0x20, 0x61, 0x74, 0x20, 0x69, 0x74, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x77, 0x65, 0x73, 0x6f, 0x6d, 0x65, 0x2e, // Action 1 0x00, ...
cl_assert_equal_i(item->action_group.actions[0].id, 0)
; cl_assert_equal_i(item->action_group.actions[0].type, TimelineItemActionTypeGeneric); cl_assert_equal_i(item->action_group.actions[0].attr_list.num_attributes, 1); cl_assert_equal_i(item->action_group.actions[0].attr_list.attributes[0].id, AttributeIdTitle); cl_assert_equal_s(item->action_group.actions[0].att...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_ERROR, "Couldn't malloc space for new font")
; return NULL; } bool result = text_resources_init_font(app_num, resource_id, 0 /* extended resource */, font_info); if (!result) { // couldn't init the font applib_free(font_info); return NULL; } return font_info; } void fonts_unload_custom_font(GF...
rn the number of pages in the log file requested or 0 if no //! file is found static int prv_get_start_of_log_file(uint8_t log_file_id, uint32_t *start_page_addr) { uint8_t num_log_pages = 0; uint8_t prev_chunk_id = 0; uint32_t log_start_addr = FLASH_LOG_INVALID_ADDR; for (uint32_t offset = 0; offset < L...
&s_curr_state.page_start_addr) == 0)) { s_curr_state.page_start_addr = FLASH_REGION_DEBUG_DB_BEGIN; } s_curr_state.page_start_addr = prv_get_unit_base_address(s_curr_state.page_start_addr); prv_erase_unit(s_curr_state.page_start_addr); s_curr_state.log_file_id = prv_get_next_log_file_id(...
//! Writes the log record header to flash and advances the //! s_curr_state.offset_in_log_page field //! //! @param msg_length - the length of the message to be written static void prv_write_flash_log_record_header(uint8_t msg_length) { LogRecordHeader record_hdr; memset((uint8_t *)&record_hdr, 0xff, sizeof(recor...
us) { } static bool semaphore_take(I2cBus *bus) { return true; } static bool semaphore_wait(I2cBus *bus) { bus->busy = true; volatile uint32_t timeout_attempts = I2C_TIMEOUT_ATTEMPTS_MAX; while ((timeout_attempts-- > 0) && (bus->busy)); bus->busy = false; return (timeout_attempts != 0); } static void sem...
{ //Fast mode i2c_init_struct.I2C_DutyCycle = BOARD_CONFIG.i2c_bus_configs[bus_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 initialize the I2C periphera...
the // different possible dest_colors for (int16_t y = 0; y < bitmap_size.h; y++) { for (int16_t column_index = 0; column_index < num_dest_colors; column_index++) { const int16_t starting_x = column_index * hline_applying_test_column_width; for (int16_t x = starting_x; x < starting_x + hline_applyi...
for (int16_t x = 0; x < mask_size.w; x++) { test_graphics_context_mask_set_value_for_coordinate(ctx, mask, mask_pixel_value, GPoint(x, y)); }
} return mask; } typedef void (*VerticalClippingMaskApplyFunc)(GContext *ctx, int16_t x, int16_t y1, int16_t y2, GColor color); static void prv_mask_apply_vline_test_pattern(VerticalClippingMaskApplyFunc apply_func) { GContext *ctx = s_ctx; prv_prepare_canvas_f...
/* * 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_antialiased(ctx, false)
; graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void clear_layer_update_callback...
/* * 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...
applib_free(text_layer)
; } void text_layer_deinit(TextLayer *text_layer) { PBL_ASSERTN(text_layer); layer_deinit(&text_layer->layer); graphics_text_layout_cache_deinit(&text_layer->layout_cache); text_layer->layout_cache = NULL; } Layer* text_layer_get_layer(TextLayer *text_layer) { PBL_ASSERTN(text_layer); return &text_layer->...
G_MAX_MESSAGE_LEN, text_fmt, name_len, entry.name); dialog_set_text(dialog, text); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_LARGE); dialog_set_timeout(dialog, DIALOG_TIMEOUT_INFINITE /* no timeout */); // Any sort of application crash or window crash is a critical message as it // impacts the UX ...
app_install_release_md(s_next_app.md)
; s_next_app = (NextApp) { .md = system_app_state_machine_system_start(), }; } } // Launch the new app if (!prv_app_start(s_next_app.md, s_next_app.common.args, s_next_app.common.reason)) { if (s_next_app.md->process_storage != ProcessStorageFlash) { PBL_CROAK("Failed to start s...
_layer->layer, frame); const GRect *bounds = &scroll_layer->layer.bounds; scroll_layer->layer.property_changed_proc = scroll_layer_property_changed_proc; layer_init(&scroll_layer->content_sublayer, bounds); layer_add_child(&scroll_layer->layer, &scroll_layer->content_sublayer); prv_setup_shadow_layer(scroll...
scroll_layer_get_paging(scroll_layer)
) { animation_set_curve(animation, AnimationCurveEaseOut); } } else { scroll_layer->animation = property_animation_create(&implementation, scroll_layer, NULL, &offset); animation = property_animation_get_animation(scroll_layer->anim...
GPoint(5, 5), GPoint(45, 10)); #if PBL_COLOR ASSERT_CALLED(graphics_line_draw_stroked_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_ODD)); #else ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_ODD)); #endif setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, f...
graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)
); setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE...
assert(!gcolor_equal(GColorRed, GColorBlue)); // Two colors with zero alpha values should be equal regardless of what their RGB channels are GColor8 color1 = GColorBlue; color1.a = 0; GColor8 color2 = GColorRed; color2.a = 0; cl_assert(gcolor_equal(color1, color2)); // But two colors with semi-transpare...
cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorOrange).argb)
; } static void prv_test_get_luminance(GColor8 color_to_test, GColor8Component expected_luminance) { cl_assert_equal_i(gcolor_get_luminance(color_to_test), expected_luminance); // Test that alpha doesn't affect luminance GColor8 semitransparent_color = color_to_test; semitransparent_color.a = 1; cl_assert_eq...
/* * 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...
assert_equal_hex(crc, 0xe8b7be43)
; } void test_crc32__standard_check(void) { // "Check" value from "A Painless Guide to CRC Error Detection Algorithms" crc = crc32(crc, "123456789", 9); assert_equal_hex(crc, 0xCBF43926); } void test_crc32__residue(void) { uint8_t message[30]; memcpy(message, "1234567890", 10); crc = crc32(crc, message, 1...
>next = s_head; s_head = result; } else { // Insert as tail: prev->next = result; result->next = NULL; } } static ScanResult *list_get_by_index(uint8_t index) { ScanResult *result = s_head; while (index && result) { result = result->next; --index; } return result; } static void lis...
menu_cell_basic_header_draw(ctx, cell_layer, (section_index == SectionData) ? "Results" : "Options")
; } static void draw_data_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) { ScanResult *result = list_get_by_index(cell_index->row); // Build the title string: char title[32]; // Annotate with "HRM" if the device has a heart rate service: char *hrm_st...
12}, { -40, 1320, -640}, { -8, 1152, -584}, { -128, 1184, -496}, { -144, 840, -352}, { -264, 512, -208}, { -352, 224, -136}, { -440, 48, -168}, { -528, 32, -176}, { -648, 248, -264}, { -776, 880, -440}, { -840, 928, -520}, { -1040, 760, -192}, { -920, 448, -8}, //...
{ -928, 152, -88}, { -960, 160, -48}, { -960, 160, -72}, { -968, 128, -40}, { -960, 168, -88}, // 521 seconds { -960, 176, -176}, { -936, 40, -104}, { -928, 128, -136}, { -928, 216, -168}, { -928, 184, -184}, { -912, 64, -152}, { -936, 112, -152}, { -944, 144, -15...
PBL_ASSERTN(app_num == SYSTEM_APP)
; if (font_info->extension_changed_cb == NULL) { font_info->extension_changed_cb = resource_watch(app_num, extended_resource, prv_resource_changed_callback, font_info); } font_info->extended = prv_load_font_res(app_num, extended_resource, &font_in...
allback callback, uintptr_t context) { if (animation->first_child) { prv_each(animation->first_child, callback, context); } if (animation->sibling) { prv_each(animation->sibling, callback, context); } callback(animation, context); } static void prv_free(AnimationPrivate *animatio...
{ prv_each(animation, prv_call_scheduled, false); prv_each(animation, prv_call_update, ANIMATION_NORMALIZED_MAX); prv_each(animation, prv_call_stopped, animation->is_completed); }
return true; } // Interface for unit tests to query the fake animation state ///////////////////////////////////////////////////////////// Animation *fake_animation_get_first_animation(void) { return (Animation *)s_animations; } Animation *fake_animation_get_next_animation(Animation *animation) { return (Anim...
pervisory:1; struct PACKED ReliableInfoPacket { bool is_supervisory:1; uint8_t sequence_number:7; bool poll:1; uint8_t ack_number:7; net16 protocol; net16 length; char information[]; } i; struct PACKED ReliableSupervisoryPacket { bool is_supervisory:1; bool is_unnumbered:1; //...
{ prv_send_supervisory_response(SupervisoryKind_ReceiveReady, /* final */ true); }
/* * 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...
RCC_AHB1PeriphResetCmd(ahb1_periphs, ENABLE)
; RCC_AHB1PeriphResetCmd(ahb1_periphs, DISABLE); const uint32_t ahb2_periphs = 0 | RCC_AHB2Periph_DCMI | RCC_AHB2Periph_CRYP | RCC_AHB2Periph_HASH | RCC_AHB2Periph_RNG | RCC_AHB2Periph_OTG_FS; RCC_AHB2PeriphResetCmd(ahb2_periphs, ENABLE); RCC_AHB2PeriphResetCmd(ahb2_periphs, DISABLE); c...
MODE_REG; uint32_t QSPIC_BURSTCMDA_REG; uint32_t QSPIC_BURSTCMDB_REG; uint32_t QSPIC_WRITEDATA_REG; uint32_t QSPIC_DUMMYDATA_REG; uint32_t QSPIC_ERASECTRL_REG; uint32_t QSPIC_ERASECMDA_REG; uint32_t QSPIC_ERASECMDB_REG; uint32_t QSPIC_BURSTBRK_REG; uint32_t QSPIC_STATUSCMD_REG; uint32_t QS...
(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_HYST, 0x4)
; REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_VOLTAGE, 0x18); REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_CUR_LIM_MAX_HV, 0x1F); REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_CUR_LIM_MIN, 0x4); REG_SETF(...
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...
if (button_id == BUTTON_ID_BACK) { VOICE_LOG("Exit UI"); prv_cancel_dictation(data); DictationSessionStatus status = DictationSessionStatusFailureTranscriptionRejected; if ((data->error_count > 0) && !data->last_session_successful) { status = DictationSessionStatusFailureTranscriptionRejectedWithE...
} static void prv_back_select_click_config_provider(void *context) { window_set_click_context(BUTTON_ID_BACK, context); window_single_click_subscribe(BUTTON_ID_BACK, &prv_mic_click_handler); window_set_click_context(BUTTON_ID_SELECT, context); window_single_click_subscribe(BUTTON_ID_SELECT, &prv_mic_click_han...
= property_animation_create_layer_frame(layer, &from_rect_a, &to_rect_a); animation_set_duration((Animation*)a, DURATION); animation_set_handlers((Animation*) a, (AnimationHandlers) { .started = (AnimationStartedHandler) animation_started, .stopped = (AnimationStoppedHandler) animation_stopped, }, NULL /*...
property_animation_create_layer_frame( text_layer_get_layer(s_text_layer_b), &from_rect_b, &to_rect_b)
lorPastelYellow : BACKGROUND_COLOR; } #endif } static GFont prv_get_number_font(bool prefer_larger_font) { return prefer_larger_font ? fonts_get_system_font(FONT_KEY_LECO_38_BOLD_NUMBERS) : fonts_get_system_font(FONT_KEY_LECO_26_BOLD_NUMBERS_AM_PM); } static GTextNode* prv_create_text_...
health_util_create_text_node_with_text( i18n_get(units_string, i18n_owner), units_font, TEXT_COLOR, container)
; units_text_node->node.offset.y = units_offset_y; #endif break; } case WorkoutMetricType_Custom: { const size_t buffer_size = 20; GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font, ...
/ --------------------------------------------------------------------------------------------- bool shared_circular_buffer_read(const SharedCircularBuffer* buffer, SharedCircularBufferClient *client, uint16_t length, const uint8_t** data_out, uint16_t* ...
{ // The subsampling algorithm does not need the subsampling ratio to // be normalied to reduced form. client->numerator = numerator; client->denominator = denominator; // Initialize the state so that the next item in the buffer is copied, // not discarded. client->subsample_state = denomina...
} // ------------------------------------------------------------------------------------------------- size_t shared_circular_buffer_read_subsampled( SharedCircularBuffer* buffer, SubsampledSharedCircularBufferClient *client, size_t item_size, void *data, uint16_t num_items) { uint16_t bytes_available =...
/* * 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(s_command_list[0].addr, 64 * 1024)
; cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand); s_command_list_index = 0; // Erase two sectors 0x10000 - 0x30000 but allow us to erase more flash_region_erase_optimal_range(0, 64 * 1024, 3 * 64 * 1024, 4 * 64 * 1024); cl_assert_equal_i(s_command_list_index, 2); cl_assert_equal_i(s_comma...
*text_box, TEXT_OVERFLOW, TEXT_ALIGNMENT, (GTextLayoutCacheRef) &layout).h; } static int prv_get_icon_top_margin(bool has_status_bar, int icon_he...
window_get_user_data(window)
; dialog_unload(&simple_dialog->dialog); if (simple_dialog->dialog.destroy_on_pop) { applib_free(simple_dialog); } } static void prv_click_handler(ClickRecognizerRef recognizer, void *context) { SimpleDialog *simple_dialog = context; if (!simple_dialog->buttons_disabled) { dialog_pop(&simple_dialog->...
/* * 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...
(iter, &value)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(buffer, flash_addr, num_bytes)
; return crc32(crc, buffer, num_bytes); }
data[] = "\x02\x01\x1a\x03\x03\x29\x7b\x0a\x09\x4c\x69\x67\x68\x74\x42\x6c\x75\x65"; set_ad_data(data, sizeof(data)); // Test ble_ad_get_raw_data_size: cl_assert_equal_i(ble_ad_get_raw_data_size(s_ad_data), sizeof(data)); // Test ble_ad_copy_raw_data: uint8_t buffer[GAP_LE_AD_REPORT_DATA_MAX_LENGTH * 2]...
(ble_ad_set_service_uuids(ad, uuid, 2), false)
; // Hand-construct expected raw advertisement data: uint8_t expected_ad_data[sizeof(Uuid) + 2 /* +1 Length, +1 Type bytes */] = { sizeof(Uuid) + 1 /* +1 for Type byte */, 0x07, // Service UUIDs, 128-bit, Complete }; memcpy(&expected_ad_data[2], uuid_bytes, sizeof(Uuid)); // One should fit though: ...
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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli...
(t->tm_year)
; const int hour_12h = (t->tm_hour % 12 == 0) ? 12 : (t->tm_hour % 12); // Only use i18n if we're in the kernel, or the app locale is the system locale. const bool use_i18n = !locale || (strncmp(locale, app_get_system_locale(), ISO_LOCALE_LENGTH) == 0); while (left) { // Copy up to ...
animation_schedule(animation); if (click_recognizer_get_button_id(recognizer) == BUTTON_BACKWARD) { music_command_send(MusicCommandPreviousTrack); } else { music_command_send(MusicCommandNextTrack); } } static void prv_volume_click_handler(ClickRecognizerRef recognizer, void *context) { reset_action_...
(BUTTON_ID_DOWN, VOLUME_REPEAT_INTERVAL_MS, prv_volume_click_handler)
; window_single_click_subscribe(BUTTON_ID_SELECT, prv_play_pause_click_handler); } static void prv_update_layout(MusicAppData *data) { // Hide track position bar if progress reporting not supported bool hide_layer = !music_is_progress_reporting_supported(); layer_set_hidden(&data->track_pos_bar.layer, hide_lay...
ce that nobody uses these variables outside of the block // when dealing with round displays, sizes change depending on location. const GRect probe_rect = GRect(x, y + text_single_line_text_offset_px, w, max_text_line_height_px); const uint16_t text_height = graphics_text_...
dialog_init_icon_layer(dialog, icon, GPoint(x, y), true)
SCROLL_AMOUNT, false); } layer_mark_dirty(&item_layer->layer); } static void prv_handle_select_click(ClickRecognizerRef recognizer, void *context) { TimelineItemLayer *item_layer = context; TimelineItemActionGroup *action_group = &item_layer->item->action_group; const uint8_t num_actions = action_group->num...
{ property_animation_destroy(item_layer->animation); layer_deinit(&item_layer->layer); if (item_layer->timeline_layout) { layout_destroy((LayoutLayer *)item_layer->timeline_layout); item_layer->timeline_layout = NULL; } }
void timeline_item_layer_set_item(TimelineItemLayer *item_layer, TimelineItem *item, TimelineLayoutInfo *info) { item_layer->item = item; if (item_layer->timeline_layout) { layer_remove_from_parent((Layer *)item_layer->timeline_layout); layout_destroy((LayoutLayer *)item_layer->timeline_layout); } ...
* * 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 Lice...
RCC_DeInit()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ system_reset(); (void)data; }
NORETURN system_hard_reset(void) { // Don't do anything fancy here. We may be in a context where nothing works, not even // interrupts. Just reset us. NVIC_SystemReset(); __builtin_unreachable(); }
{ 488, 248, -744}, { 488, 152, -672}, { 600, 424, -624}, { 544, 416, -720}, { 456, 184, -816}, { 416, -88, -760}, { 408, 32, -856}, { 504, 400, -904}, { 400, -328, -736}, { 544, 88, -816}, { 576, 104, -1112}, { 616, -40, -1072}, { 576, 272, -968}, { 104, -1024, -3...
{ -600, 952, -256}, { -784, 616, -160}, { -864, 664, -320}, { -728, 640, -376}, { -688, 712, -424}, { -624, 640, -456}, { -648, 800, -400}, { -592, 792, -408}, { -512, 752, -400}, { -488, 784, -368}, { -416, 840, -360}, { -360, 864, -336}, { -336, 896, -264}, { -...
nection_service.h" #include "applib/graphics/graphics.h" #include "applib/graphics/text.h" #include "applib/tick_timer_service.h" #include "applib/ui/animation_private.h" #include "applib/ui/app_window_click_glue.h" #include "applib/ui/ui.h" #include "applib/ui/window.h" #include "applib/ui/window_private.h" #include "...
(LOG_LEVEL_DEBUG, "Forcekill disabled due to low-power or factory-reset")
; return; } PBL_LOG(LOG_LEVEL_DEBUG, "Force killing app."); app_manager_force_quit_to_launcher(); } static void back_button_force_quit_handler(void *data) { launcher_task_add_callback(launcher_force_quit_app, NULL); } static void launcher_handle_button_event(PebbleEvent* e) { ButtonId button_id = e->bu...
eTask_KernelMain); const AppInstallId id = config->id; const bool is_worker = config->worker; if (id == INSTALL_ID_INVALID) { PBL_LOG(LOG_LEVEL_DEBUG, "Invalid ID"); return; } const PebbleProcessMd *md = NULL; #if !RECOVERY_FW if (app_install_id_from_app_db(id)) { if (!process_manager_check_...
analytics_stopwatch_stop(ANALYTICS_APP_METRIC_FRONT_MOST_TIME)
; } analytics_external_collect_app_cpu_stats(); analytics_external_collect_app_flash_read_stats(); } // --------------------------------------------------------------------------------------------- //! This method returns true if the process is safe to kill (it has exited out of it's main function). If the //! ...
/* * 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...
(&header->common, now, 0, TIMELINE_EVENT_DELTA_INFINITE)
)); } static uint32_t prv_calendar_update(TimelineItem *item, void **context) { s_event_ongoing = item ? timeline_event_is_ongoing(rtc_get_time(), item->header.timestamp, item->header.duration) : false; prv_put_calendar_event(); return...
{ PBL_LOG(LOG_LEVEL_ERROR, "Err %d while reading", (int)bytes_read); return false; }
else if (bytes_read < (int)size) { PBL_LOG(LOG_LEVEL_ERROR, "Read only %d bytes, expected %d", (int)bytes_read, (int)size); return false; } return true; } // ---------------------------------------------------------------------------------------- // Logs if an error occurs, returns true on success static...
4; static const int16_t SCREEN_HEIGHT = 168; static FrameBuffer *fb = NULL; static const GPathInfo s_house_path_info = { .num_points = 11, .points = (GPoint []) { {-40, 0}, {0, -40}, {40, 0}, {28, 0}, {28, 40}, {10, 40}, {10, 16}, {-10, 16}, {-10, 40}, {-28, 40}, {-28, 0}, }, }; static const GPathInfo s...
(0, SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT / 2)
; prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_top_clipped.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2); prv_filled_...
ess 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. */ ...
contacts_db_insert((uint8_t *)&contact, UUID_SIZE, (uint8_t *)&contact, sizeof(contact))
e_buffer; break; case TXMenuIdx_UnmodulatedContinuousWave: title = "Unmodulated CW"; subtitle = data->is_unmodulated_cw_enabled ? "Enabled" : "Disabled"; break; case TXMenuIdx_PayloadLength: title = "Payload Length"; itoa_int(data->payload_length, subtitle_buf...
{ 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...
/* * 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_p(result, false)
-------------------------- // Sample captured: 2015-10-05 16:50:20 local AccelRawData *activity_sample_non_walk_pbl_25668_14(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME non_walk_pbl_25668_14 //> TEST_EXPECTED 0 //> TEST_EXPECTED_MIN 0 //> TEST_EXPECTED_MAX 10 ...
{ 200, 200, -712}, { 208, 320, -840}, { 176, 256, -920}, // 5 seconds { 176, 40, -952}, { 168, -56, -1008}, { 88, -24, -1088}, { 72, 272, -856}, { 112, 280, -904}, { 128, 328, -896}, { 136, 240, -880}, { 136, 240, -888}, { 128, 208, -888}, { 112, 216, -928}, {...
{ 104, 392, -816}, { 88, 384, -728}, { 88, 512, -824}, { 88, 408, -832}, { 64, 400, -888}, { 48, 392, -848}, { 64, 232, -632}, { 72, 408, -976}, { 112, 208, -696}, { 152, 312, -928}, // 8 seconds { 184, 240, -896}, { 232, 264, -880}, { 216, 280, -888}, { 208,...
ther express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "selection_layer.h" #include "applib/applib_malloc.auto.h" #include "applib/graphics/graphics.h" #include "applib/graphics/text.h" #include "applib/ui/window_private.h" #inclu...
for (uint32_t i = 0; i < selection_layer->num_cells; i++) { if (selection_layer->cell_widths[i] == 0) { continue; } total_width += selection_layer->cell_widths[i]; if (i + 1 < selection_layer->num_cells) { total_width += selection_layer->cell_padding; } }
LEVEL_DEBUG, "Unexpected PPoGATT Service Read: 0x%"PRIx16, evt->handle); // In the future, we might actually return something useful. For now, just uncoditionally // respond to everything with the same payload uint8_t response = 0xAA; ble_error_t e = ble_gatts_read_cfm(evt->conn_idx, evt->handle, ATT_ERROR_OK,...
(payload_size)
/* * 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...
list_prepend((ListNode *)s_event_head, (ListNode *)node)
; } return s_can_send_event; } static void prv_process_callback_events_alt(bool should_execute_callback) { EventNode *node = s_event_head; while (node) { EventNode *next = (EventNode *) node->node.next; if (should_execute_callback) { node->event.callback.callback(node->event.callback.data); }...
bs.h" #include "stubs_applib_resource.h" // Definitions #define SW_EVEN 4 #define SW_ODD 5 // Includes all possible fields for all shapes // The fields that are not needed for a particular shape will be zeroed out. typedef struct PACKED { char func[30]; GContext ctx; GPoint p0; GPoint p1; GRect r0; uint16...
{ s_last_args_for_mock = (ArgsForMock){ .ctx = *ctx, .p0 = p, .radius = radius }; strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)); }
void graphics_circle_draw_stroked_non_aa(GContext* ctx, GPoint p, uint16_t radius, uint8_t stroke_width) { s_last_args_for_mock = (ArgsForMock){ .ctx = *ctx, .p0 = p, .radius = radius }; strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)); } void graphics_internal_circle...
licable 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. */ #include "stroke_wi...
{ AppData *data = window_get_user_data(s_window); data->operation = (data->operation + 1) % MAX_OPS; if (data->operation < MIN_OPS) data->operation = MIN_OPS; layer_mark_dirty(data->canvas_layer); PBL_LOG(LOG_LEVEL_DEBUG, "current operation type: %d", data->operation); }
static void click_config_provider(void *context) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, up_handler); window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 100, select_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, down_handler); } static void debug_layer_update...
cl_assert_equal_i(1, s_path_fill_precise_count); cl_assert(prv_compare_points((GPoint*)points, s_fill_points, s_path_num_points)); cl_assert_equal_i(1, s_path_stroke_precise_count); cl_assert_equal_b(false, s_path_open); cl_assert(prv_compare_points((GPoint*)points, s_stroke_points, s_path_num_points)); prv...
(s_path_open, false)
; cl_assert_equal_i(s_circle_fill_count, 1); cl_assert_equal_i(s_circle_stroke_count, 0); cl_assert_equal_p(s_stroke_points, NULL); cl_assert(prv_compare_points(&center, s_fill_points, s_path_num_points)); prv_reset(); // restore stroke color and set radius to zero - only a stroke should be drawn gdraw_c...
return dict_write_data_internal(iter, key, (const uint8_t * const) &value, sizeof(value), TUPLE_INT); } DictionaryResult dict_write_int16(DictionaryIterator *iter, const uint32_t key, const int16_t value) { return dict_write_data_internal(iter, key, (const uint8_t * const) &value, sizeof(value), TUPLE_INT); } Dic...
{ return DICT_INVALID_ARGS; }
switch (tuplet->type) { case TUPLE_BYTE_ARRAY: return dict_write_data_internal(iter, tuplet->key, tuplet->bytes.data, tuplet->bytes.length, tuplet->type); case TUPLE_CSTRING: return dict_write_data_internal(iter, tuplet->key, (uint8_t *)tuplet->cstring.data, tuplet->cstring.length, tuplet->type);...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(src_x, src_begin_x, src_end_x - 1)
) { // Check if content should wrap (under and over) for tiling if (!WITHIN(src_x, src_bitmap->bounds.origin.x, grect_get_max_x(&src_bitmap->bounds) - 1)) { // keep correct bounds alignment for circular when tiling src_x = src_bitmap->bounds.origin.x + ...
/* * 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_destroy(s_data.window); }
int main(void) { init(); app_event_loop(); deinit(); }
"applib/graphics/gdraw_command_sequence.h" #include "applib/graphics/gdraw_command_private.h" #include "applib/graphics/graphics_private_raw.h" #include "stubs_applib_resource.h" #include "stubs_app_state.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_pbl_malloc....
prv_setup_context(&ctx, gdraw_command_image_get_bounds_size(image))
; gdraw_command_image_draw(&ctx, image, GPoint(0, 0)); // Write output to file of the same name with extension replaced with .png char output[strlen(filename) + 5]; // add space for .pdc + '\0' prv_get_base_path(filename, output); strcat(output, ".png"); write_gbitmap_to_pbi(&ctx.dest_bitmap, output, s_...
RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 11); ...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11)
; graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN...
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 disabled bus %d by device %d", bus_idx, device_id); bus_unlock(bus); return; } ...
delay_ms(1)
; } else { // Too many NACKs received, abort transfer abort_transfer(bus); break; PBL_LOG(LOG_LEVEL_ERROR, "I2C Error: too many NACKs received on bus %" PRId8, bus_idx); } } else { // Timeout, abort transfer abort_transfer(bus); break; PBL_LOG(LO...
/* * 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 NULL; }
int read_size = file_size; uint8_t *contents = kernel_calloc(1, read_size); while (contents == NULL && read_size > 0) { // If we can't allocate enough RAM to read the whole file, we should // at least try to read part of it. read_size /= 2; contents = kernel_calloc(1, read_size); } if (conten...
-888}, { 176, -104, -992}, { 264, -200, -864}, { 296, -216, -856}, { 40, -224, -864}, { -184, -296, -840}, { -264, -152, -848}, { -288, -80, -912}, { -168, -192, -984}, { -248, -272, -1032}, { -160, -168, -1096}, { -128, -56, -1184}, { -64, 104, -1328}, { 24, -8, -127...
{ 1024, 72, -176}, { 896, 104, -128}, { 904, 160, -8}, { 992, 208, 48}, { 1080, 272, 8}, { 1008, 312, -48}, { 1224, 312, 32}, { 1232, 504, 144}, // 107 seconds { 880, 688, 24}, { 1272, 392, 0}, { 1208, 336, -56}, { 1144, 320, 0}, { 1280, 336, 64}, { 1488, 312,...
buffer_length); cl_assert_equal_s(dest, "Pankajava"); cl_assert_equal_m(dest + buffer_length, GUARD_REFERENCE, NAME_LENGTH - buffer_length); } void test_phone_formatting__overflowing_first_name(void) { const size_t buffer_length = 10; char dest[NAME_LENGTH]; memset(dest, GUARD_CHAR, NAME_LENGTH); phone_...
(dest, "+49 030\n90 26 0")
; } void test_phone_formatting__phone_number_std_germany(void) { char test_number[] = "030 90 26 0"; // Berlin, Rotes Rathaus int dest_len = sizeof(test_number) + 1; char *dest = malloc(dest_len); // malloc'd memory is protected by DUMA phone_format_phone_number(test_number, dest, dest_len); cl_assert_eq...
uint16_t max_period_secs, ResponsivenessGrantedHandler granted_handler); CommSession *s_session; Transport *s_transport = (Transport *) ~0; const TransportImplementation s_transport_implementation = { .send_next = prv_send_next, .reset ...
cl_assert_equal_i(s_prepare_count, 0)
; // Length low byte (big endian!) RECEIVE(0x01); cl_assert_equal_i(s_prepare_count, 0); // Endpoint low byte (big endian!) RECEIVE(PRIVATE_TEST_ENDPOINT_ID >> 8); cl_assert_equal_i(s_prepare_count, 0); // Endpoint low byte (big endian!) RECEIVE(PRIVATE_TEST_ENDPOINT_ID & 0xff); cl_assert_equal_i(s...
RAY_LENGTH(types), .types = types, .num_samples = ARRAY_LENGTH(offset_sec), .offset_sec = offset_sec, .num_values = ARRAY_LENGTH(values), .values = values, }, }; ProtobufLogRef ref = prv_test_encode_measurements(&input, false /*use_data_logging*/); prv_test_deco...
prv_common_payload_initialize(&input)
; for (unsigned i = 0; i < input.msrmt.num_samples; i++) { rtc_set_time(input.msrmt.time_utc + input.msrmt.offset_sec[i]); success = protobuf_log_session_add_measurements(session_ref, rtc_get_time(), input.msrmt.num_types, ...
/* * 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...
{ dbgserial_putstr("Configuring FPGA from bitstream in flash..."); if (display_program(bitstream->bitstream, bitstream->len)) { return true; } }
else { // Fall back to NVCM. dbgserial_putstr("No FPGA bitstream in flash."); } dbgserial_putstr("Falling back to NVCM."); return prv_reset_into_nvcm(); } static void prv_start_command(uint8_t cmd) { GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET); delay_us(100); display_write_byte(cmd); } stat...
/* * 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...
((void*)0x1F, 0x2)
; cl_assert_equal_i(s_flush_addr, 0x1F); cl_assert_equal_i(s_flush_size, 0x02); cl_assert_equal_i(s_invalidate_addr, 0x1F); cl_assert_equal_i(s_invalidate_size, 0x02); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid); } void test_cpu_cache__userspace_fail_from_addr(void) { cl_will_return(icache_...