prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
f the log file to find //! @param[out] start_page_addr - the address of the page the log starts on //! @return the number of pages in the log file requested or 0 if no //! file is found static int prv_get_start_of_log_file(uint8_t log_file_id, uint32_t *start_page_addr) { uint8_t num_log_pages = 0; uint8_t pr...
if (!new_log_region_found) { if (multiple_gens_found || (prv_get_start_of_log_file(prev_log_id, &s_curr_state.page_start_addr) == 0)) { s_curr_state.page_start_addr = FLASH_REGION_DEBUG_DB_BEGIN; } s_curr_state.page_start_addr = prv_get_unit_base_address(s_curr_state.page_start_addr); prv...
ield_number, const pb_msgdesc_t * fields, const void *msg) { // Encode the field tag and data type if (!pb_encode_tag(stream, PB_WT_STRING, field_number)) { return false; } return pb_encode_submessage(stream, fields, msg); } // ------------------------------------------------...
(types_copy, config->measurements.types, extra_space)
in dls_list_for_each_session //! @param empty_all_data A bool that indicates if the session should be force emptied static bool prv_send_session(DataLoggingSession *logging_session, void *empty_all_data) { dls_private_send_session(logging_session, (bool) empty_all_data); return true; } //! @param empty_all_data A...
PBL_ASSERTN(logging_session->item_size <= num_bytes)
; num_bytes -= (num_bytes % logging_session->item_size); uint32_t new_read_offset; int32_t read_bytes = dls_storage_read(logging_session, buffer, num_bytes, &new_read_offset); if (read_bytes < 0) { goto exit; } PBL_ASSERTN((uint32_t)read_bytes <= DLS_ENDPOINT_MAX_PAYLOAD); unsigned int leftover_byte...
/* * 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 (++i > QSPI_WAIT_TIME) { break; } }
oid prv_change_state(BacklightState new_state) { s_light_state = new_state; // Calculate the new brightness and reset any timers based on our state. int32_t new_brightness = 0; switch (new_state) { case LIGHT_STATE_ON: new_brightness = prv_backlight_get_intensity(); new_timer_stop(s_timer_id); ...
if (s_num_buttons_down == 0) { // reset the state if someone calls light_enable(false); // (unless there are buttons pressed, then leave the backlight on) prv_change_state(LIGHT_STATE_OFF); }
mutex_unlock(s_mutex); } void light_enable_respect_settings(bool enable) { mutex_lock(s_mutex); s_user_controlled_state = enable; if (enable) { if (prv_light_allowed()) { prv_change_state(LIGHT_STATE_ON); } } else if (s_num_buttons_down == 0) { prv_change_state(LIGHT_STATE_OFF); } ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (!button_is_pressed(button_id)) { button_counter[button_id] = 0; continue; } if (button_counter[button_id] >= STUCK_BUTTON_THRESHOLD) { dbgserial_putstr("Stuck button register is invalid, clearing."); dbgserial_print_hex(button_counter_register); RTC_WriteBackupRegister(...
if (button_counter_register != 0) { dbgserial_print("Button was pushed on boot. Button counter: "); dbgserial_print_hex(button_counter_register); dbgserial_newline(); } RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, button_counter_register); return result; } bool boot_test_is_flash_broken(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...
(true /* should_shutdown */)
; } static void decline_click_handler(ClickRecognizerRef recognizer, Window *window) { const bool animated = true; app_window_stack_pop(animated); (void)recognizer; (void)window; } static void config_provider(Window *window) { window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler) confirm_click_handler)...
te->num_samples++; samples_drained++; } // If buffer is full, notify subscriber to process it if (!state->event_posted && state->num_samples >= state->samples_per_update) { // Notify the subscriber that data is available state->event_posted = prv_call_data_callback(state); ACCEL_...
(s_accel_manager_mutex)
; AccelDriverSample data; int result = accel_peek(&data); if (result == 0 /* success */) { prv_copy_accel_sample_to_accel_data(&data, accel_data); prv_update_last_accel_data(&data); } mutex_unlock_recursive(s_accel_manager_mutex); return result; } DEFINE_SYSCALL(AccelManagerState*, sys_accel_man...
_cache(ActionMenuLayer *aml, int selected_index) { prv_unschedule_item_animation(aml); if (aml->layout_cache.item_heights != NULL) { applib_free(aml->layout_cache.item_heights); aml->layout_cache.item_heights = NULL; } if (aml->num_items > 0) { // Update the cache of heights. We do this here to a...
{ if (!aml) { return; } action_menu_layer_deinit(aml); applib_free(aml); }
void action_menu_layer_set_align(ActionMenuLayer *aml, ActionMenuAlign align) { if (!aml) { return; } aml->layout_cache.align = align; } void action_menu_layer_set_items(ActionMenuLayer *aml, const ActionMenuItem* items, int num_items, unsigned default_selected_item, unsign...
/* * 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...
(84, 92, 60, 60)
ww.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 CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions...
{ qspi_flash_init(QSPI_FLASH, &QSPI_FLASH_PART, coredump_mode); #if BOARD_CUTTS_BB || BOARD_ROBERT_BB || BOARD_ROBERT_EVT prv_set_high_drive_strength(); #endif return S_SUCCESS; }
status_t flash_impl_get_erase_status(void) { return qspi_flash_is_erase_complete(QSPI_FLASH); } status_t flash_impl_erase_subsector_begin(FlashAddress subsector_addr) { return qspi_flash_erase_begin(QSPI_FLASH, subsector_addr, true /* is_subsector */); } status_t flash_impl_erase_sector_begin(FlashAddress sector...
----------- // Sample captured: 2015-10-05 16:04:24 local AccelRawData *activity_sample_walk_200_pbl_25657_10(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25657_10 //> TEST_EXPECTED 200 //> TEST_EXPECTED_MIN 165 //> TEST_EXPECTED_MAX 230 //> TEST...
{ -400, 256, -8}, { -400, 160, 48}, { -400, 136, -40}, { -560, 256, 8}, { -664, 160, 48}, // 5 seconds { -888, 184, 40}, { -1272, 288, -24}, { -1128, 144, 8}, { -1288, 384, -200}, { -1144, 216, -224}, { -1216, 72, -112}, { -1048, 240, -288}, { -600, 264, -248}, ...
{ -288, 64, -56}, { -272, 272, -240}, { -248, 376, -184}, { -400, 288, -112}, { -648, 248, -64}, { -856, 312, -176}, { -1024, 408, -104}, { -1232, 448, -208}, { -1136, 448, -88}, { -1536, 720, -400}, { -1384, 408, -208}, { -1048, 48, 32}, { -1128, 416, 0}, { -712...
{ register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_calloc(task_heap_get_for_current_task(), count, size, saved_lr); }
MFG where we have the command_pmic_rails function. #ifdef RECOVERY_FW { "+VSYS", 4, 0b010 }, // 4:1 { "+1V2", 1, 0b011 }, // 1:1, BUCK1 { "+1V8", 2, 0b100 }, // 2:1, BUCK2 { "+2V0_RTC", 2, 0b101 }, // 2:1, LDO1 { "+3V2", 2, 0b110 }, // 2:1, LDO2 #ifdef BOARD_SNOWY_BB { "+...
delay_us(200)
; return result; } bool pmic_enable_battery_measure(void) { prv_mon_config_lock(); return prv_set_mon_config(&MON_CONFIG[PMIC_MON_CONFIG_VBAT_INDEX]); // Don't prv_unlock, we don't want anyone else mucking with the mon config until // pmic_disable_battery_measure is called. } bool pmic_disable_battery_me...
} handler(recognizer, context); } if (needs_reset) { prv_click_reset(recognizer); } return true; } else { return false; } } inline static bool prv_is_hold_to_repeat_enabled(ClickRecognizer *recognizer) { return (recognizer->config.click.repeat_interval_ms >= 30); } inline...
(recognizer, ClickHandlerOffsetLong, needs_reset)
; } //! Called at the end of a click pattern, either on the button up, or after a multi-click timeout: static void prv_click_pattern_done(ClickRecognizer *recognizer) { // In case multi_click is also configured, if there was only one click, regard it as // a "single click" after the multi-click timeout passed and ...
/* * 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...
(RTC_BKP_FLASH_ERASE_PROGRESS, 0)
; return S_SUCCESS; } status_t flash_impl_get_nvram_erase_status(bool *is_subsector, FlashAddress *addr) { uint32_t reg = RTC_ReadBackupRegister(RTC_BKP_FLASH_ERASE_PROGRESS); if (reg == 0) { return S_FALSE; } *addr = reg & ERASE_ADDRESS_MASK; *is_subsector =...
D_REQUEST_POLL = 0x3, } PollRemoteCommand; // Deprecated -- used to set the mail poll interval typedef struct PACKED { uint8_t cmd; uint8_t interval_minutes; } PollLegacySetIntervalMessage; // Poll a service at a specific interval typedef struct PACKED { PollRemoteCommand cmd; PollRemoteService service; uin...
PBL_LOG(LOG_LEVEL_ERROR, "Invalid command.")
; return; } } } /* * Public */ static void poll_service_system_task_callback(void *data) { PBL_ASSERTN(s_running); for_each_context(context_interval_check); } static void poll_service_timer_callback(void *data) { system_task_add_callback(poll_service_system_task_callback, data); } void poll_remo...
/* * 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 ram_storage_flush(&s_test_db.ram_storage); }
status_t test_db_is_dirty(bool *is_dirty_out) { return ram_storage_is_dirty(&s_test_db.ram_storage, is_dirty_out); } bool prv_dirty_items_each_cb(RamStorageEntry *entry, void *context) { BlobDBDirtyItem **dirty_items = context; if (entry->flags & RamStorageFlagDirty) { BlobDBDirtyItem *new_item = kernel_za...
); prv_set_day_sep_timer(data); } static void prv_up_down_click_handler(ClickRecognizerRef recognizer, void *context) { TimelineAppData *data = context; prv_inactive_timer_refresh(data); ButtonId button = click_recognizer_get_button_id(recognizer); const bool next = (button == BUTTON_ID_UP) ^ (data->t...
timeline_model_get_iter_state(i)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ memcpy(key_out, &s_retrieved_keys[key_type], sizeof(*key_out)); }
return rv; } static SM128BitKey s_stored_keys[SMRootKeyTypeNum]; void bt_persistent_storage_set_root_keys(SM128BitKey *keys_in) { cl_mock_type(void); memcpy(s_stored_keys, keys_in, sizeof(SM128BitKey) * SMRootKeyTypeNum); } static uint32_t s_rng_output; #define RNG_ROUNDS (sizeof(SM128BitKey) / sizeof(uint32_t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (!s_paused_reconnect_because_repairing) { bt_driver_reconnect_pause(); s_paused_reconnect_because_repairing = true; }
graphics_draw_bitmap_in_rect(ctx, bitmap, &destination); } static void prv_composite_test(const char *unit_test_name, GCompOp compositing_mode) { for (size_t i = 0; i < ARRAY_LENGTH(s_composite_tests); i++) { const CompositeTest *test_data = &s_composite_tests[i]; // Skip invalid GBitmapFormat and GCompO...
(GPointZero)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_layer_across_x(void) { prv_offset_layer_test(GPoint(25, 0)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_layer_across_nx(void) { prv_offset_layer_te...
event); rocky_api_graphics_path2d_reset_state(); } JERRY_FUNCTION(prv_request_draw) { Window *const top_window = app_window_stack_get_top_window(); if (!top_window) { return jerry_create_undefined(); } layer_mark_dirty(&top_window->layer); return jerry_create_undefined(); } GContext *rocky_api_graphi...
rocky_api_graphics_get_gcontext()
->draw_state.stroke_color); } JERRY_FUNCTION(prv_set_fill_style) { return prv_graphics_set_color(argc, argv, graphics_context_set_fill_color); } JERRY_FUNCTION(prv_get_fill_style) { return prv_graphics_get_color_string(rocky_api_graphics_get_gcontext()->draw_state.fill_color); } JERRY_FUNCTION(prv_fill_radial) {...
olorBlack.argb); #endif color.a = 2; graphics_context_set_stroke_color(&context, color); #if PBL_COLOR cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlue.argb); #else cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlack.argb); #endif color.a = 1; graphics_context_set_stroke_...
graphics_line_draw_1px_aa(&context, GPoint(5, 5), GPoint(45, 10))
); #else ASSERT_CALLED(graphics_line_draw_1px_non_aa(&context, GPoint(5, 5), GPoint(45, 10))); #endif setup_test(&context, true, 1, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context, tru...
.stopped = prv_stopped_handler_check_finished }; animation_set_handlers(a, handlers, animation_get_context(a)); animation_set_duration(a, duration_a); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(a); // Seek to just after the end of the second A prv_advance_to_m...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
applib_malloc(sizeof(AngleLookupContext))
; if (!ctx) { return NULL; } *ctx = (AngleLookupContext) { .angle = angle, .num_delay_groups = num_delay_groups, .group_delay = group_delay, }; if (!ctx->angle) { ctx->angle = rand() % TRIG_MAX_ANGLE; } KinoReel *reel = kino_reel_scale_segmented_create(from_reel, take_ownership, scree...
uccess && evt->bond) { // Sync the new bonding: bonding_sync_handle_pairing_completed(conn, conn_idx); } BTDeviceInternal device = {}; connection_get_address(conn, &device); hc_endpoint_pairing_send_pairing_complete(&device, evt->status); } // Convert to BT Spec error codes and update P...
(LOG_LEVEL_DEBUG, "hope for the best")
; connection_module_init(); prv_configure_irk(init_info->config); ble_error_t e = ble_enable(); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_enable: %u", e); } PBL_LOG(LOG_LEVEL_DEBUG, "go go go"); ble_register_app(); advert_init(); local_addr_init(); // Do all the things that cl...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ FrameBuffer *fb = compositor_get_framebuffer(); s_current_flush_line = MAX(s_current_flush_line, fb->dirty_rect.origin.y); const uint8_t y_end = fb->dirty_rect.origin.y + fb->dirty_rect.size.h; if (s_current_flush_line < y_end) { row->address = s_current_flush_line; void *fb_line = framebuffer_get_li...
//! display_update complete callback static void prv_flush_complete_cb(void) { s_current_flush_line = 0; framebuffer_reset_dirty(compositor_get_framebuffer()); if (s_update_complete_handler) { s_update_complete_handler(); } } void compositor_display_update(void (*handle_update_complete_cb)(void)) { if...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(false /* disconnected */)
; check_disconnected(); //! Get connected event prv_send_connection_event(true); // Event put prv_assert_event_received(true); check_connected(); } void test_debounced_connection_service__connected_to_connected(void) { init(true /* connected */); check_connected(); //! Get connected event prv...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uint32_t* line = framebuffer_get_line(f, y); memcpy(line, buffer, num_lines * FRAMEBUFFER_WORDS_PER_ROW); const GRect dirty_rect = GRect(0, y, DISP_COLS, num_lines); framebuffer_mark_dirty_rect(f, dirty_rect); }
------------------------------------------------------- // Structures typedef struct { char dialog_text[256]; SimpleMenuItem *menu_items; SimpleMenuLayer *menu_layer; } DebugCard; // App globals typedef struct { Window *debug_window; DebugCard debug_card; uint32_t steps_offset; uint32_t cur_steps; } Act...
snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Current steps changed to: %"PRIu32"\n", data->cur_steps)
; prv_display_alert(data->debug_card.dialog_text); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_tracking(int index, void *context) { ActivityDemoAppData *data = context; bool enabled = activity_tracking_on(); enabled = !enabled; i...
/* * 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...
process_manager_compiled_with_legacy2_sdk()
) { bitmap->info.version = GBITMAP_VERSION_0; } bitmap->info.version = GBITMAP_VERSION_CURRENT; } uint8_t gbitmap_get_version(const GBitmap *bitmap) { if (process_manager_compiled_with_legacy2_sdk()) { return GBITMAP_VERSION_0; } return bitmap->info.version; } // indirection to allow conditional moc...
1.8V PmicRail_LDO1, //!< 2.0V - Auto - RTC PmicRail_LDO2, //!< 3.2V - Manual - FPGA //! snowy_bb: 2.5V - Manual - MFi, Magnetometer //! snowy_evt: 1.8V - Manual - MFi PmicRail_LDO3 } PmicRail; //! Gives configuration information for reading a given rail through the monitor pin. typedef struct { const char...
{ // Set the register byte to XXXXX00X to disable the rail, just mask register_value = (register_value & ~0x06); success = prv_write_register(rail_control_reg, register_value); if (success) { // We disabled the rail! *ref_count = 0; return true; } return fal...
else { (*ref_count)--; return true; } } } bool pmic_power_off(void) { bool ret = prv_write_register(PmicRegisters_PWR_CFG, 0xB2); if (ret) { // Goodbye cruel world. The PMIC should be removing our power at any time now. while(1); __builtin_unreachable(); } return false; } sta...
//////////////////////////// void test_rocky_api_app_message__receive_message_multi_chunk(void) { prv_init_and_goto_session_open_with_tiny_buffers(); EXECUTE_SCRIPT("var event = null;\n" "var json_str = null;\n" "_rocky.on('message', function(e) {\n" " json_str =...
(app_timer_trigger(t), true)
, 0x0 }); cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, }; // Init mutable types word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start); // Tests cl_assert(word_iter_state.current.start == word_iter_state....
iter_next(&word_iter)
); cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == '\0'); cl_assert(!iter_next(&word_iter)); }
nt to indicate a lookup of the current task #define PEBBLE_TASK_CURRENT PebbleTask_Unknown #define US_PER_SECOND (1000 * 1000) typedef void (*ProcessDataHandler)(CallbackEventCallback *cb, void *data); // We create one of these for each data service subscriber typedef struct AccelManagerState { ListNode list_node;...
PBL_ASSERTN(s_double_tap_subscribers_count > 0)
; if (--s_double_tap_subscribers_count == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Stopping accel double tap service"); accel_enable_double_tap_detection(false); prv_setup_subsampling(accel_get_sampling_interval()); } mutex_unlock_recursive(s_accel_manager_mutex); } //! Out of all accel subscribers, figures ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_ERROR, "BT driver failed to start!")
; // FIXME: PBL-36163 -- handle this better } stop_mode_enable(InhibitorCommMode); } static void prv_comm_stop(void) { if (!s_comm_is_running) { return; } stop_mode_disable(InhibitorCommMode); #if CAPABILITY_HAS_BUILTIN_HRM ble_hrm_deinit(); #endif gap_le_deinit(); // Should be the last thing...
logging_session->data->buffer_storage, buf_size); shared_circular_buffer_add_client(&logging_session->data->buffer, &logging_session->data->buffer_client); } else { // non buffered sessions can only be created/used from KernelBG PBL_ASSERT_TAS...
{ #if !RELEASE // TODO: We should be able to remove this requirement once PBL-23925 is fixed // // Some datalogging code holds the dls_list.c:s_list_mutex while taking the // bt_lock. Since we are locking the list and then trying to get the bt_lock, // any other thread which holds the bt_lock and then trys to...
if (shared_circular_buffer_get_write_space_remaining(&session->data->buffer) < num_bytes) { result = DATA_LOGGING_BUSY; goto unlock_and_exit; } shared_circular_buffer_write(&session->data->buffer, data, num_bytes, false /*advance_slackers*/); // Only enqueue work on the...
/* * 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...
{ uint8_t value; // Registers are read when the address MSB=1 reg |= BMI160_READ_FLAG; SPIScatterGather sg_info[2] = { {.sg_len = 1, .sg_out = &reg, .sg_in = NULL}, // address {.sg_len = 1, .sg_out = NULL, .sg_in = &value} // 8 bit register read }; spi_slave_burst_read_write_scatter(BMI160_SPI, sg_i...
uint16_t bmi160_read_16bit_reg(uint8_t reg) { // 16-bit registers are in little-endian format uint16_t value; reg |= BMI160_READ_FLAG; SPIScatterGather sg_info[2] = { {.sg_len = 1, .sg_out = &reg, .sg_in = NULL}, // address {.sg_len = 2, .sg_out = NULL, .sg_in = &value} // 16 bit register read }; ...
data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Step activities\n"); // Print info on each one ActivitySession *session = sessions; for (uint32_t i = 0; i < num_sessions; i++, session++) { char *prefix = ""; switch (session->type) { case ActivitySessionType_Sleep: ...
(minute_data, &chunk, &utc_start)
; if (!success) { snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Failed"); prv_display_alert(data->debug_card.dialog_text); goto exit; } PBL_LOG(LOG_LEVEL_DEBUG, "Got %d minutes with UTC of %d (delta of %d min)", (int)chunk, (int)ut...
ode qspi_mmap_stop(dev->qspi); } static void prv_read_mmap(QSPIFlash *dev, uint32_t addr, void *buffer, uint32_t length) { uint8_t instruction; uint8_t dummy_cycles; bool is_ddr; prv_get_fast_read_params(dev, &instruction, &dummy_cycles, &is_ddr); prv_read_mmap_with_params(dev, addr, buffer, length, instr...
(dev, &instruction, &dummy_cycles, &is_ddr)
; qspi_mmap_start(dev->qspi, instruction, addr, dummy_cycles, size_bytes, is_ddr); // Point the buffer at the QSPI region uint32_t const volatile * const buffer = (uint32_t *)(QSPI_MMAP_BASE_ADDRESS + addr); uint32_t size_words = size_bytes / sizeof(uint32_t); for (uint32_t i = 0; i < size_words; ++i) { ...
g %s", task_name); pebble_task_create(PebbleTask_Worker, &task_params, &s_worker_task_context.task_handle); // If no default yet, set as the default so that it can be relaunched upon system reset if (worker_manager_get_default_install_id() == INSTALL_ID_INVALID) { worker_manager_set_default_install_id(s_wor...
if ((closing_worker_install_id == s_last_worker_crashed_install_id) && ((current_time - s_last_worker_crash_timestamp) <= WORKER_CRASH_RESET_TIMEOUT_SECONDS)) { // Reset the data tracking the last worker that crashed since we are going to show crash UI prv_reset_last_worker_crashed_data(); // ...
} } // ------------------------------------------------------------------------------------------------ const PebbleProcessMd* worker_manager_get_current_worker_md(void) { return s_worker_task_context.app_md; } // ------------------------------------------------------------------------------------------------ Ap...
state = upng_decode_image(upng); if (upng_state != UPNG_EOK) { APP_LOG(APP_LOG_LEVEL_ERROR, (upng_state == UPNG_ENOMEM) ? PNG_MEMORY_ERROR : PNG_DECODE_ERROR); goto cleanup; } // Use UPNG to decode image and get data uint32_t width = upng_get_width(upng); uint32_t height = upng_get_height(upng); ui...
applib_malloc(padded_palette_size * sizeof(GColor8))
; if (palette == NULL) { return 0; } memset(palette, 0, padded_palette_size * sizeof(GColor8)); // Convert rgb + alpha palette to GColor8 palette for (int i = 0; i < palette_entries; i++) { (palette)[i] = GColorFromRGBA( rgb_palette[i].r, rgb_palette[i].g, rgb_palette[i].b, // RGB (i...
/* * 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...
{ WordState new_state = state; switch (state) { case WordStateStart: if (codepoint == NEWLINE_CODEPOINT) { new_state = WordStateEnd; } else if (codepoint_is_ideograph(codepoint)) { new_state = WordStateIdeograph; } else { new_state = WordStateGrowing; } bre...
//! @return true if init to new word, false otherwise (ie end of text) //! @note assumes 'start' is not NULL, but does not assume 'start' is valid start of word bool word_init(GContext* ctx, Word* word, const TextBoxParams* const text_box_params, utf8_t* start) { word->width_px = 0; if (*start == NULL_CODEPOINT)...
/* * 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...
(timer_id != TIMER_INVALID_ID)
; cl_assert(stub_new_timer_is_scheduled(timer_id)); return stub_new_timer_timeout(timer_id); } void enter_standby(RebootReasonCode reason) { s_entered_standby = true; } void event_put(PebbleEvent* event) { s_last_event_put = *event; if (event->type == PEBBLE_BATTERY_STATE_CHANGE_EVENT) { battery_monito...
/* * 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 (app_install_entry_is_hidden(entry)) { return false; }
if (app_install_entry_is_watchface(entry)) { return true; // Only watchfaces } return false; } ////////////// // MenuLayer callbacks static uint16_t prv_transform_index(AppMenuDataSource *data_source, uint16_t original_index, void *context) { #if (SHELL_SDK && CAPABILITY...
//// #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 30, 40) #define START_ON_ORIGIN_RECT GPointPrecise(5, 5) #define END_ON_ORIGIN_RECT GPointPrecise(25, 25) #define START_ON_ORIGIN_RECT_XY ...
(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 10)
; graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_XY, END_ON_ORIGIN_RECT_XY, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_offset_layer_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 10); graphics_line_...
free_segments; uint16_t alloc_segments; /* Initialize the return values. */ *used = 0; *free = 0; *max_free = 0; free_segments = 0; alloc_segments = 0; heap_info_ptr = heap->begin; do { /* Check to see if the current fragment is marke...
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->high_water_mark ...
} heap_unlock(heap); if (allocated_block) { return &allocated_block->Data; } return NULL; } void heap_free(Heap* const heap, void *ptr, uintptr_t client_pc) { UTIL_ASSERT(heap->begin); if (!ptr) { // free(0) is a no-op, just bail return; } UTIL_ASSERT(heap_contains_address(heap, ptr))...
ely that while executing a the handler for the 'memorypressure' event, // new objects have been created on the heap. Therefore, it's unlikely we'll be able to reclaim // the desired headroom immediately after returning from the handler. Try to grab as much as we // can and resize it later on, see prv_resize_headr...
prv_resize_headroom_if_needed(ctx)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(!list_contains(head, (const ListNode *)job))
; if (head) { list_append(head, (ListNode *)job); } else { session->send_queue_head = job; } // Schedule to let the transport to send the enqueued data: comm_session_send_next(session); } unlock: bt_unlock(); } // ---------------------------------------------------------------------...
sizeof(GetAppAttributesMsg); // app id memcpy(request_data_ptr, app_id->value, app_id->length); request_data_ptr += app_id->length; // NULL terminator *request_data_ptr = '\0'; request_data_ptr += 1; // Requested attribute id(s) for (unsigned i = 0; i < ARRAY_LENGTH(s_fetched_app_attributes); ++i) { ...
(subscribed_characteristic)
; if (characteristic_id != ANCSCharacteristicNotification && characteristic_id != ANCSCharacteristicData) { // Only Notification and Data characteristics are expected to be subscribed to WTF; } static const AnalyticsMetric metric_matrix[2][2] = { [ANCSCharacteristicNotification] = { [0] =...
30 * 1000; s_app_data->inactive_timer_id = evented_timer_register_or_reschedule( s_app_data->inactive_timer_id, INACTIVITY_TIMEOUT_MS, prv_inactive_timer_callack, data); } ///////////////////////////////////// // Pin View ///////////////////////////////////// static void prv_move_timeline_layer_stopped(Animat...
timeline_model_is_empty()
&& prv_set_state(data, TimelineAppStateNoEvents)) { // Hide layouts and animate to "No events" timeline_layer_set_layouts_hidden(&data->timeline_layer, true); prv_init_peek_layer(data); prv_setup_no_events_peek(data); peek_layer_play(&data->peek_layer); Animation *sidebar_slide = prv_cr...
cel(AppInboxServiceTagUnitTest); // No events expected: assert_num_callback_events(0); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Consuming writes void test_app_inbox__multiple_writes_while_consuming(void) { prv_create_test_inbox_and_begin_write();...
(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1))
; cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); cl_assert_equal_i(1, app_inbox_destroy_and_deregister(s_inbox)); assert_num_callback_events(1); prv_process_callback_events(); assert_num_dropped_callbacks(0); assert_num_message_callbacks(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...
(LOG_LEVEL_DEBUG, "BMA255 self test pass, all 3 axis")
; } else { PBL_LOG(LOG_LEVEL_ERROR, "BMA255 self test failed one or more axis"); } // Workaround to fix FIFO Frame Leakage: Disable temperature sensor (we're not using it anyways) // See Section 2.2.1 of https://drive.google.com/a/pebble.com/file/d/0B9tTN3OlYns3bEZaczdoZUU3UEk/view bma255_write_register(...
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 CONDITIONS OF ANY KIND, either express or implied. * See the License for th...
jerry_get_array_length(listeners)
; JS_UNUSED_VAL = jerry_set_property_by_index(listeners, num_entries, listener); } static bool prv_remove_listener(jerry_value_t event_listeners, uint32_t idx, jerry_value_t listener, void *data) { ListenerQueryData *query_data = data; if (query_data->listener == listener) { /...
/* * 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 (!animation) { return false; } ((AnimationPrivate*)animation)->delay_ms = delay_ms; return true; }
bool WEAK animation_set_immutable(Animation *animation) { if (!animation) { return false; } ((AnimationPrivate*)animation)->immutable = true; return true; } bool WEAK animation_is_immutable(Animation *animation) { if (!animation) { return false; } return ((AnimationPrivate*)animation)->immutabl...
alloc_check(sizeof(TimelineItem)); if (type == NotificationMobile) { if (!notification_storage_get(id, item)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read notification"); goto cleanup; } } else if (type == NotificationReminder) { // validate reminder int rv = reminder_db_read_item(item, i...
reminder_db_read_item(&reminder, id)
) { return; } timeline_item_free_allocated_buffer(&reminder); TimelineItem item; if (S_SUCCESS != pin_db_get(&reminder.header.parent_id, &item)) { return; } timeline_item_free_allocated_buffer(&item); // Use the latest stale time to auto-hide the reminder. const time_t reminder_stale_time = pr...
ename_part = "quads_top", .mask = GCornersTop, }, { .filename_part = "quads_bottom", .mask = GCornersBottom, }, { .filename_part = "quads_right", .mask = GCornersRight, }, { .filename_part = "quads_left", .mask = G...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 0)
; graphics_context_set_stroke_color(&ctx, GColorRed); prv_draw_circles(&ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_swX_color.8bit.pbi")); } void test_graphics_draw_circle_8bit__zero_aa_swX_color(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Draw red circles with diffe...
n.raw_value <= bottom_margin.raw_value) { graphics_private_plot_vertical_line(ctx, x, top_margin, bottom_margin, (fraction_for_left >> 1)); } } for (int16_t x = (fraction_for_left ? x_min + 1 : x_min); x <= x_max; x++) { if (x > tm_p1.x.integer) {...
GPointPreciseFromGPoint(p0)
, GPointPreciseFromGPoint(p1), stroke_width, true); } #endif // PBL_COLOR MOCKABLE void graphics_line_draw_stroked_non_aa(GContext* ctx, GPoint p0, GPoint p1, uint8_t stroke_width) { prv_adjust_stroked_line_width(&stroke_width); pr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(session, SESSION_REMOTE_VERSION_ENDPOINT_ID, &command, sizeof(command), COMM_SESSION_DEFAULT_TIMEOUT)
; } static void prv_schedule_request(CommSession *session) { bt_lock(); if (!comm_session_is_valid(session)) { session = NULL; goto unlock; } unlock: bt_unlock(); if (session) { launcher_task_add_callback(prv_comm_session_perform_version_request_bg_cb, session); } } static void prv_handle_pho...
pdc_colors, }; gdraw_command_image_draw_processed(ctx, image, offset, &processor); } ////////////// // MenuLayer callbacks static const uint8_t BAR_PX = 9; static const uint8_t BAR_SELECTED_PX = 12; static void prv_draw_notification_cell_rect(GContext *ctx, const Layer *cell_layer, ...
if (title) { prv_draw_centered_text_line_in(ctx, title_font, box, title, GAlignCenter); }
_Liftoff, pos, 0, time_ms); TOUCH_DEBUG("Touch %"PRIu8": Liftoff!", touch_idx); } update = true; } else if (touch_state == TouchState_FingerDown) { PBL_ASSERTN(pos); if (ctx->touch_queue.count > 0) { // don't update if the position hasn't changed TouchEvent *last = &ctx->touch_queue....
(s_touch_mutex)
; } #if UNITTEST TouchEvent *touch_event_queue_get_event(TouchIdx touch_idx, uint32_t queue_idx) { if ((touch_idx > ARRAY_LENGTH(s_touch_ctx)) || (queue_idx > ARRAY_LENGTH(s_touch_ctx[touch_idx].touch_queue.events)) || (queue_idx >= s_touch_ctx[touch_idx].touch_queue.count)) { return NULL; } queu...
* distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "util/circular_cache.h" #include "util/size.h" #include...
cl_assert(!circular_cache_contains(&s_test_cache, &s_test_item[1]))
; cl_assert(!circular_cache_contains(&s_test_cache, &s_test_item[2])); circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_push(&s_test_cache, &s_test_item[1]); cl_assert(!circular_cache_contains(&s_test_cache, &s_test_item[2])); cl_assert(circular_cache_contains(&s_test_cache, &s_test_item[...
ept 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 CONDITIONS OF ANY KI...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r1_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Testing of the special cases for ra...
out, we would likely // need to update how this calculation works uint32_t systick_start = SysTick->VAL; power_tracking_start(PowerSystemMcuCoreSleep); __DSB(); // Drain any pending memory writes before entering sleep. do_wfi(); // Wait for Interrupt (enter sleep mode). Work around F2/F...
(&seconds, &milliseconds)
; int64_t rtc_ticks = ((((int64_t)seconds * 1000) + milliseconds) * RTC_TICKS_HZ) / 1000; uint32_t target_rtos_ticks = rtc_ticks + s_rtc_ticks_to_rtos_ticks; uint32_t act_ticks = xTaskGetTickCountFromISR(); if (act_ticks > target_rtos_ticks + 100 || act_ticks < target_rtos_ticks - 100) { // If we are too f...
0 = 6 = Sat 6 - 2 = 4 = Thu 0 - 2 = -2+7 = 5 = Fri (wday - yday % 7) */ // First wday of the year int wday = (((t->tm_wday - t->tm_yday) % 7) + 7) % 7; // Don't ask me, I didn't decide this. if (wday == normal_compare || (YEAR_IS_LEAP(year) && wday == leap_compare)) { return 53; } else { return 52;...
sys_i18n_get_length(i18nstr)
; } else { length = strlen(cpystr); } if (left <= length) { goto _out_of_size; } if (i18nstr) { sys_i18n_get_with_buffer(i18nstr, dest_str, length + 1); } else { memcpy(dest_str, cpystr, length); } dest_str += length...
/* * 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...
bt_persistent_storage_init()
; comm_default_kernel_sender_init(); comm_session_app_session_capabilities_init(); comm_session_init(); bt_ctl_init(); #if CAPABILITY_HAS_TOUCHSCREEN touch_init(); #endif #if CAPABILITY_HAS_BUILTIN_HRM hrm_manager_init(); #endif // We only use the factory registry on tintins and biancas #ifdef MICRO_...
ox_params) { int16_t next_line_y_extent; // Normally, we lay out the text one line below the regular cutoff so that it may be rendered, // albeit clipped. But, if we're rendering in truncation mode (e.g. GTextOverflowModeFill or // GTextOverflowModeTrailingEllipsis), we can immediately cut the text off below t...
if (utf8_iter_state->current <= utf8_iter_state->bounds->start) { // EOS while searching for valid codepoint return false; }
bool is_utf8_advanced = iter_prev(utf8_iter); codepoint = utf8_iter_state->codepoint; if (!is_utf8_advanced) { return is_utf8_advanced; } PBL_ASSERTN(codepoint != 0); if (codepoint_is_formatting_indicator(codepoint)) { continue; } if (codepoint_should_skip(codepoint)) {...
/* * 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...
{ // Malformed packet; silently discard. return; }
PCMPPacket *packet = raw_packet; switch (packet->code) { case PCMPCode_EchoRequest: { PCMPPacket *reply = this->send_begin_fn(PULSE_CONTROL_MESSAGE_PROTOCOL); memcpy(reply, packet, packet_length); reply->code = PCMPCode_EchoReply; this->send_fn(reply, packet_length); break; }...
/* * 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 GSizeZero; }
return image->size; } void gdraw_command_image_set_bounds_size(GDrawCommandImage *image, GSize size) { if (!image) { return; } image->size = size; } GDrawCommandList *gdraw_command_image_get_command_list(GDrawCommandImage *image) { if (!image) { return NULL; } return &image->command_list; }
g; uint16_t height_mm; } HumanPrefs; #define ACTIVITY_DEFAULT_HEIGHT_MM 1620 // 5'3.8" // dag - decagram (10 g) #define ACTIVITY_DEFAULT_WEIGHT_DAG 7539 // 166.2 lbs #define ACTIVITY_DEFAULT_GENDER ActivityGenderFemale #define ACTIVITY_DEFAULT_AGE_YEARS ...
(long_run_distance_m, short_guy_distance)
; // And finally throw in a specific value so that anyone who touches the function will have to // check up on the unit tests cl_assert_equal_i(short_guy_distance, 36845); } // --------------------------------------------------------------------------------------- void test_activity_calculators__active_calories...
55) of the timestamp of that minute. bool activity_algorithm_get_minute_history(HealthMinuteData *minute_data, uint32_t *num_records, time_t *utc_start) { // Get the current time time_t now = rtc_get_time(); // Get the minute index uint32_t minute_idx = now / SECONDS_...
{ time_t utc_secs; uint16_t ms; rtc_get_time_ms(&utc_secs, &ms); uint64_t start_ms = utc_secs * 1000 + ms; for (int i = 0; i < num_samples; ) { AccelData accel_data[ALGORITHM_SAMPLING_RATE]; int j; for (j = 0; j < ALGORITHM_SAMPLING_RATE && i < num_samples; j++, i++) { accel_data[j] = (Acc...
// -------------------------------------------------------------------------------- // Fast forward time, one minute at a time, calling all minute callbacks along the way. // This does not feed in any accel data static void prv_advance_by_days(uint32_t num_days) { for (int i = 0; i < num_days; i++) { // Advanc...
{ 328, -384, -600}, { 528, 88, -136}, { 1072, 336, -128}, { 1592, 248, 56}, { 2120, 736, -40}, // 32 seconds { 1760, 744, 312}, { 1392, 656, 304}, { 1264, 568, -144}, { 1248, 544, 88}, { 1248, 632, -72}, { 1152, 368, 56}, { 1256, 344, 16}, { 1600, 456, 32}, { ...
{ 984, 336, 144}, { 1000, 344, 80}, { 1184, 376, 120}, { 1688, 496, 352}, { 1208, 1024, 224}, { 1328, 1432, -272}, { 992, 400, 24}, { 984, 720, -144}, { 1096, 640, -32}, { 1344, 488, 32}, { 1488, 400, 32}, { 1456, 280, 96}, { 1480, 184, 120}, // 35 seconds { ...
t GAlign arrow_alignment = PBL_IF_RECT_ELSE(GAlignTop, GAlignBottom); 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 dra...
{ int16_t dy; const GRect *prev_frame = &swap_layer->previous->layer.frame; const GRect *current_frame = &swap_layer->current->layer.frame; if (full_swap) { dy = prev_frame->size.h - current_frame->origin.y; } else { dy = swap_layer->layer.frame.size.h - PEEK_PX; } Animation *prev_down = prv_cr...
static bool prv_setup_swap_up(SwapLayer *swap_layer) { LayoutLayer *new_previous = prv_fetch_next_layout(swap_layer, -1); // if there is no layout to swap up to, abort if (!new_previous) { return false; } swap_layer->previous = new_previous; GRect prev_frame = swap_layer->previous->layer.frame; c...
laveSelect_Soft = 0x0200, SpiSlaveSelect_Hard = 0x0000 } SpiSlaveSelect; typedef enum { SpiDisable = 0, SpiEnable } SpiFunctionalState; // // Private SPI bus functions. No higher level code should // get access to SPIBus functions or data directly // static bool prv_spi_get_flag_status(const SPIBus *bus, SpiI...
while (!prv_spi_transmit_is_idle(bus)) continue;
} void prv_spi_receive_wait_ready_blocking(const SPIBus *bus) { while (!prv_spi_receive_is_ready(bus)) continue; } static void prv_configure_spi_sclk(const AfConfig *clk_pin, uint16_t spi_sclk_speed) { gpio_af_init(clk_pin, GPIO_OType_PP, spi_sclk_speed, GPIO_PuPd_NOPULL); } static void prv_spi_bus_deinit(const...
8, 0x00, 0x00, 0x00, '}', '\0', }; cl_assert_equal_i(sizeof(raw_bytes_v1), expected_size); cl_assert_equal_m(raw_bytes_v1, buffer, expected_size); prv_rcv_app_message_ack(APP_MSG_OK); json_bytes_remaining -= json_bytes_size; } EXPECT_OUTBOX_NO_MESSAGE_PENDING(); task_free(buffer); } void t...
cl_assert_equal_b(s_is_outbox_message_pending, true)
; // NACK prv_rcv_app_message_ack(APP_MSG_BUSY); AppTimer *t = rocky_api_app_message_get_app_msg_retry_timer(); cl_assert(t != EVENTED_TIMER_INVALID_ID); cl_assert_equal_b(fake_app_timer_is_scheduled(t), true); // Enqueuing more objects shouldn't affect the pace at which things are retried: ...
ar * restrict dest_str, size_t maxsize, const char * restrict fmt, const struct tm * restrict t, const char *locale) { const struct lc_time_T *time_locale = time_locale_get(); size_t left = maxsize; const int year = prv_full_year(t->tm_year); const int hour_12h = (t->tm_hour % 12 == 0)...
FMT_STRCOPY_I18N(time_locale->mon[t->tm_mon % MONTHS_PER_YEAR]); break; case 'B': FMT_STRCOPY_I18N(time_locale->month[t->tm_mon % MONTHS_PER_YEAR]); break; case 'c': FMT_RECURSE_I18N(time_locale->c_fmt); _fmt_recurse: if (!use_i18n && i18nstr) { cpys...
FMT_RECURSE("%Y-%m-%d"); break; case 'g': // TZ FMT_INTCOPY(prv_iso8601_year(t) % 100, 2, INTFMT_PADZERO); break; case 'G': // TZ FMT_INTCOPY(prv_iso8601_year(t), 4, INTFMT_PADZERO); break; case 'H': FMT_INTCOPY(t->tm_hour, 2, INTFMT_PADZERO); ...
/* * 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...
{ 11, 0x52, 3692, 0x0}, { 16, 0x53, 4885, 0x0}, { 6, 0x52, 4215, 0x0}, // 30: Local time: 08:00:00 PM { 0, 0x42, 2813, 0x0}, { 0, 0x54, 4750, 0x0}, { 0, 0x54, 3097, 0x0}, { 23, 0x53, 5092, 0x0}, { 18, 0x64, 5601, 0x0}, { 0, 0x55, 3364, 0x0}, { 0, 0x24, 1850, 0x0}, ...
{ 0, 0x75, 0, 0x0}, { 0, 0x76, 103, 0x0}, { 0, 0x86, 0, 0x0}, { 0, 0x75, 180, 0x0}, { 0, 0x65, 0, 0x0}, { 0, 0x75, 0, 0x0}, { 0, 0x75, 0, 0x0}, { 0, 0x75, 13, 0x0}, { 0, 0x75, 0, 0x0}, // 90: Local time: 09:00:00 PM { 0, 0x75, 199, 0x0}, { 0, 0x75, 0, 0x0}, ...
/* * 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...
{ // CTRL-C if (!s_prompt_enabled) { PBL_LOG(LOG_LEVEL_DEBUG, "Ignoring prompt request, not yet ready!"); return; } console_switch_to_prompt(); }
} void serial_console_init(void) { if (s_serial_console_initialized) { return; } dbgserial_register_character_callback(logging_handle_character); s_serial_console_state = SERIAL_CONSOLE_STATE_LOGGING; s_serial_console_initialized = true; } bool serial_console_is_prompt_enabled(void) { if (!s_serial...
t(1, 0); prv_test_touch_event(touch_event, 1, TouchEvent_Touchdown, &GPoint(1, 13), 3686401, 5, &GPointZero, 0, 0, true); } void test_touch__handle_update_liftoff(void) { // Test first touch touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, T...
GPoint(13, 13)
, 6, 3686420); touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(13, 13), 40, 6, true); touch_handle_update(0, TouchState_FingerDown, &GPoint(18, 5), 1, 3686440); // Test the same event (event...
ds: case HealthMetricSleepRestfulSeconds: case HealthMetricRestingKCalories: case HealthMetricActiveKCalories: return HealthAggregationSum; case HealthMetricHeartRateBPM: case HealthMetricHeartRateRawBPM: return HealthAggregationAvg; } WTF; return 0; } // -------------------------...
{ // Only support querying the current raw heart rate. const bool query_cur_minute = prv_interval_within_last_minute(now_utc, time_start, time_end); return ((agg == HealthAggregationAvg) && query_cur_minute); }
case HealthMetricHeartRateBPM: // For heart rate, we can only support avg, min, max with constraints on time switch (agg) { case HealthAggregationSum: return false; case HealthAggregationAvg: { // We used to unconditionally return true here which was a bug ...
_records >= 100) { cl_assert(false); } cl_assert(s_num_dls_activity_records < ARRAY_LENGTH(s_dls_activity_records)); s_dls_activity_records[s_num_dls_activity_records++] = records[i]; } } else { return DATA_LOGGING_INVALID_PARAMS; } return DATA_LOGGING_SUCCESS; } DataLoggingSe...
{ printf("Expected %"PRIu32" activities, but found %"PRIu32".\n", num_expected, num_sessions); }
t bool buffered = false; const bool resume = false; Uuid system_uuid = UUID_SYSTEM; state->activity_dls_session = dls_create( DlsSystemTagActivitySession, DATA_LOGGING_BYTE_ARRAY, sizeof(dls_record), buffered, resume, &system_uuid); if (!state->activity_dls_session) { PBL_LOG(LOG_L...
if ((session->type == ActivitySessionType_RestfulSleep) || (session->type == ActivitySessionType_RestfulNap)) { if (session_exit_utc <= max_end_utc) { // Accumulate restful sleep stats stats->restful_minutes += session->length_min; } stats->last_deep_exit_utc = MAX(stats->last_de...
} return rv; } // -------------------------------------------------------------------------------------------- // Goes through a list of activity sessions and updates our sleep totals in the metrics // accordingly. We also take this opportunity to post a sleep metric changed event for the SDK // if the sleep to...
8_t *) &header, sizeof(header), COMM_SESSION_DEFAULT_TIMEOUT); } else { // Otherwise, just send a "done" message header.command = 0x81; comm_session_send_data(s_bt_dump_chunk_callback_data.comm_session, ENDPOINT_ID, (uint8_t *) &header, sizeof(header),...
PBL_HEXDUMP(LOG_LEVEL_INFO, build_id, sizeof(build_id))
; } } }
load = prv_time_picker_window_unload; data->time_picker_window.window.window_handlers.appear = prv_time_picker_window_appear; if (data->creating_alarm) { time_selection_window_set_to_current_time(&data->time_picker_window); } else { int hour, minute; alarm_get_hours_minutes(data->alarm_id, &hour, &mi...
(alarm_id, data->scheduled_days)
; } prv_setup_day_picker_window(data); app_window_stack_push(&data->day_picker_window, true); }
mer_for_tag(tag)); AppOutboxConsumer *consumer = &s_app_outbox_consumer[tag]; consumer->message_handler = message_handler; consumer->consumer_data_length = consumer_data_length; consumer->consumer_task = consumer_task; } prv_unlock(); } void app_outbox_service_unregister(AppOutboxServiceTag service...
{ return s_app_outbox_sender_defs[tag].max_pending_messages; }
uint32_t app_outbox_service_max_message_length(AppOutboxServiceTag tag) { return s_app_outbox_sender_defs[tag].max_length; }
anguage governing permissions and * limitations under the License. */ #include "window_stack.h" #include "animation_private.h" #include "app_window_click_glue.h" #include "window_manager.h" #include "window_private.h" #include "window_stack_animation.h" #include "window_stack_private.h" #include "applib/applib_mal...
(context->animation)
; applib_free(context->animation); } else { animation_set_elapsed(context->animation, animation_get_duration(context->animation, true, true)); } } *context = (WindowTransitioningContext) { .window_to = window_to, .window_to_last_x = INT16_MAX, .window_fro...
nager.h" #include "drivers/accel.h" #include "services/common/event_service.h" #include "util/math.h" #include "util/size.h" #include <stdio.h> // helpers from accel manager extern void test_accel_manager_get_subsample_info( AccelManagerState *state, uint16_t *num, uint16_t *den, uint16_t *samps_per_update); ext...
(fastest_rate, sample_arr[i])
- i, sizeof(buf)); cl_assert_equal_i(pfs_write(fd, (uint8_t *)&buf[0], sizeof(buf)), sizeof(buf)); } pfs_close(fd); fd = pfs_open("page_lookup", OP_FLAG_READ | OP_FLAG_USE_PAGE_CACHE, FILE_TYPE_STATIC, 0); cl_assert(fd >= 0); for (int i = 0; i < num_regions; i++) { cl_assert_equal_i(pfs_seek(fd, i * ...
cl_assert(fd >= 0)
; uint8_t buf[rd_len]; rv = pfs_read(fd, buf, rd_len); cl_assert(rv == E_INVALID_ARGUMENT); pfs_close(fd); fd = pfs_open("newfile", OP_FLAG_READ, 0, 0); rv = pfs_read(fd, buf, rd_len); cl_assert(rv == rd_len); rv = pfs_read(fd, buf, 1); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, 0, FSeekSet); cl...
xt) { Window *window = app_window_stack_get_top_window(); // only force render if we're not fullscreen if (!window->is_fullscreen) { // a little logic to only force update when the minute changes ApplibInternalEventsInfo *events_info = app_state_get_applib_internal_events_info(); struct tm cur...
event_service_client_subscribe(&events_info->will_focus_event)
; event_service_client_subscribe(&events_info->button_down_event); event_service_client_subscribe(&events_info->button_up_event); prv_legacy2_status_bar_timer_subscribe(); // a no-op on sdk3+ applications event_loop_upkeep(); // Event loop: while (1) { PebbleEvent event; sys_get_pebble_event(&eve...
328, -224}, { 1104, 352, -224}, { 960, 352, -168}, { 1104, 312, -64}, { 1296, 296, -32}, { 1208, 224, 32}, // 78 seconds { 952, 200, 32}, { 728, 168, -16}, { 632, 216, -48}, { 656, 160, -16}, { 760, 104, 8}, { 856, 96, 0}, { 1024, 112, -24}, { 1112, 160, -72}, ...
{ 544, 280, -80}, { 560, 224, -72}, { 696, 200, -112}, { 816, 256, -208}, { 1000, 256, -240}, { 1104, 272, -296}, { 1064, 280, -264}, { 1288, 288, -200}, { 1176, 336, -208}, { 1024, 288, -136}, { 1208, 272, -72}, { 1216, 248, 0}, { 1120, 256, -24}, { 896, 200, -32...
{ 1328, 272, -232}, { 1032, 272, -160}, { 1032, 256, -136}, { 1160, 280, -136}, { 1176, 280, -64}, { 1032, 176, -16}, { 848, 160, -16}, { 736, 160, -24}, { 768, 200, -40}, { 816, 136, -8}, { 840, 64, 16}, { 952, 48, -16}, { 1048, 56, -104}, { 1040, -8, -104}, ...
/* * 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...
{ uint8_t *data = hci_data; uint8_t payload_len = data[0]; uint8_t *hci_cmd = &data[1]; hc_endpoint_enqueue_hci_cmd(hci_cmd, payload_len); kernel_free(hci_data); }
e->all_day); // correct end of line behaviour cl_assert(!iter_prev(&iterator)); } void test_timeline__all_day_future_with_others(void) { prv_insert_all_day_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // start 11:40 AM, earlier than all timed events for t...
{ prv_insert_all_day_items(); // 1421183640 is 13:14 on Jan 13, 2015 // after first timed event of the day but not all of them Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, Timelin...
static void prv_insert_extra_case_items(void) { pin_db_flush(); for (int i = 0; i < ARRAY_LENGTH(s_extra_case_items); i++) { cl_assert_equal_i(pin_db_insert_item(&s_extra_case_items[i]), 0); } } // 5am, no events passed void test_timeline__extra_case_forwards(void) { prv_insert_extra_case_items(); Ite...
_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertOther)); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); cl_assert(!alerts_should_vibrate_for_type(AlertPhoneCall)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICK...
cl_assert(!alerts_should_notify_for_type(AlertOther))
; cl_assert(!alerts_should_vibrate_for_type(AlertOther)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertOther)); s_dnd_active = false; alerts_set_mask(AlertMaskAllOn); alerts_set_dnd...
/* * 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...
(freertos_mutex)
; return mutex; } void mutex_lock_recursive(PebbleRecursiveMutex * handle) { uintptr_t myLR = (uintptr_t) __builtin_return_address(0); OS_ASSERT(!mcu_state_is_isr()); xLightMutexLockRecursive(handle->common.freertos_mutex, portMAX_DELAY); LOG_LOCKED(handle->common.lr, myLR); } bool mutex_lock_recursive_wit...
required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #inc...
(s_event_count, 0)
; } void test_debounced_connection_service__disconnected_wait_disconnected(void) { //! Currently disconnected init(false /* disconnected */); check_disconnected(); //! Get disconnected event prv_send_connection_event(false); check_waiting_to_send_second_disconnect(); //! Timer fires regular_timer_f...
ontext(action_bar_layer, data); prv_add_prf_layers(pair_text_area, data); const int16_t y_offset = PBL_IF_RECT_ELSE(0, 2); // Device name: if (prv_has_device_name(data)) { TextLayer *device_name_layer = &data->device_name_text_layer; text_layer_init_with_parameters(device_name_layer, ...
window_single_click_subscribe(BUTTON_ID_BACK, prv_pop_click_handler)
; window_single_click_subscribe(BUTTON_ID_UP, prv_pop_click_handler); window_single_click_subscribe(BUTTON_ID_SELECT, prv_pop_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_pop_click_handler); } static void prv_create_new_pairing_data(void) { // If we already have a window up, remove that be...
/* * 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_LOG_LEVEL_DEBUG, "Error with \"j\": %s", buf)
; } r = strftime(buf, buf_size, "%m", &good_data); if (r == 0 || strncmp(buf, "05", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"m\": %s", buf); } r = strftime(buf, buf_size, "%M", &good_data); if (r == 0 || strncmp(buf, "04", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error w...
(!serialized_slice || !attr_list_out || !attr_list_data_buffer_out) { return false; } const uint8_t num_attributes = serialized_slice->num_attributes; // If there aren't any attributes, set `attr_list_out` to be an empty AttributeList and return // true because technically we did successfully deserialize ...
if (!prv_deserialize_attribute_list(serialized_slice, &attr_list, &attr_list_data_buffer)) { deserialization_context->deserialization_failed = true; return false; }
// Check that the deserialized attribute list is valid const bool success = prv_is_slice_attribute_list_valid(serialized_slice->type, &attr_list); if (!success) { goto cleanup; } AppGlance *glance_out = deserialization_context->glance_out; // Copy the common serialized slice fields to the output gla...
/* * 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...
(id, 3, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule)
; id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); id = alarm_create(&(AlarmInfo) { .hour = 5, .minute = 14, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id, 5, 14, false, ALAR...