prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_data(s_session, (const uint8_t *) &incomplete_put_msg, sizeof(incomplete_put_msg)); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__commit_message_sent_while_previous_put_was_not_acked_yet(void) { uint8_t max_put_ops = prv_put_bytes_get_max_batched_pb_ops(); ...
prv_receive_init_put_and_commit_fw_object()
; prv_receive_install(~s_last_response_cookie); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__install_message_prf_boot_bit_set(void) { prv_receive_init_put_commit_and_install(ObjectRecovery); assert_ack_count(1); assert_nack_count(0); cl_assert_equal_i((s_boot_bits_orred & BOOT_BIT_NE...
sport_imp, TransportDestinationSystem); cl_assert(system_session2); cl_assert_equal_p(s_last_closed_transport, system_transport); cl_assert_equal_i(s_close_count, 1); comm_session_close(system_session2, CommSessionCloseReason_UnderlyingDisconnection); // T...
comm_session_send_next(session)
; cl_assert_equal_i(fake_system_task_count_callbacks(), 1); cl_assert_equal_i(s_send_next_count, 1); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(s_send_next_count, 2); comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection); } void test_session__send_next_not_called_w...
gdraw_command_list_get_command(GDrawCommandList *command_list, uint16_t command_idx) { if (!command_list || (command_idx >= command_list->num_commands)) { return NULL; } GDrawCommand *command = command_list->commands; for (uint32_t i = 0; i < command_idx; i++) { command = prv_next_command(command); }...
((offsetof(GPoint, y) == offsetof(GPointPrecise, y)), "GPointPrecise cannot be convert to GPoint in-place because of its member size difference.")
otAnApp") == 0) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_fake_app_info_dict), (uint8_t *)s_fake_app_info_dict); } else { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_app_info_dict), (uint8_t *)s_mes...
if (uid == mms_no_caption_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_mms_no_caption_dict), (uint8_t *)s_mms_no_caption_dict); s_num_ds_notifications_received++; } else if (uid == mms_with_caption_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_mms_with_caption_dict), (uint...
ar_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } // Simulate receiving an ack for the last, after the roll-back, but before the packets are // retransmitted (the last part shouldn't matter much, but simplifies the test a bit) prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], ...
(transport, s_short_data_fragment, sizeof(s_short_data_fragment) - sn)
, true); fake_malloc_set_largest_free_block(1000); s_mtu_size = 0; ppogatt_send_next(transport); // No crash } //! When client ID info got added to the Reset Packet (PBL-14099), a potential buffer overrun //! situation got introduced accidentally. This test is a white-box test to catch this issue. //! For the ...
conds { 560, 664, -88}, { 568, 712, -80}, { 600, 736, -32}, { 648, 688, -168}, { 688, 720, -224}, { 656, 728, 0}, { 680, 712, -8}, { 592, 688, -40}, { 504, 968, -104}, { 440, 448, -224}, { 472, 1272, -184}, { 384, 512, -88}, { 472, 664, -232}, { 656, 560, -360}, ...
{ 1192, 352, -464}, { 1256, 296, -336}, { 1152, 312, -248}, { 1024, 384, -256}, { 960, 440, -280}, { 904, 528, -312}, { 904, 520, -256}, { 944, 576, -336}, { 928, 624, -392}, { 856, 648, -472}, { 776, 608, -496}, // 8 seconds { 776, 600, -504}, { 848, 560, -424}, ...
{ 712, 360, -192}, { 696, 528, -216}, { 832, 520, -304}, { 968, 504, -344}, { 984, 528, -328}, { 992, 544, -528}, { 928, 528, -480}, { 816, 448, -432}, { 1136, 432, -320}, { 1288, 600, -480}, { 1376, 568, -368}, { 1448, 376, -80}, { 1504, 416, -160}, { 1240, 440,...
ALID) || (entry == NULL)) { return false; } unsigned int record_order = 0; const AppRegistryEntry *reg_entry = prv_get_registry_list_entry(install_id, &record_order); if (reg_entry) { bool rv = false; // switch on registry type switch (reg_entry->type) { case AppInstallStorageFw: ...
{ return prv_get_md_for_reg_entry(reg_entry); }
else if (app_db_exists_install_id(id)) { return prv_get_md_for_flash_id(id, worker); } // Not a registered app, fail. PBL_LOG(LOG_LEVEL_ERROR, "Can't get PebbleProcessMd for app id %"PRId32, id); return NULL; } void app_install_release_md(const PebbleProcessMd *md) { if (!md) { return; } switc...
x->node; custom_node->callback(ctx->gcontext, &ctx->box, ctx->config, ctx->render, ctx->size_out, custom_node->user_data); } static void prv_draw_noop(GTextNodeDrawContext *ctx) { } static const GTextNodeBaseImpl s_text_impl = { .destructor = prv_destroy_text_node_base, .will_draw = prv_...
prv_should_draw_text_node(node, ctx->gcontext, &ctx->box, ctx->render)
; if (!ctx->cached && node->clip) { ctx->cached_clip_box = ctx->gcontext->draw_state.clip_box; const GRect draw_box = { .origin = gpoint_add(ctx->draw_box->origin, ctx->gcontext->draw_state.drawing_box.origin), .size = ctx->draw_box->size, }; grect_clip(&ctx->gcontext->draw_state.clip_box,...
), }; data->list = (EvictListNode *)list_sorted_add((ListNode *)data->list, (ListNode *)node, evict_node_comparator, false); data->bytes_in_list += node->size; if (data->bytes_in_list > data->bytes_needed) { prv_trim_top_priorities(&data->list, &data->bytes_in_list, data->bytes_needed); } retur...
while (iter) { // grab the next entry right now since we may delete the node we're looking at PFSFileListEntry *next = (PFSFileListEntry *)iter->list_node.next; if (app_file_parse_app_id(iter->name) == id) { // the AppInstallId of the file matches the one in the cache so we can remove this // en...
offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 4 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 4); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw4_no_clip.${BIT_DEPTH_...
(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")
alue`-tall row. void prv_assign_vertical_line_raw(GContext *ctx, int16_t x, Fixed_S16_3 y1, Fixed_S16_3 y2, GColor color); static void prv_vline_pattern_apply_assign_vertical_line(GContext *ctx, int16_t x, int16_t y1, int16_t y...
(ctx->draw_state.draw_mask, mask2)
; // Calling record with NULL should reset draw impl to default and mask in GContext to NULL cl_assert(graphics_context_mask_record(ctx, NULL)); cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default_draw_implementation); cl_assert_equal_p(ctx->draw_state.draw_mask, NULL); graphics_context_mask_d...
t; const int32_t buffer_size = attribute_get_buffer_size_for_serialized_attributes(num_attributes, &buffer_size_cursor, serialized_attr_list_end); if (buffer_size < 0) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to measure the buffer size requ...
attribute_get_uint32(&attr_list, AttributeIdTimestamp, APP_GLANCE_SLICE_NO_EXPIRATION)
, .type = (AppGlanceSliceType)serialized_slice->type, }; // Copy type-specific fields from the serialized slice to the output glance's slice s_slice_type_impls[serialized_slice->type].init_slice_from_attr_list(&attr_list, current_slice_out...
dow_data, item, action) && action != dismiss_action) { timeline_actions_add_action_to_root_level(action, root_level); } } if (has_ancs_mute_action) { const char *app_id = attribute_get_string(&item->attr_list, AttributeIdiOSAppIdentifier, ""); iOSNotifPrefs *notif_prefs = ios_notif_pref_db...
PBL_LOG(LOG_LEVEL_ERROR, "Couldn't create notification action menu")
; return; } window_data->action_menu = timeline_actions_push_action_menu( &config, window_manager_get_window_stack(NOTIFICATION_PRIORITY)); } static void prv_select_long_click_handler(ClickRecognizerRef recognizer, void *data) { prv_dismiss_all(data, NULL); } static void prv_back_button_single_click_...
iptors 0x00, //// GATTCharacteristic 0x10, 0x00, 0x00, 0x01, 0x32, 0x8e, 0x0f, 0xbb, 0xc6, 0x42, 0x1a, 0xa6, 0x69, 0x9b, 0xda, 0xda, //// Offset EMULATED_DATA_CHAR_OFFSET, //// Properties 0x14, //// Num Descriptors 0x01, ////// Data descriptor 0x00, 0x00, 0x29, 0x02, 0x00, 0x00, 0x10, 0x00, 0x80, ...
{ return; // Gotta wait for remote to subscribe. }
sion_timeout_10ms, }; const bool success = bt_driver_le_connection_parameter_update(&connection->device, &req); if (success) { connection->param_update_info.is_request_pending = true; } retry: // Restart watchdog timer: new_timer_start(connection->param_update_info.watchdog_timer, retry_ms, ...
{ goto unlock; }
GAPLEConnection *connection = gap_le_connection_by_addr(&event->dev_address); if (!connection) { PBL_LOG(LOG_LEVEL_DEBUG, "Receiving conn param update but connection is no longer open"); goto unlock; } const ResponseTimeState desired_state = conn_mgr_get_latency_for_le_connection(connection, NULL); ...
.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, software * distributed under the License is distributed on an "AS IS" ...
for (int index = 0; index < src_bitmap->bounds.size.h * src_bitmap->row_size_bytes; index++) { src_bitmap_buff[index] = src_bitmap_buff[index] & 0xbf; }
IDTH / 2, SCREEN_HEIGHT / 2)); s_outline_mode = false; s_path_angle = 0; } // setup and teardown void test_graphics_gpath_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); s_house_path = gpath_create(&s_house_path_info); s_bolt_pa...
gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi")
); printf("-- right\n"); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH, SCREEN_HEIGHT / 2)); ctx.draw_state.drawing_box = GRect(-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH, SCREEN_HEIGHT); ctx.draw_state.clip_box = GRect(0, 0, SCR...
/* * 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(s_num_packets_sent, 2)
; cl_assert_equal_i(s_num_bytes_sent, LOG_METADATA_LENGTH + 20); cl_assert_equal_s(s_log_message_buffer, "TestTestTestTestTest"); } void test_pulse_logging__simple_trucate(void) { pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTest" "Tes...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(IWDG_WriteAccess_Disable)
; DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP, ENABLE); } void watchdog_start(void) { IWDG_Enable(); IWDG_ReloadCounter(); } bool watchdog_check_reset_flag(void) { return RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET; }
ower, PWR_STOPEntry_WFI); // We don't use ^^ the above function because of a silicon bug which // causes the processor to skip some instructions upon wake from STOP // in certain sitations. See the STM32F20x and STM32F21x Errata sheet // section 2.1.3 "Debugging Stop mode with WFE entry", or the erratum // of...
(inhibitor, now_ticks)
; s_inhibitor_profile[inhibitor].total_ticks_while_disabled = 0; portEXIT_CRITICAL(); analytics_set(metric, ticks_to_milliseconds(ticks), AnalyticsClient_System); } void analytics_external_collect_stop_inhibitor_stats(RtcTicks now_ticks) { prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_MAIN_TIME, InhibitorMain...
= window->layer.bounds.size; const GTextAlignment ARTIST_TITLE_TEXT_ALIGNMENT = PBL_IF_RECT_ELSE(GTextAlignmentLeft, GTextAlignmentRight); const MusicAppSizeConfig *config = prv_config(); const GRect artist_rect = prv_artist_rect(); const...
(&data->window.layer, &status_layer->layer)
; music_get_pos(&data->track_pos, &data->track_length); #if CAPABILITY_HAS_VIBE_SCORES data->score = vibe_score_create_with_resource(RESOURCE_ID_VIBE_SCORE_HAPTIC_FEEDBACK); #endif prv_update_now_playing(data); prv_update_layout(data); prv_update_track_progress(data); prv_update_ui_state(data, false); } ...
64 KiB. // The remaining sectors are 128 KiB. // Bitset of sectors that have been "erased" static uint32_t erased_sector; static bool flash_locked, flash_flags_set; static FLASH_Status return_status; uint8_t *flash_written_data; bool *flash_written_flag; void *source_buffer; uint32_t flash_data_start, flash_data_lengt...
cl_assert(callback_called)
; } void test_system_flash__write_error(void) { return_status = FLASH_ERROR_OPERATION; malloc_flash_data(10); flash_data_start = FLASH_BASE; cl_assert(!system_flash_write(FLASH_BASE, "abc", 3, NULL, NULL)); cl_assert(flash_locked); assert_flash_unwritten(0, 10); } extern void FLASH_Lock(void) { flash_lo...
nt(recognizer, ctx->touch_event); RecognizerState state = recognizer_get_state(recognizer); if (!ctx->triggered && ((state == RecognizerState_Completed) || (state == RecognizerState_Started) || (state == RecognizerState_Updated))) { ctx->triggered = recognizer; } return true; } static ...
prv_process_all_recognizers(manager, prv_reset_recognizer, NULL)
; } static void prv_reset(RecognizerManager *manager) { prv_reset_all_recognizers(manager); prv_set_triggered(manager, NULL); manager->state = RecognizerManagerState_WaitForTouchdown; manager->active_layer = NULL; } static void prv_fail_then_reset_if_no_active_recognizers(RecognizerManager *manager) { bool ...
return; } if (data->operation == OP_TEST4 || data->operation == OP_TEST5) { /* GRect bounds = layer->bounds; GPoint center = GPoint(bounds.size.w/2, bounds.size.h/2); int radius = 40; graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, true); ...
(window_layer, data->debug_layer)
; data->canvas_layer = layer_create(GRect(10, 10, window_bounds.size.w - 20, window_bounds.size.h - 20)); layer_set_update_proc(data->canvas_layer, canvas_update_proc); layer_add_child(window_layer, data->canvas_layer); // For drawing_rect testing... // layer_set_bo...
/* * 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...
accel_service_state_init(worker_state_get_accel_state())
; plugin_service_state_init(worker_state_get_plugin_service()); battery_state_service_state_init(worker_state_get_battery_state_service_state()); connection_service_state_init(worker_state_get_connection_service_state()); tick_timer_service_state_init(worker_state_get_tick_timer_service_state()); #if CAPAB...
cl_assert(blob_db_sync_db(BlobDBIdTest) == S_SUCCESS); // We have built the dirty list, add more entries. // This mimics us performing writes while the sync is ongoing or not having enough memory to // build the initial list char *extra_keys[] = { "keyA", "keyB" }; char *extra_values[] = { "valA", "valB" }; ...
{ // create a few sync sessions prv_fill_stop_return_session(BlobDBIdTest); prv_fill_stop_return_session(BlobDBIdPins); prv_fill_stop_return_session(BlobDBIdReminders); // check we can conjure them by id BlobDBSyncSession *test_session = blob_db_sync_get_session_for_id(BlobDBIdTest); cl_assert(test_sessi...
uint8_t *resp_ptr = process_blob_db_command(s_insert_cmd_no_value_size, sizeof(s_insert_cmd_no_value_size)); // Check Response cl_assert(0 < *(uint16_t*)resp_ptr); resp_ptr += sizeof(uint16_t); cl_assert(BLOB_DB_INVALID_DATA == *resp_ptr); resp_ptr += sizeof(uint8_t); cl_assert((resp_ptr - s_data) == s...
(s_delete_cmd_success, sizeof(s_delete_cmd_success))
; // Check Response cl_assert(token == *(uint16_t*)resp_ptr); resp_ptr += sizeof(uint16_t); cl_assert(BLOB_DB_SUCCESS == *resp_ptr); resp_ptr += sizeof(uint8_t); cl_assert((resp_ptr - s_data) == s_sending_data_length); } /************************************* * Checking for valid CLEAR command * *****...
OFFSET_RECT_NO_CLIP, false, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP...
prv_draw_rects(&ctx, 4, 3 * CLIP_OFFSET, 0)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_clip_rect.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); prv_draw_rects(&ctx, 1, 0, 1); prv_draw_rects(&ctx, 2, CLIP_OFFSET, 1); prv_draw_rects(&ctx, 3, 2 * CLIP_OFFSET, 1); prv_draw_rects(&ctx, ...
flash_base; flash_base = prv_flash_start_address(false /*new*/); if (!s_core_dump_is_forced && flash_base != CORE_DUMP_FLASH_INVALID_ADDR) { CoreDumpFlashRegionHeader region_hdr; CoreDumpImageHeader image_hdr; prv_debug_str_int("CD: Checking: ", flash_base); prv_flash_read_bytes(&region_hdr, flash_b...
if (!RETURNS_TO_PSP(s_saved_registers.core_reg[portCANONICAL_REG_INDEX_LR])) { // Another exception invoked the core dump handler xPORT_TASK_INFO task_info; task_info.pcName = "ISR"; task_info.taskHandle = (void *)1; for (int i = 0; i < portCANONICAL_REG_COUNT; i++) { // registers [r0-r12, sp,...
// Write out chunk terminator chunk_hdr.key = CORE_DUMP_CHUNK_KEY_TERMINATOR; chunk_hdr.size = 0; s_flash_addr += prv_flash_write_bytes(&chunk_hdr, s_flash_addr, sizeof(chunk_hdr)); // Reset! prv_debug_str("CD: completed"); prv_reset(); } // --------------------...
ied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <string.h> #include "clar.h" #include "drivers/system_flash.h" #define KiB *1024 // Set bits n..0 in a bit-vector (zero-indexed) #de...
cl_assert_(countdown <= 0, "Callback not called enough times")
; } void malloc_flash_data(uint32_t size) { flash_data_length = size; flash_written_data = malloc(size * sizeof(uint8_t)); cl_assert(flash_written_data); flash_written_flag = malloc(size * sizeof(bool)); cl_assert(flash_written_flag); } void assert_flash_unwritten(uint32_t start, uint32_t length) { for (...
/* * 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...
free(s_fb)
; free(test_image.addr); } // Layout Test Support //////////////////////////////////// #define TEST_LAYER_SIZE (GSize(64, 110)) #define TEST_LAYER_OFFSET_ORIGIN (GPoint(80, 55)) static GPoint s_layer_test_image_bounds_offset; static void prv_layer_test_update_proc(Layer *layer, GContext *ctx) { GRect destinatio...
ayer_set_text(s_text_layer_a, "Started."); } static void animation_stopped(Animation *animation, bool finished, void *data) { text_layer_set_text(s_text_layer_a, finished ? "Hi, I'm a TextLayer!" : "Just Stopped."); } // -------------------------------------------------------------------------------------- // setu...
property_animation_get_to_grect(a, &test_rect); APP_LOG(APP_LOG_LEVEL_DEBUG, "rect is %d, %d, %d, %d", test_rect.origin.x, test_rect.origin.y, test_rect.size.w, test_rect.size.h); switch (click_recognizer_get_button_id(recognizer)) { case BUTTON_ID_UP: animation_set_curve((Animation*) a, Anima...
static void config_provider(Window *window) { window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler) click_handler); window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler) click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) click_handler); } static void init(void) { wind...
/* * 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_init(&s_window, WINDOW_NAME("VibeAndLogs Demo"))
; const bool animated = true; app_window_stack_push(&s_window, animated); s_app_timer = app_timer_register(100 /* milliseconds */, app_timer_callback, NULL); s_sys_timer = new_timer_create(); //new_timer_start(s_sys_timer, 10, sys_timer_callback, NULL, 0); } static void handle_deinit(void) { } static void...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return false; }
void passert_failed(const char* filename, int line_number, const char* message, ...) { APP_LOG(LOG_LEVEL_ERROR, "ASSERTION FAILED: %s:%d", filename, line_number); EM_ASM_INT_V({ abort(); }); while (1) ; } void passert_failed_no_message(const char* filename, int line_number) { passert_failed(filename, line_nu...
own frame buffer op_2) System copies the app frame buffer to the system frame buffer op_3) System sends the system frame buffer to the display hardware (using DMA). op_3 can happen in parallel with op_1, so the effective frame period is: frame_period = MAX(op_1_time + op_2_time, op2_time + op_3_time) Th...
{ data->time_started = prv_time_64(); __profiler_init(); __profiler_start(); }
data->rendered_frames++; } void prv_syncing_selection_changed(MenuLayer *menu_layer, MenuIndex old_index, MenuIndex new_index, void *context) { ScrollLayer *scroll_layer = (ScrollLayer *)menu_layer; AppData *data = context; GPoint offset = scroll_layer_get_content_offset(scroll_layer); scroll_layer_set...
_EVEN, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); #if PBL_COLOR ASSERT_CALLED(graphics_circle_draw_stroked_aa(&context, GPoint(50, 50), 10, SW_EVEN)); #else ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_EVEN)); #endif setup_test(&c...
ASSERT_CALLED(prv_fill_rect_aa(&context, &GRect(20, 80, 40, 10), 4, GCornersAll, GColorBlack))
; #endif } void test_graphics_context_${BIT_DEPTH_NAME}__lock(void) { // Test all the setup test combinations as above setup_test(&context, false, 1, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRe...
the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "util/stringlist.h" #include "clar.h" // Setup ///////////////////////////...
("hello", string_list_get_at(list, 0))
kino_reel_destroy(icon_reel); icon_reel = prv_create_kino_reel_with_timeline_resource( timeline_layout, icon_res_size, fallback_resource, TIMELINE_RESOURCE_NOTIFICATION_FLAG, NULL /* app_id */); if (!icon_reel) { return; } icon_size = kino_reel_get_size(icon_reel); } if (t...
i18n_noop("All day")
, .use_i18n = true, .text.style = LayoutContentSizeDefault, .text.style_font = TextStyleFont_Title, .text.fixed_lines = 1, .text.alignment = PBL_IF_RECT_ELSE(LayoutTextAlignment_Left, LayoutTextAlignment_Right), .text.extent.offset.y = -13, .text.extent.margin.h = -7, }; GTextNodeText *t...
vice_end(AppInboxServiceTagUnitTest); cl_assert_equal_i(1, app_inbox_service_num_success_for_tag(AppInboxServiceTagUnitTest)); cl_assert_equal_i(0, app_inbox_service_num_failed_for_tag(AppInboxServiceTagUnitTest)); prv_process_callback_events(); assert_message(0, s_test_data, BUFFER_SIZE); assert_num_message...
(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1))
; cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // Only one callback event scheduled: assert_num_callback_events(1); s_num_messages_to_consume_from_handler = 1; prv_process_callback_events(); assert_num_callback_events(0); // Expect 2 message callbacks and 1 drop callback...
/* * 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...
fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)
); text_layer_set_text(data->title_text_layer, "ALS"); text_layer_set_text_alignment(data->title_text_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(data->title_text_layer)); bounds.origin.y += 30; data->reading_text_layer = text_layer_create(bounds); prv_update_reading(d...
-114 and PBL-34044. extern const uint32_t __syscall_text_start__[]; extern const uint32_t __syscall_text_end__[]; const uint32_t priv_code_start = (uint32_t) __syscall_text_start__; const uint32_t priv_code_end = (uint32_t) __syscall_text_end__; return (caller_pc >= priv_code_start && caller_pc < priv_code_en...
ticks_to_milliseconds(s_analytics_app_stop_ticks)
; uint32_t awake_ms = ticks_to_milliseconds(now_ticks - s_last_ticks) - stop_ms - sleep_ms; analytics_set(ANALYTICS_APP_METRIC_CPU_RUNNING_TIME, awake_ms, AnalyticsClient_App); analytics_set(ANALYTICS_APP_METRIC_CPU_SLEEP_TIME, mcu_cycles_to_milliseconds(s_analytics_app_sleep_cpu_cycles), ...
<limits.h> static bool prv_char_iter_next_start_of_word(Iterator* char_iter); // PBL-23045 Eventually remove perimeter debugging void graphics_text_perimeter_debugging_enable(bool enable) { app_state_set_text_perimeter_debugging_enabled(enable); } // [CTX] processing individual codepoints doesn't work for context...
{ word->width_px += prv_codepoint_get_horizontal_advance(&ctx->font_cache, text_box_params->font, utf8_iter_state->codepoint); }
iter_next(&char_iter); state = word_state_update(state, utf8_iter_state->codepoint); } while (state != WordStateEnd); word->end = utf8_iter_state->current; return true; } void word_iter_init(Iterator* word_iter, WordIterState* word_iter_state, GContext* ctx, const TextBoxParams* c...
back_context) { const char *title = prv_row_texts[cell_index->row]; prv_draw_row(ctx, cell_layer, title, -cell_layer->frame.origin.y/4 + cell_layer->bounds.size.w); } static int16_t prv_get_separator_height(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { return 0; } static voi...
(&data->action_list2)
; } static void s_main(void) { AppData *data = app_malloc_check(sizeof(AppData)); memset(data, 0, sizeof(AppData)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("FPS test")); window_set_user_data(window, data); window_set_fullscreen(window, true); laye...
%d) or removed (%d)", minute_of_day, s_activity_summary_settings.summary.activity.trigger_minute, s_activity_pin_state.removed); return; } // Make sure we actually have a step count const int32_t steps = prv_get_step_count(); if (steps <= 0) { INSIGHTS_LOG_...
i18n_get("MI", i18n_owner)
, i18n_get("KM", i18n_owner)); } static void prv_add_metric_duration_info(StringList *headings, int headings_buf_size, StringList *values, int values_buf_size, ActivitySession *session) { const size_t duration_buffer_size = sizeof("00:...
e "stubs_app_install_manager.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_bt_lock.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_serial.h" #include "stubs_tick.h" extern void music_protocol_msg_callback(CommSession *session, const uint8_...
{ prv_receive_and_assert_now_playing(expect_is_handled); prv_receive_and_assert_play_state(expect_is_handled); prv_receive_and_assert_volume_info(expect_is_handled); prv_receive_and_assert_player_info(expect_is_handled); }
static const MusicServerImplementation s_dummy_server_implementation = {}; static void prv_set_dummy_server_connected(bool connected) { music_set_connected_server(&s_dummy_server_implementation, connected /* connected */); } static void prv_assert_no_data_sent_cb(uint16_t endpoint_id,...
urn png_seek_chunk_in_resource_system(app_num, resource_id, offset, seek_framedata, found_actl); } int32_t png_seek_chunk_in_resource_system(ResAppNum app_num, uint32_t resource_id, uint32_t offset, bool seek_framedata, bool *found_ac...
(bitmap, palette, true)
; } retval = true; cleanup: if (!retval) { // bitmap init failed, free palette APP_LOG(APP_LOG_LEVEL_ERROR, PNG_LOAD_ERROR); applib_free(palette); } // we are keeping the image data to avoid copying it upng_destroy(upng, !retval); return retval; } static uint16_t prv_gbitmap_png_create_pal...
ount, 0); app_free(outbox_data); } void test_app_message_sender__byte_by_byte_consume(void) { AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID, TEST_PAYLOAD, sizeof(TEST_PAYLOAD)); size_t length = ...
app_outbox_service_cleanup_all_pending_messages()
; // Copy & consume the rest: size_t second_length = (length - first_length); cl_assert_equal_i(second_length, comm_session_send_queue_copy(s_app_session_ptr, 0, second_length, bytes_ou...
#include "drivers/periph_config.h" #include "drivers/pmic.h" #include "drivers/spi.h" #include "flash_region.h" #include "stm32f4xx_gpio.h" #include "stm32f4xx_rcc.h" #include "stm32f4xx_spi.h" #include "system/passert.h" #include "util/delay.h" #include "util/misc.h" #define CMD_NULL (0) #define CMD_SET_PARAMETER (...
((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 version_num; } void display_init(void) { display_start(); bool...
ransfer locks the bus bool result = do_transfer(device_id, false, i2c_device_address, register_address_start, write_size, (uint8_t*)buffer); if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Write failed on bus %" PRId8, BOARD_CONFIG.i2c_device_map[device_id]); } return result; } /*------------------------INTERRU...
if (bus->transfer.idx == bus->transfer.size) { bus->i2c->CR2 &= ~I2C_CR2_ITBUFEN; bus->transfer.state = TRANSFER_STATE_END_WRITE; break; }
break; case TRANSFER_STATE_END_WRITE: // End transfer after all bytes have been sent should_context_switch = end_transfer_irq(bus, true); break; default: // Abort transfer from invalid state - should never reach here (state machine logic broken) should_context_switch = end...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ unsigned int sector_addr = state->address + state->next_sector * SECTOR_SIZE_BYTES; state->next_sector += 1; pulse_bulkio_erase_message_send(PulseBulkIODomainType_ExternalFlash, S_TRUE, state->cookie); flash_erase_sector(sector_addr, prv_erase_sector, state); }
else { pulse_bulkio_erase_message_send(PulseBulkIODomainType_ExternalFlash, S_SUCCESS, state->cookie); kernel_free(state); } } static status_t external_flash_domain_erase(uint8_t *packet_data, size_t length, uint8_t cookie) { if (length != sizeof(ExternalFlashEraseOptions)) { return E_INVALID_ARGUMENT...
); layer_set_hidden(&layer->relbar_layer.layer, true); return; } layer_set_hidden(&layer->relbar_layer.layer, false); if (layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeOverlap) { layer->relbar_layer.curr_rel_bar.anim_offset = prv_get_overlap_line_length(layer, NULL, NULL); } e...
animation_spawn_create(prev_rel_bar_anim, curr_rel_bar_anim, NULL)
TE_WRITE_ADDRESS_RX, TRANSFER_STATE_WAIT_FOR_DATA, TRANSFER_STATE_READ_DATA, TRANSFER_STATE_WRITE_DATA, TRANSFER_STATE_END_WRITE, TRANSFER_STATE_INVALID, } state; bool result; uint16_t nack_count; }I2cTransfer; typedef struct I2cBus{ I2C_TypeDef *i2c; uint8_t user_cou...
BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_fn(false)
; // Drain through pull-ups bus_pin_cfg_output(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl, false); bus_pin_cfg_output(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda, false); } //! Power up I2C bus power supply //! Always lock bus and peripheral config access before use static void bus_rail_power_up(uint8_t bu...
os/chip_id.h" #include "services/common/comm_session/session.h" #include "system/bootbits.h" #include "system/passert.h" #include "system/reset.h" #include "system/logging.h" #include "system/version.h" #include "util/attributes.h" #include "util/build_id.h" #include "util/math.h" #include "util/net.h" #include "util...
{ return cd_flash_write_bytes(buffer_ptr, start_addr, buffer_size); }
else { flash_write_bytes(buffer_ptr, start_addr, buffer_size); return buffer_size; } } static void prv_flash_erase_region(uint32_t start_addr, uint32_t total_bytes) { if (s_use_cd_flash_driver) { cd_flash_erase_region(start_addr, total_bytes); } else { uint32_t end = start_addr + total_bytes; ...
//////////////////////////////////////////// // Helpers /////////////////////////////////////////////////////////// #define ANCS_CALL_UID 1 #define ANCS_UNUSED_UID 2 // Whenever we check the last phone ui event, we reset s_last_phone_ui_event so we don't end up // checking the same event twice and assume everything w...
prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, false)
; ASSERT_LAST_EVENT(PhoneEventType_Invalid); prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, true); ASSERT_LAST_EVENT(PhoneEventType_Incoming); // Make sure we don't process incoming calls while we're in a call prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, true); ASSERT_LAST_EVENT(Phon...
/* * 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...
(RCC_APB1Periph_PWR, ENABLE)
; PWR_BackupAccessCmd(ENABLE); // Disable write-protect on RTC_BKP_x registers if (!boot_bit_test(BOOT_BIT_INITIALIZED)) { RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, BOOT_BIT_INITIALIZED); } } void boot_bit_set(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); cu...
{ -200, -24, -976}, { -200, -16, -976}, { -192, 0, -1000}, { -192, -24, -1000}, { -200, -24, -992}, { -200, -16, -992}, { -192, -16, -1000}, { -192, -8, -984}, { -200, -8, -992}, { -200, -16, -1000}, { -192, -24, -992}, { -192, -16, -984}, { -192, -8, -984}, { -200...
{ -192, 0, -1008}, { -184, -8, -992}, { -200, 8, -1000}, { -200, -16, -984}, { -192, 0, -984}, { -192, -40, -1016}, // 69 seconds { -192, 0, -968}, { -192, -8, -992}, { -192, 8, -1000}, { -192, 0, -968}, { -192, 8, -984}, { -200, 0, -984}, { -200, 0, -984}, { ...
{ -184, -16, -984}, { -192, -16, -992}, { -200, -8, -984}, { -208, -16, -992}, { -184, 8, -992}, { -192, 0, -976}, { -192, 8, -984}, { -208, -8, -1000}, { -200, -16, -984}, { -184, -8, -992}, { -176, -8, -1000}, { -192, -24, -1000}, { -200, -8, -984}, // 72 secon...
SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_zero_length", 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_le...
set_and_verify(&file, key, key_len, val, val_len)
; // setting a byte to all 0s should work settings_file_set_byte(&file, key, key_len, 2, 0x00); val[2] &= 0x00; verify(&file, key, key_len, val, val_len); // setting all 1s should do nothing - only reset bytes are applied settings_file_set_byte(&file, key, key_len, 2, 0xff); val[2] &= 0xff; verify(&fi...
er we've unsubscribed return; } PBL_ASSERTN(state->data_handler != NULL || state->raw_data_handler != NULL || state->raw_data_handler_deprecated != NULL); uint16_t time_interval_ms = 1000 / state->sampling_rate; // Process in chunks to limit the amount of stack space we use up. uint32_t n...
(PebbleTask_Unknown)
; accel_session_double_tap_subscribe(session, handler); } // ---------------------------------------------------------------------------------------------- void accel_double_tap_service_unsubscribe(void) { AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_double_...
me *)(command->points + command->num_points); *frame = (GDrawCommandFrame) { .duration = 30, }; frame->command_list = (GDrawCommandList) { .num_commands = 1 }; command = gdraw_command_list_get_command(&frame->command_list, 0); points2[0].x++; // increment x value to distinguish draw command from com...
(&sequence)
urn; } void framebuffer_mark_dirty_rect(FrameBuffer *f, GRect rect) { return; } bool layer_is_status_bar_layer(Layer *layer) { return false; } void status_bar_layer_render(GContext *ctx, const GRect *bounds, void *config) { return; } GDrawState graphics_context_get_drawing_state(GContext* ctx) { GDrawState ...
(new_window, &(WindowHandlers){ .load = prv_window_load, .unload = prv_window_unload })
; cl_check(window->parent_window_stack); cl_assert_equal_i(window->on_screen, true); cl_assert_equal_i(window->is_loaded, false); window_stack_push(window->parent_window_stack, new_window, true); } static void prv_pop_window_load(Window *window) { prv_window_load(window); cl_check(window->parent_window_...
LEGATTClientEvent *e) { BLEAppState *ble_app_state = app_state_get_ble_app_state(); const BLEClientWriteHandler handler = ble_app_state->gatt_characteristic_write_handler; if (handler) { handler(e->object_ref, e->gatt_error); } } static void prv_handle_characteristic_subscribe(const PebbleBLEGATTClientEven...
(handler, offset)
t_flow.layout = layout; } void graphics_text_attributes_enable_screen_text_flow(GTextLayoutCacheRef layout, uint8_t inset) { s_actual.enable_text_flow.layout = layout; s_actual.enable_text_flow.inset = inset; } void graphics_text_attributes_restore_default_paging(GTextLayoutCacheRef layout) { s_actual.disable_p...
cl_assert_mocks_called(((MockValues){ .disable_paging.layout = text_layer.layout_cache, .disable_text_flow.layout = text_layer.layout_cache, }))
// Disable all of the peripheral clocks we may have on, but don't touch any of // the reserved bits. The reset values in the stm32f412 reference manual are // not to be trusted, so make sure those bits never change. RCC->AHB1ENR &= ~(0x006010ff); RCC->AHB2ENR &= ~(0x000000c0); RCC->AHB3ENR &= ~(0x00000003); ...
(BOOT_BIT_RESET_LOOP_DETECT_TWO)
; boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE); return true; } switch (++counter) { case 1: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 2: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 3: boot_bit_se...
d_cannned_accel_data(1 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake); prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 10, ActivitySleepStateAwake); activity_get_metric(ActivityMetricActiveSeconds, 1, &value); cl_assert_equal_i(value, SECONDS_PER_HOUR + (2 * SECONDS_PER_MINUTE)); cl_assert_equal_i(heal...
(value, ActivitySleepStateRestfulSleep)
; prv_feed_cannned_accel_data(10 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake); } // 30 minute "morning walk" 4 hours later at 2:30am prv_feed_cannned_accel_data(30 * SECONDS_PER_MINUTE, 50, ActivitySleepStateAwake); activity_get_metric(ActivityMetricSleepState, 1, &value); cl_assert_equal_i(value,...
// 1035: Local time: 2015-11-15 01:56:00 PM { 0, 0xc, 0, 140, 0}, { 0, 0xc, 0, 140, 0}, { 0, 0xc, 0, 140, 0}, { 0, 0xc, 0, 140, 0}, { 0, 0xc, 0, 140, 0}, { 0, 0xc, 0, 140, 0}, { 0, 0xc, 0, 140, 0}, { 0, 0xc, 0, 140, 0}, { 0, 0xc, 0, 140, 0}, { 0, 0xc, 0, 140, 0}, { 0, 0xc...
{ 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, // 1155: Local time: 2015-11-15 03:56:00 PM { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc...
{ 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0, 0xc, 0, 139, 0}, { 0...
one d - e return GPoint(frame.origin.x, frame.origin.y + DIV_X(frame.size.h * (1000 - MULT_X((cur - limit_d), (limit_e - limit_d))))); } else { // zone e - 0 return GPoint(frame.origin.x + DIV_X(frame.size.w / 2 * MULT_X((cur - limit_e), (total...
app_free(path.points)
; #elif PBL_ROUND const int32_t degree = total ? (360 * current / total) : 0; const int32_t to_angle = DEG_TO_TRIGANGLE(degree); graphics_fill_radial(ctx, outer_bounds, GOvalScaleModeFitCircle, fill_thickness, 0, to_angle); #endif } #if PBL_ROUND static void prv_draw_outer_dots(GContext *ctx, GRect bounds) { ...
estAppCount } LauncherMenuLayerTestApp; typedef struct LauncherMenuLayerTestAppNode { AppMenuNode node; uint32_t bitmap_icon_resource_id; uint32_t pdc_icon_resource_id; uint32_t bitmap_slice_icon_resource_id; uint32_t pdc_slice_icon_resource_id; } LauncherMenuLayerTestAppNode; static bool s_use_pdc_icons; ...
{ return &s_default_app_icon_bitmap; }
gbitmap_deinit(&s_app_icon_bitmap); gbitmap_init_with_resource(&s_app_icon_bitmap, node->icon_resource_id); return &s_app_icon_bitmap; } //! We use this function in the app glance service to create a key (the install ID) for an app //! glance cache entry; just fake it by constructing a 32-bit number from the f...
*dev, uint32_t addr, bool is_subsector) { const uint32_t size_bytes = is_subsector ? SUBSECTOR_SIZE_BYTES : SECTOR_SIZE_BYTES; const uint32_t BUF_SIZE_BYTES = 128; const uint32_t BUF_SIZE_WORDS = BUF_SIZE_BYTES / sizeof(uint32_t); uint32_t buffer[BUF_SIZE_WORDS]; for (uint32_t offset = 0; offset < size_bytes...
(dev->qspi, dev->state->part->instructions.read_status, dev->state->part->status_bit_masks.busy, false /* !set */, QSPI_NO_TIMEOUT)
6, 232, -544}, { 1376, 384, -760}, { 1072, 480, -848}, { 904, 536, -800}, { 1176, 608, -808}, { 1080, 528, -640}, { 1344, 568, -544}, { 1336, 440, -472}, { 1224, 280, -400}, { 992, 128, -304}, { 960, 80, -288}, { 1104, 136, -216}, { 1336, 176, -248}, { 1600, 136, -176...
{ 1120, 168, -200}, { 1256, 160, -248}, // 160 seconds { 1352, 160, -136}, { 1128, 160, -176}, { 1000, 56, -256}, { 832, -248, 96}, { 528, -256, -200}, { 856, -32, -384}, { 1192, -48, -384}, { 1088, 144, -464}, { 880, 96, -456}, { 936, 272, -368}, { 1144, 384, -38...
{ 1056, 720, -488}, { 984, 768, -536}, { 848, 608, -424}, { 1320, 808, -640}, { 1240, 624, -352}, { 1208, 600, -392}, { 1296, 472, -384}, { 1176, 408, -280}, { 968, 216, -248}, { 936, 200, -264}, { 1048, 192, -224}, { 1144, 112, -216}, // 163 seconds { 1368, 128,...
return FRAMEBUFFER_SIZE_BYTES; } /////////////////////////////////////////////////////////// // Tests void test_word_iterator__initialize(void) { framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); } void test_word_iterator__test_stri...
(*word_iter_state.current.end == '\0')
; cl_assert(!iter_next(&word_iter)); } void test_word_iterator__test_string_terminating_newlines(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...
ation_dialog); dialog_set_text(dialog, i18n_get("Done", data)); dialog_set_icon(dialog, RESOURCE_ID_RESULT_SHREDDED_LARGE); static const uint32_t DIALOG_TIMEOUT = 2000; dialog_set_timeout(dialog, DIALOG_TIMEOUT); // Set the app exit reason so we will go to the watchface upon exit app_exit_reason_set(APP_EX...
(ctx, icon, icon_rect.origin)
ess Timeline"; } #else GColor color; if (app_id == INSTALL_ID_INVALID) { text = "Install an app to continue or press up / down to browse the timeline"; color = GColorChromeYellow; } else { text = "Press select to launch your app or press up / down to browse the timeline"; color = GColorPictonBlu...
window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite))
; tick_timer_service_subscribe(SECOND_UNIT, prv_handle_tick_timer); #endif prv_update_ui(data); app_window_stack_push(window, true /* is_animated */); } static void s_main(void) { prv_init(); app_event_loop(); } const PebbleProcessMd* sdk_app_get_info(void) { static const PebbleProcessMdSystem s_app_md...
/* * 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...
(decoded_codepoint, actual_codepoint)
+i) { int16_t output = ~0; jerry_value_t v = jerry_create_number(cases[i].input); JERRY_ARGS_MAKE(v); ROCKY_ARGS_ASSIGN(ROCKY_ARG(output)); cl_assert_equal_i(output, cases[i].expected_output); ASSERT_JS_ERROR(error_value, NULL); jerry_release_value(v); } } void test_rocky_api_util_args__n...
cl_assert_equal_i(u64, (uint64_t)c->u64)
; cl_assert_equal_i(s8, (int8_t)c->s8); cl_assert_equal_i(s16, (int16_t)c->s16); cl_assert_equal_i(s32, (int32_t)c->s32); cl_assert_equal_i(s64, (int64_t)c->s64); cl_assert_equal_d(d, (double)c->d); } JERRY_ARGS_RELEASE(); } } void test_rocky_api_util_args__number_type_mismatch(...
, { 844, 352, -15}, { 873, 367, -7}, { 1153, 436, -37}, { 1259, 422, -19}, { 1415, 468, 29}, { 1525, 524, 0}, { 1304, 427, 82}, { 1157, 397, 73}, { 1114, 367, 75}, { 965, 284, 129}, { 849, 214, 159}, { 787, 153, 169}, { 780, 160, 178}, { 769, 154, 171}, { 730,...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-08-11 22:02:59 GMT AccelRawData *activity_sample_200_steps(int *len) { //> TEST_NAME walk_200 //> TEST_EXPECTED 200 //> TEST_EXPECTED_MIN 190 //> TEST_EXPECTED_MAX 210 //> TEST_WEIGHT 1.0 st...
KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* This file should probably go in the stm32f4 folder */ #include "drivers/pmic.h" #include "board/board.h" #include "console/prompt.h" #include "drivers/battery.h" #include "...
(s_mon_config_mutex)
; } static void prv_mon_config_unlock(void) { mutex_unlock(s_mon_config_mutex); } static bool prv_read_register(uint8_t register_address, uint8_t *result) { i2c_use(I2C_MAX14690); bool rv = i2c_read_register(I2C_MAX14690, register_address, result); i2c_release(I2C_MAX14690); return (rv); } static bool prv_...
fake_comm_session_is_latency_reduced()
, false); } void test_music_endpoint__low_latency_for_period(void) { // Android app connects: prv_receive_app_info_event(true /* is_android */); cl_assert_equal_i(fake_comm_session_get_responsiveness_max_period(), 0); music_request_low_latency_for_period(2000); cl_assert_equal_i(fake_comm_session_get_respon...
----------------------------------------- // Log minute data to PBL_LOG // @param earliest_wake_time ignore any sleep cycles that end before this time. bool activity_algorithm_dump_minute_data_to_log(void) { if (!prv_lock()) { return false; } bool success = false; SettingsFile *file = NULL; // Open the ...
{ bool need_close = false; bool nuke_file = false; // Reset total # of records we have. We will update this after we scan the file s_alg_state->num_minute_records = 0; // Open settings file containing our minute data if (file == NULL) { need_close = true; file = prv_minute_data_file_open(); if...
PBL_LOG(LOG_LEVEL_WARNING, "Detected invalid minute data file, deleting it"); pfs_remove(ALG_MINUTE_DATA_FILE_NAME); } return file; } // ------------------------------------------------------------------------------------- static void prv_init_minute_record(AlgMinuteRecordHdr *hdr, time_t utc_sec, bool f...
(text, text_len, "%d:%02d", (int)hour, (int)minute)
; } // ----------------------------------------------------------------------------------------- static void prv_display_alert(const char *text) { ExpandableDialog *expandable_dialog = expandable_dialog_create("Alert"); dialog_set_text(expandable_dialog_get_dialog(expandable_dialog), text); expandable_dialog_sh...
P_ID); if (found) { PBL_LOG(LOG_LEVEL_DEBUG, "Found the as3701b"); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error: read as3701b whoami byte 0x%x, expecting 0x11", chip_id); } return found; } static void prv_set_sd1_voltage(void) { // STM32F4 running at 1.76V may trigger a Power Down Reset (PDR). The power ...
(PmicRegisters_CHARGE_STATUS_1, &status)
824, 312}, { -40, 1000, 424}, { 112, 1200, 488}, { 192, 1400, 768}, { 312, 1296, 840}, { 312, 1024, 360}, { 176, 688, 168}, { 112, 528, 232}, { 72, 520, 312}, { -32, 584, 304}, { -40, 744, 312}, { -8, 720, 344}, { -48, 832, 264}, { -32, 864, 224}, { -64, 944, 208}...
{ -24, 872, 320}, { 40, 1160, 432}, { 184, 1200, 384}, { 136, 1376, 696}, { 248, 1304, 640}, { 248, 1056, 352}, { 240, 760, 160}, { 144, 624, 216}, { 120, 504, 264}, { 16, 608, 208}, { -16, 624, 256}, { -24, 720, 248}, { -88, 776, 216}, { -120, 848, 200}, { -1...
{ -48, 952, 72}, { -72, 1040, 152}, { -88, 1120, 288}, // 63 seconds { -80, 1208, 376}, { 56, 1408, 680}, { 152, 1264, 416}, { 24, 712, 248}, { -128, 608, 256}, { -32, 728, 368}, { 64, 840, 432}, { 0, 792, 280}, { -80, 672, 200}, { -128, 648, 232}, { -96, 752...
ey), &s_activity_state.logged_sleep_activity_exit_at_utc, sizeof(s_activity_state.logged_sleep_activity_exit_at_utc)); key = ActivitySettingsKeyLastRestfulSleepActivityUTC; settings_file_get(file, &key, sizeof(key), &s_activity_state.logged_restful_sleep_...
{ return activity_prefs_heart_rate_is_enabled(); }
// ------------------------------------------------------------------------------------------------ typedef struct { HealthMinuteData *minute_data; uint32_t *num_records; time_t *utc_start; bool success; bool completed; } ActivityGetMinuteHistoryContext; static void prv_get_minute_history_system_cb(void *...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(APP_RECORDS)
; i++) { if (APP_RECORDS[i].id == id) { if (record_order_out) { *record_order_out = i + 1; } return &APP_RECORDS[i]; } } return NULL; } // optimization: sort the UUID's and then search more quickly. This will most likely // require many changes to the JSON generation script. AppIn...
const uint8_t *data, size_t length) { cl_assert_equal_p(receiver, s_kernel_receiver); memcpy(s_kernel_receiver_buffer + s_kernel_receiver_buffer_idx, data, length); s_kernel_receiver_buffer_idx += length; cl_assert(s_kernel_receiver_buffer_idx <= MAX_HEADER_SIZE); } static void prv_de...
s_rcv_imp->cleanup(r)
; cl_assert_equal_b(false, s_kernel_receiver_is_receiving); cl_assert_equal_b(true, s_kernel_receiver_cleanup_called); } void test_app_message_receiver__receive_push_but_inbox_not_opened_kernel_oom(void) { fake_kernel_malloc_set_largest_free_block(0); Receiver *r = s_rcv_imp->prepare(s_session, &s_app_message...
char *file, int line) { for (int i = 0; i < num_sessions; i++) { if (sessions[i].activity == exp_session->activity && sessions[i].start_utc == exp_session->start_utc && sessions[i].len_minutes == exp_session->len_minutes && sessions[i].active_calories == exp_session->active_calories...
{ if (s_stat_rows == NULL) { return; } StatsRow *stats = (StatsRow *)list_get_tail(&s_stat_rows->node); cl_assert(stats != NULL); bool found = 0; for (int i = 0; i < s_stats_num_columns; i++) { if (strcmp(s_stats_column_names[i], name) == 0) { found = true; stats->values[i] = value; ...
// --------------------------------------------------------------------------------------- // Write out accumulated stats to a csv file static void prv_stats_write(const char* filename, bool create, const char *test_name, bool is_stepping) { if (!s_stat_rows) { return; } FILE *...
0}, { 48, 8, -1000}, { 48, 8, -1000}, { 40, 0, -1000}, { 48, 8, -1008}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 40, 8, -1000}, { 40, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, ...
{ 48, 8, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 8, -1008}, { 48, 8, -1008}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 40, 0, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, {...
{ 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 40, 0, -1000}, { 48, 8, -1000}, { 40, 8, -1000}, { 48, 8, -1008}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 8, -1008}, { 48, 8, -1000}, { 48, 0, -1008}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1008}, ...
icon_pos = { ICON_POSITION_X, PBL_IF_RECT_ELSE(11, 22) }, .caller_id_pos_y = PBL_IF_RECT_ELSE(80, 88), .caller_id_height = 60, .status_pos_y = PBL_IF_RECT_ELSE(138, 144), .status_height = 20, .large_caller_id = true, }; static const PhoneStyle *s_phone_styles[NumPreferredContentSizes] = { [PreferredContent...
(&s_phone_ui_data->icon_layer, kino_reel, true)
; kino_layer_play(&s_phone_ui_data->icon_layer); s_phone_ui_data->current_icon = image; s_phone_ui_data->current_icon_id = resource; #else kino_layer_set_reel(&s_phone_ui_data->icon_layer, image, true); s_phone_ui_data->current_icon = image; s_phone_ui_data->current_icon_id = resource; #endif } #if !PLATFO...
e the type is valid switch (session->type) { case ActivitySessionType_Sleep: case ActivitySessionType_RestfulSleep: case ActivitySessionType_Nap: case ActivitySessionType_RestfulNap: case ActivitySessionType_Walk: case ActivitySessionType_Run: case ActivitySessionType_Open: break; ...
if (prv_activity_sessions_equal(session, stored_session, false /*any_sleep*/)) { found_session_idx = i; break; }
g.h> // Helper Functions //////////////////////////////////// // Stubs //////////////////////////////////// // Tests //////////////////////////////////// //////////////////////////////////////////////////////////////// /// Fixed_S16_3 = 1 bit sign, 12 bits integer, 3 bits fraction //////////////////////////////////...
(num.fraction == 1)
; test_num = (int32_t)((float)0.250 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == 0); cl_assert(num.fraction == 2); test_num = (int32_t)((float)0.375 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.i...
b.h" #include "stubs_sleep.h" #include "stubs_task_watchdog.h" const char *timeline_get_private_data_source(Uuid *parent_id) { return NULL; } static TimelineItem item1 = { .header = { .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4}, .pare...
((uint8_t *)&reminder_app_item.header.id, sizeof(TimelineItemId))
frame, compensate if needed if (selection_layer->selected_cell_idx == i && selection_layer->bump_is_upwards) { y_offset -= prv_get_pixels_for_bump_settle(selection_layer->bump_settle_anim_progress); } // If we are performing an increment or decrement animation then update the ...
(&selection_layer->layer)
; } static void prv_bump_settle_stopped(Animation *animation, bool finished, void *context) { SelectionLayer *selection_layer = (SelectionLayer*) animation_get_context(animation); selection_layer->bump_settle_anim_progress = 0; } static Animation* prv_create_bump_text_animation(SelectionLayer *selection_layer) { ...
b/app.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/ui.h" #include "applib/voice/transcription_dialog.h" #include "applib/voice/voice_window.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include ...
dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT)
prv_receive_abort(uint32_t cookie) { AbortRequest abort_msg = (AbortRequest) { .cmd = CmdAbort, .cookie = htonl(cookie), }; prv_receive_data(s_session, (const uint8_t *) &abort_msg, sizeof(abort_msg)); } static void prv_receive_install(uint32_t cookie) { InstallRequest install_msg = (InstallRequest) { ...
put_bytes_init()
; } void test_put_bytes__cleanup(void) { put_bytes_deinit(); fake_comm_session_cleanup(); fake_system_task_callbacks_cleanup(); fake_event_clear_last(); fake_pbl_malloc_check_net_allocs(); fake_pbl_malloc_clear_tracking(); } ///////////////////////////////////////////////////////////////////////////////...
ced(&storage->file, key, key_len); } mutex_unlock(storage->mutex); return rv; } int timeline_item_storage_get_len(TimelineItemStorage *storage, const uint8_t *key, int key_len) { mutex_lock(storage->mutex); status_t rv = settings_file_get_len(&storage->file, key, key_len); mutex_unlock(storage->mute...
{ mutex_lock(storage->mutex); status_t rv = settings_file_rewrite(&storage->file, prv_flush_rewrite_cb, NULL); mutex_unlock(storage->mutex); return rv; }
+ (num_bits / 8)); } static void *CONTEXT = (void *)0xabcdabcd; static const char *NEW_STRING = "Bye, bye, World"; static bool is_int8_updated = false; static bool is_string_updated = false; static bool should_update_existing_keys_only = false; static bool test_not_enough_storage = false; static bool is_data_updated ...
cl_assert(memcmp(tuple->value->data, SOME_DATA, sizeof(SOME_DATA)) == 0)
{ if (s_circular_buffer[client] == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "App attempted to consume notifications without buffer."); return false; } return true; }
// ------------------------------------------------------------------------------------------------- bool prv_get_next_notification_header(GAPLEClient client, GATTBufferedNotificationHeader *header_out) { bool has_notification = false; GATTBufferedNotificationHeader header; ...
/* * 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...
atol(" 765")
ication: // make icon hidden (return true) if app has not recently communicated return !app_install_is_prioritized(entry->install_id); case ProcessVisibilityShown: return false; case ProcessVisibilityQuickLaunch: return true; } return false; } bool app_install_entry_is_quick_launch_...
if (id != INSTALL_ID_INVALID) { return id; }
return INSTALL_ID_INVALID; } static void prv_app_install_delete(AppInstallId id, Uuid *uuid, bool app_upgrade, bool delete_cache) { if (!app_upgrade) { // remove settings associated with the app pin_db_delete_with_parent(uuid); } if (delete_cache) { // only log...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_initialized) { return; }
s_mag_mutex = mutex_create(); s_initialized = true; if (!mag3110_check_whoami()) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to query Mag"); } gpio_input_init(&BOARD_CONFIG_MAG.mag_int_gpio); exti_configure_pin(BOARD_CONFIG_MAG.mag_int, ExtiTrigger_Rising, mag3110_interrupt_handler); } void mag_use(void) ...
loat our PebbleEvent unecessarily. If you hit this // assert and you have a good reason for making the event bigger, feel free to relax the restriction. //PBL_LOG(LOG_LEVEL_DEBUG, "PebbleEvent size is %u", sizeof(PebbleEvent)); // FIXME: _Static_assert(sizeof(PebbleEvent) <= 12, "You made the P...
{ void **buffer = event_get_buffer(event); if (buffer && *buffer) { kernel_free(*buffer); *buffer = NULL; } }
void event_put(PebbleEvent* event) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; // If we are posting from the KernelMain task, use the dedicated s_from_kernel_event_queue queue for that // See comments above where s_from_kernel_event_queue is declared. if (pebble_task_get_current() == Pebbl...