prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
/*
* 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 (charge.is_plugged) {
if (charge.is_charging) {
status_led_set(StatusLedState_Charging);
} else {
status_led_set(StatusLedState_FullyCharged);
}
} else {
status_led_set(StatusLedState_Off);
} |
data->was_plugged = charge.is_plugged;
data->last_dialog_state = next_dialog_state;
}
static void prv_handle_init(void) {
struct AppData *data = app_malloc_check(sizeof(struct AppData));
*data = (struct AppData){};
app_state_set_user_data(data);
data->dialog = simple_dialog_create(WINDOW_NAME("Shutdown ... |
t uint8_t *bitmap, unsigned x_offset, unsigned y_offset,
unsigned width, unsigned height,
uint8_t buffer[DISP_ROWS][DISP_LINE_BYTES]) {
// Need to convert offsets to bytes for the horizontal dimensions
x_offset = prv_round_to_byte(x_offset);
width = prv_roun... | {
for (unsigned x = 0; x < num_pixels; x++) {
// Add 1 to offsets so we don't write into outer box
prv_set_bit(x + x_offset + 1, y_offset + y + 1, buffer);
}
} |
prv_display_buffer(buffer);
}
void display_init(void) {
prv_enable_display_spi_clock();
prv_display_start();
prv_disable_display_spi_clock();
}
|
ActionResultTypeSuccess);
}
void timeline_enable_ancs_bulk_action_mode(bool enable) {
s_bulk_action_mode = enable;
}
bool timeline_is_bulk_ancs_action_mode_enabled(void) {
return s_bulk_action_mode;
}
typedef struct OpenAppContext {
EventServiceInfo event_info;
AppInstallId install_id;
} ... | timeline_get_private_data_source((Uuid *)&item->header.parent_id) | )) {
prv_dismiss_local_notification_action(item);
return;
}
// FALLTHROUGH
case TimelineItemActionTypeGeneric:
case TimelineItemActionTypeResponse:
case TimelineItemActionTypeAncsResponse:
case TimelineItemActionTypeAncsGeneric:
case TimelineItemActionTypeHttp:
case ... |
advert_term.max_interval_slots = 32;
job = gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm),
unscheduled_callback, s_unscheduled_cb_data, 0);
cl_assert_equal_p(job, NULL);
// Loop-around in the first term:
advert_term.min_interval_sl... | (gap_le_is_advertising_enabled(), false) | ;
// Trigger the advertising to start up again. Since we still have an advertisement job set,
// it should continue.
regular_timer_fire_seconds(1);
cl_assert_equal_b(gap_le_is_advertising_enabled(), true);
free(ad);
}
void test_gap_le_advert__unschedule_job_types(void) {
BLEAdData *ad = create_ad(NULL, N... |
/*
* 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... | {
gmtime_tm = worker_state_get_gmtime_tm();
} |
sys_gmtime_r(timep, gmtime_tm);
return gmtime_tm;
}
struct tm *pbl_override_localtime(const time_t *timep) {
struct tm *localtime_tm = NULL;
char *localtime_zone = NULL;
if (pebble_task_get_current() == PebbleTask_App) {
localtime_tm = app_state_get_localtime_tm();
localtime_zone = app_state_get_l... |
/*
* 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... | hci_rom_passthrough_send_cmd(
HCI_OP2OGF(opcode), HCI_OP2OCF(opcode), &hci_cmd->param[0],
hci_cmd->param_length) | ;
}
void hc_endpoint_enqueue_hci_evt(const uint8_t *hci_evt, uint8_t payload_len) {
uint8_t hc_message_len = sizeof(HcProtocolMessage) + 1 /* for HCI_EVT_MSG */ + payload_len;
uint8_t hc_protocol_message[hc_message_len];
HcProtocolMessage *hc_msg = (HcProtocolMessage *)&hc_protocol_message[0];
memset(hc_msg, ... |
ctionParams s_le_conn_params = { 0 };
void bluetooth_analytics_get_param_averages(uint16_t *params) {
int num_samps = s_le_conn_params.num_samps;
if (num_samps != 0) {
params[0] = s_le_conn_params.slave_latency_events / num_samps;
params[1] = s_le_conn_params.supervision_to_ms / num_samps;
}
s_le_conn... | if (success) {
PBL_LOG(LOG_LEVEL_DEBUG, "Link quality: %x, RSSI: %d", link_quality, rssi);
analytics_add(ANALYTICS_DEVICE_METRIC_BLE_LINK_QUALITY_SUM,
link_quality, AnalyticsClient_System);
analytics_add(ANALYTICS_DEVICE_METRIC_BLE_RSSI_SUM,
ABS(rssi), AnalyticsClient_Sys... |
}
void bluetooth_analytics_handle_disconnect(bool local_is_master) {
if (!local_is_master) {
analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_TIME);
analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_ENCRYPTED_TIME);
prv_update_conn_event_timer(0, true);
}
}
void bluetooth_anal... |
(fd) == S_SUCCESS);
}
}
static uint32_t s_watch_file_callback_called_count = 0;
static void prv_file_changed_callback(void *data) {
s_watch_file_callback_called_count++;
}
void test_pfs__watch_file_callbacks(void) {
const char* file_name = "newfile";
PFSCallbackHandle cb_handle = pfs_watch_file(file_name, pr... | cl_assert_equal_i(pfs_read(fd, &buf[0], sizeof(buf)), sizeof(buf));
cl_assert(memcmp(buf, bufcmp, sizeof(buf)) == 0);
cl_assert_equal_i(pfs_close(fd), S_SUCCESS);
}
} | |
{ 1144, 48, 64},
{ 1136, 32, 48},
{ 1144, 32, 48},
{ 1104, 24, 64},
{ 1128, 16, 64},
{ 1144, 16, 96},
{ 1136, 0, 104},
{ 1120, -8, 120},
{ 1088, -16, 120},
{ 1080, -16, 120},
{ 1072, -16, 104},
{ 1064, -24, 112},
{ 1032, -24, 96},
{ 1064, -48, 88},
{ 1200, -40, 13... | { 1056, 32, -64},
{ 1080, -8, 24},
{ 1056, -32, 16},
{ 928, -24, 0},
{ 832, -24, -80},
// 26 seconds
{ 848, -40, -160},
{ 904, -96, -176},
{ 944, -120, -216},
{ 928, -136, -296},
{ 1000, -152, -360},
{ 1072, -152, -416},
{ 1160, -160, -432},
{ 1200, -128, -432},
... |
{ 968, -104, -40},
{ 984, -96, -72},
{ 1000, -112, -72},
{ 1016, -120, -56},
{ 1032, -136, -64},
{ 1296, -136, -72},
{ 1336, -144, -88},
{ 1224, -112, -128},
{ 1024, -80, -240},
{ 832, -56, -256},
{ 936, -56, -232},
{ 1112, -80, -176},
{ 1096, -80, -136},
{ 1024,... |
>close) {
// iAP sessions cannot be closed from the watch' side :(
PBL_LOG(LOG_LEVEL_ERROR, "System session already exists and cannot be closed");
return NULL;
}
// Last system session to connect wins:
// This is to work-around a race condition that happens when iOS... | {
if (session->transport_imp->schedule) {
return session->transport_imp->is_current_task_schedule_task(session->transport);
}
return bt_driver_comm_is_current_task_send_next_task();
} |
void prv_send_next(CommSession *session, bool is_callback) {
bt_lock();
{
if (!comm_session_is_valid(session)) {
// Session closed in the mean time
goto unlock;
}
// Flip the flag before the send_next callback, so it can schedule again if needed.
// Only flip the flag, if this called a... |
-------------------
// Fetch sleep sessions using the health_service API
static uint32_t s_health_sessions_count;
static uint32_t s_health_sessions_max;
static ActivitySession *s_health_sessions;
static time_t s_health_sessions_sleep_time;
static time_t s_health_sessions_awake_time;
static bool prv_activity_iterate_cb... | (100 /*initial_ticks*/, utc_sec) | ;
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(false);
prv_activity_algorithm_erase_minute_data();
prv_activity_init_and_set_enabled(true);
// Set default user settings
activity_prefs_set_height_mm(ACTIVITY_DEFAULT_HEIGHT_MM);
activity_prefs_set_weight_dag(ACTIVITY_DEFAULT_WEIGHT_DAG... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&this->sd_gpio, GPIO_OType_PP,
GPIO_Medium_Speed, data_pupd) | ;
}
//! Configure GPIOs for lowest power consumption
static void prv_disable_gpio(MicDevice *this) {
// Configure the clock pin as an output driving low so the microphone
// won't see any unintentional clock edges which would wake it up
// from sleep mode.
gpio_af_configure_fixed_output(&this->ck_gpio, false);... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(event.bluetooth.le.gatt_client_service.subtype,
PebbleBLEGATTClientEventTypeServiceChange) | ;
cl_assert_equal_i(event.bluetooth.le.gatt_client_service.info->status,
status);
const BTDeviceInternal event_device = event.bluetooth.le.gatt_client_service.info->device;
const bool equal_devices = bt_device_equal(&device->opaque,
&event_device.opaque);
cl_... |
ctrl);
I2C_DeInit(bus->hal->i2c);
}
bool i2c_hal_is_busy(I2CBus *bus) {
return ((bus->hal->i2c->SR2 & I2C_SR2_BUSY) != 0);
}
void prv_disable_all_interrupts(I2CBus *bus) {
bus->hal->i2c->CR2 &= ~(I2C_CR2_ITEVTEN | I2C_CR2_ITERREN | I2C_CR2_ITBUFEN);
}
void i2c_hal_abort_transfer(I2CBus *bus) {
// Disable all... | i2c->DR = transfer->register_address;
if (transfer->direction == I2CTransferDirection_Read) {
transfer->state = I2CTransferState_RepeatStart;
} else {
// Enable TXE interrupt for writing
i2c->CR2 |= I2C_CR2_ITBUFEN;
transfer->state = I2CTransferState_WriteData;
}... |
i2c->CR2 &= ~I2C_CR2_ITBUFEN;
should_context_switch = prv_end_transfer_irq(bus, true);
break;
}
break;
case I2CTransferState_WriteData:
i2c->DR = transfer->data[transfer->idx];
transfer->idx++;
if (transfer->idx == transfer->size) {
i2c->CR2 &= ~I2C_C... |
264},
{ 1152, 152, 224},
{ 968, 360, -128},
{ 904, 360, -160},
{ 992, 200, 96},
{ 888, 112, 136},
{ 760, 104, 48},
{ 744, 216, 24},
{ 752, 304, -24},
{ 760, 344, -64},
{ 848, 328, -88},
{ 1080, 312, -56},
{ 984, 344, -40},
{ 1584, 488, 0},
{ 1344, 520, 128},
{... | { 928, 128, 232},
{ 1256, 144, 264},
{ 1096, 104, 328},
{ 832, 256, -40},
{ 800, 312, -200},
{ 896, 176, -16},
{ 888, 128, 48},
{ 824, 96, -16},
{ 808, 192, -88},
{ 832, 288, -136},
{ 808, 320, -120},
{ 824, 304, -128},
{ 960, 312, -96},
{ 1072, 328, -32},
{ 1... |
{ 744, 168, 120},
{ 792, 104, 176},
{ 856, 80, 216},
{ 920, 80, 296},
{ 960, 72, 360},
{ 1008, 104, 304},
{ 1088, 152, 192},
{ 1232, 40, 344},
{ 808, 136, 16},
{ 824, 288, -264},
{ 864, 200, -168},
{ 928, 112, -48},
{ 864, 64, -32},
{ 824, 160, -144},
{ 824, ... |
rect) {}
void graphics_fill_radial_precise_internal(GContext *ctx, GPointPrecise center,
Fixed_S16_3 radius_inner, Fixed_S16_3 radius_outer,
int32_t angle_start, int32_t angle_end) {}
void layer_mark_dirty(Layer *layer) {}
jerry_va... | (GPoint(2, 3), lc->path.points[1]) | ;
cl_assert_equal_point(GPoint(4, 5), lc->path.points[2]);
cl_assert_equal_point(GPoint(6, 7), lc->path.points[3]);
}
void test_rocky_api_graphics_path2d__fill(void) {
rocky_global_init(s_graphics_api);
prv_create_global_ctx();
EXECUTE_SCRIPT(
"ctx.moveTo(1, 2);\n"
"ctx.lineTo(3, 4);\n"
"ctx.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... | cl_assert(NULL != bmp) | ;
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat4BitPalette);
cl_assert(NULL == bmp);
bmp = gbitmap_create_blank(s10, GBitmapFormat8BitCircular);
cl_assert(NULL == bmp);
bmp = gbitmap_create_blank(s180, GBitmapForm... |
_uid = uid,
};
static const size_t request_max_size = 32;
Buffer *request_buffer = buffer_create(request_max_size);
const size_t written_size = buffer_add(request_buffer,
(const uint8_t *) &cmd_header,
sizeof(cmd_header));
PBL_... | if (no_error) {
PBL_LOG(LOG_LEVEL_INFO, "Hurray! ANCS subscribed: %u", characteristic_id);
if (characteristic_id == ANCSCharacteristicData) {
prv_ancs_is_alive_start_tracking();
prv_start_temp_notification_connection_delay_timer();
}
} else {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to subscribe ... |
}
void ancs_invalidate_all_references(void) {
for (int c = 0; c < NumANCSCharacteristic; c++) {
s_ancs_client->characteristics[c] = BLE_CHARACTERISTIC_INVALID;
}
prv_reset_and_flush();
prv_put_ancs_disconnected_event();
}
void ancs_handle_service_removed(BLECharacteristic *characteristics, uint8_t num_c... |
2},
{ -712, 152, -208},
{ -680, -176, -104},
{ -560, 104, 24},
{ -432, 2120, 336},
{ 632, 3752, 768},
{ 536, 1824, 624},
{ 480, 792, 272},
// 5 seconds
{ 432, 280, 24},
{ 432, -224, 48},
{ 320, -480, 248},
{ 208, -576, 376},
{ 944, 248, 312},
{ 1104, 3056, 960},
... | { -200, 3032, 640},
{ 296, 2288, 896},
{ 488, 1648, 424},
{ 456, 960, 256},
{ 464, 328, 136},
{ 376, -168, 168},
{ 664, -368, 176},
{ 504, -416, 192},
{ 832, 680, 648},
{ 400, 3384, 616},
{ 224, 1968, 248},
{ -144, 1568, -32},
{ -296, 800, -16},
{ -552, 120, 8},
... |
// 13 seconds
{ -464, 2752, 440},
{ -168, 2720, 1048},
{ 344, 1816, 664},
{ 384, 1112, 336},
{ 352, 576, 152},
{ 320, -56, 264},
{ 504, -344, 216},
{ 592, -392, 296},
{ 920, 464, 232},
{ 320, 2480, 1008},
{ 456, 2312, 304},
{ -240, 1544, 192},
{ -376, 992, 32},
... |
gain before we expire, should get the same session ref back
HRMSessionRef new_session_ref = sys_hrm_manager_app_subscribe(app_id, 1, expire_s,
HRMFeature_BPM);
cl_assert(new_session_ref == session_ref);
// Now advance time past the expiration time
... | (app_id, 1, expire_s, HRMFeature_BPM) | ;
}
prv_fake_send_new_data();
// One event for each app subscriber
cl_assert_equal_i(s_event_count, num_refs);
for (int i = 0; i < num_refs; ++i) {
sys_hrm_manager_unsubscribe(session_refs[i]);
}
}
void test_hrm_manager__no_feature_callbacks(void) {
// Subscribe and fake data being sent
AppInsta... |
/*
* 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... | (&connection->device.opaque, &device->opaque) | |
fine PROMPT_RESP_DONE (101)
#define PROMPT_RESP_MESSAGE (102)
static void start_prompt(void);
static void pulse_send_message(const int message_type, const char* response);
static void prv_pulse_done_command(void);
static void prv_dbgserial_response_callback(const char* response) {
if (serial_console_get_state() == ... | {
((CommandFuncThreeParams) cmd->func)(args.args[0], args.args[1], args.args[2]);
} | else if (cmd->num_params == 2) {
((CommandFuncTwoParams) cmd->func)(args.args[0], args.args[1]);
} else if (cmd->num_params == 1) {
((CommandFuncOneParam) cmd->func)(args.args[0]);
} else if (cmd->num_params == 0) {
((CommandFuncNoParam) cmd->func)();
}
done:
if (!s_command_continues_after_return ... |
/*
* 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... | (header, &state->context) | ) {
if (prv_should_use_item(state, header)) {
*state->filter_header = *header;
}
filter = true;
}
}
return filter;
}
static void prv_update_status(void) {
PBL_ASSERT_TASK(PebbleTask_KernelBackground);
if (!s_mutex) {
return;
}
mutex_lock(s_mutex);
new_timer_stop(s_timer)... |
;
if (!structured_glance) {
return;
} else if (structured_glance->glance.current_slice.type != AppGlanceSliceType_IconAndSubtitle) {
PBL_LOG(LOG_LEVEL_WARNING, "Generic glance doesn't know how to handle slice type %d",
structured_glance->glance.current_slice.type);
return;
}
// Evaluate... | prv_generic_glance_set_icon(generic_glance, &generic_glance->default_icon_resource_info) | ;
LauncherAppGlanceStructured *structured_glance =
launcher_app_glance_structured_create(&node->uuid, &s_generic_structured_glance_impl,
should_consider_slices, generic_glance);
if (structured_glance) {
if (generic_glance->use_legacy_28x28_icon_size_limit) {
... |
/*
* 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... | ecma_free_unused_memory(JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH, 0, true) | ;
jmem_pools_collect_empty();
}
static void prv_memorypressure_app_log(const char *level, const jmem_heap_stats_t *stats) {
APP_LOG(LOG_LEVEL_WARNING, "Memory pressure level: %s", level);
APP_LOG(LOG_LEVEL_WARNING,
"heap size: %zu, alloc'd: %zu, waste: %zu, largest free block: %zu,",
stats->s... |
s
}
accel_get_latest_reading((AccelRawData *)accel_data);
accel_data->timestamp = accel_get_latest_timestamp();
result = 0;
} else {
uint64_t old_timestamp_ms = accel_get_latest_timestamp();
// Else, change the FIFO to 1 deep and wait for a reading
ACCEL_LOG_DEBUG("setti... | analytics_add(ANALYTICS_DEVICE_METRIC_ACCEL_SAMPLE_COUNT, num_samples,
AnalyticsClient_System) | ;
PBL_ASSERTN(state->num_samples <= state->raw_buffer_size);
}
// If buffer is full, notify subscriber to process it
if (state->num_samples >= state->samples_per_update) {
prv_call_data_callback(state);
ACCEL_LOG_DEBUG("full set of %d samples for session %d", state->num_sampl... |
= TextFront,
[GOLF_MID_KEY] = TextMid,
[GOLF_BACK_KEY] = TextBack,
[GOLF_HOLE_KEY] = TextHole,
[GOLF_PAR_KEY] = TextPar
};
typedef struct {
Window *window;
ActionBarLayer *action_bar;
StatusBarLayer *status_layer;
GBitmap *up_bitmap;
GBitmap *down_bitmap;
GBitmap *click_bitmap;
Layer *background... | PBL_IF_ROUND_ELSE(vertical_divider_x_offset, 0) | ;
const int16_t vertical_divider_y_offset = PBL_IF_ROUND_ELSE(
37, bounds.size.h - vertical_divider_height);
const uint16_t horizontal_divider_y_offset = PBL_IF_ROUND_ELSE(
vertical_divider_y_offset + (vertical_divider_height / 2), vertical_divider_y_offset);
graphics_context_set_stroke_color(ctx, GC... |
arm_set_enabled(AlarmId id, bool enable) {
SettingsFile file;
if (!prv_file_open_and_lock(&file)) {
return;
}
AlarmConfig config;
bool rv = prv_alarm_get_config(&file, id, &config);
if (!rv) {
goto cleanup;
}
if (id == s_most_recent_alarm_id && !enable) {
PBL_LOG(LOG_LEVEL_DEBUG, "Cancelin... | if (kind_out) {
*kind_out = config.kind;
} |
cleanup:
prv_file_close_and_unlock(&file);
return rv;
}
static void prv_snooze_alarm(int snooze_delay_s) {
prv_clear_snooze_timer();
PBL_LOG(LOG_LEVEL_INFO, "Snoozing for %d minutes", snooze_delay_s / SECONDS_PER_MINUTE);
bool success = new_timer_start(s_snooze_timer_id, snooze_delay_s * MS_PER_SECOND,
... |
/*
* 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_context_set_antialiased(ctx, false) | ;
graphics_draw_round_rect(ctx, &GRect(2, 2, 28, 20), 4);
}
void clear_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorClear);
graphics_context_set_antialiased(ctx, false);
graphics_draw_round_rect(ctx, &GRect(2, 2, 28, 20), 4);
}
void across_x_layer_update_callb... |
s_items[2].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id));
// check third again
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id));
// check fifth
cl_assert(iter_next(&itera... | uuid_equal(&state.pin.header.id, &s_long_items[3].header.id) | );
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[4].header.id));
cl_assert(!iter_next(&iterator));
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[3].header.id));
#if CAPABILITY_HAS_CORE_NAVIGATION4
cl_assert(iter_prev(... |
ULL));
cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_16KB_sectors(void) {
cl_assert(system_flash_erase(FLASH_BASE, 48 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 2), erased_sector);
cl_assert(flash_locked);
}
void callback_is_called_c... | fprintf(stderr, "0x%.08x", num) | ;
}
extern void dbgserial_putstr(char *str) {
fprintf(stderr, "%s\n", str);
}
|
{ 1480, 168, -216},
{ 1344, 256, -224},
{ 1160, 376, -344},
{ 992, 496, -240},
{ 888, 560, -200},
{ 920, 656, -256},
{ 976, 752, -384},
{ 872, 672, -400},
{ 856, 648, -512},
{ 912, 600, -440},
{ 920, 536, -352},
{ 1208, 568, -296},
{ 1360, 712, -392},
{ 1304, 600,... |
// 50 seconds
{ 1224, 736, -208},
{ 1304, 776, -296},
{ 1096, 752, -368},
{ 1424, 616, -208},
{ 1624, 416, -112},
{ 1320, 352, -144},
{ 1032, 344, -136},
{ 888, 288, -104},
{ 792, 232, -64},
{ 776, 216, -56},
{ 784, 192, -64},
{ 760, 168, -16},
{ 832, 168, 0},
... | |
rly straightforward SPI interactions
//! The assertion and deassertion of the SCS line is automatic
//
static bool prv_is_bidrectional(const SPISlavePort *slave) {
bool is_bidirectional = (slave->spi_direction == SpiDirection_2LinesFullDuplex) ||
(slave->spi_direction == SpiDirection_2LinesRxOnly);
re... | PBL_ASSERTN(slave->slave_state->acquired) | ;
spi_slave_wait_until_idle_blocking(slave);
prv_spi_clear_flags(slave->spi_bus);
spi_ll_slave_spi_disable(slave);
slave->slave_state->acquired = false;
prv_spi_disable_peripheral_clock(slave->spi_bus);
}
void spi_ll_slave_spi_enable(const SPISlavePort *slave) {
PBL_ASSERTN(slave->slave_state->initialized)... |
x, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 3);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY... | setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1) | |
e before continuing to use the device.
// It takes 2.6ms for the LDO rails to ramp.
psleep(3);
return true;
}
return false;
}
} else {
if (*ref_count <= 1) {
// Set the register byte to XXXXX00X to disable the rail, just mask
register_value = (register_value & ... | prv_read_register(PmicRegisters_BUCK1_VSET, buck1_vset) | ;
}
static void prv_clear_any_pending_interrupts(void) {
// Read the Int status registers to clear any pending bits.
// An interrupt wont fire if the matching bit is already set.
uint8_t throwaway_read_result;
prv_read_register(PmicRegisters_INTA, &throwaway_read_result);
prv_read_register(PmicRegisters_INTB... |
0, 0x00},
.timestamp = 100*60,
.duration = 10,
.type = TimelineItemTypePin,
.all_day = true,
.layout = LayoutIdCalendar,
},
.attr_list = {
.num_attributes = 1,
.attributes = &title_attr,
},
};
// Setup
////////////////////////////////////////////////////////////////
void test_calenda... | rtc_set_time(30 * 60) | ;
timeline_event_init();
cl_assert_equal_i(fake_event_get_count(), 1);
cl_assert(!prv_get_calendar_ongoing());
TimerID timer_id = stub_new_timer_get_next();
cl_assert_equal_i(timer_id, TIMER_INVALID_ID);
cl_assert(!stub_new_timer_is_scheduled(timer_id));
cl_assert(timeline_add(&item1));
timeline_event_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (t_a, t_b) | ;
}
static int prv_int32_cmp_desc(const void *a, const void *b) {
return -prv_int32_cmp(a, b);
}
void test_sort__uint8_array(void) {
uint8_t array[] = {9, 1, 8, 2, 7, 3, 6, 4, 6, 5, 5};
sort_bubble(array, ARRAY_LENGTH(array), sizeof(uint8_t), prv_uint8_cmp);
uint8_t sorted[] = {1, 2, 3, 4, 5, 5, 6, 6, 7, 8,... |
n(const GAPLEConnection *connection,
IntentApply fp, void *data) {
GAPLEConnectionIntent *intent = s_intents;
while (intent) {
GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next;
if (prv_intent_matches_connection(intent, con... | GAP_LE_Cancel_Create_Connection(stack_id) | ;
if (r) {
PBL_LOG(LOG_LEVEL_ERROR, "GAP_LE_Cancel_Create_Connection (r=%d)", r);
} else {
// Update the state right away (don't wait for the Connection Complete event
// with HCI_ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER status):
s_has_pending_create_connection = false;
}
#endif
}
static void prv... |
(1, 2, 3, 4) | ,
.info.format = GBitmapFormat8BitCircular,
.data_row_infos = infos,
};
cl_assert_equal_i(0, gbitmap_format_get_row_size_bytes(123, GBitmapFormat8BitCircular));
cl_assert_equal_i(123, gbitmap_get_bytes_per_row(&bmp));
cl_assert_equal_p(&some_addr + 1, gbitmap_get_data_row_info(&bmp, 0).data);
cl_... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (num.integer == -1) | ;
cl_assert(num.fraction == 5);
test_num = (int32_t)((float)-0.250 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == -1);
cl_assert(num.fraction == 6);
test_num = (int32_t)((float)-0.125 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_valu... |
sert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0);
cl_as... | (start_ms + total_duration + 5 * MIN_FRAME_INTERVAL_MS) | ;
// Make sure neither inner_seq, a, nor b played
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, inner_seq), 0);
cl_assert_equal_i(pr... |
= "Time range that goes further back into history than BPM supports",
.in = { HealthMetricHeartRateBPM, now - 3 * SECONDS_PER_HOUR, now - 1 * SECONDS_PER_HOUR,
HealthAggregationAvg, HealthServiceTimeScopeOnce },
.out = { HealthServiceAccessibilityMaskNotSupported }
},
};
// Run all ... | cl_assert_equal_i(accessible, HealthServiceAccessibilityMaskNotAvailable) | |
/*
* 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... | {
watchdog_feed();
uint32_t erase_size = 0;
if (((start_addr & SECTOR_ADDR_MASK) == start_addr) &&
(total_bytes >= SECTOR_SIZE_BYTES)) {
erase_size = SECTOR_SIZE_BYTES;
flash_impl_erase_sector_begin(start_addr);
} else if ((start_addr & SUBSECTOR_ADDR_MASK) == start_addr &&
... |
watchdog_feed();
}
uint32_t cd_flash_write_bytes(const void *buffer_ptr, uint32_t start_addr,
const uint32_t buffer_size) {
CD_ASSERTN(((start_addr + buffer_size) <= CORE_DUMP_FLASH_END) &&
(int)start_addr >= CORE_DUMP_FLASH_START);
const uint8_t *buffer = buffer_ptr;
uin... |
vice);
}
}
}
static void prv_structured_glance_subtitle_dynamic_text_node_update(
GContext *ctx, GTextNode *node, const GRect *box, const GTextNodeDrawConfig *config,
bool render, char *buffer, size_t buffer_size, void *user_data) {
LauncherAppGlanceStructured *structured_glance = user_data;
if (str... | graphics_text_node_container_add_child(&vertical_icon_container_node->container,
&horizontal_icon_container_node->container.node) | |
uint64_t start_ms = utc_secs * 1000 + ms;
for (int i = 0; i < num_samples; ) {
AccelData accel_data[ALGORITHM_SAMPLING_RATE];
int j;
for (j = 0; j < ALGORITHM_SAMPLING_RATE && i < num_samples; j++, i++) {
accel_data[j] = (AccelData) {
.x = samples[i].x,
.y = samples[i].y,
.... | {
s_health_sessions_awake_time = time_end;
} |
}
char time_start_text[64];
struct tm *local_tm = localtime(&time_start);
strftime(time_start_text, sizeof(time_start_text), "%F %r", local_tm);
char time_end_text[64];
local_tm = localtime(&time_end);
strftime(time_end_text, sizeof(time_end_text), "%F %r", local_tm);
PBL_LOG(LOG_LEVEL_DEBUG, "Got... |
ct_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) {
// If the selection animation is running, complete it. Note that 2.x apps don't have a selection
// animation.
if (menu_layer->animation.animation) {
animation_set_elapsed(menu_layer->animation.animation,
animat... | {
return menu_layer->callbacks.get_header_height(menu_layer, section_index, menu_layer->callback_context);
} | else {
return 0; // default
}
}
static inline int16_t prv_menu_layer_get_cell_height(MenuLayer *menu_layer, MenuIndex
*cell_index, bool provide_correct_selection_index) {
if (menu_layer->callbacks.get_cell_height) {
const MenuIndex prev_selection_index = menu_layer->selection.index;
if (!provide_c... |
/*
* 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... | (DISP_GPIO, DISP_PIN_SCS, Bit_SET) | ;
// required setup time > 3us
delay_us(7);
gpio_release(DISP_GPIO);
}
static void prv_disable_chip_select(void) {
gpio_use(DISP_GPIO);
// delay while last byte is emitted by the SPI peripheral
delay_us(7);
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET);
// hold time > 1us
// produce a delay 4ms
... |
/*
* 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... | pb_encode_tag_for_field(stream, field) | ) {
return false;
}
if (!pb_encode_varint(stream, encoder_arg->types[i])) {
return false;
}
}
return true;
}
bool protobuf_log_util_encode_buffer(pb_ostream_t *stream, const pb_field_t *field,
void * const *arg) {
PLogBufferEncoderArg *... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | pstring_equal_cstring(&app_name_attr->pstr, existing_name) | ) {
// If the existing name doesn't match our new name, update the name
app_name_buff = kernel_zalloc_check(app_name_attr->length + 1);
pstring_pstring16_to_string(&app_name_attr->pstr, app_name_buff);
attribute_list_add_cstring(&new_attr_list, AttributeIdAppName, app_name_buff);
list_dirt... |
-56, -104, -1008},
{ -40, -56, -1024},
{ -64, -8, -1000},
{ -56, 40, -1024},
{ -72, 72, -1008},
{ -88, 80, -984},
{ -88, 112, -1000},
{ -112, 144, -1000},
{ -112, 192, -1024},
{ -120, 216, -1000},
{ -128, 184, -1000},
{ -144, 56, -912},
{ -104, -96, -896},
{ -96, -24... | { -240, 408, -888},
{ -208, 296, -904},
{ -232, 216, -960},
{ -232, 256, -976},
{ -160, 88, -984},
{ -112, 72, -1064},
{ -168, 176, -1072},
{ -192, 200, -1008},
{ -240, 240, -920},
{ -248, 320, -864},
// 218 seconds
{ -288, 440, -832},
{ -192, 360, -864},
{ -240, ... |
{ -328, 744, -464},
{ -368, 480, -808},
{ -224, 648, -784},
{ -264, 528, -768},
{ -48, 480, -944},
{ 24, 488, -840},
{ -80, 568, -744},
{ 24, 696, -808},
{ 112, 600, -728},
{ 104, 584, -752},
{ 48, 496, -728},
{ 8, 600, -696},
{ -80, 456, -712},
{ -48, 808, -696}... |
elRawData fake_buf[1];
for (int i = 0; i < num_items; i++) {
if (fastest_rate < sample_arr[i]) {
fastest_rate = sample_arr[i];
}
sessions[i] = sys_accel_manager_data_subscribe(
sample_arr[i], prv_noop_sample_handler, NULL, tasks[i]);
// buffer size of 1
sys_accel_manager_set_sample... | sys_accel_manager_set_sample_buffer(main_session, fake_buf, 3) | ;
cl_assert_equal_i(s_num_samples, 7); /* 300ms / (1000ms / 25 samps) */
}
|
--------------------------------------------------------------------------
bool activity_algorithm_set_user(uint32_t height_mm, uint32_t weight_g, ActivityGender gender,
uint32_t age_years) {
return true;
}
// -------------------------------------------------------------------------... | prv_fill_minute_record(utc_sec, m_rec) | ;
prv_reset_state_minute_handler(m_rec);
ACTIVITY_LOG_DEBUG("minute handler: steps: %"PRIu8", orientation: 0x%"PRIx8", vmc: %"PRIu16", "
"light: %"PRIu8", plugged_in: %d",
m_rec->base.steps, m_rec->base.orientation, m_rec->base.vmc,
m_rec->base.light,... |
y1.integer, y2.integer, opacity,
ctx->draw_state.stroke_color);
graphics_release_frame_buffer(ctx, framebuffer);
return;
}
#endif // PBL_COLOR
if (opacity <= (MAX_PLOT_BRIGHTNESS / 2)) {
int16_t y1_rounded = (y1.raw_value + (F... | (1, framebuffer->bounds.size.h) | ,
};
GBitmap column_to_replicate_sub_bitmap;
gbitmap_init_as_sub_bitmap(&column_to_replicate_sub_bitmap, framebuffer, column_to_replicate);
for (int16_t x = dst_x1; x <= dst_x2; x++) {
bitblt_bitmap_into_bitmap(framebuffer, &column_to_replicate_sub_bitmap, GPoint(x, 0),
GCompOp... |
64, 640, -752},
{ 64, 648, -760},
{ 64, 632, -752},
{ 64, 640, -760},
{ 64, 648, -760},
{ 64, 632, -752},
{ 64, 640, -752},
{ 64, 648, -760},
{ 64, 640, -752},
{ 56, 640, -752},
{ 64, 656, -752},
{ 64, 648, -752},
{ 64, 648, -752},
{ 64, 640, -752},
{ 64, 648, -7... | { 64, 640, -760},
{ 64, 640, -760},
{ 64, 640, -760},
{ 56, 640, -768},
{ 56, 640, -768},
{ 56, 640, -760},
{ 56, 632, -760},
{ 56, 640, -752},
{ 56, 632, -760},
{ 64, 648, -760},
{ 64, 640, -760},
{ 64, 648, -760},
{ 64, 640, -760},
{ 56, 656, -768},
{ 56, 64... |
{ 64, 640, -760},
{ 64, 640, -760},
{ 56, 640, -760},
{ 56, 640, -760},
{ 64, 640, -768},
// 25 seconds
{ 56, 640, -760},
{ 64, 640, -760},
{ 64, 640, -760},
{ 64, 640, -760},
{ 56, 640, -760},
{ 64, 640, -760},
{ 56, 640, -760},
{ 56, 640, -760},
{ 64, 632, ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_DEBUG, "Locking mutex 2") | ;
mutex_lock(s_mutex2);
}
static void s_main(void) {
window = window_create();
app_window_stack_push(window, true /* Animated */);
deadlock();
app_event_loop();
}
const PebbleProcessMd* deadlock_get_app_info(void) {
static const PebbleProcessMdSystem s_app_info = {
.common.main_func = &s_main,
.... |
SB);
dbgserial_putstr("exit standby");
system_hard_reset();
}
periph_config_disable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_PWR);
}
void boot_main(void) {
gpio_enable_all();
check_and_handle_resuming_from_standby();
dbgserial_init();
dbgserial_putstr("");
dbgserial_putstr(" ___ _ _ _ ");
... | ("Remove charger to shutdown") | ;
i = 0;
}
delay_ms(500);
++i;
}
dbgserial_putstr("Shutting down.");
pmic_full_power_off();
}
watchdog_init();
#ifndef NO_WATCHDOG
watchdog_start();
#endif
gpio_disable_all();
jump_to_fw();
}
|
e->callback_context);
state->sent_expiration_event = true;
}
// See if this subscriber wants these types of events
switch (event.event_type) {
case HRMEvent_BPM:
if (!(state->features & HRMFeature_BPM)) {
continue;
}
break;
case HRMEvent_LEDCurrent:
... | ("PPG samples: %d", data->ppg_data.num_samples) | ;
HRM_HEXDUMP(data->ppg_data.ppg, data->ppg_data.num_samples * sizeof(uint16_t));
HRM_LOG("TIA samples: %d", data->ppg_data.num_samples);
HRM_HEXDUMP(data->ppg_data.tia, data->ppg_data.num_samples * sizeof(uint16_t));
HRM_LOG("Accel samples: %"PRIu32, data->accel_data.num_samples);
HRM_LOG("LED %"PRIu16"uA, T... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, "CFSR (Configurable Fault) = 0x%"PRIx32, cfsr) | ;
// Usage Fault Status Register
const uint16_t ufsr = (cfsr >> 16) & 0xffff;
static const IndexToName ufsr_mappings[] = {
{ 9, "DIVBYZERO" },
{ 8, "UNALIGNED" },
{ 3, "NOCP" },
{ 2, "INVPC" },
{ 1, "INVSTATE" },
{ 0, "UNDEFINSTR" }
};
if (ufsr != 0) {
PBL_LOG_FROM_FAULT_HANDLER("... |
-10, -20);
grect_polar_calc_values(&r, mode, ¢er, &radius);
cl_assert_gpoint_precise(center, -5.5, -10.5);
cl_assert_fixedS16_3(radius, 4.5);
}
void test_graphics_circle__grect_polar_calc_values_square(void) {
GPointPrecise center = {};
Fixed_S16_3 radius = {};
GRect r = GRect(0, 0, 5, 5);
GOvalScal... | GRect(0, 0, 10, 12) | , GOvalScaleModeFitCircle, 3, 0, 0);
cl_assert_gpoint_precise(s_center, 4.5, 5.5);
cl_assert_fixedS16_3(s_radius_outer, 4.5);
cl_assert_fixedS16_3(s_radius_inner, 1.5);
}
void test_graphics_circle__DEG_TO_TRIGANGLE(void) {
cl_assert_equal_i(DEG_TO_TRIGANGLE(720), TRIG_MAX_ANGLE * 2);
cl_assert_equal_i(DEG_TO... |
ense, 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 distributed... | menu_layer_deinit(&data->menu_layer) | ;
app_free(data);
}
static void handle_init(void) {
SettingsAppData *data = app_zalloc_check(sizeof(SettingsAppData));
Window *window = &data->window;
window_init(window, WINDOW_NAME("Settings"));
window_set_user_data(window, data);
window_set_window_handlers(window, &(WindowHandlers){
.load = prv_win... |
.h"
#include "util/math.h"
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
enum ActionBarState {
ActionBarStateSkip,
ActionBarStateVolume,
ActionBarStateLongPress,
};
typedef struct MusicAppSizeConfig {
const char *music_time_font_key;
const char *no_music_font_key;
int16_t horizontal_margin... | (cassette_x, config->cassette_rect.origin.y,
config->cassette_rect.size.w, config->cassette_rect.size.h) | ;
}
static GRect prv_track_rect(void) {
const MusicAppSizeConfig *config = prv_config();
return GRect(config->horizontal_margin, config->track_field.origin_y,
prv_content_width(), config->track_field.size_h);
}
static const ButtonId BUTTON_FORWARD = BUTTON_ID_DOWN;
static const ButtonId BUTTON_BACK... |
depoint) {
if (FONT_VERSION(md->version) == FONT_VERSION_1) {
return (1);
} else {
return prv_font_hash(codepoint, md->hash_table_size);
}
}
static int prv_load_offset_table(Codepoint codepoint, FontCache *font_cache,
const FontResource *font_res) {
const int table_id =... | {
int min_idx = 0;
int max_idx = prv_load_offset_table(codepoint, font_cache, font_res);
uint32_t offset = 0;
while (max_idx >= min_idx) {
int mid_idx = (max_idx + min_idx) / 2;
Codepoint codepoint_at_mid_idx = prv_offset_table_get_codepoint(font_cache, &font_res->md,
... | |
config(void) {
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;
// ... | pebble_task_get_current() | ;
if (task == PebbleTask_Worker || task == PebbleTask_App) {
analytics_inc(ANALYTICS_APP_METRIC_ACCEL_PEEK_COUNT, AnalyticsClient_CurrentTask);
}
if (!accel_running()) {
return (-1);
}
mutex_lock_recursive(s_mutex);
{
if (s_accel_samples_per_update == 0) {
// If we are not in FIFO mode,... |
, BTErrno errno) {
if (errno != BTErrnoOK) {
// Handle failure -- cleanup and dispatch event:
prv_free_service_nodes(connection);
gatt_client_subscriptions_cleanup_by_connection(connection, false /* should_unsubscribe */);
}
prv_remove_current_discovery_job(connection);
connection->gatt_is_service_... | {
prv_free_service_nodes(connection);
} |
}
//! extern for gatt_service_changed.c
//! Same as gatt_client_discovery_discover_all, but cleans up existing service discovery
//! state and stops any existing service discovery process.
BTErrno gatt_client_discovery_rediscover_all(const BTDeviceInternal *device) {
BTErrno ret_val = BTErrnoServiceDiscoveryDisconn... |
10);
cl_assert(fd >= 0);
fd = pfs_open("a_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
fd = pfs_open("b_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
fd = pfs_open("b_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
// Get a directory listin... | prv_file_exists("a_test_1") | |
cl_assert_equal_i(2, menu_layer_get_selected_index(&l).row);
const int16_t basic_cell_height = menu_cell_basic_cell_height();
cl_assert_equal_i(2 * basic_cell_height, l.selection.y);
menu_layer_set_selected_next(&l, false, MenuRowAlignNone, false);
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).secti... | layer_convert_point_to_screen(cell_layer, GPointZero) | ;
const GPoint expected = layer_convert_point_to_screen(&s_menu_layer_hierarchy.scroll_layer.layer,
GPoint(0, cell_index->row * 44));
cl_assert_equal_gpoint(actual, expected);
}
int prv_num_sublayers(const Layer *l) {
int result = 0;
Layer *child = l->fir... |
cessarily. If you hit this
// assert and you have a good reason for making the event bigger, feel free to relax the restriction.
//PBL_LOG(LOG_LEVEL_DEBUG, "PebbleEvent size is %u", sizeof(PebbleEvent));
// FIXME:
_Static_assert(sizeof(PebbleEvent) <= 12,
"You made the PebbleEvent bigger! It sh... | kernel_free(*buffer) | ;
*buffer = NULL;
}
}
void event_put(PebbleEvent* event) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
// If we are posting from the KernelMain task, use the dedicated s_from_kernel_event_queue queue for that
// See comments above where s_from_kernel_event_queue is declared.
if (pebble_... |
xt(&ctx, "ajj", &s_font_info, RECT_TEXT_2_0,
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_ajj22.${BIT_DEPTH_NAME}.pbi"));
// Test when clipping/drawing and text bounds are all at (2, 0) - no negative offset
setup_test_aa_s... | setup_test_aa_sw(&ctx, fb, RECT_NULL_H, RECT_NULL_H, false, 1) | ;
graphics_context_set_text_color(&ctx, GColorBlack);
graphics_draw_text(&ctx, "jja", &s_font_info, RECT_TEXT_0_0,
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL);
cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite));
// Test negative context boxes - ensure n... |
GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index,
void *context) {
LauncherMenuLayer *launcher_menu_layer = context;
AppMenuDataSource *data_source = launcher_menu_layer->data_source;
if (!data_source) {
return;
}
AppMenuNode *node = app_menu_data_source_g... | fonts_get_system_font(LAUNCHER_MENU_LAYER_SUBTITLE_FONT) | ;
Layer *container_layer = &launcher_menu_layer->container_layer;
layer_init(container_layer, &frame);
launcher_menu_layer->data_source = data_source;
GRect menu_layer_frame = frame;
#if PBL_ROUND
const int top_bottom_inset =
(frame.size.h - LAUNCHER_MENU_LAYER_CELL_ROUND_FOCUSED_CELL_HEIGHT -
... |
ion_get_duration(seq, true, true);
cl_assert_equal_i(duration, duration_b + delay_b + delay_seq);
// The position of seq should be at -delay_seq
int32_t position;
animation_get_elapsed(seq, &position);
cl_assert_equal_i(position, -delay_seq);
// Finish the sequence
prv_advance_to_ms_with_timers(prv_now_... | cl_assert_equal_i(position, (680 - 310)) | ;
// Run to the completion of B, start of C
prv_advance_to_ms_with_timers(start_ms + 730 + 2 * MIN_FRAME_INTERVAL_MS);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handl... |
ee PBL-20368.
void bt_driver_cb_handle_create_bonding(const BleBonding *bonding,
const BTDeviceAddress *addr) {
}
void cc2564A_bad_le_connection_complete_handle(unsigned int stack_id,
const GAP_LE_Current_Connection_Parameters_t *par... | {
// Verify the Pebble event:
PebbleEvent event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_BLE_CONNECTION_EVENT);
// Event should only go to app:
cl_assert_equal_i(event.task_mask, (PebbleTaskBitset) ~(client_tasks));
const PebbleBLEConnectionEvent *conn_event = &event.bluetooth.le.connec... |
// Tests
///////////////////////////////////////////////////////////
extern void gap_le_connect_bluetopia_connection_callback(
unsigned int stack_id, GAP_LE_Event_Data_t* event_data, unsigned long CallbackParameter);
void test_gap_le_connect__initialize(void) {
fake_GAPAPI_init();
// Register slave connectio... |
}
}
bool timeline_nodes_equal(TimelineNode *a, TimelineNode *b) {
if (a == NULL || b == NULL) {
return (a == b);
}
return (uuid_equal(&a->id, &b->id) && (a->timestamp == b->timestamp));
}
bool timeline_get_originator_id(const TimelineItem *item, Uuid *uuid) {
TimelineItem pin = {};
const TimelineItem ... | {
timeline_item_free_allocated_buffer(&iter_state->pin);
Uuid id = iter_state->pin.header.id;
iter_state->pin = (TimelineItem){};
pin_db_get(&id, &iter_state->pin);
} |
}
bool timeline_add_missed_call_pin(TimelineItem *pin, uint32_t uid) {
uuid_generate(&pin->header.id);
pin->header.layout = LayoutIdGeneric;
pin->header.type = TimelineItemTypePin;
pin->header.from_watch = true;
pin->header.ancs_uid = uid;
// patch the dismiss action to be a remove action
TimelineItemA... |
meout_ms - ticks_to_milliseconds(timeout_end_ticks - rtc_get_ticks())));
analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_GATT_STALLED_NOTIFICATIONS_COUNT,
AnalyticsClient_System);
}
return true;
}
const RtcTicks now_ticks = rtc_get_ticks();
if (now_ticks > timeout_end_ti... | (task_mask) | ;
}
unlock:
bt_unlock();
}
// -------------------------------------------------------------------------------------------------
static GATTClientSubscriptionNode * prv_find_subscription_and_connection_for_cccd(
BLEDescriptor cccd_ref,
... |
/*
* 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
//> TEST_NAME non_walk_pbl_28406_7
//> TEST_EXPECTED 0
//> TEST_EXPECTED_MIN 0
//> TEST_EXPECTED_MAX 20
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ -112, 216, -1064},
{ -112... | |
ol *requires_address_pinning,
uint8_t *flags);
static void prv_update_bondings(BTBondingID id, BtPersistBondingType type) {
if (id == BT_BONDING_ID_INVALID) {
return;
}
if (type == BtPersistBondingTypeBTClassic) {
BTDeviceAddress addr;
SM128BitKey key;
char classic_name[BT_DEVICE_NAME_BUFFER... | settings_file_set(&fd, key, key_len, (uint8_t*) data_in, data_len) | ;
}
} else {
rv = settings_file_delete(&fd, key, key_len);
}
settings_file_close(&fd);
}
cleanup:
prv_unlock();
if (rv != S_SUCCESS) {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to update gap bonding db, rv = %"PRId32, rv);
return GapBondingFileSetFail;
}
return (do_perform_update ? Gap... |
tle -> NA
// Body -> Title
// Footer -> Location
#define LAYOUT_MAX_HEIGHT 2500
#define CARD_MARGIN PBL_IF_ROUND_ELSE(12, 10)
// All paddings relate to padding above the object unless othersize noted
#define CARD_BOTTOM_PADDING 18
// The y-position of a layout frame when its banner is peeking
#define BANNER_PEEK_STATI... | {
const NotificationLayout *layout = (NotificationLayout *)layout_ref;
clock_get_since_time(buffer, config->buffer_size, layout->info.item->header.timestamp);
} |
#if !PLATFORM_TINTIN
static const EmojiEntry s_emoji_table[] = JUMBOJI_TABLE(EMOJI_ENTRY);
static bool prv_each_emoji_codepoint(int index, Codepoint codepoint, void *context) {
Codepoint *emoji_codepoint = context;
if (codepoint_is_end_of_word(codepoint) ||
codepoint_is_formatting_indicator(codepoint) ||
... |
{
nf->value = value;
if (nf->value > nf->max_val) {
nf->value = nf->max_val;
}
if (nf->value < nf->min_val) {
nf->value = nf->min_val;
}
update_output_value(nf);
} |
void number_window_set_step_size(NumberWindow *nf, int32_t step) {
nf->step_size = step;
}
int32_t number_window_get_value(const NumberWindow *nf) {
return nf->value;
}
static void number_window_load(NumberWindow *nw) {
ActionBarLayer *action_bar = &nw->action_bar;
action_bar_layer_set_context(action_bar, n... | |
/*
* 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... | {
QemuProtocolTimeFormatHeader *hdr = (QemuProtocolTimeFormatHeader *)data;
if (len != sizeof(*hdr)) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid packet length");
return;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Got time format msg: is 24 hour: %d", hdr->is_24_hour);
clock_set_24h_style(hdr->is_24_hour);
} |
// -----------------------------------------------------------------------------------------
// Handle incoming timeline peek format data (QemuProtocol_TimelinePeek)
static void prv_timeline_peek_msg_callback(const uint8_t *data, uint32_t len) {
QemuProtocolTimelinePeekHeader *hdr = (QemuProtocolTimelinePeekHeader... |
/*
* 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... | kernel_free(message) | ;
}
static AppOutboxMessageHandler s_outbox_message_handler;
static size_t s_service_data_size;
void app_outbox_service_register(AppOutboxServiceTag service_tag,
AppOutboxMessageHandler message_handler,
PebbleTask consumer_task,
... |
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 in writing, software
* distributed un... | (!alerts_should_notify_for_type(AlertReminder)) | ;
}
void test_alerts__migration(void) {
cl_assert(alerts_get_mask() == AlertMaskAllOn);
alerts_set_mask(AlertMaskAllOnLegacy);
cl_assert(alerts_get_mask() == AlertMaskAllOn);
}
void test_alerts__dnd_interruptions(void) {
s_dnd_active = true;
alerts_set_dnd_mask(AlertMaskAllOff);
alerts_set_mask(AlertMas... |
em, num_attributes, num_actions, attributes_per_action,
*string_alloc_size, string_buffer)) {
return false;
}
return true;
}
TimelineItem *timeline_item_create_with_attributes(time_t timestamp, uint16_t duration,
TimelineItemType type, LayoutId layout,
... | PBL_ASSERTN(header != NULL) | |
head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,
s_feb_5_midnight + 8 * 60 * 60 + 16 * 60), 0);
#if !CAPABILITY_HAS_CORE_NAVIGATION4
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id));
cl_assert(iter_nex... | (state.node) | ;
timeline_iter_deinit(&iterator, &state, &head);
}
void test_timeline__delete_last_items(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000)... |
_1"));
cl_assert(list_find(&dir_list->list_node, prv_find_name, "b_test_0"));
cl_assert(list_find(&dir_list->list_node, prv_find_name, "b_test_1"));
pfs_delete_file_list(dir_list);
// Do another search using a filter
dir_list = pfs_create_file_list(prv_filename_filter_a_prefix_cb);
// Should have 2 entri... | pfs_open(filename, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10) | |
&& value >= (40 - ACTIVITY_SESSION_UPDATE_MIN) * SECONDS_PER_MINUTE);
// Verify the root metrics. Since we also verify these using the health_service api, set
// the task to the app task now
stub_pebble_tasks_set_current(PebbleTask_App);
activity_get_metric(ActivityMetricSleepTotalSeconds, 1, &value);
cl_a... | (num_samples, 0) | |
destroy;
void graphics_text_attributes_destroy(GTextAttributes *text_attributes) {
record_mock_call(s_graphics_text_attributes_destroy){};
}
static MockCallRecordings s_graphics_text_layout_get_max_used_size;
static GSize s_graphics_text_layout_get_max_used_size__result;
GSize graphics_text_layout_get_max_used_size(... | EXECUTE_SCRIPT(
"var event = null;\n"
"_rocky.on('draw', function(e) {event = e;});"
) | ;
const jerry_value_t event_null = prv_js_global_get_value("event");
cl_assert_equal_b(true, jerry_value_is_null(event_null));
jerry_release_value(event_null);
Layer *l = &app_window_stack_get_top_window()->layer;
l->update_proc(l, NULL);
const jerry_value_t event = prv_js_global_get_value("event");
cl_... |
eviceAddress) {};
if (memcmp(&data.bt_classic_data.address, &invalid_address, sizeof(invalid_address)) == 0) {
PBL_LOG(LOG_LEVEL_WARNING, "Invalid pairing stored");
goto done;
}
if (addr_out) {
*addr_out = data.bt_classic_data.address;
}
if (link_key_out) {
*link_key_out = data.bt_classic_dat... | prv_get_empty_struct(&data) | ;
prv_update_and_cleanup_struct(&data, sizeof(data), 0);
}
static void prv_system_task_prf_update_cb(void *unused) {
PBL_LOG(LOG_LEVEL_DEBUG, "Syncing pairing information to SPRF");
prv_lock_pending_bonding();
{
bool le_bonding_update = s_pending_bondings.has_ble_pairing_pending;
bool classic_bonding_u... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ("Battery change period: %"PRId64"\n", value) | |
gracefully flag tells us whether to attempt a graceful
//! exit or not.
//!
//! For a graceful exit, if the app has not alreeady finished it's de-init, we post a de_init event to the app, set
//! a 3 second timer, and return immediately to the caller. If/when the app finally finishes deinit, it will post a
//! PEBBLE_... | (config->id != INSTALL_ID_INVALID) | ;
PebbleLaunchAppEventExtended *data = kernel_malloc_check(sizeof(PebbleLaunchAppEventExtended));
*data = (PebbleLaunchAppEventExtended) {
.common = config->common
};
data->common.transition = prv_get_transition(&config->common, config->id);
PebbleEvent e = {
.type = PEBBLE_APP_LAUNCH_EVENT,
.la... |
hics_context_set_fill_color(ctx, bar_color);
graphics_fill_rect(ctx, box_inset);
}
static void prv_draw_day_bar_thin(GContext *ctx, const GRect *box, int weekday,
GColor bar_color) {
GRect thin_box = *box;
// Nudge the bars before Thursday (inclusive). Note that Sunday is on the... | graphics_draw_text(ctx, char_buffer, graph_card->legend_font, box,
GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL);
// Move the box cursor to the next bar
box.origin.x = next_x;
} |
}
static void prv_draw_avg_line(HealthGraphCard *graph_card, GContext *ctx, int32_t avg,
int16_t offset_x, int16_t width) {
if (avg == 0) {
return;
}
const int offset_y = LABEL_OFFSET_Y - MAX(prv_convert_to_graph_height(graph_card, avg),
... |
}
bool ancs_filtering_is_muted(const iOSNotifPrefs *app_notif_prefs) {
return false;
}
// Fakes
////////////////////////////////////////////////////////////////
#include "fake_events.h"
#include "fake_notification_storage.h"
static time_t s_now;
time_t rtc_get_time(void) {
return s_now;
}
RtcTicks rtc_get_tick... | cl_assert_equal_i(event.type, PEBBLE_PHONE_EVENT) | |
*expandable_dialog = context;
Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog);
dialog_set_background_color(dialog, GColorRed);
}
static void prv_show_expandable_dialog(DialogsData *data) {
ExpandableDialog *expandable_dialog = expandable_dialog_create("Expandable Dialog");
Dialog *dialog = exp... | (dialog, "Look mah, no scroll!") | ;
dialog_set_background_color(dialog, GColorLightGray);
dialog_show_status_bar_layer(dialog, true);
expandable_dialog_show_action_bar(expandable_dialog, true);
app_expandable_dialog_push(expandable_dialog);
}
////////////////////////////////
// Voice Dialog
static void prv_transcription_dialog_cb(void *contex... |
tings_display_calibration.h"
#include "kernel/event_loop.h"
#include "kernel/ui/modals/modal_manager.h"
#include "mfg/mfg_info.h"
#include "mfg/mfg_serials.h"
#include "resource/resource_ids.auto.h"
#include "services/common/i18n/i18n.h"
#include "services/common/new_timer/new_timer.h"
#include "shell/prefs.h"
#include... | shell_prefs_should_prompt_display_calibration() | ) {
s_timer = new_timer_create();
const uint32_t prompt_delay_time_ms = MS_PER_SECOND * SECONDS_PER_MINUTE;
new_timer_start(s_timer, prompt_delay_time_ms, prv_timer_callback, NULL, 0 /* flags */);
}
}
#endif
|
_i(1, current_stack);
cl_assert_equal_p(a, stack[0]);
cl_assert_equal_p(ab, stack[1]);
// not necessary to free memory on unit tests
}
void test_layer__is_ancestor(void) {
Layer parent, child_a, child_b, child_c;
Layer *layers[] = {&parent, &child_a, &child_b, &child_c};
for (int i = 0; i < ARRAY_LENGTH(l... | GRect(2, 2, 6, 6) | );
layer_add_child(&parent, &child_a);
layer_add_child(&child_a, &child_b);
layer_set_contains_point_override(&child_b, prv_override_layer_contains_point);
cl_assert_equal_p(layer_find_layer_containing_point(&child_b, &GPoint(9, 9)), &child_b);
cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GP... |
izerState_Possible;
updated = false;
new_state = RecognizerState_Started;
recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touchdown });
cl_assert_equal_i(last_touch_event.type, TouchEvent_Touchdown);
cl_assert_equal_b(updated, true);
cl_assert_equal_i(rec_event, RecognizerEvent_Started);... | recognizer_set_simultaneous_with(r1, prv_simultaneous_with_cb) | ;
cl_assert(!recognizer_should_evaluate_simultaneously(NULL, NULL));
cl_assert(!recognizer_should_evaluate_simultaneously(r1, NULL));
cl_assert(!recognizer_should_evaluate_simultaneously(NULL, r2));
cl_assert(!recognizer_should_evaluate_simultaneously(r1, r2));
s_simultaneous = true;
cl_assert(!recognizer_... |
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2);
... | (complex != NULL) | ;
animation_set_handlers(complex, handlers, complex);
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(complex);
// -------------------------------------------------------------------------------------
// Start A
prv_advance_to_ms_with_timers(start_ms + 1);
cl_asser... |
}
// See if this subscriber wants these types of events
switch (event.event_type) {
case HRMEvent_BPM:
if (!(state->features & HRMFeature_BPM)) {
continue;
}
break;
case HRMEvent_LEDCurrent:
if (!(state->features & HRMFeature_LEDCurrent)) {
con... | HRM_HEXDUMP(data->ppg_data.ppg, data->ppg_data.num_samples * sizeof(uint16_t)) | ;
HRM_LOG("TIA samples: %d", data->ppg_data.num_samples);
HRM_HEXDUMP(data->ppg_data.tia, data->ppg_data.num_samples * sizeof(uint16_t));
HRM_LOG("Accel samples: %"PRIu32, data->accel_data.num_samples);
HRM_LOG("LED %"PRIu16"uA, TIA: %"PRIu16, data->led_current_ua, data->tia);
time_t utc_now = rtc_get_time()... |
ut_attempts-- > 0) && (bus->busy));
bus->busy = false;
return (timeout_attempts != 0);
}
static void semaphore_give(I2cBus *bus) {
}
/*-------------------BUS/PIN CONFIG FUNCTIONS--------------------------*/
//! Configure bus power supply control pin as output
//! Lock bus and peripheral config access before conf... | I2C_Init(i2c_buses[bus_idx].i2c, &i2c_init_struct) | ;
I2C_Cmd(i2c_buses[bus_idx].i2c, ENABLE);
}
//! Configure the bus pins, enable the peripheral clock and initialize the I2C peripheral.
//! Always lock the bus and peripheral config access before enabling it
static void bus_enable(uint8_t bus_idx) {
// Don't power up rail if the bus is already in use (enable can 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... | PBL_LOG(LOG_LEVEL_INFO, "LSE oscillator started after %d ms", i) | ;
break;
}
delay_us(1000);
watchdog_feed();
}
if (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) {
PBL_LOG(LOG_LEVEL_ERROR, "LSE oscillator did not start");
}
}
}
bool clocksource_is_lse_started(void) {
return (RCC_GetFlagStatus(RCC_FLAG_LSERDY) != RESET);
}
void clockso... |
succeeded, void *cb_data) {
NotificationWindowData *window_data = (NotificationWindowData*) cb_data;
window_data->window_frozen = false;
if (s_in_use && succeeded) {
prv_pop_notification_window(window_data);
}
}
static void prv_dismiss_all(void *data, ActionMenu *action_menu) {
NotificationWindowData *wi... | (peek_up, swap_up, NULL) | ;
AnimationHandlers anim_handlers = {
.started = NULL,
.stopped = prv_peek_anim_stopped,
};
animation_set_handlers(spawn, anim_handlers, data);
// move the icon to where it should be in the swap_layer's notification_layout
PeekLayer *peek_layer = data->peek_layer;
GRect frame = peek_layer->layer.fr... |
10, 15)
#define CENTER_OF_OFFSET_RECT_NXNY GPoint(0, 5)
void test_graphics_stroke_circle_${BIT_DEPTH_NAME}__offset_layer_aa(void) {
#if SCREEN_COLOR_DEPTH_BITS == 8
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Big circles
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, S... | (&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.