prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
void) { uint8_t result = prv_flash_send_and_receive_byte(FLASH_CMD_DUMMY); return result; } static void prv_flash_wait_for_write_bounded(volatile int cycles_to_wait) { prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ_STATUS_REG); uint8_t status_register = 0; do { if (cycles_to_wa...
prv_flash_write_enable()
; prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_ERASE_SECTOR); prv_flash_send_24b_address(sector_addr); prv_flash_end_cmd(); prv_flash_wait_for_write(); } static void prv_flash_erase_subsector(uint32_t sector_addr) { prv_flash_write_enable(); prv_flash_start_cmd(); prv_flash_send_...
(fd, (uint8_t *)buf, len)
== len); cl_assert(pfs_close(fd) == S_SUCCESS); if (num_erases != (erase_count - 1)) { cl_assert(pfs_remove(file_small) == S_SUCCESS); } } } int original_page_count = num_pages(); ftl_populate_region_list(); // make sure something was added PBL_LOG(LOG_LEVEL_DEBUG, "original pa...
c void prv_handle_ready_event(VoiceUiData *data, PebbleVoiceServiceEvent *event) { VOICE_LOG("Handling ready event"); switch (event->status) { case VoiceStatusSuccess: VOICE_LOG("Session setup successfully"); data->start_ms = prv_get_time_ms(); data->speech_detected = false; data->dicta...
prv_show_connectivity_error_and_exit(data)
; break; case VoiceStatusErrorGeneric: VOICE_LOG("Result: error %"PRId8, event->status); prv_handle_dictation_error(data, event->status); break; case VoiceStatusRecognizerResponseError: VOICE_LOG("Result: speech not recognized"); prv_handle_dictation_error(data, event->stat...
// We have seen this crop up for cases where the phone has disconnected due to a timeout // but the watch has not yet. In practice, I think the only way it could happen is if a // user is sitting in the Bluetooth settings menu and walking in and out of range. If it // does take place, let...
(LOG_LEVEL_INFO, "LE Disconn: addr="BT_DEVICE_ADDRESS_FMT", is_random_addr=%u,", BT_DEVICE_ADDRESS_XPLODE(event->peer_address.address), event->peer_address.is_random_address)
; PBL_LOG(LOG_LEVEL_INFO, " hdl=%u, status=0x%02x, reason=0x%02x, master=%u", event->handle, event->status, event->reason, local_is_master); bluetooth_analytics_handle_disconnect(local_is_master); bluetooth_analytics_handle_connection_disconnection_event( Analytics...
_I2C_BUS_COUNT]; static uint32_t s_guard_events[] = { I2C_EVENT_MASTER_MODE_SELECT, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED, I2C_EVENT_MASTER_BYTE_TRANSMITTED, I2C_EVENT_MASTER_MODE_SELECT, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED, I2C_EVENT_MASTER_BYTE_RECEIVED, I2C_EVENT_MASTER_BYTE_TRANSMITTING, I...
(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl)
; bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda); BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_fn(true); } //! Initialize the I2C peripheral //! Lock the bus and peripheral config access before initialization static void bus_init(uint8_t bus_idx) { // Initialize peripheral I2C_InitTypeDef ...
800, 352}, { -304, 880, 392}, { -272, 800, 432}, { -304, 824, 376}, { -288, 864, 408}, { -296, 848, 392}, { -256, 840, 368}, // 183 seconds { -248, 752, 384}, { -264, 800, 376}, { -264, 760, 368}, { -288, 680, 344}, { -320, 672, 320}, { -344, 752, 384}, { -360, 8...
{ 136, 336, -864}, { 144, 360, -936}, { 136, 384, -952}, { 144, 400, -928}, { 120, 392, -952}, { 184, 328, -912}, { 152, 408, -944}, { 120, 496, -864}, { 128, 344, -872}, { 0, 472, -736}, { -40, 496, -816}, { -88, 536, -744}, { -16, 576, -800}, { -24, 680, -736}, ...
{ 48, 696, -680}, { 72, 672, -712}, { 56, 672, -688}, { 64, 640, -688}, { 40, 664, -680}, { 64, 688, -688}, { 48, 712, -680}, { 48, 680, -680}, { 48, 648, -712}, { 40, 648, -720}, { 56, 680, -680}, { 56, 672, -640}, { 72, 672, -664}, { 56, 656, -696}, { 40, 7...
/* * 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...
(60 * 1024, 60 * 1024, 2 * 64 * 1024, 2 * 64 * 1024)
; cl_assert_equal_i(s_command_list_index, 2); cl_assert_equal_i(s_command_list[0].addr, 60 * 1024); cl_assert_equal_i(s_command_list[0].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[1].addr, 64 * 1024); cl_assert_equal_i(s_command_list[1].type, SectorEraseCommand); s_command_list_index = ...
/* * 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...
(normalized, 1, 2, data->effect_duration)
; } else { intermediate = *from; second_normalized = normalized; } gdraw_command_list_scale_segmented_to( list, size, intermediate, *to, second_normalized, data->interpolate, index_lookup, data->point_duration, two_stage); const AnimationProgress stroke_width_progress = data->stroke_width....
/* * 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...
_Static_assert(sizeof(MovementData) % sizeof(uint32_t) == 0, "MovementData size is invalid")
76}, { 288, 0, -960}, { 368, 96, -1064}, { 392, 104, -1000}, { 464, 64, -976}, { 288, -112, -952}, { 224, -88, -912}, { 128, 0, -944}, { -8, 8, -1048}, { 48, 64, -1168}, { -16, 104, -1160}, { 24, 112, -1072}, { 168, -80, -952}, // 181 seconds { 240, -168, -888}, ...
{ 528, 784, 80}, { 496, 776, 104}, { 440, 736, 120}, { 360, 840, 184}, { 312, 760, 48}, { 304, 856, 112}, { 256, 752, 40}, { 304, 896, 40}, { 336, 712, -24}, { 392, 648, -88}, { 568, 600, -184}, { 736, 832, -224}, { 776, 800, -288}, { 808, 688, -336}, { 832, 5...
r.h" // Stubs //////////////////////////////////// #include "stubs_applib_resource.h" #include "stubs_app_state.h" #include "stubs_logging.h" #include "stubs_heap.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_queue.h" #include "stub...
gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, (60 - 1) * 100)
_line_dotted(&ctx, GPoint(14, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS + 1 ); ...
(&ctx, GPoint(20, 0), MAX_NUM_ROWS - 1)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_even_cols_no_clip"))); // Odd cols of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); ...
lude "stubs_bootbits.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_passert.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_queue.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_syscalls.h" ...
glyph_get_size_bytes(glyph)
; cl_assert_equal_m(a_glyph_data_bytes, glyph->data, glyph_size_bytes); glyph = text_resources_get_glyph(&s_font_cache, 'b', &s_font_info); glyph_size_bytes = glyph_get_size_bytes(glyph); cl_assert_equal_m(b_glyph_data_bytes, glyph->data, glyph_size_bytes); glyph = text_resources_get_glyph(&s_font_cache, 'c...
len(data->long_message); strncpy(transcription, data->long_message, len); transcription_dialog_update_text(transcription_dialog, transcription, len); app_transcription_dialog_push(transcription_dialog); transcription_dialog_set_callback(transcription_dialog, prv_transcription_dialog_cb, data); } //////////////...
("Dialogs")
); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_stack_push(window, animated); } static void prv_handle_deinit() { DialogsData *data = app_state_get_user_data(); menu_layer_deinit(&data->m...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(BOARD_CONFIG.mic_config.spi, BOARD_CONFIG.mic_config.spi_clock_ctrl)
; periph_config_release_lock(); gpio_use(BOARD_CONFIG.mic_config.i2s_ck.gpio); gpio_use(BOARD_CONFIG.mic_config.i2s_sd.gpio); // Configure pins as SPI/I2S pins GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStru...
/* * 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...
(msg, (const uint8_t *)&payload, sizeof(payload))
; break; } default: PBL_LOG(LOG_LEVEL_ERROR, "HcGap: unhandled message id: %d", msg->command_id); } } void hc_endpoint_gap_service_mtu_changed(const Connection *connection, uint16_t mtu) { HcProtocol_GapServiceMtuChanged mtu_resp = {}; connection_get_address(connection, &mtu_resp.addr); mtu...
/* * 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...
{ *hours = (duration_s / SECONDS_PER_HOUR) ?: INT_MIN; *minutes = ((duration_s % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE) ?: INT_MIN; if (*minutes == INT_MIN && *hours == INT_MIN) { *hours = 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...
(s_num_bytes_sent, LOG_METADATA_LENGTH + 20)
; cl_assert_equal_s(s_log_message_buffer, "TestTestTestTestTest"); } void test_pulse_logging__simple_trucate(void) { pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTest" "TestTestTestTestTestTestTestTestTestTest" ...
nsfer bus->state->transfer = (I2CTransfer) { .device_address = device_address, .register_address = register_address, .direction = direction, .type = type, .size = size, .idx = 0, .data = data, }; i2c_hal_init_transfer(bus); bus->state->transfer_nack_count = 0; bus->state->transfe...
(slave, register_address, 1, &value)
; } bool i2c_write_register_block(I2CSlavePort *slave, uint8_t register_address_start, uint32_t write_size, const uint8_t* buffer) { PBL_ASSERTN(slave); PBL_ASSERTN(buffer); // Do transfer locks the bus bool result = prv_do_transfer(slave->bus, Write, slave->address, register_addr...
* num_values_per_sample; i++) { values[i] = i * 3; } // Create a session with an artifically small buffer size which will cause it to flush // automatically time_t start_time = rtc_get_time(); ProtobufLogConfig log_config = { .type = ProtobufLogType_Measurements, .measurements = { .num_typ...
cl_assert(session_ref != NULL)
; const uint32_t values_per_samples = input.msrmt.num_types; bool success; for (unsigned i = 0; i < input.msrmt.num_samples; i++) { rtc_set_time(input.msrmt.time_utc + input.msrmt.offset_sec[i]); uint32_t *vals = &input.msrmt.values[i * values_per_samples]; success = protobuf_log_hr_add_sample(sessio...
art.h" #include "drivers/dma.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "system/passert.h" #include "FreeRTOS.h" #define STM32F7_COMPATIBLE #include <mcu.h> #include <mcu/interrupts.h> // The STM32F2 standard peripheral library uses a precision of 100 which is plenty, so we'll do the /...
{ PBL_ASSERTN(dev->state->initialized); // wait for us to be ready to send while (!uart_is_tx_ready(dev)) continue; dev->periph->TDR = data; }
uint8_t uart_read_byte(UARTDevice *dev) { // explicitly clear the error flags to match up with F4 behavior prv_clear_all_errors(dev); // read the data regardless since it will clear interrupt flags return dev->periph->RDR; } UARTRXErrorFlags uart_has_errored_out(UARTDevice *dev) { uint16_t errors = dev->p...
et < content_size.h - scroll_bounds.size.h; offset += scroll_height) { // scroll offset for scroll down is negative, so invert offset.y cl_assert_equal_i(offset, -((int32_t)scroll_layer_get_content_offset(scroll_layer).y)); scroll_layer_scroll(scroll_layer, ScrollDirectionDown, false); } // can only sc...
cl_assert_equal_i(page_height * pages, -scroll_layer_get_content_offset(scroll_layer).y)
; }
(layout, ctx, true)
; break; default: break; } } static void prv_layout_init(NotificationLayout *layout, const LayoutLayerConfig *config); LayoutLayer *notification_layout_create(const LayoutLayerConfig *config) { NotificationLayout *layout = task_zalloc_check(sizeof(NotificationLayout)); if (!layout) { return ...
bgserial_putstr("Firmware is erased"); return true; } return false; } static void prv_sad_watch(uint32_t error_code) { dbgserial_putstr("SAD WATCH"); char error_code_buffer[12]; itoa_hex(error_code, error_code_buffer, sizeof(error_code_buffer)); dbgserial_putstr(error_code_buffer); display_error_co...
("Enabling watchdog")
; watchdog_init(); watchdog_start(); #endif gpio_disable_all(); prv_jump_to_fw(); } // Stubs for libg_s.a, which is our libc implementation from nano-newlib void _exit(int status) { }
aw_round_rect_origin_r4_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_clip_nxny.${...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3)
; graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 3); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_REC...
ze < 1) { return; } flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_PAGE_PROGRAM); flash_send_24b_address(start_addr); while (buffer_size--) { flash_send_and_receive_byte(*buffer); buffer++; } flash_end_cmd(); flash_wait_for_write(); prv_check_protect...
MIN(buffer_size, FLASH_PAGE_SIZE)
; } disable_flash_spi_clock(); power_tracking_stop(PowerSystemFlashWrite); flash_unlock(); } void flash_erase_subsector_blocking(uint32_t subsector_addr) { assert_usable_state(); PBL_LOG(LOG_LEVEL_DEBUG, "Erasing subsector 0x%"PRIx32" (0x%"PRIx32" - 0x%"PRIx32")", subsector_addr, subsector_a...
///////// // Timeline Iterator ///////////////////////// // Order of events in timeline: // * All day events appear first // * (All day events should be timestamped at midnight, the first second in the day) // * Order all other events by time // * For concurrent events: order by duration (shortest to longest), then by...
{ if (prv_show_event(current, timestamp, today_midnight, TimelineIterDirectionFuture, show_all_day_events)) { break; } current = (TimelineNode *)current->node.next; }
/////////////////////////////// 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_st...
app_timer_trigger(t)
, true); ASSERT_JS_GLOBAL_EQUALS_B("didError", true); EXECUTE_SCRIPT("didError = false;"); } // Timer for the 3rd should be set: AppTimer *t = rocky_api_app_message_get_session_closed_object_queue_timer(); cl_assert(t != EVENTED_TIMER_INVALID_ID); cl_assert_equal_b(fake_app_timer_is_scheduled(t), t...
a was already scheduled animation_set_handlers(seq, handlers, seq); animation_schedule(seq); // The duration of seq should include all of a and b uint32_t duration = animation_get_duration(seq, true, true); cl_assert_equal_i(duration, duration_a + delay_a + duration_b + delay_b); // The position of seq sh...
cl_assert_equal_i(duration, duration_a + delay_a + duration_b + delay_b)
; // The position of seq should be the amount we already played of a, including the 'a' delay // since a is embedded within seq int32_t position; animation_get_elapsed(seq, &position); cl_assert_equal_i(position, 100); // Now, advance sequence to almost the end of seq. Positions don't include the delay, ...
{ 0, 480, -896}, { 0, 480, -888}, { -8, 480, -888}, { -8, 480, -896}, { -16, 480, -888}, { -8, 488, -888}, { -16, 472, -896}, { -8, 464, -896}, { -8, 480, -888}, { -8, 480, -896}, { 0, 480, -904}, { -8, 480, -888}, { -16, 480, -880}, { -16, 496, -888}, { -16, 47...
{ -128, 416, -920}, { -88, 416, -920}, { -88, 472, -888}, { -40, 608, -984}, { -56, 560, -928}, // 16 seconds { -72, 480, -872}, { -72, 448, -864}, { 16, 496, -912}, { -32, 560, -896}, { -64, 528, -872}, { -56, 496, -872}, { -40, 504, -872}, { -48, 520, -864}, ...
{ -40, 480, -888}, { -40, 480, -888}, { -40, 480, -888}, { -40, 472, -888}, { -48, 480, -888}, { -40, 480, -888}, { -40, 480, -888}, { -40, 472, -888}, { -40, 480, -896}, { -32, 472, -888}, { -40, 480, -888}, { -40, 480, -888}, { -40, 472, -888}, // 19 seconds ...
/* * 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...
(0, font, color, container)
; text_node->text = text; return text_node; } void health_util_duration_to_hours_and_minutes_text_node(int duration_s, void *i18n_owner, GFont number_font, GFont units_font, GColor color, ...
t32_t KICK_TIMEOUT_INTERVAL = 2000; //! If we hit bus contention during sending, we should wait this number of milliseconds. static const uint32_t BUS_CONTENTION_INTERVAL = 100; //! Subscriber information static int s_subscriber_count; //! Timer used for monitoring the connection and sending pending requests static Ti...
{ // run the monitor again after the set interval new_timer_start(s_monitor_timer, s_monitor_interval, prv_monitor_timer_cb, NULL, 0); }
else { // custom fast-path for 0ms timeout prv_monitor_timer_cb(NULL); } } static void prv_monitor_timer_cb(void *context) { // we need to run from KernelBG so schedule a callback system_task_add_callback(prv_monitor_system_task_cb, NULL); } void smartstrap_connection_kick_monitor(void) { // queue up...
m_message_send(SystemMessageType type) { uint8_t buffer[2] = { 0x00, type }; CommSession *system_session = comm_session_get_system_session(); comm_session_send_data(system_session, ENDPOINT_ID, buffer, sizeof(buffer), COMM_SESSION_DEFAULT_TIMEOUT); PBL_LOG(LOG_LEVEL_DEBUG, "Sending sysmsg: %u", type); } static...
event_put(&e)
; break; } case SysMsgFirmwareStatus: prv_handle_firmware_status_request(session); break; case SysMsgFirmwareComplete: { PBL_LOG_VERBOSE("Firmware transfer succeeded, okay to restart!"); PebbleEvent e = { .type = PEBBLE_SYSTEM_MESSAGE_EVENT, .firmware_update.type = PebbleSystemMe...
0; int fd = pfs_open("newfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, len); cl_assert(fd >= 0); int rv = pfs_seek(fd, len, FSeekSet); cl_assert(rv == len); rv = pfs_seek(fd, 0, FSeekCur); cl_assert(rv == len); rv = pfs_seek(fd, -5, FSeekCur); cl_assert(rv == (len - 5)); rv = pfs_seek(fd, -6, FSeekCur); ...
(large_file_size, 1)
; uint16_t curr = 0; for (int i = 0; i < 2; i++) { snprintf(file_large, sizeof(file_large), "large%d", i); for (int i = 0; i < large_file_size / 4; i++) { *(((uint32_t *)((uint8_t *)bigbuf)) + i) = curr | (curr << 16); curr++; } int fd = pfs_open(file_large, OP_FLAG_WRITE, FILE_TYPE_STA...
k__time_past_two_hour_relative(void) { char time_buf[64]; const int jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 9th 2015, 12:00:00 // Now - one day const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY; // if the event is wit...
(event_time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUTE))
/* * 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(index, 3)
ystemMenuItemFactoryReset] = i18n_noop("Factory Reset"), }; // Common status bar component is used across all windows that need them. // This will init it and set the correct style to be used within the settings // app. static void prv_init_status_bar(StatusBarLayer *status_layer, Window *window, const char *text) { ...
confirmation_dialog_pop((ConfirmationDialog *)context)
; } static void prv_coredump_click_config(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_confirm_cb); window_single_click_subscribe(BUTTON_ID_DOWN, prv_confirm_pop); window_single_click_subscribe(BUTTON_ID_BACK, prv_confirm_pop); } static void prv_coredump_reset_confirm_cb(ClickRecogn...
1448, 536, 296}, { 1728, 256, 368}, { 1688, 96, 552}, { 1192, 360, 416}, { 896, 288, 280}, { 752, 216, 192}, { 816, 72, 272}, { 784, -16, 296}, { 720, -88, 288}, { 768, -32, 280}, { 808, 32, 280}, { 1336, 16, 376}, { 1168, 352, 472}, { 1784, 648, 96}, { 2184, 848...
{ 1560, 792, -176}, { 1408, 976, -136}, { 1216, 576, 56}, { 1168, 392, 16}, { 880, 224, 24}, { 736, 224, 8}, { 664, 240, 8}, { 704, 328, -80}, { 808, 392, -104}, { 896, 368, -96}, { 1064, 384, -120}, { 1168, 336, -128}, { 1144, 240, -64}, { 1424, 200, -24}, { ...
// 5 seconds { 872, 112, -400}, { 808, 160, -256}, { 768, 104, -48}, { 824, 224, -48}, { 912, 216, -136}, { 1040, 176, -176}, { 1248, 384, -104}, { 1320, 320, -8}, { 1728, 304, -88}, { 1608, 496, -224}, { 1088, 384, -88}, { 1192, 280, -64}, { 1248, 192, -64}, ...
ool verify_schedule_1[7] = {false, false, false, false, false, false, false}; id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 }); prv_assert_alarm_config(id1, 3, 14, false, ALARM_KIND_CUSTOM, schedule_1); alarm_get_custom_days(id1, verify_schedul...
alarm_set_enabled(invalid_id, false)
/* * 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...
("This app requires Pebble Health to work. Enable Health in the Pebble" " mobile app to continue.")
; health_tracking_ui_show_message(RESOURCE_ID_GENERIC_WARNING_TINY, msg, false); } // --------------------------------------------------------------------------- void health_tracking_ui_feature_show_disabled(void) { /// Feature requires health dialog static const char *msg = i18n_noop("This feature requir...
ate->data_cb_handler, state->data_cb_context); default: WTF; // Unsupported task for the accel manager } } //! This is called every time new samples arrive from the accel driver & every //! time data has been drained by the accel service. Its responsibility is //! populating subscriber storage with new sam...
if (sys_accel_manager_peek(&accel_data) == 0) { uint32_t delta = prv_compute_delta_pos(&accel_data, &s_last_analytics_position); s_is_idle = (delta < ACCEL_MAX_IDLE_DELTA); s_last_analytics_position = accel_data; analytics_set(ANALYTICS_DEVICE_METRIC_ACCEL_XYZ_DELTA, delta, AnalyticsClient_System); }
data->standalone_action = true; } else if (complete_cb) { // If data is NULL, something went wrong (or local action), so call callback in case caller // relies on it for cleanup complete_cb(false /* success */, cb_data); } } static void prv_push_dismiss_first_use_dialog(ActionMenu *action_menu) { ...
{ const char *label = string_list_get_at(responses_list, i); action_menu_level_add_action(template_level, label, prv_action_menu_cb, action); }
} else { // hard-wired default responses in case the phone app doesn't provide any static char *strings[] = { i18n_noop("Ok"), i18n_noop("Yes"), i18n_noop("No"), i18n_noop("Call me"), i18n_noop("Call you later"), }; template_level = prv_create_level(ARRAY_LENGTH(strings)...
initialized; prv_lock(); { initialized = prv_check_initialized(); if (initialized || !start) { s_outstanding_enqueues += (start) ? 1 : -1; } } prv_unlock(); return initialized; } static bool prv_enqueue(HcProtocolMessage *message) { PBL_ASSERTN(message->message_length >= sizeof(HcProtocol...
list_remove((ListNode *)expectation, (ListNode **)&s_expectations_head, NULL)
; prv_unlock(); vSemaphoreDelete(expectation->semaphore); kernel_free(expectation); } static HcProtocolMessage *prv_expect(HcExpectation *expectation) { HcProtocolMessage *response = NULL; // Save for debugging const HcCommandID cmd_id = expectation->request->command_id; const HcEndpointID end_id = expec...
he 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 is distr...
{ if (corner_mask & GCornerBottomLeft) { corner_insets_left = round_bottom_corner_lookup[radius]; } if (corner_mask & GCornerBottomRight) { corner_insets_right = round_bottom_corner_lookup[radius]; } }
er, text_layer_get_layer(data->hr_card.text_layer)); // Update UI prv_hr_update_text(data); // Sample the Heart rate at a higher rate while in this view health_service_set_heart_rate_sample_period(1 /*interval_s*/); } // ------------------------------------------------------------------------------- static ...
{ APP_LOG(APP_LOG_LEVEL_ERROR, "Unexpected accessibility result: %d", (int)mask); }
health_service_activities_iterate(HealthActivityMaskAll, now - (2 * SECONDS_PER_DAY), now, HealthIterationDirectionFuture, prv_activity_iterate_cb, &num_activities_found); APP_LOG(APP_LOG_LEVEL_DEBUG, "Found %"PRIu32" activities", num_activit...
E_WAS_ELEVATED) { // Note: if we start storing services, we will need to update the size syscall_assert_userspace_buffer(info, sizeof(*info)); } *info = (PebbleBLEGATTClientServiceEventInfo) { .type = e->info->type, .device = e->info->device, .status = e->info->status }; } static void prv_ha...
(object_ref, value, value_length, 0 /* value_offset (future proofing) */, gatt_error)
; } value_length = next_value_length; } applib_free(value); } static void prv_handle_notifications(const PebbleBLEGATTClientEvent *e) { BLEAppState *ble_app_state = app_state_get_ble_app_state(); prv_consume_notifications(e, ble_app_state->gatt_characteristic_read_handler); } static void prv_handle_...
(s_reliable_timer_state_lock)
; return timeout; } static void prv_pulse_task_feed_watchdog(void) { task_watchdog_bit_set(PebbleTask_PULSE); } static void prv_pulse_task_idle_timer_callback(void* data) { if (s_pulse_task_idle && uxQueueMessagesWaiting(s_pulse_task_queue) == 0) { prv_pulse_task_feed_watchdog(); } } static void prv_puls...
layer); KinoReel *icon_reel = kino_reel_morph_square_create(old_image, true); kino_reel_transform_set_to_reel(icon_reel, new_image, false); kino_reel_transform_set_transform_duration(icon_reel, SQUARE_ANIMATION_FRAMES * ANIMATION_FRAME_MS); kino_layer_set_reel(&s_ph...
if (left_to_right) { s_phone_ui_data->bg_color.left = color; color_animation = property_animation_get_animation( property_animation_create(&s_color_slide_animation_impl, NULL, &zero, &width)); s_phone_ui_data->bg_color.boundary = 0; } else { s_phone_ui_data->bg_color.right = color; color_a...
s_phone_ui_data->bg_color_animation = color_animation; animation_set_duration(color_animation, COLOUR_ANIMATION_FRAMES * ANIMATION_FRAME_MS); animation_set_curve(color_animation, AnimationCurveEaseIn); animation_schedule(color_animation); #else layer_mark_dirty(&s_phone_ui_data->window.layer); #endif } // N...
= TIMER_INVALID_ID) { app_timer_cancel(status_bar_layer->title_timer_id); } status_bar_layer->title_timer_id = app_timer_register(STATUS_BAR_LAYER_TITLE_TIMEOUT, status_bar_layer_reset_title, stat...
{ return; }
*addr_buf = connection->initial_addr; } } prv_unlock(); } void connection_get_local_address(Connection *connection, BTDeviceAddress *addr_buf) { prv_lock(); { *addr_buf = connection->local_addr; } prv_unlock(); } void connection_get_conn_params(const Connection *connection, ...
{ prv_set_flag(connection, is_subscribed, ConnectionFlag_IsSubscribedToGattMtuNotifications); }
void connection_set_subscribed_to_conn_param_notifications( Connection *connection, bool is_subscribed) { prv_set_flag(connection, is_subscribed, ConnectionFlag_IsSubscribedToConnParamNotifications); } void connection_set_should_pin_address(Connection *connection, bool should_pin_address) { pr...
{ 1136, 184, -48}, { 1080, 200, -64}, { 1232, 240, -80}, // 37 seconds { 1240, 272, -88}, { 1064, 280, -128}, { 760, 256, -192}, { 544, 184, -160}, { 496, 136, -112}, { 536, 160, -48}, { 712, 240, -128}, { 920, 288, -120}, { 1168, 344, -200}, { 1096, 384, -264}, ...
{ 704, 192, -48}, { 744, 176, -40}, { 824, 160, -8}, { 1008, 128, -48}, { 1096, 136, -32}, { 1104, 176, -144}, { 1104, 136, -128}, { 1192, 152, -64}, { 1080, 200, -128}, { 1176, 192, -144}, { 1248, 208, -96}, { 1080, 264, -104}, { 784, 264, -176}, { 552, 240, -168...
cancelled = false; r->state = RecognizerState_Updated; rec_event = -1; recognizer_cancel(r); cl_assert_equal_i(r->state, RecognizerState_Cancelled); cl_assert_equal_b(cancelled, true); cl_assert_equal_i(rec_event, RecognizerEvent_Cancelled); } void test_recognizer__handle_touch_events(void) { Recogni...
(r, prv_filter)
; new_state = RecognizerState_Completed; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touchdown }); cl_assert_equal_i(last_touch_event.type, TouchEvent_Liftoff); cl_assert_equal_b(updated, false); allow = true; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touc...
N_BAR_ICON_CHECK, expandable_dialog_close_cb); i18n_free(msg, &s_data); expandable_dialog_push(first_use_dialog, window_manager_get_window_stack(ModalPriorityNotification)); } static void prv_push_smart_dnd_first_use_dialog(void) { const char *msg = i18n_get("Calendar Aware enables Quiet...
{ do_not_disturb_set_manually_enabled(false); }
s_data.is_in_schedule_period = !is_enable_next; } PBL_LOG(LOG_LEVEL_INFO, "%s scheduled period. %u seconds until update", s_data.is_in_schedule_period ? "In" : "Out of", (unsigned int) seconds_until_update); bool success = new_timer_start(s_data.update_timer_id, seconds_until_update * 1000, ...
turb_is_active(); cl_assert(active == true); // Scheduled ON DoNotDisturbSchedule schedule_2 = { .from_hour = 5, .from_minute = 0, .to_hour = 13, .to_minute = 0, }; do_not_disturb_set_schedule(WeekdaySchedule, &schedule_2); rtc_set_time(s_thursday_12_00); do_not_disturb_handle_clock_change...
(stub_new_timer_timeout(get_dnd_timer_id()), 52200 * MS_PER_SECOND)
; do_not_disturb_set_schedule_enabled(WeekendSchedule, false); rtc_set_time(s_saturday_01_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 00:00 on Monday. (46.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_time...
scroll or // selection animation has already been advanced to completion by the menu layer before it called // this select click handler prv_launcher_menu_layer_mark_dirty(launcher_menu_layer); } static uint16_t prv_menu_layer_get_num_rows(UNUSED MenuLayer *menu_layer, ...
(launcher_menu_layer, index)
child) { break; } uint32_t duration = prv_get_total_duration(state, child, true /*delay*/, true /*play_count*/); // It is allowed that the first child may have already been scheduled and played a bit. If // this is the case, backup the start time by reducing delay accordingly. if ...
child->delay_ms = serial_distance32(earliest_start_time, child_start); } else { if (!child->abs_start_time_ms) { success = prv_schedule_animation(state, now, child, delay); } } } // Set the duration now, after we've possibly adjusted the children delays to compensa...
static AnimationProgress prv_get_distance_normalized(const AnimationPrivate *animation, AnimationProgress time_normalized_raw) { AnimationProgress time_normalized; if (animation->reverse) { time_normalized = ANIMATION_NORMALIZED_MAX - time_normalized_raw; ...
most recently used (highest last_used value). uint32_t max_last_used = 0; int last_used_idx = -1; for (i=0; i<CORE_DUMP_MAX_IMAGES; i++) { // Skip if unformatted if (flash_hdr.unformatted & (1 << i)) { continue; } base_address = core_dump_get_slot_address(i); prv_flash_read_bytes(&regio...
{ if (!RETURNS_TO_PSP(s_saved_registers.core_reg[portCANONICAL_REG_INDEX_LR])) { // The core dump handler got invoked from another exception, therefore the // running task was interrupted by an exception. // Get R0-R3, R12, R14, PC, xpsr for the task off the process stack used // by the task...
// The 10th bit of the pushed xPSR indicates whether an alignment word was // inserted into the stack frame during exception entry in order to make // sp 8-byte aligned. // Note that this is going to be wrong if the floating-point registers // were stacked. The only way to know for sure w...
(out_buffer, "0a3d6g9j", 8)
; cl_assert(shared_circular_buffer_write( &buffer, (uint8_t*)"0k1m2n", 3*item_size, false)); items_read = shared_circular_buffer_read_subsampled( &buffer, &client, item_size, out_buffer, 100); cl_assert_equal_i(items_read, 1); cl_assert_equal_m(out_buffer, "2n", 2); } void test_shared_circular_bu...
/* * 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...
(!prv_find_combo_timer())
; cl_assert(!s_mfg_mode_entered); prv_release_button(BUTTON_ID_DOWN); // Make sure we've waited the appropriate amount of time StubTimer *timer = prv_find_combo_timer(); cl_assert(timer); cl_assert_equal_i(stub_new_timer_timeout(timer->id), 5000); // Pretend 5000ms have elapsed stub_new_timer_fire(ti...
zers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); // The app's recognizer's gesture completes immediately. Only the app's recognizer sees the touch // events. All recognizers in the chain are reset e.type = TouchEvent_Touchdown; s_next_state = RecognizerState_Completed; ...
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Started)
; cl_assert_equal_i(recognizers[1]->state, RecognizerState_Cancelled); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed); // A touchdown occurs where no layers are touched while a window recognizer is active e.type = TouchEvent_...
_erase_optimal_range_no_watchdog(start_addr, start_addr, end, end); } } static void prv_flash_read_bytes(void* buffer_ptr, uint32_t start_addr, uint32_t buffer_size) { if (s_use_cd_flash_driver) { cd_flash_read_bytes(buffer_ptr, start_addr, buffer_size); } else { flash_read_bytes(buffer_ptr, start_addr, ...
{ CoreDumpFlashHeader flash_hdr; CoreDumpFlashRegionHeader region_hdr; uint32_t base_address; unsigned int i; // ---------------------------------------------------------------------------------- // First, see if the flash header has been put in place prv_flash_read_bytes(&flash_hdr, CORE_DUMP_FLASH_ST...
last_used_idx = i; } } // If simply trying to find most recently used image, return that now. if (!new) { if (max_last_used > 0) { CD_ASSERTN(last_used_idx >= 0); return core_dump_get_slot_address(last_used_idx); } else { return CORE_DUMP_FLASH_INVALID_ADDR; } } // -...
opped handler) animation->being_destroyed = true; // Unschedule and destroy it prv_unschedule_animation(state, animation, false /*finished*/, false /*allow_auto_destroy*/, true /*force_destroy*/, true /*teardown*/); return true; } // ------------------------------------------------...
(animation)
; prv_unschedule_animation(state, animation, false /*finished*/, true /*allow_auto_destroy*/, false /*force_destroy*/, true /*teardown*/); } } // ------------------------------------------------------------------------------------------- bool animation_is_scheduled(Animation *animat...
assert_equal_i(s_num_alarm_events_put, 2); cl_assert_equal_i(s_num_timeline_adds, 9); cl_assert_equal_i(s_num_timeline_removes, 5); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; ...
(id2, 11, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule)
; // Delete the 10:30 alarm alarm_delete(id1); // The 10:30 alarm should not go off s_current_hour = 11; s_current_minute = 0; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 0); // Delete the 11:30 alarm alarm_delete(id2); // The 11:30 alarm should not go off either s_current_hou...
cContext; static void prv_text_dynamic_node_callback(GContext *ctx, GTextNode *node, const GRect *box, const GTextNodeDrawConfig *config, bool render, char *buffer, size_t buffer_size, void *user_data) { TextDynamicContext *text_co...
{ GTextNode *node = config->constructor(layout, config); if (node) { prv_set_text_node_extent(node, &config->extent); } return node; }
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 KIND, either express or implied. * See the Licen...
(LOG_LEVEL_ALWAYS, "LR: %p. Incorrect task! Can't be <%s>", (void*) saved_lr, pebble_task_get_name(unexpected_task))
; trigger_fault(RebootReasonCode_Assert, saved_lr); } } //! Assert function called by the STM peripheral library's //! 'assert_param' method. See stm32f2xx_conf.h for more information. void assert_failed(uint8_t* file, uint32_t line) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; handle_pas...
ed, false); window_stack_push(window->parent_window_stack, new_window, true); } static void prv_pop_window_load(Window *window) { prv_window_load(window); cl_check(window->parent_window_stack); cl_assert_equal_i(window->on_screen, true); cl_assert_equal_i(window->is_loaded, false); window_stack_pop(wind...
(window2->on_screen, true)
; app_window_stack_remove(window1, false); cl_assert_equal_i(app_window_stack_count(), 1); cl_assert_equal_i(window2->on_screen, true); cl_assert_equal_i(window1->on_screen, false); app_window_stack_remove(window2, false); cl_assert_equal_i(app_window_stack_count(), 0); cl_assert_equal_i(window2->on_s...
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 "services/normal/timeline/reminders.h" #include "kernel/events.h" #include "serv...
stub_pebble_tasks_set_current(PebbleTask_NewTimers)
; cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_equal_i(num_events_put, 2); cl_assert_equal_m(&item2.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId))...
x, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dr...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5)
; graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_...
p -= num_ignored_bytes; if (*data_size_p == 0) { return true; // we're done } *data_p += num_ignored_bytes; } return false; } static bool prv_prepare_receiver(const uint32_t payload_length, const PebbleProtocolEndpoint *endpoint, const uint16_t endpoint_id, ...
{ rtr->receiver_imp->cleanup(rtr->receiver); }
-1264, 144, 240}, { -1216, 72, 216}, { -1128, 64, 232}, { -1080, 72, 264}, { -984, 40, 168}, { -1080, 40, 208}, { -880, -192, 112}, { -952, -80, 56}, { -1336, -64, 160}, { -1736, 720, -64}, { -1392, 480, -24}, { -1280, -112, 232}, { -1168, 192, 40}, { -1056, 416, 16},...
{ -1488, 160, 272}, { -1336, 40, 80}, { -1256, 144, 128}, { -1216, 184, 136}, { -1096, 152, 120}, // 94 seconds { -1024, 160, 128}, { -1280, 32, 96}, { -1296, -184, -104}, { -1192, -200, -192}, { -1320, 48, -224}, { -1392, 360, -192}, { -1400, 216, -56}, { -1440, ...
{ -1280, 192, 128}, { -1232, 56, 128}, { -1112, 120, 72}, { -1000, 128, 144}, { -880, 80, 256}, { -864, 128, 320}, { -944, 256, 288}, { -976, 312, 312}, { -1088, 360, 512}, { -1120, 608, 472}, { -1224, 256, 224}, { -1432, 456, 312}, { -1120, 456, 272}, { -1296, 4...
/* * 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...
battery_convert_reading_to_millivolts(reading, 1, 1)
; cl_assert_equal_i(result, 1200); reading.vmon_total = prv_convert_millivolts_to_12bit_reading(0); result = battery_convert_reading_to_millivolts(reading, 1, 1); cl_assert_equal_i(result, 0); } void test_battery__reading_conversion_40_samples(void) { ADCVoltageMonitorReading reading = { .vref_total = ...
/* * 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...
GATT_LOG_DEBUG("gatt_wrapper_write_no_resp: handle: %d", handle)
; const GattRespDest resp_dest = GattRespDestNone; if (!prv_enqueue(conn_idx, 0, resp_dest, GattOpType_Write)) { return BLE_ERROR_NOT_CONNECTED; } const bool signed_write = false; ble_error_t rv = ble_gattc_write_no_resp(conn_idx, handle, signed_write, length, value); prv_pop_if_failing_rv(conn_idx, rv...
zeof(tmbuf), "%02R %06t %04T", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "13:00 \t 13:00:00"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%5u %3V", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "00005 001"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%9z", &jan_2_10015__13_00_00); ...
cl_assert_equal_s(tmbuf, "Fri Friday Jan January")
; tmbuf[0] = '\0'; localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, NULL); cl_assert_equal_s(tmbuf, "Fri Jan 2 13:00:00 2015"); tmbuf[0] = '\0'; localized_strftime(tmbuf, sizeof(tmbuf), "%a %A %b %B", &jan_2_2015__13_00_00, i18n_get_locale()); cl_assert_equal_s(tmbuf, "Fri Friday Jan J...
xt_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_assign_horizontal_line_delta_raw); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_assign_horizontal_line_delta_...
TEST_NAMED_PBI_FILE("draw_core_set_pixel_raw_8bit_replicate_column_row_raw")
); cl_check(result); }; void test_graphics_draw_core__plot_pixel(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); const GRect *bitmap_bounds = &ctx.dest_bitmap.bounds; // Fill the screen with red graphics_context_s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (!memory_layout_is_cstring_in_region(memory_layout_get_app_region(), string, 100) && !memory_layout_is_cstring_in_region(memory_layout_get_microflash_region(), string, 100)) { PBL_LOG(LOG_LEVEL_ERROR, "Pointer %p not in app or microflash region", string); syscall_failed(); }
} return i18n_get_length(string); }
/* * 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...
{ // AHB2 clock_freq = clocks.PCLK2_Frequency; ppre_mask = RCC_CFGR_PPRE1; ppre_div1_mask = RCC_CFGR_PPRE1_DIV1; }
rty.call_count++; s_layer_mark_dirty.last_call = (MockCallRecording){.layer = layer}; } static MockCallRecordings s_graphics_context_set_fill_color; void graphics_context_set_fill_color(GContext* ctx, GColor color) { s_graphics_context_set_fill_color.call_count++; s_graphics_context_set_fill_color.last_call = (M...
rocky_runtime_context_deinit()
; } void test_js__initialize(void) { fake_pbl_malloc_clear_tracking(); s_skip_mem_leak_check = false; fake_app_timer_init(); prv_init(); s_app_window_stack_get_top_window = (Window){}; s_app_state_get_graphics_context = NULL; s_layer_mark_dirty = (MockCallRecordings){}; s_graphics_context_set_fill_co...
void test_circular_buffer__initialize(void) { } void test_circular_buffer__cleanup(void) { } void test_circular_buffer__circular_buffer(void) { CircularBuffer buffer; uint8_t storage[8]; circular_buffer_init(&buffer, storage, sizeof(storage)); const uint8_t* out_buffer; uint16_t out_length; // We should...
(circular_buffer_copy_offset(&buffer, 0 /* start_offset */, data_out, data_out_size), 0)
; // Assert zero bytes copied, start offset > storage size: cl_assert_equal_i(circular_buffer_copy_offset(&buffer, sizeof(storage) + 1 /* start_offset */, data_out, data_out_size), 0); // Valid offset, non-wrapping copy: circular_buffer_write(&buffer, (uint8_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...
fake_spi_flash_init(0, 0x1000000)
; pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, FRENCH_FIXTURE_NAME, "lang"); shell_prefs_set_language_english(false); i18n_set_resource(RESOURCE_ID_STRINGS); } void test_i18n__cleanup(void) { } extern I18nString *prv_list_find_string(const...
/* * 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...
(0, 0, 10, 20)
)); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, 20, 10))); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, 10, -20))); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, -20, 10))); } void test_gtypes__grect_shortest_side(void) { cl_assert_equal_i(0, grect_shortest_side(GRectZero)); cl_assert...
/* * 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...
{ pstring_out->str_length = length; strncpy(pstring_out->str_value, string, length); }
} bool pstring_equal(const PascalString16 *ps1, const PascalString16 *ps2) { return ps1 && ps2 && (ps1->str_length == ps2->str_length) && (memcmp(ps1->str_value, ps2->str_value, ps1->str_length) == 0); } bool pstring_equal_cstring(const PascalString16 *pstr, const char *cstr) { return pstr && cstr && (p...
40}, { -1568, 400, 40}, // 28 seconds { -1568, 296, 168}, { -1408, 40, 56}, { -1312, 56, 88}, { -1200, 168, -8}, { -1040, 208, -24}, { -920, 200, 8}, { -968, 152, 104}, { -952, -64, 144}, { -904, -200, 0}, { -1016, -192, 96}, { -1328, 232, -136}, { -1336, 240, -2...
{ -16, 528, 72}, { 48, 576, 120}, { 88, 720, 256}, { 168, 960, 240}, { 272, 1240, 392}, { 368, 1264, 312}, { 400, 1008, 216}, { 384, 720, 224}, { 416, 616, 360}, { 416, 504, 392}, { 264, 616, 240}, { 256, 448, 168}, { 200, 280, 192}, // 34 seconds { 176, 152, ...
{ -800, 400, -592}, { -1056, 24, -720}, { -1096, 64, -808}, { -864, -88, -712}, { -808, -32, -440}, { -1376, 360, 1304}, { -992, 280, 128}, { -1016, -32, -112}, { -992, -128, 24}, { -1208, 48, -24}, { -1488, 120, 16}, { -1200, 720, 64}, { -1200, 632, 56}, { -1040...
event prv_handle_connection(); } else { // Disconnect event prv_handle_disconnection(); } } //////////////////////////////////////////////////////////////////////////////// // Outbound Object Queue //////////////////////////////////////////////////////////////////////////////// static void prv_object_que...
{ PBL_LOG(LOG_LEVEL_ERROR, "Chunk tuple not a byte array!"); return false; }
clude "util/uuid.h" // Fixture //////////////////////////////////////////////////////////////// // Fakes //////////////////////////////////////////////////////////////// #include "fake_spi_flash.h" #include "fake_system_task.h" #include "fake_kernel_services_notifications.h" // Stubs ////////////////////////////////...
(contacts_db_flush(), 0)
; fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(contacts_db_get_len((uint8_t *)&contact, UUID_SIZE), 0); } void test_contacts_db__get_serialized_contact(void) { uint8_t contact[sizeof(s_contact_1)]; memcpy(contact, s_contact_1, sizeof(s_contact_1)); cl_assert_equal_i(contacts_db_insert((uin...
/* * 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...
("Invalid rtcfreq")
; return; } mfg_info_set_rtc_freq(rtc_freq); } void command_model_read(void) { char model_buffer[MFG_INFO_MODEL_STRING_LENGTH]; mfg_info_get_model(model_buffer); // Just send it straight out, as it's already null-terminated prompt_send_response(model_buffer); } void command_model_write(const char* m...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_malloc(app_state_get_heap(), bytes, saved_lr); }
void *app_malloc_check(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = app_state_get_heap(); void *mem = heap_malloc(heap, bytes, saved_lr); if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); } return mem; } void app_free(void *ptr) { registe...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ Window *window = app_window_stack_get_top_window(); if (window && window->is_render_scheduled) { GContext *ctx = rocky_api_graphics_get_gcontext(); layer_render_tree(&window->layer, ctx); window->is_render_scheduled = false; EM_ASM( // Implemented by html-binding.js: if (Module.frameBu...
void emx_app_init(void) { emx_graphics_init(); emx_resources_init(); emx_tick_timer_service_init(); } void emx_app_deinit(void) { emx_resources_deinit(); } void emx_app_event_loop(void) { emscripten_set_main_loop(prv_event_loop, 0, /* using window.requestAnimationFrame() */ ...
ler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); // ------------------------------------------------------------------------------------- // animation a has completed, but it shouldn't be deleted yet until the top-level // animation is...
(&s_stopped_handler_calls, c)
, 0); // Execute to the end of B & C prv_advance_to_ms_with_timers(start_ms + duration_total + 1 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_...
uled_callback, s_unscheduled_cb_data, 0); // Even though B is newer, expect "A" to be scheduled still, because B's first term is silent: cl_assert(job_b); cl_assert_equal_b(gap_le_is_advertising_enabled(), true); assert_ad_data("A"); gap_le_assert_advertising_interval(advert_terms_a[0].min_interval_slots, ...
(s_unscheduled_job, job_a)
; cl_assert_equal_b(s_unscheduled_completed, true); cl_assert(!gap_le_is_advertising_enabled()); free(ad_a); free(ad_b); } void test_gap_le_advert__expiring_job(void) { // Test that a job is expired correctly after the set duration: uint16_t seconds_left = 5; GAPLEAdvertisingJobTerm advert_term = { ...
/* * 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...
{ ScanResult *prev = NULL; ScanResult *result = s_head; while (result) { if (bt_device_equal(&result->device, device)) { // Match! if (prev) { // Unlink from previous node: prev->next = result->next; } else { // Unlink from head: s_head = result->next; }...
//! Inserts the result into the list, keeping the list sorted by RSSI (strongest //! first). static void list_link_sorted_by_rssi(ScanResult *result) { ScanResult *prev = NULL; ScanResult *other = s_head; while (other) { if (other->rssi < result->rssi) { if (!prev) { // Need to insert as the h...
*prv_find_analytic(DialogAnalyticsMetric metric) { return (AnalyticsNode *)list_find( s_analytics_list, prv_compare_analytic, (void *)(uintptr_t)metric); } static void prv_add_analytic_node(DialogAnalyticsMetric metric) { AnalyticsNode *node = kernel_malloc_check(sizeof(AnalyticsNode)); *node = (AnalyticsN...
prv_unlock()
; } // Getters void analytics_each(AnalyticsEachCallback cb, void *context) { analytics_stopwatches_update(rtc_get()); prv_lock(); ListNode *iter = s_analytics_list; while (iter) { AnalyticsNode *node = (AnalyticsNode *)iter; cb(node->metric, node->value, context); iter = iter->next; } prv_un...
ATS_FILE_NAME, (num_tests == 0) /*create*/, entry->name, (entry->exp_steps != 0) /*stepping*/); #endif // Run through reference code int ref_steps = prv_feed_reference_samples(entry->samples, entry->num_samples); //int ref_steps = -1; int error = abs(steps - entry->exp_steps); ...
(act->passed)
); } else { act->passed = true; printf("\nRESULTS for %s: exp: (NA), act: %d, error: NA, weighted_error: NA", name, (int)act->value); } return weighted_error; } // ========================================================================================= // Support for capturing sleep sessions ...
bit.pbi")); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } #define BOX_OFFSET_X 8 #define BOX_OFFSET_Y 4 #define COLUMN_OFFSET_X 32 // Draws an 8x4 rectangle starting a point p static void prv_draw_box(GContext *ctx, GPoint p) { graphics_draw_pixel(ctx, GPoi...
(ctx, GPoint(5, -1))
; graphics_draw_pixel(ctx, GPoint(10, 0)); graphics_draw_pixel(ctx, GPoint(15, 1)); // Bottom boundary graphics_draw_pixel(ctx, GPoint(5, 19)); graphics_draw_pixel(ctx, GPoint(10, 20)); graphics_draw_pixel(ctx, GPoint(15, 21)); } void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__clipping_rect(void) { GCo...
, HLinePatternDrawFunction draw_func, const GRect *rect, GColor color) { for (int16_t x = 0; x < rect->size.w; x++) { draw_func(ctx, rect->origin.x + x, rect->origin.y, grect_get_max_y(rect) - 1, color); } } static void prv_draw_vline_test_pattern(GContext *ctx, HLinePattern...
prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_blend_horizontal_line_raw)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_blend_horizontal_line_raw"))); }; void prv_assign_horizontal_line_delta_raw(GBitmap *framebuffer, int16_t y, Fixed_S16_3 x1, Fixed_S16_3 x2, ...
on_dialog); animation_unschedule(property_animation_get_animation(transcription_dialog->animation)); *transcription_dialog->zero = transcription_dialog->missing; transcription_dialog->zero = dialog->buffer + transcription_dialog->buffer_len; transcription_dialog->missing = '\0'; layer_mark_dirty((Layer *)&dia...
if (!transcription_dialog) { return NULL; }
transcription_dialog_init(transcription_dialog); return transcription_dialog; } void transcription_dialog_init(TranscriptionDialog *transcription_dialog) { *transcription_dialog = (TranscriptionDialog){}; expandable_dialog_init((ExpandableDialog *)transcription_dialog, "Transcription Dialog"); expandable_...
ds { 1176, -256, 248}, { 1120, -248, 312}, { 1200, 184, -32}, { 1696, 4000, -968}, { 568, 4000, -1600}, { -744, 2568, -1096}, { -968, 1216, -576}, { -896, 224, -432}, { -872, -360, -424}, { -1064, -424, -176}, { -680, -344, -56}, { -408, -184, 88}, { -1024, 664, -192}...
{ 1328, 392, 160}, { 1528, -664, 384}, { 1784, -680, 848}, { 1584, -536, 720}, { 1848, 296, 328}, { 3560, 2448, -280}, { 3792, 4000, -1200}, { 1656, 4000, -1864}, { 296, 2048, -896}, { -416, 1216, -648}, { -1000, 368, -560}, { -1944, -240, -960}, { -1672, -96, -912}, ...
{ 1776, -64, 120}, { 4000, 4000, -1864}, { 3144, 4000, -3160}, { 792, 2424, -1976}, { -216, 1600, -1424}, // 33 seconds { -944, 304, -1152}, { -1920, 64, -784}, { -1752, -200, -656}, { -1344, 424, -776}, { -736, 1600, -904}, { -608, 3952, -1768}, { 1168, 4000, -2464}...
lis3dh_unlock(); } // Record timestamp of newest data in the queue time_t time_s; uint16_t time_ms; rtc_get_time_ms(&time_s, &time_ms); s_latest_timestamp = ((uint64_t)time_s) * 1000 + time_ms; if (num_samples == 0) { accel_reset_pending_accel_event(); return; } accel_manager_dispatch_dat...
{ if (!accel_start()) { return false; } }
if (lis3dh_get_fifo_mode() != MODE_STREAM) { accel_get_data((AccelRawData*)accel_data, 1); } else { accel_get_last_data((AccelRawData*)accel_data); } if (!running) { accel_stop(); } return true; } // Analytics Metrics ////////////////////////////////////////////////////////////////////// void ...
qual_s(dstbuf, "There are 4 lights"); // Left-align, Variable length character output snprintf(dstbuf, 256, "There are %*d lights", -3, 4); cl_assert_equal_s(dstbuf, "There are 4 lights"); // Variable length digits output snprintf(dstbuf, 256, "There are %.*d lights", 3, 4); cl_assert_equal_s(dstbuf, ...
(dstbuf, "There are 4 lights, 4294967292")
; // Alternate form snprintf(dstbuf, 256, "There are %#u lights, %#u", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, 4294967292"); // Zero padded minimum character output snprintf(dstbuf, 256, "There are %02u lights, %02u", 4, -4); cl_assert_equal_s(dstbuf, "There are 04 lights, 4294967292"); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(s_refcount > 0)
; --s_refcount; if (s_refcount == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Disabling MCO1"); gpio_analog_init(&BOARD_CONFIG_MCO1.an_cfg); } } portEXIT_CRITICAL(); }
ext) { StatsRow *to_free = next; next = (StatsRow *)next->node.next; free(to_free); } s_stat_rows = NULL; s_stats_num_columns = 0; } // --------------------------------------------------------------------------------------- // Callback called by the algorithm. This collects stats from an epoch stati...
kalg_init(s_kalg_state, prv_stats_cb)
; // Run some data through it, 1 minute at a time while (num_samples_left) { int chunk_size = MIN(num_samples_left, KALG_SAMPLE_HZ * SECONDS_PER_MINUTE); uint32_t steps; uint32_t consumed_samples; steps = kalg_analyze_samples(s_kalg_state, data, chunk_size, &consumed_samples); minute_steps += s...