prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
{1189814400,"37","07"},{1189900800,"37","07"},{1189987200,"38","07"},{1190073600,"38","07"},{1190160000,"38","07"},{1190246400,"38","07"},{1190332800,"38","07"}, {1190419200,"38","07"},{1190505600,"38","07"},{1190592000,"39","07"},{1190678400,"39","07"},{1190764800,"39","07"},{1190851200,"39","07"},{1190937600,"39...
cl_assert_equal_s(tmbuf, "+0100")
EG, DCDC_V18_CUR_LIM_MAX_LV, 0xF); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_VOLTAGE, 0x10); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_CUR_...
REG_SETF(CRG_TOP, FORCE_SLEEP_REG, FORCE_BLE_SLEEP, 0x0)
; // GUESS REG_SETF(CRG_TOP, FORCE_SLEEP_REG, FORCE_FTDF_SLEEP, 0x0); // GUESS REG_SETF(CRG_TOP, LDOS_DISABLE_REG, LDOS_DISABLE, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_REG, OSC16_HOLD_AMP_REG, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_REG, OSC16_SH_DISABLE, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_RE...
/ uuid_width; if (!num_uuids) { return true; // continue parsing } Uuid uuids[num_uuids]; // Iterate through the list, expanding each UUID to 128-bit equivalents, // then copying them into the uuids[] array: const uint8_t *uuid_data = elem->data; for (size_t i = 0; i < num_uuids; ++i) { sw...
if (elem->header.length == 0) { // We've hit a padding zero. We should be done, or this packet is corrupt. return; }
if (cursor + elem->header.length + 1 /* +1 length byte */ > end) { return; // corrupted } bool (*parse_func)(const BLEAdElement *, const BLEAdParseCallbacks *, void *) = NULL; switch (elem->header.type) { case BLEAdTypeService16BitUUIDPartial ... BLEAdTypeService12...
t return false; } return false; } static size_t prv_to_locale_buffer(jerry_value_t this_val, jerry_length_t argc, const jerry_value_t *argv, ToStringFormat default_format, ToStringFormat mask, ...
jerry_create_undefined()
; char buffer[BUFFER_LEN_DATETIME] = {0}; // we allow users to pick from any option to here const size_t total_len = prv_to_locale_buffer(this_val, argc, argv, ToStringFormatEmpty, ToStringFormatDateMask | ToStringFor...
ister this timer as needed // for each subsequent click event in the sequence. const bool timer_started = new_timer_start(s_console_button_timer, 0, command_button_press_callback, new_timer_context, 0 /* flags */); if (!tim...
(msg->filename, "spam.exe", sizeof(msg->filename))
; char letter = 'A' + i; memset(msg->message, letter, msg->message_length - 1); msg->message[msg->message_length - 1] = 0; uint32_t flash_addr = flash_logging_log_start(sizeof(buffer)); flash_logging_write(buffer, flash_addr, sizeof(buffer)); } (void)data; } void command_log_dump_spam(void) { ...
/* * 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_prebake_pfs(argv[1])
; }
tmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(2bitpalette)); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette); } // Tests 4-bit palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void ...
TEST_PNG_FILE_FMT(2bitpalette)
); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette); } // Tests 4-bit transparent greyscale PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__greyscale_4_bit_transparent(void) { G...
ONFIG = 0x16, PmicRegisters_MON_CFG = 0x19, PmicRegisters_HAND_SHK = 0x1D, PmicRegisters_PWR_CFG = 0x1F } PmicRegisters; //! The different power rails that our PMIC controls typedef enum PmicRail { PmicRail_BUCK1, //!< 1.2V PmicRail_BUCK2, //!< 1.8V PmicRail_LDO1, //!< 2.0V - Auto - RTC PmicRail_LDO2, //...
{ const uint8_t CHARGE_VOLTAGE_4300 = 0b101; const uint8_t CHARGE_VOLTAGE_4200 = 0b011; // [AS] HACK alert! (see PBL-19186) // The MAX14690 state machine is stupid and kicks us into a charge complete state when the charger // is connected and the battery voltage is within the range VBATREG < x < VBATREG - VB...
uint8_t chg_ctrl_b = 6 << 4 | // 6: Set precharge voltage threshold to 3.00V (default) 1 << 2 | // 1: Set precharge current to 0.1C 1 << 0; // 1: Set charge done current to 0.1C (default) if (!prv_write_register(PmicRegisters_CHG_CNTL_B, chg_ctrl_b)) { return fals...
equal_i(s_circle_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 0); cl_assert_equal_p(s_stroke_points, NULL); cl_assert_equal_p(s_fill_points, NULL); free(command); } static GDrawCommandList *prv_create_command_list_3(void) { GDrawCommandList *command_list = malloc(sizeof(GDrawCommandList) + (3 * ...
gdraw_command_list_validate(command_list, size)
sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_COLS); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 2), MAX_NUM_COLS + 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 4), 0); graphics_draw_horizontal_line_dotted(&ctx, GP...
graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(4, 0), 0); graphics_draw_vertical_line_dotted(&ctx, GPoint(6, 0), 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(8, 0), 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 0), 4); graphics_...
eline_layer.animating_intro_or_exit = true; } static void prv_exit_anim_stopped(Animation *animation, bool finished, void *context) { // we must use a timer to allow the last frame to render const int exit_timeout_ms = 2 * ANIMATION_TARGET_FRAME_INTERVAL_MS; evented_timer_register(exit_timeout_ms, false, prv_exi...
{ int16_t to_sidebar_width; if (open) { to_sidebar_width = timeline_layer_get_ideal_sidebar_width(); } else { const GRect *layer_frame = &data->timeline_window.layer.frame; to_sidebar_width = layer_frame->size.w; #if PBL_ROUND // Use a larger width to ensure we fill the entire screen since we use ...
static void prv_exit(TimelineAppData *data) { UNUSED const TimelineAppState prev_state = data->state; if (!prv_set_state(data, TimelineAppStateExit)) { return; } #if ANIMATION_SLIDE prv_launch_watchface(data); #elif ANIMATION_DOT const uint32_t duration = interpolate_moook_in_duration(); animation_u...
/* * 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...
(console, ROCKY_CONSOLE_WARN, prv_console_warn)
; rocky_add_function(console, ROCKY_CONSOLE_ERROR, prv_console_error); } const RockyGlobalAPI CONSOLE_APIS = { .init = prv_init, };
/* * 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...
(&health_data)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_activity_detail_card__render_no_distance(void) { HealthData health_data = { .current_distance_meters = 0, }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void te...
{ battery_ui_dismiss_modal(); status_led_set(StatusLedState_Off); }
// TODO PBL-39883: Replace w/ QUIRK_RESET_ON_SHUTDOWN_WHILE_CHARGING once arbitrary prefixes land #if PLATFORM_TINTIN || PLATFORM_SILK static void prv_shutdown(void *ignored) { battery_ui_handle_shut_down(); } #else static void prv_enter_shutdown_charging(void *ignored) { app_manager_put_launch_app_event(&(AppLau...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(out_length, 5)
; cl_assert(memcmp(out_buffer, (uint8_t*) "56789", 5) == 0); cl_assert(shared_circular_buffer_consume(&buffer, &client, 5)); // Get the rest of the wrapped read cl_assert(shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 1); cl_assert(memcmp(out_buff...
graphics_draw_bitmap_in_rect(ctx, shadow_top, &GRect(0, shadow_top_y_offset, layer_w, shadow_top_bitmap_h)); } // Draw bottom shadow, if (partially) visible: const int16_t shadow_bottom_bitmap_h = shadow_top->bounds.size.h; const int16_t bottom_clipped_h...
{ bounds.origin.x = CLIP(offset.x, MIN(min_x_offset, 0), 0); bounds.origin.y = CLIP(offset.y, MIN(min_y_offset, 0), 0); }
else { bounds.origin = offset; } if (gpoint_equal(&old_offset, &bounds.origin)) { // Not changed. // still, call update_content indicator to refresh potential timers scroll_layer_update_content_indicator(scroll_layer); return; } layer_set_bounds(&scroll_layer->content_sublayer, &bounds);...
s_rx_window_size packets in flight: for (sn = 0; sn < s_tx_window_size; ++sn) { const bool success = fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, ...
fake_gatt_client_op_set_write_return_value(BTErrnoOK)
; ppogatt_handle_buffer_empty(); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], 0 /* sn */, s_short_data_fragment, sizeof(s_short_data_fragment)); } void test_ppogatt__retransmit_timed_out_data_packets_all_at_once(void) { test_ppogatt__open_session_when_found_pebble_...
/* * 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...
rocky_global_init(s_graphics_api)
; // make this easily testable by putting it int JS context as global Layer l = {.bounds = GRect(0, 0, 144, 168)}; const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l); jerry_set_object_field(jerry_get_global_object(), "ctx", ctx); return ctx; } void test_rocky_api_graphics_rendering__line...
/* * 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...
(PebbleTask_App, real_callback, NULL)
; } static void prv_update_state(GettingStartedButtonComboState *state) { const uint32_t COMBO_HOLD_MS = 5 * 1000; // Wait for 5 seconds // Map of button combos -> callback to call if we hit it. const struct { uint8_t desired_bitset; void (*callback)(void*); } BUTTON_COMBOS[] = { { (1 << BUTTON_ID...
date, 0); cl_assert_equal_i(s_render_pending, true); // Now transition to a modal. The app framebuffer should be released. No animation should be started. s_modal_window_present = true; compositor_transition(&s_transition_a); cl_assert_equal_i(s_render_pending, false); cl_assert_equal_i(s_count_animation_c...
(&s_transition_a)
DEVICE_METRIC_HRM_ACCEL_DATA_MISSING, AnalyticsClient_System); PBL_LOG(LOG_LEVEL_WARNING, "Falling behind: HRM got 0 accel samples"); } } static void prv_as7000_interrupt_handler(bool *should_context_switch) { PPG_DBG("Handshake interrupt"); PROFILER_NODE_START(hrm_handling); // Starting to respond to hand...
(dev->state->lock, true)
bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorClear); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_white_on_white-expect.1bit.pbi")); memset(dest_data, 0b11111111, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCom...
(src_bitmap)
; }
r %d minutes"); char snooze_buf[32]; snprintf(snooze_buf, sizeof(snooze_buf), i18n_get(snooze_text, dialog), alarm_get_snooze_delay()); i18n_free(snooze_text, dialog); dialog_set_text(dialog, snooze_buf); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); dialog_set_background_color(dialog, GC...
vibe_score_get_duration_ms(s_alarm_popup_data->vibe_score)
+ vibe_score_get_repeat_delay_ms(s_alarm_popup_data->vibe_score); s_alarm_popup_data->max_vibes = DIVIDE_CEIL(VIBE_DURATION, vibe_repeat_interval_ms); #else s_alarm_popup_data->max_vibes = TINTIN_MAX_VIBES; #endif s_alarm_popup_data->vibe_timer = new_timer_create(); prv_vibe(NULL); new_timer_start(s_al...
-------------------------------------------------------------- //! Helper to reduces a 128-bit UUID to 32-bits. Note: this function does not //! check whether the original UUID is based on the Bluetooth base. static uint32_t prv_convert_to_32bit_uuid(const Uuid *uuid) { uint32_t uuid_32bits = 0; // Use bytes 0-3 of...
(company_id)
; memcpy(element->data, data, size); return prv_write_element_to_ad_data(ad, (const BLEAdElement *) element); } // ----------------------------------------------------------------------------- bool ble_ad_set_flags(BLEAdData *ad, uint8_t flags) { struct __attribute__((__packed__)) BLEAdElementManufacturerSpecifi...
quat sapien tincidunt vitae. " "Duis ipsum nunc, tristique sit amet blandit non, scelerisque non diam. " "Etiam condimentum aliquam dictum. Nam nisi ex, cursus in ligula sit amet, " "ultricies egestas libero. Aliquam luctus, metus quis ultricies sagittis, " "nisi orci viverra felis, vitae luctus massa dolor sit...
{ char data[] = { 1, 2, 3, 4, 5, 6 }; cl_assert_equal_i(persist_write_data(0, data, sizeof(data)), sizeof(data)); cl_assert_equal_i(persist_get_size(0), sizeof(data)); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_check(framebuffer_is_empty("outside_y_origin_layer", ctx.parent_framebuffer, GColorWhite))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_x_y_origin_layer", ctx.parent_framebuffer, GColorWhite)); } void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__offset_layer(void) { ...
, PebbleTouchEvent_TouchesAvailable); touch_event = touch_event_queue_get_event(1, 0); prv_test_touch_event(touch_event, 1, TouchEvent_Touchdown, &GPoint(1, 13), 3686401, 5, &GPointZero, 0, 0, true); } void test_touch__handle_update_liftoff(void) { // Test first touch touch_set_touch_sta...
GPoint(10, 10)
, 20, 5, true); touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(13, 13), 40, 6, true); touch_handle_update(0, Tou...
; i < exp_num_sessions; i++) { cl_assert_equal_i(sessions[i].type, health_sessions[i].type); cl_assert_equal_i(sessions[i].start_utc, health_sessions[i].start_utc); cl_assert_equal_i(sessions[i].length_min, health_sessions[i].length_min); } } // =========================================================...
MAX(ACTIVITY_SESSION_UPDATE_MIN, ACTIVITY_SETTINGS_UPDATE_MIN)
; prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * wait_min, 0, ActivitySleepStateAwake); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){100, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTotalSeconds, ((cons...
/* * 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...
prefs_db_insert((uint8_t *)key, key_len, (uint8_t *)&uuid, sizeof(uuid))
, 0); cl_assert_equal_i(prefs_db_get_len((uint8_t *)key, key_len), sizeof(uuid)); } void test_prefs_db__insert_and_read(void) { uint32_t set_value = 42; // NOTE: We intentionally put one garbage character after the key to catch errors // that assume the key is 0 terminated const char *key = "lightTimeoutMsX...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(list_get_prev(&a) == NULL)
/ Sample captured: 2015-10-16 17:11:10 local AccelRawData *activity_sample_walk_100_pbl_28394_1(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_28394_1 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 60 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 st...
{ -896, 392, -184}, { -824, 328, -264}, { -776, 336, -288}, { -880, 528, -320}, // 5 seconds { -1144, 512, -336}, { -1680, 712, -304}, { -1688, 352, -192}, { -1544, 144, -200}, { -1544, 176, -200}, { -1680, 272, -104}, { -1552, 240, -16}, { -1240, 128, 40}, { -106...
_rounded - x1_rounded + 1, color); #endif } // This function draws vertical line with AA edges, given values have to be adjusted for // screen coordinates and clipped according to the clip box, does not respect transparency // on the drawn line (beside edges) T_STATIC void prv_assign_vertical_line_raw(GContext *ctx, i...
(ctx, output, data_row_offset, x, 1, gcolor_alpha_blend(color, *output))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, &GRect(4, 2, 16, 8))
; } static void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(10, 2, 18, 4)); } static void across_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics...
ommand_processor; GContext *ctx; GColor stroke_color; // replace red to this GColor key_color; // replace this color with overdraw_color GColor overdraw_color; // replace key_color with this GColor app_fb_key_color; // replace with app framebuffer, use GColorClear to skip GPoint framebuffer_offset; // displ...
gbitmap_get_data_row_info(framebuffer, y)
; x1.raw_value = MAX(x1.raw_value, destination_data_row_info.min_x << FIXED_S16_3_PRECISION); x2.raw_value = MIN(x2.raw_value, destination_data_row_info.max_x << FIXED_S16_3_PRECISION); if (x1.integer > x2.integer) { return; } GBitmap app_framebuffer = compositor_get_app_framebuffer_as_bitmap(); // We ...
_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpClear, GColorWhite); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_clear-expect.8bit.pbi")); memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, ...
(src_bitmap)
; } // Setup: // - Source is 25x25. // - Source has alternating white / black lines. // - Dest is Blue, 100x100. // - Dest offset is set to 8x10 clipped in the bottom right corner. // Result: // - There should be an 8x10 alternating black & white lines in the bottom right corner. void test_bitblt__1bit_to_8b...
.origin.x, property_animation->values.to.grect.origin.x); result.origin.y = distance_interpolate( distance_normalized, property_animation->values.from.grect.origin.y, property_animation->values.to.grect.origin.y); result.size.w = distance_interpolate( distance_normalized, propert...
(&property_animation->animation)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(text_color, GColorClear)
) { graphics_context_set_text_color(ctx, text_color); graphics_draw_text(ctx, text, small_font, text_box, overflow_mode, alignment, NULL); } } void health_ui_render_typical_text_box(GContext *ctx, Layer *layer, const char *value_text) { time_t now = rtc_get_time(); struct tm time_tm; localtime_r(&now, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_INFO, "App PP receiver already closed")
; return; } app_inbox_destroy_and_deregister(*inbox); *inbox = NULL; }
ctivityMetric metric) { strcpy(data->debug_card.dialog_text, title); // Get History int32_t values[7]; activity_get_metric(metric, ARRAY_LENGTH(values), values); for (int i = 0; i < 7; i++) { char elapsed[8]; prv_convert_seconds_to_time(values[i], elapsed, sizeof(elapsed)); char temp[32]; snp...
activity_test_set_steps_history()
; snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Step history changed"); prv_display_alert(data->debug_card.dialog_text); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_set_sleep_history(int index,...
{ // TODO: PBL-15063 return; }
gpio_input_init_pull_up_down(input_config, GPIO_PuPd_NOPULL); } void gpio_input_init_pull_up_down(const InputConfig *input_config, GPIOPuPd_TypeDef pupd) { GPIO_InitTypeDef gpio_init = { .GPIO_Mode = GPIO_Mode_IN, .GPIO_PuPd = pupd, .GPIO_Pin = input_config->gpio_pin }; prv_init_common(input_con...
{ // Make sure combinations of vmc/orient are mostly unique, so don't wrap at the same // module 256 boundary. next_vmc = 0; }
minute_data[i].base.orientation = next_orient++; minute_data[i].base.light = next_light++; minute_data[i].base.plugged_in = next_plugged_in; next_plugged_in = !next_plugged_in; minute_data[i].active_calories = next_active_calories++; minute_data[i].resting_calories = next_resting_calories++; ...
nse 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 "jerry-api.h" #include "rocky_api_graphics.h" #include "rocky_api_graphics_path2d.h" ...
{ return jerry_create_undefined(); }
layer_mark_dirty(&top_window->layer); return jerry_create_undefined(); } GContext *rocky_api_graphics_get_gcontext(void) { return app_state_get_graphics_context(); } static jerry_value_t prv_rect_precise_call(const jerry_length_t argc, const jerry_value_t argv[], void (*func...
pt(); prv_read_data((uint8_t *)&packet, sizeof(packet)); PBL_ASSERTN(packet.packet_id == PACKET_ID_FLASH_RESPONSE); PBL_ASSERTN(packet.address == address); PBL_ASSERTN(packet.footer == RAM_FLASH_FOOTER); return ntohs(packet.value); } #endif // Interrupt / Callback ///////////////////////////////////////////...
exti_enable(EWD1000->int_exti)
; PBL_LOG(LOG_LEVEL_DEBUG, "Initialized eWD1000 touch controller"); }
t(); const GTextAlignment text_alignment = PBL_IF_RECT_ELSE(GTextAlignmentCenter, show_action_bar ? GTextAlignmentRight : GTextAlignmentCenter); { // do all this in a block so we enforce that nobody uses these variables outside of the block // when dealing with round displays, sizes change depending o...
{ WorkoutDialog *workout_dialog = window_get_user_data(window); dialog_unload(&workout_dialog->dialog); action_bar_layer_remove_from_window(&workout_dialog->action_bar); action_bar_layer_deinit(&workout_dialog->action_bar); gbitmap_deinit(&workout_dialog->confirm_icon); gbitmap_deinit(&workout_dialog->dec...
void workout_dialog_init(WorkoutDialog *workout_dialog, const char *dialog_name) { PBL_ASSERTN(workout_dialog); *workout_dialog = (WorkoutDialog){}; dialog_init(&workout_dialog->dialog, dialog_name); Window *window = &workout_dialog->dialog.window; window_set_window_handlers(window, &(WindowHandlers) { ...
184, 512, 576}, { -200, 456, 408}, { -208, 392, 440}, { -248, 464, 408}, { -272, 512, 512}, // 412 seconds { -280, 640, 528}, { -296, 728, 680}, { -256, 744, 696}, { -400, 888, 824}, { -384, 920, 1008}, { -176, 848, 728}, { -136, 680, 424}, { -208, 576, 328}, { -2...
{ -408, 504, 416}, { -480, 584, 584}, { -544, 632, 648}, { -536, 792, 696}, { -528, 864, 896}, { -584, 920, 1032}, { -384, 816, 792}, { -424, 616, 808}, { -344, 600, 784}, { -192, 536, 560}, { -216, 400, 432}, { -240, 360, 408}, { -248, 456, 408}, { -240, 544, 504...
// elapsed: 7 minutes { -320, 848, 728}, { -400, 848, 672}, { -448, 856, 720}, { -304, 832, 688}, { -200, 840, 504}, { -240, 760, 464}, { -264, 624, 376}, { -312, 504, 288}, { -376, 424, 320}, { -456, 448, 392}, { -520, 584, 520}, { -504, 664, 528}, { -568, 848, ...
er_id); break; case LIGHT_STATE_ON_TIMED: new_brightness = prv_backlight_get_intensity(); // Schedule the timer to move us from the ON_TIMED state to the ON_FADING state new_timer_start(s_timer_id, backlight_get_timeout_ms(), light_timer_callback, NULL, 0 /* flags */);...
{ prv_change_state(LIGHT_STATE_ON); }
to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); window_stack_push(app_stack, window1, true); cl_assert_equal_i(window_stack_count(app_stack), 1); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to the ker...
window_stack_push(stack, window2, true)
; window_stack_push(stack, window3, true); WindowStackDump *dump; size_t stack_depth = window_stack_dump(stack, &dump); cl_assert_equal_i(stack_depth, 3); cl_assert_equal_p(dump[0].addr, window3); cl_assert_equal_s(dump[0].name, "Window3"); cl_assert_equal_p(dump[1].addr, window2); cl_assert_equal_s(du...
s_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_NEG, RECT_NEG, false, 1);...
(&ctx, GColorBlack)
; graphics_draw_text(&ctx, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR" "STUVWXYZabcdefghijklmnopqrstuvwxyz", &s_font_info, RECT_TEXT_0_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(gbitmap_pbi_eq(&ctx.des...
rrent fill color since the stroke color // is what is used for draw pixel. Restore the stroke color afterwards. GColor backup_stroke_color = ctx->draw_state.stroke_color; ctx->draw_state.stroke_color = ctx->draw_state.fill_color; graphics_draw_pixel(ctx, p); ctx->draw_state.stroke_color = backup_str...
Fixed_S16_3(y)
}; } }
/* * 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(IOS_SMS_APP_ID)
; memcpy(expected_app_id->value, IOS_SMS_APP_ID, strlen(IOS_SMS_APP_ID)); char valid_message[128]; strcpy(valid_message, "possible preamble "); strcat(valid_message, NEXMO_REAUTH_STRING); strcat(valid_message, " possible postamble"); uint8_t expected_message_buf[128]; ANCSAttribute *expected_message = (...
(&app_data->window, app_data)
; window_set_window_handlers(&app_data->window, &(WindowHandlers) { .load = prv_window_load }); const bool animated = true; app_window_stack_push(&app_data->window, animated); app_data->test = 0xA5A5A5A5; launcher_task_add_callback(prv_verify_modify_on_kernel_task, app_data); } static void prv_main(v...
(FLASH_GPIO)
; // Init the hardware flash_hw_init(); gpio_release(FLASH_GPIO); periph_config_release_lock(); } void flash_start_cmd(void) { gpio_use(FLASH_GPIO); GPIO_ResetBits(FLASH_GPIO, FLASH_PIN_SCS); gpio_release(FLASH_GPIO); } void flash_end_cmd(void) { gpio_use(FLASH_GPIO); GPIO_SetBits(FLASH_GPIO, FLAS...
= atan2_lookup(y, x) * 180 / TRIG_PI; double theirs = atan2(y, x) / 3.14159 * 180; // atan2 returns in range [-pi, +pi], but we have [0,2pi]. if (theirs < 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(...
(WITHIN(11, min, max), false)
; // Negative out of bounds cl_assert_equal_i(WITHIN(-5, min, max), false); // Positive out of bounds cl_assert_equal_i(WITHIN(0, min, max), false); // Min negative, max positive //////////////////////////////// min = -10; max = 10; // Min and max themselves should satisfy WITHIN cl_assert_equal...
4.h" #include "util/math.h" #include "util/size.h" #include "util/units.h" #include <pebbleos/cron.h> #include "FreeRTOS.h" #include "semphr.h" #include "activity.h" #include "activity_algorithm.h" #include "activity_calculators.h" #include "activity_insights.h" #include "activity_private.h" // Our globals static A...
("Got HR event: %d", (int) hrm_event->event_type)
; if (hrm_event->event_type == HRMEvent_BPM) { ACTIVITY_LOG_DEBUG("HR bpm: %"PRIu8", qual: %"PRId8" ", hrm_event->bpm.bpm, (int8_t) hrm_event->bpm.quality); // Perform a basic validity check so we only proceed with reasonable data // TODO: Use quality to filter out some readings, ...
p->bounds }; // All compositing modes except GCompOpSet should be the same as GCompAssign memset(dest_data, GColorGreen.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect...
(src_bitmap)
; } // Tests comptint, multiple tint colors and varying opacity of the source image. // Setup: // - Destination is two 128 by 64 blocks expressing the 64 colors; each row expresses // one of the colors stack vertically. // - Source is a set of 4 by 4 blocks each with a 1 pixel wide vertical strip of a color //...
/* * 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...
rocky_runtime_context_init()
; jerry_init(JERRY_INIT_EMPTY); s_app_window_stack_get_top_window = (Window){}; s_app_event_loop_callback = NULL; s_log_internal__expected = NULL; s_prv_api_init__callcount = 0; s_prv_api_add__callcount = 0; s_prv_api_add__result = false; s_prv_api_remove__callcount = 0; s_prv_listener_a1__callcoun...
subscriber should leave the HRM off hrm_manager_enable(false); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_b(hrm_is_enabled(HRM), false); hrm_manager_enable(true); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_b(hrm_is_enabled(HRM), false); // 2. Subscribing while disable...
fake_system_task_callbacks_invoke_pending()
; cl_assert_equal_b(hrm_is_enabled(HRM), true); prv_advance_time_ms(1000); prv_fake_send_new_data(); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_b(hrm_is_enabled(HRM), true); prv_advance_time_ms(1000); // Remove the 10 second subscription - We should get disabled after the next update ...
(new_state == SmartstrapStateReadInProgress)) { PBL_ASSERTN(mcu_state_is_isr() || (pebble_task_get_current() == PebbleTask_KernelBackground)); } else if ((prev_state == SmartstrapStateReadDisabled) && (new_state == SmartstrapStateReadReady)) { PBL_ASSERT_TASK(PebbleTask_KernelBackgroun...
(s_services_lock)
; } s_is_connected = connected; smartstrap_profiles_handle_connection_event(connected); } DEFINE_SYSCALL(bool, sys_smartstrap_is_service_connected, uint16_t service_id) { if (!smartstrap_is_connected()) { return false; } mutex_lock(s_services_lock); bool result = prv_find_connected_service(service_id...
/* * 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...
(DBGMCU_SLEEP | DBGMCU_STOP, ENABLE)
; // Stop RTC, IWDG & TIM2 during debugging // Note: TIM2 is used by the task watchdog DBGMCU_APB1PeriphConfig(DBGMCU_RTC_STOP | DBGMCU_TIM2_STOP | DBGMCU_IWDG_STOP, ENABLE); #endif } void disable_mcu_debugging(void) { DBGMCU->CR = 0; DBGMCU->APB1FZ = 0; DBGMCU->APB2FZ = 0; } voi...
-72, -32}, { 584, -72, -88}, { 808, 32, -144}, { 1464, -248, 176}, { 1960, 48, 440}, // 16 seconds { 1872, 456, 200}, { 1712, 512, -48}, { 1472, 504, 168}, { 1232, 400, 312}, { 1128, 224, 376}, { 1048, 272, 256}, { 968, 328, 160}, { 912, 496, 40}, { 896, 544, 24},...
{ 1936, -288, 144}, { 1928, 176, 64}, { 1776, 384, -184}, { 1576, 320, -96}, { 1208, 264, 320}, { 1056, 152, 352}, { 1000, 144, 280}, { 888, 240, 216}, { 800, 368, 96}, { 776, 488, -56}, { 808, 480, 56}, // 22 seconds { 984, 328, 144}, { 1144, 448, 128}, { 164...
GBitmapFormat1BitPalette: case GBitmapFormat2BitPalette: case GBitmapFormat4BitPalette: return ((width * gbitmap_get_bits_per_pixel(format) + 7) / 8); // byte aligned case GBitmapFormat8BitCircular: return 0; // variable width } return 0; } static GBitmap* prv_allocate_gbitmap(void) { if ...
{ gbitmap_init_with_data(bitmap, data); }
sed on black and white, using UNUSED here quiets the linter UNUSED int16_t bottom_inset = 0; #if PBL_ROUND // On round displays, inset the box from the bottom to account for drawing the indicator at the // bottom center, and then draw the indicator const bool selected_with_indicator = (selected && !item->is_lea...
{ if (item_index < aml->num_items) { return item_index; } else { return aml->num_items + (item_index - aml->num_items) / SHORT_COL_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...
if (tloc) { *tloc = legacy_time; }
return (t_ms); } extern size_t localized_strftime(char* s, size_t maxsize, const char* format, const struct tm* tim_p, const char *locale); struct tm *pbl_override_gmtime(const time_t *timep) { struct tm *gmtime_tm = NULL; if (pebble_task_get_current() == PebbleTask_App) { gmtime_tm = app_state_get...
return jerry_create_undefined(); } JERRY_FUNCTION(prv_fill_rect) { return prv_rect_call(argc, argv, graphics_fill_rect); } static void prv_draw_rect_impl(GContext *ctx, const GRectPrecise *rect) { GRectPrecise adjusted_rect = *rect; adjusted_rect.origin.x.raw_value -= FIXED_S16_3_HALF.raw_value; adjusted_rec...
task_zalloc(sizeof(*new_head))
; new_head->draw_state = rocky_api_graphics_get_gcontext()->draw_state; list_insert_before(&s_canvas_context_2d_stored_states->node, &new_head->node); s_canvas_context_2d_stored_states = new_head; return jerry_create_undefined(); } JERRY_FUNCTION(prv_restore) { Context2DStoredState *const head = s_canvas_con...
CT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_THREE); break; case 5: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 6: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; ...
pwr_clear_boot_from_standby_flag()
; dbgserial_putstr("exit standby"); system_hard_reset(); } periph_config_disable(PWR, RCC_APB1Periph_PWR); } static void prv_print_bootloader_version(void) { char bootloader_version_str[12]; memset(bootloader_version_str, 0, 12); itoa_hex(boot_version_read(), bootloader_version_str, 12); dbgserial_...
s/common/battery/battery_state.h" #include "services/common/battery/battery_monitor.h" #include "services/common/compositor/compositor.h" #include "services/common/cron.h" #include "services/common/debounced_connection_service.h" #include "services/common/ecompass.h" #include "services/common/event_service.h" #include ...
{ launcher_cancel_force_quit(); }
light_button_released(); } app_idle_timeout_refresh(); if (compositor_is_animating()) { // mask the app task if we're already animating e->task_mask |= 1 << PebbleTask_App; return; } const bool is_modal_focused = (modal_manager_get_enabled() && !(modal_mana...
ector at addr: 0x%"PRIX32" not really erased. is_subsector: %d", addr, is_subsector); goto done; } } } } done: return erased; } // ARG: // 0 - Only show sectors // 1 - Show subsectors too if sector is not erased void command_flash_show_erased_sectors(const char *arg) { ...
{ int len = strlen(bit); int bit_number = 0; for (int i = 0; i < len; ++i) { bit_number *= 10; int next_digit = bit[i] - '0'; if (next_digit < 0 || next_digit > 9) { prompt_send_response("invalid bit number"); return; } bit_number += next_digit; } int bit_mask = 1 << bit_numb...
typedef struct { ButtonId button_id; bool button_is_held_down; uint32_t num_presses_remaining; uint32_t hold_down_time_ms; uint32_t delay_between_presses_ms; } ButtonPressNewTimerContext; // This is a callback to only be used in conjunction with command_button_press() and // command_button_press_multiple()...
uint8_t status_a; uint8_t status_b; if (!prv_read_register(PmicRegisters_STATUSA, &status_a) || !prv_read_register(PmicRegisters_STATUSB, &status_b)) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to read status registers"); return; } PBL_LOG(LOG_LEVEL_INFO, "%s: StatusA = 0x%"PRIx8"; StatusB = 0x%"PRIx...
i2c_use(I2C_MAX14690)
; prv_update_rail_state(PmicRail_LDO3, enabled); i2c_release(I2C_MAX14690); } void set_4V5_power_state(bool enabled) { gpio_output_set(&BOARD_CONFIG_POWER.rail_4V5_ctrl, enabled); } void set_6V6_power_state(bool enabled) { PBL_ASSERTN(BOARD_CONFIG_POWER.rail_6V6_ctrl.gpio); gpio_output_set(&BOARD_CONFIG_POW...
mu_serial_private_init_state(&s_state); } void test_qemu_serial__cleanup(void) { } // ------------------------------------------------------------------------------------ static void prv_send_bytes(void *p, uint32_t size) { uint8_t *src = (uint8_t *)p; for (uint32_t i=0; i<size; i++) { qemu_test_add_byte_fro...
(msg_data, rcv_msg, sizeof(msg_data))
; cl_assert_equal_m(msg_data, rcv_msg+sizeof(msg_data), sizeof(msg_data)); prv_send_footer(); cl_assert(!qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol)); }
topped_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); // Complete B prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_c...
(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), 1); cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MAX); #...
1288, 280, -72}, { 1280, 152, 72}, { 1856, 208, 104}, // 49 seconds { 1376, 280, 136}, { 1056, 184, 96}, { 1144, 24, 208}, { 1176, 8, 264}, { 1016, 8, 264}, { 824, 64, 168}, { 768, -8, 144}, { 720, -40, 152}, { 696, -40, 104}, { 760, -88, 104}, { 840, -112, 64}, ...
ARRAY_LENGTH(samples)
(FLASH_BASE, 16 KiB, callback_is_called_cb, (void *)8675309)
); cl_assert(callback_called); cl_assert(flash_locked); } void test_system_flash__handle_erase_error(void) { return_status = FLASH_ERROR_OPERATION; cl_assert(!system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert(flash_locked); } void error_in_middle_cb(uint32_t num, uint32_t den, void *context) { ...
final frontier. These are the voyages of the starship Enterprise. " "Its 5-year mission: to explore strange new worlds, " "to seek out new life and new civilizations, to boldly go where no man has gone before. "; static const char* QUOTE_BUF_2 = "Dib: You're just jealous...\n" "Zim: This has nothing to do with...
push_window(data)
; } static void handle_deinit(void) { struct AppState* data = app_state_get_user_data(); app_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* text_flow_app_get_info() { static const PebbleProcessMdSystem text_flow_info = { .common.m...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(!alerts_preferences_dnd_is_smart_enabled())
; s_data.manually_override_dnd = false; prv_do_update(); } static void prv_toggle_manual_dnd_from_action_menu(void *e_dialog) { do_not_disturb_toggle_push(ActionTogglePrompt_NoPrompt, false /* set_exit_reason */); } static void prv_toggle_manual_dnd_from_settings_menu(void *e_dialog) { do_not_disturb_set_manu...
*curr = bottom_layer; // Traverse the layer's ancestors and cancel all (unless one of the ancestors is the new active // layer - then stop) while (curr && (curr != top_layer) && (curr != root)) { recognizer_list_iterate(layer_get_recognizer_list(curr), iter_cb, manager); curr = curr->parent; } } stati...
if (!manager->triggered) { // Look for triggered recognizers in remaining recognizer lists prv_set_triggered(manager, prv_any_recognizers_active_triggered(manager)); }
if (manager->triggered) { if (!new_active_layer_is_ancestor) { prv_cancel_layer_tree_recognizers(manager, NULL, new_active_layer); } } else { // We cancelled all the triggered recognizers, time to reset everything manager->active_layer = new_active_la...
/* * 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...
(&now, &local_tm)
; // Get the current steps health_service_private_get_metric_history(HealthMetricStepCount, 1, health_data->step_data); // Get the typical step averages for every 15 minutes activity_get_step_averages(local_tm.tm_wday, &health_data->step_averages); health_data->current_hr_bpm = health_service_peek_current_...
/* * 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...
(*get_erase_status_fn)
392, 848, -328}, { 384, 1056, -504}, { 368, 904, -616}, { 320, 656, -480}, { 208, 560, -408}, // 127 seconds { 72, 480, -288}, { 48, 624, -232}, { 0, 632, -288}, { 0, 752, -344}, { 40, 896, -512}, { 176, 984, -456}, { 360, 1424, -600}, { 384, 1192, -416}, { 280, 1...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25820_10 //> TEST_EXPECTED 200 //> TEST_EXPECTED_MIN 165 //> TEST_EXPECTED_MAX 230 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { 304, 128, -944}, { ...
); s_current_day = s_sunday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 3); s_current_day = s_monday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 4); s_current_day = s_tuesday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 5); s_current_day = s_w...
(s_num_alarm_events_put, 3)
; cl_assert_equal_i(s_num_timeline_adds, 11); cl_assert_equal_i(s_num_timeline_removes, 7); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again, but not until Saturday s_current_hour = 11; s_current_minute = 30; cron_serv...
/* * 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...
hr_util_get_hr_zone(220)
, HRZone_Zone3); cl_assert_equal_i(hr_util_get_hr_zone(240), HRZone_Zone3); } void test_hr_util__is_elevated(void) { cl_assert_equal_b(hr_util_is_elevated(60), false); cl_assert_equal_b(hr_util_is_elevated(80), false); cl_assert_equal_b(hr_util_is_elevated(99), false); cl_assert_equal_b(hr_util_is_elevated(...
v_unlock(void) { mutex_unlock(s_db_mutex); } static bool prv_bt_persistent_storage_get_ble_smpairinginfo_by_id( BTBondingID bonding, SMPairingInfo *info_out, char *name_out, bool *requires_address_pinning, uint8_t *flags); static void prv_update_bondings(BTBondingID id, BtPersistBondingType type) { if (id...
{ s_bt_persistent_storage_updates++; PBL_LOG_D(LOG_DOMAIN_BT_PAIRING_INFO, LOG_LEVEL_DEBUG, "Updating GAP Bonding DB Value <key, val>!"); PBL_HEXDUMP_D(LOG_DOMAIN_BT_PAIRING_INFO, LOG_LEVEL_DEBUG, (uint8_t *)key, key_len); PBL_HEXDUMP_D(LOG_DOMAIN_BT_PAIRING_INFO, LOG_L...
} else { rv = settings_file_delete(&fd, key, key_len); } settings_file_close(&fd); } cleanup: prv_unlock(); if (rv != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to update gap bonding db, rv = %"PRId32, rv); return GapBondingFileSetFail; } return (do_perform_update ? GapBondingFi...
orkout of 120 seconds duration. Should be valid prv_inc_time(2 * SECONDS_PER_MINUTE); cl_assert(workout_service_stop_workout()); // Wait 20 minutes. By this time, as soon as we leave the app, we should turn off the HR device. prv_inc_time(20 * SECONDS_PER_MINUTE); workout_service_frontend_closed(); cl_ass...
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 20)
; cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 20); prv_inc_time(10); prv_put_bpm_event(ZONE_2_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 10); cl...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(radius <= 8)
; GBitmap* bitmap = graphics_context_get_bitmap(ctx); // translate to absolute bitmap coordinates: rect.origin.x += ctx->draw_state.drawing_box.origin.x; rect.origin.y += ctx->draw_state.drawing_box.origin.y; // clip it to avoid drawing outside of the bitmap memory: GRect clipped_rect = rect; grect_stan...
no Rocky.js APIs that need to be called while in privileged mode, so run // in unprivileged mode for the built-in Rocky.js apps (Tictoc) as well: const bool is_rocky_app = s_app_task_context.app_md->is_rocky_app; if (is_unprivileged || is_rocky_app) { mcu_state_set_thread_privilege(false); } const Pebb...
(PebbleTask_KernelMain)
; PBL_ASSERTN(app_md); prv_dump_start_app_info(app_md); process_manager_init_context(&s_app_task_context, app_md, args); // Set up the app's memory and load the app into it. size_t app_segment_size = prv_get_app_segment_size(app_md); // The stack guard is counted as part of the app segment size... cons...
artstrapResult result, const uint8_t *data, size_t length) { cl_assert(data == (uint8_t *)attribute); cl_assert(result == SmartstrapResultOk); cl_assert(s_pending_did_read.active); cl_assert(s_pending_did_read.attribute == attribute); cl_assert(s_pending_did_read.length == len...
(app_smartstrap_attribute_get_service_id(attr) == 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...
{ window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); window_single_click_subscribe(BUTTON_ID_UP, up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler); }
static void in_received_handler(DictionaryIterator *iter, void *context) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Received message"); } static void in_dropped_handler(AppMessageResult reason, void *context) { APP_LOG(APP_LOG_LEVEL_DEBUG, "App Message Dropped!"); } static void out_failed_handler(DictionaryIterator *faile...
/* * 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...
GRect(0, 0, 60, 60)
; GRect to_rect_a = GRect(84, 92, 60, 60); GRect from_rect_b = GRect(84, 0, 60, 60); GRect to_rect_b = GRect(0, 92, 60, 60); GRect tmp; if (toggle) { tmp = to_rect_b; to_rect_b = from_rect_b; from_rect_b = tmp; } toggle = !toggle; animation_destroy(s_animation); s_animation = NULL; P...
lice, context)) { break; } // Advance to the next slice glance_size_processed += current_slice->total_size; current_slice = (SerializedAppGlanceSliceHeader *)(((uint8_t *)current_slice) + current_slice->total_size); } return true; } ///////////////////////////////////////// // Seria...
if (!attribute_buffer) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to alloc memory for the buffer of Attribute's while deserializing an " "AttributeList from a serialized slice"); // Free the `*attr_list_data_buffer_out` we might have allocated above kernel_free(*attr_list_data_buffer_out); ...
// Setup the arguments for `attribute_deserialize_list()` char *attribute_data_buffer_pointer = *attr_list_data_buffer_out; char * const attribute_data_buffer_end = attribute_data_buffer_pointer + buffer_size; *attr_list_out = (AttributeList) { .num_attributes = num_attributes, .attributes = attribute...
944, 88}, { -400, 936, 80}, { -400, 936, 80}, { -400, 936, 72}, { -392, 936, 80}, { -392, 944, 80}, { -392, 936, 80}, { -392, 936, 80}, // 55 seconds { -392, 944, 72}, { -400, 936, 88}, { -392, 920, 72}, { -392, 920, 72}, { -368, 888, 32}, { -384, 936, 88}, {...
{ -424, 920, 168}, { -416, 912, 168}, { -416, 912, 168}, { -416, 912, 168}, { -416, 904, 168}, { -416, 904, 160}, { -416, 912, 176}, { -424, 912, 168}, { -424, 888, 168}, { -416, 896, 184}, { -424, 896, 208}, { -440, 904, 184}, { -432, 912, 184}, { -440, 904, 184}...
{ -408, 904, 192}, { -416, 920, 216}, { -416, 904, 232}, { -416, 920, 216}, { -416, 888, 208}, { -416, 920, 208}, { -400, 904, 216}, { -400, 912, 208}, { -400, 920, 224}, { -392, 896, 216}, { -400, 912, 208}, { -392, 896, 216}, { -408, 944, 232}, { -392, 976, 216...
/* * 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...
memcpy(&address_out->octets[0], hash_bytes, HASH_LEN_BYTES)
; // Copy the prand to the 24 MSBits of the address: memcpy(&address_out->octets[HASH_LEN_BYTES], prand_bytes, PRAND_LEN_BYTES); }
-304, 112}, { -1000, -32, 64}, { -872, 72, 104}, { -832, -16, 88}, { -792, -120, 144}, { -752, -96, 72}, { -1032, 64, 24}, { -1232, -16, 184}, { -1608, -144, 168}, { -1568, -176, 16}, { -1216, 296, 136}, { -1184, 160, 232}, // 54 seconds { -1288, 176, 680}, { -11...
{ 136, 1056, 328}, { 144, 912, 144}, { 96, 888, -152}, { -72, 768, -360}, { -144, 616, -568}, { -16, 400, -784}, // 60 seconds // elapsed: 1 minutes { -344, -2160, -544}, { 88, 496, -824}, { -32, 512, -816}, { -24, 344, -912}, { 56, 136, -872}, { 152, 152, -888}, ...
// ---------------------------------------------------------------- // Sample captured: 2015-10-02 15:39:33 local AccelRawData *activity_sample_walk_100_pbl_25478_6(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25478_6 //> TEST_EXPECTED 100 //> T...
leaned up, make it so the kernel can do it on the worker's behalf and put // the call at the bottom of prv_worker_cleanup. worker_state_deinit(); sys_exit(); } //! Heap locking function for our app heap. Our process heaps don't actually //! have to be locked because they're the sole property of the process and ...
PBL_LOG(LOG_LEVEL_WARNING, "Tried to launch an invalid worker in bank %u!", process_metadata_get_code_bank_num(app_md))
; return false; } // The rest of worker_ram is available for worker state to use as it sees fit. if (!worker_state_configure(&worker_ram)) { PBL_LOG(LOG_LEVEL_ERROR, "Worker state configuration failed"); return false; } // The remaining space in worker_segment is assigned to the worker's // hea...
); } else if (action->type == TimelineItemActionTypePostpone) { ActionMenuLevel *responses_level = prv_create_postpone_level(action, root_level); action_menu_level_add_child(root_level, responses_level, label); } else { action_menu_level_add_action(root_level, label, prv_action_menu_cb, action); } } ...
(data, ignore_failures)
; bool performed_actions = false; if (action_menu) { TimelineActionMenu *timeline_action_menu = action_menu_get_context(action_menu); prv_set_action_result(timeline_action_menu, data); action_menu_freeze(action_menu); // We only show the first use tutorial if this was called from an action menu ...
e pin position prv_setup_first_pin_peek(data); focus_handler = prv_open_did_focus_handler; } // set the did_focus handler data->focus_event_info = (EventServiceInfo) { .type = PEBBLE_APP_DID_CHANGE_FOCUS_EVENT, .handler = focus_handler, .context = s_app_data, }; event_service_client_subsc...
(&data->timeline_layer, true)
; window_set_background_color(&data->timeline_window, GColorWhite); #if !PLATFORM_TINTIN TimelineLayout *pin_timeline_layout = timeline_layer_get_current_layout(&data->timeline_layer); if (pin_timeline_layout) { // animation the pin icon TimelineItemLayer *item_layer = &data->pin_window.item_detail_laye...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&state->tick_service_info)
; // TODO: make an effort to get this closer to the "actual" second tick } void tick_timer_service_unsubscribe(void) { TickTimerServiceState *state = prv_get_state(PebbleTask_Unknown); event_service_client_unsubscribe(&state->tick_service_info); state->handler = NULL; } void tick_timer_service_state_init(Tic...
/* * 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...
{ uint32_t addr = get_current_address(s_current_chunk, 0); PBL_ASSERT((addr & (SUBSECTOR_SIZE_BYTES - 1)) == 0, "Sections must be subsector aligned! addr is 0x%" PRIx32, addr); PBL_ASSERT((CHUNK_SIZE_BYTES & (SUBSECTOR_SIZE_BYTES - 1)) == 0, "Sections divide into subsectors evenly, size is 0x%" PRIx16...
cl_assert_equal_b(s_nack_received_for_id_2, true)
; // Check that the state was reset check_in_accepting_again(); } void test_app_message__receive_app_not_running(void) { // FIXME: // https://pebbletechnology.atlassian.net/browse/PBL-22925 return; prv_set_remote_receive_handler(prv_receive_ack_nack_callback); prv_receive_test_data(TEST_TRANSACTION_ID_...
ll_id, &entry); // Construct the crash reason string (copied by the dialog, so we don't have to free it ourselves) // "Worker " is 7, optional space is 1, up to 15 for app name, rest of string is 32, 1 for '\0' const uint8_t MAX_APP_NAME_STRING_LENGTH = 15; const uint8_t CRASH_REASON_BUFFER_SIZE = 7 + 1 + MAX_...
{ launcher_task_add_callback(prv_push_reset_dialog, YOUR_PEBBLE_RESET); }
//! Restrict only to the two defines above //! Show the "Your Bluetooth is ..." void crashed_ui_show_bluetooth_stuck(void) { launcher_task_add_callback(prv_push_reset_dialog, PHONE_BT_CONTROLLER_WEDGED); } #endif
/* * 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_analytics_storage_mutex)
; if (!has_lock) { PBL_LOG(LOG_LEVEL_ERROR, "Analytics lock is not held when it should be!"); } return has_lock; } void analytics_storage_give_lock(void) { mutex_unlock_recursive(s_analytics_storage_mutex); } /////// // Get AnalyticsHeartbeat *analytics_storage_hijack_device_heartbeat() { PBL_ASSERTN(an...
sectors(void) { // write 0's to the entire flash static uint8_t buf[2048] = { 0 }; char status[80]; __disable_irq(); for (int i = 0; i < 2; i++) { for (uint32_t addr = 0; addr < BOARD_NOR_FLASH_SIZE; addr += sizeof(buf)) { if (addr >= FLASH_REGION_SAFE_FIRMWARE_BEGIN && addr < FLASH_REG...
for (int i = 0; i < 100; i++) { snprintf(name, sizeof(name), "litter%d", i); int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 300); if (i % 5 == 0) { pfs_close_and_remove(fd); } else { pfs_close(fd); } }
} #endif #endif static GAPLEConnection *prv_get_le_connection_and_print_info(void) { GAPLEConnection *conn = gap_le_connection_any(); if (!conn) { prompt_send_response("No device connected"); } else { char buf[80]; prompt_send_response_fmt(buf, sizeof(buf), "Connected to " BT_DEVICE_ADDRESS_FMT, ...