prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ut, sizeof(link_key_out)); cl_assert_equal_s(name_1, name_out); cl_assert_equal_i(platform_bits_1, platform_bits_out); ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_2, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl...
(fake_shared_prf_storage_get_bt_classic_store_count(), 1)
; // Delete the Pairing bt_persistent_storage_delete_bt_classic_pairing_by_id(id); cl_assert_equal_i(fake_shared_prf_storage_get_bt_classic_delete_count(), 2); // Try to read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, ...
(odd num pixels) const int16_t width = 2 * MAX(left_width, right_width); // starting point of text needs to be half width left of the center. const int16_t x_start = center - width / 2; // Position the text vertically offset from the bottom of the status bar const int16_t y = min_y + max_y - (2 * STATUS_BAR_L...
prv_get_text_format()
; char time_text_buffer[TITLE_TEXT_BUFFER_SIZE]; clock_copy_time_string(time_text_buffer, sizeof(time_text_buffer)); GContext *ctx = graphics_context_get_current_context(); return graphics_text_layout_get_max_used_size(ctx, time_text_buffer, ...
1432, 200, 288}, { 1720, 32, 480}, { 1608, -216, 528}, { 1376, -208, 376}, { 1296, -96, 288}, { 1200, -104, 232}, { 1200, -208, 256}, { 1128, -288, 144}, { 1016, -424, 56}, // 35 seconds { 984, -440, 8}, { 1112, -552, 48}, { 928, -384, -24}, { 1056, -288, 72}, { ...
{ 1232, -48, 288}, { 872, -24, 160}, { 840, 80, 176}, { 848, 96, 168}, { 984, -16, 192}, { 976, 80, 280}, { 1280, 216, 408}, { 1472, 496, 424}, { 1752, 552, 472}, { 872, 432, 184}, { 1464, 136, 320}, { 1744, 48, 544}, { 1544, -184, 512}, { 1392, -176, 344}, { ...
{ 936, -184, 208}, { 832, -216, 24}, // 43 seconds { 856, -288, 16}, { 832, -360, -32}, { 1168, -640, 24}, { 824, -464, 112}, { 1256, -376, 240}, { 1712, -120, 264}, { 1856, 80, 280}, { 1608, 32, 272}, { 1336, -24, 392}, { 1264, 216, 256}, { 1184, 248, 312}, ...
0); } void test_flash_region__erase_optimal_range_sectors_simple(void) { // Erase one sector 0x10000 - 0x20000 flash_region_erase_optimal_range(64 * 1024, 64 * 1024, 2 * 64 * 1024, 2 * 64 * 1024); cl_assert_equal_i(s_command_list_index, 1); cl_assert_equal_i(s_command_list[0].addr, 64 * 1024); cl_assert_equ...
cl_assert_equal_i(s_command_list[1].type, SubsectorEraseCommand)
; cl_assert_equal_i(s_command_list[2].addr, 40 * 1024); cl_assert_equal_i(s_command_list[2].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[3].addr, 44 * 1024); cl_assert_equal_i(s_command_list[3].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[4].addr, 48 * 1024); cl_assert...
8, -32, -136}, { 1000, -88, -160}, { 1032, -160, -168}, { 1048, -176, -208}, { 1224, -192, -232}, { 1432, -192, -240}, { 1336, -160, -408}, { 896, -160, -432}, { 696, -168, -320}, { 1072, -104, -240}, { 984, -144, -216}, { 960, -96, -184}, { 840, -96, -256}, { 792, -1...
{ 1176, -248, 184}, { 1168, -240, 208}, { 1016, -224, 168}, { 1096, -200, 96}, { 1064, -192, 128}, { 1120, -208, 96}, { 1080, -176, 72}, { 1144, -176, 48}, { 1088, -184, 72}, { 1096, -192, 64}, { 1144, -168, 64}, // 67 seconds { 1240, -160, 88}, { 1216, -128, 104}...
{ 1104, -152, -168}, { 1360, -168, -200}, { 1336, -168, -248}, { 1176, -120, -184}, { 920, -56, -120}, { 1048, 32, -176}, { 1272, 0, -88}, { 1232, -56, 0}, { 1080, -96, 16}, { 1024, -112, -8}, { 1008, -80, -24}, { 960, -80, -8}, { 912, -104, 0}, { 912, -104, -8},...
RS); cl_assert_equal_s(" 2:00 PM", time_buf); // June 10th 2015, 13:00:00 (T-01:00:00) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 H", time_buf); // June 10th 2015, 13:00:01 (T-00:59:...
(jun10th_noon_2015 + (12 * SECONDS_PER_HOUR) - 1)
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Fri, 12:00 PM", time_buf); // June 11th 2015, 00:00:00 (T-1DAY-12:00:00) rtc_set_time(event_time - SECONDS_PER_DAY - (12 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(tim...
{.is_invalid = true, .steps = 2}, {.is_invalid = false, .steps = 3}, }, }, }; // pass time that's not exactly on a boundary time_t time_start = now - 10 * SECONDS_PER_MINUTE - 30; time_t time_end = now - 20; written = health_service_get_minute_history(data, ARRAY_LENGTH(data), &time_start, ...
(123, end_sec)
; cl_assert_equal_i(1, s_sys_activity_get_metric_values.in.history_len); cl_assert_equal_i(ActivityMetricSleepExitAtSeconds, s_sys_activity_get_metric_values.in.metric); } // Test that health_service_sum_averaged() returns the correct result when asked to get the // average daily value of a metric void test_health...
/* * 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...
delay_us(100)
; } return true; } static bool prv_try_program(const uint8_t *fpga_bitstream, uint32_t bitstream_size) { display_spi_configure_default(); spi_ll_slave_acquire(ICE40LP->spi_port); spi_ll_slave_scs_assert(ICE40LP->spi_port); gpio_output_set(&ICE40LP->creset, false); // CRESET LOW...
SampleFileType_MinuteSamples, "activity/activity_samples"); cl_assert(success); // Init algorithm state s_kalg_state = kernel_zalloc(kalg_state_size()); const uint32_t k_max_tests = 1000; uint32_t num_tests = 0; // Results ActivityTe...
printf(" exp_%-8s act_%-7s", metrics[i], metrics[i])
; } printf(" %-10s %-10s", "weight_err", "status"); printf("\n------------------------"); for (int i = 0; i < ARRAY_LENGTH(metrics); i++) { printf("| ---------------------- "); } float weighted_sum = 0.0; int pass_count = 0; int fail_count = 0; ActivityFileTestEntry *entry = &test_entry[0]; Ac...
e ABI: const uint8_t raw_bytes_v1[] = { 0x04, 0x00, 0x00, 0x00, ':', '1', '2', '3', }; cl_assert_equal_i(sizeof(raw_bytes_v1), expected_size); cl_assert_equal_m(raw_bytes_v1, buffer, expected_size); prv_rcv_app_message_ack(APP_MSG_OK); json_bytes_remaining -= json_bytes_size; } // Ch...
(event_valid)
); // Make sure that there is a "data" property JS_VAR data_prop = jerry_get_object_field(event_valid, "data"); cl_assert_equal_b(true, jerry_value_is_object(data_prop)); // Make sure the re-serialized object matches: ASSERT_JS_GLOBAL_EQUALS_S("json_str", "{\"x\":123}"); EXECUTE_SCRIPT("json_...
uint16_t length) { return (Tuple *) (((uint8_t *)iter->cursor) + sizeof(Tuple) + length); } static DictionaryResult dict_write_data_internal(DictionaryIterator *iter, const uint32_t key, const uint8_t * const data, const uint16_t data_length, const TupleType type) { if (iter == NULL || iter->dictionary == N...
dict_init(iter, buffer, length)
; if (result != DICT_OK) { return NULL; } return get_safe_cursor(iter); } Tuple * dict_read_next(DictionaryIterator *iter) { if (iter == NULL || iter->dictionary == NULL || iter->cursor == NULL) { return NULL; } iter->cursor = cursor_after_tuple_with_data_length(iter, iter->cursor->leng...
All alarm preferences are saved in the file under separate keys to simplify // backward compatibility. When a new preference is added, watches with older // firmwares won't have that preference stored and the preference-loading code // naturally falls back to setting the preference to its default. If the // preferences...
{ settings_file_close(file); mutex_unlock(s_mutex); }
// ---------------------------------------------------------------------------------------------- static ActivitySleepState prv_get_sleep_state(void) { #if CAPABILITY_HAS_HEALTH_TRACKING int32_t sleep_state; const bool rv = activity_get_metric(ActivityMetricSleepState, 1, &sleep_state); return rv ? sleep_state ...
C_CTRLBUS_REG, QSPIC_DIS_CS, 0x0); REG_SETF(QSPIC, QSPIC_CTRLBUS_REG, QSPIC_EN_CS, 0x0); REG_SETF(QSPIC, QSPIC_CTRLBUS_REG, QSPIC_SET_QUAD, 0x0); REG_SETF(QSPIC, QSPIC_CTRLBUS_REG, QSPIC_SET_DUAL, 0x0); REG_SETF(QSPIC, QSPIC_CTRLBUS_REG, QSPIC_SET_SINGLE, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_USE_3...
(GPREG, PLL_SYS_CTRL1_REG, LDO_PLL_ENABLE, 0x0)
; REG_SETF(GPREG, PLL_SYS_CTRL1_REG, PLL_EN, 0x0); REG_SETF(GPREG, PLL_SYS_CTRL2_REG, PLL_SEL_MIN_CUR_INT, 0x0); REG_SETF(GPREG, PLL_SYS_CTRL2_REG, PLL_DEL_SEL, 0x2); REG_SETF(GPREG, PLL_SYS_CTRL2_REG, PLL_N_DIV, 0x6); REG_SETF(GPREG, PLL_SYS_CTRL3_REG, PLL_RECALIB, 0x0); // GUESS REG_SETF(GPREG, PLL_SYS_...
s required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #i...
{ prv_init_no_pinnings_no_pinned_address(); cl_assert_equal_b(false, s_last_bt_persist_pinned_addr_is_null); cl_assert_equal_m(&s_last_bt_persist_pinned_addr, &TEST_PINNED_ADDR_1, sizeof(s_last_bt_persist_pinned_addr)); cl_assert_equal_b(true, s_last_driver_allow_cycling); }
void test_local_addr__init_loads_stored_pinned_address(void) { cl_will_return(bt_persistent_storage_has_pinned_ble_pairings, true); cl_will_return(bt_persistent_storage_set_ble_pinned_address, true); cl_will_return(bt_driver_set_local_address, 0); s_last_bt_persist_pinned_addr_is_null = false; s_last_bt_per...
le this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 4 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 4); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw4_no_clip...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 2); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_N...
e_otp_reset(); } void test_mfg_serials__cleanup(void) { } void test_mfg_serials__hw_version(void) { const char* hw_version; // Initially, bunch of XXs: hw_version = mfg_get_hw_version(); cl_assert(strcmp(hw_version, "XXXXXXXX") == 0); // Test writing & reading back: const char* written_hw_version1 = "AB...
mfg_get_serial_number()
; cl_assert_equal_i(index, 0); cl_assert_equal_i(r, MfgSerialsResultFailIncorrectLength); cl_assert_equal_s(sn, "XXXXXXXXXXXX"); } void test_mfg_serials__serial_numbers(void) { const char * sn; uint8_t index; MfgSerialsResult r; // Initially, return bunch of XXs: sn = mfg_get_serial_number(); cl_ass...
0}, { 304, 920, 328}, { 296, 1128, 424}, { 432, 1296, 544}, { 304, 1392, 672}, { 272, 1168, 552}, { 248, 984, 448}, { 216, 912, 408}, { 120, 816, 344}, { 128, 632, 192}, // 78 seconds { 160, 480, 112}, { 184, 416, 128}, { 192, 512, 128}, { 176, 640, 216}, { 16...
{ -1616, 40, 112}, { -1488, 32, 136}, { -1288, 40, 104}, { -1064, 24, 88}, { -1000, -56, 48}, { -712, -632, 192}, { -1120, -920, 400}, { -1000, -368, -360}, { -1800, 496, -24}, { -1880, 432, 24}, { -1840, 88, 296}, { -1856, 184, 168}, { -1632, 224, 248}, { -1384, ...
{ 32, 784, -328}, { 40, 736, -320}, { 88, 624, -224}, // 86 seconds { 224, 520, -144}, { 344, 400, -48}, { 360, 424, -16}, { 424, 336, 88}, { 496, 376, 184}, { 560, 448, 384}, { 488, 928, 192}, { 520, 768, 528}, { 760, 1592, 320}, { 528, 1336, 440}, { 432, 13...
yer = &dialog->text_layer; text_layer_init_with_parameters(text_layer, &GRect(x, y, w, h), dialog->buffer, dialog_text_font, dialog->text_color, GColorClear, text_alignment, GTextOverflowModeWordWrap); #if PBL_ROUND ...
(sizeof(WorkoutDialog))
; if (workout_dialog) { workout_dialog_init(workout_dialog, dialog_name); } return workout_dialog; } Dialog *workout_dialog_get_dialog(WorkoutDialog *workout_dialog) { return &workout_dialog->dialog; } ActionBarLayer *workout_dialog_get_action_bar(WorkoutDialog *workout_dialog) { return &workout_dialog-...
"test_bitblt__bitmap_into_bitmap_sub_bitmap-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Test: // - source origin offset // - source bounds origin and size // - wrapping into larger destination // - dest rect not at { 0, 0 } // Setup: // - Source has non-zero bounds origin, { 5, ...
(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_black_on_black-expect.1bit.pbi"))
; gbitmap_destroy(src_bitmap); } // Test: // - source origin offset // - source bounds origin and size // - Source bounds origin is beyond (32, y) to pass word boundary. // - Source origin offset is beyond (32, y) to pass another word boundary. // - wrapping into larger destination // - dest rect no...
/* * 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_layer_set_font(title, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD))
Idle app has ended if (!prv_wait_int_high(dev)) { PBL_LOG(LOG_LEVEL_ERROR, "Timed-out waiting for the Idle app to end but we " "probably just missed it"); // TODO: The line only goes high for a few ms. If there is any kind of context switch while we // wait for the line to go high we will miss...
PBL_LOG(LOG_LEVEL_ERROR, "Failed to flash firmware")
; goto cleanup; } // We need to wait for the HRM to reboot into the application before // releasing the enable GPIO. If the loader sees the GPIO released // during boot, it will activate "force loader mode" and fall back // into the loader. Since we're waiting anyway, we might as well // q...
tor__test_unprintable(void) { // Allocate mutable types Iterator word_iter = (Iterator) { 0 }; WordIterState word_iter_state = (WordIterState) { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, (char[]) { 0x10, 0x0 }); cl_assert(success); ...
cl_assert(iter_next(&word_iter))
; cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == 'o'); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.start == 'o'); cl_assert(*word_iter_state.current.end == '\n'); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ bool is_initialized; HcProtocolState state; prv_lock(); { state = s_hc_state; is_initialized = (state == HcProtoclStateIsInitialized); } prv_unlock(); if (!is_initialized) { PBL_LOG(LOG_LEVEL_WARNING, "prv_check_initialized called when hc_protocol is not initialized, " "state: %d...
static TickType_t prv_remaining_ticks(TickType_t timeout_ticks, TickType_t start_ticks) { const TickType_t now = xTaskGetTickCount(); const TickType_t elapsed = (now - start_ticks); if (timeout_ticks > elapsed) { return timeout_ticks - elapsed; } return 0; } static bool prv_still_processing_enqueues(vo...
client_id_payload); return packet; } else { // PPoGATTPacketTypeResetComplete if (prv_client_supports_enhanced_throughput_features(client)) { *packet = (const PPoGATTPacket) { .sn = 0, .type = PPoGATTPacketTypeResetComplete, }; PPoGATTResetCompleteClientIDPayloadV1 *client_id...
if (!packet) { return NULL; }
bool success = prv_sample_discovery_init(&s_accel_sample_discovery_state.common, SampleFileType_AccelSamples, "activity/step_samples"); cl_assert(success); const uint32_t k_max_tests = 1000; uint32_t num_tests = 0; // Results typedef struct { int steps; ...
("\n\ntest FAILED: %d failures, Avg weighted error: %.2f", fail_count, weighted_sum / num_tests)
; } else { printf("\n\ntest PASSED! Avg weighted error: %.2f", weighted_sum / num_tests); } cl_assert_equal_i(fail_count, 0); } // --------------------------------------------------------------------------------------- static const char *prv_status_str(bool passed) { if (!passed) { return "FAIL";...
cise(center, distance << GPOINT_PRECISE_PRECISION, angle); } static void prv_graphics_draw_centered_text(GContext *ctx, const GSize *max_size, const GPoint *center, const GFont font, const GColor color, const char *text) { GSize ...
(ctx, face->bob_color)
; graphics_fill_oval(ctx, bob_rect, GOvalScaleModeFitCircle); graphics_context_set_fill_color(ctx, face->bob_center_color); graphics_fill_oval(ctx, bob_center_rect, GOvalScaleModeFitCircle); } static void prv_draw_non_local_clock(GContext *ctx, NonLocalClockFace *clock) { // TODO: The non-local clock text is c...
state if (!data) { s_manager_state.sensor_stable = false; s_manager_state.sensor_start_ticks = 0; return false; } // Ignore the "no accel" quality reading samples. We seem to get these occasionally // and don't want them to mess up our state. if (data->hrm_quality == HRMQuality_NoAccel) { re...
(state->update_interval_s * MS_PER_SECOND)
- subscriber_age_ticks - spin_up_ticks; subscriber_remaining_ticks = MAX(0, subscriber_remaining_ticks); remaining_ticks = MIN(remaining_ticks, subscriber_remaining_ticks); } // How many milliseconds till we need to send the next sensor reading remaining_ms = ticks_to_mi...
activity sessions ASSERT_STEP_ACTIVITY_SESSION_PRESENT(&old_activity); ASSERT_STEP_ACTIVITY_SESSION_PRESENT(&new_activity); // Wait long enough for our midnight rollover to occur. We init time at 5pm, so we need to wait // for at least 7 hours. const int minutes_till_midnight = (7 * MINUTES_PER_HOUR) - ACTIV...
(value, SECONDS_PER_HOUR)
; cl_assert_equal_i(health_service_sum_today(HealthMetricActiveSeconds), SECONDS_PER_HOUR); activity_get_metric(ActivityMetricActiveKCalories, 1, &value); // The following determined from a known good commit int32_t exp_active_kcalories = 152; cl_assert_equal_i(value, exp_active_kcalories); cl_assert_equal...
ta->rectr_velocity_y * -1; } } else if (shape == CIRCLE) { // Move the line X per Y data->circle_origin.x += (data->circle_velocity_x * PIXEL_SPEED_PER_FRAME); if (data->circle_origin.x - data->circle_radius < 0 || data->circle_origin.x + data->circle_radius > data->window.layer.b...
gpath_draw_outline(ctx, data->triangle)
; } else if (shape == GPATH_OPEN_BUCKET) { gpath_draw_outline_open(ctx, data->bucket); } } } static int64_t prv_time_64(void) { time_t s; uint16_t ms; rtc_get_time_ms(&s, &ms); return (int64_t)s * 1000 + ms; } static void layer_update_proc(Layer *layer, GContext* ctx) { AppData *data = app_s...
e_collision_points(ctx, center.y.integer + i + special_line_offset_bottom, left, right, bottom_starting_edge, bottom_ending_edge, ignore_close_angles); } } } // Finish color hack ctx->draw_state.stroke_color = stroke_...
{ angle_end += TRIG_MAX_ANGLE; }
prv_fill_oval_precise(ctx, point, outer_radius_x, outer_radius_y, inner_radius_x, inner_radius_y, angle_start, angle_end); } void prv_fill_oval_quadrant(GContext *ctx, GPoint point, uint16_t outer_radius_x, uint16_t outer_radius_y, uin...
if (entry->length < resource_offset) { PBL_LOG(LOG_LEVEL_ERROR, "Resource offset past its own ending."); return 0; } else if ((resource_offset + num_bytes) > entry->length) { PBL_LOG(LOG_LEVEL_ERROR, "offset + length > resource size, truncated."); return entry->length - resource_offset; } else { ...
} static uint32_t prv_read(ResourceStoreEntry *entry, uint32_t offset, void *data, size_t num_bytes) { num_bytes = prv_check_resource_bounds(entry, offset, num_bytes); if (!num_bytes) { return 0; } return entry->impl->read(entry, offset, data, num_bytes); } static void prv_get_manifest(ResourceStoreEntry...
delay_ms, false /* repeating */, prv_window_pop_cb, NULL); } //! Window setup //! Currently only 1 call window can exist at a time static void prv_phone_ui_init(void) { PBL_ASSERTN(s_phone_ui_data == NULL); s_phone_ui_data = kernel_zalloc_check(sizeof(PhoneUIData)); s_phone_ui_data->hid_action_bar = false; ...
(&s_phone_ui_data->call_status_text_layer.layer, true)
; layer_set_clips(&s_phone_ui_data->call_status_text_layer.layer, false); layer_add_child(&s_phone_ui_data->core_ui_container, &s_phone_ui_data->call_status_text_layer.layer); // Shrink the bounds but not the frame size to allow for centering when action bar removed s_phone_ui_data->call_statu...
/* * 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...
CREATE_DMA_STREAM(2, 2)
; // DMA2_STREAM2_DEVICE - Compositor DMA CREATE_DMA_STREAM(2, 4); // DMA2_STREAM4_DEVICE - DFSDM CREATE_DMA_STREAM(2, 5); // DMA2_STREAM5_DEVICE - ICE40LP TX CREATE_DMA_STREAM(2, 7); // DMA2_STREAM7_DEVICE - QSPI // DMA Requests // - On DMA1 we have "Debug UART RX" and "Accessory UART RX". The former is never used in...
-152}, { 616, 296, -112}, { 648, 328, -104}, { 768, 432, -192}, { 1040, 480, -336}, { 1160, 464, -424}, { 1520, 528, -440}, { 1168, 696, -704}, { 1024, 624, -768}, { 1288, 448, -560}, { 1224, 272, -296}, { 872, 320, -240}, { 616, 352, -136}, { 472, 336, -16}, { 54...
{ 896, 120, 16}, { 848, 120, 24}, { 784, 104, 56}, // 13 seconds { 816, 64, 40}, { 912, 56, -24}, { 1304, 8, 40}, { 1392, 176, -224}, { 1192, 192, -400}, { 1576, 272, -448}, { 1608, 384, -264}, { 1184, 584, -160}, { 768, 448, -56}, { 696, 392, -48}, { 720, 336...
{ 800, 360, -96}, { 920, 376, -80}, { 984, 432, -104}, { 1088, 512, -152}, { 1320, 584, -184}, { 1392, 520, 0}, { 1888, 560, -80}, { 1136, 592, -120}, { 1464, 424, -32}, // 16 seconds { 1656, 368, 0}, { 1416, 168, 176}, { 1056, 32, 120}, { 896, 176, -24}, { 7...
enu_layer->animation.animation); } menu_layer->animation.animation = NULL; return result; } #define TOP_DOWN_PX 7 #define BOTTOM_DOWN_PX 10 static void prv_setup_selection_animation(MenuLayer *menu_layer, bool up) { // Move selection inverter layer: const int16_t w = menu_layer->scroll_layer.layer.frame.siz...
(menu_layer, scroll_align)
; if (scroll_align != MenuRowAlignNone) { int16_t y; const GSize frame_size = menu_layer->scroll_layer.layer.frame.size; // Scroll to the right position: switch (scroll_align) { case MenuRowAlignTop: y = - menu_layer->selection.y; break; case MenuRowAlignBottom: y...
PHA = SPI_CPHA_1Edge; spi_cfg.SPI_NSS = SPI_NSS_Soft; // APB2 is at 16MHz, max is 54MHz, so we want the smallest prescaler spi_cfg.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2; spi_cfg.SPI_FirstBit = SPI_FirstBit_MSB; spi_cfg.SPI_CRCPolynomial = 7; SPI_Init(FLASH_CONFIG.spi, &spi_cfg); SPI_Cmd(FLASH_C...
{ if (!buffer_size) { return; } prv_enable_flash_spi_clock(); prv_flash_wait_for_write(); prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ); prv_flash_send_24b_address(start_addr); while (buffer_size--) { *buffer = prv_flash_read_next_byte(); buffer++; } prv_fla...
AppMessageHeader *message = (AppMessageHeader *) data; switch (message->command) { case CMD_PUSH: // Incoming message: app_message_inbox_receive(session, (AppMessagePush *) message, length, consumer_info); return; case CMD_REQUEST: // Incoming request for an update push: // TO...
if (prv_supports_8k()) { // New behavior, allow up to one large 8K byte array per message: return (APP_MSG_8K_DICT_SIZE); } else { // Legacy behavior: if (sys_get_current_app_is_js_allowed()) { return (COMM_PRIVATE_MAX_INBOUND_PAYLOAD_SIZE - APP_MSG_HDR_OVRHD_SIZE); } else { return (CO...
/* * 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(second, 5)
--------------------------------------------------------------------------- // Filter callbacks used by stats_calculate_basic() bool health_service_private_non_zero_filter(int index, int32_t value, void *context) { return (index > 0 && value > 0); } bool health_service_private_weekday_filter(int index, int32_t value...
if (daily_history.totals[time_range.last_day_idx + i] >= 0) { return HealthServiceAccessibilityMaskAvailable; }
} return HealthServiceAccessibilityMaskNotAvailable; #endif } // ---------------------------------------------------------------------------------------------- HealthValue health_service_sum_today(HealthMetric metric) { #if !CAPABILITY_HAS_HEALTH_TRACKING return 0; #else const time_t today_midnight = sys_ti...
prv_get_adjusted_gpoint_precise_from_gpoint(segment->points[2])
; GPointPrecise p3 = prv_get_adjusted_gpoint_precise_from_gpoint(segment->points[3]); if (segment->type == HealthProgressSegmentType_Vertical) { graphics_line_draw_precise_stroked(ctx, p0, p3); graphics_line_draw_precise_stroked(ctx, p1, p2); } else if (segment->type == HealthProgressSegmentTyp...
eap, DoubleFreeHandler double_free_handler) { heap->double_free_handler = double_free_handler; } void heap_set_corruption_handler(Heap *heap, CorruptionHandler corruption_handler) { heap->corruption_handler = corruption_handler; } void *heap_malloc(Heap* const heap, unsigned long nbytes, uintptr_t client_pc) { ...
get_next_block(heap, heap_info_ptr)
; /* If we are pointing at the end of the heap, then use the */ /* begin as the next segment. */ if(next_block == heap->end) { /* We can't combine the begin with the end, so just */ /* update the PrevSize field. */ heap->begi...
/* * 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...
(atoi(" -573888"), -573888)
; cl_assert_equal_i(atoi(" +713713"), +713713); } void test_atoi__error(void) { cl_assert_equal_i(atoi("2147483647"), 2147483647); // last valid value cl_assert_equal_i(atoi("4294967287"), (int)4294967287); // signed integer overflow // ((2147483648 * 10) + 1) & 0xFFFFFFFF cl_assert_equal_i(atoi("2147483648...
essions[i + 1], remaining * sizeof(*sessions)); (*session_entries)--; num_sessions_to_clear++; i--; } // Zero out unused sessions at end. This is important because when we re-init from stored // settings, we detect the number of sessions we have by checking for non-zero ones memset(&sessions[*sessi...
{ state->activity_sessions[i] = *session; goto unlock; }
} // If no more room, fail if (state->activity_sessions_count >= ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT) { PBL_LOG(LOG_LEVEL_WARNING, "No more room for additional activities"); goto unlock; } // Add this activity in PBL_LOG(LOG_LEVEL_INFO, "Adding activity session %d, start_time: %"...
/ process_manager_force_close_syscall_exit_trap to check whether // it is about to return control to a misbehaving app. This // function checks the process context's closing state and makes // the process safe to kill if its state is set to ForceClosing. // All we have to do is set the state and...
event_service_clear_process_subscriptions(task)
; #if CAPABILITY_HAS_BUILTIN_HRM hrm_manager_process_cleanup(task, context->install_id); #endif #ifndef RECOVERY_FW #if CAPABILITY_HAS_MICROPHONE voice_kill_app_session(task); #endif dls_inactivate_sessions(task); if (task == PebbleTask_App) { #if CAPABILITY_HAS_ACCESSORY_CONNECTOR smartstrap_attribute_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...
(false /* run filesystem check */)
; pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); co...
_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to the kernel to push a modal window stub_pebble_tasks_set_current(PebbleTask_KernelMain); window_stack_push(modal_stack, window2, true); cl_assert_equal_i(window_stack_count(modal_stack), 1); cl_ass...
(window2, true)
; cl_assert_equal_i(window_stack_count(modal_stack), 0); cl_assert_equal_i(window2->on_screen, false); // Switch to app happens via the compositor compositor_transition(NULL); // Call the upkeep function so the change in state is handled modal_manager_event_loop_upkeep(); // The app is unobstructed, it...
/* * 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...
fake_spi_flash_cleanup()
; } void test_snowy_mfg_info__color(void) { cl_assert_equal_i(mfg_info_get_watch_color(), 0); mfg_info_set_watch_color(WATCH_INFO_COLOR_RED); cl_assert_equal_i(mfg_info_get_watch_color(), WATCH_INFO_COLOR_RED); mfg_info_set_watch_color(WATCH_INFO_COLOR_GREEN); cl_assert_equal_i(mfg_info_get_watch_color(), ...
"_rocky.on('postmessagedisconnected', function() { isCalled = true; });"); ASSERT_JS_GLOBAL_EQUALS_B("isCalled", false); RCV_RESET_COMPLETE(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteLocalInitiated); EXPECT_OUTBOX_RESET_REQUEST(); ASSER...
jerry_value_is_object(object)
); JS_VAR x = jerry_get_object_field(object, "x"); cl_assert(jerry_value_is_number(x)); cl_assert_equal_d(jerry_get_number_value(x), 42.0); } void test_rocky_api_app_message__json_parse_stress(void) { const int num_attempts = 0x3ff + 10; // Want this to be higher than the max refcount, ...
t)); PBL_ASSERTN(s_kernel_event_queue != NULL); s_from_app_event_queue = xQueueCreate(MAX_FROM_APP_EVENTS , sizeof(PebbleEvent)); PBL_ASSERTN(s_from_app_event_queue != NULL); s_from_worker_event_queue = xQueueCreate(MAX_FROM_WORKER_EVENTS , sizeof(PebbleEvent)); PBL_ASSERTN(s_from_worker_event_queue != NULL...
{ return prv_event_put(s_kernel_event_queue, "kernel", saved_lr, event); }
} bool event_put_isr(PebbleEvent* event) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return prv_event_put_isr(s_kernel_event_queue, "kernel", saved_lr, event); } void event_put_from_process(PebbleTask task, PebbleEvent* event) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr;...
; #endif } static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) { WorkoutSelectionWindow *selection_window = (WorkoutSelectionWindow *)context; ActivitySessionType activity_type = prv_get_activity_type(cell_index->row); ...
{ WorkoutSelectionWindow *selection_window = app_zalloc_check(sizeof(WorkoutSelectionWindow)); selection_window->select_workout_cb = select_workout_cb; Window *window = &selection_window->window; window_init(window, WINDOW_NAME("Workout Selection")); window_set_user_data(window, selection_window); window_...
cl_assert_equal_gpoint(origin, GPoint(40, 60))
; // containers's absolute coordinate cl_assert_equal_gpoint(page.origin, GPoint(30, 40)); cl_assert_equal_gsize(page.size, GSize(100, 10)); } void test_text_layer_flow__no_overflow_on_default_page_height(void) { // first, make sure that grect_max_y itself overflows cl_assert(grect_get_max_y(&(GRect){.origin...
XME PBL-22272. We back convert this value in // settings_display.c:prv_get_scaled_brightness() We should really just store // the percent intensity or a setting level name and leave it up to the light // module to do the conversion static uint16_t prv_convert_backlight_percent_to_intensity(uint32_t percent_intensity) {...
if (rv != S_SUCCESS) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to set pref '%s' (%"PRIi32")", entry->key, (int32_t)rv); }
settings_file_close(&file); } } mutex_unlock(s_mutex); return (rv == S_SUCCESS); } // ------------------------------------------------------------------------------------ // Convenience function used to update the state AND set the backing for a pref. This is // used by the functions below that are c...
/* * 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...
(!list_contains(buffer->clients, &client->list_node))
; buffer->clients = list_prepend(buffer->clients, &client->list_node); client->read_index = buffer->write_index; return true; } // ------------------------------------------------------------------------------------------------- void shared_circular_buffer_remove_client(SharedCircularBuffer* buffer, SharedCircu...
ore; activity_get_metric(ActivityMetricStepCount, 1, &before); // Walk 30 steps activity_test_feed_samples(s_walk_30_steps, ARRAY_LENGTH(s_walk_30_steps)); // Check new step count int32_t steps; steps = health_service_sum_today(HealthMetricStepCount); steps -= before; PBL_LOG(LOG_LEVEL_DEBUG, "steps:...
{ passed = false; }
if ((deep_sleep < k_min_deep_sleep_min * SECONDS_PER_MINUTE) || (deep_sleep > k_max_deep_sleep_min * SECONDS_PER_MINUTE)) { passed = false; } // Check other sleep metrics activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "entry minute: %d", (int)(value / S...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ gpio_af_init(&dev->tx_gpio, otype, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); }
if (dev->rx_gpio.gpio) { // half-duplex should only define a TX pin PBL_ASSERTN(!dev->half_duplex); gpio_af_init(&dev->rx_gpio, otype, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); } // clear any lingering errors prv_clear_all_errors(dev); // configure the UART peripheral control registers // - 8-bit ...
ormIdentity(); t2 = GTransformIdentity(); t_c = GTransformIdentity(); gtransform_concat(&t_new, &t1, &t2); cl_assert(gtransform_is_equal(&t_new, &t_c)); // Test identity concatenation with non-identity t1 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t2 = GTransformIdentity(); t_c = GTransformFromNumbers...
cl_assert(gtransform_is_equal(&t1, &t_c))
; }
/* * 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...
{ unsigned char *p = (unsigned char*)s; while (n--) { *p++ = (unsigned char)c; } return s; }
#endif
overrides)); s_prv_activity_cb__call_count = 0; s_prv_activity_cb__false_at_call_no = UINT32_MAX; s_sys_activity_get_minute_history_values = (sys_activity_get_minute_history_values) { // as all these values need to be configured in the test, we assert per default .out[0].asserts = true, }; s_activit...
prv_calculate_time_range(now - SECONDS_PER_DAY, now, &range)
; cl_assert(result); cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 0, .num_days = 2, .seconds_first_day = 53258 - utc_to_local_delta, .seconds_last_day = 33142 + utc_to_local_delta, .seconds_total_last_day = 33142 + utc_to_local_delta, })); } void test_health__range_...
rogress progress = ANIMATION_NORMALIZED_MAX / 2; unobstructed_area_service_change(area.size.h, to_area.size.h, progress); fake_event_service_handle_last(); cl_assert_equal_i(s_data.num_change_calls, 1); cl_assert_equal_i(s_data.last_change_progress, progress); } void test_unobstructed_area_service__change_afte...
(app_state_get_unobstructed_area_state()->handlers.did_change, prv_did_change)
; const GRect to_area = GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_did_change(to_area.size.h); fake_event_service_handle_last(); cl_assert_equal_i(s_data.num_will_change_calls, 1); cl_assert_equal_i(s_data.num_did_change_calls, 1); } void test_unobstructed_area_service__layer_no_clip(void) { a...
/* * 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...
FLASH_Lock()
; return true; } bool system_flash_write(uint32_t address, const void *data, size_t length) { // enable programming of flash FLASH_Unlock(); // clear errors FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR); ...
item_id; } const bool is_all_day_event_visible = (update->today_has_all_day_event && !update->today_timed_event_passed); const bool is_first_event = (item_id && uuid_equal(item_id, &update->first_header.common.id)); PebbleEvent event = { .type = PEBBLE_TIMELINE_PEEK_EVENT, .timeline_peek = { ...
if (old_is_peeking && (new_is_persistent != old_is_persistent)) { // When both items are peeking, items that are not persistent take priority return (new_is_persistent ? 1 : 0) - (old_is_persistent ? 1 : 0); } else { // When both items are peeking, newer items take priority (larger timestamp first) //...
} static uint32_t prv_calc_timeout(CommonTimelineItemHeader *item, TimelinePeekTimeType *time_type_out) { if (item == NULL) { goto none; } TimelinePeekTimeType time_type; const time_t now = rtc_get_time(); const time_t start = item->timestamp; const unsigned int durat...
_menu_index, MenuRowAlignCenter, false); } static void prv_handle_alarm_editor_complete(AlarmEditorResult result, AlarmId id, void *callback_context) { AlarmsAppData *data = (AlarmsAppData *)callback_context; if (result == CANCELLED && ...
{ // "add alarm" cell highlighted new_bitmap_resource = RESOURCE_ID_PLUS_ICON_DOTTED; }
} else { // "add alarm" cell not highlighted // Have to manually override the tint color as we're using a color that differs // from the ones the MenuLayer uses. graphics_context_set_tint_color(ctx, GColorLightGray); } } if (new_bitmap_resource != data->current_plus_icon_re...
ent == &parent); // Remove first-child (child_a): // // +-parent // | // '->child_c // // +-child_a // | // '->grand_child_a // layer_remove_from_parent(&child_a); cl_assert(parent.first_child == &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_a.parent =...
ARRAY_LENGTH(stack)
, &current_stack, true); cl_assert_equal_p(aaa, actual); cl_assert_equal_i(2, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); cl_assert_equal_p(aaa, stack[2]); // go to child if possible actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &curre...
/* * 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 (cached_resource == NULL) { cached_resource = kernel_malloc_check(sizeof(CachedResource)); *cached_resource = (CachedResource){}; cached_resource->id = resource_id; s_resource_list = (CachedResource *)list_prepend((ListNode *)s_resource_list, (ListNode *)cached_resource); }
cached_resource->stored_resource = res; mutex_unlock_recursive(s_resource_mutex); return resource_id; } size_t resource_load_byte_range_system(ResAppNum app_num, uint32_t resource_id, uint32_t offset, uint8_t *buffer, size_t num_bytes) { PBL_ASSERTN(buffer); if (!num_bytes) { return 0; } mute...
am >> 16) & 0xff); prv_send_command_arg((param >> 24) & 0xff); prv_end_command(); } static uint8_t prv_read_version(void) { GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET); delay_us(100); uint8_t version_num = display_write_and_read_byte(0); GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET); return vers...
if (bar_fill != last_bar_fill) { last_bar_fill = bar_fill; prv_set_parameter(bar_fill); prv_draw_scene(SCENE_UPDATE); }
} void display_error_code(uint32_t error_code) { prv_set_parameter(error_code); prv_draw_scene(SCENE_ERROR); } void display_prepare_for_reset(void) { prv_screen_off(); }
/* * 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...
(ANALYTICS_DEVICE_METRIC_BT_OFF_TIME)
ll_fn(ctx, cell_layer, cd, is_selected, item->arg1, item->arg2); } static uint16_t prv_certification_get_num_rows_callback(MenuLayer *menu_layer, uint16_t section_index, void *context) { SettingsSystemData...
if (flags->has_japan_telec_t) { prv_append_certification_menu(cd, &(SystemCertificationMenuItem) { .draw_cell_fn = prv_draw_rt_cell, .arg1 = &cd->t_mark, .arg2 = prv_get_japan_telec_t_id() }); }
// Create the menu MenuLayer *menu_layer = &data->menu_layer; GRect bounds = data->window.layer.bounds; const GEdgeInsets menu_layer_insets = (GEdgeInsets) { .top = STATUS_BAR_LAYER_HEIGHT, .bottom = PBL_IF_RECT_ELSE(0, STATUS_BAR_LAYER_HEIGHT) }; bounds = grect_inset(bounds, menu_layer_insets); ...
}; } return custom_node; } static void prv_destroy_text_node_base(GTextNode *node) { if (node && node->free_on_destroy) { task_free(node); } } static bool prv_destroy_container_iter(GTextNode *node, void *context) { graphics_text_node_destroy(node); return true; } static void prv_destroy_text_node...
prv_container(ctx->node)
->get_axis_align(ctx->node); graphics_text_node_get_size(ctx->node, ctx->gcontext, ctx->draw_box, ctx->config, &max_used_size); const int16_t excess_length = ToGValue(&ctx->box.size)[axis] - ToGValue(&max_used_size)[axis]; if (align == GAxisAlign_Center) { ToGValue(&ctx->box.origin)[axis] += excess_length / 2...
m_data, }; event_service_client_subscribe(&s_ble_hrm_session.service_info); s_ble_hrm_session.manager_session = hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1 /*update_interval_s*/, 0 /*expire_s*/, HRMFeature_BPM, NULL, NULL); analytics_stopwatch_start...
(connection, prev_is_sharing)
; } static void prv_disconnect_to_kill_subscription(GAPLEConnection *connection) { // Unfortunately, GATT does not offer a way to remove a subscription from the server side. // Only clients (subscribers) themselves can change the subscription state (write the CCCD). // When stopping sharing, we're disconnecting ...
ETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_REG, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_BROWN_OUT_IRQ_CLEAR, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18P_TIMEOUT_IRQ_CLEAR, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_VDD_TIMEOUT_IRQ_CLEAR, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18_TIMEOUT_IRQ_C...
(QSPIC, QSPIC_ERASECMDA_REG, QSPIC_RES_INST, 0x0)
; REG_SETF(QSPIC, QSPIC_ERASECMDA_REG, QSPIC_SUS_INST, 0x0); REG_SETF(QSPIC, QSPIC_ERASECMDA_REG, QSPIC_WEN_INST, 0x0); REG_SETF(QSPIC, QSPIC_ERASECMDA_REG, QSPIC_ERS_INST, 0x0); REG_SETF(QSPIC, QSPIC_ERASECMDB_REG, QSPIC_RESSUS_DLY, 0x0); REG_SETF(QSPIC, QSPIC_ERASECMDB_REG, QSPIC_ERSRES_HLD, 0x0); REG_SE...
/* * 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, "test_file_set_get_one", 4096)
); uint8_t key[4]; int key_len = sizeof(key) - 1; memcpy(key, "key", sizeof(key)); uint8_t val[4]; int val_len = sizeof(val) - 1; memcpy(val, "val", sizeof(val)); set_and_verify(&file, key, key_len, val, val_len); } void test_settings_file__set_get_one_many_times(void) { printf("\nTesting setting and ...
if (payload && length) { checksum = crc32(checksum, payload, length); } prv_encode_and_send_data(&checksum, sizeof(checksum)); accessory_send_byte(HDLC_FLAG); accessory_enable_input(); } // Request processing //////////////////////////////////////////////////////////////////// static void prv_erase_co...
PBL_LOG(LOG_LEVEL_ERROR, "Invalid region (%"PRIu8")", request->region)
; } prv_send_frame(OPCODE_FLASH_GEOMETRY, &response, sizeof(response)); } static void prv_handle_flash_erase_request(const void *payload, uint32_t length) { if (length != sizeof(FlashEraseRequest)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } const FlashEraseRequest *r...
" #include "system/passert.h" #include "util/bitset.h" #include "util/graphics.h" #include "util/size.h" #define MAX_SUPPORTED_PALETTE_ENTRIES 4 // stores transparent masks + color patterns for even+odd scanlines typedef struct { // true, if color entry will be visible on 1bit, false otherwise bool transparent_ma...
(&look_ups, compositing_mode, palette, src_palette_size, tint_color)
; while (dest_y < dest_y_end) { if (src_y >= src_end_y) { src_y = src_begin_y; } uint8_t dest_shift = dest_shift_at_line_begin; RowLookUp look_up = look_ups[dest_y % 2]; int16_t src_x = src_begin_x + src_origin_offset.x; uint8_t row_bits_left = dest_rect.size.w; uint32_t *dest_blo...
/* * 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 we aren't going to move the modal, just bail return; }
// Start from the bottom of the display (last row index) and copy rows from above to the // current line. If we did this the other way, we would lose data from the framebuffer. // This produces a sliding down effect. const uint32_t start_row = DISP_ROWS_LAST_INDEX; const uint32_t end_row = new_modal_offset_...
s; bool success; pebble_pipeline_Event event = { .uuid = { .funcs.decode = prv_decode_uuid, .arg = &decoder_info->event_uuids[event_idx], }, }; success = pb_decode(stream, pebble_pipeline_Event_fields, &event); if (event.type == pebble_pipeline_Event_Type_ActivitySessionEvent) { prot...
{ pb_istream_t stream = pb_istream_from_buffer(encoded_buf, encoded_buf_size); const uint32_t max_num_types = *num_types; const uint32_t max_num_values = *num_values; const uint32_t max_num_samples = *num_samples; *num_values = 0; *num_samples = 0; *num_types = 0; PLogTypesDecoderArg types_decoder_ar...
*payload_send_time = payload.send_time_utc; if (payload.sender.has_version && payload_sender_v_major && payload_sender_v_minor) { *payload_sender_v_major = payload.sender.version.major; *payload_sender_v_minor = payload.sender.version.minor; } *type = ProtobufLogType_Measurements; return success; } ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return false; }
typedef enum { CmdInit = 0x01, CmdPut = 0x02, CmdCommit = 0x03, CmdAbort = 0x04, CmdInstall = 0x05, CmdInvalid = 0xff, } Cmd; typedef enum { ResponseAck = 0x01, ResponseNack = 0x02, } Response; // Send an INIT message typedef struct PACKED { Cmd cmd:8; uint32_t total_size; PutBytesObjectType t...
; // Offsets for mirroring of scanline (they differ for even and odd height of the circle) int special_line_offset_top = 1; int special_line_offset_bottom = 1; // Color hack const GColor stroke_color = ctx->draw_state.stroke_color; ctx->draw_state.stroke_color = ctx->draw_state.fill_color; // In case o...
{ // Separate min/max offsets for angles masking for lines drawn above and below center point int16_t top_starting_edge = center.x.raw_value - radius_outer_x.raw_value; int16_t top_ending_edge = center.x.raw_value + radius_outer_x.raw_value; int16_t bottom_starting_edge = top_starting_edge; int16_t ...
prv_draw_scanline_collision_points(ctx, center.y.integer - i - special_line_offset_top, left, inner_left, top_starting_edge, top_ending_edge, ignore_close_angles); prv_draw_scanline_collision_points(ctx, center.y.inte...
/* * 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...
wakeup_handler(e->wakeup.wakeup_info.wakeup_id, e->wakeup.wakeup_info.wakeup_reason)
; } } void app_wakeup_service_subscribe(WakeupHandler handler) { if (handler) { app_state_set_wakeup_handler(handler); // Subscribe to PEBBLE_WAKEUP_EVENT EventServiceInfo *wakeup_event_info = app_state_get_wakeup_event_info(); // NOTE: the individual fields of wakeup_event_info are assigned to ...
tion); } } if (data->to_reel) { // We want to make sure the transform duration is at least as long as the to_reel duration // so that the resource transition runs to completion if it's animated const uint32_t to_duration = kino_reel_get_duration(data->to_reel); duration = MAX(duration, to_durat...
(data, source_list)
; offset = gpoint_to_local_coordinates(GPointZero, ctx); if (!list) { // There is no list with global coordinates embedded. Instead, interpolate the offset. gpoint_add_eq(&offset, prv_get_interpolated_origin(data)); } prv_draw_reel_or_command_list_processed(ctx, reel, list, offset, processor); } static...
/* * 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...
("500hurf")
, 500); cl_assert_equal_i(atoi("765berserker"), 765); cl_assert_equal_i(atoi("573888 redmage"), 573888); cl_assert_equal_i(atoi("713713 4 job fiesta111"), 713713); } void test_atoi__sign(void) { cl_assert_equal_i(atoi("+500"), 500); cl_assert_equal_i(atoi("-765"), -765); cl_assert_equal_i(atoi(" -573888"...
/* * 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...
{ evented_timer_reset(); }
void test_evented_timer__simple(void) { EventedTimerID e_timer = evented_timer_register(100, false, stub_evented_timer_callback, 0); // NOTE: We are leveraging the fact that we know the system timer ID is the same as the // EventedTimer ID TimerID sys_timer_id = e_timer; cl_assert(stub_new_timer_is_schedul...
's the last thing we see before exiting app_simple_dialog_push(confirmation_dialog); } static void prv_dialog_click_config(void *context) { NotificationsData *data = app_state_get_user_data(); window_single_click_subscribe(BUTTON_ID_SELECT, prv_confirmed_handler); window_set_click_context(BUTTON_ID_SELECT, da...
system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle)
; const GFont subtitle_font = system_theme_get_font_for_default_size(TextStyleFont_Caption); menu_cell_basic_draw_custom(ctx, cell_layer, title_font, title, NULL /* value_font */, NULL /* value */, subtitle_font, subtitle, NULL /* icon */, false /* icon_on...
ic void prv_cell_item_content_draw_rect(GContext *ctx, const Layer *cell_layer, const ActionMenuLayer *aml, const ActionMenuItem *item, bool selected, GRect *content_box) { char *indicator = NULL; const int16_t horizontal_paddin...
graphics_draw_text(ctx, item->label, font, text_box, overflow_mode, text_alignment, NULL)
; } static int16_t prv_get_indicator_height(const ActionMenuLayer *aml) { // This magic factor is an approximation of the indicator height in relation to the font line // height; it Just Works(tm) return fonts_get_font_height(aml->layout_cache.font) * 40 / 100; } static void prv_draw_indicator_round(GContext *c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return shell_prefs_get_units_distance(); }
layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_nx_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_y_o...
(ctx, GPoint(p.x + 6, p.y + 2))
; graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 2, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y ...
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 <stdbool.h> #include <stdint.h> #include "board/board.h" #include "drivers/flash.h" #includ...
{ return true; }
else { return false; } } void flash_init(void) { prv_enable_qspi_clock(); // init GPIOs for (unsigned i = 0; i < QSpiPinCount; ++i) { gpio_af_init(&BOARD_CONFIG_FLASH_PINS[i], GPIO_OType_PP, GPIO_Speed_100MHz, GPIO_PuPd_NOPULL); } // Init QSPI peripheral QSPI_InitTypeDef qspi_config; QSPI_Str...
MM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMM...
(window, &(WindowHandlers) { .load = prv_dialog_load, .unload = prv_dialog_unload, .appear = prv_dialog_appear, })
; window_set_user_data(window, new_dialog); dialog_push(new_dialog, stack); } #endif static char s_text_test_str[1024]; static void prv_perftest_test_main(void *data) { profiler_init(); GFont font = fonts_get_system_font(s_perftest_text_arguments.font_key); int text_index; int font_index; if (strcmp(s_...
%"PRIu32"", length); return; } prv_handle_wb_write_response(data, length); } static void prv_handle_sync_done_response(CommSession *session, const uint8_t *data, uint32_t length) { if (length < SYNC_DONE_RESPONSE_LENGTH) { ...
comm_session_send_buffer_end_write(sb)
; } return writeback_metadata.token; } BlobDBToken blob_db_endpoint_send_write(BlobDBId db_id, time_t last_updated, const void *key, int key_len, const vo...
(lookup, (i * num_points_per_group), group_delay_amount)
; } } //////////////////// // segmented scale: index based segmentation of scale + transform static int16_t prv_int_scale_to( int16_t value, int16_t size, int16_t from_range, int16_t to_range, int32_t normalized, InterpolateInt64Function interpolate) { return value + ((int32_t) value * interpolate( ...
L_IF_COLOR_ELSE(GColorLightGray, GColorWhite); } // Create the icon KinoReel *icon_reel = kino_reel_create_with_resource(icon_res_id); if (!icon_reel) { PBL_CROAK("Couldn't create kino reel"); } // Position the icon kino_area = GRect(icon_x_offset, icon_y_offset, data->launch_app_window.layer.bounds...
(&data->name_text_layer.layer, &frame)
/* * 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(tail == &c)
; cl_assert(list_get_prev(&a) == NULL); cl_assert(list_get_next(&a) == &b); cl_assert(list_get_prev(&b) == &a); cl_assert(list_get_next(&b) == &c); cl_assert(list_get_prev(&c) == &b); cl_assert(list_get_next(&c) == NULL); } void test_list__prepend(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, ...
_STOP) typedef union PACKED TIMINGR { struct { int32_t SCLL:8; int32_t SCLH:8; int32_t SDADEL:4; int32_t SCLDEL:4; int32_t reserved:4; int32_t PRESC:4; }; int32_t reg; } TIMINGR; static void prv_i2c_deinit(I2CBus *bus) { // Reset the clock to the peripheral RCC_APB1PeriphResetCmd(bus...
{ // Disable all interrupts on the bus prv_disable_all_interrupts(bus); // Generate a stop condition bus->hal->i2c->CR2 |= I2C_CR2_STOP; }
void i2c_hal_init_transfer(I2CBus *bus) { I2CTransfer *transfer = &bus->state->transfer; if (transfer->type == I2CTransferType_SendRegisterAddress) { transfer->state = I2CTransferState_WriteRegAddress; } else { if (transfer->direction == I2CTransferDirection_Read) { transfer->state = I2CTransferS...
{ -496, 240, 64}, { -544, 232, 104}, { -552, 272, 64}, { -560, 320, 64}, { -904, 368, 16}, { -1016, 472, -72}, { -1168, 416, 24}, { -1408, 360, 56}, { -1312, 488, -176}, { -952, 488, -184}, { -760, 560, -304}, { -576, 424, -304}, { -480, 264, -192}, { -432, 288, -1...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-05 15:50:49 local AccelRawData *activity_sample_walk_100_pbl_25655_6(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25655_6 //> TEST...
_item->window; bool is_app_window = window_manager_is_app_window(pop_item_window); PBL_LOG(LOG_LEVEL_DEBUG, "(-) %s=%p <%s>", is_app_window ? "window" : "modal window", pop_item_window, window_get_debug_name(pop_item_window)); // Only animate if the window was previously at the top of the stack and there's...
{ // We manually remove each item to ensure that we do not call prv_remove_unloaded_windows // until we have cleaned up the list. This prevents us from running into the issue where // an unload handler pushes a window onto the stack, but that window is subsequently // popped from the stack on another i...
while (true); window_stack_pop(window_stack, animated); } bool window_stack_remove(Window *window, bool animated) { if (window == NULL) { return false; } WindowStackItem *item = prv_find_window_stack_item_for_window(window->parent_window_stack, window); if (item == NULL) { return false; } ...
plane_eq[0] = v_ab[1] * v_ac[2] - v_ab[2] * v_ac[1]; plane_eq[1] = -v_ab[0] * v_ac[2] + v_ab[2] * v_ac[0]; plane_eq[2] = v_ab[0] * v_ac[1] - v_ab[1] * v_ac[0]; // solve for d plane_eq[3] = -(plane_eq[0] * s_samples[0][0] + plane_eq[1] * s_samples[0][1] + plane_eq[2] * s_samples[0][2]); // Distance^2...
if (!pt_to_line_dist_under_thresh(0, 1, 2, thresh)) { return (MagCalStatusNoSolution); }
} else if (s_sample_idx == 3) { if (!pt_to_plane_dist_under_thresh(0, 1, 2, 3, thresh)) { return (MagCalStatusNoSolution); } } // the sample has passed its distance threshold check so add it PBL_LOG(LOG_LEVEL_DEBUG, "---> [%d] Adding %d %d %d \n", s_sample_idx, (int)sample[0], (int)sample[...
_ERROR_OK); if (!ppogatt_emulated_server_wa_enabled(evt->conn_idx)) { return; } BTDeviceInternal addr; Connection *conn = connection_by_idx_check(evt->conn_idx); if ((evt->handle == s_ppogatt_ctx.att_hdl.data) || (evt->handle == s_ppogatt_ctx.att_hdl.data_wr)) { // Pretend the write request is...
ppogatt_emulated_server_wa_enabled(conn_idx)
) { return false; } HcGattHdr *hdr = (HcGattHdr *)&msg->payload[0]; uint16_t att_hdl = (msg->command_id == HcMessageID_Gatt_Read) ? ((HcGattReadData *)hdr)->att_handle : ((HcGattWriteData *)hdr)->att_handle; if (att_hdl < EMULATED_PPOGATT_SERVICE_HDL) { goto unhandled; } uint8_t offset = att...
/* * 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...
gbitmap_create_blank(s10, GBitmapFormat1BitPalette)
; cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat2BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap...
; } // API Functions //////////////////////////////////////////////////////////////////////////////////////////////////// HealthData *health_data_create(void) { return (HealthData *)app_zalloc_check(sizeof(HealthData)); } void health_data_destroy(HealthData *health_data) { app_free(health_data); } void health_...
health_data_update_step_derived_metrics(health_data)
; } void health_data_update_sleep(HealthData *health_data, uint32_t new_sleep, uint32_t new_deep_sleep) { health_data->sleep_data[0] = new_sleep; health_data->deep_sleep = new_deep_sleep; } void health_data_update_current_bpm(HealthData *health_data) { health_data->resting_hr_bpm =...
/* * 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(mbuf_is_flag_set(m, MBUF_FLAG_IS_MANAGED))
; PBL_ASSERTN(mbuf_is_flag_set(m, MBUF_FLAG_IS_FREE)); PBL_ASSERTN(!mbuf_get_data(s_free_list)); PBL_ASSERTN(mbuf_get_length(m) == 0); m = mbuf_get_next(m); } } MBuf *mbuf_get(void *data, uint32_t length, MBufPool pool) { PBL_ASSERTN(pool < NumMBufPools); MBuf *m; mutex_lock(s_free_list_lock); ...
_db/pin_db.h" #include "services/normal/timeline/attribute.h" #include "services/normal/timeline/item.h" #include "services/normal/timeline/timeline.h" // Fixture //////////////////////////////////////////////////////////////// // Fakes //////////////////////////////////////////////////////////////// #include "fake_r...
(&item->attr_list, AttributeIdTitle, "none")