prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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_fetch_struct()
fs_get_health_app_opened_version(void) { return s_health_app_opened_version; } ActivityScalarStore activity_metrics_prv_steps_per_minute(void) { return s_data.steps_per_minute; } // ========================================================================================= // PFS stubs static PFSFileChangedCallbac...
(stats.median, 4277)
; cl_assert_equal_i(stats.total_days, 16); cl_assert_equal_i(stats.consecutive_days, 3); } // --------------------------------------------------------------------------------------- // Test that the sleep reward triggers when it should, and doesn't trigger when it shouldn't void test_activity_insights__sleep_rewar...
/* * 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...
while (true) { APP_LOG(APP_LOG_LEVEL_ERROR, "Crash Demo Looping Log Spam! WarbleGarbleWarbleGarbleWarble"); }
} static void accel_data_handler(AccelData *data, uint32_t num_samples) { } static void trigger_to_app_event_flood(int index, void *context) { // Generate a crazy number of events and then busy wait. accel_data_service_subscribe(1, accel_data_handler); accel_service_set_sampling_rate(ACCEL_SAMPLING_100HZ); ...
verflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_clip_outside_x(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(80, 4, 72, 32), GTextOverflowModeTrailingElli...
(&layer, &draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset)
; layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_ny_descender); layer_render_tre...
fo); cl_assert_equal_i(res_info.res_app_num, SYSTEM_APP); cl_assert_equal_i(res_info.res_id, RESOURCE_ID_BIRTHDAY_EVENT_LARGE); // Set the TimelineResourceInfo to valid values timeline_res_info = (TimelineResourceInfo) { .app_id = &valid_app_data->install_entry.uuid, .res_id = (TimelineResourceId)Timel...
(&timeline_res_info, TimelineResourceSizeSmall, &res_info)
; cl_assert_equal_i(res_info.res_app_num, SYSTEM_APP); cl_assert_equal_i(res_info.res_id, RESOURCE_ID_HOTEL_RESERVATION_SMALL); // Even if the provided app UUID != UUID_SYSTEM timeline_res_info.app_id = &valid_app_data->install_entry.uuid; timeline_resources_get_id(&timeline_res_info, TimelineResourceSizeSmal...
ree)); fake_system_task_callbacks_invoke_pending(); after_size = app_cache_get_size(); cl_assert(after_size == (before_size - to_free)); } struct file_description { const char *name; size_t size; }; static struct file_description descriptions[] = { // this first set of files match some I found on my snowy...
{ // make sure nothing goes awry if there are no installed apps // create some 'standard' files for (uint32_t i = 0; i < ARRAY_LENGTH(descriptions); ++i) { prv_file_create(descriptions[i].name, descriptions[i].size); } // re-initialize the app-cache (which will attempt to purge resource files too) app_c...
m size *size = GSize(DISP_COLS, DISP_ROWS); return; } // Platform matches current platform const PlatformType sdk_platform = process_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; } ...
DEFINE_SYSCALL(void, sys_get_app_uuid, Uuid *uuid)
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(uuid, sizeof(*uuid)); } *uuid = 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...
/* * 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...
DEFINE_SYSCALL(void, sys_analytics_max, AnalyticsMetric metric, int64_t val, AnalyticsClient client)
{ analytics_max(metric, val, client); }
------------------------------------------------------------ void accel_data_service_subscribe(uint32_t samples_per_update, AccelDataHandler handler) { AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_data_subscribe(session, samples_per_update, handler); } // ----...
{ AccelServiceState *state = context; if (state->shake_handler != NULL) { state->shake_handler(e->accel_tap.axis, e->accel_tap.direction); } }
// ---------------------------------------------------------------------------------------------- // Event service handler for double tap events static void prv_session_do_double_tap_handle(PebbleEvent *e, void *context) { AccelServiceState *state = context; if (state->double_tap_handler != NULL) { state->do...
break; case NUM_BUTTONS: break; } PBL_ASSERTN(key); pref.enabled = enabled; prv_pref_set(key, &pref, sizeof(pref)); } void quick_launch_set_quick_launch_setup_opened(uint8_t version) { if (s_quick_launch_setup_opened != version) { s_quick_launch_setup_opened = version; prv_pref_set(P...
{ s_activity_prefs_health_app_opened = version; prv_pref_set(PREF_KEY_ACTIVITY_HEALTH_APP_OPENED, &s_activity_prefs_health_app_opened, sizeof(s_activity_prefs_health_app_opened)); }
} uint8_t activity_prefs_get_workout_app_opened_version(void) { return s_activity_prefs_workout_app_opened; } void activity_prefs_set_workout_app_opened_version(uint8_t version) { if (s_activity_prefs_workout_app_opened != version) { s_activity_prefs_workout_app_opened = version; prv_pref_set(PREF_KEY_AC...
/* * 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(GBITMAP_NATIVE_FORMAT, GBitmapFormat8BitCircular)
; GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, true, 1); cl_assert_equal_i(ctx.dest_bitmap.info.format, GBitmapFormat8BitCircular); memset(ctx.dest_bitmap.addr, GColorRedARGB8, FRAMEBUFFER_SIZE_BYTES); GRect radial_container_rect ...
/* * 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...
{ net16 protocol; net16 length; unsigned char information[]; }
PushPacket; static const unsigned char s_message_header[] = { // Message type: text 1, // Source filename 'B', 'O', 'O', 'T', 'L', 'O', 'A', 'D', 'E', 'R', 0, 0, 0, 0, 0, 0, // Log level and task '*', '*', // Timestamp 0, 0, 0, 0, 0, 0, 0, 0, // Line number 0, 0, }; static size_t s_message_length...
governing permissions and * limitations under the License. */ #include "sharp_ls013b7dh01.h" #include "applib/graphics/gtypes.h" #include "board/board.h" #include "debug/power_tracking.h" #include "drivers/dma.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/spi.h" #include "kernel...
gpio_release(BOARD_CONFIG_DISPLAY.spi_gpio)
; if (BOARD_CONFIG.power_5v0_options != OptionNotPresent) { // +5V to 5V_EN pin gpio_output_set(&BOARD_CONFIG.power_ctl_5v0, true); } // +5V to LCD_DISP pin (Set this pin low to turn off the display) gpio_output_set(&BOARD_CONFIG_DISPLAY.on_ctrl, true); periph_config_release_lock(); } uint32_t dis...
izers[button_id].config; cfg->click.repeat_interval_ms = 0; cfg->click.handler = handler; if (button_id == BUTTON_ID_BACK) { window_set_overrides_back_button(window, true); } } void window_single_repeating_click_subscribe(ButtonId button_id, uint16_t repeat_interval_ms, ClickHandler handler) { prv_chec...
{ return; }
(recognizer, &s_test_impl)
; cl_assert_equal_i(data->test, TEST_PATTERN); if (data->failed) { cl_assert_equal_b(*data->failed, false); *data->failed = true; } } static void prv_sub_event_handler(const Recognizer *recognizer, RecognizerEvent event) { RecognizerEvent *event_type = recognizer_get_user_data(recognizer); if (event_...
_path_num_points, 2); cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points2, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(points2, s_fill_points, s_path_num_points)); prv_reset();...
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(); // make fill color transparent (nothing should be drawn because the stroke width is zero and the // fill is transparent GColor co...
|| strncmp(buf, "05", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"d\": %s", buf); } r = strftime(buf, buf_size, "%D", &good_data); if (r == 0 || strncmp(buf, "05/05/15", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"D\": %s", buf); } r = strftime(buf, buf_size, "%e",...
(buf, buf_size, "%y", &good_data)
RADIUS_MAX_PRECOMPUTED 2 #define RADIUS_SMALL 1 #define RADIUS_NONE 0 #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 30, 40) #define CENTER_OF_ORIGIN_RECT GPoint(20, 25) #define CENTER_OF_ORIGIN_RECT_N...
layer_render_tree(&layer, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_x_offset...
ine_draw_precise_stroked(ctx, top_left, top_right); graphics_line_draw_precise_stroked(ctx, top_right, bottom_right); graphics_line_draw_precise_stroked(ctx, bottom_right, bottom_left); graphics_line_draw_precise_stroked(ctx, bottom_left, top_left); } // This takes care of all routines since it re-uses existing ...
graphics_draw_rect(ctx, rect)
; } else { #if PBL_COLOR if (ctx->draw_state.antialiased) { if (ctx->draw_state.stroke_width > 1) { // Antialiased and Stroke Width > 1 // Note: stroke width == 2 is rounded down to stroke width of 1 prv_draw_round_rect_aa_stroked(ctx, rect, radius, ctx->draw_state.stroke_width); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&ctx.dest_bitmap, "blendtest_0_100.pbi")
); // Reset canvas setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_bitmap_in_rect(&ctx, background_33_66, &ORIGIN_RECT_NO_CLIP); // 33% alpha channel blend test color = 0x0; alpha = 0x40; for (int i=0; i < 64; i++) { prv_test_plot_horizontal_line(&ctx.d...
age_ack(APP_MSG_OK); // Chunk is ignored, no new reset request is sent out. EXPECT_OUTBOX_NO_MESSAGE_PENDING(); // TODO: timeout + retry ResetRequest if no ResetComplete follows within N secs. } void test_rocky_api_app_message__awaiting_reset_complete_loc_init__(void) { prv_init_and_goto_awaiting_reset_compl...
(false /* start_connected */)
; ASSERT_JS_GLOBAL_EQUALS_I("d", 1); prv_simulate_transport_connection_event(true /* is_connected */); ASSERT_JS_GLOBAL_EQUALS_I("c", 0); ASSERT_JS_GLOBAL_EQUALS_I("d", 1); prv_postmessageconnected_postmessagedisconnected_negotiate_to_open_session(); ASSERT_JS_GLOBAL_EQUALS_I("c", 1); ASSERT_JS_GLOBAL_EQU...
/* * 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 (app_manager_get_task_context()->closing_state == ProcessRunState_Running) { data->button_pressed = e->button.button_id; switch (e->type) { case PEBBLE_BUTTON_DOWN_EVENT: click_recognizer_handle_button_down(&data->click_manager.recognizers[e->button.button_id]); break; case PEBBLE_BUTTON_...
#else if ((e->button.button_id == BUTTON_ID_SELECT) && (e->type == PEBBLE_BUTTON_DOWN_EVENT)) { app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = system_app_state_machine_get_last_registered_app(), .common.reason = APP_LAUNCH_USER, .common.button = e->button.button_id, }); ...
Y_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 the user // to a new setting automatically return DEFAULT_IDX; } static void prv_window_timeout_menu_select(OptionM...
{ case PEBBLE_BATTERY_CONNECTION_EVENT: // Redraw the menu so that the Vibration status will be re-rendered. settings_menu_mark_dirty(SettingsMenuItemNotifications); break; default: break; }
} static void prv_expand_cb(SettingsCallbacks *context) { SettingsNotificationsData *data = (SettingsNotificationsData *) context; data->battery_connection_event_info = (EventServiceInfo) { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .handler = prv_settings_notifications_event_handler, }; event_service_...
BL_IF_ROUND_ELSE(63, background_width); const int16_t back_value_y_offset = STATUS_BAR_LAYER_HEIGHT + PBL_IF_ROUND_ELSE(24, 0); const int16_t mid_value_y_offset = back_value_y_offset + PBL_IF_ROUND_ELSE(30, 26); const int16_t front_value_y_offset = mid_value_y_offset + PBL_IF_ROUND_ELSE(30, 40); const int16_t d...
layer_set_hidden(text_layer_get_layer(data->disconnected_text), 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...
gap_le_connect_cancel_all(GAPLEClientApp)
abled // - 1 stop bit // - no flow control dev->periph->CR1 &= ~USART_CR1_UE; dev->periph->CR2 = (dev->do_swap_rx_tx ? USART_CR2_SWAP : 0); dev->periph->CR3 = (dev->half_duplex ? USART_CR3_HDSEL : 0); dev->periph->CR1 = cr1_extra_flags | USART_CR1_UE; dev->state->initialized = true; // initialize the ...
(dev->irq_channel, dev->irq_priority)
tributed 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 "console/control_protocol.h" #include "console/control_protoco...
hton16(LCP_HEADER_LEN)
, }; pulse_link_send(packet, LCP_HEADER_LEN); } static void prv_send_terminate_ack(PPPControlProtocol *this, int identifier) { if (identifier < 0) { // Not in response to a Terminate-Request // Pick an arbitrary identifier to send in ack identifier = this->state->next_terminate_id++; } else { // U...
]; uint32_t idx; } TouchEventContext; static void prv_touch_event_dispatch_cb(const TouchEvent *event, void *context) { TouchEventContext *ctx = context; cl_assert(ctx->idx < ARRAY_LENGTH(ctx->touch_events)); ctx->touch_events[ctx->idx++] = *event; } void test_touch__dispatch_touch_events_single_finger(void) ...
(0, TouchState_FingerDown, &GPoint(15, 15), 6, 3686440)
; // make sure that another event is, in fact, pended event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable); TouchEventContext ctx = { .idx = 0 }; // handle first TouchesAvailable event touch_dispatch...
se kino_layer_set_reel(&s_phone_ui_data->icon_layer, image, true); s_phone_ui_data->current_icon = image; s_phone_ui_data->current_icon_id = resource; #endif } #if !PLATFORM_TINTIN static void prv_update_color_boundary(void *subject, int16_t boundary) { s_phone_ui_data->bg_color.boundary = boundary; layer_ma...
phone_format_phone_number(caller_text, s_phone_ui_data->caller_id_text_buf, NAME_BUFFER_LENGTH)
; text_layer_set_overflow_mode(&s_phone_ui_data->caller_id_text_layer, GTextOverflowModeWordWrap); } else { phone_format_caller_name(caller_text, s_phone_ui_data->caller_id_text_buf, NAME_BUFFER_LENGTH); } if (s_phone_ui_data->style->large_caller_id) { caller_id_font = s_phone_ui_data->name_font; ...
me_buf); // June 12th 2015, 00:29:30 (T-11:30:30) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (29 * SECONDS_PER_MINUTE) + 30); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 12 H", time_buf); // June 12th 2015, 00:29:59 (T-11:30:01) ...
("10 MIN AGO", time_buf)
; // June 9th 2015, 12:10:59 (T+00:10:59) rtc_set_time(event_time + (10 * SECONDS_PER_MINUTE) + 59); 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:59:29 (T+00:59:29) rtc_set_time(event_time + (59 ...
on *session, const uint8_t* data, size_t length); typedef void SendBuffer; SendBuffer *comm_session_send_buffer_begin_write(CommSession *session, uint16_t endpoint_id, size_t required_payload_length, uint32_t timeout_ms)...
cl_assert(did_sync_cancel)
; } static const uint8_t s_start_writeback_response_success[] = { BLOB_DB_COMMAND_WRITEBACK_RESPONSE, // cmd 0x12, 0x34, // token BLOB_DB_SUCCESS, // response }; static const uint8_t s_start_writeback_response_error[] = { BLOB_DB_COMMAND_WRITEBACK_RESPONSE, // c...
uired 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. */ #includ...
(sizeof(AppData))
(samples_collected < 5) { return; // wait a few samples for ramp up error to stabilize } int16_t new_corr[3]; MagCalStatus cal_status = ecomp_corr_add_raw_mag_sample((int16_t *)&mag_data, (s_saved_corr_present) ? s_saved_corr : NULL, new_corr); if (cal_status != MagCalStatusNoSolution) ...
(buffer, sizeof(buffer), "Mx=%d, My=%d, Mz=%d", s_last_mag_sample.x, s_last_mag_sample.y, s_last_mag_sample.z)
; } #endif // RECOVERY_FW
-208, 376, -920}, { -184, 272, -904}, { -144, 488, -1152}, { -144, 352, -944}, { -104, 448, -952}, // 152 seconds { -152, 344, -888}, { -152, 288, -872}, { -136, 296, -936}, { -112, 368, -944}, { -136, 384, -984}, { -112, 488, -1048}, { -160, 312, -848}, { -88, 408, -...
{ -176, 480, -936}, { -192, 328, -968}, { -168, 456, -1040}, { -192, 416, -944}, { -176, 464, -992}, { -176, 480, -952}, { -184, 488, -928}, { -176, 456, -912}, { -240, 528, -928}, { -184, 472, -968}, { -184, 496, -936}, { -192, 504, -960}, { -176, 456, -872}, { -...
{ -168, 488, -872}, { -176, 384, -936}, { -224, 440, -872}, { -176, 432, -936}, { -176, 400, -896}, { -184, 376, -960}, { -176, 560, -896}, { -248, 320, -832}, { -160, 584, -904}, // 160 seconds { -184, 368, -824}, { -112, 520, -784}, { -96, 304, -1024}, { -136, ...
/* * 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, "settings_raw_iter logic error. " "Attempting to read affected file into RAM for easier debugging...")
; uint8_t *contents = read_file_into_ram(iter); PBL_LOG(LOG_LEVEL_INFO, "Removing affected file %s...", iter->file_name); // Remove the file that caused us to get into this state before we reboot, // that way we should be able to avoid getting into a reboot loop. pfs_close_and_remove(iter->fd); PBL_LOG(LOG_...
include "fake_spi_flash.h" #include "fake_system_task.h" // We start time out at 5pm on Jan 1, 2015 for all of these tests static const struct tm s_init_time_tm = { // Thursday, Jan 1, 2015, 5:pm .tm_hour = 17, .tm_mday = 1, .tm_mon = 0, .tm_year = 115 }; #define ACTIVITY_FIXTURE_PATH "activi...
{ fake_system_task_callbacks_invoke_pending(); }
s_queue_value--; return true; } signed portBASE_TYPE xQueueGenericSend(QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, portBASE_TYPE xCopyPosition) { PBL_ASSERTN(xQueue == QUEUE_HANDLE); s_queue_value++; return true; } QueueHandle_t xQ...
/* * 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...
(destination, info->load_size)
; for (uint32_t i = 0; i < info->num_reloc_entries; ++i) { // an absolute pointer to an app-relative pointer which needs to be offset uintptr_t *addr_to_change = prv_offset_to_address(destination, reloc_array[i]); *addr_to_change = (uintptr_t) prv_offset_to_address(destination, *addr_to_change); } /...
tats(true); stub_pebble_tasks_set_current(TEST_TARGET_TASK); s_num_messages_to_consume_from_handler = 0; s_can_send_event = true; s_dropped_idx = 0; memset(s_dropped_messages, 0, sizeof(s_dropped_messages)); s_message_idx = 0; memset(s_messages, 0, sizeof(s_messages)); } void test_app_inbox__cleanup(void...
cl_assert_equal_b(false, app_inbox_service_has_inbox_for_tag(AppInboxServiceTagUnitTestAlt))
; fake_kernel_malloc_mark_assert_equal(); } void test_app_inbox__app_inbox_create_and_register_tag_already_associated(void) { bool success; uint8_t storage[BUFFER_SIZE]; success = app_inbox_service_register(storage, sizeof(storage), test_message_handler, test_dropped_han...
contains((const ListNode *) s_fake_transport_head, (const ListNode *) fake_transport), true); CommSession *session = fake_transport->session; PebbleProtocolHeader pp_header; uint8_t *buffer = kernel_malloc(1024); while (circular_buffer_copy(&session->send_buffer, (uint8_t *) &pp_...
{ cl_assert_equal_i(data_node->endpoint_id, endpoint_id); cl_assert_equal_i(data_node->length, length); cl_assert_equal_m(data_node->data, data, length); }
data_node = (DataNode *) data_node->node.next; } } void fake_transport_assert_nothing_sent(Transport *transport) { cl_assert(transport); FakeTransport *fake_transport = (FakeTransport *)transport; DataNode *data_node = fake_transport->sent_data; cl_assert_equal_p(data_node, NULL); } void fake_transpor...
/* * 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...
filter(i, value, context)
8(prop_h, &test_value); cl_assert(gcolor_equal(test_value, set_value)); property_animation_set_from_gcolor8(prop_h, &start_value); // Start, we should start at the start values prv_advance_to_ms_with_timers(start_ms + 1); cl_assert(gcolor_equal(value, start_value)); // Halfway through prv_advance_to_ms...
prv_fire_animation_timer()
; time_ms = prv_now_ms(); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, layer.frame.size.w, layer.frame.size.h); cl_assert(max_loops > 0); max_loops--; } // Make sure the frame reached the "to" state cl_ass...
pected"); _Static_assert(sizeof(size_t) <= 4, "size_t larger than expected"); _Static_assert(sizeof(ptrdiff_t) <= 4, "ptrdiff_t larger than expected"); static void prv_start_tx(void); void debug_uart_init(void); // LogBuffer -- Circular buffer & control for the log hashing output buffer typedef struct LogBuffer {...
pm_register_adapter(&s_ad_uart_pm_call_backs)
; } static void prv_uart_tx_callback(void *user_data, uint16_t written) { prv_lock(); s_log_buffer.transmitting = false; circular_buffer_consume(&s_log_buffer.circular_buffer, written); // Attempt to kick off another transmit prv_start_tx(); prv_unlock(); } //! Must be in a critical section (interrupts o...
>state = RecognizerState_Failed; recognizer_cancel(r); cl_assert_equal_i(r->state, RecognizerState_Failed); cl_assert_equal_b(cancelled, false); cl_assert_equal_i(rec_event, -1); r->state = RecognizerState_Cancelled; recognizer_cancel(r); cl_assert_equal_i(r->state, RecognizerState_Cancelled); cl_asser...
(r, &(TouchEvent) { .type = TouchEvent_Touchdown })
; cl_assert_equal_i(last_touch_event.type, TouchEvent_Touchdown); cl_assert_equal_b(updated, true); cl_assert_equal_i(rec_event, RecognizerEvent_Completed); } static bool prv_filter(const Recognizer *recognizer, const TouchEvent *touch_event) { bool *allow = recognizer_get_user_data(recognizer); return *allo...
, sizeof(font_cache->cache_keys)); memset(font_cache->cache_data, 0, sizeof(font_cache->cache_data)); keyed_circular_cache_init(&font_cache->line_cache, font_cache->cache_keys, font_cache->cache_data, sizeof(LineCacheData), LINE_CACHE_SIZE); resource_init(); } void test_text_resource...
(horiz_advance != 0)
; cl_assert_equal_i(horiz_advance, text_resources_get_glyph_horiz_advance(&s_font_cache, WILDCARD_CODEPOINT, &s_font_info)); const GlyphData *glyph = text_resources_get_glyph(&s_font_cache, WILDCARD_CODEPOINT, &s_font_info); cl_assert_equal_i(glyph->heade...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
dialog_set_background_color(dialog, GColorLightGray)
; dialog_set_icon(dialog, RESOURCE_ID_BATTERY_ICON_CHARGING_LARGE); } static void prv_update_ui_warning(Dialog *dialog, void *context) { const BatteryWarningDisplayData *data = context; const uint32_t percent = data->percent; dialog_set_background_color(dialog, data->background_color); const size_t warning_l...
VEL_DEBUG, "Error with \"b\": %s", buf); } r = strftime(buf, buf_size, "%B", &good_data); if (r == 0 || strncmp(buf, "May", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"B\": %s", buf); } r = strftime(buf, buf_size, "%c", &good_data); if (r == 0 || strncmp(buf, "Tue May 5 11:04:49 2015...
(buf, "18", buf_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...
{ bool is_supervisory:1; bool is_unnumbered:1; // is_unnumbered=true is unsupported enum SupervisoryKind kind:2; char _reserved:4; bool poll_or_final:1; uint8_t ack_number:7; }
s; } ReliablePacket; static PulseControlMessageProtocol s_reliable_pcmp = { .send_begin_fn = pulse_reliable_send_begin, .send_fn = pulse_reliable_send, }; _Static_assert(sizeof((ReliablePacket){0}.i) == 6, "sizeof ReliablePacket.i is wrong"); _Static_assert(sizeof((ReliablePacket){0}.s) == 2, ...
/* * 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...
(destbuf, "lariousness", 6)
; cl_assert_equal_m(expectbuf, destbuf, 9); } void test_strcat__n_return(void) { char destbuf[9] = "hi"; char expectbuf[9] = "hilarity"; cl_assert_equal_p(strncat(destbuf, "larity", 6), destbuf); }
24, 0}, { 1320, -48, 56}, { 1208, -64, 48}, { 1176, -32, 32}, // 24 seconds { 1056, -80, 80}, { 936, -136, 96}, { 864, -104, 56}, { 784, -72, -8}, { 808, 0, -88}, { 880, -8, -104}, { 896, -96, -168}, { 1288, -240, -56}, { 1424, -120, -168}, { 1112, -80, -224}, ...
{ 768, -72, -696}, { 632, 80, -720}, { 728, 144, -736}, { 600, 64, -624}, { 576, 64, -584}, { 560, 88, -496}, { 528, 56, -536}, { 584, 8, -544}, { 528, 0, -544}, { 736, 64, -600}, { 672, -8, -480}, { 736, -8, -376}, { 776, 40, -400}, { 992, 72, -288}, { 1192, ...
{ 1312, -152, -248}, // 32 seconds { 960, -120, -136}, { 1040, -80, -104}, { 1408, -120, 0}, { 1344, -120, 32}, { 1120, -96, 56}, { 1040, -112, 48}, { 1016, -80, -16}, { 992, -96, 32}, { 864, -96, 16}, { 832, -96, -88}, { 808, -152, -176}, { 840, -176, -160}, ...
-56}, { 304, -48, -160}, { 544, 0, -152}, { 920, 208, -72}, { 1256, 224, -232}, // 10 seconds { 2016, 432, -384}, { 2384, 576, -424}, { 1416, 640, -256}, { 1136, 368, -200}, { 1440, 456, -248}, { 1056, 744, 0}, { 864, 680, -88}, { 976, 848, -216}, { 1048, 1072, -2...
{ 1080, 752, -360}, { 1200, 712, -312}, { 1360, 608, -240}, { 1328, 424, -192}, { 1112, 256, -152}, { 1032, 216, -136}, { 1168, 232, -136}, { 1224, 184, -128}, { 1288, 192, -80}, { 1192, 152, -80}, { 1032, 152, -160}, { 920, -40, -72}, { 368, -216, 16}, { 728, 80,...
{ 1200, 264, -336}, { 1320, 424, -272}, // 18 seconds { 1384, 872, -312}, { 1416, 656, -256}, { 1096, 968, -232}, { 920, 1064, -128}, { 1104, 960, -104}, { 1064, 992, -48}, { 1104, 704, -80}, { 1152, 632, -64}, { 1296, 584, -104}, { 1144, 328, -128}, { 1064, 288,...
072}, { -8, 128, -856}, { -48, 104, -768}, { -112, 128, -792}, { -64, 40, -792}, { -56, 80, -928}, // 48 seconds { -56, 192, -1088}, { 24, 136, -1248}, { 248, 72, -1208}, { 72, 96, -1208}, { 216, 248, -1336}, { 328, 152, -1152}, { 248, 208, -1112}, { 192, 144, -95...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_temp_95861_2 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { 104, 192, -1008}, { ...
s { i18n_ctx_noop("TmplStringSing", " second"), /// Plural suffix for seconds with full units i18n_ctx_noop("TmplStringPlur", " seconds")}, }; static const char * const s_minute_strings[3][2] = { /// Singular suffix for minutes with no units { i18n_ctx_noop("TmplStringSing", ""), /// Plural suffix for mi...
(state, suffix_strings[add_units][value != 1])
; } // This is a recursive function, so watch out! // The recursion happens on the %R and %T cases only, and will only recurse once. // So when adding stack variables, realize the stack usage may be doubled! T_STATIC const char *prv_template_format_specifier(TemplateStringState *state, const char *input, ...
-800}, { -64, 328, -968}, { -168, 368, -1064}, { -232, 400, -1184}, { -200, 424, -1152}, { -280, 480, -1152}, { -120, 616, -1176}, // 18 seconds { -128, 480, -968}, { -136, 560, -984}, { -80, 448, -880}, { -40, 320, -728}, { -136, 304, -704}, { -192, 296, -720}, {...
{ 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},...
{ 96, 240, -672}, { -16, 192, -656}, { -88, 144, -744}, { -144, 208, -896}, // 26 seconds { -136, 248, -952}, { -304, 392, -1176}, { -152, 464, -1312}, { -112, 400, -1240}, { -168, 696, -1408}, { 8, 568, -1184}, { -24, 504, -1016}, { -32, 488, -928}, { 56, 336, -...
BEntry *prv_create_entry(const WeatherDBEntry *base_entry, char *location, char *phrase, size_t *size_out) { PascalString16List pstring16_list; PascalString16 *location_name; PascalString16 *short_phrase; size_t data_size; location_name = pstring_create_pstring16_from_...
(to_check->last_update_time_utc, original->last_update_time_utc)
mation and then clips a full-screen red rectangle to the resulting mask static void prv_left_flip_half_frame_clipping(GContext *ctx) { compositor_round_flip_transitions_flip_animation_update(ctx, ANIMATION_NORMALIZED_MAX / 2, CompositorTransitionDirectionLeft...
{ compositor_round_flip_transitions_flip_animation_update(ctx, ANIMATION_NORMALIZED_MAX / 2, CompositorTransitionDirectionRight, GColorWhite); }
void test_graphics_window_stack_animation__right_flip_half_frame_clipping(void) { prv_test_clipping_mask(prv_right_flip_half_frame_clipping, "right_flip_half_frame_clipping"); }; // This test records a clipping mask of the 3/4 progress frame of the right "round flip" compositor // transition animation and then cli...
88, 360, -192}, { 904, 328, -96}, // 10 seconds { 816, 240, -40}, { 680, 176, -16}, { 600, 176, -32}, { 608, 208, -40}, { 752, 176, -72}, { 928, 176, -8}, { 992, 144, -8}, { 1056, 160, -72}, { 1064, 176, -56}, { 1120, 184, -136}, { 1232, 232, -144}, { 1096, 200, -...
{ 576, 216, -120}, { 864, 248, -144}, { 1240, 328, -192}, { 1176, 400, -304}, { 1216, 392, -248}, { 1360, 440, -232}, { 1120, 400, -160}, { 920, 336, -120}, { 1056, 376, -104}, { 1192, 360, -40}, { 1016, 264, 0}, { 768, 192, 16}, // 16 seconds { 592, 240, -32}, ...
{ 1152, 328, -64}, { 1184, 304, -48}, { 1032, 304, 0}, { 840, 232, -8}, { 672, 232, -40}, { 688, 72, 32}, { 712, 224, 0}, { 784, 64, 32}, { 856, 40, 8}, { 1008, 104, -64}, { 1080, 128, -136}, { 1208, 176, -160}, { 1328, 160, -8}, { 1120, 208, -80}, { 1224, 25...
tx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(34, 4, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_outside_ny(Layer* me, GContext* ctx) { graphics_context_set_t...
test_graphics_context_reset(&ctx, fb)
left_pixel, fill_byte, bytes); } break; } uint8_t *const from = delta_neg ? right_pixel : left_pixel; uint8_t *const to = delta_neg ? left_pixel : right_pixel; uint8_t *const garbage_start = delta_neg ? left_pixel + bytes - delta_bytes : left_pixel; if (delt...
for (int16_t y = start_y; y != end_y; y -= iterate_dir) { const GBitmapDataRowInfo dst_row_info = gbitmap_get_data_row_info(bitmap, y + delta_y); const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(bitmap, y); switch (bpp) { case 1: { // Note: this doesn't care about the boundin...
} GColor graphics_private_sample_line_color(const GBitmap *bitmap, GColorSampleEdge edge, GColor fallback) { if (!bitmap) { return fallback; } GColor color = fallback; const int bpp = gbitmap_get_bits_per_pixel(bitmap->info.format); const int16_t min_x = bitm...
ion bar icon bitmaps. data->up_bitmap = gbitmap_create_from_png_data(s_golf_api_up_icon_png_data, sizeof(s_golf_api_up_icon_png_data)); data->down_bitmap = gbitmap_create_from_png_data(s_golf_api_down_icon_png_data, ...
PBL_IF_ROUND_ELSE(24, 0)
; const int16_t mid_value_y_offset = back_value_y_offset + PBL_IF_ROUND_ELSE(30, 26); const int16_t front_value_y_offset = mid_value_y_offset + PBL_IF_ROUND_ELSE(30, 40); const int16_t disconnected_text_y_offset = mid_value_y_offset + PBL_IF_ROUND_ELSE(-5, 8); const int16_t stroke_box_width = PBL_IF_ROUND_ELSE...
en(TEST_FILE_C_NAME, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof (s_test_file_c)); for (unsigned int i = 0; i < ARRAY_LENGTH(s_test_file_c); ++i) { s_test_file_c[i] = 'c'; } pfs_write(fd, (uint8_t *)s_test_file_c, sizeof(s_test_file_c)); pfs_close(fd); } void test_pfs__cleanup(void) { fake_spi_flash_cl...
("toobig", OP_FLAG_READ, 0, 0)
; cl_assert(fd == E_DOES_NOT_EXIST); fd = pfs_open(NULL, OP_FLAG_READ, 0, 0); cl_assert(fd == E_INVALID_ARGUMENT); fd = pfs_open("newfile2", OP_FLAG_WRITE, FILE_TYPE_STATIC, 8000); cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); } void test_pfs__page_lookup_cache(void) { // create fragmentat...
/* * 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, "Not setting timer.")
; } else if (new_timer_start(s_timer, timeout_ms, prv_new_timer_callback, NULL, 0)) { PBL_LOG(LOG_LEVEL_DEBUG, "Set timer for %u", timeout_ms); } else { PBL_LOG(LOG_LEVEL_ERROR, "Could not start timer."); } } static bool prv_should_use_item(TimelineEventState *state, SerializedTimelineItemHeader *header)...
{ // PercentTier_BelowAverage .body = i18n_noop("Resting is fine, but try to recover and step it up tomorrow!"), .detail_text = i18n_noop("NOT VERY ACTIVE"), }, { // PercentTier_Fail .body = i18n_noop("Resting is fine, but try to recover and step it up tomorrow!"), .detail_text = i18...
i18n_get(notif_config->text_body, &notif_attr_list)
, notif_config->icon, notif_config->insight_type, ActivitySessionType_None); AttributeList positive_attr_list = {0}; attribute_list_add_cstring(&positive_attr_list, AttributeIdTitle, ...
ULL, inline static void* get_callback_context(ScrollLayer *scroll_layer) { return scroll_layer->context ? scroll_layer->context : scroll_layer; } void scroll_layer_draw_shadow_sublayer(Layer *shadow_sublayer, GContext* ctx) { ScrollLayer *scroll_layer = (ScrollLayer *)(((uint8_t*)shadow_sublayer) - offsetof(Scroll...
{ scroll_layer->layer.frame = rect; layer_mark_dirty(&scroll_layer->layer); }
void scroll_layer_add_child(ScrollLayer *scroll_layer, Layer *child) { layer_add_child(&scroll_layer->content_sublayer, child); } GPoint scroll_layer_get_content_offset(ScrollLayer *scroll_layer) { return scroll_layer->content_sublayer.bounds.origin; } T_STATIC void prv_scroll_layer_set_content_offset_internal...
GPIO_PuPd_NOPULL; gpio_cfg.GPIO_Mode = GPIO_Mode_AF; gpio_cfg.GPIO_Speed = GPIO_Speed_50MHz; gpio_cfg.GPIO_Pin = (1 << FLASH_CONFIG.miso_pin) | (1 << FLASH_CONFIG.mosi_pin); GPIO_Init(FLASH_CONFIG.spi_gpio, &gpio_cfg); // Configure the SCLK pin to have a weak pull-down to put it in a known state // when SC...
prv_flash_read_next_byte()
; prv_flash_end_cmd(); prv_disable_flash_spi_clock(); return ((manufacturer << 16) | (type << 8) | capacity); } static bool prv_check_whoami(uint32_t spi_flash_id) { return spi_flash_id == EXPECTED_SPI_FLASH_ID_32MBIT || spi_flash_id == EXPECTED_SPI_FLASH_ID_64MBIT; } static bool prv_is_whoami_correct(v...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
uuid_equal(&system, &invalid)
); const Uuid test_uuid_1 = (Uuid) { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; // Different at the start Uuid test_uuid_2 = test_uuid_1; ++test_uuid_2.byte0; // Different at the end Uuid test_uuid_3 = test_uuid_1; ++test_uuid_3.byte15; cl_assert(uuid_equal(&test_uuid_1, &test_uuid_1))...
ctZero); layer_add_child(root, &layer_a); manager.window = &window; manager.active_layer = &layer_a; recognizer_add_to_list(r1, &layer_a.recognizer_list); recognizer_add_to_list(r2, &layer_a.recognizer_list); RecognizerManager manager2; recognizer_set_manager(r1, &manager2); recognizer_manager_dereg...
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered)
; cl_assert_equal_p(manager.triggered, r[0]); cl_assert_equal_p(manager.active_layer, &layer_a); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(r[0]->state, RecognizerState_Started); cl_assert_equal_i(r[1]->state, RecognizerState_Failed); r[0]->state = RecognizerState_U...
EventServiceAddSubscriberCallback start_cb, EventServiceRemoveSubscriberCallback stop_cb) {} void sys_vibe_history_start_collecting(void) {} void sys_vibe_history_stop_collecting(void) {} int32_t sys_vibe_get_vibe_strength(void) { return 0; } void accel_set_shake_sensitivity_high(bool ...
(tasks[i])
ad it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(!ret); // Add the pairing again id = bt_persistent_storage_store_bt_classic_pairing(&addr_in, &link_key_in, ...
cl_assert(!ret)
_draw_arrow(ctx, &arrow_rect, ContentIndicatorDirectionUp, fg_color, bg_color, GAlignTop); } if (num_rows - row >= SHORT_ITEM_MAX_ROWS_SPALDING) { grect_align(&arrow_rect, aml_bounds, GAlignBottom, true /* clip */); content_indicator_draw_arrow(ctx, &arrow_rect, Co...
{ if (aml->layout_cache.item_heights) { applib_free(aml->layout_cache.item_heights); } prv_unschedule_item_animation(aml); #ifndef RECOVERY_FW gbitmap_deinit(&aml->item_animation.fade_top); gbitmap_deinit(&aml->item_animation.fade_bottom); #endif menu_layer_deinit(&aml->menu_layer); }
ActionMenuLayer *action_menu_layer_create(GRect frame) { ActionMenuLayer *aml = applib_zalloc(sizeof(ActionMenuLayer)); if (!aml) { return NULL; } action_menu_layer_init(aml, &frame); return aml; } void action_menu_layer_destroy(ActionMenuLayer *aml) { if (!aml) { return; } action_menu_laye...
/* * 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_fill_rect(ctx, &data->box_rect)
; graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &data->box_rect); } void prv_redraw_timer_cb(void *cb_data) { AppData *data = app_state_get_user_data(); prv_move_rect(data); layer_mark_dirty(&data->window.layer); app_timer_register(1000 / TARGET_FPS, prv_redraw_timer_cb,...
/* * 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...
MIN(100, progress_percent)
; layer_mark_dirty(&progress_layer->layer); } void progress_layer_update_proc(ProgressLayer* progress_layer, GContext* ctx) { const GRect *bounds = &progress_layer->layer.bounds; int16_t progress_bar_width_px = scale_progress_bar_width_px(progress_layer->progress_percent, ...
itations under the License. */ #include "music_internal.h" #include "apps/system_apps/music_app.h" #include "drivers/rtc.h" #include "kernel/events.h" #include "process_management/app_manager.h" #include "shell/system_app_ids.auto.h" #include "os/mutex.h" #include "os/tick.h" #include "system/logging.h" #include "ut...
{ // Upon connect and disconnect, reset the cached data: music_update_player_volume_percent(0); // Taking short-cut here, music_update_now_playing already puts NowPlayingChanged event, no // need to put it again by calling music_update_player_name: s_music_ctx.player_name[0] = 0; music_update_n...
mutex_unlock_recursive(s_music_ctx.mutex); return (change_type != None); } const char * music_get_connected_server_debug_name(void) { const char *debug_name = NULL; mutex_lock_recursive(s_music_ctx.mutex); if (s_music_ctx.implementation) { debug_name = s_music_ctx.implementation->debug_name; } mut...
istributed 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 "comm/ble/gatt_service_changed.h" #include "comm/ble/gap_le_connection.h" #include "kernel/e...
{ s_last_handle_discovery_result = Unknown; fake_gatt_init(); s_connection = (GAPLEConnection) { .gatt_connection_id = TEST_GATT_CONNECTION_ID, .gatt_service_changed_att_handle = 0, }; GATT_Start_Service_Discovery_Handle_Range(TEST_BT_STACK_ID, TEST_GATT_CONNECTION_ID, NULL, 0, NULL, ...
void test_gatt_service_changed_client__cleanup(void) { } // Discovery /////////////////////////////////////////////////////////// void test_gatt_service_changed_client__handle_non_gatt_profile_service(void) { fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID); cl_assert_equal_i(s...
ame_buffer(GContext *ctx, GBitmap *buffer) { PBL_ASSERTN(ctx); ctx->lock = false; framebuffer_dirty_all(ctx->parent_framebuffer); return true; } void test_action_menu_window__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_...
(&action_menu_window->window, &s_ctx)
; } #define GRID_CELL_PADDING 5 typedef void (*RenderCallback)(SettingsContentSize content_size, const ActionMenuLevel *root_level, unsigned int selected_index, unsigned int additional_crumbs); static void prv_prepare_canvas_and_render_for_each_size(RenderCallback callback, ...
status_t status_code) { InternalErrorResponse *resp = pulse_reliable_send_begin( PULSE2_BULKIO_PROTOCOL); resp->opcode = BULKIO_RESP_INTERNAL_ERROR; resp->status_code = status_code; size_t response_len = sizeof(*resp); size_t command_len = MIN(length, PULSE_MAX_SEND_SIZE - respons...
{ PulseTransferFD *pulse_fd = prv_get_fd(cmd, length); if (!pulse_fd) { // prv_get_fd has already sent an error response return; } status_t status = pulse_fd->impl->close_proc(pulse_fd->domain_state); if (FAILED(status)) { prv_respond_internal_error(cmd, length, status); return; } Close...
(count != 0); option_menu_set_icons_enabled(&data->option_menu, use_icons /* icons_enabled */); option_menu_set_choice(&data->option_menu, prv_get_chosen_row_index(data)); option_menu_reload_data(&data->option_menu); } // Settings Menu callbacks /////////////////////////// static void prv_select_cb(OptionMenu ...
if (row == 0) { title = i18n_get("None", data); } else { AppMenuNode *node = app_menu_data_source_get_node_at_index(data->data_source, row - 1); title = node->name; }
option_menu_system_draw_row(option_menu, ctx, cell_layer, text_frame, title, false, NULL); } static uint16_t prv_row_height_cb(OptionMenu *option_menu, uint16_t row, bool is_selected, void *context) { const int16_t cell_height = option_menu_default_cell_height(option_menu-...
/* * 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...
for (i = 0; i < len; ++i) { if (_clar_path[i] == '\\') _clar_path[i] = '/'; }
} #endif if (_clar_path[len - 1] != '/') { _clar_path[len++] = '/'; } strncpy(_clar_path + len, path_tail, sizeof(_clar_path) - len); #if defined(__MINGW32__) if (_mktemp(_clar_path) == NULL) return -1; if (mkdir(_clar_path, 0700) != 0) return -1; #elif defined(_WIN32) if (_mktemp_s(_clar_path, sizeof...
/* * 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...
{ SettingsFile settings_file; if (PASSED(prv_open(&settings_file))) { settings_file_delete(&settings_file, app_uuid, sizeof(*app_uuid)); settings_file_close(&settings_file); } }
ap_le_advert_unschedule((GAPLEAdvertisingJobRef)(uintptr_t) 0x1234); // Unschedule callback should not have been called: cl_assert_equal_i(s_unscheduled_cb_count, 0); } void test_gap_le_advert__deinit_unschedules(void) { BLEAdData *ad = create_ad(NULL, NULL); GAPLEAdvertisingJobTerm advert_term = { .min_...
{ regular_timer_fire_seconds(1); }
cl_assert_equal_b(gap_le_is_advertising_enabled(), true); // make sure we can remove a few jobs with the same advertisement type tag = GAPLEAdvertisingJobTagReconnection; gap_le_advert_unschedule_job_types(&tag, 1); // should have 3 jobs unscheduled at this point and 1 still running cl_assert_equal_i(s_...
/* * 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 (expect_is_handled) { cl_assert_equal_i(e.type, PEBBLE_MEDIA_EVENT); cl_assert_equal_i(e.media.type, PebbleMediaEventTypeTrackPosChanged); char artist[MUSIC_BUFFER_LENGTH]; char album[MUSIC_BUFFER_LENGTH]; char title[MUSIC_BUFFER_LENGTH]; music_get_now_playing(title, artist, album); cl...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_handle_measurement_msg(msg)
; break; case HcMessageID_HRM_Enable: hrm_service_handle_enable(((HcHrmEnableCmd *)msg)->enable); break; default: break; } } void hc_endpoint_hrm_update_subscription(const HcHrmSubscription *subscription) { hc_protocol_enqueue_with_payload(HcEndpointID_HRM, HcMessageID_HRM_UpdateS...
/* * 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...
RTC_WriteBackupRegister(RTC_TIMEZONE_ABBR_START, raw[0])
; RTC_WriteBackupRegister(RTC_TIMEZONE_ABBR_END_TZID_DSTID, raw[1]); RTC_WriteBackupRegister(RTC_TIMEZONE_GMTOFFSET, raw[2]); RTC_WriteBackupRegister(RTC_TIMEZONE_DST_START, raw[3]); RTC_WriteBackupRegister(RTC_TIMEZONE_DST_END, raw[4]); } void rtc_get_timezone(TimezoneInfo *tzinfo) { uint32_t *raw = (uint3...
{ s_watch_res_callback_called_count++; }
void test_resource__watch(void) { load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, PUG_FIXTURE_NAME, "pug"); ResourceCallbackHandle cb_handle = resource_watch(SYSTEM_APP, RESOURCE_ID_PUG, prv_res_changed_callback, NULL); cl_assert(cb_handle); // Callback should get invoked if resource was written ...
ample *data) { const int a_begin = 0; // index within the frame where accel data starts prv_convert_accel_raw_data_to_mgs(&frame_buf[a_begin], data); } static void prv_drain_fifo(void) { // we can't drain the fifo if we are in low power mode so we have // to temporarily enter normal mode bool was_low_power =...
(BOARD_CONFIG_ACCEL.accel_ints[i])
; } else { // disable exti_disable(BOARD_CONFIG_ACCEL.accel_ints[i]); } prv_read_modify_write(BMI160_REG_INT_OUT_CTRL, int_cfg, int_mask); BMI160_DBG("INT_OUT_CTRL = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_OUT_CTRL)); } } void bmi160_init(void) { gpio_input_init(&BOARD_CONFIG_ACCEL.accel_i...
(2 * SECONDS_PER_MINUTE)); // ---------------------------------------------------------------------------------- // Reset and try another case. Faster pace and taller person activity_stop_tracking(); fake_system_task_callbacks_invoke_pending(); const int k_height_mm_2 = 1830; activity_prefs_set_height_mm...
cl_assert_equal_i(health_service_peek_current_activities(), HealthActivityNone)
; int exp_value = 22 * SECONDS_PER_HOUR + 30 * SECONDS_PER_MINUTE; // 10:30pm in minutes activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, &value); cl_assert_equal_i(value, exp_value); activity_get_metric(ActivityMetricSleepStateSeconds, 1, &value); // Ideally it would show 40 minutes, but we only s...
= (ParentChildInfo) { .parent = parent, .child_idx = child_idx }; ListNode* node = list_find(state->unscheduled_head, prv_parent_list_filter, &info); if (!node) { node = list_find(state->scheduled_head, prv_parent_list_filter, &info); } if (!node) { return NULL; } return (AnimationPrivate...
{ duration *= animation->play_count; }
} return duration; } // ------------------------------------------------------------------------------------------- // Return true if animation is a descendent of the given parent static bool prv_is_descendent_of(AnimationState *state, AnimationPrivate *animation, AnimationPriva...
/* * 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...
{ // Need to disable button wakeup functionality // or the buttons don't register input PWR_WakeUpPinCmd(DISABLE); periph_config_enable(RCC_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG); initialize_button_common(); for (int i = 0; i < NUM_BUTTONS; ++i) { initialize_button(&BOARD_CONFIG_BUTTON.buttons[i])...
----------------------- static BTBondingID prv_get_bonding_id_for_intent(const GAPLEConnectionIntent *intent) { if (intent->is_bonding_based) { return intent->bonding->id; } return BT_BONDING_ID_INVALID; } // ------------------------------------------------------------------------------------------------- st...
if (connected_device) { intent->device = *connected_device; }
} else { intent->device = *request->device; // Append to hardware white-list of BT chip if not connected: if (!is_already_connected) { prv_mutate_whitelist_safely(request->device, true /* add */); } } } intent->client[c].is_used = true; intent->client[c].auto_reconnect = ...
/* * 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...
(InhibitorBacklight)
; } else { stop_mode_enable(InhibitorBacklight); } } s_backlight_pwm_enabled = on; } void backlight_init(void) { if (s_initialized) { return; } s_led_enable = 0; if (BOARD_CONFIG_BACKLIGHT.options & ActuatorOptions_Ctl) { periph_config_acquire_lock(); gpio_output_init(&BOARD_CO...
, GPoint offset, int8_t brightness, GColor stroke_color, GCornerMask quadrant) { /* * This will mirror given offset point over all eighths of the circle at given center * \ x8| x / * \ | / * \ | / * x7 \ | / x2 * -------+-------- * x6 / | \ x3 * ...
if (radius < 7) { // And sometimes magic number 2 special_case_pixels = 2; }
// Step 2 // Special code for filling gap between mirrored parts in a manner that wont overdraw pixels for (; progress < stop_progress + special_case_pixels; progress++) { Fixed_S16_3 edge = (Fixed_S16_3){.raw_value = radius_fixed - prv_get_circle_border(progress, radiu...
/* * 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...
{ Connection *connection; prv_lock(); { connection = connection_by_idx(conn_idx); PBL_ASSERTN(connection); } prv_unlock(); return connection; }
static bool prv_connection_by_address_list_filter_cb(ListNode *found_node, void *data) { const BTDeviceInternal *desired_addr = (const BTDeviceInternal *)data; const Connection *connection = (const Connection *)found_node; return (bt_device_internal_equal(desired_addr, &connection->initial_addr) || (c...
(&data->dnd_icon, RESOURCE_ID_QUIET_TIME_STATUS_BAR)
; // actual frame of the icon layer is calculated in prv_set_dnd_icon_visible() layer_init(&data->dnd_icon_layer, &GRectZero); layer_set_update_proc(&data->dnd_icon_layer, prv_draw_dnd_icon); layer_add_child(root_layer, &data->dnd_icon_layer); prv_dnd_status_changed(do_not_disturb_is_active()); // set up ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_percent, hdr->charger_connected)
N_TIMELINE_LAYER]; static const int s_visible_items[] = {1, 2}; static const int s_nonvisible_items[] = {0, TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER - 1}; static const TimelineLayerStyle *prv_get_style(void) { return s_styles[PreferredContentSizeDefault]; } uint16_t timeline_layer_get_fat_pin_height(void) { return pr...
{ prv_get_frame(layer, index, frame); const bool is_future = (layer->scroll_direction == TimelineScrollDirectionDown); const TimelineLayerStyle *style = prv_get_style(); frame->origin.y += is_future ? style->future_day_sep_dot_offset_y : style->past_day_sep_dot_offset_y; // Re...
static void prv_get_day_sep_show_frame(TimelineLayer *layer, GRect *frame) { const GRect *bounds = &((Layer *)layer)->bounds; const TimelineLayerStyle *style = prv_get_style(); *frame = (GRect) { .origin = gpoint_add(bounds->origin, style->day_sep_offset), .size.w = bounds->size.w - style->sidebar_width...
/* * 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...
{ display_spi_configure_default(); spi_ll_slave_acquire(ICE40LP->spi_port); spi_ll_slave_scs_assert(ICE40LP->spi_port); gpio_output_set(&ICE40LP->creset, false); // CRESET LOW #if !defined(TARGET_QEMU) // Wait until we succeed in pulling CRESET down against the external pull-up // and other external circu...
spi_ll_slave_burst_write(ICE40LP->spi_port, spi_zeros, ARRAY_LENGTH(spi_zeros)); 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...
%% below your typical. " "Go crush your day and then get back in bed 😉"), }, }, [PercentTier_Fail] = { .num_variants = 3, .variants = { i18n_noop("You slept for %dH %dM which is %d%% below your typical. " "Sleep is vital for all your great ideas–how...
{ INSIGHTS_LOG_DEBUG("Not adding activity pin - no steps"); return; }
er_unowned_intent(void) { BTDeviceInternal device = prv_dummy_device(1); BTErrno e; // Register connection intent owned by kernel: e = gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing_required */, ...
prv_assert_client_event(&device, true /* connected */, (1 << PebbleTask_App), HCI_ERROR_CODE_SUCCESS)
; } void test_gap_le_connect__register_for_already_connected_bonding(void) { BTErrno e; BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device(); // Register connection intent for kernel: e = gap_le_connect_connect_by_bo...
_equal_s(dstbuf, "There are 10 lights, the absolute value of 37777777774"); // Plus for positive signed // No signed conversion occurs, so this is a no-op snprintf(dstbuf, 256, "There are %+o lights, the absolute value of %+o", 8, -4); cl_assert_equal_s(dstbuf, "There are 10 lights, the absolute value of 37777...
(dstbuf, "There are 10 lights")
; // Variable length digits output snprintf(dstbuf, 256, "There are %.*x lights", 3, 16); cl_assert_equal_s(dstbuf, "There are 010 lights"); // Variable length digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.*xzero%.*x", -3, 0, -3, 1); cl_assert_equal_s(dstbuf, "zero1"); // Lengt...
{ -592, 392, -64}, { -440, 424, -136}, { -424, 336, -24}, { -416, 264, 32}, { -504, 328, 64}, { -608, 360, 120}, { -752, 392, 104}, { -896, 408, 96}, { -1072, 432, 40}, { -1200, 464, -8}, { -1136, 448, -104}, { -960, 512, -344}, { -1144, 400, -288}, { -976, 144, -160...
{ -384, 360, -240}, { -480, 272, -112}, { -696, 304, -72}, { -736, 320, -72}, { -696, 368, -120}, { -872, 456, -192}, { -984, 424, -144}, { -1016, 408, -120}, // 26 seconds { -1240, 568, -208}, { -1240, 704, -304}, { -1264, 656, -288}, { -1288, 504, -32}, { -1000,...
{ -704, 464, -168}, { -760, 328, -128}, { -1040, 464, -160}, { -1192, 440, -112}, { -1520, 528, -128}, { -1504, 712, -224}, { -1120, 616, -112}, { -1040, 560, -152}, { -784, 360, -24}, { -448, 384, -64}, { -312, 416, -80}, { -384, 384, 0}, { -504, 352, 32}, { -68...
.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(!timeline_model_iter_next(&new_idx, &has_next)); } void test_timeline_model__and_back(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11...
timeline_model_get_iter_state(2)
->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(1)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(2))...