prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ec->base.steps >= ACTIVITY_ACTIVE_MINUTE_MIN_STEPS) ? 1 : 0; // Fill in resting calories, active calories, and distance covered in the previous minute const uint32_t resting_calories = activity_metrics_prv_get_resting_calories(); m_rec->resting_calories = resting_calories - s_alg_state->prev_resting_calories; ...
{ return false; }
s_alg_state->steps = activity_metrics_prv_get_steps(); s_alg_state->prev_active_calories = activity_metrics_prv_get_active_calories(); s_alg_state->prev_resting_calories = activity_metrics_prv_get_resting_calories(); s_alg_state->prev_distance_mm = activity_metrics_prv_get_distance_mm(); prv_unlock(); retu...
/* * 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...
update("abcd", 4)
; update("efgh", 4); assert_checksum(0x18c4859c); } void test_legacy_checksum__split_word(void) { update("123", 3); update("4", 1); assert_checksum(0xc2091428); } void test_legacy_checksum__finish_with_partial(void) { update("1234", 4); update("5", 1); assert_checksum(0xec5baa37); } void test_legacy_...
ck is assumed to be taken before calling this function. static void prv_apply_fuction_to_intents_matching_connection(const GAPLEConnection *connection, IntentApply fp, void *data) { GAPLEConnectionIntent *intent = s_intents; while (intent) { GAPLEConn...
("Stopping connecting...")
kout->current_bpm_timestamp_ts = time_get_uptime_seconds(); // FIXME: This probably doesn't need to be on a timer. We can just flush out a new time on each // API function call s_workout_data.second_timer = (RegularTimerInfo) { .cb = prv_workout_timer_cb, }; // Initialize all of our initial v...
PBL_LOG(LOG_LEVEL_INFO, "Stopping a workout with type: %d", s_workout_data.current_workout->type)
; prv_put_event(PebbleWorkoutEvent_Stopped); kernel_free(s_workout_data.current_workout); s_workout_data.current_workout = NULL; } unlock: prv_unlock(); return rv; } // --------------------------------------------------------------------------------------- bool workout_service_is_workout_ongoing(voi...
s_state.out.app_msg_retry_timer != EVENTED_TIMER_INVALID_ID); } static void prv_outbox_try_send_next(void) { if (prv_is_outbox_busy()) { return; } // Send out the next message. Prioritize control messages over chunk messages: if (s_state.out.control_msg_queue) { prv_control_message_queue_send_hea...
{ PBL_ASSERTN(s_state.state == PostMessageStateAwaitingResetCompleteRemoteInitiated || s_state.state == PostMessageStateAwaitingResetCompleteLocalInitiated); const PostMessageUnsupportedErrorPayload error_payload = { .error_code = error, }; prv_control_message_queue_add(PostMessageKeyUnsuppor...
//////////////////////////////////////////////////////////////////////////////// // Session Open //////////////////////////////////////////////////////////////////////////////// static void prv_emit_post_message_connection_event(bool is_connected) { const char *event_type = is_connected ? ROCKY_EVENT_CONNECTED : R...
.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the Li...
{ if (!vers_info) { // We expect version info PBL_LOG(LOG_LEVEL_WARNING, "Le Disconnect but no version info?"); } else { analytics_event_bt_le_disconnection(reason, vers_info->version_number, vers_info->company_identifier, ...
num_events_logged++; } void bluetooth_analytics_handle_connect( const BTDeviceInternal *peer_addr, const BleConnectionParams *conn_params) { analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_COUNT, AnalyticsClient_System); analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_TIME, AnalyticsClient...
S32_16_ONE; num2 = FIXED_S32_16_ONE; sum = Fixed_S32_16_add(num1, num2); sum_c = (Fixed_S32_16){ .raw_value = (int32_t)((float)2 * (1 << FIXED_S32_16_PRECISION)) }; cl_assert(sum.raw_value == sum_c.raw_value); // sum = 3.5 + 1 = 4.5 num1 = (Fixed_S32_16){ .raw_value = (int32_t)((float)3.5 * (1 << FIXED_S32...
cl_assert(mul.raw_value == mul_c.raw_value)
; // 2*3 = 6 num1 = (Fixed_S32_16){ .raw_value = (int32_t)((float)2 * (1 << FIXED_S32_16_PRECISION)) }; num2 = (Fixed_S32_16){ .raw_value = (int32_t)((float)3 * (1 << FIXED_S32_16_PRECISION)) }; mul = Fixed_S32_16_mul(num1, num2); mul_c = (Fixed_S32_16){ .raw_value = (int32_t)((float)6 * (1 << FIXED_S32_16_P...
annedResponses, .string_list = &string_list,}, }; static TimelineItemAction actions[] = { { .id = 0, .type = TimelineItemActionTypeResponse, .attr_list = { .num_attributes = ARRAY_LENGTH(action1_attributes), .attributes = action1_attributes } }, { .id = 1, .type = TimelineItemActi...
(notification_storage_get(&id, &r))
; compare_notifications(&e, &r); free(r.allocated_buffer); cl_assert(notification_storage_get(&id, &r)); compare_notifications(&e, &r); free(r.allocated_buffer); Uuid invalid_uuid; uuid_generate(&invalid_uuid); cl_assert_equal_b(notification_storage_get(&invalid_uuid, &r), false); } void test_notific...
h = PRES_DETECT_THRSH_BLACK; break; case WATCH_INFO_COLOR_PEBBLE_2_HR_WHITE: case WATCH_INFO_COLOR_PEBBLE_2_HR_LIME: case WATCH_INFO_COLOR_PEBBLE_2_HR_AQUA: pres_detect_thrsh = PRES_DETECT_THRSH_WHITE; break; default: pres_detect_thrsh = 1; break; } if (!prv_write_regis...
(&dev->en_gpio, true)
; psleep(20); gpio_output_set(&dev->en_gpio, false); psleep(20); #else gpio_output_set(&dev->en_gpio, true); psleep(NORMAL_BOOT_DELAY_MS); #endif AS7000InfoRecord hrm_info; if (!prv_get_and_log_device_info(dev, &hrm_info, true /* log_version */)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read AS7000 vers...
/* * 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(system_flash_erase(FLASH_BASE + 12345, 1, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); }
void test_system_flash__erase_some_sectors_from_beginning(void) { cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_assert(system_flash_erase(FLASH_BASE, 1024 KiB...
essor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(aa, actual); cl_assert_equal_i(1, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); // go to child if possible actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &curr...
(&child_f, &GRect(-10, -10, 40, 40))
; layer_add_child(&parent, &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&child_a, &GPoint(11, 11)), NULL); cl_assert_equal_p(layer_find_layer_containing_point(&child_a, &GPoint(10, 10)), NULL); cl_assert_equal_p(layer_find_layer_containing_point(&child_a, &GPoint(9, 9)), &child_a); cl_asser...
IM_OFFSET)))) { return; } graphics_context_set_fill_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); GRect layer_bounds = timeline_layer->layer.bounds; GPoint line1_start; GPoint line2_start; // Draw down line1_start.x = layer_bounds.origin.x + layer_bounds.size.w - (SIDEBAR_...
{ layer->relbar_layer.curr_rel_bar.anim_offset = REL_BAR_BACK_TO_BACK_OFFSET; }
layer_mark_dirty((Layer*) layer); } #define TIMELINE_NUM_REL_BARS (TIMELINE_NUM_VISIBLE_ITEMS + 1) static void prv_update_rel_bars(TimelineLayer *layer) { // Store prev, current, and next item relationship bar types RelationshipBarType rel_bar_types[TIMELINE_NUM_REL_BARS]; layer->relbar_layer.prev_rel_bar....
_list(recognizers[0], &layer_c.recognizer_list); cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {0}, 1, &s_recognizers_handled); // Two recognizers attached to the active layer - processed in order that they were added recognizer_...
recognizer_set_simultaneous_with(r, prv_simultaneous_with_cb); cl_assert(prv_dispatch_touch_event(r, &ctx)); cl_assert(handled); cl_assert_equal_p(ctx.triggered, s); }
ECT_WIDTH, RECT_HEIGHT) void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__offset_aa_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 1 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_N...
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_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 5); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dr...
(sizeof(SettingsFile))
; if (settings_file_open(file, ACTIVITY_SETTINGS_FILE_NAME, ACTIVITY_SETTINGS_FILE_LEN) != S_SUCCESS) { kernel_free(file); PBL_LOG(LOG_LEVEL_ERROR, "No settings file"); return NULL; } return file; } // -------------------------------------------------------------------------...
/* * 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...
backlight_get_intensity()
* 100) / BACKLIGHT_BRIGHTNESS_MAX; } void backlight_set_timeout_ms(uint32_t timeout_ms) { } BacklightBehaviour backlight_get_behaviour(void) { return BacklightBehaviour_On; } bool backlight_is_enabled(void) { return true; } bool backlight_is_ambient_sensor_enabled(void) { return false; } bool backlight_is_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...
delay_us(1000)
; watchdog_feed(); } if (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) { PBL_LOG(LOG_LEVEL_ERROR, "LSE oscillator did not start"); } } } bool clocksource_is_lse_started(void) { return (RCC_GetFlagStatus(RCC_FLAG_LSERDY) != RESET); } void clocksource_MCO1_enable(bool on) { static int8_t s_...
Style; static const OptionMenuStyle s_style_medium = { #if PBL_RECT .cell_heights[OptionMenuContentType_DoubleLine] = 56, #endif .right_icon_spacing = PBL_IF_RECT_ELSE(7, 35), }; static const OptionMenuStyle s_style_large = { #if PBL_RECT .cell_heights[OptionMenuContentType_SingleLine] = 46, #endif .top_inset...
grect_inset(remaining_rect, GEdgeInsets(0, right_inset_x, 0, left_inset_x))
neration_to_index(0)); } //! Get next FILE_ID_BIT_WIDTH bit value static uint8_t get_next_file_id(uint8_t file_id) { return (file_id + 1) % (1 << (FILE_ID_BIT_WIDTH)); } // Make sure this is out of range for uint8_t:FILE_ID_BIT_WIDTH. static const uint8_t INVALID_FILE_ID = 0xff; void debug_db_determine_current_ind...
strncpy(file_header.details.version_tag, md.version_tag, sizeof(md.version_tag))
; flash_write_bytes((const uint8_t*) &file_header, get_current_file_address(), sizeof(file_header)); } uint32_t debug_db_get_stat_section_size(void) { return SECTION_HEADER_SIZE_BYTES - sizeof(FileHeader); }
Watchdog caused a reset"); } if (boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { dbgserial_putstr("Software failure caused a reset"); } // Clean up after the last failure. boot_bit_clear(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); // We have a "three strikes" algorithm: if the watch fails three times, r...
if (should_leave_standby_mode()) { leave_standby_mode(); } else { dbgserial_putstr("returning to standby"); enter_standby_mode(); }
dbgserial_putstr("leaving standby"); } else { // If not entering or leaving standby this is a cold boot. The firmware // expects the clock to be running in fast mode rtc_initialize_fast_mode(); } // Print out our super cool bootloader logo: // ______ __ // /_ __/ __/ /_ // / / /_ ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -18, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL)
; } void draw_text_single_line_ellipsis_clip_across_y(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 20, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_sing...
/* * 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...
(shared_prf_storage_get_ble_pairing_data(NULL, NULL, NULL, NULL), false)
; } void test_shared_prf_storage_v2__getting_started_complete(void) { shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false); shared_prf_storage_set_getting_started_complete(true); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), true); ...
ee_block); if (allocated_block != NULL) { // We've allocated a new block, update our metrics #ifdef MALLOC_INSTRUMENTATION allocated_block->pc = client_pc; #endif heap->current_size += allocated_block->Size * ALIGNMENT_SIZE; if (heap->current_size > heap->high_water_mark) { heap->...
next_block->PrevSize = heap_info_ptr->Size; } else { /* The next segment is free, so merge it with the */ /* current segment. */ heap_info_ptr->Size += next_block->Size; /* Since we merged the next segment, we have to update*/ ...
sequence(&sequence); GDrawCommandFrame *frame = gdraw_command_sequence_get_frame_by_elapsed(sequence, 0); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(sequence, 0)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 14)); frame = gdraw_command_sequence_get_fr...
memcmp(clone, sequence, expected_size)
ask_Worker && worker_manager_get_current_worker_md()->is_unprivileged) { worker_manager_close_current_worker(false); } else { PBL_ASSERTN(0); } #endif } } } } if (!prv_task_is_masked_out(e, cur_task) && service->subscribers[cur_task...
{ uuid = &sys_process_manager_get_current_process_md()->uuid; }
return prv_get_plugin_index(uuid); } DEFINE_SYSCALL(void, sys_event_service_cleanup, PebbleEvent *e) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(e, sizeof(PebbleEvent)); } EventServiceBuffer *esb = prv_get_esb_for_event(e); if (esb) { uint16_t task_bit = 1 << pebble_task_get_cu...
-224}, { 1360, 0, -256}, { 1472, 256, -240}, { 1408, 296, -248}, { 1488, 408, -200}, { 1712, 520, -48}, { 1928, 744, -136}, { 1976, 952, -32}, { 1704, 1064, 16}, { 1016, 1408, 56}, { 600, 1376, 40}, { 728, 1264, 160}, { 720, 888, 72}, { 1128, 840, 64}, { 1552, 71...
{ 1352, 480, -48}, { 1240, 368, -80}, { 1304, 360, -104}, { 1464, 320, -96}, { 1576, 312, -104}, { 1408, 248, -96}, { 1320, 248, -144}, { 1008, -80, -112}, { 952, -304, -64}, // 37 seconds { 712, -536, -72}, { 1080, 192, -320}, { 1288, 104, -192}, { 1264, 408, -36...
{ 1552, 440, -600}, { 1608, 520, -864}, { 1416, 1064, -1232}, { 936, 792, -1056}, { 808, 880, -768}, { 984, 736, -448}, { 1064, 848, -272}, { 1680, 776, -112}, { 1632, 496, -24}, { 1408, 416, -104}, { 1368, 408, -56}, { 1392, 352, -56}, { 1464, 328, -56}, { 1432,...
SSERTN(semaphore); HcExpectation *expectation = kernel_malloc_check(sizeof(HcExpectation)); *expectation = (HcExpectation) { .semaphore = semaphore, .request = request_message, .response = NULL, }; prv_lock(); s_expectations_head = (HcExpectation *) list_prepend((ListNode *)s_expectations_head, ...
(response)
; kernel_free(response); return rv; } static HcProtocolMessageHandler prv_get_handler_for_endpoint_id(HcEndpointID endpoint_id) { if (endpoint_id >= HcEndpointIDCount) { return NULL; } return g_hc_protocol_endpoints_table[endpoint_id]; } static void prv_dispatch_message_to_static_handler(HcProtocolMessa...
d; info->get_key(file, (uint8_t*)&wakeup_id, sizeof(WakeupId)); WakeupEntry entry; info->get_val(file, (uint8_t*)&entry, sizeof(WakeupEntry)); //If we have already flagged an error, just skip the rest if (check->wakeup_count < S_SUCCESS) { return true; // continue iterating } if (uuid_equal(&app_ma...
(&wakeup_settings)
; } else { status = E_INTERNAL; } } mutex_unlock(s_mutex); if (status != S_SUCCESS) { return status; } // timer doesn't belong to this app if (!uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) { return E_DOES_NOT_EXIST; } time_t return_time = entry.timestamp; ...
- There should be an 8x10 alternating black & white lines in the bottom right corner. void test_bitblt__1bit_to_8bit_clipping(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__1bit_to_8bit_clipping.1bit.pbi"); uint8_t dest_data[100*100]; GBitmap dest_bitmap = { .addr = dest_data, .row_si...
gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_dest_origin_offset_clip-expect.8bit.pbi")
); gbitmap_destroy(src_bitmap); } // Setup: // - Source width is 32 pixels (ie. a word in source) // - Source starts with 2 rows and 4 columns of black pixels. // - Dest is all blue. // - Src origin is set to (4, 2) // - dest origin is set to 10, 25 // - dest size is twice the height / width of the sou...
k(s_characteristics[0][PPoGATTCharacteristicData], 0 /* sn */); // The last enqueued one should now be sent out: prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment)); } void test_ppogatt__receive_ack_for_all_packets_...
{ test_ppogatt__open_session_when_found_pebble_app(); uint8_t sn = 0; Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); // Get s_tx_window_size packets in flight: for (sn = 0; sn < s_tx_window_size; ++sn) { cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(t...
ght 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 in writing, s...
{ if (s_valid_session) { comm_session_send_queue_cleanup(s_valid_session); s_valid_session = NULL; } return 10; }
} disable_flash_spi_clock(); power_tracking_stop(PowerSystemFlashWrite); flash_unlock(); } void flash_erase_subsector_blocking(uint32_t subsector_addr) { assert_usable_state(); PBL_LOG(LOG_LEVEL_DEBUG, "Erasing subsector 0x%"PRIx32" (0x%"PRIx32" - 0x%"PRIx32")", subsector_addr, subsector_ad...
(LOG_LEVEL_DEBUG, "Lock Register: 0x%x", lock_register)
; PBL_LOG(LOG_LEVEL_DEBUG, "Flag Status Register: 0x%x", flag_status_register); PBL_LOG(LOG_LEVEL_DEBUG, "Nonvolatile Configuration Register: 0x%x", nonvolatile_config_register); PBL_LOG(LOG_LEVEL_DEBUG, "Volatile Configuration Register: 0x%x", volatile_config_register); #endif } bool flash_is_initialized(void) ...
(&content_indicator)
; // Setting a dummy configuration for a direction should return true const ContentIndicatorConfig dummy_config = helper_get_dummy_config(); dummy_config.layer->update_proc = s_content_indicator_dummy_layer_update_proc; cl_assert(content_indicator_configure_direction(&content_indicator, ...
e "util/size.h" #include "clar.h" #include "stubs/stubs_logging.h" #include "stubs/stubs_passert.h" InterpolateInt64Function s_animation_private_current_interpolate_override; InterpolateInt64Function animation_private_current_interpolate_override(void) { return s_animation_private_current_interpolate_override; } ...
(&s_custom_moook)
); cl_assert_equal_i(-20000, interpolate_moook_custom(0, -20000, 20000, &s_custom_moook)); // mid frame is closer to end due to more end frames cl_assert_equal_i(6683, interpolate_moook_custom(ANIMATION_NORMALIZED_MAX / 2, -20000, 20000, &s_custom_moook)); c...
ar(BOOT_BIT_FORCE_PRF); return true; } if (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)) { dbgserial_putstr("Hold down UP + BACK for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK))) {...
(0xfeedface)
; delay_us(200000); display_error_code(0x8badf00d); delay_us(200000); display_error_code(0xbad1ce40); delay_us(200000); display_error_code(0xbeefcace); delay_us(200000); display_error_code(0x0defaced); delay_us(200000); display_error_code(0xd15ea5e5); delay_us(200000); di...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
TEST_NAMED_PBI_FILE("off_screen_left_aa_clipping")
)); }; void test_framebuffer_clipping__off_screen_right_aa_clipping(void) { cl_assert_equal_i(GBITMAP_NATIVE_FORMAT, GBitmapFormat8BitCircular); GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, true, 1); cl_assert_equal_i(ctx.dest_bitmap....
hs, DISABLE); RCC_AHB3PeriphResetCmd(ahb3_periphs, ENABLE); RCC_AHB3PeriphResetCmd(ahb3_periphs, DISABLE); RCC_APB1PeriphResetCmd(apb1_periphs, ENABLE); RCC_APB1PeriphResetCmd(apb1_periphs, DISABLE); RCC_APB2PeriphResetCmd(apb2_periphs, ENABLE); RCC_APB2PeriphResetCmd(apb2_periphs, DISABLE); // The Corte...
(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)
; } else { dbgserial_putstr("Failed to start firmware, strike one."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); } return false; } static bool check_force_boot_recovery(void) { if (boot_bit_test(BOOT_BIT_FORCE_PRF)) { boot_bit_clear(BOOT_BIT_FORCE_PRF); return true; } if (button_is_...
cl_assert(offset > -((int32_t)scroll_layer_get_content_offset(scroll_layer).y))
; } void test_scroll_layer__paging_with_scroll(void) { ScrollLayer *scroll_layer = scroll_layer_create(GRect(0,0,180,180)); int16_t page_height = 0; page_height = scroll_layer->layer.frame.size.h; scroll_layer_set_paging(scroll_layer, true); cl_assert_equal_i(page_height, prv_scroll_layer_get_paging_height(...
{ 128, -280, -936}, // 2 seconds { 168, -72, -784}, { 168, 40, -776}, { 176, 280, -608}, { 152, 616, -504}, { 72, 720, -504}, { 24, 800, -408}, { 80, 640, -296}, { -72, 720, -80}, { -80, 912, 32}, { -136, 936, 296}, { -144, 960, 432}, { -72, 864, 544}, { -88, 84...
{ -1864, 200, -128}, { -1456, 136, -80}, { -1328, 80, -16}, { -1320, 88, 0}, { -1312, 64, 8}, { -1168, 32, 56}, { -1064, 56, 88}, { -1008, 40, 120}, { -856, 48, 112}, { -720, 128, 152}, { -840, 168, -128}, { -888, 1096, -504}, { -960, 2984, -904}, { -816, 1480, -4...
(hence the 8px radius limit): static const uint32_t round_top_corner_lookup[] = { 0x0, 0x01, 0x01, 0x12, 0x113, 0x123, 0x1234, 0x11235, 0x112346, }; static const uint32_t round_bottom_corner_lookup[] = { 0x0, 0x01, 0x10, 0x210, 0x3110, 0x32100, 0x432100, 0x5321100, 0x64321100, }; // Set up the insets...
circle_func(ctx, GPoint(rect->origin.x + radius, rect->origin.y + radius), radius, GCornerTopLeft)
; top_rect_origin_x += radius; top_rect_size_w -= radius; } if (corner_mask & GCornerBottomLeft) { circle_func(ctx, GPoint(rect->origin.x + radius, rect->origin.y + rect->size.h - radius - 1), radius, GCornerBottomLeft); bottom_rect_origin_x += radius; bottom_rect...
if (!data) { return; }
s_window = window_create(); window_set_user_data(s_window, data); window_set_fullscreen(s_window, true); window_set_window_handlers(s_window, &(WindowHandlers) { .load = main_window_load, .unload = main_window_unload, }); window_set_click_config_provider(s_window, click_config_provider); const...
} graphics_text_node_container_add_child(&vertical_node->container, &primary_node->node); } if (has_secondary) { LayoutNodeTextDynamicConfig secondary_config = { .text.extent.node.type = is_peek ? LayoutNodeType_TextDynamic : LayoutNodeType_Text, .update = prv_peek_time_text_update, .bu...
PBL_IF_ROUND_ELSE(layout->layout_layer.mode == LayoutLayerModePinnedThin, false)
) { const int thin_height = 20; box_out->size.h = thin_height; } else if (layout->layout_layer.mode == LayoutLayerModePinnedFat) { box_out->size.h -= PBL_IF_ROUND_ELSE(30, 20); } } static void prv_get_card_view_bounds(TimelineLayout *layout, GRect *box_out) { const GRect *frame = &((Layer *)layout)->...
// return immediately if so. mutex_unlock(s_mutex); return; } timer->expired = !timer->repeating; mutex_unlock(s_mutex); PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_evented_timer_event_callback, .data = (void*)(intptr_t)id, } }; switc...
{ if (timeout_ms == 0) { timeout_ms = 1; } mutex_lock(s_mutex); // This will detect an invalid timer ID, or one that already ran on the client's task and got deleted // already EventedTimer* timer = prv_find_timer(timer_id); if (!timer) { PBL_LOG(LOG_LEVEL_DEBUG, "Attempting to reschedule an inv...
void evented_timer_cancel(EventedTimerID timer_id) { if (timer_id == EVENTED_TIMER_INVALID_ID) { return; } mutex_lock(s_mutex); // Find this timer and validate it EventedTimer* timer = prv_find_timer(timer_id); if (!timer) { PBL_LOG(LOG_LEVEL_DEBUG, "Attempting to cancel an invalid timer (id=%u...
, { -744, 472, -304}, { -1104, 664, -472}, { -872, 480, -392}, { -1016, 424, -408}, { -1040, 248, -96}, { -1600, 680, -624}, { -1200, 72, 48}, { -1192, 408, -352}, { -1040, 368, -248}, { -664, 72, -24}, { -360, 104, -224}, { -368, 312, -272}, // 31 seconds { -656,...
{ -496, 64, 80}, { -696, 64, -64}, // 36 seconds { -840, -104, 168}, { -1200, 336, -232}, { -1064, 192, -256}, { -1128, 128, -112}, { -1240, 0, -32}, { -1632, -8, -32}, { -712, 192, -416}, { -1064, -24, -216}, { -936, -216, -104}, { -536, 0, -168}, { -416, 112, -2...
{ -552, 248, -168}, { -744, 256, -120}, { -728, 104, 32}, { -776, 504, -328}, { -1128, 624, -656}, { -1288, -264, -56}, { -1992, 608, -600}, { -1368, 56, -200}, { -1208, 344, -200}, { -944, -8, 16}, { -480, -144, 168}, { -464, -72, 16}, { -472, -72, 152}, // 39 s...
ancs_notifications_count(), 1); } void test_ancs__should_filter_out_loading_messages_from_mail_app(void) { // Get notification for which we'll get a "Loading..." response: prv_send_notification((uint8_t *)&s_loading_response); cl_assert_equal_i(s_num_requested_notif_attributes, 1); cl_assert_equal_i(s_num_ds_n...
(sizeof(ns_notification), (uint8_t*) &ns_notification)
-1296, 24, 104}, { -1504, -120, 176}, { -1152, -264, 296}, { -1016, -360, 144}, { -1144, -136, -88}, { -1320, 0, -144}, { -1536, -40, -96}, { -1456, -152, 0}, { -1384, -80, 48}, { -1296, 144, 184}, { -1232, 272, 336}, { -1328, 464, 96}, { -1192, 504, 48}, { -1016, 544...
{ -1312, 40, -88}, { -1328, -40, 24}, { -1328, 56, -16}, { -1432, 280, 40}, { -1656, 360, 72}, // 57 seconds { -1688, 408, 56}, { -1376, 720, -88}, { -1400, 448, -216}, { -1256, 424, -224}, { -1648, 640, -264}, { -1416, 560, -176}, { -1104, 368, -272}, { -1272, 38...
{ -1416, 200, 112}, { -1384, 112, 144}, { -1384, 80, 152}, { -1360, 88, 184}, { -1208, 64, 216}, { -1232, -56, 208}, { -1024, -400, 312}, { -1016, -320, 192}, { -1216, 88, 48}, { -1176, 280, -336}, { -1232, -88, -224}, { -1472, 0, 56}, { -1256, -144, -168}, { -13...
data->sleep_card.text_layer = NULL; } // ------------------------------------------------------------------------------- static void steps_select_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; data->lap_steps = data->cur_steps; pers...
(APP_LOG_LEVEL_DEBUG, "Got significant update event")
; steps_update_text(data); } else if (event == HealthEventSleepUpdate) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Got sleep update event"); } else if (event == HealthEventHeartRateUpdate) { prv_hr_update_text(data); } else if (event == HealthEventMetricAlert) { HealthValue now_bpm = health_service_peek_cu...
ke_kernel_malloc_mark(void) { } void fake_kernel_malloc_mark_assert_equal(void) { } // Stubs /////////////////////////////////////////////////////////// #include "stubs_analytics.h" #include "stubs_bluetopia_interface.h" #include "stubs_bt_driver_gatt.h" #include "stubs_bt_lock.h" #include "stubs_logging.h" #include ...
cl_assert_equal_i(event.bluetooth.le.gatt_client.subtype, PebbleBLEGATTClientEventTypeNotification)
/* * 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...
GPoint(15, 40)
); } void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(40, 50), GPoint(35, 70)); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_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...
{ button_counter[button_id] = 0; continue; }
if (button_counter[button_id] >= STUCK_BUTTON_THRESHOLD) { dbgserial_putstr("Stuck button register is invalid, clearing."); char buffer[32]; itoa(button_counter_register, buffer, sizeof(buffer)); dbgserial_putstr(buffer); RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, 0); retu...
ot use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR ...
{ SerializedAttributeHeader *attribute = (SerializedAttributeHeader *)*cursor; *cursor += sizeof(SerializedAttributeHeader); if ((*cursor + attribute->length) > payload_end) { return false; } notif_attr->id = attribute->id; switch (prv_attribute_type(attribute->id)) { case AttributeTypeString: { ...
ration, 8 * MINUTES_PER_HOUR); cl_assert_equal_i(state.current_day, midnight_march_2_pst); // day 2 cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &all_day_item.header.id)); cl_assert(uuid_equal(&state.node->id, &all_day_item.header.id)); cl_assert(!state.node->all_day); cl_a...
cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY)
; cl_assert_equal_i(state.current_day, midnight_march_2_pst + SECONDS_PER_DAY); // no more cl_assert(!iter_next(&iterator)); // 4 deletes cl_assert(timeline_iter_remove_node_with_id(&head, &multiday_item.header.id)); cl_assert(timeline_iter_remove_node_with_id(&head, &multiday_item.header.id)); cl_asser...
strlen(values[0])
; // insert all keys for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { blob_db_insert(BlobDBIdTest, (uint8_t *)keys[i], key_len, (uint8_t *)values[i], value_len); } cl_assert(blob_db_sync_db(BlobDBIdTest) == S_SUCCESS); // We have built the dirty list, add more entries. // This mimics us performing writ...
t) { ActivityState *state = activity_private_state(); if (median_out) { *median_out = state->hr.metrics.previous_median_bpm; } if (heart_rate_total_weight_x100_out) { *heart_rate_total_weight_x100_out = state->hr.metrics.previous_median_total_weight_x100; } } // -------------------------------------...
for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { if (i == 0) { uint32_t elapsed_minutes = time_util_get_minute_of_day(utc_now); uint32_t cur_day_resting_calories = activity_private_compute_resting_calories(elapsed_minutes); new_history.values[i] = ROUND(cur...
} // Copy values from old history into correct slot in new history for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { int new_index = i + old_age; if (new_index >= 0 && new_index < ACTIVITY_HISTORY_DAYS) { new_history.values[new_index] = old_history.values[i]; } ...
_end(false /*call accepted*/, disconnected); } else if (!disconnected) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring end call. A call is not in progress"); } } static void prv_handle_caller_id(PebblePhoneEvent *event) { if (s_call_in_progress) { phone_ui_handle_caller_id(event->caller); } else { PBL_LOG(LOG_...
ancs_perform_action(s_call_identifier, ActionIDNegative)
; ancs_phone_call_temporarily_block_missed_calls(); prv_cancel_call_watchdog(); } else { pp_decline_call(s_call_identifier); } if (s_call_in_progress) { s_call_in_progress = false; analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_PHONE_CALL_TIME); } }
/* * 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...
(storage, buffer, len)
; } return false; } void gb_storage_cleanup(GetBytesStorage *storage, bool successful) { if (storage->impl->setup) { storage->impl->cleanup(storage, successful); } }
rocess_state/app_state/app_state.h" #include "system/logging.h" #include <inttypes.h> #include <stdbool.h> #include <stdio.h> static Window *s_window; typedef enum PixelBit { PIXEL_BIT_BOTH, PIXEL_BIT_MSB, PIXEL_BIT_LSB, PIXEL_BIT_COUNT } PixelBit; typedef enum LineHue { HUE_RED, HUE_GREEN, HUE_BLUE, ...
(50, 80, 20, 20)
, "G", data->hue == HUE_GREEN, data->selection == ATTRIBUTE_HUE); draw_ui_element(ctx, GRect(70, 80, 20, 20), "B", data->hue == HUE_BLUE, data->selection == ATTRIBUTE_HUE); draw_ui_element(ctx, GRect(90, 80, 20, 20), "W", data->hue == HUE_WHITE, data->selection ...
ed_pauses_s += (rtc_get_time() - wrkt_data->last_paused_utc); } else { // We are unpaused and want to pause. Set the last_paused_utc timestamp wrkt_data->last_paused_utc = rtc_get_time(); } s_workout_data.current_workout->paused = should_be_paused; // Update the global duration since we ha...
prv_unlock()
; return rv; } // --------------------------------------------------------------------------------------- bool workout_service_is_paused(void) { prv_lock(); bool rv = (workout_service_is_workout_ongoing() && s_workout_data.current_workout->paused); prv_unlock(); return rv; } // ----------------------------...
.layer, &window->text_layer.layer); window_set_click_config_provider(&window->window, prv_no_music_window_click_config); return window; } static void prv_push_no_music_window(MusicAppData *data) { if (data->no_music_window) { return; } data->no_music_window = prv_create_no_music_window(); app_window_st...
(0, -y_offset, rect->size.w, rect->size.h + y_offset)
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_odd_clip"))); } void test_graphics_draw_line__dotted_cross(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test horizontal and vertical lines cross appropriately setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1...
graphics_draw_vertical_line_dotted(&ctx, GPoint(70, 15), 5)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(65, 15), 10); // T facing down graphics_draw_vertical_line_dotted(&ctx, GPoint(101, 11), 5); graphics_draw_horizontal_line_dotted(&ctx, GPoint(96, 16), 10); // cross - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 32), 10); ...
aving this function const GDrawState root_draw_state = ctx->draw_state; uint8_t current_depth = 0; // We render our layout tree using a stack as opposed to using recursion to optimize for task // stack usage. We can't allocate this stack on the stack anymore without blowing our stack // up when doing a few c...
(layer, &frame)
; } void layer_get_frame(const Layer *layer, GRect *frame) { *frame = layer->frame; } GRect layer_get_frame_by_value(const Layer *layer) { GRect frame; layer_get_frame(layer, &frame); return frame; } void layer_set_bounds(Layer *layer, const GRect *bounds) { if (grect_equal(bounds, &layer->bounds)) { r...
layer_set_hidden((Layer *)&layer->day_separator, true)
; layer_add_child((Layer *)layer, (Layer *)&layer->day_separator); // end-of-timeline indicator // TODO: PBL-21716 Fin icon layout on Spalding prv_get_end_of_timeline_frame(layer, 3, &frame); kino_layer_init(&layer->end_of_timeline, &frame); kino_layer_set_reel_with_resource(&layer->end_of_timeline, RESOUR...
/* * 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...
(day - 1, max_days, delta)
+ 1; } int date_time_selection_step_month(int month, int delta) { return prv_wrap(month, 12, delta); } int date_time_selection_truncate_date(int year, int month, int day) { bool is_leap_year = date_util_is_leap_year(year); // date_util_get_max_days_in_month expects Jan == 1, but this function expects Jan == 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...
launcher_menu_app_get_app_info()
; } #else AppInstallId system_app_state_machine_get_last_registered_app(void) { return APP_ID_SDK; } const PebbleProcessMd* system_app_state_machine_get_default_app(void) { return sdk_app_get_info(); } #endif void system_app_state_machine_register_app_launch(AppInstallId app_id) { if (app_install_id_from_app_d...
/* * 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 (!connection->connection_parameter_sets) { const size_t size = sizeof(GAPLEConnectRequestParams) * NumResponseTimeState; connection->connection_parameter_sets = (GAPLEConnectRequestParams *) kernel_zalloc_check(size); }
for (ResponseTimeState s = ResponseTimeMax; s < NumResponseTimeState; ++s) { const PebblePairingServiceConnParamSet *pps_params = &settings->connection_parameter_sets[s]; GAPLEConnectRequestParams *params = &connection->connection_parameter_sets[s]; prv_convert_pps_request_params(pps_pa...
*response_length_out = prv_handle_connection_state_read(conn_idx, response); } else if (value_handle == s_pps_ctx.att_hdl.gatt_mtu) { *response_length_out = prv_handle_gatt_mtu_read(conn_idx, response); } else if (value_handle == s_pps_ctx.att_hdl.conn_params) { *response_length_out = prv_handle_conn_par...
{ prv_send_notification(evt->conn_idx, value_handle); }
return ATT_ERROR_OK; } static att_error_t prv_handle_mtu_value_write(const ble_evt_gatts_write_req_t *evt) { if (evt->length != sizeof(uint16_t)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid GATT MTU size %u!", evt->length); return ATT_ERROR_INVALID_VALUE_LENGTH; } // https://pebbletechnology.atlassian.net/br...
te_order[4]) { const int duration_a = 150; const int duration_total = 2 * duration_a; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; // Simulate some delay incurred on every call to rtc_get_ticks() fake_rtc_auto_increment_ticks(3); Animati...
(first_fire_b, prv_last_handler_entry(&s_started_handler_calls, b2)->fire_order)
; first_fire_b = MIN(first_fire_b, prv_last_handler_entry(&s_started_handler_calls, b3)->fire_order); first_fire_b = MIN(first_fire_b, prv_last_handler_entry(&s_started_handler_calls, spawn_b)->fire_order); cl_assert(last_fire_a < first_fire_b); cl_assert_equal_i(prv_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...
{ return NULL; }
// Helpers //////////////////////////////////////////////////////////////// typedef struct PeekTestData { PebbleTimelinePeekEvent last_peek_event; unsigned int num_peek_events; } PeekTestData; static PeekTestData s_data; static PebbleTimelinePeekEvent prv_get_peek_event(void) { return s_data.last_peek_event; ...
/* * 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...
{ WTF; // It might be possible to encode a duty cycle differently from the legacy I2C, if it's // ever necessary. Currently it's not, so just maintain the previous implementation }
} RCC_ClocksTypeDef rcc_clocks; RCC_GetClocksFreq(&rcc_clocks); uint32_t prescaler = rcc_clocks.PCLK1_Frequency / (bus->hal->clock_speed * (duty_cycle_low + duty_cycle_high)); if ((rcc_clocks.PCLK1_Frequency % (bus->hal->clock_speed * (duty_cycle_low + duty_cycle_high))) == 0) { // Prescale...
_') != NULL; // invalid key } static bool prv_value_is_valid(const uint8_t *key, int key_len, const uint8_t *val, int val_len) { return val_len && val_len % sizeof(uint32_t) == 0; } static bool prv_is_last_processed_timesta...
(key, HEALTH_DB_MAX_KEY_LEN, "%s%s", WEEKDAY_NAMES[day], SLEEP_DATA_KEY_SUFFIX)
; const int key_len = strlen(key); SettingsFile file; if (prv_file_open_and_lock(&file) != S_SUCCESS) { return false; } // We cheat a bit here because the only typical values we store are sleep related SleepData data; status_t s = settings_file_get(&file, key, key_len, (uint8_t *)&data, sizeof(data...
; if (step->arc.anti_clockwise) { const int32_t t = angle_start; angle_start = angle_end; angle_end = t; } while (angle_end < angle_start) { angle_end += TRIG_MAX_ANGLE; } graphics_draw_arc_precise_internal(ctx, step->arc.center, step->arc....
if (argc >= 4) { GRectPrecise rect; ROCKY_ARGS_ASSIGN_OR_RETURN_ERROR(ROCKY_ARG(rect)); grect_precise_standardize(&rect); // shift rectangle into coordinate system const int16_t half_pt = FIXED_S16_3_HALF.raw_value; rect.origin.x.raw_value -= half_pt; rect.origin.y.raw_value -= half_pt; ...
.pt.xy = GPointPrecise(right.raw_value, bottom.raw_value), .pt.fill_delta = delta_br, }; // bottom left s_rocky_path_steps[s_rocky_path_steps_num++] = (RockyAPIPathStep) { .type = RockyAPIPathStepType_LineTo, .pt.xy = GPointPrecise(rect.origin.x.raw_value, bottom.raw_value), ....
->swap_in_progress = false; if (swap_layer->callbacks.layout_did_appear_handler) { swap_layer->callbacks.layout_did_appear_handler(swap_layer, layout, rel_change, swap_layer->context); } } static void prv_update_colors(SwapLayer *swap_layer, GColor bg_color, ...
grect_align(&arrow_bounds, layer_bounds, arrow_alignment, false /* clip */)
; const int16_t arrow_nudge_y = PBL_IF_RECT_ELSE(7, -8); arrow_bounds.origin.y += arrow_nudge_y; // FIXME PBL-43428: // For some reason the down arrow bitmap is drawn as all-black in the test_notification_window // unit test on Silk unless we draw it with GCompOpSet, yet this results in the arrow being drawn...
stroy(window); } static void prv_push_window_load(Window *window) { prv_window_load(window); Window *new_window = window_create(); window_set_window_handlers(new_window, &(WindowHandlers){ .load = prv_window_load, .unload = prv_window_unload }); cl_check(window->parent_window_stack); cl_assert_equ...
cl_check(app_state_get_window_stack())
; cl_check(!app_state_get_window_stack()->list_head); app_window_stack_push(window1, true); cl_assert_equal_i(app_window_stack_count(), 1); cl_assert_equal_i(window1->on_screen, true); app_window_stack_push(window2, true); cl_assert_equal_i(app_window_stack_count(), 2); cl_assert_equal_i(window1->on_s...
te_cstring(&iter, SOME_STRING_KEY, SOME_STRING); cl_assert(result == DICT_OK); result = dict_write_uint8(&iter, SOME_UINT8_KEY, 8); cl_assert(result == DICT_OK); result = dict_write_uint16(&iter, SOME_UINT16_KEY, 16); cl_assert(result == DICT_OK); result = dict_write_uint32(&iter, SOME_UINT32_KEY, 32); cl...
(&iter, buffer, sizeof(buffer))
; cl_assert(result == DICT_OK); result = dict_write_cstring(&iter, SOME_STRING_KEY, SOME_STRING); cl_assert(result == DICT_NOT_ENOUGH_STORAGE); } void test_dict__tuple_header_size(void) { Tuple t; t.type = 0; t.type = ~t.type; uint8_t num_bits = ffs(t.type + 1) - 1; cl_assert(num_bits % 8 == 0); // T...
et = ClickHandlerOffsetRawUp; break; case 'd': offset = ClickHandlerOffsetRawDown; break; default: return; } prv_dispatch_event(&(app_state_get_click_manager()->recognizers[button]), offset, needs_reset); } void click_recognizer_handle_button_down(ClickRecognizer *recognizer) { r...
{ for (unsigned int button_id = 0; button_id < ARRAY_LENGTH(click_manager->recognizers); ++button_id) { ClickRecognizer *recognizer = &click_manager->recognizers[button_id]; recognizer->button = button_id; prv_click_reset(recognizer); } }
void click_manager_clear(ClickManager* click_manager) { for (unsigned int button_id = 0; button_id < ARRAY_LENGTH(click_manager->recognizers); ++button_id) { prv_click_reset(&click_manager->recognizers[button_id]); click_manager->recognizers[button_id].config = (ClickConfig){}; } } void click_mana...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
sys_hrm_manager_unsubscribe(data->hrm_session)
; } text_layer_deinit(&data->title_text_layer); text_layer_deinit(&data->status_text_layer); window_deinit(&data->window); app_free(data); } static void prv_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* mfg_hrm_app_get_info(void) { static const Pebb...
xt); } // ----------------------------------------------------------------------------------------- static void prv_intraday_metric_avg(HealthAPITestAppData *data, HealthMetric metric, const char *name) { strncpy(data->debug_card.dialog_text, name, sizeof(data->debug_card.dialog_...
health_service_metric_aggregate_averaged_accessible( HealthMetricRestingKCalories, time_start_of_today(), time(NULL), HealthAggregationSum, HealthServiceTimeScopeOnce)
; APP_LOG(APP_LOG_LEVEL_DEBUG, "Result from aggregate_averaged_accessible calories, sum: 0x%x", access); if (access != HealthServiceAccessibilityMaskAvailable) { passed = false; goto exit; } // accessibility with heart rate should work access = health_service_metric_aggregate_averaged_acces...
_data.steps, 3800); cl_assert_equal_i(stored_session->step_data.active_kcalories, 200 + calculated_active_kcalories); cl_assert_equal_i(stored_session->step_data.resting_kcalories, ROUND(activity_private_compute_resting_calories(stored_session->length_min), ACTIVITY_CAL...
(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone))
; cl_assert_equal_i(bpm, 100); // Time forward X seconds prv_inc_time(30); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 100); // Time forward X seconds prv_inc_time(30);...
_create_layer_bounceback_animation(&data->artist_text_layer.layer, prv_artist_rect()), prv_create_layer_bounceback_animation(&data->title_text_layer.layer, prv_title_rect()), prv_create_layer_bounceback_animation(&data->position_text_layer.layer, time_rect), prv_create_layer_bounceback_animation(&data...
(&data->cassette_layer, new_bitmap)
; data->cassette_current_icon = new_bitmap; return; } // Never animate an icon to itself. We can't use the current value of the bitmap layer itself, // because that will cause false positives if an icon change is triggered, but a revert // is triggered before the first half of the icon animation complet...
ay_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_delay(b, delay_b); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); animation_set_delay(seq, delay_seq); prv_clear_handler_histories(); uint64...
cl_assert(spawn != NULL)
; animation_set_delay(spawn, delay_spawn); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(spawn); // Test the elapsed int32_t elapsed_ms; animation_get_elapsed(spawn, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn)); animation_get_elapsed(a, &e...
/* * 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 (curr_request->req_state > state) { // reset our tracker, we have found a higher power mode requested timeout = curr_request->timeout; state = curr_request->req_state; responsible_consumer = curr_request->consumer; } else if (curr_request->req_state == state) { if (curr_reques...
if (consumer_out) { *consumer_out = responsible_consumer; } if (secs_to_wait) { uint32_t curr_ticks = rtc_get_ticks(); if (curr_ticks < timeout) { uint16_t wait_time = (timeout - curr_ticks) / RTC_TICKS_HZ; *secs_to_wait = MAX(1, wait_time); } else { *secs_to_wait = 0; } ...
tag, DataLoggingItemType item_type, uint16_t item_size, bool buffered, bool resume, const Uuid* uuid) { return prv_dls_create(tag, item_type, item_size, buffered, NULL /*buffer*/, resume, uuid); } // -------------------------------------------------------------------------------------...
if (!session->data->buffer_storage) { // Unbuffered, we can write to storage immediately if (!dls_storage_write_data(session, data, num_bytes)) { // We always overwrite old data, so the only possibility for failure here is an internal // PFS error. result = DATA_LOGGING_INTERNAL_ERR; } ...
clude "system/passert.h" #include "util/attributes.h" #include "util/build_id.h" #include "util/string.h" #include <stddef.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include "version.h" #include "git_version.auto.h" //! This symbol and its contents are provided by the linker script, see the //! ...
version_copy_build_id_hex_string(buffer, buffer_bytes_left, &TINTIN_BUILD_ID)
; } void version_get_major_minor_patch(unsigned int *major, unsigned int *minor, char const **patch_ptr) { *major = GIT_MAJOR_VERSION; *minor = GIT_MINOR_VERSION; *patch_ptr = GIT_PATCH_VERBOSE_STRING; }
const uint32_t active_calories = activity_metrics_prv_get_active_calories(); m_rec->active_calories = active_calories - s_alg_state->prev_active_calories; const uint32_t distance_mm = activity_metrics_prv_get_distance_mm(); const uint32_t minute_distance_mm = distance_mm - s_alg_state->prev_distance_mm; co...
prv_unlock()
; return true; } // ------------------------------------------------------------------------------------ void activity_algorithm_enable_activity_tracking(bool enable) { if (!activity_tracking_on()) { return; } if (!prv_lock()) { return; } kalg_enable_activity_tracking(s_alg_state->k_state, enable...
/* * 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...
(&dev->rx_gpio, otype, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL)
; } // configure the UART peripheral control registers // - 8-bit word length // - no parity // - RX / TX enabled // - 1 stop bit // - no flow control dev->periph->CR1 = cr1_extra_flags; dev->periph->CR2 = 0; dev->periph->CR3 = (dev->half_duplex ? USART_CR3_HDSEL : 0); // QEMU doesn't want you t...
state = (properties & ModalProperty_Transparent) ? CompositorState_AppAndModal : CompositorState_Modal; compositor_modal_render_ready(); // Force the app framebuffer to be released. We hold it during transitions to keep the app // framebuffer from ch...
{ return framebuffer_get_as_bitmap(&s_framebuffer, &s_framebuffer.size); }
GBitmap compositor_get_app_framebuffer_as_bitmap(void) { // Get the app framebuffer state based on the size it should be to prevent a malicious app from // changing it and causing issues. GSize app_framebuffer_size; app_manager_get_framebuffer_size(&app_framebuffer_size); return framebuffer_get_as_bitmap(ap...
the object. char *data_buffer; //! The next offset in bytes, into the JSON string (excluding the PostMessageChunkPayload //! header) that the next chunk's payload will start at. uint32_t offset_bytes; } OutgoingObject; typedef enum { OutboxMsgTypeNone, OutboxMsgTypeControl, OutboxMsgTypeChunk } OutboxM...
((ListNode *)obj, (ListNode **)&s_state.out.object_queue, NULL)
; if (should_free_data_buffer) { task_free(obj->data_buffer); } task_free(obj); } static void prv_calc_current_chunk_size(size_t *out_bytes_remaining, size_t *out_chunk_payload_size) { OutgoingObject *obj = s_state.out.object_queue; const size_t bytes_remaining =...
!"); } ++num_message_consumed; } if (info.num_failed) { if (info.dropped_handler) { info.dropped_handler(info.num_failed); } else { PBL_LOG(LOG_LEVEL_ERROR, "Dropped %"PRIu32" messages but no dropped_handler", info.num_failed); } } // Report back up to which byte ...
{ // See PBL-41464 // App message has been reset (closed and opened again) while a message was being received. // Fail it because our state got lost. inbox->write_failed = true; }
lse); window_stack_push(window_stacks[2], windows[2][1], false); // An unfocusable window is now the top window // Test: Opaque windows that are not the top window have no affect on unfocusable // Test: One unfocusable top window results in Unfocused modal_manager_event_loop_upkeep(); cl_assert_equal_i(mod...
(windows[idx][i])
; } } } void test_window_stack__modal_properties_enable_disable(void) { // Enable all modals modal_manager_set_min_priority(ModalPriorityMin); Window *window1 = window_create(); modal_window_push(window1, ModalPriorityGeneric, false); modal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_manag...
/* * 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(timer->id != TASK_TIMER_INVALID_ID)
; manager->idle_timers = list_insert_before(manager->idle_timers, &timer->list_node); mutex_unlock(manager->mutex); return timer->id; } // -------------------------------------------------------------------------------- // Schedule a timer to run. bool task_timer_start(TaskTimerManager *manager, TaskTimerID t...
= file_hdr->hdr_crc) { return (HdrCrcCorrupt); } return (PageAndFileHdrValid); } static status_t write_file_header(FileHeader *hdr, uint16_t pg) { hdr->hdr_crc = compute_file_header_crc(hdr); prv_flash_write((uint8_t *)hdr, sizeof(*hdr), prv_page_to_flash_offset(pg) + FILEHEADER_OFFSET); return (S...
{ s_last_page_written = pg; PBL_LOG(LOG_LEVEL_INFO, "Last written page %d", (int)s_last_page_written); return; }
} // should only happen after a filesystem format PBL_LOG(LOG_LEVEL_WARNING, "Couldn't resolve last written pg"); s_last_page_written = s_pfs_page_count - 1; #if UNITTEST if (s_test_last_page_written_override != -1) { s_last_page_written = s_test_last_page_written_override; } #endif } //! @param regi...
/* * 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_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, c = LIST_NODE_NULL; ListNode *head; head = list_prepend(&c, &b); cl_assert(head == &b); head = list_prepend(...
_encryption_info = { .ltk = (const SMLongTermKey) { .data = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, }, }, .rand = 0x11223344, .ediv = 9876, }, .irk = (const SMIdentityResolvingKey) { .dat...
(&pairing_info->remote_encryption_info.ltk, &pairing_info_out.remote_encryption_info.ltk, sizeof(SMLongTermKey))
, 0); cl_assert_equal_i(memcmp(&pairing_info->irk, &pairing_info_out.irk, sizeof(SMIdentityResolvingKey)), 0); cl_assert_equal_i(memcmp(&pairing_info->csrk, &pairing_info_out.csrk, sizeof(SM128BitKey)), 0); } void test_shared_prf_storage_v2__bt_classic_and_le_...
te animation_state = 0; animation_state < ActionMenuLayerLongLabelScrollingAnimationStateCount; animation_state++) { const int16_t y_offset = GRID_CELL_PADDING + (animation_state * (GRID_CELL_PADDING + DISP_ROWS)); s_ctx.draw_state.drawing_box.origin = G...
(s_dest_bitmap, TEST_PBI_FILE)
); } void test_action_menu_window__thin_display_mode_one_row(void) { static const char* thin_values[] = { "Y", "N" }; ActionMenuLevel *root_level = action_menu_level_create(ARRAY_LENGTH(thin_values)); action_menu_level_set_display_mode(root_level, ActionMenuLevelDisplayModeThin); for (size_t i = 0; i < ARRAY_L...
app_db_insert((uint8_t*)&app1.uuid, sizeof(Uuid), (uint8_t*)&app1, sizeof(AppDBEntry))); cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app2.uuid, sizeof(Uuid), (uint8_t*)&app2, sizeof(AppDBEntry))); cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app3.uuid, sizeof(Uuid), (uint8_t*...
(true, uuid_equal(&app3.uuid, &temp.uuid))
; } void test_app_db__overwrite(void) { // add 3 of the same. Confirm that the entry was overwritten by checking next ID. cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app1.uuid, sizeof(Uuid), (uint8_t*)&app1, sizeof(AppDBEntry))); cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app1.uuid, si...
/* * 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 *window = &s_data.app.timeline_window; window_init(window, "Timeline"); const GColor color = past ? TIMELINE_PAST_COLOR : TIMELINE_FUTURE_COLOR; window_set_background_color(window, color); prv_init_peek_layer(&s_data.app); prv_setup_no_events_peek(&s_data.app); peek_layer_play(&s_data.app.peek_l...
// Tests ////////////////////// void test_timeline_no_events__future(void) { prv_create_no_events_and_render(false /* past */); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE(); } void test_timeline_no_events__past(void) { prv_create_no_events_and_render(true /* past */); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITM...
return; } struct PACKED StartSyncResponseMsg { BlobDBCommand cmd; BlobDBToken token; BlobDBResponse result; } response = { .cmd = BLOB_DB_COMMAND_START_SYNC_RESPONSE, }; BlobDBId db_id; endpoint_private_read_token_db_id(data, &response.token, &db_id); status_t rv = blob_db_sync_db(d...
prv_handle_wb_response(session, data, data_length)
; break; case BLOB_DB_COMMAND_SYNC_DONE_RESPONSE: PBL_LOG(LOG_LEVEL_DEBUG, "SYNC DONE Response"); prv_handle_sync_done_response(session, data, data_length); break; default: PBL_LOG(LOG_LEVEL_ERROR, "Invalid BlobDB2 message received, cmd is %u", cmd); prv_send_error_response(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...
strcmp(with_neither, string_strip_leading_whitespace(with_both))
== 0); } void test_string__strip_trailing_whitespace(void) { char string_out[100]; const char *with_whitespace = "hello, world "; const char *without_whitespace = "hello, world"; string_strip_trailing_whitespace(with_whitespace, string_out); cl_assert(strcmp(without_whitespace, string_out) == 0); cons...
prv_unschedule_all_in_update_handler(false); } static void prv_stopped_unschedule_all_handler(Animation *animation, bool finished, void *context) { prv_add_handler_entry(&s_stopped_handler_calls, animation, finished, context); DPRINTF("%"PRIu64" ms: Executing stopped handler for %d\n", prv_now_ms(), (int)animati...
{ // just some pointer to compare against AnimationCurveFunction curve = (void*)1; InterpolateInt64Function interpolation = (void*)2; AnimationState *state = kernel_applib_get_animation_state(); cl_assert_equal_p(state->aux->current_animation, NULL); cl_assert_equal_p(animation_private_current_interpolate_...
de <stdio.h> #include <services/common/hrm/hrm_manager.h> // ----------------------------------------------------------------------------- // T_STATIC functions // ----------------------------------------------------------------------------- extern HRMSubscriberState * prv_get_subscriber_state_from_ref(HRMSessionRef ...
(100 /*initial_ticks*/, 1465243370)
; stub_pebble_tasks_set_current(PebbleTask_App); app_manager_get_task_context()->to_process_event_queue = (void *)0x1; fake_system_task_callbacks_cleanup(); s_activity_prefs_heart_rate_is_enabled = true; s_event_count = 0; s_num_cb_events_1 = 0; s_num_cb_events_2 = 0; memset(&s_hrm_state, 0, sizeof(s_...