prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
q_handler); // enable the UART RX interrupt uart_set_rx_interrupt_enabled(QEMU_UART, true); } // ----------------------------------------------------------------------------------------- // KernelMain callback triggred by our ISR handler when we detect a high water mark on our // receive buffer or a footer sign...
(QEMU_HEADER_SIGNATURE)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME #define ENTRY3(name, element_type, num_elements) {element_type, num_elements}, #define ENTRY2(name, element_type) {element_type, 1}, #define ENTRY1(name) {ANALYTICS_METRIC_ELEMENT_TYPE_NIL, 0}, #define ENTRY(...) GET_MACRO(__VA_ARGS__, ENTRY3, ENTRY2, ENTRY1)(__VA_ARGS__)...
((kind == ANALYTICS_METRIC_KIND_DEVICE) || (kind == ANALYTICS_METRIC_KIND_APP))
; return s_metric_heartbeat_offset[metric]; } AnalyticsMetricKind analytics_metric_kind(AnalyticsMetric metric) { if ((metric > ANALYTICS_DEVICE_METRIC_START) && (metric < ANALYTICS_DEVICE_METRIC_END)) { return ANALYTICS_METRIC_KIND_DEVICE; } else if ((metric > ANALYTICS_APP_METRIC_START) && (met...
_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); // ------------------------------------------------------------------------------------- // anima...
(prv_count_handler_entries(&s_started_handler_calls, c), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 0); // Execute to the end of B & C prv_advance_to_ms_with_timers(start_ms + duration_total + 1 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handl...
app_install_release_md(app_md)
; return false; } if (process_metadata_get_run_level(app_md) < s_minimum_run_level) { PBL_LOG(LOG_LEVEL_WARNING, "Ignoring launch for app <%s>, minimum run level %d, app run level %d", process_metadata_get_name(app_md), s_minimum_run_level, process_metadata_get_run_level(app_md)); ...
comm_session_send_next_is_scheduled(session)
, true); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_b(comm_session_send_next_is_scheduled(session), false); comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection); } void test_session__capabilities(void) { Transport *transport = (Transport *) TransportID1; CommSession...
sh(); prv_put_ancs_disconnected_event(); } void ancs_handle_service_removed(BLECharacteristic *characteristics, uint8_t num_characteristics) { // There should only be one ancs client ancs_invalidate_all_references(); } void ancs_handle_service_discovered(BLECharacteristic *characteristics) { BLE_LOG_DEBUG("In...
{ BLE_LOG_DEBUG("Ignoring notification because we just connected and PreExisting"); }
else { BLE_LOG_DEBUG("Added ANCS notification!"); prv_notif_queue_push_attr_request(nsnotification->uid, properties); } // See analytics_external_collect_ancs_info() s_ns_flags_used_bitset |= nsnotification->event_flags; break; case EventIDNotificationModified: BLE_L...
/* * 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...
(&(HealthData) {})
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_activity_summary_card__no_current_steps(void) { HealthData health_data = { .step_data = 0, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, ...
ing ready event"); switch (event->status) { case VoiceStatusSuccess: VOICE_LOG("Session setup successfully"); data->start_ms = prv_get_time_ms(); data->speech_detected = false; data->dictation_timeout = app_timer_register(DICTATION_TIMEOUT, prv_dictation_timeout_cb, data); ...
VOICE_LOG("Result: error %"PRId8, event->status)
; prv_handle_dictation_error(data, event->status); break; case VoiceStatusRecognizerResponseError: VOICE_LOG("Result: speech not recognized"); prv_handle_dictation_error(data, event->status); break; case VoiceStatusTimeout: VOICE_LOG("Result: timeout"); if (!connectio...
tion = 0}; graphics_draw_arc_precise_internal(ctx, fixed_center, fixed_radius, angle_start, angle_end); } void graphics_draw_arc(GContext *ctx, GRect rect, GOvalScaleMode scale_mode, int32_t angle_start, int32_t angle_end) { GPointPrecise center; Fixed_S16_3 radius; grect_polar_calc_val...
graphics_fill_radial(ctx, rect, scale_mode, inset_thickness, 0, TRIG_MAX_ANGLE)
; } void graphics_fill_circle(GContext* ctx, GPoint p, uint16_t radius) { PBL_ASSERTN(ctx); if (ctx->lock) { return; } if (radius == 0) { // Filling a circle of radius zero should just draw a single pixel. // Backup the stroke color and set that to the current fill color since the stroke color ...
ess or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "transform.h" #include "applib/graphics/gdraw_command_private.h" #include "applib/graphics/gdraw_command_transforms.h" #include "applib/ui/animation.h" #include "applib/ui/animation_in...
(duration, to_duration)
; } return duration; } static bool prv_elapsed_setter(KinoReel *reel, uint32_t elapsed) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data->elapsed == elapsed) { return false; } bool changed = false; data->elapsed = elapsed; if (data->from_reel && kino_reel_set_elapsed(data...
" #include "mfg/mfg_mode/mfg_factory_mode.h" #include "mfg/results_ui.h" #include "process_management/app_manager.h" #include "process_management/pebble_process_md.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "resource/system_resource.h" #include "services/common/li...
graphics_draw_line( ctx, GPoint(radial_padding_size, layer->bounds.size.h / 2), GPoint(layer->bounds.size.w - radial_padding_size - 1, layer->bounds.size.h / 2))
; prv_draw_border(layer, ctx, radial_padding_size); } static void prv_draw_bitmap(struct Layer *layer, GContext *ctx, uint32_t res) { GBitmap *bitmap = gbitmap_create_with_resource(res); graphics_draw_bitmap_in_rect(ctx, bitmap, &layer->bounds); gbitmap_destroy(bitmap); } static void prv_update_proc(struct L...
) { return s_activation_time; } static void prv_set_activation_time(time_t activation_time) { s_activation_time = activation_time; } static uint32_t s_activity_activation_delay_insight_bitmask = 0; bool activity_prefs_has_activation_delay_insight_fired(ActivationDelayInsightType type) { return (s_activity_activ...
cl_assert_equal_i(stats.total_days, 29)
; cl_assert_equal_i(stats.consecutive_days, 29); // Test sparse history static const int32_t sparse_history[ACTIVITY_HISTORY_DAYS] = { 1234, // This value is ignored since it's loaded in as the current day 6233, 4277, 9857, 0, 6540, 719, 0, 0, 0, 0, 0, 0, 0, 0, 6664, 9177, 0, 2330, 3951, 1568, 871, 0...
{ VOICE_LOG("Handling ready event"); switch (event->status) { case VoiceStatusSuccess: VOICE_LOG("Session setup successfully"); data->start_ms = prv_get_time_ms(); data->speech_detected = false; data->dictation_timeout = app_timer_register(DICTATION_TIMEOUT, prv_dictation_timeout_cb, ...
prv_handle_ready_error(data); break; default: WTF; } if (event->status != VoiceStatusSuccess) { data->last_session_successful = false; } } static bool prv_handle_dictation_success(VoiceUiData *data, PebbleVoiceServiceEvent *event) { if (data->buffer_size == 0) { // If buffer size...
LOG_LEVEL_ERROR, "Failed to start accel service"); } } } mutex_unlock_recursive(s_mutex); } // ------------------------------------------------------------------------------------------- // NOTE: This is guaranteed to be only called from the KernelMain task by the event_service static void prv_tap_remov...
event_service_init(PEBBLE_ACCEL_SHAKE_EVENT, &prv_tap_add_subscriber_cb, &prv_tap_remove_subscriber_cb)
; #ifdef TEST_KERNEL_SUBSCRIPTION accel_data_service_subscribe(5, prv_kernel_data_subscription_handler); accel_tap_service_subscribe(prv_kernel_tap_subscription_handler); accel_service_set_sampling_rate(ACCEL_SAMPLING_10HZ); #endif imu_power_down(); } #ifdef RECOVERY_FW void command_accel_peek(void) { cons...
_bitmap->bounds.size.w % 32) ? 1 : 0)); #else const int row_size_bytes = dest_bitmap->row_size_bytes; #endif // SCREEN_COLOR_DEPTH_BITS == 8 // Number of blocks (i.e. 32-bit chunks) const int dest_row_length = row_size_bytes / 4; // The number of bits between the beginning of dest_block and glyph_block. // ...
MIN(32 - dest_shift, MIN(glyph_line_bits_left, glyph_block_bits_left))
; const uint32_t mask = (((1 << number_of_bits) - 1) << dest_shift); #if SCREEN_COLOR_DEPTH_BITS == 8 // dest_block points to the block if the dest image was a 1-bit buffer // translate this to an x coordinate in the 8-bit buffer const int32_t block_start_x = prv_convert_1bit_addr_to_8bit_x(des...
buted under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "services/normal/app_cache.h" #include "proce...
(fake_event_get_count(), 2)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ActivitySessionType_Run)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
ication), (uint8_t*) &ns_notification); cl_assert_equal_i(s_num_requested_notif_attributes, 5); cl_assert_equal_i(s_num_ds_notifications_received, 5); } extern ANCSClientState prv_get_state(void); extern void prv_check_ancs_alive(void); void test_ancs__alive_check_disconnection(void) { prv_check_ancs_alive(); ...
cl_assert_equal_i(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT)
; fake_event_clear_last(); ancs_invalidate_all_references(); cl_assert_equal_i(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT); // Make sure that losing BT altogether sends the event ancs_destroy(); cl_assert_equal_i(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT); fake_event_cle...
/* * 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...
(I2C4_ER, i2c_hal_error_irq_handler, &I2C_PMIC_MAG_BUS)
t_time(rtc_get_time() + SECONDS_PER_DAY); // activity_insights_recalculate_stats(); // activity_insights_process_sleep_data(rtc_get_time()); // cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); // } // // rtc_set_time(rtc_get_time() + SECONDS_PER_DAY); // activity_insights...
(fake_kernel_services_notifications_ancs_notifications_count(), 0)
/* * 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_convert_1bit_addr_to_8bit_x(bitmap, block_addr, dest_y)
, prv_get_8bit_x_from_1bit_x(dest_x)); dest_x = 20; dest_y = 100; block_addr = (uint32_t *)(uintptr_t)(((dest_y * row_1bit_size_words) + (dest_x / 32)) * 4); cl_assert_equal_i(prv_convert_1bit_addr_to_8bit_x(bitmap, block_addr, dest_y), prv_get_8bit_x_from_1bit_x(dest_x)...
_prefs_db_read(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, send_text_prefs_out, data_len), S_SUCCESS); cl_assert_equal_m(s_send_text_prefs, send_text_prefs_out, data_len); // Make sure we reject malformed data (not aligned to list size) cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_...
(watch_app_prefs_db_get_len(WEATHER_KEY, WEATHER_KEY_LEN), data_len)
; SerializedWeatherAppPrefs *weather_prefs_out = watch_app_prefs_get_weather(); cl_assert_equal_m(s_weather_prefs, weather_prefs_out, data_len); watch_app_prefs_destroy_weather(weather_prefs_out); }
git); } static int16_t get_axis_data(AccelAxisType axis, uint8_t *raw_data) { // each sample is 2 bytes for each axis int offset = 2 * BOARD_CONFIG_ACCEL.accel_config.axes_offsets[axis]; int invert = BOARD_CONFIG_ACCEL.accel_config.axes_inverts[axis]; int16_t raw = (((int16_t)raw_data[offset + 1]) << 8) | raw_...
prv_read_register(LIS3DH_CTRL_REG1, &ctrl_reg1)
) { ctrl_reg1 &= ~LPen; if (prv_write_register(LIS3DH_CTRL_REG1, ctrl_reg1)) { // Write successful, low power mode disabled return; } } } PBL_LOG(LOG_LEVEL_ERROR, "Failed to exit low power mode"); } void lis3dh_power_down(void) { if (accel_start()) { uint8_t ctrl_reg...
); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); // A touchdown occurs and the parent of the previous active recognizer becomes the active layer. // No...
prv_create_recognizers(k_rec_count)
; Window window = {}; layer_init(&window.layer, &GRectZero); Layer *root = &window.layer; RecognizerManager manager; recognizer_manager_init(&manager); Layer layer_a; layer_init(&layer_a, &GRectZero); layer_add_child(root, &layer_a); manager.window = &window; manager.active_layer = &layer_a; ma...
}, { 984, 336, 0}, { 1056, 272, 56}, { 1200, 200, 128}, { 1056, 200, 152}, { 944, 144, 88}, { 856, 64, 24}, // 61 seconds { 768, -32, 0}, { 720, -32, -8}, { 768, -32, 0}, { 808, -96, 40}, { 1000, -8, 16}, { 1080, -56, 24}, { 1696, -48, 128}, { 1416, 256, -80},...
{ 1144, 224, -208}, { 1056, 208, -184}, { 768, 176, -64}, { 760, 144, -32}, { 800, 176, 8}, { 856, 200, 72}, { 848, 320, -80}, { 888, 304, -88}, { 968, 336, -224}, { 1184, 240, -168}, // 67 seconds { 1216, 216, -112}, { 1808, 224, -32}, { 1384, 328, -48}, { 93...
{ 792, 64, 144}, { 712, 64, 0}, { 744, 32, -16}, { 832, 56, -32}, { 824, -8, -16}, { 976, -88, -24}, { 1072, 56, -176}, { 1392, -264, -32}, { 1544, 120, 56}, { 1144, 240, -232}, { 1256, 192, -184}, { 864, 336, -40}, { 592, 176, -48}, { 704, 192, 32}, { 760, 2...
case the length is not what it should be, do not add data element. return true; // continue parsing } const int8_t tx_power_level = *(int8_t *)elem->data; // Call back to client with parsed data: return callbacks->tx_power_level_cb(tx_power_level, cb_data); } // ------------------------------------------...
{ if (uuid_equal(ctx->service_uuid, &uuids[i])) { // Found! ctx->included = true; return false; // stop parsing } }
return true; // continue parsing } bool ble_ad_includes_service(const BLEAdData *ad, const Uuid *service_uuid) { struct IncludesServiceCtx ctx = { .service_uuid = service_uuid, .included = false, }; const BLEAdParseCallbacks callbacks = (const BLEAdParseCallbacks) { .services_cb = includes_servic...
easy_walk_distance_m); // Walk for a long time. People can walk at roughly 5km/h, so we should be close to 50km const int long_walk_time = 10 * MINUTES_PER_HOUR; steps = walking_cadence_spm * long_walk_time; time_ms = long_walk_time * SECONDS_PER_MINUTE * MS_PER_SECOND; int long_walk_distance_m = activity_pr...
(distance_mm, time_ms)
/ ACTIVITY_CALORIES_PER_KCAL; cl_assert_within(long_run_calories, 3000, 3200); // And finally throw in a specific value so that anyone who touches the function will have to // check up on the unit tests cl_assert_equal_i(long_run_calories, 3172); } // ---------------------------------------------------------...
const SlaveConnEventStats *orig_stats) { } bool bt_driver_analytics_get_conn_event_stats(SlaveConnEventStats *stats) { return false; } typedef enum { CmdInit = 0x01, CmdPut = 0x02, CmdCommit = 0x03, CmdAbort = 0x04, CmdInstall = 0x05, CmdInvalid = 0xff, } Cmd; ...
htonl(cookie)
, }; prv_receive_data(s_session, (const uint8_t *) &install_msg, sizeof(install_msg)); } #define assert_ack_count(c) \ { \ fake_comm_session_process_send_next(); \ cl_assert_equal_i(s_acks_received, c); \ } #define assert_nack_count(c) \ { \ fake_comm_session_process_send_next(); \ 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...
dbgserial_putstr("CRESET not high after reset")
; return false; } delay_ms(1); // Program the FPGA prv_spi_write(fpga_bitstream, bitstream_size); // Set SCS high so that we don't process any of these clocks as commands. gpio_output_set(&ICE40LP->spi.scs, false); // SCS not asserted (high) // 49+ SCLK cycles to tell FPGA we're done configuratio...
{ if (!pfs_active()) { // either we have downgraded or there is no data on the flash PBL_LOG(LOG_LEVEL_INFO, "PFS not active ... formatting"); pfs_format(true /* write erase headers */); } } // we need to run this before reserving a new GC region so that we don't // think a region is f...
(&checksum)
; mutex_unlock_recursive(s_pfs_mutex); return (crc); } void analytics_external_collect_pfs_stats(void) { uint16_t avail_kilobytes = (uint16_t)(get_available_pfs_space() / 1024); analytics_set(ANALYTICS_DEVICE_METRIC_PFS_SPACE_FREE_KB, avail_kilobytes, AnalyticsClient_System); } /* * Debug U...
the requested size */ /* can be broken into 2 framents leaving a fragment that is of the */ /* requested size and one that is at least as larger as the */ /* MINIMUM_MEMORY_SIZE. */ #define MINIMUM_MEMORY_SIZE 1 /* The following defines the structure that de...
{ /* Check to see if the current fragment is marked as free. */ if(heap_info_ptr->is_allocated) { alloc_segments++; *used += heap_info_ptr->Size * ALIGNMENT_SIZE; } else { free_segments++; /* Accumulate the total number of free Bytes. */ *free += heap_info_p...
while (heap_info_ptr < heap->end); UTIL_ASSERT(heap_info_ptr == heap->end); char format_str[80]; snprintf(format_str, sizeof(format_str), "alloc: %u (%u bytes), free: %u (%u bytes)", alloc_segments, *used, free_segments, *free); util_dbgserial_str(format_str); } void heap_calc_totals(Heap* const ...
/* * 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 (data->current_steps) { font = fonts_get_system_font(FONT_KEY_LECO_26_BOLD_NUMBERS_AM_PM); snprintf(buffer, sizeof(buffer), "%"PRIu32"", data->current_steps); } else { font = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD); snprintf(buffer, sizeof(buffer), EM_DASH); }
const int y = PBL_IF_RECT_ELSE(PBL_IF_BW_ELSE(85, 83), 88); graphics_context_set_text_color(ctx, CURRENT_TEXT_COLOR); graphics_draw_text(ctx, buffer, font, GRect(0, y, base_layer->bounds.size.w, 35), GTextOverflowModeFill, GTextAlignmentCenter, NULL); } static void prv...
12, 760, 384}, { 616, 1200, 184}, { 496, 600, -24}, { 488, 480, -16}, { 512, 1024, -136}, { 432, 576, -104}, { 480, 520, -184}, // 118 seconds { 408, 560, -120}, { 432, 616, -160}, { 408, 680, -48}, { 360, 840, 152}, { 352, 1192, 96}, { 288, 864, 456}, { 464, 928,...
{ 856, -776, -232}, { 648, 576, -576}, { 808, 1648, 448}, { 960, 2168, 1432}, { 1096, 1048, 1384}, { 656, 1760, 1200}, { 800, 1744, 1176}, { 680, 1304, 1240}, { 1240, 872, 216}, { 1000, 968, -144}, { 1352, 848, -672}, { 840, 552, -456}, { 856, 856, -1136}, { 104, ...
{ -264, 24, 680}, { -104, 144, 496}, { -184, 24, 704}, // 126 seconds { -112, 264, 416}, { -432, 160, 792}, { -496, 272, 1144}, { -288, 176, 712}, { -496, 280, 920}, { -336, 608, 1024}, { -224, 544, 816}, { 1432, 320, 400}, { -384, 280, 712}, { -280, 176, 552}, ...
ebble_asserts.h" #include <stdio.h> // stubs #include "stubs_process_manager.h" #include "stubs_passert.h" #include "stubs_app_state.h" #include "stubs_heap.h" ///////////////////////////// void test_gtypes__gpoint_scale_by_gsize(void) { GSize from = GSize(10, 20); GSize to = GSize(20, 40); GPoint point = GPo...
cl_assert_equal_i(2, PBL_IF_RECT_ELSE(1,2))
; #else #error "unknown platform" #endif } void test_gtypes__pbl_if_round_else(void) { #if defined(PLATFORM_TINTIN) cl_assert_equal_i(2, PBL_IF_ROUND_ELSE(1,2)); #elif defined(PLATFORM_SNOWY) cl_assert_equal_i(2, PBL_IF_ROUND_ELSE(1,2)); #elif defined(PLATFORM_SPALDING) cl_assert_equal_i(1, PBL_IF_ROUND_ELSE(1,2...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_fill_circle(ctx, circle_center, circle_radius)
; } } else { const int16_t flip_boundary_from_x = display_center.x + (flip_overlap_region_width / 2); const int16_t flip_boundary_to_x = 0; const int16_t current_flip_boundary_x = interpolate_int16(distance_normalized, flip_boundary_from_x,...
lt); } static jerry_value_t prv_create_function(void *c_function_ptr) { return jerry_create_external_function(c_function_ptr); } bool rocky_add_function(jerry_value_t parent, char *name, jerry_external_handler_t handler) { bool result = false; JS_UNUSED_VAL = rocky_get_or_create_object(parent, name, prv_create_...
(date_constructor)
) { return jerry_create_undefined(); } jerry_value_t date_obj; if (tick_time) { jerry_value_t args[] = { jerry_create_number(1900 + tick_time->tm_year), jerry_create_number(tick_time->tm_mon), jerry_create_number(tick_time->tm_mday), jerry_create_number(tick_time->tm_hour), jerry_...
calculate mask for angles if (!is_full_circle) { prv_get_angles_mask_edge(y, center, config.start_quadrant.quadrant, &top_starting_edge, &bottom_ending_edge, start_top, start_bottom); prv_get_angles_mask_edge(y, center, config.end_quadrant.quadrant, ...
prv_fill_oval_precise(ctx, center, radius_outer_x, radius_outer_y, radius_inner_x, radius_inner_y, angle_start, angle_end)
/* * 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...
simple_dialog_push(simple_dialog, prv_get_window_stack())
; } // ---------------------------------------------------------------------------------------------- //! Main Window typedef struct { ActionableDialog *alarm_popup; GBitmap *bitmap; GBitmap *action_bar_dismiss; GBitmap *action_bar_snooze; ActionBarLayer action_bar; TimerID vibe_timer; int max_vibes; ...
int res = E_UNKNOWN; if (!FD_VALID(fd) || (buf == NULL) || (size == 0)) { res = E_INVALID_ARGUMENT; goto cleanup; } File *file = &PFS_FD(fd).file; if ((file->op_flags & OP_FLAG_READ) == 0) { res = E_INVALID_ARGUMENT; goto cleanup; } if ((file->offset + size) > file->file_size) { PB...
((prev_size/PFS_PAGE_SIZE), (new_size/PFS_PAGE_SIZE), 1)
; } update_last_written_page(); } bool pfs_active_in_region(uint32_t start_address, uint32_t ending_address) { uint16_t starting_page = start_address / PFS_PAGE_SIZE; uint16_t ending_page = (ending_address) / PFS_PAGE_SIZE; for (uint16_t pg = starting_page; pg < ending_page; pg++) { PageHeader hdr; ...
/* * 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_resource_load_file_as_resource(TEST_IMAGES_PATH, TEST_PDC_FILE)
; cl_assert(resource_id != UINT32_MAX); GDrawCommandImage *image = gdraw_command_image_create_with_resource(resource_id); cl_assert(image != NULL); } void test_gdraw_command_resources__load_pdcs(void) { uint32_t resource_id = sys_resource_load_file_as_resource(TEST_IMAGES_PATH, TEST_PDC_FILE); cl_assert(reso...
lights"); // Variable length digits output snprintf(dstbuf, 256, "There are %.*u lights", 3, 4); cl_assert_equal_s(dstbuf, "There are 004 lights"); // Variable length digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.*uzero%.*u", -3, 0, -3, 1); cl_assert_equal_s(dstbuf, "zero1"); /...
snprintf(dstbuf, 256, "There are %03x lights, %03x", 16, -4)
ainer; BitmapLayer cassette_layer; GBitmap *cassette_current_icon; EventServiceInfo event_info; ProgressLayer track_pos_bar; uint32_t track_length; uint32_t track_pos; bool pause_track_pos_updates; enum ActionBarState action_bar_state; AppTimer *action_bar_revert_timer; AppTimer *volume_repeat_ti...
prv_create_layer_bounceback_animation(&data->length_text_layer.layer, time_rect)
, NULL); } static void prv_update_track_progress(MusicAppData *data); static void prv_flip_animated_text(Animation *animation, bool finished, void *context) { MusicAppData *data = context; data->pause_track_pos_updates = false; prv_update_track_progress(data); music_get_now_playing(data->title_buffer, d...
flags are unset. Depending //! on the firmware loaded onto the HRM, multiple apps can be run //! concurrently by setting the logical OR of the App IDs. static bool prv_set_running_apps(HRMDevice *dev, AS7000AppId apps) { return prv_write_register(dev, ADDR_APP_IDS, apps); } // Wait for the INT line to go low. Return...
(dev->state->lock)
; } // This regular timer callback executes once a second. It is part of the watchdog logic used to // detect if the sensor becomes unresponsive. static void prv_watchdog_timer_cb(void *data) { HRMDevice *dev = (HRMDevice *)data; if (++s_missing_interrupt_count >= AS7000_MAX_WATCHDOG_INTERRUPTS) { system_task_...
id = AttributeIdSubtitle; result_attributes.attributes[0].cstring = (char *)msg; result_attributes.attributes[1].id = AttributeIdIconLarge; result_attributes.attributes[1].uint32 = timeline_res_id; *action_result = (PebbleSysNotificationActionResult) { .id = *id, .type = type, .attr_list = result_a...
timeline_pin_window_push_modal(pin)
; } else { PBL_LOG(LOG_LEVEL_ERROR, "Failed to fetch parent pin"); } kernel_free(parent_id); } static void prv_perform_health_response_action(const TimelineItem *item, const TimelineItemAction *action) { const uint8_t insight_type = attribute_get_uint8(&item->...
ivate.h" #include "system/logging.h" #include "system/passert.h" #include "syscall/syscall_internal.h" #include <stdint.h> #include <string.h> // ------------------------------------------------------------------------------------------------- // Static variables //! The list of open Pebble Protocol sessions. //! @...
if (session->transport_imp->get_uuid) { return session->transport_imp->get_uuid(session->transport); }
return NULL; } static const char *prv_string_for_destination(TransportDestination destination) { switch (destination) { case TransportDestinationSystem: return "S"; case TransportDestinationApp: return "A"; case TransportDestinationHybrid: return "H"; default: WTF; return NULL; } } ...
est_params(const PebblePairingServiceConnParamSet *pps_params_in, GAPLEConnectRequestParams *params_out) { const uint16_t min_1_25ms = pps_params_in->interval_min_1_25ms; params_out->connection_interval_min_1_25ms = min_1_25ms; params_out->connection_interval_max_1_25ms ...
(connection, &conn_params->remote_desired_state)
; break; case PebblePairingServiceConnParamsWriteCmd_EnablePacketLengthExtension: PBL_LOG(LOG_LEVEL_INFO, "Enabling BLE Packet Length Extension"); break; case PebblePairingServiceConnParamsWriteCmd_InhibitBLESleep: PBL_LOG(LOG_LEVEL_INFO, "BLE Sleep Mode inhibited!"); ...
/* * 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...
layer_set_update_proc(&layer, &across_x_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_x_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.des...
not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES O...
(s_mag_mutex)
; --s_use_refcount; if (s_use_refcount == 0) { // We need to put the magnetometer into standby mode and read the data register to reset // the state so it's ready for next time. prv_enter_standby_mode(); uint8_t raw_data[7]; // DR_STATUS_REG is immediately before data registers mag3110_rea...
sion_send_queue_consume(s_app_session_ptr, length - 1); comm_session_send_queue_cleanup(s_app_session_ptr); assert_consumed(AppMessageSenderErrorDisconnected, 1); cl_assert_equal_i(s_app_install_timestamp_update_count, 0); app_free(outbox_data); } void test_app_message_sender__byte_by_byte_consume(void) { Ap...
comm_session_send_queue_copy(s_app_session_ptr, 0, first_length, bytes_out)
); comm_session_send_queue_consume(s_app_session_ptr, first_length); // App quits with only one header byte consumed: app_outbox_service_cleanup_all_pending_messages(); // Copy & consume the rest: size_t second_length = (length - first_length); cl_assert_equal_i(second_length, comm_session_send_queue_copy...
(bus->state->transfer_event == I2CTransferEvent_Error)) { // Track the max transfer duration so we can keep tabs on the MFi chip's nacking behavior const uint32_t duration_ticks = rtc_get_ticks() - bus->state->transfer_start_ticks; if (duration_ticks > s_max_transfer_duration_ticks) { ...
PBL_ASSERTN(slave)
; PBL_ASSERTN(buffer); // Do transfer locks the bus bool result = prv_do_transfer(slave->bus, Write, slave->address, 0, write_size, (uint8_t*)buffer, NoRegisterAddress); if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Block write failed on bus %s", slave->bus->name); } return...
at 1 bt_persistent_storage_delete_ble_pairing_by_id(9); cl_assert_equal_i(s_ble_bonding_change_delete_count, 1); cl_assert_equal_i(fake_shared_prf_storage_get_ble_delete_count(), 3); // Make sure the pairing is actually still there ret = bt_persistent_storage_get_ble_pairing_by_id(id, &irk_out, &device_out,...
false /* auto_accept_re_pairing */); cl_assert(id2 != BT_BONDING_ID_INVALID); // Find it ancs_id = bt_persistent_storage_get_ble_ancs_bonding(); cl_assert_equal_i(ancs_id, id2); ret = bt_persistent_storage_has_ble_ancs_bonding(); cl_assert(ret); ...
void test_bluetooth_persistent_storage__ble_device_name(void) { SMPairingInfo pairing = { .irk = (SMIdentityResolvingKey) { .data = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, }, }, .identity = (BTDeviceInternal) { ....
ptions_handle_server_notification & // gatt_client_subscriptions_consume_notification void test_gatt_client_subscriptions__notification_but_no_subscribers(void) { const uint8_t value = 0xAA; gatt_client_subscriptions_handle_server_notification(s_connection, s_handle, ...
cl_assert_equal_i(fake_event_get_count(), 1)
; // Assert 2 events can be read out: prv_assert_notification_event(characteristic, value, sizeof(value), true /* kernel */, true /* app */); prv_assert_notification_event(characteristic, value, sizeof(value), true /* kernel */, true /* app */); ...
id prv_detected_workout_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_detected_workout_up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_detected_workout_down_click_handler); } static void prv_show_workout_detected_dialog(WorkoutAppData *data) { Workout...
(sizeof(WorkoutAppData))
a.flags, app_data_out.flags); cl_assert_equal_s(app_data.display_name, app_data_out.display_name); ancs_app_destroy_buffer(&app_data_out); } void test_ancs_app_storage__overwrite(void) { ANCSAppData app_data = { .bundle_id = "com.getpebble.PebbleApp", .display_name = "Pebble", .flags = ANCSAppIsBloc...
PBL_LOG(LOG_LEVEL_DEBUG, "i: %d, name: %s, name_out: %s", i, apps[i].bundle_id, app_data_out.bundle_id)
; cl_assert_equal_s(apps[i].bundle_id, app_data_out.bundle_id); } }
PBL_ASSERTN(dev->state->initialized)
; RCC_ClocksTypeDef RCC_ClocksStatus; RCC_GetClocksFreq(&RCC_ClocksStatus); uint64_t scaled_apbclock = DIV_PRECISION; if ((dev->periph == USART1) || (dev->periph == USART6)) { scaled_apbclock *= RCC_ClocksStatus.PCLK2_Frequency; } else { scaled_apbclock *= RCC_ClocksStatus.PCLK1_Frequency; } // ...
/* * 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_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_health_hr_summary_card__render_current_bpm(void) { HealthData health_data = { .current_hr_bpm = 110, }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_hr_summary_card__render_timestamp(void) { rtc_set_time(SECONDS...
oggingRecord s_dls_activity_records[100]; static void prv_reset_captured_dls_data(void) { s_num_dls_accel_records = 0; s_num_dls_activity_records = 0; } DataLoggingResult dls_log(DataLoggingSession *logging_session, const void *data, uint32_t num_items) { if (logging_session == (DataLo...
printf("\ntype: %d, start_utc: %"PRIu32", elapsed: %"PRIu32", utc_to_local: %"PRIu32" ", (int)s_dls_activity_records[i].activity, (uint32_t)s_dls_activity_records[i].start_utc, s_dls_activity_records[i].elapsed_sec, s_dls_activity_records[i].utc_to_local)
; } printf("\nLooking for: type: %d, start_utc: %"PRIu32", elapsed: %"PRIu32", " "utc_to_local: %"PRIu32" ", (int)record->activity, (uint32_t)record->start_utc, record->elapsed_sec, record->utc_to_local); clar__assert(false, file, line, "Missing activity record", "", true); } #define ASSERT_A...
0, -701}, { 207, 744, -658}, { 129, 491, -735}, { 134, 681, -701}, { 154, 758, -660}, { 180, 677, -746}, { 176, 651, -756}, { 177, 651, -675}, { 150, 680, -683}, { 173, 680, -747}, { 227, 780, -723}, { 178, 739, -716}, { 136, 561, -734}, { 142, 623, -662}, { 205, ...
{ 72, 24, -1000}, { 80, 16, -1000}, { 72, 16, -1008}, { 72, 16, -1000}, { 72, 16, -1000}, { 72, 16, -1000}, { 72, 16, -1000}, { 72, 16, -992}, { 72, 8, -1000}, { 72, 24, -1000}, { 72, 8, -1000}, { 80, 8, -1008}, { 72, 24, -1000}, { 72, 16, -1000}, { 72, 8, -10...
isturb_is_smart_dnd_enabled() == false); active = do_not_disturb_is_active(); cl_assert(active == true); // !Manual && Scheduled && !Smart do_not_disturb_set_manually_enabled(false); cl_assert(do_not_disturb_is_active() == false); do_not_disturb_toggle_scheduled(WeekdaySchedule); // see PBL-22011 cl_ass...
do_not_disturb_is_active()
f (!app_install_get_entry_for_install_id(id, &entry)) { // can't retrieve app install entry for id PBL_LOG(LOG_LEVEL_ERROR, "Failed to get entry for id %"PRId32, id); } else if (app_install_entry_is_watchface(&entry)) { // If the watchface is for an unsupported SDK version, we need to swit...
(context, task, gracefully)
15, 0x46, 4314, 239, 0}, { 14, 0x63, 4237, 141, 0}, { 16, 0x63, 4440, 143, 0}, { 0, 0x63, 3205, 143, 0}, { 0, 0x44, 3838, 142, 0}, { 0, 0x63, 4898, 146, 0}, { 0, 0x64, 2473, 140, 0}, { 0, 0x74, 2351, 151, 0}, { 0, 0x72, 1490, 144, 0}, { 0, 0x64, 239, 142, 0}, { 0, 0x64, 547, 150,...
{ 0, 0x73, 129, 158, 0}, { 0, 0x73, 244, 158, 0}, { 0, 0x73, 246, 157, 0}, { 0, 0x72, 488, 160, 0}, { 0, 0x73, 125, 158, 0}, { 0, 0x73, 136, 158, 0}, { 0, 0x83, 3, 158, 0}, { 0, 0x73, 97, 155, 0}, { 0, 0x73, 171, 155, 0}, { 0, 0x73, 71, 158, 0}, { 0, 0x73, 104, 158, 0}, {...
{ 0, 0x74, 125, 155, 0}, { 0, 0x64, 61, 155, 0}, { 0, 0x64, 411, 154, 0}, { 0, 0x64, 5156, 146, 0}, { 16, 0x46, 7166, 219, 0}, { 0, 0x44, 1084, 221, 0}, { 0, 0x42, 642, 219, 0}, { 0, 0x44, 97, 221, 0}, { 0, 0x44, 440, 222, 0}, // 180: Local time: 2015-11-12 11:28:00 PM { 0, ...
RY(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){2000, 1000, 0, 0, 0, 0, 0})); // If we ask for the sum of the latter half of yesterday, we should get 500 HealthValue steps = health_service_sum( HealthMetricStepCount, time_start_of_today() - (12 * SECONDS_PER_HOUR), time_sta...
activity_get_metric(ActivityMetricDistanceMeters, 1, &value)
; act_distance[i] = value; float err = abs(exp_distance_m - value); float pct_err = err * 100.0 / exp_distance_m; printf("\nTest %d: height:%d, steps:%d, seconds:%.1f, exp_distance:%d, exp_distance_2min:%d, " "act_distance_2min:%"PRIu32", pct_err: %.2f%% \n", i, params->height_in, params->ste...
inute = 0, .trigger = prv_create_day_1_insight, .insight_type = ActivityInsightType_Day1, }, [ActivationDelayInsightType_Day4] = { // https://pebbletechnology.atlassian.net/browse/PBL-28581 .day_lag = 4, .hour = 20, .minute = 30, .trigger = prv_create_day_4_insight, .insight_type = A...
if (!insight_settings->enabled) { return false; }
heirs < 0) theirs += 360; cl_assert(abs(ours - (int) theirs) < 3); // Allow 3 degrees difference max } static double log_two(uint32_t n) { return (log(n) / log(2)); } static void check_ceil_log_two(uint32_t n) { int ours = ceil_log_two(n); int theirs = ceil(log_two(n)); cl_assert(ours == theirs); } void t...
WITHIN(0, min, max)
p_day_bar_box(int weekday, GRect *box, int16_t bar_height) { const int w = 23; // normal bar width; #if PBL_RECT // The center bars are slightly wider than the other bars // Note that Thursday is the center bar, not Wednesday since drawing begins with Monday // S M T W ...
(ctx, i, &box, bar_color, false /* wide bar */)
; } // Draw the day bar prv_setup_day_bar_box(i, &box, bar_height); const bool is_wide = prv_bar_should_be_wide(i, graph_card->current_day); const GColor bar_color = prv_get_bar_color(graph_card, is_active, is_wide); const int16_t next_x = prv_draw_day_bar(ctx, i, &box, bar_color, is_wide); ...
ameBuffer s_fb; static KickstartData s_data; GContext *graphics_context_get_current_context(void) { return &s_ctx; } void test_kickstart__initialize(void) { // Setup graphics context framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GCo...
{ #if (PLATFORM_SILK || PLATFORM_ROBERT) s_clock_is_24h_style = true; prv_set_data(&s_data, 10323, 7500, 13000, 82); prv_set_unobstructed_area_height(TIMELINE_PEEK_HEIGHT); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, T...
void test_kickstart__render_PBL_43681(void) { prv_set_data(&s_data, 0, 1098, 8, 0); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_kickstart__render_PBL_43717(void) { prv_set_data(&s_data, 7,...
property_animation_get_to_grect(property_animation, &end)
; layer_set_frame(layer, &end); } } //! Creates an animation that moves a layer from its original frame to another frame that is offset //! dy (change in origin.y). static Animation *prv_create_anim_frame_scroll(Layer *layer, uint32_t duration, int16_t dy, ScrollAni...
UG("total_min: %"PRIu16", deep_min: %"PRIu16", state: %"PRIu16", " "state_min: %"PRIu16"", sleep_data->total_minutes, sleep_data->restful_minutes, sleep_data->cur_state, sleep_data->cur_state_ela...
time_t session_exit_utc = session->start_utc + session_len_sec; ActivityClassParams *params = NULL; switch (session->type) { case ActivitySessionType_Sleep: case ActivitySessionType_Nap: params = &class_settings[ActivityClass_Sleep]; break; case ActivitySessionType_Restfu...
// Update settings file if any events were logged if (logged_event) { mutex_lock_recursive(state->mutex); SettingsFile *file = activity_private_settings_open(); if (file) { for (int i = 0; i < ActivityClassCount; i++) { ActivityClassParams *params = &class_settings[i]; status_t re...
layer->overflow_mode = GTextOverflowModeTrailingEllipsis; layer_set_clips(&text_layer->layer, true); text_layer->text_alignment = GTextAlignmentLeft; text_layer->font = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD); layer_mark_dirty(&(text_layer->layer)); } TextLayerLegacy2* text_layer_legacy2_create(GRect ...
(&text_layer->layout_cache)
; text_layer->layout_cache = NULL; } } GSize text_layer_legacy2_get_content_size(GContext* ctx, TextLayerLegacy2 *text_layer) { if (text_layer == NULL) { return GSizeZero; } else if (!text_layer->should_cache_layout) { text_layer_legacy2_set_should_cache_layout(text_layer, true); } GTextLayoutCac...
-------------------------------------------------------------------------------- static void prv_finalize_queued_packet(PPoGATTClient *client, uint16_t payload_size) { if (client->out.reset_packet_byte != 0) { client->out.reset_packet_byte = 0; } else if (client->out.send_rx_ack_now && client->out.ack_packet_b...
{ if (!prv_is_client_valid(client)) { // Client became invalid in the mean time goto unlock; } prv_start_reset(client); }
unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- void ppogatt_destroy(void) { bt_lock(); { PPoGATTClient *client = s_ppogatt_head; while (client) { PPoGATTClient *next = (PPoGATTClient *) client->node.next; prv_delet...
-80, 64}, { 1016, -48, -32}, { 720, -80, 16}, { 624, 40, -32}, { 680, 64, -8}, { 824, 104, -48}, { 1008, 200, 16}, { 1088, 352, 0}, { 1160, 400, 56}, { 1240, 304, -40}, { 1336, 120, -24}, { 928, 40, -192}, // 40 seconds { 1280, 160, -176}, { 1464, 120, -168}, ...
{ 1280, 384, -80}, { 1032, 384, -64}, { 912, 384, -32}, { 848, 208, 0}, { 768, 136, -32}, { 752, 96, -48}, { 768, 64, -48}, { 912, 88, -144}, { 968, -40, -128}, { 1240, -144, -120}, { 1472, 56, -96}, { 1480, 288, -312}, { 1504, 232, -232}, { 1344, 176, -88}, {...
ic char *get_expected_msg(void) { cl_assert(s_msg.msg_arr != NULL); cl_assert(s_msg.curr_msg_idx < s_msg.num_items); char *expected_msg = NULL; if (s_msg.num_processed != 0) { expected_msg = s_msg.msg_arr[s_msg.curr_msg_idx - 1]; } s_msg.curr_msg_idx++; s_msg.num_processed++; return (expected_msg); ...
free_logs(logs, num_logs)
; } } //! void test_flash_logging__wrap(void) { flash_logging_init(); uint32_t tot_size, erase_size, page_size, page_hdr_size; test_flash_logging_get_info(&tot_size, &erase_size, &page_size, &page_hdr_size); int num_pages = tot_size / page_size; uint32_t space_avail = tot_size - num_pages * page_...
{ TouchContext *ctx = &s_touch_ctx[i]; prv_touch_context_reset(ctx); // If there is an event on the kernel queue, we need to set a flag to not dispatch touches in // the queue when that event is called, because the TouchesCancelled event will arrive after // the event on the queue. We do however wa...
mutex_unlock(s_touch_mutex); // Always send a touches cancelled event (all currently defined events cancel other touches) PebbleEvent cancel_event = { .type = PEBBLE_TOUCH_EVENT, .touch = { .type = PebbleTouchEvent_TouchesCancelled, } }; event_put(&cancel_event); if (driver_event == To...
_ad_data, copied_uuids, count); cl_assert_equal_i(found, 1); // Test ble_ad_copy_service_uuids, destination array too small: found = ble_ad_copy_service_uuids(s_ad_data, copied_uuids, 0); cl_assert_equal_i(found, 1); // Test ble_ad_get_tx_power_level returns false, when no TX Power Level: int8_t tx_power_...
(ad->ad_data_length, sizeof(expected_ad_data))
; cl_assert_equal_i(ad->scan_resp_data_length, 0); ble_ad_destroy(ad); // 7x 32-bit UUIDs should fit, expect true: ad = ble_ad_create(); cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 7), true); ble_ad_destroy(ad); // 8x 32-bit UUIDs does not fit, expect false: ad = ble_ad_create(); cl_assert_...
This timer watches to see if we have stopped receiving // sensor interrupts and will trigger logic to reset the sensor if necessary. static RegularTimerInfo s_as7000_watchdog_timer; // Incremented by s_as7000_watchdog_timer. Reset to 0 by our interrupt handler. static uint8_t s_missing_interrupt_count; //! Interval ...
{ struct PACKED { uint8_t sample_idx; net16 accel_x; net16 accel_y; net16 accel_z; } sample_data = { .sample_idx = sample_idx, .accel_x = hton16(data->x * 2), // Accel service supplies mGs, AS7000 expects lsb = 0.5 mG .accel_y = hton16(data->y * 2), .accel_z = hton16(data->z * 2) }...
static void prv_read_hrm_data(HRMDevice *dev, HRMData *data) { struct PACKED { uint16_t led_current; uint8_t hrm_status; uint8_t bpm; uint8_t sqi; } hrm_data_regs; prv_read_register_block(dev, ADDR_LED_CURRENT_MSB, &hrm_data_regs, sizeof(hrm_data_regs)); data->led_current_ua = ntohs(hrm_data...
_vertical_line_dotted(&ctx, GPoint(70, 36), 5); graphics_draw_horizontal_line_dotted(&ctx, GPoint(66, 36), 10); // T facing down - lined up graphics_draw_vertical_line_dotted(&ctx, GPoint(101, 33), 5); graphics_draw_horizontal_line_dotted(&ctx, GPoint(97, 37), 10); // T facing left - lined up graphics_dr...
(&ctx, GPoint(71, 71), 10)
pin = 5, .miso_pin = 6, .mosi_pin = 7, }; static void prv_enable_flash_spi_clock(void) { RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE); } static void prv_disable_flash_spi_clock(void) { RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, DISABLE); } static void prv_flash_start(void) { gpio_use(FLASH_CONFIG.s...
(FLASH_CMD_READ_STATUS_REG)
; uint8_t status_register = 0; do { status_register = prv_flash_read_next_byte(); } while (status_register & 0x1); prv_flash_end_cmd(); } static void prv_flash_deep_sleep_exit(void) { prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_WAKE); prv_flash_end_cmd(); // wait a sufficien...
/* * 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_card_and_render(&(HealthData) {})
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_hr_summary_card__render_current_bpm(void) { HealthData health_data = { .current_hr_bpm = 110, }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_hr...
/* * 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...
{ LOCK_AND_GET_STORE(store); return settings_file_exists(store, &key, sizeof(key)); }
/* * 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...
(&file_hdr.magic, SETTINGS_FILE_MAGIC, sizeof(file_hdr.magic))
!= 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted to open %s, not a settings file.", name); pfs_close_and_remove(fd); return E_INVALID_OPERATION; } if (file_hdr.version > SETTINGS_FILE_VERSION) { PBL_LOG(LOG_LEVEL_WARNING, "Unrecognized version %d for file %s, removing...", file_...
ctorLockRangeArg; flash_impl_release(); } void flash_s29vs_hw_init(void) { // Configure the reset pin (D2) GPIO_InitTypeDef gpio_init = { .GPIO_Pin = GPIO_Pin_2, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = GPIO_Speed_100MHz, .GPIO_OType = GPIO_OType_PP, .GPIO_PuPd = GPIO_PuPd_NOPULL }; GPIO_Init(GPI...
if (sr & S29VSStatusBit_EraseSuspended) { // Cannot program while another program operation is suspended. error = E_INVALID_OPERATION; }
if (FAILED(error)) { result = error; goto done; } } prv_allow_write_if_sector_is_not_protected(false, sector_addr); prv_issue_command(sector_addr, S29VSCommand_EraseSetup); prv_issue_command_argument(sector_addr, S29VSCommandEraseAguments_SectorErase); prv_a...
t__corner_radius(void) { // Test 0 radius cases cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornerNone, 0), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornerNone, 2), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornersAll, 0), 0); cl_assert_equal_i(prv_clamp_corner...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_clip_rect_aa.${BIT_DEPTH_NAME}.pbi"))
; }
if (enabled) { vibes_short_pulse(); } else { vibes_double_pulse(); }
} static WindowStack *prv_get_window_stack(void) { return window_manager_get_window_stack(ModalPriorityNotification); } static void prv_push_result_dialog(ActionToggleContext *ctx) { ActionToggleDialogConfig config = { .message = ctx->config.impl->result_messages[prv_get_toggled_state_index(ctx)], }; prv...
16, 64}, { 1064, -32, 32}, { 1056, -24, 0}, { 1016, -40, -72}, { 1048, -88, -104}, { 1112, -168, -96}, { 1088, -176, -80}, { 1056, -160, -160}, // 93 seconds { 1032, -184, -232}, { 1040, -256, -240}, { 1032, -320, -240}, { 976, -328, -192}, { 1000, -288, -208}, { ...
{ 1528, -104, -40}, { 1184, -8, -48}, { 904, -32, -40}, { 1240, -8, -24}, { 1528, -56, 104}, { 1160, -40, 128}, { 1120, -112, 80}, { 1120, -128, 80}, { 1136, -56, 72}, { 1120, -88, 96}, { 1048, -112, 120}, { 944, -96, 96}, { 912, -80, 8}, { 928, -80, -80}, { 9...
{ 1120, 128, -40}, { 1168, 104, -24}, { 1144, 112, -64}, { 1104, 72, -16}, // 101 seconds { 1072, 56, -16}, { 1000, 48, -24}, { 1040, 72, -8}, { 1080, 104, -16}, { 1048, 112, -48}, { 1112, 104, -64}, { 1168, 136, -96}, { 1144, 104, -80}, { 1112, 56, -72}, { 1...
/* * 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...
(pass, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD))
; text_layer_set_text_alignment(pass, GTextAlignmentRight); text_layer_set_text(pass, "Pass"); layer_add_child(&window->layer, &pass->layer); bounds.origin.y = 120; TextLayer *fail = &results_ui->fail_text_layer; text_layer_init(fail, &bounds); text_layer_set_font(fail, fonts_get_system_font(FONT_KEY_GOT...
Tests cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(lin...
line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)
); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); // reset line ...
\ do { \ char _buf[80]; \ dbgserial_putstr_fmt(_buf, sizeof(_buf), msg, __VA_ARGS__); \ } while (0) #else #define BMI160_DBG(msg, ...) #endif #define NUM_AVERAGED_SAMPLES (4) typedef enum { BMI160_...
{ case BMI160_SCALE_2G: cfg_val = BMI160_ACC_RANGE_2G; break; case BMI160_SCALE_4G: cfg_val = BMI160_ACC_RANGE_4G; break; case BMI160_SCALE_8G: cfg_val = BMI160_ACC_RANGE_8G; break; case BMI160_SCALE_16G: cfg_val = BMI160_ACC_RANGE_16G; break; default:...
prv_write_reg(BMI160_REG_ACC_RANGE, cfg_val); s_raw_unit_to_mgs = 32768 / scale; } static int16_t prv_raw_to_mgs(int16_t raw_val) { int16_t mgs = (raw_val * 1000) / s_raw_unit_to_mgs; return mgs; } static void prv_convert_accel_raw_data_to_mgs(const uint8_t *raw_buf, AccelDriverSample *data) { int16_t ...
/* * 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...
("session_id %u", logging_session->comm.session_id)
; WRITE_LINE("uuid %s", uuid_b); WRITE_LINE("data state %u", logging_session->status); WRITE_LINE("tag %lu", logging_session->tag); WRITE_LINE("item type %u", logging_session->item_type); WRITE_LINE("item size %u", logging_session->item_size); WRITE_LINE("storage %lu bytes", logging_session->storage.num_byt...
_set_time(1421395200); head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, 1421395200), S_NO_MORE_ITEMS); fake_pbl_malloc_clear_tracking(); // Thursday Jan 16 14:00:00 PST 2015 ...
(uuid_equal(&state.pin.header.id, &s_items[1].header.id))
; // check sixth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)); // check rollover behaviour cl_assert(!iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(...
s.h" #include "vendor/tinymt32/tinymt32.h" #include <string.h> typedef struct { Heap heap; struct tm gmtime_tm; struct tm localtime_tm; char localtime_zone[TZ_LEN]; tinymt32_t rand_seed; ProcessAppSDKType sdk_type; int16_t initial_obstruction_origin_y; ClickManager click_manager; AppInbox *app_...
click_manager_init(&s_app_state_ptr->click_manager)
; animation_private_state_init(&s_app_state_ptr->animation_state); app_message_init(); app_outbox_init(); // Set the correct framebuffer size depending on the SDK version GSize fb_size; app_manager_get_framebuffer_size(&fb_size); framebuffer_init(&s_app_state_ptr->framebuffer, &fb_size); framebuffe...
_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); // All recognizers receive events while none have started recognizing e.type = TouchEvent_PositionUpdate; recogniz...
(recognizers[3]->state, RecognizerState_Possible)
; cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); // Layer A recognizer's gesture does not complete because there is no active layer until a // touchdown occurs e.type = TouchEvent_PositionUpdate; s_next_state = RecognizerState_Completed; s_idx_to_change = 3; recognizer_manager_handle...
t = &data->peek_layer.layer.frame; GRect stop = { { was_mini_peek ? 0 : start->size.w , 0 }, start->size }; Animation *peek_out = (Animation *)property_animation_create_layer_frame( (Layer *)&data->peek_layer, start, &stop); animation_set_duration(peek_out, duration); animation_set_custom_interpolation(pe...
event_service_client_unsubscribe(&data->focus_event_info)
; #if ANIMATION_DOT peek_layer_play(&data->peek_layer); #elif ANIMATION_SLIDE prv_play_peek_in(data); #endif if (data->state == TimelineAppStateNoEvents) { window_set_click_config_provider_with_context(&data->timeline_window, prv_click_config_provider, data)...
ongoing_call_ui) { s_last_phone_ui_event = PhoneEventType_Incoming; } void phone_ui_handle_outgoing_call(PebblePhoneCaller *caller) { s_last_phone_ui_event = PhoneEventType_Outgoing; } void phone_ui_handle_missed_call(void) { s_last_phone_ui_event = PhoneEventType_Missed; } void phone_ui_handle_call_start(bool...
{ // We should only allow incoming calls when connected to the mobile app (this should never really // happen for PP) prv_put_incoming_call_event(PhoneCallSource_PP, false); ASSERT_LAST_EVENT(PhoneEventType_Invalid); prv_put_incoming_call_event(PhoneCallSource_PP, true); ASSERT_LAST_EVENT(PhoneEventType_In...
// --------------------------------------------------------------------------------------- // Basic test for incoming calls over ANCS on iOS 8 and below void test_phone_call__ancs_legacy_incoming(void) { // We should only allow the incoming call if we're connected to the app for polling reasons prv_put_incoming_...
ata->mic_window.window); } } static void prv_exit_and_send_result_event(VoiceUiData *data, DictationSessionStatus result) { VOICE_LOG("Send result"); PebbleEvent event = { .type = PEBBLE_DICTATION_EVENT, .dictation = { .result = result, .text = (result == DictationSessionStatusSuccess) ? dat...
{ const GColor dialog_bg_color = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite); prv_push_error_dialog(data, i18n_noop("No internet connection"), RESOURCE_ID_CHECK_INTERNET_CONNECTION_LARGE, dialog_bg_color); data->error_exit_status = DictationSessionStatusFailureConnectivityError...
else { prv_exit_and_send_result_event(data, DictationSessionStatusFailureConnectivityError); } } static void prv_handle_bt_conn_result(bool connected, void *context) { VoiceUiData *data = context; if (connected) { if (data->state == StateError) { // We got here after a dictation result timeout, so...
oint the buffer at the QSPI region uint32_t const volatile * const buffer = (uint32_t *)(QSPI_MMAP_BASE_ADDRESS + addr); uint32_t size_words = size_bytes / sizeof(uint32_t); for (uint32_t i = 0; i < size_words; ++i) { if (buffer[i] != FLASH_RESET_WORD_VALUE) { result = false; break; } } /...
kernel_malloc_check(size + 3)
-48}, { 1936, 216, 24}, { 2024, 176, 24}, { 1808, 320, -8}, { 1528, 264, -88}, { 1368, -24, -88}, { 928, -344, -72}, { 640, -200, -288}, { 1024, -216, -216}, { 1184, 40, -232}, { 1288, 160, -176}, { 1456, 456, -296}, { 1776, 1248, -544}, { 1408, 1216, -408}, { 904...
{ 1360, 112, -128}, { 984, -344, 24}, { 552, -352, -160}, { 960, -184, -296}, { 1200, -16, -232}, { 1344, 152, -120}, { 1536, 184, -24}, { 2016, 304, -144}, { 1920, 464, -176}, { 1720, 512, -192}, { 1456, 680, -304}, { 1392, 448, -304}, { 1552, 200, -160}, { 1224,...
{ 1360, 1152, 56}, { 1056, 1344, 24}, { 920, 856, 24}, { 1000, 920, -32}, { 1016, 816, -24}, { 1040, 728, -40}, { 1424, 768, 24}, { 2024, 752, 160}, { -1944, 552, 216}, { -2024, 360, 160}, { 2016, 176, 184}, { 1784, 224, 128}, { 1608, 336, -48}, { 1280, 288, -120...
{ 712, -88, 96}, { 624, -152, 8}, { 752, -32, -160}, { 816, -56, -200}, { 1336, -240, 32}, { 1544, -48, 192}, { 1480, 272, -8}, { 1688, 320, 0}, { 1800, 344, 328}, { 1600, 472, 400}, { 1376, 624, 392}, { 1072, 440, 288}, { 896, 360, 96}, { 888, 208, 72}, // 11...
{ 288, 1048, -152}, { 248, 1032, -160}, { 256, 1000, -184}, { 296, 912, -200}, { 272, 864, -192}, { 288, 928, -200}, { 288, 920, -200}, { 264, 864, -240}, { 264, 848, -280}, { 256, 792, -296}, { 304, 760, -280}, { 328, 712, -256}, { 416, 760, -272}, { 568, 672, -1...
{ 776, -48, 24}, { 920, 72, -112}, { 1352, 80, -112}, { 1728, -232, 272}, { 1416, 280, 136}, { 1016, 464, -80}, { 912, 280, 16}, { 920, 128, 248}, { 912, 80, 304}, { 968, 160, 288}, { 944, 288, 256}, { 832, 432, 136}, { 776, 400, 56}, { 960, 544, -32}, { 1184...
onstruct file name and create meaningful assert description char filename[100]; snprintf(filename, sizeof(filename), "draw_circle_offset_aa_r8_%s.${BIT_DEPTH_NAME}.pbi", c.filename_part); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, filename)); } #endif } void test_graphics_draw_circle_${BIT_DEPTH...
(&ctx, GColorClear)
; prv_draw_circles(&ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_swX_clear.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_circle_${BIT_DEPTH_NAME}__zero_aa_swX_clear(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Draw clear circles with antialiasing enabled setup_t...
_set_elapsed(complex, duration_total - 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), ...
---------- void regular_timer_init(void) { PBL_ASSERTN(s_callback_list_semaphore == 0); s_callback_list_semaphore = mutex_create(); time_t seconds; uint16_t milliseconds; rtc_get_time_ms(&seconds, &milliseconds); s_timer_id = new_timer_create(); bool success = new_timer_start(s_timer_id, 1000-millisecon...
list_remove(&cb->list_node, NULL, NULL)
; timer_removed = true; } } mutex_unlock(s_callback_list_semaphore); return timer_removed; } // --------------------------------------------------------------------------------------- // For Testing: void regular_timer_deinit(void) { mutex_destroy((PebbleMutex *) s_callback_list_semaphore); s_ca...