prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
{ 985, 463, -221}, { 983, 390, -74}, { 939, 293, 28}, { 851, 202, 31}, { 785, 237, 23}, { 765, 274, 34}, { 808, 300, 13}, { 816, 291, 3}, { 791, 313, 0}, { 935, 358, 4}, { 1275, 422, 20}, { 1199, 413, 38}, { 1283, 443, 51}, { 1384, 504, 20}, { 1187, 430, 86}, ...
{ 1097, 395, -14}, { 1217, 431, -6}, { 1278, 446, 29}, { 1370, 510, 43}, { 1277, 530, 22}, { 1171, 471, 59}, { 1055, 410, 76}, { 1027, 381, 88}, { 956, 305, 127}, { 853, 237, 157}, { 806, 192, 167}, { 817, 191, 186}, { 804, 181, 173}, { 753, 184, 167}, { 920, ...
.h" #include "syscall/syscall_internal.h" #include "system/logging.h" #include "system/passert.h" // FreeRTOS stuff #include "FreeRTOS.h" #include "freertos_application.h" #include "task.h" #include "queue.h" #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> static ...
pebble_task_get_handle_for_task(PebbleTask_Worker)
!= NULL) { PBL_LOG(LOG_LEVEL_WARNING, "Worker already launched"); return false; } process_manager_init_context(&s_worker_task_context, app_md, args); s_worker_task_context.to_process_event_queue = s_to_worker_event_queue; // Set up the worker's memory and load the binary into it. const size_t worke...
ECTOR_TABLE[1] // PRIMASK = 0x0 // FAULTMASK = 0x0 // BASEPRI = 0x0 // CONTROL = 0x0 // // Attempt to put the processor into as close to the reset state as possible // before passing control to the firmware. // // No attempt is made to set CONTROL to zero as it should already be set to ...
button_is_pressed(BUTTON_ID_BACK)
)) { // stop waiting if not held down any longer return false; } delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_get_fw_reset_vector(&reset_vector, &initial_sp); if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initial_sp == 0xffffffff) { ...
/* * 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...
strlen(suffix)
/* * 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_test_backing_data(0, 3)
; prv_test_backing_data(1, 0); prv_test_backing_data(2, 1); } void test_circular_cache__get(void) { prv_test_get_miss(0); prv_test_get_miss(1); prv_test_get_miss(2); prv_test_get_miss(3); prv_push(0); prv_test_get_hit(0, 0); prv_test_get_miss(1); prv_test_get_miss(2); prv_test_get_miss(3); pr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ sys_hrm_manager_unsubscribe(data->hrm_session); }
text_layer_deinit(&data->title_text_layer); text_layer_deinit(&data->status_text_layer); window_deinit(&data->window); app_free(data); } static void prv_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* mfg_hrm_app_get_info(void) { static const PebblePro...
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 governing p...
(&s_outbox_iterator, result, context)
; } } static void prv_app_message_setup(void) { s_inbox_size = 0; s_outbox_size = 0; s_outbox_buffer = NULL; s_app_message_outbox_send_call_count = 0; s_is_outbox_message_pending = false; app_message_deregister_callbacks(); } static void prv_app_message_teardown(void) { if (s_outbox_buffer) { free...
/* * 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_ERROR, "Failed to query BMA255"); return; }
he 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. */ // This app only makes sense on Snowy, as it uses addresses and sector sizes that only...
(msg_text_layer, GColorWhite)
; text_layer_set_font(msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); layer_add_child(&window->layer, &msg_text_layer->layer); msg_text_layer = &data->msg_text_layer[1]; text_layer_init(msg_text_layer, &GRect(0, 32, window->layer.bounds.size.w, 18)); if (data->test_case >= FLASH_TEST_CASE_RU...
w, void *data) { return true; } static bool prv_cb_return_false(void *w, void *data) { return (s_count++ != (int)data); } void test_transcription__validate(void) { bool result; Transcription * validate_test = (Transcription *) s_test_transcription_example; size_t test_size = sizeof(s_test_transcription_exam...
(result, end)
; result = transcription_iterate_words((TranscriptionWord *)words_test, 2, (TranscriptionWordIterateCb)prv_cb_return_true, NULL); cl_assert_equal_p(result, &words_test[15]); s_count = 0; result = transcription_iterate_words((TranscriptionWord *)words_test, 3, (TranscriptionWordIterateCb)prv_cb_ret...
.variants = { i18n_noop("You walked %d steps today. " "Don't fret, you can get back on track in no time 😉"), i18n_noop("You walked %d steps today. Good news is the sky's the limit!"), i18n_noop("You walked %d steps today. " "Try to take even more steps tomor...
i18n_noop("Hey sleepy head. You slept for %dH %dM which " "is %d%% below your typical. Try to get more tonight!")
, i18n_noop("Groggy? You slept for %dH %dM which is %d%% below your typical. Sleep " "is important for everything you do-try getting more shut eye tonight!"), i18n_noop("It's a new day! You slept for %dH %dM which is %d%% below your typical. " "It's not your best, but...
he "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS...
{ return s_first_app_launched; }
WakeupInfo app_manager_get_app_wakeup_state(void) { return s_next_app.wakeup_info; } // --------------------------------------------------------------------------------------------- //! This is the wrapper function for all apps here. It's not allowed to return as it's //! the top frame on the stack created for the...
dest_str += length; left -= length; fmt = ptr + 1; // End of string if (*ptr == '\0' || *fmt == '\0') { break; } char pad = '\0'; size_t width = 0; // Process flags // These are the only ones our old impl cared about. if (*fmt == '0' || *fmt == '+') { pad = *fmt...
prv_iso8601_year(t)
(prv_right_flip_first_quarter_frame_clipping, "right_flip_first_quarter_frame_clipping")
; }; // This test records a clipping mask of the half progress frame of the right "round flip" compositor // transition animation and then clips a full-screen red rectangle to the resulting mask static void prv_right_flip_half_frame_clipping(GContext *ctx) { compositor_round_flip_transitions_flip_animation_update(c...
(dstbuf, 256, "There are %#o lights, %#o", 8, -4)
; cl_assert_equal_s(dstbuf, "There are 010 lights, 037777777774"); // Zero padded minimum character output snprintf(dstbuf, 256, "There are %03o lights, %03o", 8, -4); cl_assert_equal_s(dstbuf, "There are 010 lights, 37777777774"); // Space padded minimum character output snprintf(dstbuf, 256, "There are ...
f (boot_bit_test(BOOT_BIT_FORCE_PRF)) { boot_bit_clear(BOOT_BIT_FORCE_PRF); return true; } if (prv_prf_button_combination_is_pressed()) { dbgserial_putstr("Hold down UP + BACK + SELECT for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!prv_prf_button_combination_is_pressed...
(BOOT_BIT_RECOVERY_START_IN_PROGRESS)
; prv_sad_watch(ERROR_CANT_LOAD_FW); } bool force_boot_recovery_mode = prv_check_force_boot_recovery(); if (force_boot_recovery_mode) { dbgserial_putstr("Force-booting recovery mode..."); } if (force_boot_recovery_mode || prv_check_for_fw_start_failure()) { if (!fw_copy_switch_to_recovery_fw()) ...
/* * 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...
{ // We allow only a limited number of app heartbeats to accumulate. A NULL means we reached the // limit analytics_heartbeat_set(heartbeat, metric, value); }
analytics_storage_give_lock(); } void analytics_set_entire_array(AnalyticsMetric metric, const void *value, AnalyticsClient client) { analytics_storage_take_lock(); AnalyticsHeartbeat *heartbeat = analytics_storage_find(metric, NULL, client); if (heartbeat) { // We allow only a limited number of app hea...
.all_day = 0, // this is a non-all-day event spanning 24h }, }; cl_assert(timeline_add(&all_day_item)); Iterator iterator = {}; TimelineIterState state = {}; TimelineNode *head = NULL; cl_assert_equal_i(timeline_init(&head), S_SUCCESS); const time_t time_21_00_march_1_pst = 1425272400; cl_assert...
timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1425272400)
, S_SUCCESS); time_t midnight_march_2_pst = 1425283200; // day 1 cl_assert(uuid_equal(&state.pin.header.id, &multiday_item.header.id)); cl_assert(uuid_equal(&state.node->id, &multiday_item.header.id)); cl_assert(state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst); cl_...
16}, { 1032, 88, 224}, { 960, 112, 176}, { 1192, 96, 224}, { 968, 88, 176}, { 792, 200, -32}, { 744, 256, -144}, { 864, 240, -72}, { 920, 152, 24}, { 920, 136, 16}, { 856, 200, -8}, { 840, 256, -24}, { 848, 256, -32}, { 880, 224, -16}, { 952, 264, -48}, { 1104...
ARRAY_LENGTH(samples)
/* * 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...
{ 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_mod...
nfig(id1, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); // 2 pins should be added (for Thursday / Friday) cl_assert_equal_i(s_num_timeline_adds, 2); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_WEEK...
(s_num_timeline_removes, 2)
; cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. No alarms should be up s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 2); prv_assert_alarm_config(id2, 11, 30, true, ALARM_KIND_JUST_ONCE,...
f_free(s_read_header_mbuf); s_read_header_mbuf = NULL; SmartstrapResult result = SmartstrapResultOk; if (!success) { result = SmartstrapResultTimeOut; } else if ((length < sizeof(FrameInfo)) || (header->length != length - sizeof(FrameInfo)) || (header->length > data_length) || (header->ver...
{ prv_send_service_discovery(NULL); s_last_service_discovery_time = current_time; return 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...
interval_timer_get(&timer, &average_ms)
; cl_assert_equal_i(num_intervals, 0); cl_assert_equal_i(average_ms, 0); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 0); cl_assert_equal_i(average_ms, 0); fake_rtc_increment_time_ms(1000); interval_timer_take_sample(&ti...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 4 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_b...
ction = 3 }, .y = { .integer = bounds->size.h / 2 - 1, .fraction = 3 } }; } return GPointPreciseFromGPoint(imprecise_center_point); } static void prv_draw_clock_face(GContext *ctx, ClockFace *face) { MultiWatchData *data = app_state_get_user_data(); const GRect *bounds = &window_get_root_layer(&d...
(&data->window)
; watch_model_cleanup(); } void tictoc_main(void) { prv_init(); app_event_loop(); prv_deinit(); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return PebbleTask_App; }
HealthServiceState *worker_state_get_health_service_state(void) { cl_fail("should never be called"); return NULL; } void sys_send_pebble_event_to_kernel(PebbleEvent* event) {} HRMSessionRef sys_hrm_manager_get_app_subscription(AppInstallId app_id) { return HRM_INVALID_SESSION_REF; } static bool s_activity_pr...
g feed failed, last feed %dms ago, current status 0x%"PRIx16" mask 0x%"PRIx16, (s_ticks_since_successful_feed * 1000) / TIMER_INTERRUPT_HZ, s_watchdog_bits, s_watchdog_mask); // Log about the tasks in reverse priority order. If we have multiple tasks stuck, this might just be because the // highest pri...
reboot_reason_get(&reason)
; if (reason.code == RebootReasonCode_Watchdog) { // Check if system task is the one triggering the watchdog PebbleTaskBitset new_mask = s_watchdog_mask & ~(1 << PebbleTask_KernelBackground); if ((new_mask & s_watchdog_bits) == new_mask) { // Put system task callback using from ISR variant ...
.size.w - clipped_rect.size.w - left_cropped_columns_count); if (top_cropped_rows_count) { // Skip over rows for each one that's cropped off the top. corner_insets_left >>= 4 * MIN(top_cropped_rows_count, 8); corner_insets_right >>= 4 * MIN(top_cropped_ro...
{ circle_func(ctx, GPoint(rect->origin.x + rect->size.w - radius - 1, rect->origin.y + rect->size.h - radius - 1), radius, GCornerBottomRight); bottom_rect_size_w -= radius; }
// Top Rect prv_fill_rect_legacy2(ctx, GRect(top_rect_origin_x, rect->origin.y, top_rect_size_w, radius), 0, GCornerNone, fill_color); // Middle Rect prv_fill_rect_legacy2(ctx, GRect(rect->origin.x, rect->origin.y + radius, rect->size.w, ...
if (!state.up) { state.menu_layer->inverter.layer.frame.origin.y -= abs_content_offset; } } layer_mark_dirty(&state.menu_layer->scroll_layer.layer); } void prv_center_focus_animation_update_in_and_out(Animation *animation, const AnimationProgress progr...
animation_schedule(anim)
; if (was_animating) { // create visual state that's already reflecting the beginning of the "out" animation prv_center_focus_animation_update_out_only(anim, 0); } } static void prv_apply_selection_change(MenuLayer *menu_layer, MenuRowAlign scroll_align, bool up, boo...
/* * 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_create_timer(argv, argc, false /*is_repeating*/)
/* * 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 (AMSCharacteristic c = 0; c < NumAMSCharacteristic; ++c) { cl_assert_equal_b(ams_can_handle_characteristic(s_characteristics[instance_idx][c]), expect_can_handle); }
} static void prv_discover_ams(uint8_t num_instances) { cl_assert(num_instances <= 2); if (num_instances) { for (int i = 0; i < num_instances && i < NUM_AMS_INSTANCES; i++) { ams_handle_service_discovered(&s_characteristics[i][0]); } } else { ams_invalidate_all_references(); } } void test_a...
; DPRINTF("%"PRIu64": value at: %d\n", time_ms - start_ms, value); cl_assert(max_loops > 0); max_loops--; } // Make sure the frame reached the "to" state cl_assert_equal_i(value, 100); // Make sure our started and stopped handlers got called cl_assert_equal_i(s_started_handler_calls.num_calls, ...
cl_assert_equal_point(test_value, set_value)
// If BT Settings is open, update BLE device name upon connecting device: if (event->bluetooth.connection.is_ble && event->bluetooth.connection.state == PebbleBluetoothConnectionEventStateConnected) { // https://pebbletechnology.atlassian.net/browse/PBL-22176 // iOS seems to respond wit...
list_count(data->remote_list_head)
; PBL_ASSERT(device_index < num_remotes, "Got index %" PRId16 " only have %" PRId32, device_index, num_remotes); StoredRemote* remote = (StoredRemote*) list_get_at(data->remote_list_head, device_index); bool connected = is_remote_connected(remote); const char *le_string = NULL; if (remote->type ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // "1.23456" * 3 is approx 3.7036800000000003, round up to 4 assert_float_parse("1,23456", 3, true, 4); }
TEST_NAMED_PBI_FILE("draw_line_across_nx_offset_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_y_offset_layer"))); ...
(&ctx, GPoint(0, 11), 3)
.address, &response.length)) { response.address = 0; response.length = 0; } } else { PBL_LOG(LOG_LEVEL_ERROR, "Invalid region (%"PRIu8")", request->region); } prv_send_frame(OPCODE_FLASH_GEOMETRY, &response, sizeof(response)); } static void prv_handle_flash_erase_request(const void *payload, ...
(BOOT_BIT_NEW_SYSTEM_RESOURCES_AVAILABLE)
; } else if (request->region == REGION_FW_SCRATCH) { boot_bit_set(BOOT_BIT_NEW_FW_AVAILABLE); } else if (request->region == REGION_PFS) { // Do nothing! } else if (request->region == REGION_COREDUMP) { // Do nothing! } else { PBL_LOG(LOG_LEVEL_ERROR, "Invalid region (%"PRIu8")", request->region)...
ion*) property_animation->animation.implementation) ->accessors.setter.gpoint(property_animation->subject, result); } // ----------------------------------------------------------------------------------------- void property_animation_update_grect(PropertyAnimation *property_animation_h, ...
{ return; }
GColor8 result; result.a = interpolate_int16( distance_normalized, property_animation->values.from.gcolor8.a, property_animation->values.to.gcolor8.a); result.r = interpolate_int16( distance_normalized, property_animation->values.from.gcolor8.r, property_animation->values.to....
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return true; // continue iterating }
struct UuidFilterData *uuid_data = (struct UuidFilterData *)context; AppInstallId app_id; AppDBEntry entry; info->get_key(file, (uint8_t *)&app_id, info->key_len); info->get_val(file, (uint8_t *)&entry, info->val_len); if (uuid_equal(&uuid_data->uuid, &entry.uuid)) { uuid_data->found_id = app_id; ...
uf_size, session); prv_add_active_calories_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_hr_metric_info(headings, headings_buf_size, values, values_buf_size, avg_hr, hr_zone_time_s); } else if (session->ty...
(num_sessions * sizeof(ActivitySession))
; if (activity_get_sessions(&num_sessions, sessions)) { for (unsigned int i = 0; i < num_sessions; i++) { if (sessions[i].ongoing) { // Don't process incomplete events continue; } switch (sessions[i].type) { case ActivitySessionType_Nap: // PBL-36355 Disable na...
{ -240, 720, 192}, { -80, 680, 320}, { 48, 848, 280}, { 120, 984, 304}, { 176, 1080, 376}, { 240, 1192, 224}, { 216, 1008, 232}, // 60 seconds // elapsed: 1 minutes { 184, 800, 128}, { 224, 632, 120}, { 256, 456, 176}, { 264, 424, 88}, { 256, 304, 56}, { 264, 152,...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25478_4 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 65 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { 56, -320, -944}, { 72...
{ 368, 552, -496}, { 320, 504, -352}, { 304, 696, -376}, { 232, 720, -328}, { 232, 704, -320}, { 208, 720, -344}, { 232, 736, -296}, { 264, 736, -272}, { 280, 848, -168}, { 344, 808, -136}, { 232, 880, -120}, { 208, 1224, -176}, { 160, 1416, -128}, { -32, 1608, -...
cept in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY K...
(APP_LOG_LEVEL_ERROR, "Out of memory!")
; return; } // Zero out: memset(result, 0, sizeof(ScanResult)); } // Update all the fields into the result: result->device = device; result->rssi = rssi; // Try getting TX Power Level: int8_t tx_power_level; if (ble_ad_get_tx_power_level(ad_data, &tx_power_level)) { APP_LOG(APP_LOG...
t *list, TimelineResourceId timeline_res, TimelineResourceId card_res) { attribute_list_add_uint32(list, AttributeIdIconTiny, timeline_res); attribute_list_add_uint32(list, AttributeIdIconSmall, card_res ?: timeline_res); attribute_list_add_uint32(list, AttributeIdIconLarge, card...
(&list, AttributeIdSubtitle, "Q4 • 1:25")
; attribute_list_add_uint32(&list, AttributeIdSportsGameState, is_ingame ? 1 : 0); attribute_list_add_cstring(&list, AttributeIdNameAway, "GSW"); attribute_list_add_cstring(&list, AttributeIdRecordAway, "114-152"); attribute_list_add_cstring(&list, AttributeIdScoreAway, "86"); attribute_list_add_cstring(&list...
/* * 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 (jerry_value_t)EM_ASM_INT({ return __jerryRefs.acquire($0); }, value); }
void jerry_release_value(jerry_value_t value) { EM_ASM_INT({ __jerryRefs.release($0); }, value); } //////////////////////////////////////////////////////////////////////////////// // Get the global context //////////////////////////////////////////////////////////////////////////////// jerry_value_t jerry...
ndlers, context); animation_set_implementation(h, &implementation); return h; } // -------------------------------------------------------------------------------------- // Setup. Called before each of the tests execute void test_animation__initialize(void) { fake_rtc_init(1024*200 /*ticks */, 200 /*seconds *...
(prop_h, &set_r)
; r = GRect(0, 0, 0, 0); property_animation_get_to_grect(prop_h, &r); cl_assert_equal_rect(set_r, r); subject = (void *)0x11223344; property_animation_set_subject(prop_h, &subject); subject = NULL; property_animation_get_subject(prop_h, &subject); cl_assert(subject == (void *)0x11223344); // Destro...
_valid_key = (int32_t)newest_valid_key - max_records; oldest_valid_key = MAX(0, oldest_valid_key); AlgMinuteFileRewriteContext context = (AlgMinuteFileRewriteContext) { .oldest_valid_key = oldest_valid_key, .newest_valid_key = newest_valid_key, .watchdog_kicks_left = max_records, }; // Rewrite the ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Error %"PRIi32" writing out minute data to minute file", (int32_t)status); }
else { s_alg_state->num_minute_records++; success = true; } exit: if (minute_file) { prv_minute_data_file_close(minute_file); } return success; } // ------------------------------------------------------------------------------------- static DataLoggingSession *prv_get_dls_minute_session(void) {...
map_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r8_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, STROKE_SMALL)
/* * 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 (length--) { crc = (crc >> 4) ^ s_lookup_table[(crc ^ *bytes) & 0xf]; crc = (crc >> 4) ^ s_lookup_table[(crc ^ (*bytes >> 4)) & 0xf]; bytes++; }
crc ^= 0xffffffff; return crc; }
app_name) + 1; node->name = app_malloc_check(len); strncpy(node->name, app_name, len); prv_sorted_add(source, node); } static AppMenuNode * prv_find_node_with_install_id(const AppInstallId install_id, const AppMenuDataSource * const source) { AppMenuNode *node = ...
((ListNode*)node)
; ++index; } return MENU_INDEX_NOT_FOUND; } GBitmap *app_menu_data_source_get_node_icon(AppMenuDataSource *source, AppMenuNode *node) { if (!node->icon && source->show_icons) { // If the icon is currently NULL and we should be showing icons, load the icon prv_load_list_item_icon(source, node); } ...
/* * 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 (ble_hrm_is_supported_and_enabled()) { service_uuids[num_uuids++] = bt_uuid_expand_16bit(0x180D); // Heart Rate Service }
#endif // Pebble Pairing Service UUID: service_uuids[num_uuids++] = bt_uuid_expand_16bit(PEBBLE_BT_PAIRING_SERVICE_UUID_16BIT); ble_ad_set_service_uuids(ad, service_uuids, num_uuids); char device_name[BT_DEVICE_NAME_BUFFER_SIZE]; bt_local_id_copy_device_name(device_name, true); ble_ad_set_local_name(ad,...
/* * 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 false; }
// Do stuff that needs to happen when stack starts, i.e. bootstrap, load FW, ... if (!dialog_bootrom_load_second_stage_bootloader()) { // Failed to load BT bootloader. Shutdown if we haven't tried this already. PBL_LOG(LOG_LEVEL_ERROR, "Failed to load BLE Second Stage Bootloader - shutting down"); if ...
_dialog.h" #include "applib/ui/dialogs/dialog.h" #include "applib/ui/dialogs/dialog_private.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/status_bar_layer.h" #include "applib/ui/window_stack.h" #include "applib/ui/layer.h" #include "applib/ui/action...
utf8_get_next(cursor)
)) { response_len_chars++; } } AnalyticsEvent event_type; if (!data->show_confirmation_dialog) { event_type = AnalyticsEvent_VoiceTranscriptionAutomaticallyAccepted; } else if (success) { event_type = AnalyticsEvent_VoiceTranscriptionAccepted; } else { event_type = AnalyticsEvent_VoiceT...
/* * 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...
{ // Corrupted description return false; }
// Log around this operation, as it can take some time (hundreds of ms) PBL_LOG(LOG_LEVEL_DEBUG, "CRCing recovery..."); start_address += sizeof(FirmwareDescription); #if CAPABILITY_HAS_DEFECTIVE_FW_CRC const uint32_t calculated_crc = flash_calculate_legacy_defective_checksum( start_address, firmware_de...
test_flash_region__cleanup(void) { } void test_flash_region__erase_optimal_range_empty(void) { flash_region_erase_optimal_range(0, 0, 0, 0); cl_assert_equal_i(s_command_list_index, 0); } void test_flash_region__erase_optimal_range_sectors_simple(void) { // Erase one sector 0x10000 - 0x20000 flash_region_eras...
cl_assert_equal_i(s_command_list[0].addr, 32 * 1024)
; cl_assert_equal_i(s_command_list[0].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[1].addr, 36 * 1024); cl_assert_equal_i(s_command_list[1].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[2].addr, 40 * 1024); cl_assert_equal_i(s_command_list[2].type, SubsectorEraseCommand); ...
/* * 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...
(num.integer == -1)
analytics_set(ANALYTICS_APP_METRIC_FLASH_READ_BYTES_COUNT, analytics_read_bytes_count, AnalyticsClient_Worker); analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT, analytics_write_bytes_count, AnalyticsClient_Worker); } analytics_read_count = 0; analytics_read_bytes_count = 0; analytics_write_byte...
delay_us(5)
; s_flash_state.deep_sleep = true; } } static void flash_deep_sleep_exit(void) { assert_usable_state(); if (s_flash_state.deep_sleep) { flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_WAKE); flash_end_cmd(); // wait a sufficient amount of time to enter standby mode // It appear...
lis3dh_set_fifo_mode(MODE_STREAM); lis3dh_enable_fifo(); } } static void prv_read_samples(void *data) { uint8_t src_reg; lis3dh_read(LIS3DH_FIFO_SRC_REG, 1, &src_reg); uint8_t num_samples = src_reg & FSS_MASK; AccelRawData accel_raw_data[num_samples]; if (src_reg & FIFO_OVRN) { PBL_LOG(LOG_LE...
if (!s_running) { return (-1); }
// No peeking if we're in FIFO mode. if (lis3dh_get_fifo_mode() == MODE_STREAM) { return (-2); } accel_get_data((AccelRawData*)data, 1); return (0); } // Compute and return the device's delta position to help determine movement as idle. static uint32_t prv_compute_delta_pos(AccelRawData *cur_pos, Ac...
ncher_icon_bitmap = { .addr = (void*) &s_music_launcher_icon_pixels, .row_size_bytes = 4, .info_flags = 0x1000, .bounds = { .origin = { .x = 0, .y = 0 }, .size = { .w = 24, .h = 27 }, }, }; typedef struct { Window window; MenuLayer menu_layer; GBitmap icon; Window detail_window; TextLayer ...
(window, &(WindowHandlers) { .load = prv_window_load, })
; const bool animated = true; app_window_stack_push(window, animated); } //////////////////// // App boilerplate static void handle_init() { AppData *data = (AppData *)app_zalloc_check(sizeof(AppData)); app_state_set_user_data(data); push_window(data); const int exist_result = persist_exists(COUNT_PKEY);...
timeline_event_deinit(); stub_new_timer_cleanup(); fake_settings_file_reset(); } // Tests //////////////////////////////////////////////////////////////// void test_calendar__no_events(void) { timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); Tim...
cl_assert(!stub_new_timer_is_scheduled(timer_id))
; cl_assert(timeline_remove(&item1.header.id)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 3); cl_assert(!prv_get_calendar_ongoing()); cl_assert(!stub_new_timer_is_scheduled(timer_id)); } void test_calendar__timer_test(void) { cl_assert(timeline_add(&item1)); timelin...
{ 1176, 232, -312}, { 1176, 320, -240}, { 1384, 472, -240}, { 1624, 608, -328}, { 1736, 816, -392}, { 1464, 952, -536}, { 1048, 1088, -600}, { 704, 1280, -632}, { 768, 1168, -400}, { 968, 1008, -320}, { 1296, 840, -304}, { 1568, 880, -360}, { 1544, 904, -400}, { ...
{ 1592, 328, -168}, { 1496, 240, -176}, { 1312, 152, -200}, { 712, -448, -16}, { 616, -224, -272}, { 656, -256, 16}, { 1080, 232, -256}, { 1352, 232, -352}, // 68 seconds { 1528, 368, -408}, { 1472, 264, -280}, { 1392, 448, -304}, { 1496, 648, -232}, { 1560, 744, ...
{ 880, 1160, -304}, { 944, 896, -216}, { 1216, 896, -224}, { 1416, 712, -168}, { 1656, 576, -144}, { 1328, 368, -104}, { 1312, 320, -232}, { 1528, 368, -208}, { 1736, 288, -120}, { 1384, 224, -168}, { 1240, 216, -224}, { 632, -552, -32}, { 568, -232, -360}, { 760...
e OFFSET_DRAW_RECT_CLIP_XY GRect(6, 6, 30, 40) #define OFFSET_DRAW_RECT_CLIP_NXNY GRect(-16, -16, 30, 40) void test_graphics_draw_rect_${BIT_DEPTH_NAME}__offset_aa_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // AA = true, SW = 1 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_...
// AA = true, SW = 5 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 5); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__offset_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // SW = 1 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_C...
sleep_summary_no_history(void) { // Tests init with zero history activity_insights_init(rtc_get_time()); // Make sure we don't trigger as soon as we're awake s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake; s_data.metric_history[ActivityMetricSleepExitAtSeconds][0] = 7 * SECONDS...
(s_data.pins_added, 2)
; #endif } // Make sure that when the watch resets, we retain state properly void test_activity_insights__walk_session_power_cycle(void) { activity_insights_init(rtc_get_time()); // Common metrics s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake; s_data.metric_history[ActivityMetric...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ (void)menu_layer; return ((SimpleMenuLayer*)callback_context)->sections[section_index].num_items; }
static void draw_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callback_context) { SimpleMenuLayer *simple_menu = (SimpleMenuLayer*)callback_context; const SimpleMenuItem *item = &simple_menu->sections[cell_index->section].items[cell_index->row]; menu_cell_basic_draw(ctx, cell_layer...
92, 0x0}, { 0, 0x42, 4888, 0x0}, { 15, 0x54, 2906, 0x0}, { 12, 0x41, 4764, 0x0}, { 0, 0x54, 4923, 0x0}, // 465: Local time: 08:20:00 PM { 10, 0x65, 4324, 0x0}, { 0, 0x6b, 4408, 0x0}, { 0, 0x78, 2810, 0x0}, { 17, 0x70, 6033, 0x0}, { 0, 0x62, 6409, 0x0}, { 0, 0x7a, 3581, 0x0}, ...
{ 38, 0x79, 5166, 0x0}, { 60, 0x47, 5880, 0x0}, { 49, 0x46, 7280, 0x0}, { 26, 0x47, 5481, 0x0}, { 41, 0x47, 7368, 0x0}, { 45, 0x43, 3396, 0x0}, { 0, 0x43, 2273, 0x0}, { 0, 0x63, 1260, 0x0}, { 6, 0x8e, 4256, 0x0}, { 6, 0x34, 871, 0x0}, { 0, 0x35, 2234, 0x0}, { 0, 0x51, 520...
{ 6, 0x41, 4585, 0x0}, { 16, 0x33, 3094, 0x0}, { 0, 0x34, 344, 0x0}, { 0, 0x44, 1342, 0x0}, // 630: Local time: 11:05:00 PM { 0, 0x43, 4263, 0x0}, { 0, 0x51, 3797, 0x0}, { 0, 0x42, 3254, 0x0}, { 19, 0x44, 7516, 0x0}, { 12, 0x35, 7161, 0x0}, { 0, 0x35, 8126, 0x0}, { 0, 0x...
_bytes = (required_row_size_bits + 7) / 8; if (data_size != required_total_size_bytes || required_row_size_bytes > bitmap->row_size_bytes) { PBL_LOG(LOG_LEVEL_WARNING, "Bitmap metadata is inconsistent! data_size %u", (unsigned int) data_size); PBL_LOG(LOG_LEVEL_WARNING, "format %u row_size_...
if (gbitmap_get_info(bitmap).is_palette_heap_allocated) { applib_free(bitmap->palette); }
bitmap->palette = palette; bitmap->info.is_palette_heap_allocated = free_on_destroy; } } GRect gbitmap_get_bounds(const GBitmap *bitmap) { if (!bitmap) { return GRectZero; } return bitmap->bounds; } void gbitmap_set_bounds(GBitmap *bitmap, GRect bounds) { if (bitmap) { bitmap->bounds = boun...
_code(error_code); static uint8_t prev_button_state = 0; prev_button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK; while (1) { // See if we should restart uint8_t button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK; if (button_state != prev_button_state) { system_reset(); ...
if (force_boot_recovery_mode) { dbgserial_putstr("Force-booting recovery mode..."); }
if (force_boot_recovery_mode || check_for_fw_start_failure()) { if (!switch_to_recovery_fw()) { // We've failed to load recovery mode too many times. sad_watch(ERROR_CANT_LOAD_FW); } } else { check_update_fw(); } if (check_and_increment_reset_loop_detection_bits()) { sad_watch(ERR...
stributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "apps/prf_apps/recovery_first_use_app/getting_started_button_...
(timer->id)
; // We now should be in mfg mode cl_assert(s_mfg_mode_entered); } void test_getting_started_button_combo__push_complex_and_release_to_simple(void) { // Up (nothing) -> Up+Select (mfg mode) -> Select (show version) prv_press_button(BUTTON_ID_UP); prv_press_button(BUTTON_ID_SELECT); prv_release_button(B...
); } static void prv_swap_up_complete(Animation *animation, bool finished, void *context) { SwapLayer *swap_layer = (SwapLayer *) context; if (swap_layer->is_deiniting) { return; } // remove the layout prv_remove_old_layout(swap_layer, swap_layer->next); // shift all of the indexes swap_layer->next...
prv_create_anim_frame_scroll((Layer *)swap_layer->next, SWAP_MS, dy, &swap_down_scroll_curve)
; return animation_spawn_create(prev_up, current_up, next_up, NULL); } static bool prv_setup_swap_down(SwapLayer *swap_layer) { // if there is no layout to swap down to, return if (!swap_layer->next) { return false; } // shift all of the indexes. No need to fetch the new next layer, since we will do tha...
/* * 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...
time_util_get_midnight_of(s_now_utc)
rent); PBL_ASSERTN(!animation_private_using_legacy_2(state)); AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!prv_is_mutable(state, animation)) { return false; } if (play_count == ANIMATION_PLAY_COUNT_INFINITE) { animation->play_count = ANIMATION_...
animation_private_using_legacy_2(NULL)
); return prv_complex_init(parent, animation_array, array_len, AnimationTypeSequence); } // ------------------------------------------------------------------------------------------- Animation *animation_sequence_create(Animation *animation_a, Animation *animation_b, Animation ...
_appear, .disappear = prv_window_disappear, .unload = prv_window_unload, }); window_set_user_data(window, data); // Initialize some variables early Layer *root_layer = window_get_root_layer(window); const GRect *window_frame = &root_layer->frame; // prepare the swap layer frame using notificat...
swap_layer_attempt_layer_swap(&data->swap_layer, ScrollDirectionUp)
l/events.h" #include "util/size.h" // Stubs //////////////////////////////////////////////////////////////////////////////////////////////////// #include "fake_system_task.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_rand_ptr.h" #include "stubs_rtc.h" void a...
{ cl_assert_equal_i(num_characteristics, TestCharacteristicCount); switch (service_ref) { case TestServiceInstanceComplete: characteristics_out[0] = TestCharacteristicInstanceCompleteOne; characteristics_out[1] = TestCharacteristicInstanceCompleteTwo; return 2; case TestServiceInstanceInco...
static int s_read_responses_consumed_count; void gatt_client_consume_read_response(uintptr_t object_ref, uint8_t value_out[], uint16_t value_length, GAPLEClient client) { ++s_read_responses_consumed_...
ctivitySleepStateLightSleep); activity_get_metric(ActivityMetricSleepState, 1, &value); cl_assert_equal_i(value, ActivitySleepStateLightSleep); prv_feed_cannned_accel_data(50 * SECONDS_PER_MINUTE, 0, ActivitySleepStateRestfulSleep); activity_get_metric(ActivityMetricSleepState, 1, &value); cl_asser...
(120 * SECONDS_PER_MINUTE, 0, ActivitySleepStateLightSleep)
; // Awake for 1 hour which puts us at 4am prv_feed_cannned_accel_data(60 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTotalSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){240 * SECONDS_PER_MINUTE, 150...
/* * 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_app_data->menu_layer)
); // --------------------------------------------------------------------------- // Run the appropriate test if (index == 0) { s_connected = true; // Flood bluetooth while (s_connected) { while (s_pending_count > 6 && s_connected) { psleep(100); } s_pending_count++; ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(name, ATT_PERM_READ)
; if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_DEBUG, "Unexpected error setting name: %d", (int)e); } } static void prv_gap_le_device_name_request(Connection *connection) { att_uuid_t name_id; ble_uuid_create16(ATT_CHAR_DEVICE_NAME, &name_id); uint16_t conn_idx = connection_get_idx(connection); ble_er...
AccODR acc_odr = 0; if (BMI160SampleRate_12p5_HZ == sample_rate) { acc_odr = BMI160AccODR_12p5_HZ; } else if (BMI160SampleRate_25_HZ == sample_rate) { acc_odr = BMI160AccODR_25_HZ; } else if (BMI160SampleRate_50_HZ == sample_rate) { acc_odr = BMI160AccODR_50_HZ; } else if (BMI160SampleRate_100_HZ ==...
{ static bool int_enabled = false; if ((int_enabled == enable_int) && (s_fifo_in_use == use_fifo)) { return; // No changes to make so don't redo writes } uint8_t map_mask = BMI160_INT_MAP_1_INT2_DATA_READY | BMI160_INT_MAP_1_INT2_FIFO_WATERMARK; uint8_t int_en_mask = BMI160_INT_EN_1_DRDY_EN ...
void accel_set_num_samples(uint32_t num_samples) { uint8_t fifo_frame_size = prv_get_fifo_frame_size(); // x,y,z accel data uint16_t max_num_samples = (BMI160_FIFO_LEN_BYTES / fifo_frame_size); max_num_samples = (max_num_samples / BMI160_FIFO_WM_UNIT_BYTES) * BMI160_FIFO_WM_UNIT_BYTES; if (num_samples ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
IWDG_SetPrescaler(IWDG_Prescaler_64)
; // ~8 seconds IWDG_SetReload(0xfff); IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable); DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP, ENABLE); } void watchdog_start(void) { IWDG_Enable(); IWDG_ReloadCounter(); } bool watchdog_check_reset_flag(void) { return RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET; }
iscovered at least 1 test cl_assert(num_tests > 0); // Let's sort the tests by name qsort(&test_entry[0], num_tests, sizeof(test_entry[0]), prv_qsort_sleep_test_entry_cb); // --------------------------------------------------------------------------------- // Print results in a table printf("\n\n"); pri...
while (prv_activity_sample_discovery_next(&test_entry[num_tests])) { ActivityFileTestEntry *entry = &test_entry[num_tests]; #ifdef ACTIVITY_TEST_ONLY if (strcmp(entry->name, ACTIVITY_TEST_ONLY)) { continue; } #endif entry->test_idx = num_tests; printf("\n\n===================================...
these here so that if we goto cleanup, then the variables are initialized PropertyAnimation *expand = NULL; PropertyAnimation *shrink = NULL; PropertyAnimation *revert = NULL; // Do the overshoot animation first expand = prv_create_int16_prop_anim(max, overshoot + max, stage_duration, &s_animated_dot_impl, ...
(&dot_frame, root_frame, GAlignCenter, false)
; layer_set_frame(&data->mic_window.mic_dot_layer, &dot_frame); layer_set_hidden(&data->mic_window.mic_dot_layer, false); static const uint32_t ANIMATION_DURATION = 270; static const int16_t MIN_RADIUS = 7; static const int16_t OVERSHOOT = 4; static const uint32_t DELAY_DURATION = 1000; static const uint...
void *unused) { if (EVENTED_TIMER_INVALID_ID == s_state.out.session_closed_object_queue_timer) { // handle race: timer was cancelled but event was already in the queue // Unfortunately, app_timer_cancel() doesn't tell us about this. return; } PBL_ASSERTN(s_state.state != PostMessageStateSessionOpen);...
(overhead + POSTMESSAGE_PROTOCOL_MAX_TX_CHUNK_SIZE, overhead + POSTMESSAGE_PROTOCOL_MAX_RX_CHUNK_SIZE)
; app_message_register_inbox_received(prv_inbox_received); app_message_register_inbox_dropped(prv_inbox_dropped); app_message_register_outbox_sent(prv_handle_outbox_sent); app_message_register_outbox_failed(prv_handle_outbox_failed); JS_VAR rocky = rocky_get_rocky_singleton(); rocky_add_function(rocky, RO...
/* * 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...
(text, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam quam tellus, fermentum quis vulputate quis, vestibulum interdum sapien. Vestibulum lobortis pellentesque pretium. Quisque ultricies purus eu orci convallis lacinia. Cras a urna mi. Donec convallis ante id dui dapibus nec ullamcorper erat egestas. Aene...
; // Trim text layer and scroll content to fit text box GSize max_size = text_layer_get_content_size(app_state_get_graphics_context(), text); text_layer_set_size(text, max_size); static const int vert_scroll_padding = 4; scroll_layer_set_content_size(scroll_layer, GSize(window->layer.bounds.size.w, ...
_activity__get_minute_history(void) { // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); const uint32_t exp_num_recor...
prv_activity_init_and_set_enabled(true)
; ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){300, 200, 100, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTotalSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]) ...
/* * 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...
(c0_points)
, }; memcpy(c0->points, c0_points, sizeof(c0_points)); GDrawCommand *c1 = gdraw_command_list_get_command(list, 1); *c1 = (GDrawCommand){ .type = GDrawCommandTypePath, .path_open = true, .stroke_color = GColorBlack, .stroke_width = 3, .num_points = ARRAY_LENGTH(c1_points), }; m...
.foreground = colors->primary_color, }; timeline_actions_push_action_menu( &config, window_manager_get_window_stack(ModalPriorityNotification)); } static void prv_handle_up_click(ClickRecognizerRef recognizer, void *context) { TimelineItemLayer *item_layer = (TimelineItemLayer *)context; const int16_t mi...
layer_add_child(&item_layer->layer, (Layer *)item_layer->timeline_layout)
nst int s_sunday_9_30 = 1427016600; // Sunday, March 22, 2015, 10:00 UTC static const int s_sunday_10_00 = 1427018400; // Sunday, March 22, 2015, 23:30 UTC static const int s_sunday_23_30 = 1427067000; // Monday, March 23, 2015, 10:30 UTC static const int s_monday_10_30 = 1427106600; static TimerID s_timer = TIMER_INV...
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == false)
; cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); active = do_not_disturb_is_active(); cl_assert(active == false); // Manual && !Scheduled && !Smart do_not_disturb_set_manually_enabled(true); cl_assert(do_not_disturb_is_manually_enabled() == true); cl_assert(do_not_disturb_is_schedule_enabled(...
ac[1] - v_ab[1] * v_ac[0]; // solve for d plane_eq[3] = -(plane_eq[0] * s_samples[0][0] + plane_eq[1] * s_samples[0][1] + plane_eq[2] * s_samples[0][2]); // Distance^2 = (a * xo + b * yo + c * zo + d) / (a^2 + b^2 + c^2) int64_t distance = ABS((plane_eq[0] * s_samples[idx_pt][0] + plane_eq[1] * s_...
if (!pt_to_plane_dist_under_thresh(0, 1, 2, 3, thresh)) { return (MagCalStatusNoSolution); }
/* * 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 (confirmation_dialog == NULL) { return NULL; } return actionable_dialog_get_dialog(&confirmation_dialog->action_dialog); }
ActionBarLayer *confirmation_dialog_get_action_bar(ConfirmationDialog *confirmation_dialog) { if (confirmation_dialog == NULL) { return NULL; } return &confirmation_dialog->action_bar; } void confirmation_dialog_set_click_config_provider(ConfirmationDialog *confirmation_dialog, ...
new_timer_create()
; if (!prv_set_pin_config()) { return false; } if (!prv_is_alive()) { return false; } prv_config_charger(); prv_initialize_interrupts(); prv_update_rail_state(PmicRail_LDO2, true); // FW should bring this up #if BOARD_ROBERT_BB2 // On Robert BB2, the BLE chip is behind LDO3, which should a...
_object_field(canvas, ROCKY_CANVAS_UNOBSTRUCTEDHEIGHT, unobstructed_height); } return jerry_acquire_value(context_2d); } static void prv_rocky_update_proc(Layer *layer, GContext *ctx) { if (!rocky_global_has_event_handlers(ROCKY_EVENT_DRAW)) { return; } rocky_api_graphics_text_reset_state(); rocky_api...
{ strncpy(buf_out, "transparent", COLOR_BUFFER_LENGTH); }
else { snprintf(buf_out, COLOR_BUFFER_LENGTH, "#%02X%02X%02X", color.r * 85, color.g * 85, color.b * 85); } } static jerry_value_t prv_graphics_get_color_string(GColor8 color) { char buf[COLOR_BUFFER_LENGTH]; prv_graphics_color_to_char_buffer(color, buf); return jerry_create_string((const jer...
/* * 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...
(pcba_serial, "XXXXXXXXXXXX")
; // Test writing & reading back: const char* written_pcba_serial1 = "01234567901"; command_pcba_serial_write(written_pcba_serial1); pcba_serial = mfg_get_pcba_serial_number(); cl_assert_equal_s(written_pcba_serial1, pcba_serial); // Write second time, but too long const char* written_pcba_serial2_long ...
nger your stride length, and stride length is roughly // linearly proportional to cadence. The proportionality factor though depends on height, and // shorter users will have a steeper slope than taller users. // The general equation for stride length is: // stride_len = (a * steps/minute + b) * height // where a...
if ((distance_mm == 0) || (ms == 0)) { return 0; }
uint64_t distance_mm_64 = distance_mm; uint64_t ms_64 = ms; // Figure out the rate and see if it's walking or running. We set the walking threshold at // 120 m/min. This is 2m/s or 2 mm/ms const unsigned int k_max_walking_rate_mm_per_min = 120 * MM_PER_METER; uint64_t rate_mm_per_min = distance_mm_64 * M...
tes_v1, buffer, expected_size); prv_rcv_app_message_ack(APP_MSG_OK); json_bytes_remaining -= json_bytes_size; } EXPECT_OUTBOX_NO_MESSAGE_PENDING(); task_free(buffer); } void test_rocky_api_app_message__postmessage_not_jsonable(void) { prv_init_and_goto_session_open(); const char *not_jsonable_err...
rocky_api_app_message_get_app_msg_retry_timer()
; cl_assert(t != EVENTED_TIMER_INVALID_ID); cl_assert_equal_b(fake_app_timer_is_scheduled(t), true); // Enqueuing more objects shouldn't affect the pace at which things are retried: EXECUTE_SCRIPT("_rocky.postMessage('')"); EXPECT_OUTBOX_NO_MESSAGE_PENDING(); cl_assert_equal_b(app_timer_trigg...
ventBlob event_blob = { .event = AnalyticsEvent_LocalBtDisconnect, }; event_blob.local_bt_disconnect.lr = lr; event_blob.local_bt_disconnect.conn_handle = conn_handle; ANALYTICS_LOG_DEBUG("Event %d - BT Disconnect: Handle:%"PRIu16" LR: %"PRIu32, event_blob.event, ...
ANALYTICS_LOG_DEBUG("App Crash event: uuid:%s, pc: %p, lr: %p", uuid_string, (void *)pc, (void *)lr)
; #endif analytics_logging_log_event(&event_blob); } extern bool comm_session_is_valid(const CommSession *session); // ------------------------------------------------------------------------------------------ static bool prv_get_connection_details(CommSession *session, bool *is_ppogatt, ...
(I2C_LIS3DH)
; enable_accel_interrupts(); s_running = false; } } void lis3dh_init_mutex(void) { s_accel_mutex = mutex_create(); } void lis3dh_lock(void) { mutex_lock(s_accel_mutex); } void lis3dh_unlock(void) { mutex_unlock(s_accel_mutex); } static void prv_handle_tap(void *data) { IMUCoordinateAxis axis; ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_current_flush_line < ARRAY_LENGTH(s_corner_shape) || s_current_flush_line >= DISP_ROWS - ARRAY_LENGTH(s_corner_shape)) { memcpy(s_line_buffer, fb_line, FRAMEBUFFER_BYTES_PER_ROW); uint8_t corner_idx = (s_current_flush_line < ARRAY_LENGTH(s_corner_shape))? s_current_flush_line :...
#else row->data = fb_line; #endif s_current_flush_line++; return true; } return false; } //! display_update complete callback static void prv_flush_complete_cb(void) { s_current_flush_line = 0; framebuffer_reset_dirty(compositor_get_framebuffer()); if (s_update_complete_handler) { s_update...
prompt_send_response_fmt(buf, sizeof(buf), "present=%d, connected=%d", accessory_is_present(), smartstrap_is_connected())
; } #endif // Subscription functions //////////////////////////////////////////////////////////////////////////////// bool smartstrap_connection_has_subscriber(void) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); return s_subscriber_count > 0; } DEFINE_SYSCALL(void, sys_smartstrap_subscribe, void) { smartstra...
45 #define STEPS_TOP ((DISP_ROWS - 3 * STEPS_HEIGHT)/2) #if PBL_RECT #define DISP_COLS 144 #define DISP_ROWS 168 #elif PBL_ROUND #define DISP_COLS 180 #define DISP_ROWS 180 #endif #define CUR_STEP_RECT GRect(0, STEPS_TOP, DISP_COLS, STEPS_HEIGHT) #define TIME_RECT GRect(0, STEPS_TOP + STEPS_HEIGHT, DISP_COLS,...
{ strcpy(data->debug_card.dialog_text, title); // Get History time_t day_start = time_start_of_today(); for (int i = 0; i < 30; i++) { HealthValue value = health_service_sum(metric, day_start, day_start + SECONDS_PER_DAY); APP_LOG(APP_LOG_LEVEL_DEBUG, "%d: %d", i, (int)value); char temp[32]; sn...
// ----------------------------------------------------------------------------------------- static void prv_display_seconds_history_alert(HealthAPITestAppData *data, const char *title, HealthMetric metric) { strcpy(data->debug_card.dialog_text, title); // Get Histo...
dx); } prv_unlock(); return connection; } Connection *connection_by_idx_check(uint16_t conn_idx) { 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_c...
prv_get_flag(connection, ConnectionFlag_IsSubscribedToConnectionStatusNotifications)
; } bool connection_should_pin_address(const Connection *connection) { return prv_get_flag(connection, ConnectionFlag_ShouldPinAddress); } bool connection_should_auto_accept_re_pairing(const Connection *connection) { return prv_get_flag(connection, ConnectionFlag_ShouldAutoAcceptRePairing); } bool connection_is_...
as zero) snprintf(dstbuf, 256, "%.Xzero%.X", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.-3Xzero%.-3X", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (non-zero digits outputting zero) snprintf(dstbuf,...
cl_assert_equal_s(dstbuf, "What's a cool number? 0")
; } void test_sprintf__percent_n(void) { char dstbuf[512]; int val, val2; int8_t hhntest[4]; int16_t hntest[2]; int32_t lntest[2]; int64_t llntest[2]; int64_t jntest[2]; int32_t zntest[2]; int32_t tntest[2]; snprintf(dstbuf, 256, "%n", &val); cl_assert_equal_i(val, 0); snprintf(dstbuf, 256, "...
ata->fastcharge_enabled = false; } else if (charge_percent > PASS_BATTERY_PERCENTAGE) { // The reading can be a bit shaky in the short term (i.e. a flaky USB connection), or we // just started charging. Make sure we have settled before transitioning into the // RuninStatePass state ...
(SECOND_UNIT, prv_handle_second_tick)
; app_window_stack_push(window, true /* Animated */); } static void s_main(void) { app_init(); app_event_loop(); } const PebbleProcessMd* mfg_runin_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, // UUID: fbb6d0e6-2d7d-40bc-8b01-f2f8beb9c394 .c...
prv_reset_layer_tree_recognizers(manager, manager->active_layer, new_active_layer)
; } } else { // Cancel all active layer recognizers if: // - we can't find a new active layer (i.e. point is off screen or not attached to any child // layers of the window) // - we're in a different layer which is not a child of the previous active layer and there // are...