prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
hedule, true);
active = do_not_disturb_is_active();
cl_assert(active == false); // not in Scheduled mode
rtc_set_time(s_thursday_01_00);
do_not_disturb_handle_clock_change(); // In scheduled period
do_not_disturb_set_manually_enabled(true); // both ON
cl_assert(do_not_disturb_is_manually_enabled() == true... | do_not_disturb_is_smart_dnd_enabled() | == true);
active = do_not_disturb_is_active();
cl_assert(active == false);
s_event_ongoing = true;
active = do_not_disturb_is_active();
cl_assert(active == true);
s_event_ongoing = false;
active = do_not_disturb_is_active();
cl_assert(active == false);
s_event_ongoing = true;
active = do_not_dis... |
LOT_TOP, PLOT_WIDTH, PLOT_HEIGHT)
#define READ_HISTORY_ENTRIES (4 * MINUTES_PER_HOUR)
static int32_t s_temp_readings[READ_HISTORY_ENTRIES];
// Demo temperature
typedef struct {
Window *window;
TextLayer *cur_temp_layer;
TextLayer *temp_range_layer;
char cur_temp_text[32];
char temp_range_text[128];
int mi... | graphics_context_set_stroke_color(ctx, GColorRed) | ;
graphics_draw_line(ctx, GPoint(x_pos, PLOT_BOTTOM), GPoint(x_pos, y_pos));
GRect dot = GRect(x_pos, y_pos, 4, 4);
graphics_fill_rect(ctx, &dot);
graphics_draw_pixel(ctx, GPoint(x_pos, PLOT_BOTTOM - line_height));
}
}
// ------------------------------------------------------------------------------... |
{ 344, 240, -720},
{ 360, 544, -856},
{ 360, 512, -816},
{ 368, 440, -800},
{ 264, 376, -864},
{ 256, 392, -840},
{ 304, 376, -848},
{ 296, 480, -832},
{ 296, 192, -848},
{ 272, 304, -856},
{ 248, 416, -840},
{ 264, 392, -840},
{ 272, 440, -848},
{ 288, 400, -832},... | { 368, 528, -688},
{ 424, 496, -696},
{ 472, 592, -728},
{ 432, 520, -672},
{ 424, 544, -632},
{ 440, 632, -624},
{ 448, 488, -680},
{ 432, 544, -728},
{ 392, 600, -728},
{ 400, 560, -704},
{ 424, 560, -656},
// 286 seconds
{ 480, 536, -552},
{ 520, 608, -552},
... |
{ 256, 680, -840},
{ 288, 696, -656},
{ 392, 584, -592},
{ 432, 672, -576},
{ 456, 704, -480},
{ 400, 752, -552},
{ 368, 632, -616},
{ 408, 656, -576},
{ 408, 688, -560},
{ 424, 648, -592},
{ 408, 704, -616},
{ 368, 672, -568},
{ 408, 680, -536},
{ 416, 688, -528... |
/*
* 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... | string_list_get_at(list, 0) | );
// 1 string (null terminated) => 2 strings, last is empty
list->serialized_byte_length = 3;
list->data[0] = 'a';
list->data[1] = 'b';
list->data[2] = '\0'; // end of data
list->data[3] = '\0';
cl_assert_equal_i(2, string_list_count(list));
cl_assert_equal_s("ab", string_list_get_at(list, 0));
cl_a... |
in
// This causes time to go backwards once a day unless we unlock it after reading from RTC_TR
RTC_GetDate(RTC_Format_BIN, &rtc_date);
if (rtc_time.RTC_Seconds == rtc_time_before.RTC_Seconds) {
break;
}
}
PBL_ASSERTN(max_loops > 0);
struct tm current_time = {
.tm_sec = rtc_time.RTC_Sec... | RTC_ClearITPendingBit(RTC_IT_WUT) | ;
exti_clear_pending_other(ExtiLineOther_RTCWakeup);
}
}
|
yer->title.text_layer);
const GSize subtitle_size = text_layer_get_content_size(ctx, &peek_layer->subtitle.text_layer);
GPoint cursor = { (layer_bounds.size.w - subtitle_size.w) / 2,
-(subtitle_size.h + MAX(number_size.h, title_size.h)) / 2 };
const int font_height_fuzz = 5; // Replace with f... | text_layer_deinit(&peek_layer->number.text_layer) | ;
text_layer_deinit(&peek_layer->subtitle.text_layer);
layer_deinit(&peek_layer->layer);
}
void peek_layer_set_frame(PeekLayer *peek_layer, const GRect *frame) {
layer_set_frame(&peek_layer->layer, frame);
layer_set_frame((Layer *)&peek_layer->kino_layer,
&(GRect) { { 0, peek_layer->icon_offs... |
);
}
static void prv_confirm_pop(ClickRecognizerRef recognizer, void *context) {
confirmation_dialog_pop((ConfirmationDialog *)context);
}
static void prv_coredump_click_config(void *context) {
window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_confirm_cb);
window_single_click_subscribe(BUTTON_ID_DOWN, pr... | menu_layer_set_highlight_colors(menu_layer, SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite) | ;
menu_layer_set_click_config_onto_window(menu_layer, &data->window);
layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer));
}
static void prv_information_window_unload(Window *window) {
SettingsSystemData *data = (SettingsSystemData*) window_get_user_data(window);
menu_layer_deinit(&data->me... |
/*
* 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 (rv == S_SUCCESS) {
TimelineItemId parent_id = ((CommonTimelineItemHeader *)val)->parent_id;
if (timeline_get_private_data_source(&parent_id)) {
goto done;
}
// Not a private data source, must be a PBW
AppInstallId install_id = app_install_get_id_for_uuid(&parent_id);
// can't add a pin... | |
ute attribute; //!< used to persist the response value while waiting for result
bool ignore_failures;
} response;
struct {
Window *action_chaining_window;
TimelineItem *notif;
} chaining_data;
struct {
char *message;
TimelineResourceId icon;
bool success;
} dialog;
struct {
Ac... | {
simple_dialog = simple_dialog_create("Action Result");
if (!simple_dialog) {
goto cleanup;
}
dialog = simple_dialog_get_dialog(simple_dialog);
} | else {
expandable_dialog = expandable_dialog_create("Action Result");
if (!expandable_dialog) {
goto cleanup;
}
expandable_dialog_show_action_bar(expandable_dialog, false);
dialog = expandable_dialog_get_dialog(expandable_dialog);
}
const TimelineResourceSize icon_format = use_simple_dia... |
_swap_layer(data);
}
static void prv_layout_removed_handler(SwapLayer *swap_layer, LayoutLayer *layout, void *context) {
TimelineItem *item = layout_get_context(layout);
timeline_item_destroy(item);
layout_destroy(layout);
}
T_STATIC LayoutLayer *prv_get_layout_handler(SwapLayer *swap_layer, int8_t rel_position... | (data, timeout_ms, false) | ;
}
static void prv_pop_notification_window_after_delay(NotificationWindowData *data,
uint32_t delay_ms) {
prv_refresh_pop_timer_with_timeout(data, delay_ms, true);
}
static time_t prv_get_stale_time(TimelineItem *item) {
// Reminders become stale 10 minutes aft... |
Y_RAND(icon_resources), 0);
attribute_list_add_cstring(&list, AttributeIdTitle, ARRAY_RAND(titles));
attribute_list_add_cstring(&list, AttributeIdBody, ARRAY_RAND(bodies));
attribute_list_add_uint32(&list, AttributeIdLastUpdated, now);
TimelineItem *item = timeline_item_create_with_attributes(now + delta_time_s... | timeline_item_destroy(item) | ;
attribute_list_destroy_list(&list);
}
static void prv_add_calendar_pin(int32_t delta_time_s, int32_t duration_m, bool is_all_day,
bool recurring, TimelineResourceId icon,
TimelineResourceId card_icon) {
const time_t now = rtc_get_time();
time_t ... |
0x0d, 0x0e, 0x0f, 0x00,
},
},
.identity = (BTDeviceInternal) {
.address = (BTDeviceAddress) {
.octets = {
0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
},
},
.is_classic = false,
.is_random_address = false,
},
.is_remote_identity_info_valid = true,
};
B... | (platform_bits_1, platform_bits_out) | |
edule);
bool custom_schedule1[7] = {true, false, true, false, false, true, true};
alarm_set_custom(id, custom_schedule1);
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_CUSTOM, custom_schedule1);
id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_WEEKENDS });
prv_assert_alarm_... | cl_assert_equal_i(s_num_timeline_adds, 3) | ;
cl_assert_equal_i(s_num_timeline_removes, 3);
alarm_set_enabled(id1, true);
prv_assert_alarm_config(id1, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
cl_assert_equal_i(s_num_timeline_adds, 6);
cl_assert_equal_i(s_num_timeline_removes, 3);
id2 = alarm_create(&(AlarmInfo) { .hour = 4, .minute... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (GColorLightGray, GColorWhite) | |
3_callback");
if (s_app_data->reg_timers[0].cb != 0) {
PBL_LOG(LOG_LEVEL_DEBUG, "STT reg_timer_3_callback deleting then adding from callback");
regular_timer_remove_callback(&s_app_data->reg_timers[0]);
regular_timer_add_seconds_callback(&s_app_data->reg_timers[0]);
}
}
// ============================... | (s_app_data->timer[timer_idx_0], &expire_ms) | ;
PBL_ASSERTN(!scheduled);
scheduled = new_timer_scheduled(s_app_data->timer[timer_idx_1], &expire_ms);
PBL_ASSERTN(!scheduled);
}
// =================================================================================
void deferred_delete_menu_cb(int index, void *ctx) {
void *cb_data = 0;
uint32_t zero_flags =... |
xtLayoutExtended layout = { 0 };
graphics_text_attributes_enable_screen_text_flow((GTextLayoutCacheRef) &layout,
TEXT_FLOW_INSET_PX);
return graphics_text_layout_get_max_used_size(ctx,
text,
... | layer_add_child(&dialog->window.layer, &dialog->icon_layer.layer) | |
result = result * (time_end - time_start) / SECONDS_PER_DAY;
}
return result;
}
// ----------------------------------------------------------------------------------------------
// Compute the aggregated value of the given metric using values from minute history
static HealthValue prv_compute_aggregate_using_minut... | if (info->threshold == 0) {
// No threshold set
return;
} |
int32_t value;
bool success = sys_activity_get_metric(prv_get_activity_metric(metric), 1, &value);
if (!success) {
return;
}
bool went_above = ((value > info->threshold) && (info->prior_reading < info->threshold));
bool went_below = ((value < info->threshold) && (info->prior_reading > info->threshold))... |
(result, index, hwver, "HW version") | ;
}
void command_pcba_serial_write(const char *pcba_serial) {
MfgSerialsResult result;
uint8_t index = 0;
size_t pcba_serial_len = strlen(pcba_serial);
if ((pcba_serial_len > 0) && (pcba_serial_len <= MFG_PCBA_SERIAL_NUMBER_SIZE)) {
result = mfg_write_pcba_serial_number(pcba_serial, pcba_serial_len, &inde... | |
2 = comm_session_open(system_transport2, &s_transport_imp,
TransportDestinationSystem);
cl_assert(system_session2);
cl_assert_equal_p(s_last_closed_transport, system_transport);
cl_assert_equal_i(s_close_count, 1);
comm_session_close(system_session2, CommSess... | cl_assert_equal_i(fake_system_task_count_callbacks(), 1) | ;
comm_session_send_next(session);
cl_assert_equal_i(fake_system_task_count_callbacks(), 1);
cl_assert_equal_i(s_send_next_count, 1);
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_i(s_send_next_count, 2);
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection);
}
void t... |
e except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF A... | pebble_task_get_current() | );
break;
case PebbleTask_Worker:
queue = worker_manager_get_task_context()->to_process_event_queue;
break;
case PebbleTask_App:
queue = app_manager_get_task_context()->to_process_event_queue;
break;
case PebbleTask_KernelBackground:
queue = NULL;
break;
default... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (window, (WindowHandlers) {
.load = window_load,
.unload = window_unload,
}) | ;
const bool animated = true;
window_stack_push(window, animated);
app_timer_register(1000, prv_timer_callback, 0);
}
static void deinit(void) {
window_destroy(window);
}
int main(void) {
init();
app_event_loop();
deinit();
}
|
#include "resource/resource_ids.auto.h"
#include "system/passert.h"
#include "string.h"
////////////////////////////////////////////////////////////
// Data structures
typedef struct {
Window window;
GBitmap *bitmap;
bool bitmap_inited;
BitmapLayer bitmap_layer;
Layer anim_layer;
PropertyAnimation *spin... | gbitmap_destroy(data->bitmap) | ;
data->should_cancel_animation = true;
property_animation_destroy(data->spinner_animation);
kernel_free(data);
}
}
static void prv_window_load_handler(Window* window) {
SpinnerUIData *data = window_get_user_data(window);
GRect spinner_bounds = window->layer.bounds;
spinner_bounds.origin.y += PBL_I... |
/logging.h"
#include "util/attributes.h"
#include "util/build_id.h"
#include "util/crc32.h"
#include "util/math.h"
#include <os/tick.h>
#if PLATFORM_ROBERT
#define CORE_DUMP_RX_BUFFER_SIZE (16 * 1024)
// Place in DTCM on Robert
static unsigned char DMA_BSS DMA_READ_BSS s_rx_buffer[CORE_DUMP_RX_BUFFER_SIZE];
#else
#de... | (LOG_LEVEL_ERROR, "Unable to get Text CRC") | ;
goto spi_failed;
}
memcpy(&text_crc_matches, s_rx_buffer, sizeof(text_crc_matches));
// Get the Build ID
cmd = (CoreDumpSPICmd) { .cmd = CoreDumpCmd_GetBuildID };
if (!prv_spi_transaction(&cmd, s_rx_buffer, sizeof(build_id))) {
PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Build ID");
goto spi_failed... |
// model: "pebble_time_red",
// language: "en_US",
// firmware: {
// major: 4,
// minor: 0,
// patch: 1,
// suffix: "beta3"
// }
// }
#define ROCKY_WATCHINFO "watchInfo"
#define ROCKY_WATCHINFO_PLATFORM "platform"
#define ROCKY_WATCHINFO_MODEL "model"
#define ROCKY_WATCH... | ("pebble_time_round_rose_gold_14mm") | |
{
return true;
}
//! Interrupt masks for InterruptStatus1 and InterruptMask1 registers
enum PmicInt1 {
PmicInt1_Trickle = (1 << 0), //!< Trickle charge
PmicInt1_NoBat = (1 << 1), //!< Battery detached
PmicInt1_Resume = (1 << 2), //!< Resuming charge on drop after full
PmicInt1_EOC = (1 << 3), //!< En... | prv_reset_reason() | != PmicResetReason_StandbyInterrupt) {
return false;
}
uint8_t int_status;
if (!prv_read_register(PmicRegisters_INT_STATUS_1, &int_status)) {
return false;
}
return ((int_status & PmicInt1_ChDet) && !pmic_is_usb_connected());
}
// This is a hard power off, resulting in all rails being disabled.
bo... |
/*
* 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... | {
PebbleTask task = pebble_task_get_current();
if (task == PebbleTask_App) {
return app_state_get_connection_service_state();
} else if (task == PebbleTask_Worker) {
return worker_state_get_connection_service_state();
}
WTF;
} | |
,
SystemInformationItemBootloader,
SystemInformationItemHardware,
SystemInformationItemSerial,
SystemInformationItemUptime,
SystemInformationItemLegal,
SystemInformationItem_Count,
};
typedef struct SystemCertificationData SystemCertificationData;
typedef struct SystemCertificationMenuItem {
void (*d... | dialog_set_background_color(dialog, GColorRed) | |
SOURCES) {
return RESOURCE_ID_INVALID;
}
return g_timeline_resources[timeline_id][size];
}
static bool prv_get_sys_resource(TimelineResourceId timeline_id, TimelineResourceSize size,
AppResourceInfo *res_info) {
const uint32_t res_id = prv_get_sys_resource_id(timeline_id, siz... | (timeline_res, size, res_info) | |
static void prv_unlock(SettingsFile **store) {
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 se... | (
memory_layout_get_app_region(), cstring, -1) | ) {
syscall_failed();
}
}
const size_t cstring_length = strlen(cstring) + 1;
return persist_write_data(key, cstring, cstring_length);
}
DEFINE_SYSCALL(status_t, persist_delete, const uint32_t key) {
LOCK_AND_GET_STORE(store);
status_t result;
if (settings_file_exists(store, &key, sizeof(key))) {
... |
;
} else {
dbgserial_putstr("Failed to start firmware, strike one.");
boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
}
return false;
}
static bool prv_prf_button_combination_is_pressed(void) {
return (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)
&& button_is_pressed(BUT... | button_init() | ;
pmic_init();
display_init();
display_boot_splash();
if (boot_test_is_button_stuck()) {
prv_sad_watch(ERROR_STUCK_BUTTON);
}
if (boot_test_is_flash_broken()) {
prv_sad_watch(ERROR_BAD_SPI_FLASH);
}
boot_bit_dump();
// If the recovery firmware crashed at start-up, the watch is now a $199 ... |
oogle 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 in writing, software
*... | (&s_dest_bitmap,
"test_bitblt_palette_1bit__2bit_palette_to_1bit-expect.pbi") | );
gbitmap_destroy(src_bitmap);
}
// Tests assign, from same size to same size.
// Setup:
// - Source is 50x50, alternating lines between orange and blue for the top half.
// The bottom half is a diagonal orange line over blue.
// The left half is semi-transparent and the right half is completely opaque
/... |
Pin = pin_config.gpio_pin;
gpio_init_struct.GPIO_Mode = GPIO_Mode_IN;
gpio_init_struct.GPIO_Speed = GPIO_Speed_2MHz;
gpio_init_struct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(pin_config.gpio, &gpio_init_struct);
gpio_release(pin_config.gpio);
}
//! Configure bus pin as output
//! Lock bus and peripheral conf... | bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl) | ;
bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda);
}
}
//! Perform a soft reset of the bus
//! Always lock the bus before reset
static void bus_reset(uint8_t bus_idx) {
bus_disable(bus_idx);
bus_enable(bus_idx);
}
/*---------------INIT/USE/RELEASE/RESET FUNCTIONS----------------------*/
vo... |
"gpath_filled_single_duplicate_aa.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_gpath_${BIT_DEPTH_NAME}__filled_clipped_aa(void) {
GContext ctx;
Layer layer;
prv_reset();
test_graphics_context_init(&ctx, fb);
s_current_path = s_house_path;
ctx.draw_state.clip_box = GRect(0, SCREEN_HEIGHT / 2, SCREEN_WI... | gpath_move_to(s_infinite_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2));
test_graphics_context_init(&ctx, fb);
graphics_context_set_antialiased(&ctx, true);
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_infinite_aa.8bit.pbi"));
// An angle of infinite path ... | |
ject_field(jerry_get_global_object(), "ctx", ctx);
return ctx;
}
void test_rocky_api_graphics_rendering__lines(void) {
prv_global_init_and_set_ctx();
// taken from http://fiddle.jshell.net/9298zub9/2/
EXECUTE_SCRIPT(
"var t1 = 10;\n"
"var b1 = 20.5;\n"
"var t2 = 30.5;\n"
"var b2 = 40;\n"
... | EXECUTE_SCRIPT(
"var xx = 200;\n"
"\n"
"function f(x, y, r, a1, a2) {\n"
" ctx.beginPath();\n"
" ctx.arc(x, y, r, a1, a2, false);\n"
" ctx.stroke();\n"
"\n"
" ctx.rockyFillRadial(x + xx, y, 0, r, a1, a2);\n"
"}\n"
"\n"
"function g(x, y, a1, a2) {\n"
" f(x, y, 5, a1, ... | ;
const bool eq_result =
gbitmap_pbi_eq(&s_context.dest_bitmap, TEST_NAMED_PBI_FILE("rocky_rendering_arc"));
cl_check(eq_result);
} |
-744},
{ 480, 448, -728},
{ 480, 432, -728},
{ 488, 432, -744},
{ 480, 424, -728},
{ 488, 432, -736},
{ 464, 432, -736},
{ 488, 432, -744},
{ 488, 432, -736},
{ 480, 432, -736},
{ 488, 432, -728},
{ 480, 432, -736},
{ 488, 424, -744},
{ 480, 432, -736},
{ 480, 432... | // 83 seconds
{ 464, 312, -776},
{ 472, 448, -744},
{ 472, 432, -736},
{ 488, 416, -736},
{ 488, 456, -736},
{ 456, 424, -752},
{ 472, 400, -752},
{ 480, 432, -736},
{ 472, 424, -736},
{ 496, 424, -744},
{ 464, 440, -744},
{ 472, 416, -736},
{ 480, 440, -736},
... |
{ 480, 448, -720},
{ 496, 400, -768},
{ 464, 432, -760},
{ 488, 432, -736},
{ 480, 416, -744},
{ 472, 424, -744},
{ 488, 416, -744},
{ 480, 424, -744},
// 86 seconds
{ 480, 440, -744},
{ 488, 408, -744},
{ 464, 424, -744},
{ 488, 424, -736},
{ 480, 432, -744},
... |
96, 312, 32},
{ 1064, 408, 104},
{ 880, 136, 168},
// 102 seconds
{ 1000, 200, 96},
{ 1016, 320, 0},
{ 968, 416, -88},
{ 912, 336, -272},
{ 864, 208, -48},
{ 1280, 472, -240},
{ 1328, 352, -24},
{ 1776, 296, 128},
{ 1496, 368, 136},
{ 1032, 200, 112},
{ 1112, 104,... | ARRAY_LENGTH(samples) | |
/*
* 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... | {
spi_ll_slave_scs_deassert(ICE40LP->spi_port);
spi_ll_slave_release(ICE40LP->spi_port);
power_tracking_stop(PowerSystemMcuSpi6);
} |
// Temporary code to support prv_do_display_update() logic that attempts to use the
// bootloader error display
void display_spi_configure_default(void) {
spi_slave_set_frequency(ICE40LP->spi_port, ICE40LP->base_spi_frequency);
}
void display_start() {
periph_config_acquire_lock();
gpio_output_init(&ICE40LP->... |
strlen(request->filename) + 1);
strcpy(storage_info->filename, request->filename);
break;
}
case ObjectWatchApp:
case ObjectWatchWorker: {
PebbleTask task = (request->type == ObjectWatchApp) ? PebbleTask_App : PebbleTask_Worker;
char filename[APP_FILENAME_MAX_LENGTH + 1];
... | event_put(&event) | ;
prv_create_timer_if_needed();
success = new_timer_start(s_pb_state.timer_id, PUT_TIMEOUT_MS, prv_timer_callback, &s_pb_state,
0 /*flags*/);
exit:
prv_mark_pb_jobs_complete(1);
prv_send_response(success ? ResponseAck : ResponseNack,
success ? s_pb_state.token :... |
vibes_cancel();
}
// ----------------------------------------------------------------------------------------------
//! Vibe Timer
#define TINTIN_VIBE_REPEAT_INTERVAL_MS (1000)
#define TINTIN_MAX_VIBES (10 * 60) // 10 minutes at 1 vibe a second
#define TINTIN_LPM_VIBES_PER_MINUTE (10)
#define VIBE_DURATION (10 * SECO... | (s_alarm_popup_data->action_bar_snooze) | ;
gbitmap_destroy(s_alarm_popup_data->action_bar_dismiss);
task_free(s_alarm_popup_data);
s_alarm_popup_data = NULL;
}
}
// ----------------------------------------------------------------------------------------------
//! API
#endif
void alarm_popup_push_window(PebbleAlarmClockEvent *event) {
#if !TINTI... |
/*
* 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... | {
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR);
const uint8_t *data_array = data;
for (uint32_t i = 0; i < length; ++i) {
if (FLASH_ProgramByte(address + i, data_array[i]) != FLASH_COMP... | |
,
{ 0, 0x16, 0, 144},
{ 0, 0x16, 0, 145},
{ 0, 0x16, 0, 144},
{ 0, 0x16, 0, 144},
{ 0, 0x16, 0, 145},
{ 0, 0x66, 592, 145},
// 675: Local time: 03:55:00 AM
{ 0, 0x65, 0, 144},
{ 0, 0x65, 0, 144},
{ 0, 0x65, 0, 144},
{ 0, 0x65, 0, 144},
{ 0, 0x66, 16, 150},
{ 0, 0x78, ... | {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME sleep_11
//> TEST_VERSION 2
//> TEST_TOTAL -1
//> TEST_TOTAL_MIN -1
//> TEST_TOTAL_MAX -1
//> TEST_DEEP -1
//> TEST_DEEP_MIN -1
//> TEST_DEEP_MAX -1
//> TEST_START_AT 116
//> TEST_START_AT_MIN 95
//> TEST_START_A... |
// 30: Local time: 11:36:00 PM
{ 0, 0x6b, 136, 0x0},
{ 0, 0x5b, 79, 0x0},
{ 0, 0x5b, 173, 0x0},
{ 0, 0x6b, 325, 0x0},
{ 0, 0x6a, 0, 0x0},
{ 0, 0x6a, 0, 0x0},
{ 0, 0x6a, 0, 0x0},
{ 0, 0x6a, 0, 0x0},
{ 0, 0x5b, 856, 0x0},
{ 0, 0x5b, 22, 0x0},
{ 0, 0x5b, 0, 0x0},
{ 0, 0... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (__noreturn__) | |
locked_check = 0xff,
.protection_enabled_mask = (1 << 7),
},
.reset_latency_ms = 13,
.suspend_to_read_latency_us = 20,
.standby_to_low_power_latency_us = 10,
.low_power_to_standby_latency_us = 30,
.supports_fast_read_ddr = false,
.qspi_id_value = 0x3725c2,
.name = "MX25U64",
};
//! Any PRF built a... | (QSPI_FLASH, true) | ;
return S_SUCCESS;
}
status_t flash_impl_exit_low_power_mode(void) {
qspi_flash_set_lower_power_mode(QSPI_FLASH, false);
return S_SUCCESS;
}
status_t flash_impl_set_burst_mode(bool burst_mode) {
// NYI
return S_SUCCESS;
}
status_t flash_impl_blank_check_sector(FlashAddress addr) {
return qspi_flash_blank... |
Layer swap_layer;
LayoutLayer *layout_layers[NUM_NOTIFS];
uint32_t idx;
} SwapLayerDemoData;
static LayoutLayer *prv_get_layout_handler(SwapLayer *swap_layer, int8_t rel_position,
void *context) {
PBL_LOG(LOG_LEVEL_DEBUG, "getting layer %d", rel_position);
SwapLayerDe... | window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
}) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_health_sleep_detail_card__render_sleep_session(void) {
HealthData health_data = {
.sleep_start = (23 * SECONDS_PER_HOUR) + (3 * SECONDS_PER_MINUTE),
.sleep_end = (7 * SECONDS_PER_HOUR) + (45 * SECONDS_PER_MINUTE),
};
prv_create_card_and_render(&health_data);
cl_check(gbitmap_pbi_eq(&s_c... |
buffer we have for
//! holding a single command. If anything goes wrong, the state machine resets
//! and starts looking for 0x1 again. If we are not in the process of decoding
//! a command a ctrl-d will exit passthrough mode.
void bt_driver_test_handle_hci_passthrough_character(
char c, bool *should_context_switc... | if (s_response_callback) {
s_response_callback(status, e->payload);
} |
return true;
}
bool bt_test_chip_in_test_mode(void) {
return s_test_mode_enabled;
}
static bool prv_in_test_mode(void) {
if (!s_test_mode_enabled) {
char buf[80];
prompt_send_response_fmt(
buf, sizeof(buf), "Not in test mode, run 'bt test start' first!");
return false;
}
return true;
}... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | gdraw_command_image_attract_to_square(l, t += dt) | ;
gdraw_command_image_draw(&ctx, l, GPoint(0, 96));
l = weather_app_resource_create_sun();
gdraw_command_image_attract_to_square(l, t += dt);
gdraw_command_image_draw(&ctx, l, GPoint(48, 96));
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "test_gdraw_command_transforms__to_square.8bit.pbi"));
}
// re-enable th... |
ANIMATION_NORMALIZED_MAX / 2));
}
static KinoReel *prv_get_current_reel(KinoReelTransformData *data) {
return prv_is_currently_from(data) ? data->from_reel : data->to_reel;
}
static GSize prv_get_current_size(KinoReelTransformData *data) {
return prv_is_currently_from(data) ? data->from.size : data->to.size;
}
... | {
KinoReelTransformData *data = kino_reel_custom_get_data(reel);
return prv_get_duration(data);
} |
static GSize prv_size_getter(KinoReel *reel) {
KinoReelTransformData *data = kino_reel_custom_get_data(reel);
return interpolate_gsize(data->normalized, data->from.size, data->to.size);
}
static void prv_transform_list(KinoReelTransformData *data) {
KinoReel *reel = prv_get_current_reel(data);
GDrawCommandLi... |
attribute.h"
#include "system/passert.h"
#include "util/attributes.h"
#include "util/string.h"
#include "util/struct.h"
#include <stdio.h>
typedef struct LauncherAppGlanceNotifications {
char title[APP_NAME_SIZE_BYTES];
char subtitle[ATTRIBUTE_APP_GLANCE_SUBTITLE_MAX_LEN];
KinoReel *icon;
EventServiceInfo not... | (notifications_glance->subtitle, string_to_use_in_glance_subtitle, glance_subtitle_size) | ;
notifications_glance->subtitle[glance_subtitle_size - 1] = '\0';
}
static void prv_notification_event_handler(PebbleEvent *event, void *context) {
LauncherAppGlanceStructured *structured_glance = context;
LauncherAppGlanceNotifications *notifications_glance =
launcher_app_glance_structured_get_data(struc... |
assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id));
// check fifth
cl_assert(iter_next(&iterator));
cl_asser... | uuid_equal(&state.node->id, &all_day_item.header.id) | );
cl_assert(state.node->all_day);
cl_assert_equal_i(state.node->timestamp, midnight_march_3_pst);
cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY);
cl_assert_equal_i(state.current_day, midnight_march_3_pst);
// no more
cl_assert(!iter_next(&iterator));
// 1 delete
cl_assert(timeline_iter_remo... |
GETTING_STARTED_COMPLETE = !GETTING_STARTED_COMPLETE;
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), i % SPRF_NUM_PAGES);
shared_prf_storage_set_getting_started_complete(GETTING_STARTED_COMPLETE);
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), (i + 1) % SPRF_NUM_PAGES);
... | shared_prf_storage_get_valid_page_number() | ),
sizeof(data));
cl_assert(data.getting_started.crc != 0xFFFFFFFF);
uint32_t new_crc = 0;
flash_write_bytes((uint8_t *)&new_crc,
SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number())
+ offsetof(SharedPRFData, ble_pairing_data)
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_get_current_size(data) | ;
const GPoint offset = interpolate_gpoint(data->normalized, grect_center_point(&data->from),
grect_center_point(&data->to));
return gpoint_sub(offset, GPoint(size.w / 2, size.h / 2));
}
static bool prv_image_size_eq_rect_size(KinoReelTransformData *data, GRect rect) {
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (RCC_APB2Periph_SPI1, DISABLE) | ;
}
static void prv_flash_start(void) {
gpio_use(FLASH_CONFIG.spi_gpio);
// Enable the GPIOA clock
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
uint8_t altfunc = GPIO_AF_SPI1;
// Connect pins to their SPI functionality
GPIO_PinAFConfig(FLASH_CONFIG.spi_gpio, FLASH_CONFIG.sclk_pin, altfunc);
G... |
/*
* 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... | strlen(string) | ;
bool trim = true;
for (int i = string_len; i >= 0; i--) {
if (trim &&
(string[i] == ' ' || string[i] == '\n' || string[i] == '\0')) {
string_out[i] = '\0';
} else {
trim = false;
string_out[i] = string[i];
}
}
}
const char *bool_to_str(bool b) {
if (b) {
return "yes"... |
| (pebble_task_get_current() == PebbleTask_KernelBackground));
} else if ((prev_state == SmartstrapStateReadDisabled) &&
(new_state == SmartstrapStateReadReady)) {
PBL_ASSERT_TASK(PebbleTask_KernelBackground);
} else if ((prev_state == SmartstrapStateReadInProgress) &&
(new_state == Sm... | (connected) | |
sh_init(0, 0x1000000);
pfs_init(false);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */);
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, CHINESE_FIXTURE_NAME, "lang");
//cl_assert(resource_has_valid_sys... | (s_font_info.base.md.wildcard_codepoint, WILDCARD_CODEPOINT) | ;
}
void test_text_resources__test_backup_wildcard(void) {
const uint8_t wildcard_bytes[] = {0x3f, 0xc6, 0x18, 0x63, 0x8c, 0x31, 0xc6, 0x0f};
uint32_t font_fallback = RESOURCE_ID_FONT_FALLBACK_INTERNAL;
cl_assert(text_resources_init_font(0, font_fallback, 0, &s_font_info));
int8_t horiz_advance = text_resour... |
system_task_add_callback(prv_put_bytes_event_system_task_cb, pb_event_copy) | ;
}
//! Callback for the system task to fire off the fetch request. Triggered by a call to
//! app_fetch_binaries().
static void prv_app_fetch_binaries_system_task_cb(void *data) {
AppFetchInstallRequest *request = (AppFetchInstallRequest *)data;
// check if Bluetooth is active. If so, this will send.
bool succ... | |
(LOG_LEVEL_INFO, "MIC Error detected ... %"PRIu32" packets", num_sequential_mic_errors) | ;
analytics_event_bt_error(AnalyticsEvent_BtLeMicError, num_sequential_mic_errors);
}
static uint32_t prv_calc_other_errors(const SlaveConnEventStats *stats) {
return (stats->num_type_errors + stats->num_len_errors + stats->num_crc_errors +
stats->num_mic_errors);
}
static bool prv_calc_stats_and_print(... | |
lyticsClient_App);
analytics_set(ANALYTICS_APP_METRIC_FLASH_READ_BYTES_COUNT,
s_analytics_read_bytes_count, AnalyticsClient_App);
analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT,
s_analytics_write_bytes_count, AnalyticsClient_App);
// The overhead cost of tracking wheth... | (s_erase.task) | ;
status_t status = flash_impl_erase_suspend(s_erase.address);
PBL_ASSERT(PASSED(status), "Erase suspend failure: %" PRId32, status);
if (status == S_NO_ACTION_REQUIRED) {
// The erase has already completed. No need to resume.
s_erase.in_progress = false;
} else {
s_erase.suspended = t... |
0, -296},
{ -496, -840, -304},
{ -496, -840, -288},
{ -496, -840, -296},
{ -496, -840, -296},
{ -504, -840, -304},
{ -496, -832, -296},
{ -504, -840, -304},
{ -496, -840, -296},
{ -504, -840, -296},
{ -496, -840, -296},
{ -496, -832, -296},
{ -496, -840, -296},
{ -496... | { -504, -840, -296},
{ -504, -840, -296},
{ -504, -840, -296},
{ -504, -832, -296},
{ -504, -840, -296},
{ -496, -840, -296},
{ -496, -832, -296},
{ -496, -848, -288},
{ -496, -840, -296},
{ -496, -840, -288},
{ -504, -832, -296},
{ -496, -832, -296},
// 102 seconds
... |
{ -496, -840, -288},
{ -496, -840, -296},
{ -504, -832, -296},
{ -504, -840, -296},
{ -496, -832, -288},
{ -504, -832, -288},
{ -496, -840, -288},
{ -504, -832, -288},
{ -496, -848, -288},
{ -496, -840, -288},
{ -496, -840, -288},
{ -496, -840, -288},
{ -496, -840, -... |
ontext) {
window_transition_context_disappear(context);
window_transition_context_appear(context);
return animation_create();
}
const WindowTransitionImplementation window_transition_default_push_implementation = {
.create_animation = window_transition_default_push_create_animation,
};
const WindowTransitionI... | fake_animation_cleanup() | ;
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0);
}
// Tests
////////////////////////////////////
void test_window_stack__basic_app_push(void) {
Window *window = window_create();
stub_pebble_tasks_set_current(PebbleTask_App);
cl_check(app_state_get_window_stack());
cl_check(!app_state_get_window_... |
////////////////
// app_inbox_service_cancel
void test_app_inbox__app_inbox_service_cancel(void) {
prv_create_test_inbox_and_begin_write();
// Start writing a message that occupies the complete buffer, then cancel it:
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest,
... | (1, s_test_data, 1) | ;
// Should be able to write (BUFFER_SIZE) again,
// because the message 1 and 2 are consumed now:
cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest,
BUFFER_SIZE, s_writer));
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServi... |
if (++i > QSPI_WAIT_TIME) {
break;
} |
}
PBL_ASSERT(i < QSPI_WAIT_TIME, "Waited too long for the QSPI transfer to complete");
}
static void prv_wait_for_not_busy(void) {
int i = 0;
while (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) {
if (++i > QSPI_WAIT_TIME) {
break;
}
}
PBL_ASSERT(i < QSPI_WAIT_TIME, "Waited too long for the Q... | |
if (rule->hour >= HOURS_PER_DAY) {
time_tm.tm_hour %= HOURS_PER_DAY;
}
// Brazil delays DST end by one week every 3 years for elections
if (tz_info->dst_id == DSTID_BRAZIL && (((TM_YEAR_ORIGIN + year) % 3) == 2) && is_end) {
time_tm.tm_mday += DAYS_PER_WEEK;
}
time_t uxtime = mktime(&time_tm);
gmtim... | if (region_id != -1) {
// We have a valid region!
TimezoneInfo tz_info;
prv_clock_get_timezone_info_from_region_id(region_id, tz_data->utc_time, &tz_info);
return tz_info;
} |
// Else, we couldn't find find the specified timezone.
#ifndef RECOVERY_FW
TimezoneInfo tz_info = {
.dst_id = 0,
.timezone_id = UNKNOWN_TIMEZONE_ID,
.tm_gmtoff = tz_data->utc_offset_min * SECONDS_PER_MINUTE,
.dst_start = 0,
.dst_end = 0,
};
// I was hoping to fill the name with something ... |
rue, false),
delay_spawn + MAX(total_duration_a, total_duration_b));
cl_assert_equal_i(animation_get_duration(spawn, true, true), duration_total);
animation_destroy(spawn);
#endif
}
// --------------------------------------------------------------------------------------
// Test unschedule a... | (animation_get_delay(h) == delay) | ;
cl_assert(animation_get_duration(h, true, true) == (duration + delay));
// Play count
cl_assert_equal_i(animation_get_play_count(h), 1);
animation_set_play_count(h, 2);
cl_assert_equal_i(animation_get_play_count(h), 2);
cl_assert(animation_get_duration(h, true, true) == 2*(duration + delay));
// Curve... |
slave->slave_state->dma_state = SPISlavePortDMAState_Write;
slave->slave_state->dma_complete_handler = handler;
slave->slave_state->dma_complete_context = context;
prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqTx, true);
dma_request_start_direct(slave->tx_dma, (void *)&slave->spi_bus->spi->DR, out, len,
... | (&clk_as_gpio, false) | ;
} else {
prv_configure_spi_sclk(spi_sclk, slave->spi_bus->spi_sclk_speed);
}
}
void spi_ll_slave_clear_errors(const SPISlavePort *slave) {
// First, empty the RX FIFO by reading the data. If in TX-only mode, it's possible that
// received data (0x00s) will be left in the RX FIFO.
// NOTE: Obviously, d... |
ad_offset_table(Codepoint codepoint, FontCache *font_cache,
const FontResource *font_res) {
const int table_id = prv_offset_table_get_id(&font_res->md, codepoint);
if (table_id == font_cache->offset_table_id) {
return font_cache->offset_table_size;
}
size_t num_bytes, offse... | if (codepoint_at_mid_idx < codepoint) {
min_idx = mid_idx + 1;
} else if (codepoint_at_mid_idx > codepoint) {
max_idx = mid_idx - 1;
} else {
offset = prv_offset_table_get_offset(font_cache, &font_res->md, mid_idx);
break;
} |
}
return offset;
}
static uint32_t prv_get_glyph_data_offset(Codepoint codepoint, FontCache *font_cache,
const FontResource *font_res) {
const uint32_t offset = prv_get_glyph_table_offset(font_cache, codepoint, font_res);
if (offset <= 0) {
return 0;
}
// Co... |
(!file) {
return NULL;
}
PFSCallbackHandle cb_handle = pfs_watch_file(file->name, callback, FILE_CHANGED_EVENT_ALL, data);
return cb_handle;
}
static bool resource_storage_file_unwatch(ResourceCallbackHandle cb_handle) {
pfs_unwatch_file(cb_handle);
return true;
}
static void resource_storage_file_init(... | prv_file_common_get_length_and_close(prv_app_file_open(entry, op_flags)) | ;
}
static uint32_t resource_storage_app_file_get_crc(ResourceStoreEntry *entry, uint32_t num_bytes,
uint32_t entry_offset) {
const uint8_t op_flags = OP_FLAG_READ;
return prv_file_common_get_crc(prv_app_file_open(entry, op_flags), num_bytes, entry_offset);
}
stat... |
{
// This used to be `connection_by_idx_check`, but due to PBL-36813, needed to change it.
// The error that comes back in the `evt` is `GAP_ERR_COMMAND_DISALLOWED: 0x43`, but to make
// sure we don't assert on any other future errors, we check for the connection.
Connection *conn = connection_by_idx(conn_idx);... |
void gatt_wrapper_handle_read_completed(const ble_evt_gattc_read_completed_t *evt) {
BTDeviceInternal addr;
uintptr_t context_ref;
GATT_LOG_DEBUG("gatt_wrapper_handle_read_completed: handle: %d, status: %d",
evt->handle, evt->status);
const BLEGATTError status = (BLEGATTError)evt->status;
G... | |
NE_RESOURCE_CALORIES;
icons->values[3] = TIMELINE_RESOURCE_DISTANCE;
static StringList names = StringListLiteral("Pace\0Run duration\0Calories burned\0Distance");
static StringList values = StringListLiteral("7:45\0" "30M\0" "8384\0" "3.3 miles");
attribute_list_add_string_list(&list, AttributeIdMetricNames, &n... | prv_add_notification(-60 * 30) | |
/*
* 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_BKP_BOOTBIT_DR) | );
dbgserial_newline();
}
void boot_version_write(void) {
if (boot_version_read() == s_bootloader_timestamp) {
return;
}
RTC_WriteBackupRegister(BOOTLOADER_VERSION_REGISTER, s_bootloader_timestamp);
}
uint32_t boot_version_read(void) {
return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER);
}
|
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 on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR... | cl_assert_equal_i(20000, interpolate_moook_soft(ANIMATION_NORMALIZED_MAX, -20000,
20000, moook_num_soft_frames)) | ;
}
static const int32_t s_custom_moook_in[] = {0, 2, 8};
static const int32_t s_custom_moook_out[] = {21, 9, 3, 0};
static const MoookConfig s_custom_moook = {
.frames_in = s_custom_moook_in,
.num_frames_in = ARRAY_LENGTH(s_custom_moook_in),
.frames_out = s_custom_moook_out,
.num_frames_out = ARRAY_LENGTH(s_c... |
_connected_server(&s_dummy_server_implementation,
connected /* connected */);
}
static void prv_assert_no_data_sent_cb(uint16_t endpoint_id,
const uint8_t* data, unsigned int data_length) {
cl_assert(false);
}
static bool s_now_playing_requested;
s... | fake_event_get_last() | ;
cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT);
}
void test_music_endpoint__receive_zero_length_now_playing(void) {
// Android app connects:
prv_receive_app_info_event(true /* is_android */);
prv_receive_and_assert_all(true /* expect_is_handled*/);
cl_assert_equal_b(music_has_now_playing(), true);
uint8_t... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
TimelineLayout *layout = context;
KinoReel *new_reel = kino_reel_create_with_resource_system(layout->icon_res_info.res_app_num,
layout->icon_res_info.res_id);
prv_change_reel(layout, new_reel);
if (!layout->is_being_destroyed) {
// PBL-20112: Co... | |
/*
* 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... | (touch_event, 0, TouchEvent_Touchdown, &GPoint(15, 100), 3686400, 3,
&GPointZero, 0, 0, true) | ;
touch_event = touch_event_queue_get_event(1, 0);
cl_assert_equal_p(touch_event, NULL);
// Test second touch
touch_handle_update(1, TouchState_FingerDown, &GPoint(1, 13), 5, 3686401);
event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT);
cl_assert_equal_i(event.touch.type, P... |
/*
* 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, "STT reg_timer_3_callback deleting then adding from callback") | ;
regular_timer_remove_callback(&s_app_data->reg_timers[0]);
regular_timer_add_seconds_callback(&s_app_data->reg_timers[0]);
}
}
// =================================================================================
static void menu_callback_prefix(int index, void *ctx) {
PBL_LOG(LOG_LEVEL_DEBUG, "Hit menu ... |
GATTPacket) + length);
packet->sn = sn;
packet->type = PPoGATTPacketTypeData;
memcpy(packet->payload, data, length);
fake_gatt_client_op_assert_write(characteristic, (const uint8_t *) packet,
sizeof(PPoGATTPacket) + length,
GAPLEClientKernel,... | {
struct {
const PPoGATTMetaV1 *meta;
TransportDestination expected_destination;
} metas[] = {
{
.meta = &s_meta_v1_hybrid,
.expected_destination = TransportDestinationHybrid,
},
{
.meta = &s_meta_v1_system_inferred,
.expected_destination = TransportDestinationSystem,
... |
void test_ppogatt__handles_unsupported_meta_ppogatt_version(void) {
PPoGATTMetaV0 future_meta_non_compatible = s_meta_v0_system;
future_meta_non_compatible.ppogatt_min_version = 0xaa;
future_meta_non_compatible.ppogatt_max_version = 0xff;
prv_notify_services_discovered(1);
ppogatt_handle_read_or_notificat... |
CONFIG_SPI_DMA_CHANNEL);
void DMA_Handler(void); // This is the Dialog SPI/DMA Interrupt handler
static volatile bool s_spi_dma_complete;
static const spi_device_config * const s_spi = &dev_CORE_DUMP_SPI;
static bool s_core_dump_initiated = false;
extern uint32_t *g_stacked_regs;
// The foll... | hw_timer1_disable() | ;
// The following block of code was lifted from sys_power_mgr.c:apply_wfi().
//
// TODO: It's not entirely clear what's going on, but it does reduce current draw to ~0 uA. At
// some point, it's probably worth figuring out how to cleanly hibernate (PBL-42430)
hw_cpm_enable_clockless();
hw_cpm_disabl... |
/*
* 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... | (timeout_ms) | ;
}
void alerts_init() {
alerts_preferences_init();
do_not_disturb_init();
vibe_intensity_init();
}
|
aa " // 20- 40
"aaaa aaaa aaaa aaaa " // 40- 60
"aaaa aaaa aaaa aaaa " // 60- 80
"aaaa aaaa aaaa aaaa " // 80-100
"aaaa aaaa aaaa aaaa " //100-120
"aaaa aaaa aaaa aaaa " //120-140
... | cl_assert_equal_i(llntest[0], 280) | ;
cl_assert_equal_i(llntest[1], 0);
jntest[0] = jntest[1] = 0;
snprintf(dstbuf, 512, "aaaa aaaa aaaa aaaa " // 0- 20
"aaaa aaaa aaaa aaaa " // 20- 40
"aaaa aaaa aaaa aaaa " // 40- 60
"aaaa aaaa aaaa aaaa " // 60- 80
... |
ivity_exit_at_utc));
// Clean up
activity_private_settings_close(file);
// Init insights
activity_insights_init(utc_now);
// Set up charger subscription and check right now if charger is connected
s_activity_state.charger_subscription = (EventServiceInfo) {
.type = PEBBLE_BATTERY_STATE_CHANGE_EVENT,
... | activity_algorithm_get_minute_history(context->minute_data,
context->num_records,
context->utc_start) | ;
} else {
context->success = false;
}
// Unblock the caller
context->completed = true;
xSemaphoreGive(s_activity_state.bg_wait_semaphore);
}
bool activity_get_minute_history(HealthMinuteData *minute_data, uint32_t *num_records,
time_t *utc_start) {
// Fill in the cont... |
er_state);
}
}
// ----------------------------------------------------------------------------------------------
// Event service handler for tap events
static void prv_do_shake_handle(PebbleEvent *e, void *context) {
PebbleTask task = pebble_task_get_current();
AccelServiceState *state = (AccelServiceState *)a... | (state, time_interval_ms) | ;
sys_analytics_add(ANALYTICS_APP_METRIC_ACCEL_SAMPLE_COUNT, num_processed, AnalyticsClient_CurrentTask);
} while (num_processed);
}
// -----------------------------------------------------------------------------------------------
int accel_service_set_sampling_rate(AccelSamplingRate rate) {
AccelServiceSt... |
roll_layer).y);
}
void test_menu_layer__test_set_selection_animation(void) {
MenuLayer l;
const int height = 180;
menu_layer_init(&l, &GRect(10, 10, height, 180));
menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){
.draw_row = prv_draw_row,
.get_num_rows = prv_get_num_rows,
});
cl_assert_equ... | GRect(10, 10, height, 180) | );
menu_layer_set_center_focused(&l, true);
menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){
.draw_row = prv_draw_row,
.get_num_rows = prv_get_num_rows,
.get_cell_height = prv_get_row_height_depending_on_selection_state,
});
const int FOCUSED = MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGH... |
ds = 1
};
command = gdraw_command_list_get_command(&frame->command_list, 0);
points2[0].x++; // increment x value to distinguish draw command from command in previous frame
*command = (GDrawCommand) {
.type = GDrawCommandTypePath,
.hidden = false,
.stroke_color = GColorRed,
.stroke_width = 5,
... | cl_assert_equal_i(frame->command_list.num_commands, 3) | ;
GDrawCommand *command = gdraw_command_list_get_command(&frame->command_list, 2);
cl_assert_equal_i(command->type, GDrawCommandTypePath);
cl_assert_equal_i(command->num_points, 3);
cl_assert_equal_i(command->stroke_color.argb, GColorGreenARGB8);
cl_assert_equal_i(command->fill_color.argb, GColorPurpleARGB8);... |
F ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "app_install_manager.h"
#include "app_install_manager_private.h"
#include "app_custom_icon.h"
#include "app_manager.h"
#include "worker_manager.h"
#include "app... | {
const int32_t time_since_activity = time_get_uptime_seconds() - app->last_activity;
if (app->can_expire && (time_since_activity < VISIBILITY_ON_ACTIVITY_TIMEOUT_SECONDS)) {
// The recent app should eventually expire and we are still below the threshold
rv = true;
} else if (!app->can... | |
clude "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "kernel/ui/modals/modal_manager.h"
#include "kernel/ui/system_icons.h"
#include "resource/resource_ids.auto.h"
#include "services/common/i18n/i18n.h"
#include "services/common/light.h"
#include "services/common/new_timer/new_timer.h"
#include "services... | {
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
const char *font_key_default = FONT_KEY_GOTHIC_28_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_24_PAIR;
#else
const char *font_key_default = FONT_KEY_GOTHIC_24_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_20_PAIR;
#endif
const Translation english_tr... |
prv_update_text_layer_with_translation(&data->info_text_layer2,
&translations[data->translated_str_idx]);
}
data->num_strings_shown++;
}
static void prv_animate_info_text(BTPairingUIData *data) {
prv_update_prf_info_text_layers_text(data);
animation_schedule(pr... |
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 specific language governing p... | {
bt_test_reset_callback(app_data);
} |
}
}
static void config_provider(Window *window) {
// single click / repeat-on-hold config:
window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler) select_single_click_handler);
window_single_click_subscribe(BUTTON_ID_BACK, (ClickHandler) back_single_click_handler);
}
static void handle_init() {
AppD... |
/*
* 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... | {
// NYI
return S_SUCCESS;
} |
status_t notif_db_delete(const uint8_t *key, int key_len) {
if (key_len != UUID_SIZE) {
return E_INVALID_ARGUMENT;
}
notification_storage_remove((Uuid *)key);
notifications_handle_notification_removed((Uuid *)key);
return S_SUCCESS;
}
status_t notif_db_flush(void) {
notification_storage_reset_and_i... |
FOCUSED, l.selection.h);
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionUp]);
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]);
menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignNone, false);
cl_assert_equal_i(1 * NORMAL, l.selection.y);
cl_assert... | (l.animation.animation, ANIMATION_NORMALIZED_MAX / 10) | ;
// still unchanged
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row);
cl_assert_equal_i(0 * basic_cell_height, l.selection.y);
cl_assert_equal_i(initial_scroll_offset, l.scroll_layer.content_sublayer.bounds.origin.y);
// and updated
impl->update(l.animation.animation, ANIMATION_NORMALIZED_MAX *... |
.duration = 120,
.type = TimelineItemTypePin,
.flags = 0,
.layout = LayoutIdTest,
}
}, {
.header = {
.id = {0xdd},
.parent_id = {0},
.timestamp = s_feb_5_midnight + 8 * 60 * 60 + 15 * 60, // 8:15-8:16 am
.duration = 1,
.type = TimelineItemTypePin,
.flags =... | cl_assert(iter_next(&iterator)) | |
ocal time
if (header->timestamp % SECONDS_PER_DAY != 0) {
// NOT at UTC midnight, so presumably an iOS bug
midnight = time_util_get_midnight_of(header->timestamp);
} else {
midnight = timeline_item_get_tz_timestamp(header);
}
for (int i = 0; i < num_nodes; i++) {
nodes[i]->timestamp = midnight;
... | {
TimelineNode *node = (TimelineNode *)list_get_head((ListNode *)node0);
PBL_LOG(LOG_LEVEL_DEBUG, "= = = = = = = =");
while (node) {
PBL_LOG(LOG_LEVEL_DEBUG, "======");
PBL_LOG(LOG_LEVEL_DEBUG, "Node with id %x%x...", node->id.byte0, node->id.byte1);
PBL_LOG(LOG_LEVEL_DEBUG, "Index %d", node->index);
... |
#endif
// dummy iterator that always returns false
// Useful for when there aren't any items in pindb
// but we don't want an invalid iterator.
static bool prv_iter_dummy(IteratorState state) {
return false;
}
static bool prv_iter_next(IteratorState state) {
TimelineIterState *timeline_iter_state = (TimelineIter... |
_display_colors[NUM_SHAPES];
#define MAX_STROKE_WIDTH 20
static const GPathInfo s_triangle_path = {
3,
(GPoint[]) {
{ -10, 0 },
{ 0, 10 },
{ 10, 0 }
}
};
static const GPathInfo s_bucket_path = {
4,
(GPoint[]) {
{ -10, 0 },
{ -10, 30 },
{ 10, 30 },
{ 10, 0 }
}
};
static const ... | if (stroke_width_enabled(data->state_index)) {
data->stroke_width++;
if (data->stroke_width >= MAX_STROKE_WIDTH) {
data->stroke_width = 1;
}
} |
log_state(data);
}
static void select_handler(ClickRecognizerRef recognizer, void *context) {
AppData *data = app_state_get_user_data();
update_state(data, ((data->state_index + 1) % APP_STATE_NUM_STATES));
log_state(data);
}
static void down_handler(ClickRecognizerRef recognizer, void *context) {
AppData... |
stem/passert.h"
#include "system/reboot_reason.h"
#include "system/version.h"
#include "util/attributes.h"
#include "util/build_id.h"
#include <inttypes.h>
static const uint16_t ENDPOINT_ID = 2002;
typedef struct PACKED {
uint8_t command;
uint32_t cookie;
} BluetoothHeader;
typedef struct BluetoothDumpLineCallb... | (LOG_LEVEL_ERROR, "Invalid dump log message received -- length %u", length) | ;
return;
}
generation = data[1];
cookie = *((uint32_t*) (data + 2));
} else {
if (length != 5) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid dump log message received -- length %u", length);
return;
}
cookie = *((uint32_t*) (data + 1));
}
switch (*data) {
case 0x00:
prv_f... |
// fields next to eachother are set. We set UUID first (well, create_app does),
// and then set the fields on either side, and verify that UUID remains
// unchanged.
// struct AppHeartbeat {
// [...]
// uint32 TIME_INTERVAL
// Uuid UUID
// uint8 SDK_MAJOR_VERSION
// [...]
// }
void test_anal... | {
for (int j = 0; j < analytics_metric_num_elements(metric); j++) {
analytics_heartbeat_set_array(heartbeat, metric, j, pattern(i, 8));
i++;
}
} | else {
analytics_heartbeat_set(heartbeat, metric, pattern(i, 8));
i++;
}
}
analytics_heartbeat_print(heartbeat);
i = 0x80;
for (AnalyticsMetric metric = ANALYTICS_APP_METRIC_START + 1;
metric < ANALYTICS_APP_METRIC_END; metric++) {
if (analytics_metric_is_array(metric)) {
for... |
cter, then get the start of the next codepoint.
*transcription_dialog->zero = transcription_dialog->missing;
while (current_idx++ < to_idx) {
cursor = utf8_get_next(cursor);
}
char *next = (char *)cursor;
if (next == dialog->buffer + transcription_dialog->buffer_len) {
return;
}
// Move the zero... | (transcription_dialog->pop_timer) | ;
prv_stop_text_animation(transcription_dialog);
}
static void prv_transcription_dialog_load(void *context) {
TranscriptionDialog *transcription_dialog = context;
transcription_dialog->was_pushed = true;
if (transcription_dialog->buffer_len > 0) {
Dialog *dialog = expandable_dialog_get_dialog((ExpandableDi... |
2_t pattern = graphics_private_get_1bit_grayscale_pattern(color, (uint8_t) y);
uint32_t left_edge_block, right_edge_block, mask;
const uint32_t left_edge_bits_count = x % 32;
const uint32_t right_edge_bits_count = (x + width) % 32;
uint32_t *block = ((uint32_t*)framebuffer->addr) + (y * (framebuffer->row_size_b... | PBL_ASSERTN(framebuffer->bounds.origin.x == 0 && framebuffer->bounds.origin.y == 0) | ;
GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer, y1.integer);
GColor8 *output = (GColor8 *)(data_row_info.data + x);
// first pixel with blending
const unsigned int data_row_offset = data_row_info.data - (uint8_t *)framebuffer->addr;
if (y1.fraction != 0) {
// Only draw the pi... |
/*
* 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... | content_indicator_get_current_buffer() | ;
content_indicator_init_buffer(buffer);
}
void test_timeline_layouts__cleanup(void) {
free(fb);
}
// Helpers
//////////////////////
void prv_handle_down_click(ClickRecognizerRef recognizer, void *context);
static void prv_render_layout(LayoutId layout_id, const AttributeList *attr_list,
... |
tatus = DataLoggingStatusInactive;
// Free up the data and mutex for this session
mutex_destroy(session->data->mutex);
kernel_free(session->data);
session->data = NULL;
}
}
return true;
}
// ----------------------------------------------------------------------------------------
void ... | prv_dls_create(tag, item_type, item_size, buffered, NULL /*buffer*/, resume, uuid) | ;
}
// ----------------------------------------------------------------------------------------
DataLoggingSession* dls_create_current_process(uint32_t tag, DataLoggingItemType item_type,
uint16_t item_size, void* buffer, bool resume) {
const PebbleProcessMd *md = sys_... |
n the action bar to render normal or inverted:
action_bar_set_highlighted(action_bar, index, is_highlighted);
}
static void action_bar_raw_up_handler(ClickRecognizerRef recognizer, void *context) {
ActionBarLayer *action_bar = (ActionBarLayer *)context;
action_bar_raw_up_down_handler(recognizer, action_bar, fals... | gcolor_equal(background_color, action_bar->background_color) | ) {
return;
}
action_bar->background_color = background_color;
layer_mark_dirty(&(action_bar->layer));
}
|
ic void prv_inactive_timer_refresh(TimelineAppData *data) {
static const uint32_t INACTIVITY_TIMEOUT_MS = 30 * 1000;
s_app_data->inactive_timer_id = evented_timer_register_or_reschedule(
s_app_data->inactive_timer_id, INACTIVITY_TIMEOUT_MS, prv_inactive_timer_callack, data);
}
///////////////////////////////... | (data->current_animation) | ;
data->current_animation = NULL;
timeline_layer_reset(timeline_layer);
if (timeline_model_is_empty() &&
prv_set_state(data, TimelineAppStateNoEvents)) {
// Hide layouts and animate to "No events"
timeline_layer_set_layouts_hidden(&data->timeline_layer, true);
prv_init_peek_layer(data);
pr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.