prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
oid prv_set_cell_offset(void *subject, int16_t value) {
ActionMenuLayer *aml = subject;
aml->item_animation.current_offset_y = value;
layer_mark_dirty(&aml->layer);
}
static void prv_cell_animation_stopped_handler(Animation *animation, bool finished, void *context) {
ActionMenuLayer *aml = context;
if (finis... | ((Animation *)r_animation,
(DELAY_PER_LINE / 4) * (item_height / line_height)) | ;
animation_set_curve((Animation *)r_animation, AnimationCurveEaseInOut);
animation_set_handlers((Animation *)r_animation, (AnimationHandlers){0}, aml);
item_animation->animation = animation_sequence_create((Animation *)animation,
(Animation *)s_animation, (Animation *)r_animation);
... |
/*
* 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... | (wakeup_id) | ;
AppInstallId app_id = app_install_get_id_for_uuid(&entry.uuid);
// If specified app isn't currently running, launch
if (!(app_manager_get_current_app_id() == app_id)) {
// Lookup app, and if installed, launch
if (app_id != INSTALL_ID_INVALID) {
PebbleLaunchAppEventExtended* data =
kern... |
&head, TimelineIterDirectionFuture,
1421178000), 0);
cl_assert_equal_i(prv_num_items(iterator), 6);
// Thursday Jan 16 00:00:00 PST 2015
// No items within window
rtc_set_time(1421395200);
head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDi... | cl_assert(iter_next(&iterator)) | ;
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id));
// check fifth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id));
// check sixth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id));
/... |
return;
}
case GAlignBottomLeft: {
rect->origin.x = inside_rect->origin.x;
rect->origin.y = (inside_rect->size.h - rect->size.h) + inside_rect->origin.y;
return;
}
}
}
GRect grect_crop(GRect rect, const int32_t crop_size_px) {
int16_t cropped_width = rect.size.w - 2 * crop_size... | {
return GColorDarkGray;
} | |
highlight_colors(menu_layer,
LAUNCHER_MENU_LAYER_SELECTION_BACKGROUND_COLOR,
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
menu_layer_pad_bottom_enable(menu_layer, false);
menu_layer_set_callbacks(menu_layer, launcher_menu_layer, &(MenuLayerCallbac... | if (!launcher_menu_layer || !launcher_menu_layer->data_source || !new_state) {
return;
} |
const bool animated = false;
prv_launcher_menu_layer_set_selection_index(launcher_menu_layer, new_state->row_index,
MenuRowAlignNone, animated);
const GPoint new_scroll_offset = GPoint(0, new_state->scroll_offset_y);
scroll_layer_set_content_offset(&launcher_men... |
>window.layer, &status_layer->layer);
music_get_pos(&data->track_pos, &data->track_length);
#if CAPABILITY_HAS_VIBE_SCORES
data->score = vibe_score_create_with_resource(RESOURCE_ID_VIBE_SCORE_HAPTIC_FEEDBACK);
#endif
prv_update_now_playing(data);
prv_update_layout(data);
prv_update_track_progress(data);
... | i18n_noop("Music") | |
AX_DATA_SIZE);
const uint16_t message_length = offsetof(AppMessage, payload[0].push.dictionary) +
+ dict_length + (oversized ? 20 : 0);
uint8_t buffer[message_length];
AppMessage *message = (AppMessage*)buffer;
message->command = CMD_PUSH;
message->transaction_id = transaction_id;
message->payload->pus... | (outbox_data->endpoint_id,
outbox_data->payload, length - sizeof(AppMessageAppOutboxData)) | ;
}
static void prv_process_sent_data(void) {
if (!s_sent_data) {
return;
}
if (!s_is_connected) {
return;
}
if (!s_is_app_message_receiver_open) {
return;
}
cl_assert(s_remote_receive_handler);
s_remote_receive_handler(s_sent_endpoint_id, s_sent_data, s_sent_data_length);
kernel_free(s_s... |
he app stack has regained focus,
// this is also done by checking the last event.
event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT);
cl_assert_equal_i(event.app_focus.in_focus, true);
cl_assert_equal_i(window1->on_screen, true);
window_stack_remove(window1, ... | (PebbleTask_App) | ;
window_stack_push(stack, window, true);
cl_assert_equal_i(window->on_screen, 1);
cl_assert_equal_i(window_stack_count(stack), 1);
// Ensure the load handler was called
cl_assert_equal_i(prv_get_load_unload_count(), 1);
// Ensure the appear handler was called
cl_assert_equal_i(prv_get_appear_disappea... |
alformed_test_string_utf8, NULL), 0);
cl_assert_(*malformed_test_string_utf8 == 0xcd, "Failed to invalidate an invalid UTF-8 test string");
}
void test_utf8__decode_all_gothic_codepoints(void) {
static const int NUM_GOTHIC_CODEPOINTS = sizeof(s_valid_gothic_codepoints) / sizeof(uint32_t);
bool is_valid = utf8_i... | cl_assert_equal_s(output_buffer, "\xe2\x80\xa6") | ;
cl_assert_equal_i(trunc_size, 4);
// test where max_length == ellipsis_length + 1
output_buffer = realloc(output_buffer, 5);
trunc_size = utf8_truncate_with_ellipsis("Hello", output_buffer, 5);
cl_assert_equal_s(output_buffer, "H\xe2\x80\xa6");
cl_assert_equal_i(trunc_size, 5);
// test that if we don'... |
// Save the last continent name
continent_names[continent_index] = last_cursor;
data->region_names_buffer = region_names_buffer;
data->region_names = region_names;
data->continent_names = continent_names;
}
static char *prv_get_timezone_title(void) {
/// Title of the menu for changing the watch's timezone.
... | i18n_noop("Timezone") | ;
clock_get_timezone_region(current_timezone_region, TIMEZONE_NAME_LENGTH);
subtitle = current_timezone_region;
break;
}
}
menu_cell_basic_draw(ctx, cell_layer, i18n_get(title, data), i18n_get(subtitle, data), NULL);
}
static void prv_selection_will_change_cb(SettingsCallbacks *context, uint... |
l_get_iter_state_with_timeline_idx(1));
int new_idx;
bool has_next;
cl_assert(timeline_model_iter_next(&new_idx, &has_next));
cl_assert(has_next);
cl_assert_equal_i(new_idx, 2);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id,
&timel... | (&new_idx, NULL) | );
cl_assert_equal_i(new_idx, 4);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id,
&timeline_model_get_iter_state(1)->pin... |
(GContext* ctx, GDrawState draw_state) {}
void graphics_context_set_fill_color(GContext* ctx, GColor color){}
Layer* inverter_layer_get_layer(InverterLayer *inverter_layer) {
return &inverter_layer->layer;
}
void inverter_layer_init(InverterLayer *inverter, const GRect *frame) {}
void window_long_click_subscribe(B... | menu_layer_get_selected_index(&l) | .row);
cl_assert_equal_i(basic_cell_height, l.selection.y);
const int y_center_of_row_1 = basic_cell_height + basic_cell_height / 2;
const int row1_vertically_centered = height / 2 - y_center_of_row_1;
cl_assert_equal_i(row1_vertically_centered, scroll_layer_get_content_offset(&l.scroll_layer).y);
}
void test... |
ftime(buf, buf_size, "%B", &good_data);
if (r == 0 || strncmp(buf, "May", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"B\": %s", buf);
}
r = strftime(buf, buf_size, "%c", &good_data);
if (r == 0 || strncmp(buf, "Tue May 5 11:04:49 2015", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "... | (APP_LOG_LEVEL_DEBUG, "Error with \"W\": %s", buf) | ;
}
r = strftime(buf, buf_size, "%x", &good_data);
if (r == 0 || strncmp(buf, "05/05/15", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"x\": %s", buf);
}
r = strftime(buf, buf_size, "%X", &good_data);
if (r == 0 || strncmp(buf, "11:04:49", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEB... |
um_characteristics];
// Test gatt_client_service_get_characteristics():
const uint8_t num_found_characteristics =
gatt_client_service_get_characteristics(service_ref, characteristic_refs, num_characteristics);
cl_assert_equal_i(num_characteristics, num_found_characteristics);
fo... | uuid_equal(&uuid, &bp_service->uuid) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return false;
} |
return (session == comm_session_get_current_app_session() ||
session == comm_session_get_system_session());
}
static int s_send_next_count = 0;
void comm_session_send_next(CommSession *session) {
++s_send_next_count;
}
void comm_session_set_responsiveness(CommSession *session, BtConsumer consumer,
... |
k, 1px white.
// - Dest is Blue, 100x100
// - Dest rect is 50 x 25, at (0, 0)
// Result:
// - 50x20 of alternating stripes, rest is blue.
void test_bitblt__1bit_to_8bit_wrap_x(void) {
GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__1bit_to_8bit_wrap_x.1bit.pbi");
uint8_t dest_data[100*100];
GBitma... | (10, 25, src_bitmap->bounds.size.w*2, src_bitmap->bounds.size.h*2) | ;
GPoint src_origin_offset = { .x = 4, .y = 2 }; // Offset past the black
bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, src_bitmap, dest_rect, src_origin_offset,
GCompOpAssign, GColorWhite);
cl_assert(gbitmap_pbi_eq(&dest_bitmap,
"test_bitblt__1bit_to... |
GPoint(offset, mask));
// Top-right quadrant
graphics_draw_pixel(ctx, GPoint(mask, layer->bounds.size.h - offset - 1));
graphics_draw_pixel(ctx, GPoint(layer->bounds.size.w - offset - 1, mask));
// Bottom-left quadrant
graphics_draw_pixel(ctx, GPoint(layer->bounds.size.w - mask - 1, offset));
gr... | app_window_stack_push(&app_data->results_window, false) | ;
}
#endif
}
static void prv_change_pattern(void *data) {
AppData *app_data = app_state_get_user_data();
app_data->test_pattern = (TestPattern) data;
layer_mark_dirty(&app_data->window.layer);
}
static void prv_config_provider(void *data) {
window_single_click_subscribe(BUTTON_ID_SELECT, prv_button_click_... |
d_font);
text_layer_set_text(&s_phone_ui_data->caller_id_text_layer, s_phone_ui_data->caller_id_text_buf);
}
//! Window background rendering
static void prv_window_update_proc(Layer *layer, GContext *ctx) {
#if !PLATFORM_TINTIN
graphics_context_set_fill_color(ctx, s_phone_ui_data->bg_color.left);
graphics_fill_r... | (&s_phone_ui_data->call_status_text_layer.layer) | ) {
prv_show_call_status();
}
const time_t duration = rtc_get_time() - s_phone_ui_data->call_start_time;
const int seconds = duration % SECONDS_PER_MINUTE;
int minutes = (duration - seconds) / SECONDS_PER_MINUTE;
if (minutes >= MINUTES_PER_HOUR) {
const int hours = minutes / MINUTES_PER_HOUR;
minu... |
/*
* 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... | (timestamp.second) | ;
timestamp.second[0] = '\0';
time_tm.tm_min = atoi(timestamp.minute);
timestamp.minute[0] = '\0';
time_tm.tm_hour = atoi(timestamp.hour);
timestamp.T[0] = '\0';
time_tm.tm_mday = atoi(timestamp.day);
timestamp.day[0] = '\0';
time_tm.tm_mon = atoi(timestamp.month) - 1;
timestamp.month[0] = '\0';
tim... |
oid test_circular_cache__cleanup(void) {
}
// tests
void test_circular_cache__push(void) {
circular_cache_set_item_destructor(&s_test_cache, prv_destructor);
circular_cache_push(&s_test_cache, &s_test_item[0]);
cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[0], sizeof(TestCacheItem));
cl_assert_equal_m(&s... | cl_assert(*s_test_item[0].freed) | ;
cl_assert(*s_test_item[1].freed);
cl_assert(*s_test_item[2].freed);
}
|
/*
* 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) | ;
}
void animated_demo_window_load(Window *window) {
AnimatedDemoData *data = window_get_user_data(window);
text_layer_init(&data->text_layer, &GRect(0, 0, 60, 60));
text_layer_set_background_color(&data->text_layer, GColorBlack);
text_layer_set_text_color(&data->text_layer, GColorWhite);
text_layer_set_text... |
/*
* 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 (session->type == ActivitySessionType_Sleep) {
fill_color = PROGRESS_CURRENT_COLOR;
} else if (session->type == ActivitySessionType_RestfulSleep) {
fill_color = PROGRESS_SECONDARY_COLOR;
} |
if (gcolor_equal(fill_color, GColorClear)) {
continue;
}
struct tm local_tm;
localtime_r(&session->start_utc, &local_tm);
const int session_start_24h = (local_tm.tm_sec +
local_tm.tm_min * SECONDS_PER_MINUTE +
local_tm.tm_... |
_items; i++) {
char *msg = msg_arr[i];
uint32_t addr = flash_logging_log_start(strlen(msg));
cl_assert(addr != FLASH_LOG_INVALID_ADDR);
bool rv = flash_logging_write((uint8_t *)msg, addr, strlen(msg));
cl_assert(rv);
}
ExpectedMessage newmsg = {
.msg_arr = msg_arr,
.curr_msg_idx = 0,
... | test_flash_logging_get_info(&tot_size, &erase_size, &page_size,
&page_hdr_size) | ;
int gens_avail = (tot_size - erase_size) / page_size;
char *log = malloc(100);
for (int i = 0; i < 533; i++) {
flash_logging_init();
// Write 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); ... |
(false /* success */);
}
static void prv_pairing_timeout_timer_callback(void *unused) {
PBL_LOG(LOG_LEVEL_WARNING, "SSP timeout fired!");
launcher_task_add_callback(prv_show_failure_kernel_main_cb, NULL);
}
static void prv_pop_window(void) {
if (s_data_ptr) {
window_stack_remove(&s_data_ptr->window, true /*... | window_set_click_config_provider(&data->window, prv_success_or_failure_click_config_provider) | ;
vibes_short_pulse();
light_enable_interaction();
}
void bluetooth_pairing_ui_handle_event(PebbleBluetoothPairEvent *event) {
PBL_ASSERT_TASK(PebbleTask_KernelMain);
switch (event->type) {
case PebbleBluetoothPairEventTypePairingUserConfirmation:
prv_handle_confirmation_request(event->ctx, event->c... |
CT_BUTTON_MASK;
if (button_state != prev_button_state) {
system_reset();
}
delay_ms(10);
}
}
static void prv_print_reset_reason(void) {
dbgserial_print("Reset Register ");
dbgserial_print_hex(RCC->CSR);
dbgserial_newline();
if (RCC_GetFlagStatus(RCC_FLAG_BORRST) == SET) {
dbgserial_put... | (ERROR_STUCK_BUTTON) | |
t_activities());
}
// ---------------------------------------------------------------------------------------
// Test that we report the that a Sleep session is ongoing.
void test_activity__activity_sessions_sleep_ongoing_then_delete(void) {
// Start activity tracking. This method assumes it can be called from any t... | (&sleep_activity) | |
cl_assert_equal_i(animation_get_duration(seq, false, false), total_duration_a + total_duration_b);
cl_assert_equal_i(animation_get_duration(seq, false, true),
play_count_seq * (total_duration_a + total_duration_b));
cl_assert_equal_i(animation_get_duration(seq, true, false),
... | prv_count_handler_entries(&s_setup_handler_calls, a) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1);
#endif
}
// ----------------------------------------------------------... |
f (test_image_color->addr) {
free(test_image_color->addr);
}
free(test_image_color);
}
}
static void setup_test_rotate_bitmap(GContext *ctx, FrameBuffer *fb,
GRect clip_box, GRect drawing_box,
GCompOp compositing_mode) {
test_g... | (&ctx.dest_bitmap,
"draw_rotated_bitmap_origin_bw_set_center_45.Xbit.pbi") | |
e basic glance blob insert test to insert the basic glance blob
test_app_glance_db__basic_glance_blob_insert_and_read();
const size_t glance_size = sizeof(s_app_glance_basic);
uint8_t glance_out[glance_size];
// Trying to read the basic glance blob back with an invalid key length should fail
const size_t in... | ((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE,
(uint8_t *)&s_app_glance_with_too_many_slices,
original_glance_size) | ,
S_SUCCESS);
// But the length we read back should be trimmed of the excess slices
cl_assert_equal_i(app_glance_db_get_len((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE),
trimmed_glance_size);
// The glance blob read back from the database should match everything up to wher... |
/*
* 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... | {
blob_db_set_accepting_messages(true);
fake_comm_session_init();
Transport *transport = fake_transport_create(TransportDestinationSystem, NULL, prv_sent_data_cb);
s_session = fake_transport_set_connected(transport, true /* connected */);
system_task_set_available_space(system_task_queue_size);
} |
void test_blob_db_endpoint__cleanup(void) {
fake_comm_session_cleanup();
}
/*************************************
* Checking for valid INSERT command *
*************************************/
static const uint8_t s_insert_cmd_success[] = {
// Message Header
0x01, // Pebble protocol messag... |
ble(BOARD_BT_WATCHDOG_TIMER.timer.peripheral,
BOARD_BT_WATCHDOG_TIMER.timer.config_clock);
// Setup timer 3 to generate Bluetooth Host Transport priority interrupts
NVIC_InitTypeDef NVIC_InitStructure;
TIM_ClearITPendingBit(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update);
NVIC_I... | dialog_spi_send_and_receive_dma(s_spi_transport.tx_footer, NULL,
sizeof(*s_spi_transport.tx_footer),
prv_handle_sending_footer_complete_isr) | ;
}
static void prv_handle_int_waiting_for_sending(void) {
s_spi_transport.state = SPITransportState_Sending;
dialog_spi_send_and_receive_dma(s_spi_transport.tx_read_ptr, NULL,
s_spi_transport.bytes_sendable_count,
prv_handle_sending_complete_isr)... |
/*
* 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 ( configUSE_TRACE_FACILITY == 1 )
char str_buffer[100];
prompt_send_response(
"name state pri fstk num stk_beg stk_ptr");
int num_tasks = uxTaskGetNumberOfTasks();
TaskStatus_t *task_info = kernel_malloc(num_tasks * sizeof( TaskStatus_t ));
if (!task_info) {
... |
#endif
|
d use of the accessory port via the smartstrap APIs, we can't easily
// change this.
const bool is_open_drain = (baudrate <= 115200);
#endif
s_baudrate = baudrate;
if (is_open_drain) {
uart_init_open_drain(ACCESSORY_UART);
} else {
uart_init(ACCESSORY_UART);
}
uart_set_rx_interrupt_handler(ACCESSO... | (ACCESSORY_UART, true) | ;
// Block until the sending is complete, but timeout if we aren't able to send a byte for a while.
while (xSemaphoreTake(s_send_semaphore, milliseconds_to_ticks(SEND_BYTE_TIMEOUT_MS)) != pdPASS) {
if (!s_has_sent_byte) {
// we haven't sent a byte in the last timeout period, so time out the whole send
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | rtc_get_time() | ;
}
//! @return Absolute number of ticks since system start.
RtcTicks rtc_get_ticks(void) {
RtcTicks result = s_rtc_tick_count;
s_rtc_tick_count += s_rtc_auto_increment;
return result;
}
RtcTicks sys_get_ticks(void) {
return rtc_get_ticks();
}
//
// Fake Functions!
//
void fake_rtc_init(RtcTicks initial_tick... |
/*
* 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... | (last_word) | ;
} else {
crc_value = CRC_GetCRC();
}
return crc_value;
}
void crc_calculate_incremental_stop(void) {
PBL_ASSERTN(s_initialized);
disable_crc_clock();
}
uint32_t crc_calculate_bytes(const uint8_t* data, unsigned int data_length) {
crc_calculate_incremental_start();
// First calculate the CRC of ... |
rx_gpio.gpio) {
// half-duplex should only define a TX pin
PBL_ASSERTN(!dev->half_duplex);
gpio_af_init(&dev->rx_gpio, otype, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL);
}
// clear any lingering errors
prv_clear_all_errors(dev);
// configure the UART peripheral control registers
// - 8-bit word length
... | uart_is_tx_complete(dev) | ) continue;
}
// Interrupts
////////////////////////////////////////////////////////////////////////////////
static void prv_set_interrupt_enabled(UARTDevice *dev, bool enabled) {
if (enabled) {
PBL_ASSERTN(dev->state->tx_irq_handler || dev->state->rx_irq_handler);
// enable the interrupt
NVIC_SetPrior... |
/*
* 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... | (buf, DISPLAY_BUF_LEN, "\nPinned address: "BT_DEVICE_ADDRESS_FMT,
BT_DEVICE_ADDRESS_XPLODE_PTR(&addr)) | ;
}
SM128BitKey link_key;
uint8_t platform_bits;
if (bt_driver_supports_bt_classic()) {
if (shared_prf_storage_get_bt_classic_pairing_data(&addr, &name[0],
&link_key, &platform_bits)) {
bluetooth_persistent_storage_debug_dump_classic_pairing_inf... |
},
{ 80, 832, -632},
{ 72, 824, -640},
{ 80, 840, -640},
// 266 seconds
{ 72, 832, -640},
{ 72, 832, -640},
{ 80, 832, -640},
{ 88, 832, -640},
{ 80, 808, -648},
{ 80, 832, -648},
{ 88, 816, -648},
{ 88, 808, -648},
{ 96, 816, -640},
{ 104, 816, -640},
{ 56, 8... | { 160, 784, -840},
{ 216, 696, -840},
{ 192, 776, -696},
{ -40, 792, -312},
{ -208, 1648, -64},
{ -312, 1512, -128},
{ -448, 832, 112},
{ -448, 904, 344},
{ -376, 816, 272},
// 272 seconds
{ -384, 736, 472},
{ -448, 720, 376},
{ -488, 488, 488},
{ -504, 480, 440},... |
{ -848, 504, -48},
{ -848, 504, -40},
{ -840, 504, -32},
{ -800, 456, 8},
{ -824, 512, 192},
{ -856, 488, 256},
{ -800, 480, -16},
{ -808, 600, -112},
{ -872, 584, -280},
{ -880, 464, -24},
{ -872, 592, -72},
{ -856, 528, 32},
{ -800, 432, -112},
{ -816, 376, -20... |
/*
* 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(is_complete == true) | ;
cl_assert(should_store == false);
cl_assert(is_invalid == false);
}
}
void test_hdlc__decode_invalid(void) {
// invalid sequences
uint8_t data;
bool should_store, is_invalid, is_complete;
HdlcStreamingContext ctx;
// two consecutive escape characters
hdlc_streaming_decode_reset(&ctx);
data =... |
tatus;
s_callback_called_count++;
}
static void prv_assert_callback_called(status_t expected_status) {
cl_assert_equal_i(s_callback_called_count, 1);
cl_assert_equal_i(s_callback_status, expected_status);
}
static void prv_test_erase_optimal_range(
uint32_t min_start, uint32_t max_start, uint32_t min_end, u... | (
32 * 1024, 32 * 1024, (32 + 18) * 1024, (32 + 96) * 1024,
(EraseCommand[]) {
{ 32 * 1024, SubsectorEraseCommand },
{ 36 * 1024, SubsectorEraseCommand },
{ 40 * 1024, SubsectorEraseCommand },
{ 44 * 1024, SubsectorEraseCommand },
{ 48 * 1024, SubsectorErase... | ;
}
void test_flash_erase__96k_app_banks_4(void) {
// App that's in an unaligned bank but larger than than 64k
prv_test_erase_optimal_range(
32 * 1024, 32 * 1024, (32 + 71) * 1024, (32 + 96) * 1024,
(EraseCommand[]) {
{ 32 * 1024, SubsectorEraseCommand },
{ 36 * 1024, SubsectorErase... |
_count, 0);
kernel_free(s_kalg_state);
s_kalg_state = NULL;
}
// ---------------------------------------------------------------------------------------
void test_kraepelin_algorithm__activity_tests(void) {
bool success = prv_sample_discovery_init(&s_activity_sample_discovery_state.common,
... | (&test_entry[0], num_tests, sizeof(test_entry[0]), prv_qsort_activity_test_entry_cb) | ;
// ---------------------------------------------------------------------------------
// Print results in a table
printf("\n\n");
printf("\n%-24s", "name");
// Print header line
for (int i = 0; i < ARRAY_LENGTH(metrics); i++) {
printf(" exp_%-8s act_%-7s", metrics[i], metrics[i]);
}
printf(" %-10... |
ppogatt_enabled);
gap_sec_level_t level = GAP_SEC_LEVEL_3;
if (prv_is_encrypted(conn_idx)) {
PBL_LOG(LOG_LEVEL_INFO, "Link already encrypted!");
if (!req->should_force_slave_security_request) {
return;
}
// Make sure to request the same security level when sending a request to refresh encrypti... | {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_send_event: %u", e);
} | |
tem/logging.h"
#include "system/passert.h"
#define QUICK_LAUNCH_HOLD_MS (400)
static ClickManager s_click_manager;
static bool prv_should_ignore_button_click(void) {
if (app_manager_get_task_context()->closing_state != ProcessRunState_Running) {
// Ignore if the app is not running (such as if it is in the proc... | timeline_peek_dismiss() | |
r agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "clar.h"
#include "fixt... | (horiz_advance,
text_resources_get_glyph_horiz_advance(&s_font_cache, 'c', &s_font_info)) | ;
}
void test_text_resources__get_glyph_multiple(void) {
const uint8_t a_glyph_data_bytes[] = {0x2e, 0x42, 0x2e, 0x63, 0xb6};
const uint8_t b_glyph_data_bytes[] = {0x21, 0x84, 0x36, 0x63, 0x8c, 0x71, 0x36};
const uint8_t c_glyph_data_bytes[] = {0x2e, 0x86, 0x10, 0x42, 0x74};
uint32_t gothic_18_handle = RESOUR... |
>implementation = &s_complex_implementation;
return prv_complex_init(parent_h, animation_array, array_len,
type);
}
// -------------------------------------------------------------------------------------------
static Animation *prv_animation_clone(AnimationState *state, AnimationPrivate *... | {
applib_free(state->aux);
} |
}
// -------------------------------------------------------------------------------------------
// Return true if the animation globals were instantiated using the legacy 2.x animation
// manager
bool animation_private_using_legacy_2(AnimationState *state) {
if (state == NULL) {
state = prv_animation_state_ge... |
, i18n_get(subtitle, data), NULL);
}
static void prv_selection_changed_cb(SettingsCallbacks *context, uint16_t new_row,
uint16_t old_row) {
vibes_cancel();
VibeScore *score;
switch (new_row) {
case VibeSettingsRow_Notifications: {
score = vibe_client_get_score(VibeC... | {
static const SettingsModuleMetadata s_module_info = {
.name = i18n_noop("Vibrations"),
.init = prv_init,
};
return &s_module_info;
} | |
.size.h = 24;
graphics_draw_text(ctx, le_string, font, box, GTextOverflowModeFill, GTextAlignmentRight, NULL);
}
if (is_sharing_heart_rate_string) {
const int horizontal_margin = menu_cell_basic_horizontal_inset();
GRect box = grect_inset(cell_layer->bounds, GEdgeInsets(0, horizontal_margin));
box... | list_count(data->remote_list_head) | + 1;
}
static int16_t prv_row_height_cb(SettingsCallbacks *context, uint16_t row, bool is_selected) {
#if PBL_RECT
# if CAPABILITY_HAS_BUILTIN_HRM
int heart_rate_sharing_text_height = 0;
if (row > 0) {
SettingsBluetoothData *data = (SettingsBluetoothData *) context;
const uint16_t device_index = row - 1;... |
i++) {
GPoint point = command->points[i];
if (command->type == GDrawCommandTypePrecisePath) {
point = gpoint_scalar_rshift(point, GPOINT_PRECISE_PRECISION);
}
const uint32_t lookup_length = lookup->values.num_points;
for (uint16_t j = 0; j < lookup_length; j++) {
if (gpoint_equal(&poi... | for (uint16_t i = num_groups - 1; i >= 1; i--) {
gpoint_index_lookup_add_at(lookup, (i * num_points_per_group), group_delay_amount);
} |
}
////////////////////
// segmented scale: index based segmentation of scale + transform
static int16_t prv_int_scale_to(
int16_t value, int16_t size, int16_t from_range, int16_t to_range, int32_t normalized,
InterpolateInt64Function interpolate) {
return value + ((int32_t) value * interpolate(
n... |
sters
// are as follows:
// R0-R12 = Unknown
// MSP = VECTOR_TABLE[0] (main stack pointer)
// PSP = Unknown (process stack pointer)
// LR = 0xFFFFFFFF
// PC = VECTOR_TABLE[1]
// PRIMASK = 0x0
// FAULTMASK = 0x0
// BASEPRI = 0x0
// CONTROL = 0x0
//
// Attempt t... | (BUTTON_ID_DOWN) | );
}
static bool check_force_boot_recovery(void) {
if (boot_bit_test(BOOT_BIT_FORCE_PRF)) {
boot_bit_clear(BOOT_BIT_FORCE_PRF);
return true;
}
if (prv_prf_button_combination_is_pressed()) {
dbgserial_putstr("Hold down UP + BACK + SELECT for 5 secs. to force-boot PRF");
for (int i = 0; i < 5000; ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return RCC_AHB1PeriphClockCmd;
} | else if (periph_addr < AHB3_BASE) {
return RCC_AHB2PeriphClockCmd;
} else {
return RCC_AHB3PeriphClockCmd;
}
}
void periph_config_init(void) {
s_periph_config_mutex = mutex_create();
}
void periph_config_acquire_lock(void) {
mutex_lock(s_periph_config_mutex);
}
void periph_config_release_lock(void) ... |
_started_handler,
.stopped = prv_stopped_handler
};
static const AnimationImplementation implementation = {
.setup = prv_setup_handler,
.update = prv_update_handler,
.teardown = prv_teardown_handler
};
h = animation_create();
cl_assert(h != NULL);
void *context = h;
animation_set_handler... | property_animation_get_subject(prop_h, &subject) | ;
cl_assert(subject == &layer);
GRect set_r = GRect(1, 2, 3, 4);
property_animation_set_from_grect(prop_h, &set_r);
r = GRect(0, 0, 0, 0);
property_animation_get_from_grect(prop_h, &r);
cl_assert_equal_rect(set_r, r);
set_r = GRect(5, 6, 7, 8);
property_animation_set_to_grect(prop_h, &set_r);
r = G... |
draw_state.drawing_box.origin = cell_bounds->origin;
const GRect cell_frame = GRect(0, 0, cell_bounds->size.w, cell_bounds->size.h);
const GColor background_color = is_selected ? GColorCobaltBlue : GColorWhite;
graphics_context_set_fill_color(&s_ctx, background_color);
graphics_fill_rect(&s_ctx, &cell_frame);
... | process_manager_set_compiled_with_legacy2_sdk(false) | ;
}
// Tests
//////////////////////
void test_menu_layer_system_cells__basic_cell_width_144_legacy2(void) {
#if PLATFORM_TINTIN || PLATFORM_SILK
// NOTE: The generated bitmap will look really funky because it's rendering 8bit gbitmaps as
// 1bit due to the legacy2 check in gbitmap_get_format. This is normal... |
e == BTErrnoNotEnoughResources) {
// Need to wait for space to become available
launcher_task_add_callback(&prv_register_next_entity, NULL);
} else {
// Most likely the LE connection got busted, don't think retrying will help.
PBL_LOG(LOG_LEVEL_ERROR, "Write failed %i", e);
}
prv_ana... | if (success) {
music_update_player_playback_state(&state);
} else {
PBL_LOG(LOG_LEVEL_ERROR, "Expected CSV with 3 values:");
PBL_HEXDUMP(LOG_LEVEL_ERROR, (const uint8_t *) update->value_str, value_length);
prv_analytics_log_event_with_info(AMSAnalyticsEventErrorPlayerPlaybackInfoUpdate, num_results);
... |
}
static bool prv_float_string_parse(const char *value, const uint16_t value_length,
int32_t multiplier, int32_t *value_in_out) {
if (value_length &&
!ams_util_float_string_parse(value, value_length, multiplier, value_in_out)) {
PBL_LOG(LOG_LEVEL_ERROR, "AMS float failed... |
struct AppState*) callback_param;
PBL_LOG(LOG_LEVEL_DEBUG, "I should be changing the font!");
if (++s_font_selection > 7) {
s_font_selection = 0;
}
ScrollLayer* scroll_layer = &data->scroll_layer;
TextLayer* text = &data->text;
text_layer_set_font(text, s_fonts[s_font_selection]);
GSize max_size = g... | {
static const PebbleProcessMdSystem text_layout_info = {
.common.main_func = &s_main,
.name = "\xF3\xBE\x87\x8A Code Points Overflow This!" // The first 4 bytes is a UTF-8 codepoint for the hamster emoji.
};
return (const PebbleProcessMd*) &text_layout_info;
} | |
ext);
cl_assert_equal_i(timeline_model_get_num_items(), 1);
cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id,
&timeline_model_get_iter_state(-1)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(!t... | timeline_model_get_iter_state(0) | ->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id,
&timeline_model_get_iter_state(2)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_mo... |
/*
* 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... | regular_timer_remove_callback(&s_is_idle_timer) | ;
}
}
|
sessions. Usually, there will only be about 4 or 5 sessions
// (1 container and a handful of restful periods). Allocating space for 32 (an arbitrary
// number) should be more than enough.
uint32_t num_sessions = 32;
ActivitySession *sessions = app_malloc(num_sessions * sizeof(ActivitySession));
if (!sessions)... | {
char *prefix = "";
switch (session->type) {
case ActivitySessionType_Sleep:
case ActivitySessionType_Nap:
case ActivitySessionType_RestfulSleep:
case ActivitySessionType_RestfulNap:
continue;
case ActivitySessionType_Walk:
prefix = "W";
break;
case A... |
exit:
// Free session info memory
app_free(sessions);
prv_display_alert(data->debug_card.dialog_text);
}
// -----------------------------------------------------------------------------------------
static void prv_debug_cmd_weekday_averages(int index, void *context) {
ActivityDemoAppData *data = context;
... |
{4, 0, 1}, 3, &s_recognizers_handled);
prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset);
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive);
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possi... | recognizer_set_manager(r[1], &manager) | ;
r[0]->state = RecognizerState_Failed;
recognizer_manager_handle_state_change(&manager, r[0]);
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive);
cl_assert_equal_p(manager.active_layer, &layer_a);
prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset);
r[1]->state = Rec... |
UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED = 1,
UPDATE_FW_ERROR_MICRO_FLASH_MANGLED = 2
} UpdateFirmwareResult;
static UpdateFirmwareResult update_fw(uint32_t flash_address) {
display_firmware_update_progress(0, 1);
boot_bit_set(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS);
FirmwareDescription firmware_description =
... | boot_bit_set(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO) | ;
boot_bit_set(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED);
system_reset();
} else {
dbgserial_putstr("Failed to load recovery firmware, strike three. SAD WATCH");
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO);
boot_bit_clear(BOOT_BI... |
render it into, which may be less
// wide than the display e.g. if an app is running in bezel mode. The current graphics context's
// contains the appropriate size.
GContext *ctx = graphics_context_get_current_context();
const GSize current_framebuffer_size = graphics_context_get_framebuffer_size(ctx);
layer... | {
StatusBarLayer *status_bar_layer = (StatusBarLayer *)cb_data;
// set title text mode to 'clock', update text, and setup timer to allow clock text to update
status_bar_layer->config.mode = StatusBarLayerModeClock;
prv_status_bar_layer_update_clock(status_bar_layer);
} |
void status_bar_layer_set_info_text(StatusBarLayer *status_bar_layer, const char *text) {
PBL_ASSERTN(status_bar_layer);
strncpy(status_bar_layer->config.info_text_buffer, text, INFO_TEXT_BUFFER_SIZE);
layer_mark_dirty(&(status_bar_layer->layer));
}
// Sets info text either ot X/Y or percentage if total is lar... |
/*
* 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... | (!iter_next(&utf8_iter)) | ;
cl_assert(!iter_next(&utf8_iter));
cl_assert(!iter_next(&utf8_iter));
}
//! Decode multi-byte char
void test_utf8_iterator__decode_test_single_codepoint_string_multi_byte(void) {
// Mutable types
Iterator utf8_iter;
Utf8IterState utf8_iter_state;
// Immutable types
bool success = false;
const Utf8Bo... |
ce_private.h"
#include "console/prompt.h"
#include "drivers/imu.h"
#include "drivers/legacy/accel.h"
#include "kernel/pbl_malloc.h"
#include "kernel/pebble_tasks.h"
#include "os/mutex.h"
#include "os/tick.h"
#include "process_management/app_manager.h"
#include "process_management/worker_manager.h"
#include "services/co... | if (!s_enabled) {
//do not update config when in low power mode
return;
} |
AccelSamplingRate highest_rate = ACCEL_SAMPLING_10HZ;
uint32_t lowest_ms_per_update = ACCEL_MAX_SAMPLES_PER_UPDATE * 1000 / ACCEL_SAMPLING_10HZ;
uint32_t ms_per_update;
uint32_t num_fifo_subscribers = 0;
// Cancel the peek restore config timer, if set
s_temp_peek_mode = false;
new_timer_stop(s_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... | prv_test_decode_encode("upper", buffer, 4, expected, 3) | ;
}
{
char buffer[] = "abcdABCD";
const uint8_t expected[] = { 0x69, 0xb7, 0x1d, 0x0, 0x10, 0x83 };
prv_test_decode_encode("twobyte", buffer, 8, expected, 6);
}
{
char buffer[] = "vu8=";
const uint8_t expected[] = { 0xbe, 0xef };
prv_test_decode_encode("1pad", buffer, 4, expected, 2);
... |
law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdbool.h>
#inclu... | (FLASH_CONFIG.spi, SPI_I2S_FLAG_TXE) | == RESET) {}
// Send the byte on the SPI bus
SPI_I2S_SendData(FLASH_CONFIG.spi, byte);
// Wait for the response byte to be received
while (SPI_I2S_GetFlagStatus(FLASH_CONFIG.spi, SPI_I2S_FLAG_RXNE) == RESET) {}
// Return the byte
return SPI_I2S_ReceiveData(FLASH_CONFIG.spi);
}
static void prv_flash_send_... |
/*
* 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... | prompt_send_response("No worker with id") | ;
}
}
|
tallId app_id, uint32_t update_interval_s,
uint16_t expire_s, HRMFeature features,
HRMSubscriberCallback callback, void *context) {
s_hrm_manager_update_interval = update_interval_s;
s_hrm_manager_expire_s = expire_s;
return s_hrm_n... | ARRAY_LENGTH(s_dls_activity_records) | );
s_dls_activity_records[s_num_dls_activity_records++] = records[i];
}
} else {
return DATA_LOGGING_INVALID_PARAMS;
}
return DATA_LOGGING_SUCCESS;
}
DataLoggingSession *dls_create(uint32_t tag, DataLoggingItemType item_type, uint16_t item_size,
bool buffered, bool ... |
(GColorTiffanyBlue)
#define RECT_TO_SPECIFY_IN_PRE_FUNCTION (GRect(-50, -50, 100, 100))
#define BITMAP_TO_SPECIFY_IN_PRE_FUNCTION ((GBitmap *)1234)
#define EXPECTED_CLIPPED_RECT_AFTER_DRAWING_BITMAP (GRect(0, 0, 50, 50))
typedef struct PreAndPostFunctionsTestProcessor {
GBitmapProcessor processor;
GCompOp previo... | gcolor_equal(s_bitblt_bitmap_into_bitmap_tiled_calls.last_call.tint_color,
TINT_COLOR_TO_SPECIFY_IN_PRE_FUNCTION) | );
cl_assert_equal_rect(s_bitblt_bitmap_into_bitmap_tiled_calls.last_call.dest_rect,
EXPECTED_CLIPPED_RECT_AFTER_DRAWING_BITMAP);
cl_assert_equal_p(s_bitblt_bitmap_into_bitmap_tiled_calls.last_call.src_bitmap,
BITMAP_TO_SPECIFY_IN_PRE_FUNCTION);
// Check that the modifi... |
/*
* 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... | {
switch (msg->command_id) {
case HcMessageID_GapLEConnect_ConnectionComplete: {
const HcGapLeConnectionData *e = (HcGapLeConnectionData *)msg->payload;
bt_driver_handle_le_connection_complete_event(&e->connection_complete_event);
const GattDeviceConnectionEvent gatt_event = {
.dev_addre... | |
AX_NUM_ROWS + 1 );
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_even_cols_no_clip")));
// Odd cols of different lengths
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), M... | setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1) | ;
graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS);
graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4);
graphics_draw_vertical_line_dotted(&ctx, GPoint(5, 0), 0);
graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1);
graphics_draw_vertical_line_dotted(&ctx, GPoin... |
ild_id)-1] = 0;
return prv_flash_write_bytes(&hdr, flash_addr, sizeof(hdr));
}
// =================================================================================================
// Public interface
// -----------------------------------------------------------------------------------------------
// Trigger a cor... | prv_debug_str("Starting core dump") | ;
// Save the current time now because rtc_get_ticks() disables and then re-enables interrupts
s_time_stamp = rtc_get_time();
prv_debug_str("CD: starting");
// Feed the watchdog so that we don't get watchdog reset in the middle of dumping the core
watchdog_feed();
prv_stash_regions();
// Init the fla... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (LOG_LEVEL_WARNING, "No connection to addr!") | ;
goto failure;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Received Discovery Start for 0x%x to 0x%x",
(int)req->range.start, (int)req->range.end);
uint16_t conn_idx = connection_get_idx(conn);
ble_error_t e = ble_gattc_browse(conn_idx, NULL, req->range.start, req->range.end);
if (e != BLE_STATUS_OK) {
s... |
prv_announce_interaction(swap_layer);
prv_attempt_swap(swap_layer, ScrollDirectionDown, true /* to_top */);
}
}
static void prv_raw_click_handler(ClickRecognizerRef recognizer, void *context) {
SwapLayer *swap_layer = (SwapLayer *)context;
// Ignore any press that isn't the start of a new click pattern
... | {
return &((SwapLayer *)swap_layer)->layer;
} |
LayoutLayer* swap_layer_get_current_layout(const SwapLayer *swap_layer) {
return swap_layer->current;
}
///////////////////////
// INIT FUNCTIONS
///////////////////////
void swap_layer_init(SwapLayer *swap_layer, const GRect *frame) {
*swap_layer = (SwapLayer){};
Layer *layer = &swap_layer->layer;
layer_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... | {
MetaResponseInfo *meta_response_info_heap_copy = data;
// Swap endpoint_id bytes to be Big-Endian:
meta_response_info_heap_copy->payload.endpoint_id =
htons(meta_response_info_heap_copy->payload.endpoint_id);
uint16_t payload_size;
if (meta_response_info_heap_copy->payload.error_code == MetaResp... |
void meta_endpoint_send_response_async(const MetaResponseInfo *meta_response_info) {
PBL_LOG(LOG_LEVEL_ERROR, "Meta protocol error: 0x%x (endpoint=%u)",
meta_response_info->payload.error_code, meta_response_info->payload.endpoint_id);
MetaResponseInfo *meta_response_info_heap_copy = kernel_zalloc_check... |
/*
* 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... | (&data->from, index, 1) | ;
}
static void prv_handle_from_dec(unsigned index, void *context) {
TimeRangeSelectionWindowData *data = context;
date_time_handle_time_change(&data->from, index, -1);
}
// TO selection layer callbacks
static char* prv_handle_to_get_text(unsigned index, void *context) {
TimeRangeSelectionWindowData *data = con... |
t s_last_handle_discovery_result;
static void prv_bluetopia_service_discovery_cb(unsigned int stack_id,
GATT_Service_Discovery_Event_Data_t *event,
unsigned long callback_param) {
cl_assert_equal_i(stack_id, TEST_BT_STACK_I... | gatt_service_changed_client_handle_indication(&s_connection, att_handle,
(const uint8_t *) handle_range, sizeof(uint16_t) * 2) | ;
// Re-discovery is trigger on KernelBG:
fake_system_task_callbacks_invoke_pending();
// The KernelBG trip uses kernel_malloc, make sure it's cleaning up properly:
fake_kernel_malloc_mark_assert_equal();
cl_assert_equal_b(handled, true);
// Expect service discovery to be started once more:
cl_assert_eq... |
izer)) {
return false;
}
return true;
}
uint8_t click_number_of_clicks_counted(ClickRecognizerRef recognizer_ref) {
ClickRecognizer *recognizer = (ClickRecognizer*)recognizer_ref;
return recognizer->number_of_clicks_counted;
}
ButtonId click_recognizer_get_button_id(ClickRecognizerRef recognizer_ref) {
... | (recognizer) | ) {
// No long click nor multi click, fire handler immediately on button down:
++(recognizer->number_of_clicks_counted);
const bool needs_reset = (false == local_is_hold_to_repeat_enabled);
prv_dispatch_event(recognizer, ClickHandlerOffsetSingle, needs_reset);
}
}
}
void click_recognizer_... |
(LOG_LEVEL_INFO, "Cancel audio recording") | ;
prv_teardown_session();
}
static void prv_reset(void) {
s_state = SessionState_Idle;
s_session_id = AUDIO_ENDPOINT_SESSION_INVALID_ID;
}
static void prv_cancel_session(void) {
prv_cancel_recording();
prv_reset();
}
static void prv_start_result_timeout(void) {
new_timer_start(s_timeout, TIMEOUT_SESSION_... | |
-1224, 136, 168},
// 62 seconds
{ -1168, 40, 96},
{ -1192, 120, 112},
{ -1192, -96, 176},
{ -1000, -224, 88},
{ -1280, -40, 64},
{ -1136, 248, -120},
{ -1032, 224, -144},
{ -1200, 176, -80},
{ -1352, -64, 160},
{ -1408, -16, 280},
{ -1440, 224, 264},
{ -1368, 432, 208... | { 360, -504, -432},
{ 568, -416, -800},
{ 640, -400, -872},
{ 1024, -456, -1016},
{ 848, -328, -944},
{ 640, -456, -536},
{ 472, -304, -432},
{ 488, -312, -472},
{ 512, -344, -456},
{ 384, -416, -400},
{ 320, -400, -400},
{ 384, -496, -352},
{ 512, -472, -240},
{ ... |
{ 64, 1032, 520},
{ 104, 1144, 632},
{ 40, 1064, 664},
{ 168, 808, 608},
{ 136, 696, 680},
{ 112, 744, 688},
{ 8, 760, 536},
{ 80, 552, 360},
{ 184, 496, 232},
{ 216, 480, 304},
{ 152, 648, 344},
{ 128, 744, 416},
{ 88, 864, 520},
{ 128, 952, 488},
{ 216, 107... |
"%s {%u args}", cmd->cmd_str, cmd->num_params);
} else {
prompt_send_response(cmd->cmd_str);
}
}
}
typedef struct CommandArgs {
unsigned int num_args;
const char* args[NUM_SUPPORTED_PARAM_COUNT];
} CommandArgs;
static CommandArgs prv_parse_arguments(char* buffer, cha... | {
return;
} |
if (LIKELY(c >= 0x20 && c < 127)) {
// Printable character.
if (!prompt_context_append_char(&s_dbgserial_prompt_context, c)) {
dbgserial_putchar(0x07); // bell
return;
}
// Echo
dbgserial_putchar_lazy(c);
return;
}
// Handle unprintable control characters.
if (UNLIKELY(... |
/*
* 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... | {
EventServiceEntry *service = s_event_services[subscription->event_type];
if (s_event_services[subscription->event_type] == NULL) {
// service does not exist
PBL_LOG(LOG_LEVEL_WARNING, "Attempted to unsubscribe from %d, no service found",
subscription->event_type);
return;
}
if (service->... |
static void prv_event_service_subscribe(PebbleSubscriptionEvent *subscription) {
EventServiceEntry *service = s_event_services[subscription->event_type];
if (service == NULL) {
// No event service for this event type, create one
event_service_init(subscription->event_type, NULL, NULL);
service = s_e... |
P_NXNY, OFFSET_RECT_CLIP_NXNY, true, 2);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
#endif
// AA = true, SW = 3
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSE... | gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi") | |
== SmartstrapStateNotifyInProgress) &&
(new_state == SmartstrapStateReadComplete)) {
PBL_ASSERTN(mcu_state_is_isr() || (pebble_task_get_current() == PebbleTask_NewTimers));
} else if ((prev_state == SmartstrapStateReadDisabled) &&
(new_state == SmartstrapStateReadInProgress)) {
PBL_A... | (s_services_lock) | ;
while (s_num_connected_services) {
const uint16_t service_id = s_connected_services[s_num_connected_services - 1];
prv_set_service_connected(service_id, false);
}
s_num_connected_services = 0;
mutex_unlock(s_services_lock);
}
s_is_connected = connected;
smartstrap_profiles_handle_con... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&RCC_ClocksStatus) | ;
int prescaler = RCC_ClocksStatus.HCLK_Frequency / dev->clock_speed_hz;
if ((RCC_ClocksStatus.HCLK_Frequency / prescaler) > dev->clock_speed_hz) {
// The desired prescaler is not an integer, so we'll round up so that the clock is never
// faster than the desired frequency.
prescaler++;
}
// enable... |
flash chips, and we
// run into 5+ second erases pretty regularly. We're not holding the flash lock while we're
// doing this, so other threads are allowed to use flash, but it's pretty common to hold
// other locks while waiting for a flash operation to complete, leading to other tasks
// trig... | {
mutex_lock(s_flash_lock);
flash_impl_release_many(num_locks);
mutex_unlock(s_flash_lock);
} |
#include "console/prompt.h"
void command_flash_unprotect(void) {
flash_impl_unprotect();
prompt_send_response("OK");
}
|
/*
* 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... | initialize_button(&BOARD_CONFIG_BUTTON.buttons[i]) | |
00 }, // 2:1, BUCK2
{ "+2V0_RTC", 2, 0b101 }, // 2:1, LDO1
{ "+3V2", 2, 0b110 }, // 2:1, LDO2
#ifdef BOARD_SNOWY_BB
{ "+2V5", 2, 0b111 }, // 2:1, LDO3
#else
{ "+1V8_MFI_MIC", 2, 0b111 }, // 2:1, LDO3
#endif // BOARD_SNOWY_BB
#endif // RECOVERY_FW
};
static const int PMIC_MON_CONFIG_VBAT_IND... | {
prv_mon_config_lock();
return prv_set_mon_config(&MON_CONFIG[PMIC_MON_CONFIG_VBAT_INDEX]);
// Don't prv_unlock, we don't want anyone else mucking with the mon config until
// pmic_disable_battery_measure is called.
} |
bool pmic_disable_battery_measure(void) {
bool result = prv_set_mon_config_register(0);
// Releases the lock that was previously aquired in pmic_enable_battery_measure.
prv_mon_config_unlock();
return result;
}
bool pmic_set_charger_state(bool enable) {
// Defaults to ON
// Default value is 0xF7
cons... |
/*
* 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... | {
ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL;
ListNode *tail;
tail = list_append(&a, &b);
cl_assert(tail == &b);
tail = list_append(&a, &c);
cl_assert(tail == &c);
cl_assert(list_get_prev(&a) == NULL);
cl_assert(list_get_next(&a) == &b);
cl_assert(list_get_prev(&b) == &a);
c... |
void test_list__prepend(void) {
ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL;
ListNode *head;
head = list_prepend(&c, &b);
cl_assert(head == &b);
head = list_prepend(&b, &a);
cl_assert(head == &a);
cl_assert(list_get_prev(&a) == NULL);
cl_assert(list_get_next(&a) == &b);
cl_as... |
(GPIOA)
#define DISP_PIN_LCD (GPIO_Pin_0)
#define DISP_PINSOURCE_LCD (GPIO_PinSource0)
#define DISP_MODE_STATIC (0x00)
#define DISP_MODE_WRITE (0x80)
#define DISP_MODE_CLEAR (0x20)
// The bootloader leaves SYSCLK at defaults (connected to HSI at 16 Mhz),
// and there are no prescalers on any of the buses. Since the d... | prv_display_write_byte(0x00) | |
nt client;
uint8_t *value;
size_t value_length;
bool is_response_required;
} Write;
static Write *s_write_head;
static BTErrno s_write_return_value;
static BTErrno fake_gatt_client_write(BLECharacteristic characteristic,
const uint8_t *value,
... | cl_assert_(false, "No gatt_client_op_write() or "
"gatt_client_op_write_without_response() has happened at all") | ;
}
void fake_gatt_client_op_assert_write(BLECharacteristic characteristic,
const uint8_t *value, size_t value_length,
GAPLEClient client, bool is_response_required) {
if (s_write_head) {
cl_assert_equal_i(characteristic, s_write_head->c... |
/* BPM */, 3 /* minutes */);
cl_assert_equal_b(prv_is_hr_elevated(), true);
activity_get_metric(ActivityMetricHeartRateZone1Minutes, 1, &zone1_minutes);
cl_assert_equal_i(zone1_minutes, 4);
activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes);
cl_assert_equal_i(zone2_minutes, 2);
acti... | activity_private_state() | ->activity_sessions_count) {
cl_assert_equal_m(&activity_private_state()->activity_sessions[i], &empty_session,
sizeof(ActivitySession));
}
}
cl_assert_equal_m(&activity_private_state()->activity_sessions[0], &empty_session,
sizeof(ActivitySession));
// Add ... |
/*
* 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... | (destbuf, testbuf, 8) | , destbuf);
}
void test_memcpy__move_basic(void) {
uint8_t testbuf[8] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, };
uint8_t destbuf[8];
memmove(destbuf, testbuf, 8);
cl_assert_equal_m(testbuf, destbuf, 8);
}
void test_memcpy__move_return_value(void) {
uint8_t testbuf[8] = { 0x12, 0x34, 0x56, 0x78, ... |
ock is assumed to be taken by the caller
void gatt_client_discovery_handle_service_range_change(
GAPLEConnection *connection, ATTHandleRange *range) {
GATTServiceNode *service_node;
BLEService service = gatt_client_att_handle_get_service(connection, range->start, &service_node);
if (service == BLE_SERVICE_IN... | prv_send_services_invalidate_all_event(connection, errno) | |
s file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS... | do_not_disturb_manual_toggle_with_dialog() | ;
}
static void prv_toggle_dnd_from_action_menu(ActionMenu *action_menu,
const ActionMenuItem *item,
void *context) {
// This function handles first-time use tutorial logic
do_not_disturb_toggle_manually_enabled(ManualDNDFirstU... |
cl_assert(gcolor_equal(test_value, end_value));
GColor8 set_value;
set_value = (GColor8) {.a=0, .r=1, .g=2, .b=3};
property_animation_set_from_gcolor8(prop_h, &set_value);
property_animation_get_from_gcolor8(prop_h, &test_value);
cl_assert(gcolor_equal(test_value, set_value));
property_animation_set_from_g... | (h, false) | ;
prv_clear_handler_histories();
animation_schedule(h);
int max_loops = 20;
uint64_t start_ms = prv_now_ms();
uint64_t time_ms;
while (s_stopped_handler_calls.num_calls == 0) {
prv_fire_animation_timer();
time_ms = prv_now_ms();
DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | graphics_draw_text(ctx, text, small_font, text_box, overflow_mode, alignment, NULL) | ;
}
}
void health_ui_render_typical_text_box(GContext *ctx, Layer *layer, const char *value_text) {
time_t now = rtc_get_time();
struct tm time_tm;
localtime_r(&now, &time_tm);
char weekday[8];
strftime(weekday, sizeof(weekday), "%a", &time_tm);
toupper_str(weekday);
char typical_text[32];
snprintf(... |
y 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 Lic... | if (strcmp(title, reminder_info->title) != 0) {
timeline_item_free_allocated_buffer(reminder);
return true; // continue iteration
} |
if (reminder_info->filter_cb && !reminder_info->filter_cb(&header, context)) {
timeline_item_free_allocated_buffer(reminder);
return true; // continue iteration
}
reminder_info->match = true;
return false; // stop iteration
}
bool reminder_db_find_by_timestamp_title(time_t timestamp, const char *tit... |
"stubs_sleep.h"
#include "stubs_system_reset.h"
#include "stubs_task_watchdog.h"
static PebbleProcessMd __pbl_app_info;
const PebbleProcessMd* sys_process_manager_get_current_process_md(void) {
return &__pbl_app_info;
}
// Tests
////////////////////////////////////
#define TEST_UUID_A { 0x2F, 0xF7, 0xFA, 0x04, 0x6... | {
const uint32_t key = 0;
cl_assert_equal_i(persist_read_bool(key), false);
cl_assert_equal_i(persist_write_bool(key, true), sizeof(bool));
cl_assert_equal_i(persist_get_size(key), sizeof(bool));
cl_assert_equal_i(persist_read_bool(key), true);
} |
void test_persist__data(void) {
const uint32_t key = 0;
const int size = sizeof(test_uuid_a);
Uuid uuid_buffer;
cl_assert_equal_i(persist_read_data(key, &uuid_buffer, sizeof(uuid_buffer)), E_DOES_NOT_EXIST);
cl_assert_equal_i(persist_write_data(key, &test_uuid_a, sizeof(test_uuid_a)), size);
cl_assert_e... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (c->cache + i * c->item_size, item, c->item_size) | |
l/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "services/normal/data_logging/data_logging_service.h"
#include "services/common/new_timer/new_timer.h"
#include "services/common/system_task.h"
#include "services/common/analytics/analytics_event.h"
#include "services/common/analytics/analytics_external.h"
#incl... | {
dls_log(s_device_heartbeat_session, device_hb->data, 1);
#ifdef ANALYTICS_DEBUG
analytics_heartbeat_print(device_hb);
#endif
kernel_free(device_hb);
AnalyticsHeartbeatList *app_hb_node = app_hbs;
while (app_hb_node) {
AnalyticsHeartbeat *app_hb = app_hb_node->heartbeat;
#ifdef ANALYTICS_DEBUG
analy... |
// System task callback used to prepare and log the heartbeats using dls_log().
void analytics_logging_system_task_cb(void *ignored) {
if (!s_device_heartbeat_session) {
uint32_t size = analytics_heartbeat_kind_data_size(ANALYTICS_HEARTBEAT_KIND_DEVICE);
s_device_heartbeat_session = prv_create_dls(ANALYTICS... |
omm_session_close(client->session, (CommSessionCloseReason)reason);
}
list_remove(&client->node, (ListNode **) &s_ppogatt_head, NULL);
new_timer_delete(client->rx_ack_timer);
kernel_free(client);
if (s_ppogatt_head == NULL) {
regular_timer_remove_callback(&s_ack_timer);
}
}
// -----------------------... | prv_get_max_payload_size(client) | < GATT_MTU_MINIMUM) {
// If a device does not support large a large MTU/payload size, its throughput is severely
// limited by the window size leading. This prevents us from handling throughput sensitive
// operations (such as dictation) in time and results in dropped packets. To improve this,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.