prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
s, sessions[i].active_calories,
sessions[i].distance_mm);
}
printf("\nLooking for: type: %d, start_utc: %d, len: %"PRIu16", steps: %"PRIu16", "
"rest_cal: %"PRIu32", active_cal: %"PRIu32", dist: %"PRIu32" ",
(int)exp_session->activity, (int)exp_session->start_utc,
exp_session->... | (filename, "a") | ;
cl_assert(file);
}
// Write out the column values for each row
StatsRow *row = s_stat_rows;
int row_idx = 0;
for (; row != NULL; row = (StatsRow *)row->node.next, row_idx++) {
fprintf(file, "\"%s\"", test_name);
StatsEpochType epoch_type;
if (!is_stepping) {
epoch_type = StatsEpochTyp... |
tic void prv_put_analytics_event(VoiceUiData *data, bool success) {
size_t response_size = 0;
uint16_t response_len_chars = 0;
if (data->message) {
// If an error occurred and the owner of the voice window did not specify a buffer,
// data->message might be NULL
response_size = strlen(data->message);
... | {
prv_set_mic_window_state(data, StateError);
ExpandableDialog *long_error_dialog = &data->long_error_dialog;
expandable_dialog_init(long_error_dialog, "Error");
Dialog *dialog = expandable_dialog_get_dialog(long_error_dialog);
const GColor dialog_bg_color = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite);
... |
static void prv_push_final_error_dialog(VoiceUiData *data) {
prv_push_error_dialog(data, i18n_noop("Dictation is not available."),
RESOURCE_ID_GENERIC_WARNING_LARGE, GColorRed);
}
static void prv_show_error_dialog(VoiceUiData *data, const char *msg) {
if (data->show_error_dialog) {
if... |
{
SmartstrapConnectionState *state = app_state_get_smartstrap_state();
if (!state->is_initialized) {
return;
}
state->is_initialized = false;
event_service_client_unsubscribe(&state->event_info);
sys_smartstrap_unsubscribe();
} |
#endif
// Internal APIs
////////////////////////////////////////////////////////////////////////////////
void app_smartstrap_cleanup(void) {
#if USE_SMARTSTRAP
prv_state_deinit();
#endif
}
// Exported APIs
////////////////////////////////////////////////////////////////////////////////
SmartstrapResult app_sma... | |
lags = 0,
.layout = LayoutIdTest,
}
},
{
.header = {
.id = {0xcc},
.timestamp = 14000,
.duration = 30,
.type = TimelineItemTypePin,
.flags = 0,
.layout = LayoutIdTest,
}
},
{
.header = {
.id = {0xdd},
.timestamp = 16000,
.duration = 30,... | (timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture,
1421178000), 0) | ;
cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id));
// check second
cl_assert(iter_next(&iterator));
cl_assert(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));
/... |
lient_reset_complete->payload) =
(const PPoGATTResetCompleteClientIDPayloadV1) {
.ppogatt_max_rx_window = s_rx_window_size,
.ppogatt_max_tx_window = s_tx_window_size,
};
}
}
static void prv_receive_reset_request(BLECharacteristic characteristic) {
ppogatt_handle_read_or_notification(charact... | free(packet) | ;
}
// Tests
///////////////////////////////////////////////////////////
void test_ppogatt__initialize(void) {
s_ppogatt_version = USE_PPOGATT_VERSION;
s_tx_window_size = 25;
s_rx_window_size = 25;
prv_create_expected_reset_request();
prv_create_expected_reset_complete();
s_mtu_size = MTU_SIZE;
fake_pbl... |
rotection_flag() {
uint8_t flag_status_register = prv_flash_get_register(FLASH_CMD_READ_FLAG_STATUS_REG);
// assert if we found the flag to be enabled
PBL_ASSERTN(!(flag_status_register & N25QFlagStatusBit_SectorLockStatus));
}
// This will clear the protection flag error from a previous error.
// We call this b... | (buffer, buffer_size) | ;
do_dma_transfer();
disable_flash_dma_clock();
}
flash_end_cmd();
disable_flash_spi_clock();
power_tracking_stop(PowerSystemFlashRead);
flash_unlock();
}
void flash_write_bytes(const uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) {
if (!buffer_size) {
return;
}
PBL_ASSERTN... |
cl_assert_equal_i(e, BTErrnoOK);
fake_event_clear_last();
fake_kernel_malloc_mark();
// Subscribe again:
e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications,
GAPLEClientKernel);
cl_assert_equal_i(e, BTErrnoInvalidState);
fake_kernel... | prv_confirm_cccd_write(BLEGATTErrorSuccess) | ;
prv_assert_subscription_event(characteristic, BLESubscriptionIndications, BLEGATTErrorSuccess,
true /* kernel */, false /* app */);
}
void test_gatt_client_subscriptions__subscribe_not_first_subscriber(void) {
BLECharacteristic characteristic = prv_get_indicatable_characteristic();
// Subscr... |
888, 288, -112},
{ -1440, 200, -16},
{ -1504, 336, -96},
{ -1304, 240, -200},
{ -1376, 232, -184},
{ -1016, 184, -376},
{ -704, 32, -272},
{ -568, 120, -320},
{ -560, 208, -312},
// 107 seconds
{ -624, 208, -288},
{ -672, 240, -256},
{ -768, 304, -328},
{ -888, 280, -... | { -1160, 392, -112},
{ -1232, 416, -48},
{ -1088, 360, 64},
{ -872, 272, 64},
{ -720, 128, 144},
{ -608, 120, 128},
{ -536, 48, 128},
{ -488, -40, 136},
{ -496, 8, 120},
{ -856, 88, 72},
{ -1096, -16, 160},
{ -1216, 144, -8},
{ -1568, 160, 64},
{ -1304, 320, -72},... |
{ -816, 168, 80},
{ -880, 96, 72},
{ -872, 112, -40},
{ -1456, 136, -8},
{ -1568, 320, -40},
{ -1088, 272, -160},
{ -1080, 176, -128},
{ -968, 240, -216},
// 115 seconds
{ -768, 288, -160},
{ -632, 440, -248},
{ -568, 344, -192},
{ -592, 400, -192},
{ -688, 400, ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | reboot_reason_get(&reason) | ;
bool show_reset_alert = !reason.restarted_safely;
s_last_reboot_reason_code = reason.code;
// We're out of flash space, scrape a few bytes back!
static const char* rebooted_due_to = " rebooted due to ";
const char* restarted_safely_string = "Safely";
if (!reason.restarted_safely) {
restarted_safely_... |
service records persist. When the app is relaunched again,
// a new service will get added again. The old one remains when it was killed through Xcode
// before. The old one seems to go away *after* the new one gets added in the crash scenario.
PPoGATTClient *existing_client = prv_find_client_with_uuid(&me... | prv_delete_client(client, false /* is_disconnected */, DeleteReason_MetaDataReadFailure) | ;
}
}
bt_unlock();
}
// -------------------------------------------------------------------------------------------------
bool ppogatt_can_handle_characteristic(BLECharacteristic characteristic) {
bt_lock();
bool can_handle = (prv_find_client_with_characteristic(characteristic, NULL) != NULL);
bt_unlock... |
n_offset_y = 2;
#endif
GTextNodeCustom *battery_icon_node =
graphics_text_node_create_custom(prv_battery_icon_node_draw_cb, structured_glance);
// Push the battery icon down to center it properly
battery_icon_node->node.offset.y += subtitle_icon_offset_y;
// Achieves the design spec'd 6 px horizontal sp... | snprintf(settings_glance->battery_percent_text, battery_percent_text_size, "%"PRIu8"%%",
settings_glance->glance_state.battery_charge_state.charge_percent) | |
/*
* 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_data->result_text, "Press SELECT to start") | ;
text_layer_set_overflow_mode(app_data->result_text, GTextOverflowModeWordWrap);
text_layer_set_text_alignment(app_data->result_text, GTextAlignmentCenter);
layer_add_child(window_layer, text_layer_get_layer(app_data->result_text));
}
static void prv_window_unload(Window *window) {
AppData *app_data = window_... |
2},
{ -184, 112, -1048},
{ -200, 104, -1024},
{ -192, 104, -928},
{ -184, 152, -912},
{ -160, 168, -1008},
{ -240, 408, -888},
{ -208, 296, -904},
{ -232, 216, -960},
{ -232, 256, -976},
{ -160, 88, -984},
{ -112, 72, -1064},
{ -168, 176, -1072},
{ -192, 200, -1008},
... | { -104, 936, -64},
{ -104, 928, -72},
{ -104, 928, -72},
{ -104, 936, -64},
// 223 seconds
{ -104, 936, -72},
{ -104, 928, -64},
{ -104, 928, -64},
{ -104, 928, -64},
{ -104, 928, -64},
{ -104, 936, -56},
{ -104, 928, -64},
{ -104, 928, -64},
{ -104, 928, -64},
... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_assert_held_by_curr_task((PebbleMutex *) handle, is_held, saved_lr) | ;
}
PebbleRecursiveMutex * mutex_create_recursive(void) {
LightMutexHandle_t freertos_mutex = xLightMutexCreateRecursive();
OS_ASSERT(freertos_mutex != NULL);
PebbleRecursiveMutex * mutex = (PebbleRecursiveMutex *)create_pebble_mutex(freertos_mutex);
return mutex;
}
void mutex_lock_recursive(PebbleRecursiveM... |
/*
* 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 (watchfaces_glance) {
kino_reel_destroy(watchfaces_glance->icon);
} |
app_free(watchfaces_glance);
}
static void prv_update_active_watchface_title(LauncherAppGlanceWatchfaces *watchfaces_glance) {
const AppInstallId selected_watch_id = watchface_get_default_install_id();
AppInstallEntry entry;
if (app_install_get_entry_for_install_id(selected_watch_id, &entry)) {
const siz... |
{
persist_service_unlock_store(*store);
}
#define LOCK_AND_GET_STORE(name) \
SettingsFile *name __attribute__((cleanup(prv_unlock))) \
= prv_lock_and_get_store()
DEFINE_SYSCALL(bool, persist_exists, const uint32_t key) {
LOCK_AND_GET_STORE(store);
return settings_file_exists(store, &key, sizeof(key));
... | {
syscall_failed();
} | |
APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
PWR_BackupAccessCmd(ENABLE); // Disable write-protect on RTC_BKP_x registers
}
void boot_main(void) {
prv_configure_system_flash();
prv_enable_backup_access();
dbgserial_init();
prv_print_reset_reason();
boot_bit_init();
if (!rtc_init()) {
// Need t... | {
check_update_fw();
} |
if (prv_check_and_increment_reset_loop_detection_bits()) {
prv_sad_watch(ERROR_RESET_LOOP);
}
watchdog_init();
#ifndef NO_WATCHDOG
watchdog_start();
#endif
prv_jump_to_fw();
}
|
ding error from breaking the scanline when angles are on same side but
// in reversed order (scanline first hits end angle then hits start angle
const bool ignore_close_angles = (angle_end - angle_start > (TRIG_MAX_ANGLE / 2));
// Clipping insets to prevent negative values
radius_inner_x.raw_value = MAX(radi... | (adjusted_bottom, clip_box.origin.y + clip_box.size.h) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
RTC_WriteBackupRegister(MAG_Z_CORRECTION_VAL, 0x0);
s_saved_corr_present = false;
} |
static void prv_save_calibration_values(int16_t *corr) {
// first zero out the valid marker
prv_reset_saved_sample();
uint32_t valxy = (((uint32_t)corr[1]) << BITS_PER_CORRECTION_VAL) |
(corr[0] & CORRECTION_VAL_MASK);
uint32_t valz = (((uint32_t)VALID_CORR_MARKER) << BITS_PER_CORRECTION_VAL) |
(... |
n an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "clar.h"
#include "applib/graphics/gtypes.h"
#include "kernel/events.h"
#include "services/common/touch/... | cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT) | ;
cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable);
touch_event = touch_event_queue_get_event(1, 0);
prv_test_touch_event(touch_event, 1, TouchEvent_Liftoff, &GPointZero, 0, 0, &GPoint(1, 13),
3686401, 0, true);
}
void test_touch__handle_update_liftoff_null_pos(void) ... |
state->prev_resting_calories;
const uint32_t active_calories = activity_metrics_prv_get_active_calories();
m_rec->active_calories = active_calories - s_alg_state->prev_active_calories;
const uint32_t distance_mm = activity_metrics_prv_get_distance_mm();
const uint32_t minute_distance_mm = distance_mm - s_alg_... | activity_metrics_prv_get_distance_mm() | ;
prv_unlock();
return true;
}
// ------------------------------------------------------------------------------------
void activity_algorithm_enable_activity_tracking(bool enable) {
if (!activity_tracking_on()) {
return;
}
if (!prv_lock()) {
return;
}
kalg_enable_activity_tracking(s_alg_state-... |
/*
* 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... | utf8_iter_init(&utf8_iter, &utf8_iter_state, &utf8_bounds, utf8_bounds.start) | |
(time_t* out_seconds, uint16_t* out_ms) {
*out_seconds = 0;
*out_ms = 0;
}
void vPortEnterCritical(void) {
}
void vPortExitCritical(void) {
}
bool s_in_critical_section;
bool vPortInCritical(void) {
return s_in_critical_section;
}
BaseType_t xTaskGetSchedulerState(void) {
return taskSCHEDULER_RUNNING;
}
/... | (LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestB") | |
89, 69},
{ 1008, 377, 93},
{ 984, 286, 142},
{ 900, 234, 126},
{ 841, 179, 148},
{ 828, 146, 178},
{ 808, 127, 182},
{ 772, 152, 190},
{ 932, 190, 217},
{ 1140, 193, 260},
{ 1222, 241, 204},
{ 1413, 260, 229},
{ 1215, 346, 30},
{ 1009, 476, -202},
{ 936, 360, -88}... | { 776, 148, 164},
{ 775, 161, 157},
{ 960, 157, 197},
{ 1137, 169, 164},
{ 1270, 225, 113},
{ 1494, 217, 193},
{ 1128, 324, -38},
{ 1015, 443, -237},
{ 950, 263, 12},
{ 961, 193, 136},
{ 878, 164, 108},
{ 787, 228, 77},
{ 755, 281, 105},
{ 789, 352, 57},
{ 794... |
{ 889, 333, -29},
{ 1132, 351, -31},
{ 1275, 429, -32},
{ 1222, 462, -17},
{ 1352, 589, -57},
{ 1253, 575, -12},
{ 1327, 465, 73},
{ 1291, 417, 109},
{ 1198, 320, 189},
{ 987, 256, 190},
{ 899, 218, 167},
{ 883, 199, 190},
{ 860, 181, 209},
{ 774, 139, 194},
... |
-------------------------------------------------------------------------------------------
bool animation_set_handlers(Animation *animation_h, AnimationHandlers handlers,
void *context) {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
if (animation_private_using_l... | animation_private_using_legacy_2(state) | ) {
// We need to enable other applib modules like scroll_layer, menu_layer, etc. which are
// compiled to use the 3.0 animation API to work with 2.0 apps.
animation_legacy2_set_delay((AnimationLegacy2 *)animation_h, delay_ms);
return true;
}
AnimationPrivate *animation = prv_find_animation_by_hand... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | list_pop_head(&s_subscribe_head->node) | ;
}
|
_max;
int16_t num_headings;
HealthDetailHeading headings[MAX_NUM_HEADINGS];
int16_t num_subtitles;
HealthDetailSubtitle subtitles[MAX_NUM_SUBTITLES];
int16_t num_zones;
HealthDetailZone zones[MAX_NUM_ZONES];
} HealthSleepDetailCardData;
static void prv_set_sleep_session(char *buffer, size_t buffer_size,... | app_zalloc_check(buffer_len) | ,
.fill_color = PBL_IF_COLOR_ELSE(GColorCobaltBlue, GColorWhite),
#if PBL_BW
.outline_color = GColorBlack,
#endif
};
prv_set_deep_sleep(heading->primary_value, buffer_len,
health_data_current_deep_sleep_get(health_data), card_data);
HealthDetailSubtitle *subtitle = &card_data->subti... |
auctor, turpis at cras "
"amet.";
_Static_assert(sizeof(lipsum) > PERSIST_STRING_MAX_LENGTH,
"lipsum string is not long enough for persist tests");
void test_persist__initialize(void) {
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
persist_service_init();
persist_service_client_open(&... | (persist_write_int(0, 0)) | );
cl_assert_equal_i(persist_delete(0), S_TRUE);
cl_assert_equal_i(persist_delete(0), E_DOES_NOT_EXIST);
}
/*
* Confirm that fields can be reassigned values.
*/
void test_persist__overwrite(void) {
const uint32_t key = 0;
cl_assert_equal_i(persist_write_int(key, 1), sizeof(int));
cl_assert_equal_i(persist_... |
larCache s_test_cache;
static TestCacheItem s_cache_buffer[NUM_TEST_ITEMS];
static TestCacheItem s_test_item[NUM_TEST_ITEMS] = {
{ .id = 1, .freed = &s_free_flags[0] },
{ .id = 2, .freed = &s_free_flags[1] },
{ .id = 3, .freed = &s_free_flags[2] },
};
static const TestCacheItem ZERO_ITEM = {};
static voi... | circular_cache_fill(&s_test_cache, (uint8_t *)&s_test_item[1]) | |
ts
health_service_events_subscribe(prv_health_event_handler, data);
// Set a heart rate alert
HealthMetricAlert *alert = health_service_register_metric_alert(HealthMetricHeartRateBPM, 80);
APP_LOG(APP_LOG_LEVEL_INFO, "health metric alert: %p", alert);
if (alert == NULL) {
prv_display_alert("Can't registe... | (data->steps_window, true /* Animated */) | ;
}
// -------------------------------------------------------------------------------
static void prv_hr_down_click_handler(ClickRecognizerRef recognizer, void *context) {
HealthAPITestAppData *data = (HealthAPITestAppData *)context;
window_stack_pop(true);
window_stack_push(data->sleep_window, true /* Animate... |
ng permissions and
* limitations under the License.
*/
#include "drivers/accessory.h"
#include "services/common/new_timer/new_timer.h"
#include "services/normal/accessory/accessory_manager.h"
#include "services/normal/accessory/smartstrap_attribute.h"
#include "services/normal/accessory/smartstrap_comms.h"
#include ... | smartstrap_state_unlock() | |
state->error->status = TemplateStringErrorStatus_InvalidTimeUnit;
return 0;
}
state->position++;
total_value += value * multiplier;
total_value_valid = true;
}
if (negative) {
total_value = -total_value;
}
return total_value;
}
T_STATIC bool prv_template_predicate_match(Te... | (state->output, len + 1, fmt, value) | |
/*
* 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 true;
} |
void bt_driver_hrm_service_enable(bool enable) {
hc_endpoint_hrm_enable(enable);
}
void bt_driver_hrm_service_handle_measurement(const BleHrmServiceMeasurement *measurement,
const BTDeviceInternal *permitted_devices,
size_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... | memcmp(&null_addr, &s_local_address, sizeof(s_local_address)) | ) {
sniprintf(addr_hex_str_out, BT_DEVICE_ADDRESS_FMT_BUFFER_SIZE,
BD_ADDR_FMT, BT_DEVICE_ADDRESS_XPLODE(s_local_address));
} else {
sniprintf(addr_hex_str_out, BT_DEVICE_ADDRESS_FMT_BUFFER_SIZE, "Unknown");
}
}
void bt_local_id_copy_address_mac_string(char addr_mac_str_out[BT_DEVICE_ADDRESS_... |
_p(context, &s_context);
return (value > 0);
}
void test_stats__filtered_count(void) {
const int32_t data[] = { 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0 };
const size_t num_data = ARRAY_LENGTH(data);
const StatsBasicOp op = StatsBasicOp_Count;
int32_t result;
stats_calculate_basic(op, ... | (result.sum, 0) | ;
cl_assert_equal_i(result.avg, 0);
cl_assert_equal_i(result.min, INT32_MAX);
cl_assert_equal_i(result.max, INT32_MIN);
cl_assert_equal_i(result.count, 0);
cl_assert_equal_i(result.max_streak, 0);
cl_assert_equal_i(result.first_streak, 0);
cl_assert_equal_i(result.median, 0);
}
void test_stats__all_basic... |
rev_rel_bar_anim) {
// Delay to avoid overlapping moving icon with bars
animation_set_delay(prev_rel_bar_anim, 0);
animation_set_duration(prev_rel_bar_anim, duration / 3);
}
return prev_rel_bar_anim;
}
#define REL_BAR_CURR_OVERLAP_START_OFFSET 10
#define REL_BAR_CURR_ANIM_DELAY(delay) ((2 * delay) / 3... | grect_get_max_y(&first_icon_frame) | |
rect_clipper->size.h;
rect_to_clip->size.h = 0;
}
overflow = rect_to_clip->origin.y + rect_to_clip->size.h - (rect_clipper->origin.y + rect_clipper->size.h);
if (overflow > 0) {
rect_to_clip->size.h -= overflow;
}
}
GRect grect_union(const GRect *r1, const GRect *r2) {
GRect s_r1 = *r1;
GRect s_r2 ... | grect_inset(rect,
(GEdgeInsets) {.top = dy, .right = dx, .bottom = dy, .left = dx}) | ;
}
GRect grect_inset(GRect r, GEdgeInsets insets) {
grect_standardize(&r);
const int16_t new_width = r.size.w - insets.left - insets.right;
const int16_t new_height = r.size.h - insets.top - insets.bottom;
if (new_width < 0 || new_height < 0) {
return GRectZero;
}
return GRect(r.origin.x + insets.left... |
GPoint(offset, mask));
// Top-right quadrant
graphics_draw_pixel(ctx, GPoint(mask, layer->bounds.size.h - offset - 1));
graphics_draw_pixel(ctx, GPoint(layer->bounds.size.w - offset - 1, mask));
// Bottom-left quadrant
graphics_draw_pixel(ctx, GPoint(layer->bounds.size.w - mask - 1, offset));
gr... | app_window_stack_push(&app_data->results_window, false) | |
/*
* 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... | text_layer_create(window_bounds) | ;
text_layer_set_text(text_layer, "Unplug and plug in the charger. You will see that the system cannot keep up with it.");
layer_add_child(window_layer, text_layer_get_layer(text_layer));
text_layer = text_layer_create((GRect) {{ 0, window_bounds.size.h / 2 }, window_bounds.size} );
static char buffer[80];
s... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ARRAY_LENGTH(mask_colors) | ;
const int16_t shape_width =
(int16_t)(MIN(layer_bounds.size.w, layer_bounds.size.h) / 2);
const GSize shape_size = GSize(shape_width, shape_width);
for (unsigned int i = 0; i < num_mask_levels; i++) {
// Calculate the angle of the mask shape using the current animation progress
// Offset the angle... |
, ICE40LP->spi.rcc_bit);
// Configure CR1 first:
// * TX-only mode (BIDIMODE | BIDIOE)
// * software control NSS pin (SSM | SSI)
// * master mode (MSTR)
// * clock polarity high / 2nd edge (CPOL | CPHA)
ICE40LP->spi.periph->CR1 = SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE | SPI_CR1_SSM | SPI_CR1_SSI |
... | gpio_output_set(&ICE40LP->spi.scs, true) | |
----------------------------------------------------------------------------
// Takes care of updating the history when we reach midnight as well as checking for changes in
// sleep state. Returns true if the sleep metrics were updated
// We use NOINLINE to reduce the stack requirements during the minute handler (see P... | (rtc_get_time()) | ,
.num_samples = data->run_size,
};
if (data->first_record) {
data->record.flags |= ACTIVITY_RAW_SAMPLE_FLAG_FIRST_RECORD;
data->first_record = false;
}
}
if (finish) {
// Finishing up an existing record?
if (data->run_size > 0) {
// We started a ru... |
config_register(0);
// Releases the lock that was previously aquired in pmic_enable_battery_measure.
prv_mon_config_unlock();
return result;
}
uint16_t pmic_get_vsys(void) {
prv_mon_config_lock();
const PmicMonConfig *mon_config = &MON_CONFIG[PMIC_MON_CONFIG_VSYS_INDEX];
prv_set_mon_config(mon_config);
... | {
prv_clear_any_pending_interrupts();
++s_interrupt_bounce_count;
new_timer_start(s_debounce_usb_conn_timer, USB_CONN_DEBOUNCE_MS, prv_debounce_callback,
NULL, 0 /*flags*/);
} |
static void pmic_interrupt_handler(bool *should_context_switch) {
system_task_add_callback_from_isr(prv_handle_pmic_interrupt, NULL, should_context_switch);
}
/* Private Function Implementations */
static bool prv_is_alive(void) {
uint8_t val;
prv_read_register(0x00, &val);
if (val == 0x01) {
PBL_LOG(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... | {
return;
} |
*buffer++ = '0';
*buffer++ = 'x';
for (int i = 7; i >= 0; --i) {
uint32_t digit = (num & (0xf << (i * 4))) >> (i * 4);
char c;
if (digit < 0xa) {
c = '0' + digit;
} else if (digit < 0x10) {
c = 'a' + (digit - 0xa);
} else {
c = ' ';
}
*buffer++ = c;
}
*buffer ... |
gth + dot_padding;
// Bar 1
// Filled rect used to draw line of REL_BAR_LINE_WIDTH stroke width
graphics_context_set_fill_color(ctx, GColorWhite);
GRect layer_bounds = timeline_layer->layer.bounds;
GRect line;
line.origin.x = layer_bounds.origin.x + layer_bounds.size.w - REL_BAR_LINE_HORIZ_OFFSET;
// Acc... | graphics_fill_rect(ctx, ¬ch) | ;
// Draw up
line2_start.x = line1_start.x + REL_BAR_OVERLAP_LINE2_HORIZ_OFFSET;
line2_start.y = second_icon_frame.origin.y - REL_BAR_VERT_MARGIN - y_offset -
REL_BAR_LINE_WIDTH;
graphics_fill_rect(ctx, &GRect(line2_start.x, line2_start.y,
REL_BAR_OVERLAP_STRO... |
}
void spi_ll_slave_burst_read_write(const SPISlavePort *slave,
const void *out,
void *in,
size_t len) {
PBL_ASSERTN(slave->slave_state->initialized);
PBL_ASSERTN(slave->slave_state->acquired);
const uint8_t... | (slave->spi_bus, SpiI2sDma_ReqTx, false) | ;
slave->slave_state->dma_complete_handler = NULL;
slave->slave_state->dma_complete_context = NULL;
}
void spi_ll_slave_read_write_dma_start(const SPISlavePort *slave, const void *out, void *in,
size_t len, SPIDMACompleteHandler handler, void *context) {
PBL_ASSERTN(slave->... |
/*
* 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... | (testbuf+4, 5, 4) | ;
cl_assert_equal_m(testbuf, expectbuf, 8);
}
void test_memset__big_value(void) {
uint8_t testbuf[8] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, };
uint8_t expectbuf[8] = { 5, 5, 5, 5, 5, 5, 5, 5, };
memset(testbuf, 0xF05, 8);
cl_assert_equal_m(testbuf, expectbuf, 8);
}
|
t_mic_window_state(data, StateTransitionToText);
}
prv_set_mic_window_state(data, StateTransitionToText);
} else {
prv_handle_dictation_error(data, event->status);
}
break;
}
case VoiceStatusErrorConnectivity:
prv_show_connectivity_error_and_exit(data);
bre... | if (data->state != StateStartWaitForReady) {
// This is a bit of a hack to prevent jumps in the fly in animation when a session fail comes
// back quickly
prv_set_mic_window_state(data, StateWaitForReady);
} | |
pp_idle_timeout.h"
#include "services/normal/notifications/do_not_disturb.h"
#include "services/normal/notifications/alerts_private.h"
#include "applib/ui/kino/kino_layer.h"
#include "system/passert.h"
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
typedef struct LauncherMenuData {
... | if (app_install_entry_is_watchface(entry)
|| app_install_entry_is_hidden((entry))) {
return false; // Skip watchfaces and hidden apps
} |
return true;
}
static void prv_data_changed(void *context) {
LauncherMenuData *data = context;
menu_layer_reload_data(&data->menu_layer);
}
//////////////
// MenuLayer callbacks
static void select_callback(MenuLayer *menu_layer, MenuIndex *cell_index,
LauncherMenuData *data) {
Ap... |
/*
* 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... | {
// clz stands for Count Leading Zeroes. We use it to find the MSB
int msb = 31 - __builtin_clz(n);
// popcount counts the number of set bits in a word (1's)
bool power_of_two = __builtin_popcount(n) == 1;
// if not exact power of two, use the next power of two
// we want to err on the side of ... |
//! newton's method for floor(sqrt(x)) -> should always converge
int32_t integer_sqrt(int64_t x) {
if (x < 0) {
return 0;
}
int64_t last_res = 0x3fff;
uint16_t iterations = 0;
while ((last_res > 0) && (iterations < 15)) {
last_res = ((x / last_res) + last_res)/2;
iterations++;
}
return (last... |
/*
* 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 (!level || !child || !label ||
(level->num_items >= level->max_items)) {
return NULL;
}
child->parent_level = level;
ActionMenuItem *item = &level->items[level->num_items];
*item = (ActionMenuItem) {
.label = label,
.next_level = child,
};
++level->num_items;
return item;
} |
// Hierarchy
/////////////////////////////////
static void prv_cleanup_helper(const ActionMenuLevel *level,
ActionMenuEachItemCb each_cb,
void *context) {
for (int i = 0; i < level->num_items; ++i) {
const ActionMenuItem *item = &level->items[i];
... |
prv_cancel_selection_animation(menu_layer) :
false;
return (MenuLayerBeforeSelectionChangeState) {
.was_animating = was_animating,
.prev_selection = menu_layer->selection,
};
}
void menu_layer_set_selected_index(MenuLayer *menu_layer, MenuIndex index, MenuRow... | prv_capture_state_and_cancel_center_focus_animation(menu_layer) | ;
MenuSelectNextIterator it = {
.it = {
.menu_layer = menu_layer,
.row_callback_after_geometry = prv_menu_layer_iterator_selection_next_callback,
.section_callback = prv_menu_layer_iterator_noop_callback,
.should_continue = true,
.cursor = menu_layer->selection,
},
.count = ... |
her_app_glance_update_current_slice(glance_in_cache);
// If necessary, update the slice expiration timer with the updated current slice
prv_update_slice_expiration_timer_if_necessary(service,
glance_in_cache->current_slice.expiration_time);
}
}
////////////... | {
service->handlers = (LauncherAppGlanceServiceHandlers) {};
} | |
nd_set_time(const char *arg) {
time_t t = atoi(arg);
if (t == 0) {
prompt_send_response("Invalid length");
return;
}
prv_update_time_info_and_generate_event(&t, NULL);
char buffer[80];
char time_buffer[26];
prompt_send_response_fmt(buffer, 80, "Time is now <%s>", rtc_get_time_string(time_buffer)... | {
style = FullStyleLower12h;
} | |
Namibia) [Africa/Windhoek]
Rule Namibia 1994 max - Sep Sun>=1 2:00 1:00 S
Rule Namibia 1995 max - Apr Sun>=1 2:00 0 -
Sep 7th 2014 01:00 UTC ~ Apr 5th 2015 00:00 UTC, GMT+1 */
[25]={ 1410051600, 1428192000, 1 * SECONDS_PER_HOUR },
/* Palestine (Gaza/West Bank) [Asia/Gaza... | if (tz_info.dst_end != s_dst_correct_values[dstid][1]) {
printf(" end [%d] tz_info: %ld s_dst_correct_values: %ld\n",
dstid, tz_info.dst_end, s_dst_correct_values[dstid][1]);
} |
cl_check(tz_info.dst_start == s_dst_correct_values[dstid][0]);
cl_check(tz_info.dst_end == s_dst_correct_values[dstid][1]);
}
}
void test_clock__next_monday(void) {
struct tm jan_1 = {
.tm_sec = 0, // 0 seconds after the minute
.tm_min = 0, // 0 minutes after the hour
.tm_hour = 0, // 0 hours... |
rn jerry_create_undefined();
}
void test_rocky_api_util__rocky_add_constructor(void) {
static const RockyGlobalAPI *s_api[] = {
NULL,
};
rocky_global_init(s_api);
JS_VAR prototype = rocky_add_constructor("test", test_func_imp);
cl_assert_equal_b(jerry_value_is_object(prototype), true);
EXECUTE_SCRIPT(... | cl_assert(jerry_get_number_value(result_hours) == 21.0) | ;
cl_assert(jerry_get_number_value(result_date) == 17.0);
jerry_release_value(result_date);
jerry_release_value(result_hours);
jerry_release_value(result_minutes);
jerry_release_value(result_seconds);
jerry_release_value(getDate);
jerry_release_value(getHours);
jerry_release_value(getMinutes);
jerry_... |
l(animation, true, progress);
}
static void prv_center_focus_animation_teardown(Animation *animation) {
// usually a "redundant" call. Just in case the animation gets cancelled before finish
prv_center_focus_animation_update_in_and_out(animation, ANIMATION_NORMALIZED_MAX);
}
static void prv_schedule_center_focus_... | {
prv_announce_selection_changed(menu_layer, prev_selection->index);
} |
}
}
typedef struct {
bool was_animating;
MenuCellSpan prev_selection;
} MenuLayerBeforeSelectionChangeState;
static MenuLayerBeforeSelectionChangeState prv_capture_state_and_cancel_center_focus_animation(
MenuLayer *menu_layer) {
// it's critical to cancel the animation for center focus here so that any ... |
perty_animation_get_animation(data->info_text_in_animation);
animation_set_auto_destroy(animation, false);
animation_set_duration(animation, animation_duration_ms);
animation_set_delay(animation, animation_delay_ms);
// This is the text that is currently visible and animates out of view
data->info_text_out_a... | strlen(data->code_text_layer_buffer) | != 0);
}
static void prv_exit_awaiting_user_confirmation(BTPairingUIData *data) {
// Remove UI components that are not needed any more after the user input confirmation screen:
prv_cleanup_prf_animations(data);
layer_set_hidden(&data->info_text_layer.layer, true);
if (prv_has_device_name(data)) {
layer_r... |
void prv_bus_pins_cfg_input(I2CBus *bus) {
InputConfig in_scl = {
.gpio = bus->scl_gpio.gpio,
.gpio_pin = bus->scl_gpio.gpio_pin,
};
gpio_input_init(&in_scl);
InputConfig in_sda = {
.gpio = bus->sda_gpio.gpio,
.gpio_pin = bus->sda_gpio.gpio_pin,
};
gpio_input_init(&in_sda);
}
//! Power up... | (TOGGLE_DELAY) | ;
if (gpio_input_read(&in_sda)) {
recovered = true;
break;
}
}
if (recovered) {
PBL_LOG(LOG_LEVEL_DEBUG, "I2C Bus %s recovered", slave->bus->name);
} else {
PBL_LOG(LOG_LEVEL_ERROR, "I2C Bus %s still hung after bitbang reset", slave->bus->name);
}
prv_bus_pins_cfg_i2c(slave->bus)... |
LEVEL_INFO, "Size of session %d: %d", i, size);
total_bytes += size;
}
PBL_LOG(LOG_LEVEL_INFO, "total bytes: %d", total_bytes);
cl_assert(total_bytes < DLS_TOTAL_STORAGE_BYTES);
// We should still be able to create more sessions up to the max
for (int i = num_sessions; i < DLS_MAX_NUM_SESSIONS; i++) {
... | {
logging_session = dls_list_get_next(logging_session);
cl_assert(logging_session != NULL);
uint32_t tag = dls_test_get_tag(logging_session);
prv_check_session_data(logging_session, crcs[tag], num_bytes[tag]);
} |
logging_session = dls_list_get_next(logging_session);
cl_assert(logging_session == NULL);
}
void test_data_logging__recover_one(void) {
prv_do_recovery_test(1);
}
void test_data_logging__recover_five(void) {
prv_do_recovery_test(5);
}
// ----------------------------------------------------------------------... |
/*
* 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... | {
// Create a measure log session, which we use to send heart rate readings to the phone
ProtobufLogMeasurementType measure_types[] = {
ProtobufLogMeasurementType_BPM,
ProtobufLogMeasurementType_HRQuality,
};
ProtobufLogConfig log_config = {
.type = ProtobufLogType_Measurements,
.measurements =... |
bool protobuf_log_hr_add_sample(ProtobufLogRef ref, time_t sample_utc, uint8_t bpm,
HRMQuality quality) {
uint32_t values[] = {bpm, prv_hr_quality_int(quality)};
return protobuf_log_session_add_measurements(ref, sample_utc, ARRAY_LENGTH(values), values);
}
|
/*
* 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... | GPIO_Init(FLASH_CONFIG.spi_gpio, &gpio_cfg) | ;
// Configure SCS to be controlled in software; pull up to high when inactive
gpio_cfg.GPIO_Mode = GPIO_Mode_OUT;
gpio_cfg.GPIO_Pin = (1 << FLASH_CONFIG.scs_pin);
gpio_cfg.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(FLASH_CONFIG.spi_gpio, &gpio_cfg);
// Set up a SPI bus on SPI1
SPI_InitTypeDef spi_cfg;
SPI_I... |
!= NULL) {
animation->implementation->teardown(animation->handle);
}
animation->did_setup = false;
}
animation->calling_end_handlers = false;
#ifdef UNITTEST
// Make sure this animation didn't get deleted as a side effect of running the stopped handler
PBL_ASSERTN(list_contains(state->unschedule... | prv_find_animation_by_parent_child_idx(state, animation, child_idx) | ;
if (!child) {
break;
}
uint32_t duration = prv_get_total_duration(state, child, true /*delay*/, true /*play_count*/);
// It is allowed that the first child may have already been scheduled and played a bit. If
// this is the case, backup the start time by reducing delay according... |
ons
static void prv_prepare_for_did_read(SmartstrapAttribute *attribute, uint16_t read_length) {
cl_assert(!s_pending_did_read.active);
s_pending_did_read = (PendingInfo) {
.active = true,
.attribute = attribute,
.length = read_length
};
}
static void prv_did_read_handler(SmartstrapAttribute *attribu... | (attr != NULL) | ;
// verify the ids
cl_assert(app_smartstrap_attribute_get_service_id(attr) == 0x1111);
cl_assert(app_smartstrap_attribute_get_attribute_id(attr) == 0x2222);
// destroy the attribute
app_smartstrap_attribute_destroy(attr);
// verify that we can no longer get the ids
cl_assert(app_smartstrap_attribute_g... |
y(app1.id));
PebbleEvent e = fake_event_get_last();
cl_assert_equal_i(e.type, PEBBLE_APP_CACHE_EVENT);
cl_assert_equal_i(e.app_cache_event.cache_event_type, PebbleAppCacheEvent_Removed);
cl_assert_equal_i(e.app_cache_event.install_id, app1.id);
cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app3.id));
... | (app1.id, app1.size) | |
_mutex);
{
AccelSubscriberState* state = prv_subscriber_state(session);
if (state != NULL) {
// Remove this subscriber and free up it's state variables
accel_remove_consumer(&state->buffer_client);
list_remove(&state->list_node, &s_data_subscribers /* &head */, NULL /* &tail */);
kerne... | {
accel_stop();
} |
}
#endif
// The accelerometer should issue a shake/tap event with any slight movements when stationary.
// This will allow the watch to immediately return to normal mode, and attempt to reconnect to
// the phone.
void accel_enable_high_sensitivity(bool high_sensitivity) {
mutex_lock_recursive(s_mutex);
accel_set_... |
{ .integer = x1 };
Fixed_S16_3 x2_fixed = (Fixed_S16_3) { .integer = x2 };
const uint8_t gradient_width = (uint8_t)((x2 - x1) / 2);
x2_fixed.integer -= gradient_width;
const int16_t clip_box_min_x = ctx->draw_state.clip_box.origin.x;
const int16_t clip_box_max_x = (int16_t)(grect_get_max_x(&ctx->draw_state.... | graphics_context_mask_destroy(ctx, transparent_mask) | |
iance 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 ANY KIND, either e... | (s_kernel_receiver_buffer + s_kernel_receiver_buffer_idx, data, length) | ;
s_kernel_receiver_buffer_idx += length;
cl_assert(s_kernel_receiver_buffer_idx <= MAX_HEADER_SIZE);
}
static void prv_default_kernel_receiver_finish(Receiver *receiver) {
cl_assert_equal_p(receiver, s_kernel_receiver);
s_kernel_receiver_is_receiving = false;
s_kernel_receiver_finish_called = true;
}
stati... |
all circles
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_SMALL);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r1_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_C... | graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_SMALL) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r1_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, STROKE_SMALL);
graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_SMALL);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_... |
NALYTICS_LOG_DEBUG("App Crash event: uuid:%s, pc: %p, lr: %p",
uuid_string, (void *)pc, (void *)lr);
#endif
analytics_logging_log_event(&event_blob);
}
extern bool comm_session_is_valid(const CommSession *session);
// ---------------------------------------------------------------------------... | (&event_blob) | ;
}
// ------------------------------------------------------------------------------------------
void analytics_event_PPoGATT_disconnect(time_t timestamp, bool successful_reconnect) {
AnalyticsEventBlob event_blob = {
.event = AnalyticsEvent_PPoGATTDisconnect,
.ppogatt_disconnect = {
.successful_recon... |
/flash/flash_impl.h"
#include "drivers/gpio.h"
#include "drivers/periph_config.h"
#include "kernel/util/delay.h"
#include "kernel/util/stop.h"
#include "mcu/cache.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/math.h"
#define STM32F4_COMPATIBLE
#define STM32F7_COMPATIBLE
#include <mcu.h>
#i... | {
QUADSPI->CR &= ~QUADSPI_CR_SSHIFT;
} | else {
QUADSPI->CR |= QUADSPI_CR_SSHIFT;
}
}
// CCR register Bits from LSB to MSB
// INSTRUCTION[7:0]: Instruction
// IMODE[1:0]: Instruction Mode
// ADMODE[1:0]: Address Mode
// ADSIZE[1:0]: Address Size
// ABMODE[1:0]: Alternate Bytes Mode
// ABSIZE[1:0]: Instruction Mode
// DCYC[4:0]: Dummy Cycles
// RESERVE... |
imation->values.to.gpoint.y);
((PropertyAnimationImplementation*)
property_animation->animation.implementation)
->accessors.setter.gpoint(property_animation->subject, result);
}
// -----------------------------------------------------------------------------------------
void property_animation_update_grec... | prv_find_property_animation(property_animation_h) | ;
if (!property_animation) {
return;
}
GColor8 result;
result.a = interpolate_int16(
distance_normalized,
property_animation->values.from.gcolor8.a,
property_animation->values.to.gcolor8.a);
result.r = interpolate_int16(
distance_normalized,
property_animation->values.from.g... |
ct prev_bounds = cell_layer->bounds;
GRect new_bounds = prev_bounds;
// Translate the drawing_box to the bounds of the layer:
ctx->draw_state.drawing_box.origin.y += y;
ctx->draw_state.drawing_box.size.h = cursor->h;
// Set the height appropriately on the cell layer
new_bounds.size.h = cursor-... | graphics_context_set_drawing_state(ctx, prev_state) | ;
}
static inline void prv_menu_layer_draw_section_header(MenuLayer *menu_layer, Layer *cell_layer,
MenuCellSpan *cursor, GContext* ctx) {
cell_layer->bounds.size.h = cursor->h;
cell_layer->frame.size.h = cursor->h;
cell_layer->frame.origin.y = cursor->y;
// Callback to get the shared cell instance filled... |
dr.version = PFS_CUR_VERSION;
SET_PAGE_FLAGS(pg_hdr.page_flags,
PAGE_FLAG_START_PAGE | PAGE_FLAG_ERASED_PAGE);
// Note: We have already allocated 1 pg so just subtract 1 to roundup
// We assume all pages are the same size
int pgs_needed = (f->file_size + FILEDATA_LEN + strlen(f->name) - 1) /
free_b... | PFS_FD(fd) | .file.name);
PFS_FD(fd).file.name = NULL;
}
if (PFS_FD(fd).file.pg_cache != NULL) {
kernel_free(PFS_FD(fd).file.pg_cache);
PFS_FD(fd).file.pg_cache = NULL;
PFS_FD(fd).file.pg_cache_len = 0;
}
PFS_FD(fd).fd_status = FD_STATUS_FREE;
return (S_SUCCESS);
}
typedef enum {
FDBusy = 2,
FDAlrea... |
24, 664, 32},
{ 632, 680, 16},
{ 632, 672, 24},
{ 632, 688, 32},
{ 632, 664, 8},
{ 624, 664, 8},
{ 632, 656, 8},
{ 632, 680, 16},
{ 632, 688, 8},
// 104 seconds
{ 632, 672, -8},
{ 624, 672, 0},
{ 640, 672, 0},
{ 624, 672, 0},
{ 624, 656, 8},
{ 632, 696, 0},
... | { 600, 944, -8},
{ 520, 904, 208},
{ 496, 712, 224},
{ 472, 640, 232},
{ 488, 608, 232},
{ 552, 600, 248},
{ 600, 560, 256},
{ 600, 664, 368},
{ 648, 704, 352},
{ 592, 632, 320},
// 110 seconds
{ 552, 784, 464},
{ 536, 672, 496},
{ 512, 672, 464},
{ 576, 712, ... |
{ 184, -136, -880},
{ 184, -136, -936},
{ 192, -168, -984},
{ 168, -160, -984},
{ 128, -184, -944},
{ 136, -184, -944},
{ 144, -208, -960},
{ 168, -200, -952},
{ 184, -232, -936},
{ 192, -232, -928},
{ 184, -216, -952},
{ 184, -232, -968},
{ 176, -248, -944},
{ 1... |
s file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS... | (0, STATUS_BAR_LAYER_HEIGHT) | ,
.right = PBL_IF_RECT_ELSE(0, crumbs_width),
.bottom = PBL_IF_RECT_ELSE(0, STATUS_BAR_LAYER_HEIGHT),
.left = crumbs_width,
};
}
static Animation* prv_create_content_in_animation(ActionMenuData *data,
const ActionMenuLevel *level) {
// animate the ease in of the new level
const GRect win... |
scroll_layer_set_callbacks(scroll_layer, (ScrollLayerCallbacks) {
.content_offset_changed_handler = prv_offset_changed_handler
});
scroll_layer_set_context(scroll_layer, expandable_dialog);
#if PBL_ROUND
scroll_layer_set_paging(scroll_layer, true);
#endif
if (show_action_bar) {
// Icons for up... | window_get_user_data(window) | ;
dialog_unload(&expandable_dialog->dialog);
if (expandable_dialog->show_action_bar) {
action_bar_layer_deinit(&expandable_dialog->action_bar);
}
gbitmap_destroy(expandable_dialog->up_icon);
gbitmap_destroy(expandable_dialog->down_icon);
if (*expandable_dialog->header) {
text_layer_deinit(&expandabl... |
v_metric_aggregation_implemented(metric, time_start, time_end, aggregation, scope)) {
return 0;
}
// Get our state
HealthServiceState *state = prv_get_state(true);
if (scope == HealthServiceTimeScopeOnce && prv_is_heart_rate_metric(metric)) {
return prv_hr_aggregate_averaged(state, metric, time_start,... | 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 one registration per
// metric right now
if (state->cache->alert_threshold_heart_rate.threshold != 0) {
APP_LOG(APP_LOG_LEVE... |
om_op(AlarmId id, AlarmConfig *config, void *context);
// Private globals
static bool s_alarms_enabled = false;
static time_t s_next_alarm_time;
//! This is only valid when s_next_alarm_time is not 0.
static Alarm s_next_alarm;
static CronJob s_next_alarm_cron;
static AlarmId s_most_recent_alarm_id = ALARM_INVALID_ID... | for (int i = 0; i < size / UUID_SIZE; i++) {
Uuid *pinid = (Uuid *) &buffer[UUID_SIZE * i];
if (uuid_is_invalid(pinid)) {
continue;
}
alarm_pin_remove(pinid);
settings_file_delete(fd, &key, sizeof(key));
success = true;
} |
}
}
return success;
}
// ----------------------------------------------------------------------------------------------
//! Converts an alarm's cron time to its actual alarm time.
//! Smart alarms execute earlier than their actual alarm time in order to opportunistically alarm.
static time_t prv_get_alarm_tim... |
viated units
i18n_ctx_noop("TmplStringPlur", " hr")},
/// Singular suffix for hours with full units
{ i18n_ctx_noop("TmplStringSing", " hour"),
/// Plural suffix for hours with full units
i18n_ctx_noop("TmplStringPlur", " hours")},
};
static const char * const s_day_strings[3][2] = {
/// Singular suffi... | if (value < 0) {
prv_append_char(state, '-');
value = -value;
} |
int macro_units = 2;
if (value >= SECONDS_PER_MINUTE) {
macro_units--;
}
if (value >= SECONDS_PER_HOUR) {
macro_units--;
}
int macro_end = 3;
// conversion specifiers
switch (*input) {
#if SUPPORT_YEAR
case 'y': // year
// NOTE: This number of seconds to divide by is a hack! See PBL... |
ise(35, 35)
#define START_ON_ORIGIN_RECT_NXNY GPointPrecise(-5, -5)
#define END_ON_ORIGIN_RECT_NXNY GPointPrecise(15, 15)
void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__origin_layer_aa(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// TODO: Fix offset calculation and reenable this: -... | graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_offset_layer_aa.${BIT_DEPTH_NAME}.pbi"));
// TODO: Fix offset calculation and reenable this: - PBL-16509
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 10);
graphics_line_draw_precise_stroked_aa(&ctx, END_O... |
/*
* 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... | fun(GColorFromHEX(0x0055aa)) | .argb);
cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xff5500)).argb);
cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xaaaaaa)).argb);
// // expectation as derived from Appfaces_generic_colors.psd
cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x0000aa)).argb);
cl_assert_equal_i(GColor... |
if (!(quadrant & radius_quadrants[0])) {
for (int i=QUADRANTS_NUM - 1; i >= 0; i--) {
if (quadrant & radius_quadrants[i]) {
angle_end = ((i + 1) % 4) * (TRIG_MAX_ANGLE / 4);
break;
}
}
} else {
for (int i=1; i <= QUADRANTS_NUM; i++) {
if (!(quadrant & ra... | (ctx, starting_point, half_stroke_width, half_stroke_width,
FIXED_S16_3_ZERO, FIXED_S16_3_ZERO, 0, TRIG_MAX_ANGLE) | ;
prv_fill_oval_precise(ctx, ending_point, half_stroke_width, half_stroke_width,
FIXED_S16_3_ZERO, FIXED_S16_3_ZERO, 0, TRIG_MAX_ANGLE);
}
}
// Restore color
ctx->draw_state.fill_color = tmp_color;
}
void graphics_draw_arc_internal(GContext *ctx, GPoint center, uint16_t rad... |
ot 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 on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR ... | cl_assert_equal_s(str, fp_msg) | ;
pbl_snprintf(str, STR_SIZE, "abc %+d%s", 42, "b");
cl_assert_equal_s(str, "abc +42b");
//----------------------------------------------------
pbl_snprintf(str, STR_SIZE, "abc %lf%s", "a", 1.0, "b");
cl_assert_equal_s(str, fp_msg);
pbl_snprintf(str, STR_SIZE, "abc %ld%s", 42, "b");
cl_assert_equal_s(str... |
the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the speci... | RCC_AHB3PeriphResetCmd(ahb3_periphs, ENABLE) | |
er;
}
void event_service_client_unsubscribe(EventServiceInfo *info) {
cl_assert(info->type == PEBBLE_SMARTSTRAP_EVENT);
s_event_handler = NULL;
}
bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent *e) {
cl_assert(task == PebbleTask_App);
cl_assert(e->type == PEBBLE_SMARTSTRAP_EVENT);
cl... | (app_smartstrap_attribute_end_write(attr, 100, false)) | |
uired_session_type = (CommSessionTransportType) data;
return prv_is_transport_type(session->transport, session->transport_imp, required_session_type);
}
static CommSession *prv_find_session_by_type(CommSessionTransportType session_type) {
return (CommSession *) list_find((ListNode *) s_session_head,
... | comm_session_set_responsiveness(comm_session, BtConsumerApp,
ResponseTimeMiddle, MAX_PERIOD_RUN_FOREVER) | ;
return;
case SNIFF_INTERVAL_NORMAL:
comm_session_set_responsiveness(comm_session, BtConsumerApp,
ResponseTimeMax, 0);
return;
}
PBL_LOG(LOG_LEVEL_WARNING, "Invalid sniff interval");
syscall_failed();
}
DEFINE_SYSCALL(bool, sys_system_pp_has_capability... |
_events_callback, &missed_events);
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Not rewriting wakeup file because no entries were found");
}
settings_file_close(&wakeup_settings);
// If wakeup events were missed by apps requesting notify_if_missed
// popup a notification window displaying these apps
if (missed_e... | (file, (uint8_t*)&entry, sizeof(WakeupEntry)) | ;
//If we have already flagged an error, just skip the rest
if (check->wakeup_count < S_SUCCESS) {
return true; // continue iterating
}
if (uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) {
check->wakeup_count++;
}
// If the wakeup_id is with the same minute as another wakeup eve... |
super-old notifications
if (prv_should_ignore_because_stale(timestamp)) {
return true;
}
return false;
}
void ancs_notifications_handle_message(uint32_t uid,
ANCSProperty properties,
ANCSAttribute **notif_attributes,
... | (notification, &existing_header) | ;
} else {
prv_handle_new_ancs_notif(notification);
}
notification_storage_unlock();
// if missed call, also add a pin
if (is_notification_from_phone_app && has_missed_call_property) {
TimelineItem *missed_call_pin =
ancs_item_create_and_populate(notif_attributes, app_attributes, app_metadat... |
/*
* 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 (music_glance->icon_resource_id == new_icon_resource_id) {
// Nothing to do, bail out
return;
}
// Destroy the existing icon
kino_reel_destroy(music_glance->icon);
// Set the new icon and record its resource ID
// TODO PBL-38539: Switch from using a regular resource ID to using a TimelineReso... |
static bool prv_should_display_music_state(MusicPlayState play_state,
uint32_t last_updated_time_elapsed_ms) {
const uint32_t music_last_updated_display_threshold_ms = 30 * MS_PER_SECOND * SECONDS_PER_MINUTE;
switch (play_state) {
case MusicPlayStatePlaying:
cas... |
_text_height_px) {
text_top_margin_px += text_single_line_text_offset_px;
icon_top_margin_px += icon_single_line_text_offset_px;
} else {
text_top_margin_px += status_layer_offset;
icon_top_margin_px += status_layer_offset;
}
}
y = text_top_margin_px;
h = bounds->size.h - y;
//... | (actionable_dialog->up_icon) | ;
gbitmap_destroy(actionable_dialog->down_icon);
} else { // DialogActionBarConfirm || DialogActionBarDecline
gbitmap_destroy(actionable_dialog->select_icon);
}
}
if (actionable_dialog->dialog.destroy_on_pop) {
applib_free(actionable_dialog);
}
}
Dialog *actionable_dialog_get_dialog(Actio... |
last_used_idx = -1;
for (i=0; i<CORE_DUMP_MAX_IMAGES; i++) {
// Skip if unformatted
if (flash_hdr.unformatted & (1 << i)) {
continue;
}
base_address = core_dump_get_slot_address(i);
prv_flash_read_bytes(®ion_hdr, base_address, sizeof(region_hdr));
// Skip if not written correctly or... | {
// The core dump handler got invoked from another exception, therefore the
// running task was interrupted by an exception.
// Get R0-R3, R12, R14, PC, xpsr for the task off the process stack used
// by the task.
// The information for this task is going to be incorrect: the values of
... |
// inserted into the stack frame during exception entry in order to make
// sp 8-byte aligned.
// Note that this is going to be wrong if the floating-point registers
// were stacked. The only way to know for sure whether the FP regs were
// pushed during exception entry requires unwinding... |
ng reg_timer_1_callback");
if (s_app_data->reg_timers[0].cb != 0) {
PBL_LOG(LOG_LEVEL_DEBUG, "STT reg_timer_1_callback rescheduling from callback for every 2 secs. ");
regular_timer_add_multisecond_callback(&s_app_data->reg_timers[0], 2);
}
}
// ============================================================... | PBL_LOG(LOG_LEVEL_DEBUG, "STT firing in %d ms", (int)expire_ms) | ;
}
// =================================================================================
void two_timers_menu_cb(int index, void *ctx) {
uint32_t zero_flags = 0;
uint32_t expire_ms;
menu_callback_prefix(index, ctx);
// Multiple timers
int timer_idx_0 = 0;
s_app_data->timer[timer_idx_0] = new_timer_crea... |
/*
* 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 bt_driver_test_enter_rf_test_mode();
} |
void bt_test_enter_hci_passthrough(void) {
// redirect all communications to the BT module
serial_console_set_state(SERIAL_CONSOLE_STATE_HCI_PASSTHROUGH);
bt_driver_test_enter_hci_passthrough();
}
void bt_test_stop(void) {
if (!s_test_mode_enabled) {
prompt_send_response("Invalid operation: Run 'bt test... |
t = 25; // FIXME: Currenlty don't support 33
} else if (data->alpha == ALPHA_0) {
alpha_percent = 0;
}
snprintf(data->alpha_text_buffer, sizeof(data->alpha_text_buffer), " a = %d %%", alpha_percent);
if (data->property == PROPERTY_ALPHA) {
set_text_element(data->alpha_text, data->alpha_text_buffer, true... | graphics_fill_round_rect(ctx, &GRect(35, 1, 32, 22), 4, GCornersAll) | ;
}
// Draw foreground color
GColor fg_color = (GColor){ .argb = (data->fg_color.argb | ALPHA_100) };
graphics_context_set_fill_color(ctx, fg_color);
graphics_fill_round_rect(ctx, &GRect(36, 2, 30, 20), 4, GCornersAll);
// Draw border
if (gcolor_equal(data->bg_color, GColorBlack)) {
graphics_context_... |
}
}
}
// Set the duration now, after we've possibly adjusted the children delays to compensate
// for already scheduled children.
animation->duration_ms = prv_get_total_duration(state, animation, false /*delay*/,
false /*play_count*/);
} els... | (animation, time_normalized_raw) | ;
}
bool animation_get_progress(Animation *animation_h, AnimationProgress *progress_out) {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
PBL_ASSERTN(!animation_private_using_legacy_2(state));
AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h,
... |
if (!app_install_get_entry_for_install_id(APP_ID_ALARMS, entry)) {
goto cleanup;
} |
int num_pin_adds = 0;
time_t alarm_time = prv_get_alarm_time(alarm, cron_job_get_execute_time(cron));
time_t last_alarm = 0;
for (int i = 0; alarm_time <= current_time + SECONDS_PER_DAY * 3; i++) {
if (last_alarm != alarm_time) {
last_alarm = alarm_time;
localtime_r(&alarm_time, local_alarm_t... | |
ummy configuration (which has the same layer) to configure a different
// direction should fail
cl_assert(!content_indicator_configure_direction(&content_indicator,
ContentIndicatorDirectionDown,
&dummy_config));
}... | (buffer->bytes_written == sizeof(ContentIndicator *)) | |
prv_last_update_distance(b) | , ANIMATION_NORMALIZED_MAX);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1);
#endif
}
// --------------------------------------------------------------------------------------
// Test creating a spawn where where some children are already scheduled and some have
// already complete... | |
/*
* 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_INFO, "HcGap: no connection for "BT_DEVICE_ADDRESS_FMT,
BT_DEVICE_ADDRESS_XPLODE(resp->addr.address)) | ;
return;
}
// The value is a non-zero-terminated UTF-8 string
int device_name_buffer_length = MIN(resp->name_length + 1, BT_DEVICE_NAME_BUFFER_SIZE);
char *device_name = (char *)kernel_zalloc_check(device_name_buffer_length);
if (!device_name) {
return;
}
memcpy(device_name, resp->name, device_n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.