prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
i2c_bus_configs[bus_idx].i2c_sda); BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_fn(true); } //! Initialize the I2C peripheral //! Lock the bus and peripheral config access before initialization static void bus_init(uint8_t bus_idx) { // Initialize peripheral I2C_InitTypeDef i2c_init_struct; I2C_StructInit(&...
{ bus_enable(bus_idx); }
bus->user_count++; bus_unlock(bus); } void i2c_release(I2cDevice device_id) { PBL_ASSERTN(s_initialized); PBL_ASSERTN(device_id < BOARD_CONFIG.i2c_device_count); uint8_t bus_idx = BOARD_CONFIG.i2c_device_map[device_id]; I2cBus *bus = &i2c_buses[bus_idx]; bus_lock(bus); if (bus->user_count == 0) { ...
graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(39, 39, 82, 42)); } void test_graphics_draw_text_${BIT_DEPTH_NAME}__clipping(void) { GContext ctx; Layer canvas; Layer layer; prv_setup_resources(); uint32_t gothic_24_handle = RESOURCE_ID_GOTHIC_24_BOLD; cl_assert(text...
(&ctx, fb)
; layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_y); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_y.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_s...
hand->thickness + 2); } graphics_context_set_stroke_color(ctx, hand->color); graphics_line_draw_precise_stroked_aa(ctx, center, watch_hand_end, hand->thickness); } static void prv_draw_watch_hand_pointed(GContext *ctx, ClockHand *hand, GPoint center, GPath *path) { graph...
GPoint(25, 78)
lip->size.w = 0; } else { rect_to_clip->size.w -= overflow; } rect_to_clip->origin.x = rect_clipper->origin.x; } else if (rect_to_clip->origin.x > rect_clipper->origin.x + rect_clipper->size.w) { rect_to_clip->origin.x = rect_clipper->origin.x + rect_clipper->size.w; rect_to_clip->size.w = 0...
{ rect->origin.x = (inside_rect->size.w - rect->size.w) + inside_rect->origin.x; rect->origin.y = ((inside_rect->size.h - rect->size.h) / 2) + inside_rect->origin.y; return; }
case GAlignBottomRight: { rect->origin.x = (inside_rect->size.w - rect->size.w) + inside_rect->origin.x; rect->origin.y = (inside_rect->size.h - rect->size.h) + inside_rect->origin.y; return; } case GAlignBottomLeft: { rect->origin.x = inside_rect->origin.x; rect->origin.y = (...
handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {5, 4, 2, 3}, 4, &s_recognizers_handled); // Recognizers attached to app processed before window and layer recognizers recognizer_add_to_list(recognizers[6], &app_list); cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_...
prv_create_recognizers(k_rec_count)
mationPrivate *)animation_array[i + 1]; } } return (Animation *)parent; } static Animation *prv_create_from_vararg(Animation *animation_a, Animation *animation_b, Animation *animation_c, va_list args) { Animation *animation_array[ANIMATION_MAX_CREATE_VARGS]; size_t ...
(animation, prv_call_started, (uintptr_t)NULL)
; } return true; } bool animation_set_elapsed(Animation *animation_h, uint32_t elapsed_ms) { AnimationPrivate *animation = (AnimationPrivate *)animation_h; if (!animation) { return false; } if (animation->duration_ms <= elapsed_ms) { animation->is_completed = true; animation_unschedule(animatio...
er; } void scroll_layer_draw_shadow_sublayer(Layer *shadow_sublayer, GContext* ctx) { ScrollLayer *scroll_layer = (ScrollLayer *)(((uint8_t*)shadow_sublayer) - offsetof(ScrollLayer, shadow_sublayer)); const GPoint content_offset = scroll_layer_get_content_offset(scroll_layer); const GSize content_size = scroll_l...
{ layer_add_child(&scroll_layer->content_sublayer, child); }
static void prv_window_load(Window *window) { OptionMenu *option_menu = window_get_user_data(window); menu_layer_set_callbacks(&option_menu->menu_layer, option_menu, &(MenuLayerCallbacks) { .get_cell_height = prv_get_cell_height_callback, .get_num_rows = prv_get_num_rows_callback, .draw_row = p...
(TextStyleFont_MenuCellTitle)
, }; // radio button icons are enabled by default option_menu_set_icons_enabled(option_menu, true); GBitmap *chosen_image = &option_menu->chosen_image; gbitmap_init_with_resource(chosen_image, RESOURCE_ID_CHECKED_RADIO_BUTTON); GBitmap *not_chosen_image = &option_menu->not_chosen_image; gbitmap_init_wit...
nabled //! access to the PWR clock and backup domain. Re-enabling //! it here breaks wakeup for some reason //! Returns false if configuring LSE failed bool rtc_init(void) { if (!prv_clocksource_lse_configure()) { return false; } RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); RCC_RTCCLKCmd(ENABLE); RTC_WaitForS...
if (result < 0) { result = (TICKS_IN_INTERVAL - before) + after; }
return result; } void rtc_slow_down(void) { if (prv_slow_mode()) { // If we're already slowed down there is nothing to do return; } // Calculate the current time and then save it back into the backup register int32_t last_save_time = RTC_ReadBackupRegister(CURRENT_TIME_REGISTER); uint32_t last_sa...
))); cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeof(Uuid)) == 0); // add 1 back so it's clean cl_assert(S_SUCCESS == reminder_db_insert_item(&item1)); TimelineItem temp = {{{0}}}; cl_assert(S_SUCCESS == reminder_db_read((uint8_t*)&item1.header.id, sizeof(Uuid), (uint8_t*)&temp, sizeo...
((uint8_t *)&item1.header.id, sizeof(Uuid))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ int ours = ceil_log_two(n); int theirs = ceil(log_two(n)); cl_assert(ours == theirs); }
void test_math__initialize(void) { } void test_math__cleanup(void) { } void test_math__atan2(void) { check_atan2(10, 14); check_atan2(3, 5); check_atan2(5, 3); check_atan2(10, 10); check_atan2(-153, 217); check_atan2(-28, -133); check_atan2(323, -229); check_atan2(245, 196); check_atan2(65, -3); ...
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 "board/display.h" #include "drivers/periph_config.h" #include "drivers/gpio.h" #...
GPIO_PinAFConfig(DISP_GPIO, DISP_PINSOURCE_SCKL, GPIO_AF_SPI2)
; GPIO_PinAFConfig(DISP_GPIO, DISP_PINSOURCE_SI, GPIO_AF_SPI2); // Init display GPIOs GPIO_Init(DISP_GPIO, &s_disp_gpio_init); // Init CS s_disp_gpio_init.GPIO_Mode = GPIO_Mode_OUT; s_disp_gpio_init.GPIO_OType = GPIO_OType_PP; s_disp_gpio_init.GPIO_Pin = DISP_PIN_SCS; GPIO_Init(DISP_GPIO, &s_disp_gpio...
/* * 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...
{ progress_window_pop(&data->window); }
} static void prv_set_progress_failure(AppFetchUIData *data) { uint32_t icon; const char *message; switch (data->result) { case AppFetchResultNoBluetooth: icon = TIMELINE_RESOURCE_WATCH_DISCONNECTED; message = i18n_get("Not connected", data); // Subscribe to the BT remote app connect event...
arbitrary order s_sys_activity_get_sessions_values.out.sessions[6] = (ActivitySession){ .type = ActivitySessionType_Open, .start_utc = now - (95 * SECONDS_PER_MINUTE), .length_min = 15, // end = -80 }; s_sys_activity_get_sessions_values.out.sessions[5] = (ActivitySession){ .type = ActivitySession...
(1, s_prv_activity_cb__call_count)
; cl_assert_equal_b(s_prv_activity_cb__args[0].activity, HealthActivitySleep); // order direction past s_prv_activity_cb__call_count = 0; health_service_activities_iterate(HealthActivityMaskAll, now - (200 * SECONDS_PER_MINUTE), now, HealthIterationDirectionPast, prv_activit...
es - num_bytes, .crc32 = legacy_defective_checksum_memory(data, num_bytes), }; comm_session_send_buffer_write(sb, (const uint8_t *) &header, sizeof(header)); comm_session_send_buffer_write(sb, data, num_bytes); comm_session_send_buffer_end_write(sb); dls_endpoint_print_message((uint8_t *) &header, num_by...
((ListNode *)entry)
; // Try and reopen this session bool success = false; if (dls_list_is_session_valid(entry->session) && uuid_equal(&entry->app_uuid, &entry->session->app_uuid) && entry->timestamp == entry->session->session_created_timestamp && entry->tag == entry->session->tag) { PBL_LOG_D(LOG_DOMAIN_DATA_...
turn; } AppDBEntry *db_entry = kernel_malloc_check(sizeof(AppDBEntry)); EnumerateData cb_data = { .cb = cb, .data = data, .entry_buf = db_entry, }; settings_file_each(&s_app_db.settings_file, prv_enumerate_entries, &cb_data); prv_close_file_and_unlock_mutex(); kernel_free(db_entry); retur...
{ if (key_len != UUID_SIZE) { return E_INVALID_ARGUMENT; } status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return rv; } PBL_ASSERTN(key_len == 16); AppInstallId app_id = prv_find_install_id_for_uuid(&s_app_db.settings_file, (Uuid *)key); if (app_id == INSTALL_ID_INVALID)...
status_t app_db_flush(void) { PBL_LOG(LOG_LEVEL_WARNING, "AppDB Flush initiated"); if (app_fetch_in_progress()) { // cancels any app fetch status_t rv = prv_cancel_app_fetch(INSTALL_ID_INVALID); if (rv != S_SUCCESS) { return rv; } } app_install_do_callbacks(APP_DB_CLEARED, INSTALL_ID_I...
/* * 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...
{ const BuiltInResourceData *builtin = entry->store_data; if (!builtin) { return 0; } memcpy(data, builtin->address + offset, num_bytes); return num_bytes; }
opy 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 implied. * See the License for the...
{ content_indicator_init(&content_indicator); bytes_written += sizeof(ContentIndicator *); cl_assert_equal_i(buffer->bytes_written, bytes_written); }
for (size_t i = 0; i < CONTENT_INDICATOR_BUFFER_SIZE; i++) { content_indicator_deinit(&content_indicator); bytes_written -= sizeof(ContentIndicator *); cl_assert_equal_i(buffer->bytes_written, bytes_written); } } void test_content_indicator__configuring_should_configure(void) { ContentIndicator con...
page_type_bits_set(page_flags, DELETED_START_PAGE_MASK) && !is_delete_complete(curr_pg)) { PBL_LOG(LOG_LEVEL_WARNING, "Delete of %d did not complete", curr_pg); unlink_flash_file(curr_pg); } } update_last_written_page(); } static void prv_handle_sector_erase(uint16_t start_page, bool updat...
if (!strcmp(callback_node->name, file_name) && (callback_node->event_flags & event)) { callback_node->callback(callback_node->data); }
callback_node = (PFSFileChangedCallbackNode *)list_get_next(&callback_node->list_node); } } status_t pfs_close(int fd) { mutex_lock_recursive(s_pfs_mutex); int res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; goto cleanup; } File *f = &PFS_FD(fd).file; if (f->is_tmp) { /...
2, -32}, { -1376, 1312, 16}, { -1352, 704, -224}, { -1368, 600, -328}, { -1240, 728, -208}, { -1248, 848, -216}, { -1232, 648, -72}, { -1440, 592, 104}, { -1432, 400, 200}, { -1296, 280, 176}, { -1264, 344, 184}, { -1184, 264, 320}, { -1120, 304, 200}, { -1064, 256, 2...
{ -1392, 296, 0}, { -1224, 232, -56}, { -1184, 120, -8}, { -1320, 136, 56}, { -1384, 104, 48}, { -1544, 248, 32}, { -1608, -152, 112}, // 18 seconds { -1256, -504, 112}, { -1144, -480, 72}, { -1208, -256, -40}, { -1288, -88, -96}, { -1360, -24, -120}, { -1256, -80...
{ -1296, 64, -16}, { -1104, 240, 96}, { -1016, 368, 152}, { -1184, 456, -16}, { -1296, 488, -32}, { -1264, 664, -64}, { -1256, 1064, -112}, { -1048, 320, -264}, { -1576, 632, -176}, { -1136, 632, -232}, { -1144, 488, -280}, { -1304, 352, -160}, { -1408, 400, -128}, ...
2000; //! If we hit bus contention during sending, we should wait this number of milliseconds. static const uint32_t BUS_CONTENTION_INTERVAL = 100; //! Subscriber information static int s_subscriber_count; //! Timer used for monitoring the connection and sending pending requests static TimerID s_monitor_timer = TIMER_...
if (s_monitor_interval) { // run the monitor again after the set interval new_timer_start(s_monitor_timer, s_monitor_interval, prv_monitor_timer_cb, NULL, 0); } else { // custom fast-path for 0ms timeout prv_monitor_timer_cb(NULL); }
} static void prv_monitor_timer_cb(void *context) { // we need to run from KernelBG so schedule a callback system_task_add_callback(prv_monitor_system_task_cb, NULL); } void smartstrap_connection_kick_monitor(void) { // queue up the system task immediately prv_monitor_timer_cb(NULL); } void smartstrap_conne...
s_error = (prv_is_invalid_command_for_current_state(cmd) || prv_has_invalid_request_length(cmd, req_length) || prv_has_invalid_token(cmd, token) || prv_has_invalid_fw_update_state(cmd)); return has_error; } static bool prv_check_putreques...
{ prv_fail(request_token); goto finally; }
_equal_i(0 * basic_cell_height, l.selection.y); cl_assert_equal_i(initial_scroll_offset, l.scroll_layer.content_sublayer.bounds.origin.y); // in this test setup, we can directly cast an animation to AnimationPrivate AnimationPrivate *ap = (AnimationPrivate *) l.animation.animation; const AnimationImplementatio...
(focused_height, l.selection.h)
; s_num_rows--; cl_assert_equal_i(1, s_num_rows); menu_layer_reload_data(&l); cl_assert_equal_i(s_num_rows - 1, l.selection.index.row); cl_assert_equal_i(focused_height, l.selection.h); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
mfg_info_get_watch_color()
te) { case ACCEL_SAMPLING_10HZ: case ACCEL_SAMPLING_25HZ: case ACCEL_SAMPLING_50HZ: case ACCEL_SAMPLING_100HZ: break; default: return -1; } mutex_lock_recursive(s_accel_manager_mutex); state->sampling_interval_us = (US_PER_SECOND / rate); prv_update_driver_config(); mutex_un...
(high_sensitivity)
; mutex_unlock_recursive(s_accel_manager_mutex); } /* * Driver Callbacks - See accel.h header for more context */ static bool prv_shared_buffer_empty(void) { bool empty = true; mutex_lock_recursive(s_accel_manager_mutex); { AccelManagerState *state = (AccelManagerState *)s_data_subscribers; while (s...
e 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 implied. * See the License for the specific...
cl_assert(!prv_is_known_misaligned_serial_number(s_mfg_serial_passing))
; cl_assert(prv_is_known_misaligned_serial_number(s_mfg_serial_failing)); }
ou 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 implied. * See th...
{ FontInfo* fontinfo = (FontInfo*) font; return fontinfo->max_height; }
int16_t fonts_get_font_cap_offset(GFont font) { if (!font) { return 0; } // FIXME PBL-25709: Actually use font-specific caps and also provide function for baseline offsets return (int16_t)(((int16_t)font->max_height) * 22 / 100); }
applib/ui/layer.h" #include "system/passert.h" #include "util/list.h" #include <stddef.h> static void prv_set_state(Recognizer *recognizer, RecognizerState new_state) { switch (recognizer->state) { case RecognizerState_Possible: PBL_ASSERTN((new_state == RecognizerState_Failed) || (new_s...
(recognizer, new_state)
; if (new_state != RecognizerState_Failed) { prv_send_subscriber_event(recognizer); } if (!recognizer->handling_touch_event) { recognizer_manager_handle_state_change(recognizer->manager, recognizer); } } ///////////////////////////////////////////////////////////////////////////////////////////////////...
return anim; } // Create animation static void prv_schedule_slide_animation(HealthCardView *health_card_view, Card next_card_index, bool slide_up) { animation_unschedule(health_card_view->slide_animation); health_card_view->slide_animation = NULL; GRect window_bounds = w...
layer_add_child(window_root, health_card_view->card_layers[i])
; } // set starting card based on launch args HealthLaunchArgs launch_args = { .args = app_launch_get_args() }; health_card_view->current_card_index = (launch_args.card_type == HealthCardType_Sleep) ? Card_SleepSummary : Card_ActivitySummary; // set window background prv_set_window_background_color...
} analytics_inc(ANALYTICS_APP_METRIC_CRASHED_COUNT, AnalyticsClient_App); } else if (task == PebbleTask_Worker) { analytics_inc(ANALYTICS_APP_METRIC_BG_CRASHED_COUNT, AnalyticsClient_Worker); } if (context->app_md->is_rocky_app) { analytics_inc(ANALYTICS_DEVICE_METRIC_APP_ROCKY_CRASHED_...
if (prv_force_stop_task_if_unprivileged(context)) { PBL_LOG(LOG_LEVEL_DEBUG, "Got it"); prv_handle_app_stop_analytics(context, task, gracefully); return true; }
} else { pfs_close(fd); } s_write_offset = 0; s_notif_storage_mutex = mutex_create_recursive(); } void notification_storage_lock(void) { mutex_lock_recursive(s_notif_storage_mutex); } void notification_storage_unlock(void) { mutex_unlock_recursive(s_notif_storage_mutex); } static int prv_file_open(ui...
{ break; }
} return true; } //! Compress storage by reading all valid notifications out of old file and storing to new file //! via overwrite static bool prv_compress(size_t size_needed, int *fd) { pfs_seek(*fd, 0, FSeekSet); //Open file for overwrite int new_fd = pfs_open(FILENAME, OP_FLAG_OVERWRITE, FILE_TYPE_STATI...
ested_sequence_with_0_play_count(void) { #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, ...
(spawn != NULL)
cl_assert_equal_b(true, activity_sessions_is_session_type_ongoing(ActivitySessionType_Sleep)); cl_assert_equal_i(HealthActivityRun | HealthActivityWalk | HealthActivitySleep , health_service_peek_current_activities()); } static void prv_set_median_hr_for_minutes(int bpm, int num_minutes) { const int num_samples =...
(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes)
; cl_assert_equal_i(zone2_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes); cl_assert_equal_i(zone3_minutes, 2); // Ad some "Semi-active" heart rates prv_set_median_hr_for_minutes(130 /* BPM */, 3 /* minutes */); cl_assert_equal_b(prv_is_hr_elevated(), true); activ...
a->connectivity_icon_id); } // Get the connectivity ResourceId const uint32_t new_battery_icon_id = prv_get_resource_id_for_battery_charge_state(battery_get_charge_state()); // replace the image if the battery ResourceId has changed if (data->battery_icon_id != new_battery_icon_id) { data->battery...
(menu_layer, data, &(MenuLayerCallbacks) { .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback) get_num_rows_callback, .draw_row = (MenuLayerDrawRowCallback) draw_row_callback, .select_click = (MenuLayerSelectCallback) select_callback, })
; menu_layer_set_click_config_onto_window(menu_layer, window); layer_add_child(&window->layer, menu_layer_get_layer(menu_layer)); scroll_layer_set_shadow_hidden(&data->menu_layer.scroll_layer, true); if (s_launcher_menu_persisted_data.valid) { // If we have a saved state, reload it. menu_layer_set_sel...
k(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r0_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif 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, 1); // TODO: Fix offset calculation and reenable this: - PBL-165...
(RECT_WIDTH, RECT_HEIGHT)
) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEI...
/* * 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()
.color; } void mfg_info_set_watch_color(WatchInfoColor color) { MfgData data = prv_fetch_struct(); data.color = color; prv_update_struct(&data); } GPoint mfg_info_get_disp_offsets(void) { return (GPoint) { .x = prv_fetch_struct().disp_offset_x, .y = prv_fetch_struct().disp_offset_y }; } void mfg_in...
/* * 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...
test_db_read(key, key_len, val_out, val_len)
; } status_t blob_db_delete(BlobDBId db_id, const uint8_t *key, int key_len) { cl_assert(db_id == s_blobdb_id); return test_db_delete(key, key_len); } status_t blob_db_flush(BlobDBId db_id) { cl_assert(db_id == s_blobdb_id); return test_db_flush(); } BlobDBDirtyItem *blob_db_get_dirty_list(BlobDBId db_id...
.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_system_reset.h" #include "stubs_task_watchdog.h" static...
(persist_get_size(key), sizeof(int))
; cl_assert_equal_i(persist_read_int(key), value); } void test_persist__bool(void) { const uint32_t key = 0; cl_assert_equal_i(persist_read_bool(key), false); cl_assert_equal_i(persist_write_bool(key, true), sizeof(bool)); cl_assert_equal_i(persist_get_size(key), sizeof(bool)); cl_assert_equal_i(persist_re...
out_service_is_paused, .pause = workout_service_pause_workout, .stop = workout_service_stop_workout, .update_data = workout_data_update, .metric_to_string = workout_data_fill_metric_value, .get_metric_value = workout_data_get_metric_value, .get_distance_string = health_util_get_distance_string, ...
(dialog, DIALOG_TIMEOUT_DEFAULT)
; workout_dialog_set_text(workout_dialog, i18n_get("Workout\nEnded", workout_dialog)); workout_dialog_set_action_bar_hidden(workout_dialog, true); i18n_free_all(workout_dialog); app_workout_dialog_push(workout_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...
(ctx, text, font, *box, overflow_mode, alignment, layout)
; } } static GSize prv_draw_emoji(GContext *ctx, const GRect *bounds, GFont font, bool render) { TextLayoutExtended layout = { .line_spacing_delta = 2, // Give some space for the larger emojis }; graphics_context_set_text_color(ctx, GColorBlack); prv_render_text(ctx, s_emoji_string, font, bounds, GTextOv...
/* * 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...
check_atan2(-151, 284)
; check_atan2(111, -98); check_atan2(-44, -17); check_atan2(269, -356); check_atan2(-78, 268); check_atan2(-247, 37); check_atan2(-119, 33); check_atan2(234, -253); check_atan2(355, -193); check_atan2(-6, -310); check_atan2(15, -19); check_atan2(34, -32); check_atan2(-158, 299); check_atan2(12...
nt32_t default_value, uint32_t *result) { if (!result) { return false; } if (!timeout_string) { *result = default_value; return true; } char *end; *result = MAX(0, strtol(timeout_string, &end, 10)); return (*end == '\0'); } //! Press a butt...
prv_button_press_multiple(button_index, NULL, hold_down_time_ms, NULL)
_forward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE; Animation *animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_...
(animation)
; animation_set_reverse(animation, true); animation_set_duration(animation, ANIMATION_DURATION_INFINITE); animation_set_elapsed(animation, 20); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 300 - 20); } void test_kino_player__finite_...
PBL_LOG(LOG_LEVEL_INFO, "Reminder added: %s", uuid_buffer)
; if (rv == S_SUCCESS) { if (has_reminded) { reminders_handle_reminder_updated(&hdr->common.id); } else { rv = reminders_update_timer(); } } return rv; } status_t reminder_db_insert_item(TimelineItem *item) { if (item->header.type != TimelineItemTypeReminder) { return E_INVALID_ARG...
tributed 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 "applib/app.h" #include "applib/fonts/fonts.h" #include "applib/graphics/graphics.h" #include "...
app_window_stack_push(window, animated)
; } static void s_main(void) { prv_handle_init(); app_event_loop(); } const PebbleProcessMd* panic_app_get_app_info() { static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = s_main, .visibility = ProcessVisibilityHidden, // UUID: 130fb6d7-da9e-485a-87ca-a5ca4bf21912 ...
2896 */ 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x07, 0x80, 0x07, 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* bytes 2896 - 2912 */ 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x0f, 0xc0, 0x0f, 0xc0, 0xff, 0xff, /* bytes 2912 - 2928 */ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00,...
pfs_format(false /* write erase headers */)
ME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_offset_layer_non_aa.${BIT_DEPTH_NAME}.pbi")
raw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 5); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_N...
(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 4 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 4); graphics_dra...
pData *data = context; prv_display_scalar_history_alert(data, "Steps", HealthMetricStepCount); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_sleep_history(int index, void *context) { HealthAPITestAppData *data = context; prv_display_seco...
if (!minute_data) { snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Out of memory"); prv_display_alert(data->debug_card.dialog_text); goto exit; }
/* * 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...
("pebble_time_steel_silver")
; break; case WATCH_INFO_COLOR_TIME_STEEL_BLACK: model_name = SNOWY_MODEL("pebble_time_steel_black"); break; case WATCH_INFO_COLOR_TIME_STEEL_GOLD: model_name = SNOWY_MODEL("pebble_time_steel_gold"); break; case WATCH_INFO_COLOR_TIME_ROUND_SILVER_14: mod...
ributeList response_attributes = { .num_attributes = 1, .attributes = &timestamp_attr, }; timeline_invoke_action(pin, action, &response_attributes); break; } case TimelineItemActionTypeOpenPin: case TimelineItemActionTypeOpenWatchApp: WTF; case TimelineItemActionT...
action_menu_close(action_menu, true)
; } return NULL; } void timeline_actions_invoke_action(const TimelineItemAction *action, const TimelineItem *pin, ActionCompleteCallback complete_cb, void *cb_data) { ActionResultData *data = prv_invoke_action(NULL /* action_menu */, action, pin, NULL /* label */); if (data...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_on_screen(window, true, true)
; window_render(window, &s_ctx); return window; } // Tests ////////////////////// void test_health_activity_detail_card__render_no_data(void) { prv_create_card_and_render(&(HealthData) {}); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_activity_detail_card__render_current_ca...
val) || !jerry_value_is_string(prop_name_val)) { return false; } return (bool)EM_ASM_INT({ var obj = __jerryRefs.get($0); var name = __jerryRefs.get($1); try { return delete obj[name]; } catch (e) { // In strict mode, delete throws SyntaxError if the property is an ...
(Boolean(true))
; }, pdp->is_value_defined, /* $0 */ pdp->is_get_defined, /* $1 */ pdp->is_set_defined, /* $2 */ pdp->is_writable_defined, /* $3 */ pdp->is_writable, /* $4 */ pdp->is_enumerable_defined, /* $5 */ pdp->is_enumerable, /* $6 */ pdp->is_c...
.is_remote_identity_info_valid = true, }; BTBondingID id_3 = bt_persistent_storage_store_ble_pairing(&pairing_1, true /* is_gateway */, NULL, false /* requires_address_pinning */, ...
ret = bt_persistent_storage_get_ble_pairing_by_id(id_3, NULL, NULL, NULL); cl_assert(!ret); ret = bt_persistent_storage_get_ble_pairing_by_id(id_4, NULL, NULL, NULL); cl_assert(!ret); } // Test to make sure we don't accidentally change the serialized data formats. void test_bluetooth_persistent_storage__ble_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...
prv_text_layer_get_cache_handle(text_layer)
ASSERT_JS_GLOBAL_EQUALS_D("now", (double)cur_time * 1000.0 + (double)cur_millis); ASSERT_JS_GLOBAL_EQUALS_D("local_day", 4.0); // Thursday ASSERT_JS_GLOBAL_EQUALS_D("local_hour", 14.0); // 1pm } void test_js__log_exception(void) { char *script = "var e1;\n" "var f1 = function(){throw new Error('test')}...
jerry_create_object()
tx, center, radius_outer, radius_outer, radius_inner, radius_inner, angle_start, angle_end); } void graphics_fill_radial_internal(GContext *ctx, GPoint center, uint16_t radius_inner, uint16_t radius_outer, int32_t angle_start, int32_t angle_end) { // Cast g...
{ const GPointPrecise result = prv_gpointprecise_from_polar(&rect, scale_mode, angle); return GPointFromGPointPrecise(result); }
GRect grect_centered_internal(const GPointPrecise *center, GSize size) { size.w = ABS(size.w); size.h = ABS(size.h); const int16_t FIXED_HALF = FIXED_S16_3_HALF.raw_value; return (GRect) { // Adding 0.5 to x and y here will ensure we have rounded up when we throw away the fraction .origin.x = (center-...
struct `msg` with the field number and fields passed. static bool prv_encode_struct(pb_ostream_t *stream, uint32_t field_number, const pb_msgdesc_t * fields, const void *msg) { // Encode the field tag and data type if (!pb_encode_tag(stream, PB_WT_STRING, field_number)) { return fa...
prv_session_extra_space_needed(config)
; // Copy the types array directly after the Session bytes. memcpy(types_copy, config->measurements.types, extra_space); // Generate a new UUID Uuid uuid; uuid_generate(&uuid); PLogTypesEncoderArg types_encoder_arg = { .num_types = session->config.measurements.num_types, .types = session->config.m...
/* * 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 reel->impl->get_elapsed(reel); }
return 0; } uint32_t kino_reel_get_duration(KinoReel *reel) { if (reel && reel->impl->get_duration) { return reel->impl->get_duration(reel); } return 0; } GDrawCommandImage *kino_reel_get_gdraw_command_image(KinoReel *reel) { if (reel && reel->impl->get_gdraw_command_image) { return reel->impl->g...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bitset8_get(s_current_framebuffer->dirty_lines, s_current_flush_line)
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 implied. * See the License for the specific language ...
periph_config_disable(bus->hal->i2c, bus->hal->clock_ctrl)
; I2C_DeInit(bus->hal->i2c); } bool i2c_hal_is_busy(I2CBus *bus) { return ((bus->hal->i2c->SR2 & I2C_SR2_BUSY) != 0); } void prv_disable_all_interrupts(I2CBus *bus) { bus->hal->i2c->CR2 &= ~(I2C_CR2_ITEVTEN | I2C_CR2_ITERREN | I2C_CR2_ITBUFEN); } void i2c_hal_abort_transfer(I2CBus *bus) { // Disable all inte...
o 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 "services/normal/timeline/reminde...
(get_reminder_timer_id())
== 0); stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_equal_i(num_events_put, 2); cl_assert_equal_m(&item2.header.id, stub_new_timer_ca...
s_calculate_basic(op, data, num_data, NULL, NULL, &result.sum); cl_assert_equal_i(result.sum, 357); cl_assert_equal_i(result.avg, 23); cl_assert_equal_i(result.min, -5); cl_assert_equal_i(result.max, 80); cl_assert_equal_i(result.count, num_data); cl_assert_equal_i(result.max_streak, num_data); cl_assert_...
(result.max_streak, 0)
; cl_assert_equal_i(result.first_streak, 0); cl_assert_equal_i(result.median, 0); } void test_stats__null_data(void) { const StatsBasicOp op = StatsBasicOp_Average; int32_t result = 0x73110; stats_calculate_basic(op, NULL, 0, NULL, NULL, &result); cl_assert_equal_i(result, 0x73110); } typedef struct Weigh...
}, // 88 seconds { -1360, 56, -200}, { -1160, 8, -184}, { -768, 136, -216}, { -424, 120, -240}, { -320, 136, -400}, { -408, 216, -520}, { -824, -40, -464}, { -1120, 16, -368}, { -792, -512, -624}, { -1088, 1112, -840}, { -920, -328, -40}, { -1576, 768, -640}, { -1...
{ -992, 128, -352}, { -1080, 0, -120}, { -1848, 728, -768}, { -1696, -96, 56}, { -1192, -88, -80}, { -768, 184, -160}, { -560, -32, -80}, { -560, -48, 40}, { -680, 80, 8}, { -704, 128, 16}, { -784, -96, 0}, { -840, 40, 24}, { -1168, 168, -120}, { -1088, -40, -72},...
{ -1720, 248, -256}, { -840, 0, -240}, { -1152, -168, 8}, { -1032, -352, 24}, { -616, 40, -184}, { -472, 144, -216}, { -520, 192, -104}, { -584, 232, 48}, { -784, 384, -224}, { -984, 184, -224}, { -776, 552, -576}, { -1032, 440, -440}, { -1264, 64, -16}, { -1400,...
inner_circles); graphics_draw_circle(ctx, circle1_location, radius_of_spinner_circles); graphics_fill_circle(ctx, circle2_location, radius_of_spinner_circles); graphics_draw_circle(ctx, circle2_location, radius_of_spinner_circles); } static void prv_anim_impl(struct Animation *animation, ...
window_set_user_data(window, data)
re Animation *d = animation_create(); animation_set_implementation(d, &s_custom_implementation); animation_set_duration(d, DURATION); return d; } static void click_handler(ClickRecognizerRef recognizer, Window *window) { // If the animation is still running, fast-foward to 300ms from the end if (animation...
text_layer_set_text(s_text_layer_a, "Started!")
; layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_text_layer_a)); s_text_layer_b = text_layer_create(from_rect_b); text_layer_set_text(s_text_layer_b, "Spawned"); layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_text_layer_b)); // Animate text layer a from top-lef...
/* * 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 gap_le_connect_cancel(&device, GAPLEClientApp); }
// ----------------------------------------------------------------------------- // ble_client.h DEFINE_SYSCALL(BTErrno, sys_ble_client_discover_services_and_characteristics, BTDeviceInternal device) { return gatt_client_discovery_discover_all(&device); } DEFINE_SYSCALL(uint8_t, sys_ble_cl...
9.5)), lc->fill_radial_precise.center); cl_assert_equal_i(0, lc->fill_radial_precise.radius_inner.raw_value); cl_assert_equal_i(20 * 8, lc->fill_radial_precise.radius_outer.raw_value); // outer radius capped to >= 0 EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, -10, -20, 0, Math.PI);\n" ); cl_assert_equ...
{ prv_global_init_and_set_ctx(); // we do this in C and not JS as color binding is not linked in this unit-test // what we want to test though is that the text color is taken from fill color rocky_api_graphics_get_gcontext()->draw_state.fill_color = GColorRed; EXECUTE_SCRIPT( "ctx.fillText('some text', 1...
void test_rocky_api_graphics__fill_text_coordinates(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT("ctx.fillText('some text', 0, 1.5);"); cl_assert_equal_rect((GRect(0, 2, large_int, large_int)), s_graphics_draw_text.last_call.draw_text.box); EXECUTE_SCRIPT("ctx.fillText('some t...
er = (ClickRecognizer*)recognizer_ref; return recognizer->number_of_clicks_counted; } ButtonId click_recognizer_get_button_id(ClickRecognizerRef recognizer_ref) { ClickRecognizer *recognizer = (ClickRecognizer*)recognizer_ref; return recognizer->button; } bool click_recognizer_is_repeating(ClickRecognizerRef re...
{ // No long click nor multi click, fire handler immediately on button down: ++(recognizer->number_of_clicks_counted); const bool needs_reset = (false == local_is_hold_to_repeat_enabled); prv_dispatch_event(recognizer, ClickHandlerOffsetSingle, needs_reset); }
/* * 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 (info) { info_copy = (PutBytesStorageInfo *)kernel_malloc_check(sizeof(PutBytesStorageInfo)); *info_copy = *info; }
s_storage_data.info = info_copy; storage->impl_data = &s_storage_data; // put_bytes_storage_raw.c is weird, it reserves space at the beginning for FirmwareDescription: storage->current_offset = sizeof(FirmwareDescription); return true; } uint32_t fake_pb_storage_mem_get_max_size(PutBytesObjectType object_t...
agDiscovery: return "DIS"; case GAPLEAdvertisingJobTagReconnection: return "RCN"; case GAPLEAdvertisingJobTagiOSAppLaunch: return "iOS"; default: return "?"; } } // ----------------------------------------------------------------------------- //! Helpers to manage the s_jobs list //! bt_lock is expected ...
prv_is_current_term_silent(job)
) { prv_increment_elapsed_time_for_job(&job, NULL); } job = next; } while (job != s_jobs); } // ----------------------------------------------------------------------------- //! Cycle timer callback. //! It increments the air-time counter of the job's current term. //! Updates the job's term if the ter...
ttps://github.com/pebble/bt-dialog-source/blob/master/ble_stack/src/rom_patch/rom_patch.c#L2687 extern ble_error_t __real_patch_rom_functions(void); static bool s_should_log_about_mic_error = false; static uint32_t s_max_subsequent_error_count_since_last_log = 0; static uint32_t s_subsequent_mic_errors = 0; #define MA...
IS_AE_CHIP (uint32_t)
llm_util_get_supp_features, #if !SUPPORTS_PACKET_LENGTH_EXTENSION (uint32_t) llc_length_rsp_pdu_send, #endif #endif (uint32_t) lld_data_rx_check, }; static const uint32_t s_patched_functions[] = { #if IS_AE_CHIP (uint32_t) prv_llm_util_get_supp_features, #if !SUPPORTS_PACKET_LENGTH_EXTENSION (uint32_t) prv_ll...
stem_font(config->music_time_font_key)); layer_add_child(&data->window.layer, &data->length_text_layer.layer); prv_configure_music_text_layer(&data->title_text_layer, data->title_buffer, &title_rect, TITLE_BOUNDS_OFFSET, ARTIST_TITLE_TEXT_ALIGNMENT, ...
prv_update_layout(data)
; return; default: return; } } //////////////////// // App boilerplate static void prv_handle_init(void) { MusicAppData *data = app_malloc_check(sizeof(MusicAppData)); *data = (MusicAppData){}; app_state_set_user_data(data); data->event_info = (EventServiceInfo){ .type = PEBBLE_MEDIA_EVENT, ...
ain 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 implied. * See the License ...
{ rem -= SECONDS_PER_DAY; ++days; }
/* compute hour, min, and sec */ res->tm_hour = (int) (rem / SECONDS_PER_HOUR); rem %= SECONDS_PER_HOUR; res->tm_min = (int) (rem / SECONDS_PER_MINUTE); res->tm_sec = (int) (rem % SECONDS_PER_MINUTE); /* compute day of week */ if ((res->tm_wday = ((EPOCH_WDAY + days) % DAYS_PER_WEEK)) < 0) { res->t...
{ -64, -16, -952}, { -32, -72, -952}, { -16, -56, -952}, { -40, -40, -952}, { -48, -16, -952}, { -24, -40, -992}, { 8, -104, -976}, { 32, -56, -992}, { 8, 16, -968}, { -8, 8, -968}, { -24, 16, -920}, { 24, -72, -944}, { -24, -120, -936}, { 8, -24, -976}, { -8,...
{ -72, -16, -952}, { -72, -48, -952}, { -72, -56, -952}, { -64, -24, -952}, { -80, -40, -952}, { -88, -48, -944}, { -64, -24, -944}, { -64, -16, -952}, { -72, -120, -944}, { -120, -208, -952}, { -112, -248, -936}, { -96, -176, -920}, { -40, -72, -952}, { -64, -96...
{ int32_t dist = serial_distance(0, 1, 3); cl_assert_equal_i(dist, 1); }
{ int32_t dist = serial_distance(1, 0, 3); cl_assert_equal_i(dist, -1); } { int32_t dist = serial_distance(0, 7, 3); cl_assert_equal_i(dist, -1); } { int32_t dist = serial_distance(7, 0, 3); cl_assert_equal_i(dist, 1); } { int32_t dist = serial_distance(6, 0, 3); cl_assert...
/* * 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...
service->set_enable_fn(((1 << runlevel) & service->enable_mask) != 0)
; } }
_whoami(void) { return qspi_flash_check_whoami(QSPI_FLASH); } FlashAddress flash_impl_get_sector_base_address(FlashAddress addr) { return (addr & SECTOR_ADDR_MASK); } FlashAddress flash_impl_get_subsector_base_address(FlashAddress addr) { return (addr & SUBSECTOR_ADDR_MASK); } void flash_impl_enable_write_prot...
{ return 150; }
uint32_t flash_impl_get_typical_subsector_erase_duration_ms(void) { return 50; }
/* * 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 (!removed_id) { return; }
*removed_id = *reminder_id; PebbleEvent event = { .type = PEBBLE_REMINDER_EVENT, .reminder = { .type = type, .reminder_id = removed_id, } }; event_put(&event); } void reminders_handle_reminder_updated(const Uuid *reminder_id) { prv_put_reminder_event((ReminderId *)reminder_id, Remin...
&& !prv_is_transport_type(session->transport, session->transport_imp, CommSessionTransportType_PULSE); } static bool prv_find_session_is_type_filter(ListNode *found_node, void *data) { CommSession *session = (CommSession *) found_node; CommSessionTransportType required_session_t...
PBL_ASSERTN(s_session_head == NULL)
; } DEFINE_SYSCALL(void, sys_app_comm_set_responsiveness, SniffInterval interval) { CommSession *comm_session = comm_session_get_current_app_session(); switch (interval) { case SNIFF_INTERVAL_REDUCED: comm_session_set_responsiveness(comm_session, BtConsumerApp, Resp...
/* * 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, TEST_PBI_FILE)
); } // Tests 8-bit bitblt to circular display buffer // Result: // - gbitmap matches platform loaded PBI void test_bitblt_circular__color_8_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE); GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); cl_assert(native_framebuffer->info.format == ...
logging to work"); _Static_assert((LOG_REGION_SIZE % LOG_PAGE_SIZE) == 0, "The log page size must be divisible by the log region size"); _Static_assert(((FLASH_REGION_DEBUG_DB_END % ERASE_UNIT_SIZE) == 0) && ((FLASH_REGION_DEBUG_DB_END % ERASE_UNIT_SIZE) == 0), "Space for flash logging must be aligned on an...
flash_read_bytes((uint8_t *)&hdr, flash_addr, sizeof(hdr))
Int64Function animation_get_custom_interpolation(Animation *animation_h) { return prv_animation_get_custom_function(animation_h, AnimationCurveCustomInterpolationFunction); } // ------------------------------------------------------------------------------------------- bool animation_set_immutable(Animation *animati...
animation_private_using_legacy_2(state)
); AnimationPrivate *parent = prv_find_animation_by_handle(state, parent_h, false /*quiet*/); if (!parent || !prv_animation_is_scheduled(state, parent) || parent->parent) { // Can only set the elapsed of a top-level animation, and then, only after it has // been scheduled. return false; } // First...
(buffer, 80, "R1 = 0x%x", stacked_r1); PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, "R2 = 0x%x", stacked_r2); PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, "R3 = 0x%x", stacked_r3); PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, "R12 = 0x%x", stacked_r12); PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, "SP = %p", &stacked_a...
{ // Log the lr instead of the pc. We frequently crash due to PC being madness. While the lr may be a little further // than the actual crash, it should give us enough context. const unsigned int stacked_lr = ((unsigned long) hardfault_args[5]); RebootReason reason = { .code = RebootReasonCode_HardFault, .extra...
void HardFault_Handler(void) { // Grab the stack pointer, shove it into a register and call // the c function above. __asm("tst lr, #4\n" "ite eq\n" "mrseq r0, msp\n" "mrsne r0, psp\n" "b %0\n" :: "i" (hard_fault_handler_c)); }
ata == characteristic); } return client; } // ------------------------------------------------------------------------------------------------- static bool prv_uuid_filter_callback(ListNode *found_node, void *data) { const PPoGATTClient *client = (const PPoGATTClient *) found_node; const Uuid *uuid = (const U...
MIN(PPOGATT_V1_DESIRED_RX_WINDOW_SIZE, PPOGATT_SN_MOD_DIV - 1); client->out.rx_window_size = desired_rx_window; } else { client->out.tx_window_size = client->out.rx_window_size = PPOGATT_V0_WINDOW_SIZE; }
if (self_initiated) { client->out.reset_packet_to_send.type = PPoGATTPacketTypeResetRequest; client->state = StateConnectedClosedAwaitingResetCompleteSelfInitiatedReset; } else { client->out.reset_packet_to_send.type = PPoGATTPacketTypeResetComplete; client->state = StateConnectedClosedAwaitingRes...
at8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = src_bitmap->bounds }; // All compositing modes except GCompOpSet should be the same as GCompAssign memset(dest_data, GColorGreen.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite...
cl_assert(gbitmap_eq(&dest_bitmap, &expect_bmp, "test_bitblt__8bit_comptint_clear-expect.8bit.pbi"))
; gbitmap_destroy(src_bitmap); } // Tests comptint, multiple tint colors and varying opacity of the source image. // Setup: // - Destination is two 128 by 64 blocks expressing the 64 colors; each row expresses // one of the colors stack vertically. // - Source is a set of 4 by 4 blocks each with a 1 pixel w...
/* * 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...
("Edit", list)
); } // ---------------------------------------------------------------------------------------------- void alarm_pin_add(time_t alarm_time, AlarmId id, AlarmType type, AlarmKind kind, Uuid *uuid_out) { const unsigned num_actions = 1; // We are just supporting "edit" for now TimelineItemActionGroup action_group = ...
n_menu_hierarchy.h" #include "applib/ui/action_menu_window.h" #include "applib/ui/kino/kino_layer.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "resource/resource_ids.auto.h" #include "services/common/clock.h" #include "services/common/i18n/i18n.h" #include "services/normal/activity/health_util.h...
(summary_window->action_bar_more)
_t num_points = gdraw_command_get_num_points(command); for (uint16_t i = 0; i < num_points; i++) { command->points[i] = gpoint_scale_by_gsize(command->points[i], scale->from, scale->to); } return true; } void gdraw_command_list_scale(GDrawCommandList *list, GSize from, GSize to) { ScaleCBContext ctx = { ...
applib_malloc(sizeof(GPointIndexLookup) + num_points * sizeof(uint16_t))
; if (!lookup) { applib_free(points); return lookup; } lookup->num_points = num_points; lookup->max_index = num_points - 1; GPointCreateIndexCBContext ctx = { .values = { .points = points, .num_points = num_points, }, .iter = { .lookup = lookup, }, }; gdraw_comm...
GPoint(bitmap->bounds.size.w, bitmap->bounds.size.h)); offset_point = gpoint_sub(offset_point, GPoint(COMPOSITE_TEST_OFFSET_X, COMPOSITE_TEST_OFFSET_Y)); prv_composite_test_draw_bitmap(&s_ctx, bitmap, offset_point, compositing_mode); ...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_graphics_draw_bitmap__offset_bitmap_layer_across_ny(void) { prv_offset_bitmap_layer_test(GPoint(0, -25)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__composite_assign(void) { prv_composite_test(__func__, GCompOpAssign); } void test_graphics_draw...
_saved_session = *session; } void activity_sessions_prv_delete_activity_session(ActivitySession *session) {} void activity_algorithm_enable_activity_tracking(bool enable) {} bool activity_get_sessions(uint32_t *session_entries, ActivitySession *sessions) { return false; } uint8_t activity_prefs_get_age_years(void) ...
(&steps, &duration_s, &distance_m, &bpm, &hr_zone)
//// #include "graphics_common_stubs.h" #include "stubs_applib_resource.h" static const int16_t SCREEN_WIDTH = 144; 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, ...
test_graphics_context_init(&ctx, fb)
; s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(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...
/* * 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 (type == CLOCK_TEXT_TYPE_DATE) { strftime(text.buffer, sizeof(text.buffer), "%a %d", tick_time); } else if (type == CLOCK_TEXT_TYPE_TIME) { strftime(text.buffer, sizeof(text.buffer), "$l:%M%P", tick_time); }
for (uint32_t i = 0; i < sizeof(text.buffer); i++) { text.buffer[i] = toupper((unsigned char)text.buffer[i]); } // TODO: Don't return a struct return text; } static ClockModel prv_clock_model_default(struct tm *tick_time) { // Create a generic model and configure a default clock. ClockModel model; ...
{ s_num_timer_register_calls++; s_snooze_timer_timeout_ms = timeout_ms; return true; } bool new_timer_stop(TimerID timer_id) { s_snooze_timer_timeout_ms = 0; return true; } void new_timer_delete(TimerID timer_id) { s_snooze_timer_timeout_ms = 0; } ////////////////////////////////////////////////////////...
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday)
; id = alarm_create(&(AlarmInfo) { .hour = 5, .minute = 14, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id, 5, 14, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); id = alarm_create(&(AlarmInfo) { .hour = 6, .minute = 14, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id, 6, 14,...
hargeState *)data)->charge_percent); bool new_warning = false; const BatteryUIWarningLevel num_points = ARRAY_LENGTH(s_warning_points) - 1; while (s_warning_points_index < num_points && (percent <= battery_curve_get_percent_remaining(s_warning_points[s_warning_points_index + 1]))) { s_warning_points...
low_power_is_active()
) { return BatteryLowPower; } else if (ratio32_to_percent(state->charge_percent) <= battery_curve_get_percent_remaining(s_warning_points[0])) { return BatteryWarning; } else { return BatteryGood; } } void battery_ui_handle_state_change_event(PreciseBatteryChargeState charge_state) { Ba...
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 implied. * See the Lice...
{ int *countdown = context; if ((*countdown)-- == 0) { return_status = FLASH_ERROR_OPERATION; } }
ff)}, {"firebrick", GColorARGB8FromHEX(0xb22222)}, {"floralwhite", GColorARGB8FromHEX(0xfffaf0)}, {"forestgreen", GColorARGB8FromHEX(0x228b22)}, {"gainsboro", GColorARGB8FromHEX(0xdcdcdc)}, {"ghostwhite", GColorARGB8FromHEX(0xf8f8ff)}, {"gold", GColorARGB8FromHEX(0xffd700)}, {"goldenrod", GColorARGB8FromH...
GColorARGB8FromHEX(0x40e0d0)
}, {"violet", GColorARGB8FromHEX(0xee82ee)}, {"wheat", GColorARGB8FromHEX(0xf5deb3)}, {"whitesmoke", GColorARGB8FromHEX(0xf5f5f5)}, {"yellowgreen", GColorARGB8FromHEX(0x9acd32)}, // CSS compatibility {"darkgrey", GColorDarkGrayARGB8}, {"lightgrey", GColorLightGrayARGB8}, // special cases {"transpare...
ue, "-1:01", 7, }, // Advanced %T tests { "'%0T')", 3666, true, "01:01:06", 1, }, { "'%uT')", 3666, true, "1 hour, 1 minute, and 6 seconds", 1, }, { "'%aT')", 3666, true, "1 hr 1 min 6 sec", 1, }, { "'%auT')", 3666, true, "1 hour, 1 minute, and 6 seconds", 1, ...
cl_assert_equal_i(s_error.status, test->expect_status)
; cl_assert_equal_i(err_index, test->expect_index); } cl_assert_equal_s(s_output, test->expect_str); cl_assert_equal_i(s_cond.eval_time, test->expect_eval_time); #if DEBUG_PRINTING printf("\n"); #endif } } ///////////////////////////////////////////////////////////////////////////////////////...
ctx->draw_state.stroke_color); graphics_release_frame_buffer(ctx, framebuffer); return; } #endif // PBL_COLOR if (opacity <= (MAX_PLOT_BRIGHTNESS / 2)) { int16_t x1_rounded = (x1.raw_value + (FIXED_S16_3_ONE.raw_value / 2)) / FIXED_S16_3_ONE.raw_value; int16_t x2_rounde...
{ // apply draw box and clipping x1.integer += ctx->draw_state.drawing_box.origin.x; x2.integer += ctx->draw_state.drawing_box.origin.x; y += ctx->draw_state.drawing_box.origin.y; GBitmap *framebuffer = graphics_capture_frame_buffer(ctx); if (!framebuffer) { // Couldn't capture framebuffer return; ...
#endif // PBL_COLOR void graphics_private_draw_horizontal_line_delta_non_aa(GContext *ctx, int16_t y, Fixed_S16_3 x1, Fixed_S16_3 x2, Fixed_S16_3 delta1, Fixed_S16_3 delta2) { int16_t x1_rounded = (x1.raw_value +...
ighlight_colors : menu_layer->normal_colors; ctx->draw_state.fill_color = colors[MenuLayerColorBackground]; ctx->draw_state.text_color = colors[MenuLayerColorForeground]; ctx->draw_state.tint_color = colors[MenuLayerColorForeground]; if (!gcolor_is_transparent(ctx->draw_state.fill_color)) { graphi...
(ctx, prev_state)
; } static void prv_menu_layer_render_section_from_iterator(MenuIterator *iterator) { MenuRenderIterator *it = (MenuRenderIterator*)iterator; const int16_t top_diff = it->it.cursor.y - it->content_top_y; const bool is_header_in_frame = (top_diff >= 0 && it->it.cursor.y <= it->content_bottom_y) || (it->it.c...