prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
cteristic(void) { ppogatt_handle_subscribe(s_unknown_characteristics, BLESubscriptionNotifications, BLEGATTErrorSuccess); // Expect to unsubscribe from the unknown characteristic: fake_gatt_client_subscriptions_assert_subscribe(s_unknown_characteristics, BLESubscriptionNone, ...
{ prv_discover_and_read_meta_and_reset(); // Simulate getting "Reset Complete" from remote: prv_receive_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]); // Expect "Reset Complete" to be sent by FW: prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]); // Expect ...
void test_ppogatt__start_reset_upon_out_of_range_ack(void) { test_ppogatt__open_session_when_found_pebble_app(); // Simulate getting an Ack that's outside of the window of outstanding SNs: prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], PPOGATT_SN_MOD_DIV / 2); // Expect Reset to be initiated...
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17}; cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&made_up)); cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&UUID_INVALID)); cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&(const Uuid)UUID_SYSTEM)); } void test_app...
cl_assert_equal_b(false, app_install_is_hidden(bg_counter_id))
; cl_assert_equal_b(false, app_install_is_hidden(menu_layer_id)); cl_assert_equal_b(false, app_install_is_hidden(CRAZY_ID)); } void test_app_install_manager__is_from_system(void) { cl_assert_equal_b(true, app_install_id_from_system(-1000000)); cl_assert_equal_b(true, app_install_id_from_system(-1)); cl_asse...
cfg.GPIO_Pin = (1 << FLASH_CONFIG.scs_pin); gpio_cfg.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(FLASH_CONFIG.spi_gpio, &gpio_cfg); // Set up a SPI bus on SPI1 SPI_InitTypeDef spi_cfg; SPI_I2S_DeInit(FLASH_CONFIG.spi); spi_cfg.SPI_Direction = SPI_Direction_2Lines_FullDuplex; spi_cfg.SPI_Mode = SPI_Mode_Master; ...
prv_flash_deep_sleep_exit()
on/flash_region.h" #include "system/logging.h" #include "kernel/pbl_malloc.h" static const uint8_t data_pattern = 0xAA; static const uint8_t test_pattern = 0x55; static volatile bool enable_flash_test = false; static FlashTestErrorType prv_read_verify_byte(uint32_t read_addr, ...
((uint8_t*) &read_buffer, write_addr, sizeof(read_buffer))
; if (disp_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">> Reading Addr 0x%"PRIx32" value is 0x%"PRIx16, write_addr, read_buffer); } if (read_buffer != expected_val) { PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully write the data"); return FLASH_TEST_ERR_DATA_WRITE; } return FLASH_TEST_...
core_dump_connect_ping)) == 0) { // Handshake received. Switch to tx mode. hw_spi_change_fifo_mode(s_spi->bus_id, HW_SPI_FIFO_TX_ONLY); rx_mode = false; tx_index = 0; tx_start_ticks = prv_timer_get_ticks(); continue; } else { ...
printf("region table\n")
; prv_send_response((uint8_t *)s_MemoryRegions, sizeof(s_MemoryRegions)); break; case CoreDumpCmd_ReadMemory: { printf("read memory %p %d\n", cmd.addr, cmd.len); prv_send_response(cmd.addr, cmd.len); } break; case CoreDumpCmd_ReadRunningThreadInfo: p...
, 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. */ #include "health_activity_detail_card.h" #include "hea...
PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack)
, }; prv_set_avg(subtitle->label, buffer_len, card_data->daily_avg, card_data); const HealthDetailCardConfig config = { .num_headings = card_data->num_headings, .headings = card_data->headings, .num_subtitles = card_data->num_subtitles, .subtitles = card_data->subtitles, .daily_avg = card_da...
v_get_uuid(session), uuid_string); PBL_LOG(LOG_LEVEL_INFO, "Session event: is_open=%d, destination=%s, app_uuid=%s", is_open, prv_string_for_destination(session->destination), uuid_string); } static bool prv_is_transport_type(Transport *transport, const TransportImplementa...
system_task_add_callback(dls_private_handle_disconnect, NULL)
; #endif } prv_put_comm_session_event(false, is_system); if (is_system && (session->destination == TransportDestinationHybrid)) { prv_put_comm_session_event(true, false); } // Cleanup: comm_session_receive_router_cleanup(session); comm_session_send_queue_cleanup(session); list_remove(&session->no...
n, applying a "positive" force makes the number go lower and applying // a "negative" force makes the number go higher. And then, for some reason, we abs() it when // calculating a delta to hide the fact that it's backwards. This is all documented in a // document called "How to perform BMI160 accelerometer self-...
{ // any interval < min supported must saturate to 1600Hz acc_odr = BMI160AccODR_1600_HZ; }
return acc_odr; } static BMI160SampleRate prv_get_supported_sample_rate(uint32_t interval_us) { BMI160SampleRate sample_rate; if (BMI160SampleRate_12p5_HZ <= interval_us) { sample_rate = BMI160SampleRate_12p5_HZ; } else if (BMI160SampleRate_25_HZ <= interval_us) { sample_rate = BMI160SampleRate_25_HZ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
launcher_panic_get_current_error()
!= 0) { return panic_app_get_app_info(); } #ifdef MANUFACTURING_FW accessory_imaging_enable(); mfg_enter_mfg_mode(); return mfg_menu_app_get_info(); #endif return recovery_first_use_app_get_app_info(); } AppInstallId system_app_state_machine_get_last_registered_app(void) { if (mfg_is_mfg_mode()) { ...
t_bt_classic_pairing_by_id(id_2, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_2, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_2, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_2, na...
(fake_shared_prf_storage_get_bt_classic_store_count(), 4)
; // Update with platform bits id_4 = bt_persistent_storage_store_bt_classic_pairing(&addr_4, NULL, NULL, &platform_bits_4); cl_assert(id_4 != BT_BONDING_ID_INVALID); } void test_bluetooth_persistent_storage__get_bt_classic_pairing_by_addr(void) { // Output variables SM128BitKey link_key_out; char name_ou...
ount(1); } void test_put_bytes__install_message_while_not_in_fw_update_mode(void) { prv_receive_init_put_and_commit_fw_object(); s_firmware_update_is_in_progress = false; prv_receive_install(s_last_response_cookie); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__install_message_cookie_mi...
put_bytes_expect_init(EXPECT_INIT_TIMEOUT_MS)
; stub_new_timer_fire(put_bytes_get_timer_id()); PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_PUT_BYTES_EVENT); cl_assert_equal_i(event.put_bytes.type, PebblePutBytesEventTypeInitTimeout); cl_assert_equal_i(event.put_bytes.object_type, ObjectUnknown); cl_assert_equal_i(e...
t_text_inset_to_prevent_clipping)); } #else const OptionMenuStyle * const style = prv_get_style(); const int32_t left_text_inset = menu_cell_basic_horizontal_inset(); const int32_t right_text_inset = option_menu->icons_enabled ? style->right_text_inset_with_icon : ...
{ option_menu->content_type = content_type; }
void option_menu_reload_data(OptionMenu *option_menu) { menu_layer_reload_data(&option_menu->menu_layer); } void option_menu_set_icons_enabled(OptionMenu *option_menu, bool icons_enabled) { option_menu->icons_enabled = icons_enabled; } void option_menu_configure(OptionMenu *option_menu, ...
bitmap, "fill_rect_origin_r2_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rounded rect #if SCREEN_COLOR_DEPTH_BITS == 8 // TODO: Fix left corners PBL-15915 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_f...
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, 2, GCornersAll)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, 3, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_or...
nt fd) { if (PFS_FD(fd).file.name != NULL) { kernel_free(PFS_FD(fd).file.name); PFS_FD(fd).file.name = NULL; } if (PFS_FD(fd).file.pg_cache != NULL) { kernel_free(PFS_FD(fd).file.pg_cache); PFS_FD(fd).file.pg_cache = NULL; PFS_FD(fd).file.pg_cache_len = 0; } PFS_FD(fd).fd_status = FD_STAT...
{ if (PFS_FD(fd).file.offset != (uint32_t)new_offset) { PFS_FD(fd).file.offset = (uint32_t)new_offset; PFS_FD(fd).file.curr_page = INVALID_PAGE; } res = new_offset; }
else { res = E_RANGE; } cleanup: mutex_unlock_recursive(s_pfs_mutex); return (res); } int pfs_write(int fd, const void *buf_ptr, size_t size) { const uint8_t *buf = buf_ptr; mutex_lock_recursive(s_pfs_mutex); int res = E_UNKNOWN; if (!FD_VALID(fd) || (buf == NULL) || (size == 0)) { res = E_INVA...
SlaveSelect_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, Spi...
{ 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 S...
(s_dest_bitmap->addr, PBL_IF_COLOR_ELSE(GColorShockingPinkARGB8, GColorWhiteARGB8), s_dest_bitmap->row_size_bytes * s_dest_bitmap->bounds.size.h)
; for (SettingsContentSize content_size = 0; content_size < SettingsContentSizeCount; content_size++) { system_theme_set_content_size(settings_content_size_to_preferred_size(content_size)); callback(content_size, root_level, selected_index, additional_crumbs); } } static void prv_render_action_menu...
/* * 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...
(animation->sibling, callback, context)
; } callback(animation, context); } static void prv_free(AnimationPrivate *animation, uintptr_t context) { list_remove(&animation->list_node, NULL, NULL); free(animation); } bool animation_destroy(Animation *animation) { prv_each((AnimationPrivate *)animation, prv_free, (uintptr_t)NULL); return true; } b...
er); s_kernel_receiver_is_receiving = false; s_kernel_receiver_finish_called = true; } static void prv_default_kernel_receiver_cleanup(Receiver *receiver) { cl_assert_equal_p(receiver, s_kernel_receiver); s_kernel_receiver_is_receiving = false; s_kernel_receiver_cleanup_called = true; } const ReceiverImplem...
cl_assert_equal_p(r, NULL)
; cl_assert_equal_b(false, s_kernel_receiver_is_receiving); } void test_app_message_receiver__receive_push_but_inbox_not_opened_no_kernel_receiver(void) { fake_kernel_malloc_mark(); s_kernel_receiver_available = false; Receiver *r = s_rcv_imp->prepare(s_session, &s_app_message_endpoint, ...
ications(&e, &r); free(r.allocated_buffer); const size_t block_size = file_size / 4; int erase_count = block_size / notif_size + (((block_size % notif_size) > 0) ? 1 : 0); int j; for (j = 0; j < erase_count; j++) { e.header.id = uuids[j]; e.header.timestamp = timestamp + j; cl_assert_equal_b(noti...
cl_assert(uuid_equal(&u, &e2.header.id))
e "stubs_memory_layout.h" #include "stubs_menu_layer.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_persist.h" #include "stubs_pin_db.h" #include "stubs_process_loader.h" #include "stubs_process_manager.h" #include "stubs_process_mana...
(BG_COUNTER_APP_ID, bg_counter_app_id)
f (reached_end_elapsed && s_stopped_handler_calls.num_calls == 1 && layer.frame.origin.x < to_r.origin.x) { detected_reset_of_elapsed = true; } cl_assert(max_loops > 0); max_loops--; } // Make sure we detected a reset of the elapsed after rescheduling cl_assert(s_stopped_handler_calls....
cl_assert(detected_reset_of_elapsed)
; // Make sure the frame reached the "to" state cl_assert_equal_point(layer.frame.origin, to_r.origin); // This should return a NULL context now if the animation got destroyed cl_assert(animation_get_context(h) == NULL); // Make sure no animations exist cl_assert_equal_i(prv_count_animations(), 0); #endi...
_continues_after_returning(); } void command_log_dump_generation(const char* generation_str) { int generation = atoi(generation_str); flash_dump_log_file(generation, prv_serial_dump_chunk_callback, prv_serial_dump_completed_callback); prompt_command_continues_after_returning(); } static vo...
profiler_stop()
params; connection_get_conn_params(connection, &params); PebblePairingServiceConnParamsReadNotif *resp = (PebblePairingServiceConnParamsReadNotif *)response_buffer; #if SUPPORTS_PACKET_LENGTH_EXTENSION resp->packet_length_extension_supported = true; #else resp->packet_length_extension_supported = false; #...
{ response_length = prv_handle_handle_cccd_read(evt->handle, evt->conn_idx, response); }
else if (!prv_get_value(evt->conn_idx, evt->handle, response, &response_length)) { PBL_LOG(LOG_LEVEL_ERROR, "Reading unhandled handle: %u !", evt->handle); response_status = ATT_ERROR_INVALID_HANDLE; } ble_error_t e = ble_gatts_read_cfm(evt->conn_idx, evt->handle, response_status, ...
/* * 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...
reboot_reason_set(&reason)
; while (1) {}; } /** * @brief Application tick hook */ void vApplicationTickHook( void ) { #if mainCHECK_INTERRUPT_STACK == 1 extern unsigned long _pvHeapStart[]; /* This function will be called by each tick interrupt if configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be added ...
/* * 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_INFO, "%d days ago steps: %d", i, (int)steps)
; day_start -= SECONDS_PER_DAY; } // Test getting steps for part of a day day_start = time_start_of_today(); time_t seconds_today_so_far = time(NULL) - day_start; steps = health_service_sum(HealthMetricStepCount, day_start, day_start + (seconds_today_so_far / 2)...
ata_out); cl_assert_equal_i(contiguous_num_bytes_left, 4); memcpy(data_out, "456", 3); circular_buffer_write_finish(&buffer, 3); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 1); cl_assert_equal_i(circular_buffer_get_read_space_remaining(&buffer), 7); contiguous_num_bytes_left = ci...
(&buffer, &letterA, sizeof(letterA))
); uint8_t *data_buf; uint16_t num_bytes = circular_buffer_write_prepare(&buffer, &data_buf); cl_assert_equal_i(sizeof(storage) - sizeof(letterA), num_bytes); uint8_t letterB = 'B'; data_buf[0] = letterB; cl_assert(circular_buffer_read( &buffer, sizeof(letterA), (const uint8_t **)&data_buf, &num_by...
o(flash_size)); // Init QSPI peripheral QSPI_InitTypeDef qspi_config; QSPI_StructInit(&qspi_config); qspi_config.QSPI_SShift = QSPI_SShift_HalfCycleShift; // QSPI clock = AHB / (1 + QSPI_Prescaler) qspi_config.QSPI_Prescaler = prescaler - 1; qspi_config.QSPI_CKMode = QSPI_CKMode_Mode0; qspi_config.QSPI...
(dev->state->dma_semaphore, &was_higher_priority_task_woken)
; return was_higher_priority_task_woken != pdFALSE; } static void prv_config_indirect_read(QSPIPort *dev, uint8_t instruction, uint32_t addr, uint8_t dummy_cycles, bool is_ddr) { prv_set_ddr_enabled(is_ddr); uint32_t modes_bitset = 0; modes_bitset |= is_ddr ? QSPI_ComConfi...
/* * 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(num.fraction == 2)
; test_num = (int32_t)((float)-0.625 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 3); test_num = (int32_t)((float)-0.500 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num....
/* * 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_find(s_manager_state.subscribers, prv_match_app_id, &context)
; return (HRMSubscriberState *)node; } // Return true if this subscriber needs to be sent a HRMEvent_SubscriptionExpiring event static bool prv_needs_expiring_event(HRMSubscriberState *state, time_t utc_now) { if (state->sent_expiration_event) { return false; } return (state->expire_utc && (utc_now >= stat...
-2352, 400, 752}, { -2208, 456, 936}, { -2000, 248, 904}, { -1592, 112, 648}, { -1144, 40, 464}, { -792, -112, 352}, // 55 seconds { -440, -392, 72}, { -336, -320, 120}, { -312, -448, -304}, { -480, -336, -120}, { -744, -8, 32}, { -1240, 368, 240}, { -1920, 504, 488},...
{ -1144, 184, 368}, { -960, 144, 360}, { -912, 168, 424}, { -920, 352, 616}, { -840, 616, 568}, { -912, 400, 400}, { -1152, 456, 472}, { -1272, 448, 432}, { -1504, 552, 328}, { -1944, 352, 336}, { -2208, 392, 304}, { -2072, 536, 624}, { -1888, 168, 440}, { -1688, ...
{ 0, 656, 904}, { 72, 584, 728}, { 120, 584, 688}, { 160, 616, 808}, // 63 seconds { 64, 792, 888}, { 80, 704, 808}, { 112, 712, 696}, { 112, 648, 616}, { 120, 536, 656}, { 120, 512, 648}, { 160, 544, 712}, { 200, 504, 800}, { 264, 536, 840}, { 264, 504, 864}...
pixel_max}); graphics_draw_line(ctx, (GPoint) {.x = pixel_min, .y = mid_pixel_minus_one + i}, (GPoint) {.x = pixel_min + TICK_LENGTH, .y = mid_pixel_minus_one + i}); graphics_draw_line(ctx, (GPoint) {.x = pixel_max - TICK_LENGTH, .y = mid_pixel_minus_one + i}, ...
app_state_set_user_data(data)
; Window *window = &data->window; window_init(window, "MfgDisplayCalibration"); window_set_fullscreen(window, true); window_set_click_config_provider(window, prv_config_provider); Layer *layer = window_get_root_layer(window); layer_set_update_proc(layer, prv_layer_update_proc); mfg_info_get_serialnumbe...
, int16_t x2, GColor color) { // FIXME PBL-34552: This test produces an incorrect image, see JIRA const Fixed_S16_3 x1_fixed = (Fixed_S16_3) { .integer = x1 }; Fixed_S16_3 x2_fixed = (Fixed_S16_3) { .integer = x2 }; const uint8_t gradient_widt...
graphics_context_mask_create(ctx, true /* transparent */)
; cl_assert(transparent_mask); // Verify all mask pixels are initialized to be transparent (0) prv_verify_mask_pixel_values(ctx, transparent_mask, 0); graphics_context_mask_destroy(ctx, transparent_mask); GDrawMask *opaque_mask = graphics_context_mask_create(ctx, false /* transparent */); cl_assert(opaque_...
{ 1040, 776, -72}, { 1408, 632, 32}, { 1776, 624, 56}, { 1896, 528, 64}, { 1848, 432, 64}, { 1800, 408, 0}, { 1728, 416, -152}, { 1528, 264, -192}, { 1296, 136, -208}, { 1104, -208, -104}, { 896, -416, -184}, { 1016, -304, -232}, { 1408, -104, -96}, { 1632, 176, -224}...
{ 1432, 80, -160}, { 1624, 168, -304}, { 1504, 248, -328}, { 1400, 336, -296}, { 1448, 432, -168}, { 1544, 616, 8}, { 1376, 728, -48}, { 1352, 1088, -392}, { 1304, 976, -304}, { 944, 864, -168}, { 1152, 896, -80}, { 928, 744, -200}, { 1152, 816, -200}, { 1616, 704...
st_head, NULL); window_stack->removed_list_head = list_insert_before(window_stack->removed_list_head, &next_item->list_node); window_set_on_screen(next_item->window, false /* not new */, true /* call handlers */); } while (true); window_stack_pop(w...
window_stack_count(stack)
; size_t idx = 0; if (count > 0) { *dump = kernel_calloc(count, sizeof(WindowStackDump)); if (*dump) { WindowStackItem *item = (WindowStackItem *)stack->list_head; while (item) { (*dump)[idx++] = (WindowStackDump) { .addr = item->window, .name = window_get_debug_name(...
/* * 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(crc, CRC32_INIT)
X pin PBL_ASSERTN(!dev->half_duplex); gpio_af_init(&dev->rx_gpio, otype, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); } // configure the UART peripheral control registers // - 8-bit word length // - no parity // - RX / TX enabled // - 1 stop bit // - no flow control dev->periph->CR1 = cr1_extra_flags; ...
{ // read the data regardless since it will clear interrupt flags return dev->periph->DR; }
/* * 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 (enable_access) { __atomic_or_fetch(&PWR->CR1, PWR_CR1_DBP, __ATOMIC_RELAXED); } else { __atomic_and_fetch(&PWR->CR1, ~PWR_CR1_DBP, __ATOMIC_RELAXED); }
/* * 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...
DMA_DeInit(FLASH_DMA_STREAM)
; DMA_DeInit(FLASH_TX_DMA_STREAM); /* RX DMA config */ DMA_StructInit(&dma_config); dma_config.DMA_Channel = FLASH_DMA_CHANNEL; dma_config.DMA_DIR = DMA_DIR_PeripheralToMemory; dma_config.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; dma_config.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; dma_...
ns, GAPLEClientKernel); // Simulate getting the subscription failure: ppogatt_handle_subscribe(s_characteristics[0][PPoGATTCharacteristicData], BLESubscriptionNotifications, BLEGATTErrorReadNotPermitted); cl_assert_equal_i(ppogatt_client...
prv_receive_reset_request(s_characteristics[0][PPoGATTCharacteristicData])
; fake_gatt_client_op_assert_no_write(); } void test_ppogatt__ignore_server_reset_request_while_resetting_due_to_own_reset_request(void) { prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], (const uint8_t ...
ommand_private.h" #include "applib/graphics/graphics_private_raw.h" #include "stubs_applib_resource.h" #include "stubs_app_state.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_pbl_malloc.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include <stdi...
(&ctx, image, GPoint(0, 0))
; // Write output to file of the same name with extension replaced with .png char output[strlen(filename) + 5]; // add space for .pdc + '\0' prv_get_base_path(filename, output); strcat(output, ".png"); write_gbitmap_to_pbi(&ctx.dest_bitmap, output, s_pbi2png_path); prv_teardown_context(&ctx); } static ...
s_num_ds_notifications_received += 2; } else if (uid == invalid_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_invalid_attribute_length), (uint8_t*) s_invalid_attribute_length); s_num_ds_notifications_received++; } else if (uid == loading_uid) { prv_fake_receiving_ds_notification(ARRA...
prv_send_notification((uint8_t *)&s_complete_dict)
; prv_send_notification((uint8_t *)&s_complete_dict); prv_send_notification((uint8_t *)&s_complete_dict); cl_assert_equal_i(s_num_requested_notif_attributes, 4); cl_assert_equal_i(s_num_ds_notifications_received, 4); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 4); // Ge...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_draw_pixel(ctx, GPoint(5, -5))
; } void outside_x_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(15, 15)); } void outside_nx_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(c...
rite the new message snprintf(log, 100, "Generation 0x%x", i); setup_and_test_expected_msg(&log, 0, 0, 1); for (int gen = 0; gen < MIN(gens_avail, i); gen++) { // Check to make sure the most recent log gens are around snprintf(log, 100, "Generation 0x%x", i - gen); setup_and_test_expected...
{ flash_logging_init(); const int log_len = 49; int num_logs = 0; char **logs = generate_unique_logs(20222, log_len, &num_logs); for (int i = 0; i < num_logs; i++) { uint8_t write_sizes[4] = { log_len / 2, log_len / 4, log_len / 8, log_len }; int bytes_remaining = log_len; uint32_t addr = flash...
a we read matches what we expect // anyway if (!errors.framing_error) { PBL_LOG(LOG_LEVEL_WARNING, "UART ERROR: 0x%x 0x%d", (int)errors.error_mask, (int)dr); return false; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Dialog bootrom framing error, continuing onward"); } } i...
PBL_LOG(LOG_LEVEL_ERROR, "Error waiting for chip ID / start message (i=%"PRIu32")", i)
ude "system/reboot_reason.h" #include "system/reset.h" EventServiceInfo bt_state_change_event_info; typedef enum { BtTestStateInit = 0, BtTestStateStopped, BtTestStateStarting, BtTestStateStopping, BtTestStateStarted, BtTestStateFailed, BtTestStateResetting, BtTestStateNumStates, } BtTestState; stat...
text_layer_set_text(title, "BT Test Mode")
; layer_add_child(&window->layer, &title->layer); TextLayer *status = &data->status; text_layer_init(status, &GRect(0, 50, window->layer.bounds.size.w, window->layer.bounds.size.h - 30)); text_layer_set_font(status, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text(status...
r = expect_failure; } #endif void flash_write_bytes(const uint8_t *buffer, uint32_t start_addr, uint32_t buffer_size) { mutex_lock(s_flash_lock); stop_mode_disable(InhibitorFlash); // FIXME: PBL-18028 s_analytics_write_bytes_count += buffer_size; s_system_analytics_write_bytes_count += ...
{ flash_impl_set_nvram_erase_status(is_subsector, addr); mutex_unlock(s_flash_lock); return (s_erase.expected_duration * 7 / 8); }
else { stop_mode_enable(InhibitorFlash); s_erase.in_progress = false; mutex_unlock(s_flash_lock); xSemaphoreGive(s_erase_semphr); // Only run the callback with no locks held so that the callback won't // deadlock if it kicks off another sector erase. on_complete_cb(context, status); ret...
ng event"); break; default: WTF; } } static void prv_start_dictation(VoiceUiData *data) { VOICE_LOG("Start dictation session"); PBL_ASSERTN(data->session_id == VOICE_SESSION_ID_INVALID); data->session_id = sys_voice_start_dictation(data->session_type); if (data->session_id == VOICE_SESSION_ID...
animation_set_delay((Animation *) expand, delay_duration)
; // If overshoot > 0 shrink to min size, otherwise shrink from max to min int16_t current_size = (overshoot != 0) ? overshoot + max : max; shrink = prv_create_int16_prop_anim(current_size, min, stage_duration, &s_animated_dot_impl, data); if (!shrink) { goto cleanup; } revert = prv_create_int1...
nclude "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_syscalls.h" #include "stubs_ta...
((GRect){ .size = max_size }, margin.x, margin.y)
; const GSize used_size = prv_draw_emoji(&s_ctx, &max_draw_frame, &s_font_info, false /* render */); // Resize the canvas to the used size. const GSize canvas_size = { max_width, used_size.h + 2 * margin.y }; prv_prepare_canvas(canvas_size, GColorWhite); // Create th...
//! This function should be used instead of vibe_ctl so that the vibe //! history is kept in sync with the vibe state. //! The caller must be holding s_vibe_pattern_mutex static void prv_vibes_set_vibe_strength(int32_t new_strength) { mutex_assert_held_by_curr_task(s_vibe_pattern_mutex, true); if (!s_vibe_service_...
prv_vibes_set_vibe_strength(s_vibe_queue_head->strength)
; s_pattern_in_progress = true; bool success = new_timer_start(s_pattern_timer, s_vibe_queue_head->duration_ms, prv_timer_callback, NULL, 0 /*flags*/); PBL_ASSERTN(success); mutex_unlock(s_vibe_pattern_mutex); } DEFINE_SYSCALL(void, sys_vibe_pattern_clear, void) { mutex_lock(...
L) { return; } // check that at least enough time has elapsed since the last turn-off // TODO: is this necessary in bootloader? static const uint32_t MIN_STOP_TIME_MS = 10; delay_ms(MIN_STOP_TIME_MS); bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl); bus_pin_cfg_input(BOARD_CONFIG.i2...
(s_initialized)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GRect(0, 0, 10, 10)
current_depth, const bool descend) { return prv_layer_tree_traverse_next(stack, max_depth, current_depth, descend); } void layer_render_tree(Layer *node, GContext *ctx) { // NOTE: make sure to restore ctx->draw_state before leaving this function const GDrawState root_draw_state = ctx->draw_state; uint8_t curre...
if (frame->size.w > visible_width || frame->size.h > visible_height) { layer->bounds.size.w += MAX(frame->size.w - visible_width, 0); layer->bounds.size.h += MAX(frame->size.h - visible_height, 0); }
} layer_mark_dirty(layer); } void layer_set_frame_by_value(Layer *layer, GRect frame) { layer_set_frame(layer, &frame); } void layer_get_frame(const Layer *layer, GRect *frame) { *frame = layer->frame; } GRect layer_get_frame_by_value(const Layer *layer) { GRect frame; layer_get_frame(layer, &frame); ...
/* * 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(should_store == false)
; cl_assert(is_invalid == true); } void test_hdlc__decode_escaped_special(void) { // 2 escaped special characters uint8_t data; bool should_store, is_invalid, is_complete; HdlcStreamingContext ctx; hdlc_streaming_decode_reset(&ctx); // escaped escape character data = HDLC_ESCAPE; is_complete = hdlc_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_analytics_storage_mutex)
; } /////// // Get AnalyticsHeartbeat *analytics_storage_hijack_device_heartbeat() { PBL_ASSERTN(analytics_storage_has_lock()); AnalyticsHeartbeat *device = s_device_heartbeat; s_device_heartbeat = analytics_heartbeat_device_create(); PBL_ASSERTN(s_device_heartbeat); return device; } AnalyticsHeartbeatLi...
else { return GAP_DISC_MODE_NON_DISCOVERABLE; } } ble_error_t advert_set_interval(uint16_t min_slots, uint16_t max_slots) { // No need to lock / take here, this API just sets a couple vars in ble_mgr_dev_params, // while holding the ble_mgr_dev_params lock. ble_error_t rv = ble_gap_adv_intv_set(min_slots,...
prv_lock()
; { s_desired_host_adv_state = AdvertState_Running; prv_try_to_enter_host_desired_state(); rv = s_adv_state; } prv_unlock(); return rv; } void advert_disable(void) { prv_lock(); { s_desired_host_adv_state = AdvertState_Off; prv_try_to_enter_host_desired_state(); } prv_unlock(); } v...
izeof(Uuid)); // One should fit though: cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 1), true); cl_assert_equal_i(memcmp(expected_ad_data, ad->data, sizeof(expected_ad_data)), 0); cl_assert_equal_i(ad->ad_data_length, sizeof(expected_ad_data)); cl_assert_equal_i(ad->scan_r...
(ad, 0x1234, (uint8_t *) "hello world", 11)
, true); cl_assert_equal_i(memcmp(expected_ad_data, ad->data, ad->ad_data_length), 0); ble_ad_destroy(ad); } void test_ble_ad_parse__set_flags(void) { BLEAdData *ad; ad = ble_ad_create(); const uint8_t flags = 0x03; const uint8_t expected_ad_data[] = { 1 /* +1 for Type byte */ + 1 /* uint8_t with va...
------------------------------------------------------------------------------------------------ bool shared_circular_buffer_write(SharedCircularBuffer* buffer, const uint8_t* data, uint16_t length, bool advance_slackers) { // If no clients, no need to write if (!buffer->clients) { PBL_LOG(LOG_LEVEL_WARN...
(data, read_ptr, chunk)
; shared_circular_buffer_consume(buffer, client, chunk); data += chunk; bytes_left -= chunk; } return (*length_out == length); } // ------------------------------------------------------------------------------------------------- void shared_circular_buffer_add_subsampled_client( SharedCircularB...
_ORIGIN_RECT, RADIUS_MEDIUM, GCornerBottomLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quad_bottom_left.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_origin_layer.${BIT_DEPTH_NAME}.pbi"))
; layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&la...
ocess_storage == ProcessStorageFlash) { return ((const PebbleProcessMdFlash*) md)->build_id; } return NULL; } ////////////////////// // Md Builders ////////////////////// static void prv_init_from_info_common(PebbleProcessMd *common, const PebbleProcessInfo *info, PebbleTask task, ProcessStorage process...
{ return ((flags & PROCESS_INFO_ROCKY_APP) != 0); }
uint16_t process_metadata_flags_stored_sdk_platform(PebbleProcessInfoFlags flags) { return (flags & PROCESS_INFO_PLATFORM_MASK); } static const Version first_3x_version = { PROCESS_INFO_FIRST_3X_SDK_VERSION_MAJOR, PROCESS_INFO_FIRST_3X_SDK_VERSION_MINOR, }; static const Version first_4x_version = { PROCESS_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...
(event.type, PEBBLE_TOUCH_EVENT)
; cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_Touchdown, &GPoint(15, 100), 3686400, 3, &GPointZero, 0, 0, true); touch_event = touch_event_queue_get_ev...
minimum_stub_height) { // Show the minimum stub bar if progress just began bar_height = minimum_stub_height; } return bar_height; } static void prv_setup_day_bar_box(int weekday, GRect *box, int16_t bar_height) { const int w = 23; // normal bar width; #if PBL_RECT // The center bars are slightly wider...
prv_setup_day_bar_box(i, &box, last_bar_height)
runtime_context_deinit(); } fake_pbl_malloc_check_net_allocs(); } static const RockyGlobalAPI *s_graphics_api[] = { &GRAPHIC_APIS, NULL, }; #define PP(x, y) \ GPointPrecise((int16_t)(((x)) * FIXED_S16_3_FACTOR), \ (int16_t)(((y)) * FIXED_S16_3_FACTOR)) void test_rocky_api_graphics_path2d__...
cl_assert_equal_i(3, lc->path.num_points)
; cl_assert_equal_point(GPoint(6, 7), lc->path.points[0]); cl_assert_equal_point(GPoint(8, 9), lc->path.points[1]); cl_assert_equal_point(GPoint(11, 12), lc->path.points[2]); EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.arc(1, 2, 3, 4, 5);\n" "ctx.fill();\n" , "TypeError: fill() does not support arc()"); } voi...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_missed_call_timer_id)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&meta_response_info)
failed // i2c read means we are connected to a USB cable return true; #else PBL_LOG(LOG_LEVEL_DEBUG, "Failed to read charging status B register"); return false; #endif } bool usb_connected = (val >> 3) & 1; return usb_connected; } void pmic_read_chip_info(uint8_t *chip_id, uint8_t *chip_revisio...
{ register_dump(0x00, 0x1F); }
#ifdef RECOVERY_FW void command_pmic_rails(void) { prv_mon_config_lock(); // Make sure the LDO3 rail is on before measuring it. set_ldo3_power_state(true); for (size_t i = 0; i < ARRAY_LENGTH(MON_CONFIG); ++i) { prv_set_mon_config(&MON_CONFIG[i]); ADCVoltageMonitorReading reading = battery_read_volt...
/* * 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(result.y, 0)
; } void test_gtypes__gpoint_scale_by_gsize_to_zero(void) { GSize from = GSize(10, 20); GSize to = GSizeZero; GPoint point = GPoint(10, 10); GPoint result = GPointZero; result = gpoint_scale_by_gsize(point, from, to); cl_assert_equal_i(result.x, 0); cl_assert_equal_i(result.y, 0); } #define cl_assert_e...
0); // Test if there are any notifications in the list. if (first_row) { // Draw "Clear all" box and exit #if PBL_ROUND draw_cell(ctx, cell_layer, i18n_get("Clear All", data), NULL, NULL); #else const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle); GRect box = cell_...
{ Uuid *id = e->sys_notification.notification_id; switch(e->sys_notification.type) { case NotificationAdded: prv_handle_notification_added(id); break; case NotificationRemoved: prv_handle_notification_removed(id); break; case NotificationActedUpon: prv_h...
_INT_EN_0_SLOPE_Z_EN); bma255_write_register(BMA255Register_INT_MAP_0, BMA255_INT_MAP_0_INT1_SLOPE); // configure the anymotion interrupt to fire after 4 successive // samples are over the threhold specified accel_set_shake_sensitivity_high(false /* sensitivity_high */); bma255_write_register(BMA255Register...
(LOG_LEVEL_DEBUG, "Self test axis %c: %d Pos: %d Neg: %d Delta: %d (required %d)", AXIS_NAMES[axis], before, positive, negative, delta, SELFTEST_THRESHOLDS[axis])
; if (delta < SELFTEST_THRESHOLDS[axis]) { PBL_LOG(LOG_LEVEL_ERROR, "Self test failed for axis %c: %d < %d", AXIS_NAMES[axis], delta, SELFTEST_THRESHOLDS[axis]); return false; } if ((new_data + new_negative + new_positive) != 3) { PBL_LOG(LOG_LEVEL_ERROR, "Self test problem? Not logging ...
icon_top_default_margin_px; } static void prv_get_text_box(GSize frame_size, GSize icon_size, int icon_top_margin_px, GRect *text_box_out) { const uint16_t icon_text_spacing_px = PBL_IF_ROUND_ELSE(2, 4); const uint16_t text_x = TEXT_LEFT_MARGIN_PX; co...
{ app_dialog_push(&simple_dialog->dialog); }
void simple_dialog_init(SimpleDialog *simple_dialog, const char *dialog_name) { PBL_ASSERTN(simple_dialog); *simple_dialog = (SimpleDialog) { .icon_static = !SIMPLE_DIALOG_ANIMATED, }; dialog_init(&simple_dialog->dialog, dialog_name); Window *window = &simple_dialog->dialog.window; window_set_window_...
include "services/normal/settings/settings_file.h" #include <stdint.h> #include <string.h> #include "clar.h" // Stubs #include "stubs_alerts.h" #include "stubs_analytics.h" #include "stubs_app_state.h" #include "stubs_dialog.h" #include "stubs_event_service_client.h" #include "stubs_expandable_dialog.h" #include "st...
if (do_not_disturb_is_smart_dnd_enabled()) { do_not_disturb_toggle_smart_dnd(); }
ow_set_window_handlers(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, tr...
cl_assert_equal_i(app_window_stack_count(), 1)
; cl_assert_equal_i(window1->on_screen, true); app_window_stack_push(window2, true); cl_assert_equal_i(app_window_stack_count(), 2); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window2->on_screen, true); app_window_stack_remove(window1, false); cl_assert_equal_i(app_window_stack_co...
767, 1); check_atan2(1, 32767); check_atan2(32767, 0); check_atan2(0, 32767); check_atan2(23400, -25300); check_atan2(30500, -1930); check_atan2(-6, -310); check_atan2(15000, -19); check_atan2(34, -3200); check_atan2(-1508, 299); check_atan2(1020, 1002); } void test_math__ceil_log_two(void) { che...
cl_assert_equal_i(50, distance_to_mod_boundary(50, 100))
; cl_assert_equal_i(10, distance_to_mod_boundary(90, 100)); cl_assert_equal_i(10, distance_to_mod_boundary(110, 100)); cl_assert_equal_i(10, distance_to_mod_boundary(210, 100)); cl_assert_equal_i(10, distance_to_mod_boundary(-10, 100)); cl_assert_equal_i(50, distance_to_mod_boundary(-50, 100)); cl_assert_e...
{ -104, -16, -728}, { -128, -24, -648}, { -128, 24, -696}, { -184, 40, -824}, { -248, 136, -1000}, { -376, 216, -1192}, { -344, 328, -1352}, { -448, 200, -1864}, { -88, 688, -1552}, { -192, 304, -1176}, { -232, 336, -1096}, { -152, 320, -1016}, { -88, 152, -768}, ...
{ 992, 592, -504}, { 976, 528, -504}, { 1152, 456, -400}, { 1240, 280, -240}, { 1168, 200, -208}, { 1200, 136, -48}, { 1416, 272, -264}, { 1384, 112, -144}, { 1288, 232, -176}, { 1160, 144, -144}, { 960, 160, -272}, { 1072, 112, -104}, // 39 seconds { 272, -312, -...
{ 1176, 80, -336}, { 1336, 200, -384}, { 1240, 96, -288}, { 1312, 360, -256}, { 1520, 552, -352}, { 1576, 536, -192}, { 1400, 744, -240}, { 1056, 768, -304}, { 816, 960, -392}, { 840, 984, -392}, { 1056, 1120, -384}, { 1160, 752, -288}, { 1256, 672, -256}, { 1576...
(WeekdaySchedule)
== false); cl_assert(do_not_disturb_is_schedule_enabled(WeekendSchedule) == false); active = do_not_disturb_is_active(); cl_assert(active == false); // First toggles are no-ops in unit tests, because the logic that handles the first time tutorial // dialog are stubbed out /////////////////////////////////...
p(void *, size_t) size_t size = gdraw_command_sequence_get_data_size(sequence); GDrawCommandSequence *result = applib_malloc(size); if (result) { memcpy(result, sequence, size); } return result; } void gdraw_command_sequence_destroy(GDrawCommandSequence *sequence) { applib_resource_munmap_or_free(sequ...
{ return PLAY_DURATION_INFINITE; }
return prv_get_single_play_duration(sequence) * sequence->play_count; } uint32_t gdraw_command_sequence_get_num_frames(GDrawCommandSequence *sequence) { if (!sequence) { return 0; } return sequence->num_frames; }
imeline (will show up in the past) prv_add_pin(id, config, rtc_get_time(), NULL); // Send one triggered event for the alarm prv_analytics_op(id, config, (void *)(uintptr_t)AnalyticsEvent_AlarmTriggered); return false; } // ---------------------------------------------------------------------------------------...
(fd, &key, sizeof(key), &config, sizeof(config))
/* * 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...
(GColorClearARGB8, fun(GColorClear).argb)
; // // obvious cases cl_assert_equal_i(GColorWhiteARGB8, fun(GColorBlack).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorWhite).argb); // // expectation as derived from Appfaces_all.psd cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xff0000)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GCo...
/* * 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...
(num.integer == -2)
; cl_assert(num.fraction == 7); // This confirms that the fixed number is (2^FIXED_S16_3_PRECISION)*(float value) test_num = -9; cl_assert(memcmp(&num, &test_num, sizeof(Fixed_S16_3)) == 0); test_num = (int16_t)((float)-1 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_...
the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License...
prv_write_or_read_bytes(s_vector_table, vector_table_copy_size, false)
; prv_send_crc_of_mem_region(&s_vector_table[0], vector_table_copy_size); } static void prv_handle_reboot_command(void) { debug_print_str("RT CMD\n"); const uint32_t vt_start_addr = DATA_RAM_BASE_ADDRESS; // We are about to overwrite the vector table. Disable interrupts while // this is taking pl...
ta->core_ui_container, &s_phone_ui_data->caller_id_text_layer.layer); // Shrink the bounds but not the frame size to allow for centering when action bar removed s_phone_ui_data->caller_id_text_layer.layer.bounds.size.w = width - TEXT_RIGHTSIDE_PADDING; // Status text const GRect call_status_t...
prv_set_icon_resource((can_decline) ? TIMELINE_RESOURCE_DURING_PHONE_CALL : TIMELINE_RESOURCE_DURING_PHONE_CALL_CENTERED)
; #endif prv_set_window_color(ACCEPT_COLOR, false); prv_action_bar_setup(can_decline ? PhoneCallActions_Decline : PhoneCallActions_None); prv_start_call_duration_timer(); prv_set_answer_window(); } void phone_ui_handle_call_end(bool call_accepted, bool disconnected) { if (!s_phone_ui_data) { PBL_LOG(L...
e "screenshot_pp.h" #include "compositor.h" #include "applib/graphics/framebuffer.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "services/common/comm_session/session_send_buffer.h" #include "services/common/system_task.h" #include "system/logging.h" #include "util/attributes.h" #include "u...
if (framebuffer_row_is_larger_than_chunk) { state->col = remaining_chunk_bytes * cols_per_byte; } else { state->col = 0; state->row++; }
remaining_chunk_bytes -= remaining_framebuffer_row_bytes; output_buffer_with_offset += remaining_framebuffer_row_bytes; } return max_chunk_bytes - remaining_chunk_bytes; } void screenshot_send_next_chunk(void* raw_state) { ScreenshotState* state = (ScreenshotState*)raw_state; CommSession *session =...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
health_service_events_subscribe(prv_health_service_event_handler, health_app_data)
0x00, 0x00, 0x00, 0x00, 0x00 }, .timestamp = 60 * SECONDS_PER_MINUTE, .duration = 30, .type = TimelineItemTypePin, .all_day = false, .layout = LayoutIdCalendar, }, .attr_list = { .num_attributes = 1, .attributes = &title_attr, }, }; // back-to-back calendar event 2 static TimelineItem...
(1 /* num_invoke */)
; } void test_timeline_peek_event__no_events(void) { CHECK_NO_EVENTS( .count = 1, .is_future_empty = true ); } void test_timeline_peek_event__calendar_event(void) { ADD_EVENT( .item = &s_item1 ); CHECK_EVENT( .count = 2, .item_id = s_item1.header.id, .num_concurrent = 0, .timeout_ms = SECONDS_PER...
const SmartstrapProfileGetInfoFunc s_profile_info_functions[] = { #define REGISTER_SMARTSTRAP_PROFILE(f) f, #include "services/normal/accessory/smartstrap_profile_registry.def" #undef REGISTER_SMARTSTRAP_PROFILE }; // every profile except for SmartstrapProfileInvalid should be registered _Static_assert(NUM_PROFILES() ...
if (!smartstrap_is_connected()) { PBL_LOG(LOG_LEVEL_WARNING, "Dropped notification due to not being connected."); return; }
// dispatch the notification based on the profile const SmartstrapProfileInfo *info = prv_get_info_by_profile(profile); if (info && info->notify) { smartstrap_state_lock(); info->notify(); smartstrap_state_unlock(); } else { PBL_LOG(LOG_LEVEL_WARNING, "Dropped notification for unsupported prof...
true /*teardown*/); return true; } // ------------------------------------------------------------------------------------------- void animation_unschedule_all(void) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (animation_private_using_legacy_2(state)) { // We need to enable oth...
animation_legacy2_set_implementation((AnimationLegacy2 *)animation_h, (const AnimationLegacy2Implementation *)implementation)
if (!s_current_completion_status.use_legacy_mode) { return false; } LegacyFwUpdateCompletionStatus *status = &s_current_completion_status.legacy_status; if (s_is_recovery_fw) { *progress = MIN(100, status->recovery_percent_completion); } else { *progress = MIN(100, (status->resource_perc...
(s_firmware_update_semaphore, 0)
// Set up the header if this dialog is set to have one. GTextAlignment alignment = PBL_IF_RECT_ELSE(GTextAlignmentLeft, (show_action_bar ? GTextAlignmentRight : GTextAlignmentCenter)); uint16_t right_aligned_box_reduction =...
{ action_bar_layer_set_background_color(action_bar, expandable_dialog->action_bar_background_color); }
if (expandable_dialog->select_icon) { action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_SELECT, expandable_dialog->select_icon, expandable_dialog->show_action_icon_animated); } action_bar_layer_set_context(action_bar, expandable_dialog); action_bar_layer_set_click_config_provider...
uint32_t read_bytes = dls_test_read(logging_session, buffer, num_bytes); cl_assert(read_bytes == num_bytes); uint32_t session_crc = legacy_defective_checksum_memory(buffer, num_bytes); cl_assert(crc == session_crc); dls_test_consume(logging_session, num_bytes); cl_assert(dls_test_get_num_bytes(logging_se...
cl_assert(logging_sessions[i])
; fake_system_task_callbacks_invoke_pending(); } // Log Consume for (int i = 0; i < 10; i++) { prv_log_consume_random(logging_sessions[i], item_size[i], rand() % 123); } } // ---------------------------------------------------------------------------------------- // Test writing and consuming so much...
turn the charger off and on again, then configure the charger to our // desired settings. The PMIC then recovers into a charge state. This will hopefully work for // most watches. prv_write_register(PmicRegisters_CHG_CNTL_A, 0xCD); pmic_set_charger_state(false); pmic_set_charger_state(true); const uint8_t...
{ // We enabled the rail! *ref_count = 1; // We need to wait a bit for the rail to stabilize before continuing to use the device. // It takes 2.6ms for the LDO rails to ramp. psleep(3); return true; }
return false; } } else { if (*ref_count <= 1) { // 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! ...
m >> 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...
prv_draw_scene(SCENE_UPDATE)
; } } void display_error_code(uint32_t error_code) { prv_set_parameter(error_code); prv_draw_scene(SCENE_ERROR); } void display_prepare_for_reset(void) { prv_screen_off(); }
size.w - right_margin_px - left_margin_px - action_bar_offset - right_aligned_box_reduction; #else x = 0; w = frame.size.w - right_margin_px - action_bar_offset - right_aligned_box_reduction; #endif y = icon ? icon_offset + icon_size.h : -HEADER_OFFSET; TextLayer *header_layer = &expandable_dia...
(action_bar, window)
; } else { window_set_click_config_provider_with_context(window, prv_config_provider, expandable_dialog); } x = PBL_IF_RECT_ELSE(left_margin_px, (show_action_bar) ? (frame.size.w - right_margin_px - left_margin_px - action_bar_offset - right_aligned_box_reduction - icon_size.h) : (90 - ico...
/* * 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...
(&qspi_config)
; qspi_config.QSPI_SShift = QSPI_SShift_HalfCycleShift; // QSPI clock = AHB / (1 + QSPI_Prescaler) qspi_config.QSPI_Prescaler = prescaler - 1; qspi_config.QSPI_CKMode = QSPI_CKMode_Mode0; qspi_config.QSPI_CSHTime = QSPI_CSHTime_1Cycle; qspi_config.QSPI_FSize = fsize_value; qspi_config.QSPI_FSelect = QSPI_...
_num_writebacks, 7); } void test_blob_db_sync__sync_some(void) { char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { "val1", "val2", "val3", "val4", "val5" }; int value_len = strlen(values[0]); // insert all keys, mark some as synced for (int i = 0;...
(reminders_session)
; // reset fake blob db so cleanup doesn't assert fake_blob_db_set_id(BlobDBIdTest); blob_db_init_dbs(); }
/* * 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...
for (uint32_t i = 0; i < data_len * 2; i++) { uint8_t nibble = data[i / 2]; if (i % 2 == 0) { nibble >>= 4; } uint8_t index = nibble ^ (crc >> 4); crc = lookup_table[index & 0xf] ^ ((crc << 4) & 0xf0); }
return crc; } static void prv_wait_for_flash_not_busy(void) { while ((*(volatile uint32_t *)FLASH_SR_ADDR) & (1 << 16)); // BSY flag in FLASH_SR } __attribute__((__noreturn__)) void Reset_Handler(void) { // Disable all interrupts __asm__("cpsid i" : : : "memory"); volatile uint32_t *flash_sr = (volatile ...
se); 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 bus_idx) { if (BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_fn == NULL) { return; } // chec...
ARRAY_LENGTH(i2c_buses)
; i++) { if (BOARD_CONFIG.i2c_bus_configs[i].rail_cfg_fn) { BOARD_CONFIG.i2c_bus_configs[i].rail_cfg_fn(); } if (BOARD_CONFIG.i2c_bus_configs[i].rail_ctl_fn) { bus_rail_power_down(i); } } } void i2c_use(I2cDevice device_id) { PBL_ASSERTN(s_initialized); PBL_ASSERT(device_id < BOARD_CO...
i_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax1_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); // Should draw same as rmax1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1, GCornersAll); cl_ch...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_right.${BIT_DEPTH_NAME}.pbi"))
ecise_stroked_aa(ctx, p0, p1, data->stroke_width); } else { graphics_draw_line(ctx, GPoint(p0.x.integer, p0.y.integer), GPoint(p1.x.integer, p1.y.integer)); } return; } if (data->operation == OP_ROTATE3) { int line_length = 60; time_t now; uint16_t now_ms = t...
(s_window)
; } static void s_main(void) { init(); app_event_loop(); deinit(); } const PebbleProcessMd* stroke_width_get_app_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = s_main, .name = "Stroke Width" }; return (const PebbleProcessMd*) &s_app_info; }
ator = new_den; } PBL_LOG(LOG_LEVEL_DEBUG, "set subsampling for session %d to %d/%d", (int)state->session_ref, state->subsample_numerator, state->subsample_denominator); state = (AccelSubscriberState *)state->list_node.next; } // Configure the driver accel_set_sampling_rate(highest_rate...
milliseconds_to_ticks(10)
); } } } mutex_unlock_recursive(s_mutex); return result; } static bool prv_call_data_callback(AccelSubscriberState *state) { switch (state->task) { case PebbleTask_App: case PebbleTask_Worker: case PebbleTask_KernelMain: { PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
flash_erase_optimal_range(min_start, max_start, min_end, max_end, prv_callback, s_callback_ctx)
; prv_assert_erase_commands(expected_commands); prv_assert_callback_called( s_command_list_index? S_SUCCESS : S_NO_ACTION_REQUIRED); } // Tests /////////////////////////////////////////////////////////// void test_flash_erase__initialize(void) { s_command_list_index = 0; s_callback_called_count = 0; s...
LauncherAppGlanceWorkout *workout_glance = launcher_app_glance_structured_get_data(structured_glance); if (workout_glance) { kino_reel_destroy(workout_glance->icon); app_timer_cancel(workout_glance->timer); } app_free(workout_glance); } static bool prv_set_glance_icon(LauncherAppGlanceWorkout *w...
(sizeof(*workout_glance))
; // Copy the name of the Workout app as the title const size_t title_size = sizeof(workout_glance->title); strncpy(workout_glance->title, node->name, title_size); workout_glance->title[title_size - 1] = '\0'; const bool should_consider_slices = false; LauncherAppGlanceStructured *structured_glance = ...