prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
le(timer_id, timeout_ms)) {
return timer_id;
}
return evented_timer_register(timeout_ms, false, callback, data);
}
EventedTimerID evented_timer_register(uint32_t timeout_ms,
bool repeating,
EventedTimerCallback callback,
... | (timer_id) | ;
PBL_ASSERTN(timer);
return timer->target_task == pebble_task_get_current();
}
void evented_timer_reset(void) {
s_timer_list_head = 0;
}
void *evented_timer_get_data(EventedTimerID timer_id) {
EventedTimer* timer = prv_find_timer(timer_id);
if (timer) {
return timer->callback_data;
} else {
retur... |
// but is blocked. See PBL-25741 for details
uint32_t erase_suspend_time_remaining;
if (new_timer_scheduled(s_erase_suspend_timer, &erase_suspend_time_remaining) &&
(erase_suspend_time_remaining == 0)) {
prv_erase_suspend_timer_cb(NULL);
}
// An erase can take a long time, especially if... | (s_flash_lock) | ;
}
uint32_t flash_get_sector_base_address(uint32_t flash_addr) {
return flash_impl_get_sector_base_address(flash_addr);
}
uint32_t flash_get_subsector_base_address(uint32_t flash_addr) {
return flash_impl_get_subsector_base_address(flash_addr);
}
void flash_power_down_for_stop_mode(void) {
flash_impl_enter_lo... |
/*
* 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... | {
// The unit tests parse the //> TEST_.* lines below for test values
// NOTE: The TEST_ACTIVITY_TYPE is one of the KAlgActivityType enum values
//> TEST_NAME run_shut_down_1
//> TEST_VERSION 3
//> TEST_ACTIVITY_TYPE 3
//> TEST_ACTIVITY_TYPE_MIN 3
//> TEST_ACTIVITY_TYPE_MAX 3
//> TEST_LEN 30
//> TEST_... | |
/*
* 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 (FAILED(open_status)) {
// File open failed, return live data without saving to cache
goto done;
} | |
y say that the app is now fully focused.
const ModalProperty properties = modal_manager_get_properties();
s_state = ((properties & ModalProperty_Exists) && (properties & ModalProperty_Transparent)) ?
CompositorState_AppAndModal : CompositorState_App;
prv_send_did_focus_event(true);
}
}... | {
s_state = (properties & ModalProperty_Transparent) ? CompositorState_AppAndModal :
CompositorState_Modal;
compositor_modal_render_ready();
// Force the app framebuffer to be released. We hold it during transitions to keep the app
// framebuffer... | else {
s_state = CompositorState_App;
compositor_app_render_ready();
}
prv_send_did_focus_event(properties & ModalProperty_Unfocused);
}
static void prv_animation_teardown(Animation *animation) {
if (s_animation_state.impl->teardown) {
s_animation_state.impl->teardown(animation);
}
s_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... | (0, -20000, 20000, moook_num_soft_frames) | );
// mid frame is closer to end due to more end frames
cl_assert_equal_i(6676, interpolate_moook_soft(ANIMATION_NORMALIZED_MAX / 2, -20000,
20000, moook_num_soft_frames));
cl_assert_equal_i(20000, interpolate_moook_soft(ANIMATION_NORMALIZED_MAX, -20000,
... |
bit %d not returning correct data value", bitpos);
return status;
}
bitpos++;
addr_region += 4; // increment to the next address to avoid extra erases
}
PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - DATA TEST 1: Data bus test");
return status;
}
/*********************************************************... | PBL_LOG(LOG_LEVEL_DEBUG, ">> Reading Addr 0x%"PRIx32" value is 0x%"PRIx8,
test_addr, read_buffer) | ;
}
// Write data pattern
status = prv_write_read_verify_byte(test_addr, data_pattern, data_pattern, display_logs);
VERIFY_TEST_STATUS(status);
}
if (display_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">>> Initializing data patterns...complete"); }
return FLASH_TEST_SUCCESS;
}
static FlashTestErrorType ... |
al_print("\nXsum ");
dbgserial_print_hex(firmware_description.checksum);
dbgserial_putstr("\nInvalid firmware description!");
return UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED;
}
if (!prv_check_valid_firmware_crc(
flash_new_fw_addr + sizeof(FirmwareDescription), &firmware_description)) {
dbgseri... | boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE) | ;
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO);
boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE);
boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO);
recovery_fw_ok = false;
}
break;
}
boot_bit_clear(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS);
return recovery_fw_ok;
}
|
LE_NAME,
SETTINGS_FILE_SIZE);
if (rv != S_SUCCESS) {
mutex_unlock(s_app_db.mutex);
}
return rv;
}
static void prv_close_file_and_unlock_mutex(void) {
settings_file_close(&s_app_db.settings_file);
mutex_unlock(s_app_db.mutex);
}
static status_t prv_cancel_app_fetch(AppI... | (&s_app_db.settings_file, (uint8_t *)&app_id,
sizeof(AppInstallId)) | |
/*
* 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_locked) | ;
s_locked = true;
}
void smartstrap_state_unlock(void) {
cl_assert(s_locked);
s_locked = false;
}
void smartstrap_state_assert_locked_by_current_task(void) {
cl_assert(s_locked);
}
bool sys_smartstrap_is_service_connected(uint16_t service_id) {
return true;
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | APP_LOG(APP_LOG_LEVEL_INFO, "Advancing to 300ms from the end of %d ms", (int)duration) | ;
return;
}
Layer *layer = text_layer_get_layer(s_text_layer_a);
GRect from_rect_a = GRect(0, 0, 60, 60);
GRect to_rect_a = GRect(84, 92, 60, 60);
GRect from_rect_b = GRect(84, 0, 60, 60);
GRect to_rect_b = GRect(0, 92, 60, 60);
GRect tmp;
if (toggle) {
tmp = to_rect_b;
to_rect_b = from_r... |
---------------------------
// Derived metrics like distance, calories, and walking minutes that are based on steps
void test_activity__step_derived_metrics(void) {
int32_t value;
// All tests start at 5pm, which is 1020 minutes into the day
const int k_minute_start = 1020;
// Set the user's dimensions
cons... | prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 10, ActivitySleepStateAwake);
activity_get_metric(ActivityMetricActiveSeconds, 1, &value);
cl_assert_equal_i(value, SECONDS_PER_HOUR + (2 * SECONDS_PER_MINUTE));
cl_assert_equal_i(health_service_sum_today(HealthMetricActiveSeconds),
SECONDS... |
ACTIVITY_CALORIES_PER_KCAL));
// Feed in 125 steps/minute over 60 minutes
prv_feed_cannned_accel_data(60 * SECONDS_PER_MINUTE, 125, ActivitySleepStateAwake);
const int k_exp_steps_2 = 125 * MINUTES_PER_HOUR;
// Test the derived metrics
activity_get_metric(ActivityMetricActi... |
}
void alarm_set_time(AlarmId id, int hour, int minute) {
prv_assert_alarm_params(hour, minute);
prv_alarm_operation(id, prv_set_alarm_time_op, &(SetAlarmTimeContext) { hour, minute });
}
// ----------------------------------------------------------------------------------------------
static bool prv_set_alarm_s... | (LOG_LEVEL_DEBUG, "Canceling snooze timer on delete") | ;
prv_clear_snooze_timer();
}
AlarmStorageKey key = { .id = id, .type = ALARM_DATA_CONFIG };
settings_file_delete(&file, &key, sizeof(key));
prv_timeline_remove_alarm(&file, id);
prv_reload_alarms(&file);
prv_file_close_and_unlock(&file);
}
// ---------------------------------------------------------... |
+ j]);
}
}
}
return &s_parsed_msg;
}
// ---------------------------------------------------------------------------------------------
// Parse and encoded message and return a TestPLParsedMsg structure pointer pointing to it's
// parsed contents. The contents are valid until prv_parse_encoded_msg is c... | (a->msrmt.types, b->msrmt.types,
b->msrmt.num_types * sizeof(ProtobufLogMeasurementType)) | ;
cl_assert_equal_i(a->msrmt.num_samples, b->msrmt.num_samples);
cl_assert_equal_m(a->msrmt.offset_sec, b->msrmt.offset_sec,
b->msrmt.num_samples * sizeof(uint32_t));
cl_assert_equal_i(a->msrmt.num_values, b->msrmt.num_values);
cl_assert_equal_m(a->msrmt.values, b->msrmt.values, b-... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (LOG_LEVEL_DEBUG, "Read compass whoami byte 0x%x, expecting 0x%x",
whoami, COMPASS_WHOAMI_BYTE) | ;
return (whoami == COMPASS_WHOAMI_BYTE);
}
void mag3110_init(void) {
if (s_initialized) {
return;
}
s_mag_mutex = mutex_create();
s_initialized = true;
if (!mag3110_check_whoami()) {
PBL_LOG(LOG_LEVEL_WARNING, "Failed to query Mag");
}
gpio_input_init(&BOARD_CONFIG_MAG.mag_int_gpio);
ext... |
/*
* 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... | (".rocky_bss") | T_STATIC RockyAPITextState s_rocky_text_state;
SECTION(".rocky_bss") static GFont s_default_font;
static GSize prv_get_max_used_size(GContext *ctx, const char *str_buffer, const GRect box) {
return graphics_text_layout_get_max_used_size(ctx, str_buffer,
s_rocky_text_... |
in SettingsFile format.
int pid = persist_map_auto_id(uuid);
if (FAILED(pid)) {
// Attempting to debug persist map failure
PBL_LOG(LOG_LEVEL_WARNING, "Failed to get pid! %d", pid);
persist_map_dump();
return pid;
}
return snprintf(name, buf_len, "ps%06d", pid);
}
status_t persist_service_delet... | list_remove(&store->list_node,
&s_client_stores /* &head */, NULL /* &tail */) | ;
kernel_free(store);
}
}
prv_unlock();
}
|
ver.
watchface_set_default_install_id(INSTALL_ID_INVALID);
watchface_launch_default(NULL);
}
// Not going to launch this, release the allocated memory
app_install_release_md(md);
return;
}
}
#endif
if (is_worker) {
worker_manager_launch_new_worker_with_args(md, NUL... | pebble_task_get_name(task) | |
tx->draw_state.drawing_box.origin.y;
GBitmap *framebuffer = graphics_capture_frame_buffer(ctx);
if (!framebuffer) {
// Couldn't capture framebuffer
return;
}
graphics_private_draw_horizontal_line_prepared(ctx, framebuffer, &ctx->draw_state.clip_box, y,
... | grect_get_max_x(clip_box) | );
#if PBL_COLOR
color.a = (uint8_t)(MAX_PLOT_BRIGHTNESS - opacity);
#else
if (opacity > (MAX_PLOT_BRIGHTNESS / 2)) {
// We're not plotting anything, bail
return;
}
#endif // PBL_COLOR
ctx->draw_state.draw_implementation->blend_horizontal_line(ctx, y, x_min, x_max, color);
}
void graphics_private_plo... |
ndler(device.opaque, BLEClientServicesAdded, services, num_services, status);
}
}
// TODO (PBL-22086): We should really make this easier to do ...
// We can't directly dereference the service discovery info pointer from third
// party apps because it was malloc'ed from the kernel heap. Instead copy the
// info that ... | if (!value) {
gatt_error = BLEGATTErrorLocalInsufficientResources;
value_length = 0;
} |
uintptr_t object_ref;
// Consume, even if we didn't have enough memory, this will eat the notification and free up
// the space in the buffer.
const uint16_t next_value_length = sys_ble_client_consume_notification(&object_ref,
v... |
Write APIs
////////////////////////////////////////////////////////////////////////////////
void uart_write_byte(UARTDevice *dev, uint8_t data) {
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_by... | if (dev->state->rx_dma_buffer) {
// process bytes from the DMA buffer
const uint32_t dma_length = dev->state->rx_dma_length;
const uint32_t next_idx = dma_length - dma_request_get_current_data_counter(dev->rx_dma);
// make sure we didn't underflow the index
PBL_ASSERTN(next_idx < dma_lengt... |
}
if (dev->state->tx_irq_handler && dev->state->tx_int_enabled && uart_is_tx_ready(dev)) {
if (dev->state->tx_irq_handler(dev)) {
should_context_switch = true;
}
}
portEND_SWITCHING_ISR(should_context_switch);
}
void uart_clear_all_interrupt_flags(UARTDevice *dev) {
dev->periph->RQR |= USART_R... |
/*
* 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 (!BOARD_CONFIG.als_always_on) {
prv_sensor_enable(true);
} |
VoltageReading reading;
voltage_monitor_read(VOLTAGE_MONITOR_ALS, &reading);
if (!BOARD_CONFIG.als_always_on) {
prv_sensor_enable(false);
}
// Multiply vmon/vref * 2/3 to find a percentage of the full scale and then
// multiply it back by 4096 to get a full 12-bit light level.
uint32_t value = (re... |
/*
* 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_app_session_ptr = NULL;
s_close_called = false;
s_get_called = false;
s_open_status = S_SUCCESS;
s_get_value = 0;
s_set_value = s_unwritten_value;
s_has_cache = false;
s_app_md = (PebbleProcessMd){};
} |
void test_app_session_capabilities__cleanup(void) {
}
void test_app_session_capabilities__no_cache_file_and_not_connected(void) {
s_open_status = E_ERROR;
bool has_cap =
comm_session_current_app_session_cache_has_capability(CommSessionInfiniteLogDumping);
cl_assert_equal_b(false, has_cap);
cl_assert_e... |
_layout->icon_layer.layer, &icon_from);
layer_get_global_frame(&card_timeline_layout->icon_layer.layer, &icon_to);
// Unclip for the scaling animation
layer_set_clips(&pin_timeline_layout->icon_layer.layer, false);
layer_set_clips(&card_timeline_layout->icon_layer.layer, false);
// TODO: PBL-28738 Refactor k... | {
return;
} |
const uint32_t duration = TIMELINE_CARD_TRANSITION_MS;
GRect icon_from, icon_to;
layer_get_global_frame((Layer *)&card_timeline_layout->icon_layer, &icon_from);
layer_get_global_frame((Layer *)&pin_timeline_layout->icon_layer, &icon_to);
// Unclip for the scaling animation
layer_set_clips(&pin_timeline_la... |
/*
* 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... | {
units_changed |= MINUTE_UNIT;
} |
if (s_state.last_time.tm_hour != currtime.tm_hour) {
units_changed |= HOUR_UNIT;
}
if (s_state.last_time.tm_mday != currtime.tm_mday) {
units_changed |= DAY_UNIT;
}
if (s_state.last_time.tm_mon != currtime.tm_mon) {
units_changed |= MONTH_UNIT;
}
if (s_... |
if (!state->pending_response_data) {
return; // Gotta wait for FW to subscribe / write the emulated CCCD.
} |
PBL_LOG(LOG_LEVEL_ALWAYS, "Phone & Watch have hit CCCD, initiate PPoGatt WA!");
hc_protocol_enqueue_with_payload(HcEndpointID_Gatt, HcMessageID_Gatt_WriteCompleted,
(uint8_t *)state->pending_response_data,
state->pending_data_size);
kernel_fr... | |
ob(GAPLEAdvertisingJob *job) {
if (job->node.next == &job->node) {
// Last job left...
job->node.next = NULL;
job->node.prev = NULL;
s_jobs = NULL;
} else {
list_remove(&job->node, (ListNode **) &s_jobs, NULL);
}
// Part of CC2564 advertising bug work-around:
if (job == s_current) {
b... | prv_increment_elapsed_time_for_job(&job, &force_update) | ;
prv_perform_next_job(force_update);
}
unlock:
bt_unlock();
}
// -----------------------------------------------------------------------------
//! Timer start / stop utilities
//! bt_lock is expected to be taken!
static void prv_timer_start(void) {
if (regular_timer_is_scheduled(&s_cycle_regular_timer)) {
... |
/*
* 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... | (pass, "Pass") | ;
layer_add_child(&window->layer, &pass->layer);
bounds.origin.y = 120;
TextLayer *fail = &results_ui->fail_text_layer;
text_layer_init(fail, &bounds);
text_layer_set_font(fail, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
text_layer_set_text_alignment(fail, GTextAlignmentRight);
text_layer_set_text(... |
F(DCDC, DCDC_CTRL_1_REG, DCDC_TIMEOUT, 0x10);
REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TIMEOUT_IRQ_TRIG, 0x8);
REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TIMEOUT_IRQ_RES, 0x8);
REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TUNE, 0x0);
REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_LSSUP_TRIM, 0x5);
REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_H... | REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_REG, 0x0) | ;
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_BROWN_OUT_IRQ_CLEAR, 0x0);
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18P_TIMEOUT_IRQ_CLEAR, 0x0);
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_VDD_TIMEOUT_IRQ_CLEAR, 0x0);
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18_TIMEOUT_IRQ_CLEAR, 0x0);
REG_SETF(DCDC, DCDC_IRQ_CLEAR_RE... |
GColor color);
static void prv_draw_vlines_in_rect(GContext *ctx, 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);
... | (&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (out_metadata, &TINTIN_METADATA, sizeof(FirmwareMetadata)) | ;
return true;
}
static bool prv_version_copy_flash_fw_metadata(FirmwareMetadata *out_metadata, uint32_t flash_address) {
if (out_metadata == NULL) {
return false;
}
FirmwareDescription firmware_description = firmware_storage_read_firmware_description(flash_address);
if (!firmware_storage_check_valid_fi... |
/*
* 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->text_buffer, sizeof(data->text_buffer), "%c: %"PRIi8, 'X' + i,
data->axis_offsets[X_AdjustState + i]) | ;
graphics_draw_text(ctx, data->text_buffer, font,
GRect(bounds->origin.x, bounds->origin.y + 35 + LINE_HEIGHT * i,
pixel_max, pixel_max),
GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL);
}
}
static void prv_display_serial_number(L... |
void* data) {
PebbleTask current_task = pebble_task_get_current();
PBL_ASSERT(current_task == PebbleTask_KernelMain || current_task == PebbleTask_App
|| current_task == PebbleTask_Worker,
"Invalid task: %s", pebble_task_get_name(current_task));
// Handle a lazy client. Time... | {
return NULL;
} | |
80, -288},
{ -320, 600, -296},
{ -392, 776, -416},
{ -480, 880, -472},
{ -560, 1128, -616},
// 41 seconds
{ -256, 992, -528},
{ -568, 1312, -648},
{ -136, 1456, -632},
{ -24, 1136, -552},
{ -104, 896, -512},
{ -120, 808, -464},
{ -120, 640, -360},
{ -128, 480, -272},
... | { -616, 1000, -512},
{ -520, 1056, -576},
{ -712, 1184, -488},
{ -344, 1712, -712},
{ -80, 912, -384},
{ -184, 736, -368},
{ -224, 880, -424},
{ -176, 584, -256},
{ -104, 504, -264},
{ -184, 560, -360},
{ -248, 688, -400},
{ -232, 896, -488},
{ -280, 1144, -672},
... |
{ 24, 1288, -512},
{ 120, 1096, -464},
{ 0, 824, -464},
{ -40, 584, -416},
{ -32, 520, -304},
{ -144, 512, -224},
// 49 seconds
{ -288, 608, -344},
{ -368, 816, -368},
{ -408, 920, -392},
{ -528, 1112, -520},
{ -440, 1224, -600},
{ -536, 1096, -640},
{ -168, 1376... |
led to locate GAP primary service on device ...
#define GATT_SERVICE_CHANGED_INDICATION_DELAY_MS (10000)
#define GATT_SERVICE_CHANGED_INDICATION_MAX_TIMES (5)
static uint32_t s_service_changed_indications_left;
// For unit testing
void gatt_service_changed_server_init(void) {
s_service_changed_indications_left = 0... | (sizeof(BTDeviceInternal)) | ;
*device = conn_hdl->device;
system_task_add_callback(prv_rediscover_kernelbg_cb, device);
}
|
r_is_visible = false;
s_fu_app_data->spinner_should_close = false;
}
}
static void prv_show_spinner(RecoveryFUAppData *data) {
if (!data->spinner_is_visible) {
Window *spinner_window = spinner_ui_window_get(PBL_IF_COLOR_ELSE(GColorRed, GColorDarkGray));
app_window_stack_push(spinner_window, false /* an... | ((Layer *) &data->kino_layer, &kino_area) | ;
kino_layer_set_alignment(&data->kino_layer, GAlignTopLeft);
window_set_background_color(&data->launch_app_window, background);
kino_layer_set_reel(&data->kino_layer, icon_reel, /* take_ownership */ true);
// Configure the url text layer
data->url_text_layer.layer.frame.origin.y = text_y_offset;
text_lay... |
3686400, 5, &GPointZero,
10, -5, true);
}
void test_touch__handle_update_position(void) {
touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0);
touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400);
PebbleEvent event = fake_event_get_last();
cl_as... | GPoint(10, 10) | , 5, 3686400);
TouchEvent *touch_event = touch_event_queue_get_event(0, 0);
prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0,
&GPoint(10, 10), 20, 5, true);
touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420);
touch_event = to... |
/*
* 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->ambient_reading[0]) | |
imelineLayout *pin_timeline_layout = timeline_layer_get_current_layout(&data->timeline_layer);
if (pin_timeline_layout) {
// animation the pin icon
TimelineItemLayer *item_layer = &data->pin_window.item_detail_layer;
timeline_layout_transition_card_to_pin(item_layer->timeline_layout, pin_timeline_layout);... | timeline_model_get_current_state() | , false /* animated */);
}
#if CAPABILITY_HAS_TIMELINE_PEEK
if (!timeline_model_is_empty()) {
timeline_layer_set_sidebar_width(&s_app_data->timeline_layer,
timeline_layer_get_ideal_sidebar_width());
}
#endif
}
static void NOINLINE prv_deinit(void) {
prv_cleanup_timer(&... |
cl_assert_equal_b(false, app_inbox_service_write(AppInboxServiceTagUnitTest,
s_test_data, BUFFER_SIZE + 1)) | ;
cl_assert_equal_b(false, app_inbox_service_end(AppInboxServiceTagUnitTest));
// Begin another one:
cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest,
1, s_writer));
// Expect to return 2, because two messages are being dropped, the f... | |
NO_CLIP, true, 4);
graphics_context_set_fill_color(&ctx, GColorRed);
graphics_context_set_stroke_color(&ctx, GColorGreen);
graphics_draw_arc_internal(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_start, angle_end);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_arc_origin_aa_letter_c_color_4px.8bit.pbi"));
}
... | prv_calc_draw_config_ellipsis(TO_TRIG(90), TO_TRIG(180)) | , ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90),GCornerBottomRight},
.full_quadrants = GCornerBottomRight,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCornerBottomLeft}
}));
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(180), TO_TRIG(270)), ((Ellip... |
the PLL.
// GPIOs are not reset here: resetting them would change their output values,
// which could unintentionally turn of e.g. PMIC power rails.
// The backup domain is not reset; that would be foolish.
const uint32_t ahb1_periphs =
RCC_AHB1Periph_CRC | RCC_AHB1Periph_DMA1 | RCC_AHB1Periph_DMA2
| RC... | boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE) | |
oint(24, 7), 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_no_clip")));
// Even cols of different lengths
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_ROWS);
... | GPoint(65, 15) | , 10);
// T facing down
graphics_draw_vertical_line_dotted(&ctx, GPoint(101, 11), 5);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(96, 16), 10);
// cross - even vert, even horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 32), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(4, 36), 10)... |
/*
* 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... | jerry_get_number_value(js_minutes) | |
nt_weather_type = WeatherType_HeavySnow,
.current_weather_phrase = TEST_WEATHER_DB_SHORT_PHRASE_HEAVY_SNOW,
.tomorrow_high = 2,
.tomorrow_low = 1,
.tomorrow_weather_type = WeatherType_Sun
},
{
.location_name = TEST_WEATHER_DB_LOCATION_RWC,
.is_current_location = true,
.current_temp = 60,... | s_event_info->handler(&insert_event, s_event_info->context) | ;
forecast = weather_service_create_default_forecast();
cl_assert(forecast);
prv_assert_forecast_equal(forecast, &s_forecasts[0]);
weather_service_destroy_default_forecast(forecast);
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | grect_clip(&rect, &ctx->draw_state.clip_box) | ;
// Bail out early if the clipped drawing rectangle is empty
if (grect_is_empty(&rect)) {
goto call_processor_post_function_and_return;
}
// Calculate the offset of src_bitmap to use
const GPoint src_offset = gpoint_sub(rect.origin, unclipped_origin);
// Blit bitmap_to_draw (which might have been cha... |
ZE(field_size);
const uint32_t old_crc = FIELD_CRC_FROM_DATA(data, offset);
const uint32_t new_crc = (calc_crc) ? crc32(CRC32_INIT, SPRF_FIELD_DATA(field), field_data_size)
: SPRF_UNWRITTEN_CRC;
const bool same_data =
(0 == memcmp(SPRF_FIELD_DATA(field), SPRF_FIELD_DATA... | SPRF_MAX_NUM_PAGES_MULT(SPRF_NUM_PAGES) | )) {
prv_erase_region_and_save(&data);
}
}
prv_unlock();
}
void shared_prf_storage_wipe_all(void) {
prv_lock();
prv_invalidate_current_page();
prv_unlock();
}
//!
//! Custom Local Device Name APIs
//!
bool shared_prf_storage_get_local_device_name(char *local_device_name_out, size_t max_size) {
... |
_i(decoded_codepoint, actual_codepoint);
valid_gothic_codepoints_utf8 = utf8_get_next(valid_gothic_codepoints_utf8);
}
}
void test_utf8__emoji_codepoints(void) {
cl_assert(utf8_is_valid_string("\xF0\x9F\x98\x84"));
cl_assert(utf8_is_valid_string("😃"));
}
void test_utf8__copy_single_byte_char(void) {
utf8... | realloc(output_buffer, 19) | ;
trunc_size = utf8_truncate_with_ellipsis("Hello World! \xF0\x9F\x98\x84 11111", output_buffer, 19);
cl_assert_equal_s(output_buffer, "Hello World! \xe2\x80\xa6");
cl_assert_equal_i(trunc_size, 17);
// test that we access unallocated memory if the output buffer is too small
output_buffer = realloc(output_bu... |
so let's move along to the next one.
while ((*state->position != delimiter) && (*state->position != '\0')) {
prv_handle_escape_character(state);
if (state->error->status != TemplateStringErrorStatus_Success) {
return;
}
state->position++;
}
if (*state->position == '\0') {
state->error->s... | {
if (state->filters_complete) {
state->error->status = TemplateStringErrorStatus_FormatBeforeLast;
return;
}
// Find the filter's opening paren
const char *filter_name_paren = strchr(state->position, '(');
if (!filter_name_paren) {
state->error->status = TemplateStringErrorStatus_... | |
le (true) {
psleep(100);
}
}
static void stuck_system_task_callback(void *data) {
PBL_LOG(LOG_LEVEL_DEBUG, "Entering infinite loop in system task callback");
while (true) {
psleep(100);
}
}
// ================================================================================
// We install this ISR which... | if (index == 6) {
PBL_LOG(LOG_LEVEL_INFO, "Forcing bus fault during core dump");
core_dump_test_force_bus_fault();
core_dump_reset(false /* don't force overwrite */);
} else if (index == 7) {
PBL_LOG(LOG_LEVEL_INFO, "Forcing inf loop during core dump");
core_dump_test_force_inf_loop();
core... |
system_task_add_callback(stuck_system_task_callback, NULL);
} else if (index == 12) {
PBL_LOG(LOG_LEVEL_INFO, "Generate hard-fault");
// Modify behavior of the ARM so that bus faults generate a hard fault
SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
// Write to protected memory
extern uint32_... |
/*
* 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... | ARRAY_LENGTH(s_receive_buffers) | |
gs/dialog.h"
#include "applib/ui/dialogs/expandable_dialog.h"
#include "applib/ui/dialogs/simple_dialog.h"
#include "applib/ui/ui.h"
#include "applib/ui/window.h"
#include "applib/ui/window_manager.h"
#include "applib/ui/window_stack.h"
#include "apps/system_apps/timeline/peek_layer.h"
#include "kernel/event_loop.h"
#i... | if (!s_in_use) {
return;
} |
NotificationWindowData *data = &s_notification_window_data;
if (!data->dnd_icon_visible) {
return;
}
graphics_context_set_tint_color(ctx, status_bar_layer_get_foreground_color(&data->status_layer));
graphics_context_set_compositing_mode(ctx, GCompOpTint);
graphics_draw_bitmap_in_rect(ctx, &data->dnd_... |
stack is initialized, make sure there is no code
// that tries to use the BT stack in this path.
s_db_mutex = mutex_create();
prv_load_data_from_prf();
// Load cached capability bits from flash
prv_load_cached_system_capabilities(&s_cached_system_capabilities);
}
static void prv_delete_all_pairings_itr(Se... | PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)&data, sizeof(*data)) | ;
}
}
static bool prv_dump_bt_persistent_storage_contents(
SettingsFile *file, SettingsRecordInfo *info, void *context) {
if (info->key_len == 0 || info->val_len == 0) {
prompt_send_response("key or val of 0 length");
return true;
}
char *display_buf = kernel_malloc_check(DISPLAY_BUF_LEN);
// g... |
mpling when we start up
cl_assert_equal_i(s_hrm_manager_update_interval, 1);
// The last update time should be 0
int32_t last_update_utc;
activity_get_metric(ActivityMetricHeartRateRawUpdatedTimeUTC, 1, &last_update_utc);
cl_assert_equal_i(last_update_utc, 0);
// Simulate callbacks one second away from tu... | activity_get_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, &last_update_utc) | |
(num_fmt_conversions - num_strings) * sizeof(uint32_t);
unsigned str1_len = 0;
unsigned str2_len = 0;
// Now, count the string size, if necessary
if (num_strings) {
va_list args;
va_start(args, packed_loghash);
for (unsigned index = 0; index < num_fmt_conversions; ++index) {
const ... | prv_log_to_buffer((uint8_t *)msg_buffer, length) | ;
}
#else // PBL_LOGS_HASHED
static char prv_get_log_level_char(uint8_t log_level) {
switch (log_level) {
case LOG_LEVEL_ALWAYS: return 'A';
case LOG_LEVEL_ERROR: return 'E';
case LOG_LEVEL_WARNING: return 'W';
case LOG_LEVEL_INFO: return 'I';
case LOG_LEVEL_DEBUG: return 'D';
case LOG_LEVEL... |
icense, 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 distribut... | {
PebblePairingServiceConnectivityStatus status = {};
prv_get_connectivity_status(conn_idx, &status);
memcpy(response_buf, &status, sizeof(status));
return sizeof(status);
} |
static uint8_t prv_handle_gatt_mtu_read(uint16_t conn_idx,
uint8_t response_buffer[READ_RESPONSE_BUFFER_SIZE]) {
uint16_t mtu = ATT_DEFAULT_MTU;
ble_error_t e = ble_gattc_get_mtu(conn_idx, &mtu);
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gattc_get_mtu: %... |
ady in progress");
return;
}
// If we're not on iOS9+, we need to be connected to the mobile app since it tells us when
// the phone has stopped ringing
if ((event->source != PhoneCallSource_ANCS) && !s_mobile_app_is_connected) {
PBL_LOG(LOG_LEVEL_INFO, "Ignoring incoming call. Mobile app is not connec... | (LOG_LEVEL_INFO, "PebblePhoneEvent: %d, Call in progress: %s, Connected: %s",
event.type, s_call_in_progress ? "T": "F", s_mobile_app_is_connected ? "T": "F") | ;
}
switch (event.type) {
case PhoneEventType_Incoming:
prv_handle_incoming_call(&event);
break;
case PhoneEventType_Outgoing:
prv_handle_outgoing_call(&event);
break;
case PhoneEventType_Missed:
prv_handle_missed_call(&event);
break;
case PhoneEventType_Ring:
... |
s undefined
// and functions) do not produce a String. Instead they produce the undefined value.
return rocky_error_unexpected_type(0, "JSON.stringify()-able object");
}
const uint32_t str_size = jerry_get_utf8_string_size(json_string) + 1 /* trailing zero */;
char *const data_buffer = task_zalloc(str_si... | (ROCKY_EVENT_DISCONNECTED, event_name) | == 0) {
call_handler = !is_connected;
} else {
return false;
}
if (call_handler) {
prv_call_handler_when_registering(event_name, handler);
}
return true;
}
static bool prv_add_handler(const char *event_name, jerry_value_t handler) {
if (strcmp(ROCKY_EVENT_MESSAGE, event_name) == 0 || strcmp(... |
backs for worker closing");
s_install_callback_data.callback_paused_for_worker = true;
s_pending_worker_deletion = cur_worker_id;
worker_manager_handle_remove_current_worker();
}
if (s_install_callback_data.callback_paused_for_app ||
s_install_callback_data.callback_pause... | {
app_install_launcher_task_callback(NULL);
} | |
e_init(VALID_OBJECT_SIZE, ObjectRecovery);
assert_ack_count(0);
assert_nack_count(1);
}
void test_put_bytes__init_sys_resources_object_while_not_in_fw_update_mode(void) {
s_firmware_update_is_in_progress = false;
prv_receive_init(VALID_OBJECT_SIZE, ObjectSysResources);
assert_ack_count(0);
assert_nack_coun... | prv_receive_init_fw_object() | ;
prv_process_and_reset_test_counters();
size_t chunk_size = 1024 * 1024;
uint8_t *chunk = kernel_malloc(chunk_size);
prv_receive_put(s_last_response_cookie, chunk, chunk_size);
kernel_free(chunk);
assert_ack_count(0);
assert_nack_count(1);
}
void test_put_bytes__app_cancelled_before_chunk_got_processe... |
/*
* 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 layout->impl->color_getter(layout);
} |
#endif
return &s_default_colors;
}
const LayoutColors *layout_get_notification_colors(const LayoutLayer *layout) {
return PBL_IF_COLOR_ELSE(layout_get_colors(layout), &s_default_notification_colors);
}
void layout_set_mode(LayoutLayer *layout, LayoutLayerMode final_mode) {
layout->impl->mode_setter(layout, fin... |
us_idx);
}
} else {
// Timeout, abort transfer
abort_transfer(bus);
break;
PBL_LOG(LOG_LEVEL_ERROR, "Transfer timed out on bus %" PRId8, bus_idx);
}
} while (bus->transfer.state != TRANSFER_STATE_INVALID);
// Return semaphore token so another transfer can be started
semapho... | if (bus->transfer.read_not_write) {
bus->transfer.state = TRANSFER_STATE_REPEAT_START;
} else {
// Enable TXE interrupt for writing
bus->i2c->CR2 |= I2C_CR2_ITBUFEN;
bus->transfer.state = TRANSFER_STATE_WRITE_DATA;
} |
break;
case TRANSFER_STATE_REPEAT_START:
// Generate a repeat start
bus->i2c->CR1 |= I2C_CR1_START;
bus->transfer.state = TRANSFER_STATE_WRITE_ADDRESS_RX;
break;
case TRANSFER_STATE_WRITE_ADDRESS_RX:
// Write the I2C device address again, but this time in read mode.
... |
584, -32},
{ -920, 440, -144},
{ -960, 648, -320},
{ -824, 544, -392},
{ -248, 224, -40},
{ -144, 320, -248},
{ -248, 440, -96},
{ -472, 744, -272},
{ -664, 616, -112},
{ -728, 896, -304},
{ -976, 760, -176},
{ -1048, 680, -48},
{ -1552, 1184, -368},
{ -1432, 1016, -... | { -416, 928, 232},
{ -104, 800, 104},
{ 24, 288, 336},
{ 16, 632, 232},
{ 24, 608, 296},
// 13 seconds
{ -56, 728, 424},
{ -136, 920, 376},
{ -416, 1040, 376},
{ -472, 1048, 296},
{ -808, 1224, 496},
{ -640, 1208, 160},
{ -680, 1040, 104},
{ -480, 768, 136},
{... |
{ -208, 1240, -208},
{ -368, 904, 160},
{ -408, 1088, 592},
{ -408, 1368, 432},
{ -592, 1440, 360},
{ -576, 840, 376},
{ -568, 928, 304},
{ -392, 592, 408},
{ -208, 672, -8},
{ -96, 512, 88},
{ -72, 496, 80},
{ -208, 744, 128},
{ -312, 856, 136},
// 16 seconds
... |
{ 1304, 32, -272},
{ 1848, 112, -248},
{ 1512, 200, -336},
// 117 seconds
{ 848, 208, -256},
{ 632, 96, -192},
{ 1112, 120, -112},
{ 1472, 120, -16},
{ 1248, 40, 24},
{ 1136, 32, -8},
{ 1072, 72, -16},
{ 1000, 64, -32},
{ 960, 96, -80},
{ 984, 96, -144},
{ 984... | { 1192, 0, -288},
{ 920, -24, -344},
{ 840, -16, -432},
{ 960, -40, -408},
{ 1016, -112, -368},
{ 1024, -112, -352},
{ 1008, -88, -352},
{ 984, -72, -320},
{ 1000, -48, -304},
{ 1048, -40, -248},
{ 1144, -16, -160},
{ 1256, -48, -72},
{ 1264, -48, -40},
{ 1144, -3... |
{ 984, -96, -16},
{ 944, -120, -32},
{ 904, -104, -56},
{ 888, -120, -64},
{ 912, -144, -96},
{ 952, -144, -112},
{ 1008, -136, -128},
{ 1080, -128, -160},
{ 1432, -176, -64},
{ 1720, -160, -120},
{ 1192, -120, -176},
{ 856, -104, -272},
{ 672, -56, -272},
{ 1000... |
== sizeof(uint16_t));
cl_assert(tuple->value->uint16 == 16);
uint16_found = true;
break;
case SOME_UINT32_KEY:
cl_assert(tuple->length == sizeof(uint32_t));
cl_assert(tuple->value->uint32 == 32);
uint32_found = true;
break;
case SOME_INT8_KEY:
... | (SOME_DATA_KEY, SOME_DATA, sizeof(SOME_DATA)) | , // unchanged value
TupletCString(SOME_STRING_KEY, SOME_STRING),
};
Tuplet source_tuplets[] = {
TupletCString(SOME_STRING_KEY, NEW_STRING),
TupletInteger(SOME_INT8_KEY, (int8_t) -3),
};
for (int i = 0; i < 3; ++i) {
is_int8_updated = false;
is_string_updated = false;
is_data_updated = ... |
/*
* 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... | kino_reel_create_with_resource(RESOURCE_ID_WORKOUT_APP_WORKOUT) | |
eturn substream.bytes_written + MLOG_MAX_VARINT_ENCODED_SIZE;
}
ProtobufLogRef protobuf_log_create(ProtobufLogConfig *config,
ProtobufLogTransportCB transport,
size_t max_msg_size) {
// Error check the passed in max encoded message size
PBL_ASS... | if (!success) {
PBL_LOG(LOG_LEVEL_ERROR, "Error adding sample, resetting session");
return prv_session_encode_start(session);
} | |
bool prv_can_transition_state(ANCSClientState new_state) {
if (s_ancs_client->state == new_state) {
return true;
}
switch (s_ancs_client->state) {
case ANCSClientStateIdle:
return (new_state == ANCSClientStateRequestedNotification ||
new_state == ANCSClientStateRetrying ||
... | prv_notif_queue_push_common(node) | |
/*
* 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... | dbgserial_putstr("No FPGA bitstream in flash.") | ;
}
dbgserial_putstr("Falling back to NVCM.");
return prv_reset_into_nvcm();
}
static void prv_start_command(uint8_t cmd) {
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET);
delay_us(100);
display_write_byte(cmd);
}
static void prv_send_command_arg(uint8_t arg) {
display_write_byte(arg);
}
static void... |
cl_assert(menu_layer_get_center_focused(&l) == true);
cl_assert_equal_i(2 * NORMAL, l.selection.y);
cl_assert_equal_i(NORMAL - FOCUSED, scroll_layer_get_content_offset(&l.scroll_layer).y);
cl_assert_equal_i(FOCUSED, l.selection.h);
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionUp]);
cl_... | menu_cell_basic_cell_height() | ;
const int initial_scroll_offset = (DISP_ROWS - basic_cell_height) / 2;
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section);
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row);
cl_assert_equal_i(0, l.selection.y);
cl_assert_equal_i(initial_scroll_offset, l.scroll_layer.content_sublayer.b... |
"
#include "storage.h"
#include <inttypes.h>
#include <string.h>
// Hack Alert
//
// There are some really sad Android phones/versions out there where publishing an Gatt Server does
// not work. To workaround this issue, we need to switch to using the watch as the PPoGATT Server
// and the phone as the PPoGATT client... | (state->pending_response_data) | ;
}
kernel_free(state);
}
static bool prv_is_emulated_server_wa_requested(uint16_t conn_idx) {
bool enabled = false;
storage_acquire();
device_t *dev = find_device_by_conn_idx(conn_idx);
if (dev) {
// Only enable the work-around if the bit is present in the bonding list, in other words, it
// had b... |
al_precise.center = center,
.fill_radial_precise.radius_inner = radius_inner,
.fill_radial_precise.radius_outer = radius_outer,
.fill_radial_precise.angle_start = angle_start,
.fill_radial_precise.angle_end = angle_end,
};
}
void graphics_fill_round_rect_by_value(GContext *ctx, GRect rect, uint16_t ... | (0, s_fonts_get_system_font.call_count) | |
char * const region_names_buffer = app_zalloc_check(region_count * TIMEZONE_NAME_LENGTH);
char *cursor = region_names_buffer;
char *last_cursor = cursor;
const char **continent_names = app_zalloc_check(NUM_CONTINENTS * sizeof(char *));
const char **region_names = app_zalloc_check(region_count * sizeof(char *... | clock_set_manual_timezone_source(!clock_timezone_source_is_manual()) | ;
if (!clock_timezone_source_is_manual()) {
clock_set_timezone_by_region_id(shell_prefs_get_automatic_timezone_id());
}
}
// Date & Time Menu
////////////////////////////
static void prv_select_click_cb(SettingsCallbacks *context, uint16_t row) {
SettingsTimeData *data = (SettingsTimeData*) context;
switc... |
nup(void) {
weather_shared_data_cleanup();
}
// Tests
////////////////////////////////////////////////////////////////
static void prv_db_iterator_cb(WeatherDBKey *key, WeatherDBEntry *entry, void *unused) {
weather_shared_data_assert_entries_equal(key, entry,
weather_shared_data_get_entry(weather_shared_dat... | cl_assert(weather_shared_data_get_key_exists(&keys[x])) | |
See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "simple_menu_layer.h"
#include "applib/legacy2/ui/menu_layer_legacy2.h"
#include "applib/applib_malloc.auto.h"
#include "process_management/process_manager.h"
static int16_t get_header_height(struct Men... | MenuIndex(simple_menu->menu.selection.index.section, index) | ;
menu_layer_set_selected_index(&simple_menu->menu, menu_index, MenuRowAlignCenter, animated);
}
MenuLayer *simple_menu_layer_get_menu_layer(SimpleMenuLayer *simple_menu) {
return &simple_menu->menu;
}
|
ince
// we don't account for the time it takes for the request to change the
// time to propagate to the watch). Thus only update our alarm time if
// the timezone has changed or a 'substantial' time has passed, or DST
// state has changed.
if (set_time_info->gmt_offset_delta != 0 ||
... | process_manager_launch_process(&(ProcessLaunchConfig) {
.id = worker_manager_get_default_install_id(),
.worker = true,
}) | ;
}
#endif
notify_system_ready_for_communication();
serial_console_enable_prompt();
}
void launcher_main_loop(void) {
PBL_LOG(LOG_LEVEL_ALWAYS, "Starting Launcher");
prv_launcher_main_loop_init();
while (1) {
task_watchdog_bit_set(PebbleTask_KernelMain);
// We make this PebbleEvent static to sa... |
all watchdog, this isn't iOS 8: %d",
s_call_source);
}
}
static void prv_cancel_call_watchdog(void) {
new_timer_stop(s_call_watchdog);
pp_get_phone_state_set_enabled(false);
}
static bool prv_can_answer(void) {
// We can't answer calls with Android
return prv_call_is_ancs();
}
static bool prv_s... | analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_END_COUNT, AnalyticsClient_System) | ;
}
if (s_call_in_progress) {
prv_call_end_common();
phone_ui_handle_call_end(false /*call accepted*/, disconnected);
} else if (!disconnected) {
PBL_LOG(LOG_LEVEL_INFO, "Ignoring end call. A call is not in progress");
}
}
static void prv_handle_caller_id(PebblePhoneEvent *event) {
if (s_call_in... |
ile 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 OF... | (input_config->gpio) | ;
return bit != 0;
}
void gpio_analog_init(const InputConfig *input_config) {
GPIO_InitTypeDef gpio_init = {
.GPIO_Pin = input_config->gpio_pin,
.GPIO_Mode = GPIO_Mode_AN,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_PuPd = GPIO_PuPd_NOPULL
};
prv_init_common(input_config, &gpio_init);
}
|
-176, 528, -264},
{ -288, 552, -280},
{ -376, 728, -320},
{ -376, 848, -360},
{ -576, 976, -376},
{ -472, 1256, -408},
{ -488, 1216, -464},
{ -352, 1808, -336},
{ 32, 1256, -312},
// 18 seconds
{ -168, 936, -224},
{ -112, 976, -264},
{ -56, 688, -200},
{ -96, 440, -2... | // 23 seconds
{ -104, 752, -344},
{ -80, 520, -280},
{ -128, 448, -376},
{ -248, 608, -400},
{ -256, 960, -512},
{ -144, 1136, -632},
{ -200, 1008, -704},
{ -200, 1008, -648},
{ -376, 936, -704},
{ -192, 1432, -776},
{ 280, 1128, -560},
{ 8, 800, -400},
{ -32, 888... |
{ -144, 488, -280},
{ -288, 528, -256},
{ -448, 648, -256},
{ -544, 832, -352},
{ -520, 904, -464},
{ -528, 1088, -568},
{ -304, 1152, -608},
{ -408, 1456, -760},
{ 24, 1272, -608},
{ 0, 784, -448},
{ -32, 800, -400},
// 26 seconds
{ 0, 688, -328},
{ -40, 552, -3... |
_file_name);
}
static bool prv_is_in_list(AppInstallId id, const AppInstallId list[], uint8_t len) {
for (unsigned int i = 0; i < len; i++) {
if (list[i] == id) {
return true;
}
}
return false;
}
//////////////////////
// Settings Helpers
//////////////////////
//! Settings iterator function that... | settings_file_each(&file, prv_each_free_up_space, &evict_data) | ;
settings_file_close(&file);
// remove all nodes found
EvictListNode *node = evict_data.list;
while (node) {
EvictListNode *temp = node;
PBL_LOG(LOG_LEVEL_DEBUG, "Deleting application binaries for app id: %"PRIu32", size: %"PRIu32,
node->id, node->size);
app_cache_remove_en... |
st_for_each_session(prv_accumulate_size_cb, &size);
PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Total used space: %d", (int)size);
return size;
}
// ----------------------------------------------------------------------------------------
// Compact all storage files. Used to free up space for new data.
s... | if (status != S_SUCCESS) {
PBL_LOG(LOG_LEVEL_ERROR, "Error %d closing file for session %d", (int)status,
session->comm.session_id);
} |
session->storage.fd = DLS_INVALID_FILE;
}
// -----------------------------------------------------------------------------------------
// Open the session file, creating it if necessary. If space_needed is > 0, then make sure there is
// enough space in the file to add 'space_needed' more bytes, compacting, growin... |
CommSession *session = (CommSession *) sb;
cl_assert(session);
cl_assert(session->temp_write_buffer);
cl_assert(length + session->bytes_written <= session->max_out_payload_length);
memcpy(session->temp_write_buffer + session->bytes_written, data, length);
session->bytes_written += length;
return true;
}... | (pp_header.endpoint_id, buffer, pp_header.length) | ;
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Sending Data to PP endpoint %u (0x%x):",
pp_header.endpoint_id, pp_header.endpoint_id);
PBL_HEXDUMP(LOG_LEVEL_DEBUG, buffer, pp_header.length);
DataNode *data_node = kernel_malloc(sizeof(DataNode) + pp_header.length);
list_init(&data_node->... |
ULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,
s_feb_5_midnight + 11 * 60 * 60), 0);
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.heade... | uuid_equal(&state.pin.header.id, &s_items[4].header.id) | );
// check third
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id));
// check second again
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(i... |
of %"PRIu8, s_activity_reward_state.active_minutes,
s_activity_reward_settings.reward.activity.trigger_active_minutes);
return;
}
// All criteria have been met, show reward
prv_push_reward(now_utc, &ACTIVITY_REWARD_NOTIF_CONFIG);
}
// -------------------------------------------------... | if (config->response.enabled) {
actions[num_actions++] = (TimelineItemAction) {
.id = config->response.type,
.type = TimelineItemActionTypeInsightResponse,
.attr_list = response_action_attr_list,
};
} | |
{
prv_issue_command(sector_base_addr, S29VSCommand_ReadStatusRegister);
return flash_s29vs_read_short(sector_base_addr);
} |
static uint8_t prv_poll_for_ready(FlashAddress sector_base_addr) {
// TODO: We should probably just assert if this takes too long
uint8_t status;
while (((status = prv_read_status_register(sector_base_addr)) &
S29VSStatusBit_DeviceReady) == 0) {
delay_us(10);
}
return (status);
}
//! Issue th... | |
b(fake_gatt_is_service_discovery_running(), true);
// BP service was discovered
fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID);
// start another job, should be pended
gatt_client_discovery_discover_range(connection, &range);
fake_gatt_put_discovery_complete_event(GATT_SERVI... | (uuid_equal(&characteristic_one->uuid, &expected_characteristic1->uuid), true) | ;
// Second characteristic is tacked right after the first one:
const GATTCharacteristic *characteristic_two =
(const GATTCharacteristic *) &characteristic_one->descriptors[1];
const Characteristic *expected_characteristic2 = &bp_service->characteristics[1];
cl_assert_equal_i(characteristic_t... |
it();
app_db_flush();
app_cache_init();
app_cache_flush();
tictoc_id = app_install_get_id_for_uuid(&tictoc_uuid);
music_id = app_install_get_id_for_uuid(&music_uuid);
sports_id = app_install_get_id_for_uuid(&sports_uuid);
cl_assert_equal_i(-69, tictoc_id);
cl_assert_equal_i(-3, music_id);
cl_assert... | app_install_entries_equal(&id_entry, &uuid_entry) | );
}
void test_app_install_manager__is_watchface_via_install_id(void) {
cl_assert_equal_b(true, app_install_is_watchface(tictoc_id));
cl_assert_equal_b(false, app_install_is_watchface(music_id));
cl_assert_equal_b(false, app_install_is_watchface(sports_id));
cl_assert_equal_b(false, app_install_is_watchface(b... |
d_space_for_strings += prv_max_ellipsified_cstring_size(negative_action);
required_space_for_strings += prv_max_ellipsified_cstring_size(app_id);
if (prv_should_add_sender_attr(app_id, title)) {
required_space_for_strings += prv_max_ellipsified_cstring_size(title);
}
int num_pebble_actions = 0;
if (noti... | attribute_list_destroy_list(&dismiss->attr_list) | ;
timeline_item_free_allocated_buffer(item);
*item = *new_item;
new_item->allocated_buffer = NULL;
timeline_item_destroy(new_item);
}
}
|
scriber_state_from_ref(HRM_INVALID_SESSION_REF) == NULL);
cl_assert(prv_get_subscriber_state_from_app_id(PebbleTask_App, INSTALL_ID_INVALID) == NULL);
// Unsubscribe, HRM should be disabled after
for (int i = 0; i < num_refs; ++i) {
sys_hrm_manager_unsubscribe(session_refs[i]);
cl_assert(prv_get_subscrib... | cl_assert_equal_i(prv_num_system_task_events_queued(), 1) | ;
// Make sure we successfully consume the event
fake_system_task_callbacks_invoke_pending();
// Make sure we got the expected data
cl_assert_equal_i(s_num_cb_events_1, 1);
cl_assert_equal_i(s_cb_events_1[0].event_type, HRMEvent_BPM);
cl_assert_equal_i(s_cb_events_1[0].bpm.bpm, s_hrm_event_data.hrm_bpm);
... |
_rate_metric(metric) && !sys_activity_prefs_heart_rate_is_enabled()) {
return NULL;
}
HealthServiceState *state = prv_get_state(true);
if (!state->cache) {
return NULL;
}
switch (metric) {
case HealthMetricHeartRateBPM:
// If already registered, it's an error since we only have room for on... | (num_records, needed_partial_minutes) | |
if (bt_driver_supports_bt_classic()) {
bt_driver_classic_update_connectability();
}
bt_persistent_storage_set_cached_system_capabilities(NULL);
}
}
bool bt_persistent_storage_get_active_gateway(BTBondingID *bonding_out,
BtPersistBondingType *type_out) {
B... | {
// If we were passed a null pointer, we'll just clear the cached capability bits
if (capabilities) {
diff.flags = s_cached_system_capabilities.flags ^ capabilities->flags;
s_cached_system_capabilities = *capabilities;
} else {
diff.flags = s_cached_system_capabilities.flags;
s_cach... |
prv_unlock();
// Only update the cache if the capability flags changed
if (diff.flags) {
prv_file_set(&SYSTEM_CAPABILITIES_KEY, sizeof(SYSTEM_CAPABILITIES_KEY),
capabilities, sizeof(PebbleProtocolCapabilities));
PebbleEvent event = {
.type = PEBBLE_CAPABILITIES_CHANGED_EVENT,
... |
lose(fd);
return;
reset_storage:
mutex_unlock_recursive(s_notif_storage_mutex);
notification_storage_reset_and_init();
}
// Finds the next match in the notification storage file from the current position
// Position in file will be at the start of notification payload if return value is true
static bool prv_fin... | prv_file_close(fd) | ;
return rv;
}
//! @return is_advanced
static bool prv_iter_next(NotificationIterState *iter_state) {
int result = pfs_read(iter_state->fd, (uint8_t *)&iter_state->header, sizeof(iter_state->header));
// Restore flags & status
iter_state->header.common.flags = ~iter_state->header.common.flags;
iter_state-... |
DR_ACCEL_SAMPLE_IDX (0x14)
#define ADDR_ACCEL_X_MSB (0x15)
#define ADDR_ACCEL_Y_MSB (0x17)
#define ADDR_ACCEL_Z_MSB (0x19)
#define ADDR_PPG_IDX (0x1b)
#define ADDR_PPG_MSB (0x1c)
#define ADDR_PPG_LSB (0x1d)
#define ADDR_TIA_MSB (0x1e)
#define ADDR_TIA_LSB (0x1f)
#define ADDR_PRES_DETECT_THRSH (0x26)
#define ADDR_LED... | (dev->i2c_slave) | ;
return rv;
}
static bool prv_read_register(HRMDevice *dev, uint8_t register_address, uint8_t *value) {
i2c_use(dev->i2c_slave);
bool rv = i2c_read_register(dev->i2c_slave, register_address, value);
i2c_release(dev->i2c_slave);
return rv;
}
static bool prv_read_register_block(HRMDevice *dev, uint8_t regist... |
launcher_app_glance_structured_get_data(structured_glance);
PBL_ASSERTN(settings_glance);
// Battery text (if not plugged in), battery icon, and (if plugged in) a lightning bolt icon
const size_t max_horizontal_nodes = 3;
GTextNodeHorizontal *horizontal_container_node =
graphics_text_node_create_horiz... | alerts_get_mask() | == AlertMaskPhoneCalls);
}
static uint32_t prv_get_resource_id_for_connectivity_status(
LauncherAppGlanceSettings *settings_glance) {
#if CAPABILITY_HAS_BUILTIN_HRM
if (settings_glance->glance_state.is_sharing_hrm) {
return RESOURCE_ID_CONNECTIVITY_SHARING_HRM;
}
#endif
if (settings_glance->glance_state... |
OT_BIT_RESET_LOOP_DETECT_TWO);
break;
case 3:
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE);
break;
case 4:
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE);
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO);
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_THREE);
break;
case 5:
boot_bit_set(BOO... | {
// We just woke up from standby. For some reason this leaves the system in a funny state,
// so clear the flag and reboot again to really clear things up.
PWR_ClearFlag(PWR_FLAG_SB);
dbgserial_putstr("exit standby");
system_hard_reset();
} |
periph_config_disable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_PWR);
}
void boot_main(void) {
check_and_handle_resuming_from_standby();
dbgserial_init();
dbgserial_putstr("");
dbgserial_putstr(" ____ __");
dbgserial_putstr("/\\ _`\\ /'__`\\");
dbgserial_putstr("\\ \\,\\L\\_\\ ... |
playCalibrationState_Confirm:
break;
}
}
static void prv_layer_update_proc(Layer *layer, GContext *ctx) {
DisplayCalibrationData *data = window_get_user_data(layer_get_window(layer));
ctx->draw_state.drawing_box.origin.x += data->offset.x;
ctx->draw_state.drawing_box.origin.y += data->offset.y;
prv_d... | (window, GColorBlack) | ;
Layer *root_layer = window_get_root_layer(window);
Layer *layer = &data->layer;
layer_init(layer, &root_layer->bounds);
layer_set_update_proc(layer, prv_layer_update_proc);
layer_add_child(root_layer, layer);
prv_init_arrow_bitmap(&data->arrow_down, RESOURCE_ID_ARROW_DOWN);
prv_init_arrow_bitmap(&data... |
/*
* 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... | {
new_attr_list.attributes[i] = app_notif_prefs->attr_list.attributes[i];
} |
}
// The app name should be the display name
// If there is no display name (Apple Pay) then fallback to the title
const ANCSAttribute *app_name_attr = NULL;
if (display_name && display_name->length > 0) {
app_name_attr = display_name;
} else if (title && title->length > 0) {
app_name_attr = title... |
activity_test_reset(true /*reset_settings*/, true /*tracking_on*/, NULL, NULL);
// Change into awake state and capture the sleep before
// Walk long enough to overlap with a periodic sleep recomputation
prv_feed_steps_min(ACTIVITY_SESSION_UPDATE_MIN + 1);
int32_t before_total, before_deep;
activity_get_me... | prv_feed_light_sleep_min(10) | ;
// Restore time to just after we started sleeping before
rtc_set_time(start_sleep_time + 5 * SECONDS_PER_MINUTE);
// Sleep a little more, should not crash
prv_feed_steps_min(90);
prv_feed_steps_min(20); // wake up
// Make sure we registered sleep
int32_t value;
activity_get_metric(ActivityMetricS... |
ics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20);
graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21);
graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22);
graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX... | (&ctx, GPoint(10, 90), 10) | ;
graphics_draw_horizontal_line_dotted(&ctx, GPoint(10, 96), 5);
// T facing right - even vert, even horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 90), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(46, 95), 5);
// T facing right - odd vert, odd horiz
graphics_draw_vertical_line_dotted... |
, -864},
{ -176, 240, -944},
{ -168, 320, -928},
{ -184, 248, -992},
{ -176, 448, -1008},
{ -160, 208, -1104},
{ -256, 520, -928},
{ -168, 400, -936},
{ -112, 392, -952},
{ -184, 424, -1016},
{ -240, 320, -1024},
{ -184, 368, -976},
{ -232, 376, -1000},
{ -248, 344, -... | { -240, 384, -984},
{ -232, 416, -864},
{ -208, 440, -1040},
{ -272, 376, -744},
{ -160, 376, -888},
{ -192, 312, -872},
{ -208, 360, -896},
{ -168, 400, -896},
{ -160, 280, -960},
{ -120, 368, -984},
{ -136, 264, -1072},
{ -136, 352, -1032},
{ -136, 336, -1120},
... |
{ -160, 328, -976},
// 241 seconds
{ -120, 320, -872},
{ -104, 416, -936},
{ -152, 320, -904},
{ -216, 424, -992},
{ -256, 408, -1096},
{ -248, 376, -864},
{ -264, 376, -968},
{ -240, 320, -912},
{ -248, 440, -1032},
{ -240, 312, -912},
{ -184, 528, -1152},
{ -20... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.