prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 1);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXN... | graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dr... |
_TICKS_REGISTER);
}
static void save_rtc_time_state_exact(RtcIntervalTicks current_rtc_ticks, time_t time) {
RTC_WriteBackupRegister(CURRENT_TIME_REGISTER, time);
RTC_WriteBackupRegister(CURRENT_INTERVAL_TICKS_REGISTER, current_rtc_ticks);
// Dbgserial instead of PBL_LOG to avoid infinite recursion due to PBL_L... | (get_ticks()) | ;
}
void rtc_get_time_ms(time_t* out_seconds, uint16_t* out_ms) {
RtcTicks ticks = get_ticks();
RtcTicks ticks_since_time_base = (ticks - s_time_tick_base);
*out_seconds = s_time_base + (ticks_since_time_base / RTC_TICKS_HZ);
RtcTicks ticks_this_second = ticks_since_time_base % RTC_TICKS_HZ;
*out_ms = (tic... |
uint8_t value_out[],
uint16_t *value_length_in_out) {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(value_length_in_out, sizeof(*value_length_in_out));
syscall_assert_userspace_buffer(value_out, *value_length_in_out);
}
g... | if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(device, sizeof(*device));
} |
*device = gatt_client_service_get_device(service);
}
DEFINE_SYSCALL(uint8_t, sys_ble_service_get_included_services, BLEService service_ref,
BLEService included_services_out[],
uint8_t num_services) {
if (PRIVILEGE_WAS_ELEV... |
n_size_limit);
if (!generic_glance->displayed_icon) {
// Try again with the app's default icon if we didn't just try it
if (!prv_app_resource_info_equal(&res_info_to_load,
&generic_glance->default_icon_resource_info)) {
res_info_to_load = generic_glance->default_ico... | if (glance->current_slice.type != AppGlanceSliceType_IconAndSubtitle) {
return;
} |
LauncherAppGlanceStructured *structured_glance = (LauncherAppGlanceStructured *)glance;
LauncherAppGlanceGeneric *generic_glance =
launcher_app_glance_structured_get_data(structured_glance);
const TimelineResourceId timeline_res_id =
(TimelineResourceId)glance->current_slice.icon_and_subtitle.icon_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
// The loop above consists of 2 instructions (output of arm-none-eabi-objdump -d
// delay.X.o):
//
// subs r0, #1
// bne.w 4 <spinloop>
//
// Subtract consumes 1 cycle & the conditional branch consumes 1 + P (pipeline fill delay,
// 1-3 cycles) if the branch is taken, or 1 if not taken. For this si... |
s_loops_per_us = PS_PER_US / (clock_period_ps * INSTRUCTIONS_PER_LOOP);
// we always want to delay for more than the time specified so round up
// if the numbers don't divide evenly
if ((PS_PER_US % (clock_period_ps * INSTRUCTIONS_PER_LOOP)) != 0) {
s_loops_per_us += 1;
}
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (origin, GPoint(40, 60)) | ;
// text_layer's absolute coordinate as there's no container
cl_assert_equal_gpoint(page.origin, GPoint(40, 60));
cl_assert_equal_gsize(page.size, GSize(30, TEXT_LAYER_FLOW_DEFAULT_PAGING_HEIGHT));
scroll_layer_is_instance_value = &container;
cl_assert(true == text_layer_calc_text_flow_paging_values(&text_l... |
-16, -152},
{ 960, -16, -184},
{ 896, -16, -200},
{ 872, -24, -200},
{ 928, -48, -192},
{ 984, -64, -216},
{ 968, -80, -208},
{ 1000, -80, -224},
{ 1096, -64, -248},
{ 1176, -64, -232},
{ 1184, -56, -200},
{ 1552, -40, -288},
{ 1392, 24, -296},
{ 1008, 16, -168},
... | { 488, 816, -104},
{ 480, 704, -128},
{ 480, 576, -104},
{ 480, 544, -88},
{ 480, 408, -72},
{ 544, 424, -48},
{ 792, 464, -104},
{ 800, 312, -88},
{ 912, 192, -80},
{ 984, 48, 96},
{ 1496, 24, 104},
{ 1432, 152, -96},
{ 1440, 144, -264},
{ 1456, 112, -336},
{... |
{ 592, 192, -232},
{ 568, 232, -344},
{ 592, 232, -400},
// 16 seconds
{ 576, 200, -432},
{ 936, 208, -432},
{ 808, 248, -416},
{ 712, 296, -648},
{ 688, 208, -624},
{ 912, 240, -480},
{ 960, 200, -416},
{ 976, 184, -424},
{ 864, 160, -464},
{ 808, 136, -424},
... |
_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_one_byte(void) {
cl_assert(system_flash_erase(FLASH_BASE, 1, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_one_byte_in_middle_of_sector(void) {
cl_assert(system_f... | {
// Pretty sure FLASH_Sector_N defines are simply 8*N, at least for the first
// twelve sectors.
cl_assert_(!flash_locked, "Attempted to erase a locked flash");
cl_assert_(IS_FLASH_SECTOR(sector), "Sector number out of range");
cl_assert(IS_VOLTAGERANGE(voltage_range));
cl_check_(flash_flags_set == false, ... |
extern FLASH_Status FLASH_ProgramByte(uint32_t address, uint8_t data) {
cl_assert_(!flash_locked, "Attempted to write to a locked flash");
cl_assert_(address >= flash_data_start &&
address < flash_data_start + flash_data_length,
"Address out of range");
cl_assert_(flash_written_flag[ad... |
G(30), TO_TRIG(60)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(30),GCornerTopRight},
.full_quadrants = GCornerNone,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(60),GCornerTopRight}
}));
// Starting quadrant filling up and ending quadrant finishing
cl_assert_equal_... | .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(45),GCornerTopRight}
}));
// Flipping quadrant issue
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(70), TO_TRIG(90)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(70),GCornerTopRight},
.full_quadrants = GCornerN... | |
.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_I2S_DeInit(FLASH_CONFIG.spi);
spi_cfg.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
sp... | {
prv_enable_flash_spi_clock();
prv_flash_start();
// Assume that last time we shut down we were asleep. Come back out.
prv_flash_deep_sleep_exit();
prv_disable_flash_spi_clock();
prv_flash_whoami();
} |
bool flash_sanity_check(void) {
return prv_is_whoami_correct();
}
void flash_read_bytes(uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) {
if (!buffer_size) {
return;
}
prv_enable_flash_spi_clock();
prv_flash_wait_for_write();
prv_flash_start_cmd();
prv_flash_send_and_receive_byte(FLA... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | for (int i = 0; i < c->total_items; i++) {
uint8_t* item = prv_get_item_at_index(c, i);
if (c->item_destructor) {
c->item_destructor(item);
}
} |
c->next_erased_item_idx = 0;
}
|
dialog_set_background_color(dialog, data->background_color);
const size_t warning_length = 64;
char buffer[warning_length];
const uint32_t battery_hours_left = battery_curve_get_hours_remaining(percent);
const char *message = clock_get_relative_daypart_string(rtc_get_time(), battery_hours_left);
if (message)... | if (s_dialog) {
dialog_pop(s_dialog);
s_dialog = NULL;
} |
}
|
Make sure we haven't already set up the channel in question.
if (irqn == EXTI9_5_IRQn) {
if (s_9_5_nvic_configured) {
return; // Already configured
}
s_9_5_nvic_configured = true;
} else if (irqn == EXTI15_10_IRQn) {
if (s_15_10_nvic_configured) {
return; // Already configured
}
... | {
prv_check_handle_exti(i);
} |
}
void EXTI15_10_IRQHandler(void) {
NVIC_ClearPendingIRQ(EXTI15_10_IRQn);
for (int i = 10; i <= 15; ++i) {
prv_check_handle_exti(i);
}
}
|
e_percent(), 0);
}
void test_ams__receive_player_volume_update(void) {
prv_connect_ams();
// Receive volume of 0.604925
// 00 02 00 30 2e 36 30 34 39 32 35 ...0.604 925
uint8_t volume_update[] = {
0x00, 0x02, 0x00, 0x30, 0x2e, 0x36, 0x30, 0x34,
0x39, 0x32, 0x35,
};
prv_receive_en... | (album, "Kind Of Blue (Legacy Edition)") | ;
}
// Tests: Music service capabilities
///////////////////////////////////////////////////////////
void test_ams__supported_capabilities(void) {
prv_connect_ams();
// music_is_progress_reporting_supported() relies on a valid track duration
uint8_t track_duration_update[] = {
0x02, 0x03, 0x00, 0x33, 0x31,... |
ottom.y.raw_value) {
prv_swap_precise_points(&end_top, &end_bottom);
} else if (end_top.y.raw_value == end_bottom.y.raw_value &&
(config.end_quadrant.quadrant & GCornersBottom)) {
// Special case to make bottom edge to be on left side and keep masking algorithm happy
prv_swap_precise_points(&... | if (odd_line) {
int16_t starting_edge = center.x.raw_value - radius_outer_x.raw_value;
int16_t ending_edge = center.x.raw_value + radius_outer_x.raw_value;
if (!is_full_circle) {
// Following code finds crossing points slightly above and below center point
// as the radial angles will appear ... |
int16_t right = center.x.raw_value + outer_edge;
if (!no_innner_ellipsis && radius_inner_y.integer != 0) {
// This complicates the situation
int16_t inner_edge =
prv_get_ellipsis_border(y, radius_inner_y_sq, radius_inner_x_sq).raw_value;
int16_t inner_left = center.x.raw_value - i... |
AccelOperatingMode_Data,
AccelOperatingMode_ShakeDetection,
AccelOperatingMode_DoubleTapDetection,
AccelOperatingModeCount,
} AccelOperatingMode;
static struct {
bool enabled;
bool using_interrupts;
BMA255ODR odr;
} s_operating_states[AccelOperatingModeCount] = {
[AccelOperatingMode_Data] = {
.ena... | BMA255_DBG("%"PRId16" %"PRId16" %"PRId16, data->x, data->y, data->z) | ;
}
typedef enum {
BMA255Axis_X = 0,
BMA255Axis_Y,
BMA255Axis_Z,
} BMA255Axis;
static void prv_drain_fifo(void) {
// TODO: I think the ideal thing to do here would be to invoke the accel_cb_new_sample() while
// the SPI transaction is in progress so we don't need a static ~500 byte buffer. (This is what
/... |
NDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("16:00", time_buf);
// June 8th 2015, 16:00:00 (T-48:00:00)
rtc_set_time(event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(tim... | (jun10th_noon_2015) | ;
// Our test event is at June 9th 2015, 16:00:00
// Now - one day
const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY + (4 * SECONDS_PER_HOUR);
// if the event is within 24 hours, then show the actual time instead of "X hours ago"
const int MAX_RELATIVE_HRS = 13;
clock_set_24h_style(true);
// J... |
olor lorem. Aenean scelerisque nulla sed tristique posuere. "
"Proin dui magna, gravida faucibus ultricies non, tincidunt id metus. "
"Integer a laoreet dolor, eu vulputate enim. Ut vitae hendrerit nunc, in "
"bibendum eros. Pellentesque congue ut quam id sollicitudin. Cras "
"malesuada arcu nec imperdiet cursu... | {
if (string_buffer[i] != '~') {
char error_msg[132];
snprintf(error_msg, sizeof(error_msg), "persist_read_string clobbers "
"destination buffer at %zd when key does not exist", i);
cl_fail(error_msg);
}
} |
}
void test_persist__string_write_unterminated_string(void) {
char string_buffer[PERSIST_STRING_MAX_LENGTH + 2];
memset(string_buffer, '~', sizeof(string_buffer));
cl_assert_equal_i(persist_write_string(0, lipsum), PERSIST_STRING_MAX_LENGTH);
cl_assert_equal_i(persist_get_size(0), PERSIST_STRING_MAX_LENGTH);... |
assert_equal_i(s_num_requested_app_attributes, 1);
cl_assert_equal_i(s_num_ds_notifications_received, 2);
}
void test_ancs__ancs_invalid_param(void) {
NSNotification ns_notification = {
.event_id = EventIDNotificationAdded,
.event_flags = 0,
.category_id = CategoryIDSocial,
.category_count = 1,
... | ((uint8_t *)&s_unknown_app_dict) | ;
prv_cmp_last_received_notification(&s_unknown_app_parsed_item);
// Make sure both apps attributes were requested (Messages and FakeApp)
cl_assert_equal_i(s_num_requested_app_attributes, 2);
// Test a recognized app with a unique title
prv_send_notification((uint8_t *)&s_message_dict);
prv_cmp_last_recei... |
this i18n'd string because not leaking it is really hard.
// We make sure we only ever allocate it once though, so it's not the end of the world.
prv_put_notification_action_result(&item->header.id, i18n_get("Removed", &i18n_key),
TIMELINE_RESOURCE_RESULT_DELETED, ActionRe... | (&action->attr_list, AttributeIdIconLarge,
TIMELINE_RESOURCE_THUMBS_UP) | |
IN AGO", time_buf);
// June 9th 2015, 12:05:00 (T+00:05:00)
rtc_set_time(event_time + (5 * SECONDS_PER_MINUTE));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("5 MIN AGO", time_buf);
// June 9th 2015, 12:10:00 (T+00:10:00)
rtc_set_time(event_... | clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS) | |
);
prv_file_close_and_unlock(&file);
}
// ----------------------------------------------------------------------------------------------
bool alarm_get_enabled(AlarmId id) {
SettingsFile file;
if (!prv_file_open_and_lock(&file)) {
return false;
}
bool is_enabled = false;
AlarmConfig config;
bool rv... | (ALARM_PREF_KEY_SNOOZE_DELAY) | ,
&s_snooze_delay_m, sizeof(s_snooze_delay_m));
prv_file_close_and_unlock(&file);
}
// ----------------------------------------------------------------------------------------------
static bool prv_analytics_op(AlarmId id, AlarmConfig *config, void *context) {
const AlarmInfo info = {
.hou... |
_with_resource(resource_id);
cl_assert(bitmap_sequence);
GBitmap *bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(bitmap_sequence),
GBitmapFormat8Bit);
cl_assert(bitmap);
// Since frame 1 has 0 delay, it renders then immediately we render frame 2
gbitm... | (gbitmap_pbi_eq(bitmap, GET_PBI_NAME(2))) | ;
gbitmap_set_bounds(bitmap, shift_bounds);
gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL);
gbitmap_set_bounds(bitmap, orig_bounds);
cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(3)));
gbitmap_set_bounds(bitmap, shift_bounds);
gbitmap_sequence_update_bitmap_next_frame(bitmap_s... |
graphics_private_raw_mask_set_value(ctx, mask, p, new_pixel_value) | ;
}
}
static void prv_blend_color_and_update_mask(GContext *ctx, int16_t y, int16_t min_x, int16_t max_x,
GColor color, uint8_t factor) {
color.a = (GColor8Component)(factor * 3 / (FIXED_S16_3_ONE.raw_value - 1));
prv_update_mask(ctx, y, min_x, max_x, color);
}
T_STAT... | |
ode multi-byte char
void test_utf8_iterator__decode_test_single_codepoint_string_multi_byte(void) {
// Mutable types
Iterator utf8_iter;
Utf8IterState utf8_iter_state;
// Immutable types
bool success = false;
const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "\xc3\xb0");
cl_assert(utf8_bounds.end ... | utf8_each_codepoint(str, prv_each_codepoint, context) | |
n writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applib/graphics/gbitmap_png.h"
#in... | setup_png_test(TEST_PNG_FILE_FMT(4bitpalette)) | ;
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(4bitpalette)));
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat4BitPalette);
}
// Tests 8-bit transparent palettized PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__color_8_bit_transparent(void) {
GBitm... |
/*
* 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... | {
struct FlashTestData *data = app_state_get_user_data();
window_set_background_color(window, GColorBlack);
TextLayer *msg_text_layer = &data->msg_text_layer[0];
text_layer_init(msg_text_layer, &GRect(0, 12, window->layer.bounds.size.w, 18));
switch (data->test_case) {
case FLASH_TEST_CASE_RUN_DATA_TEST... |
text_layer_set_text(msg_text_layer, "Select To Confirm Switch");
}
else {
text_layer_set_text(msg_text_layer, "Press Select To Start");
}
text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter);
text_layer_set_background_color(msg_text_layer, GColorBlack);
text_layer_set_text_color(msg_... |
{ -24, 944, -120},
{ -32, 952, -104},
{ -32, 952, -104},
{ -32, 952, -112},
{ -24, 952, -112},
{ -24, 952, -104},
{ -32, 952, -112},
{ -32, 952, -104},
{ -24, 952, -112},
{ -24, 952, -104},
// 27 seconds
{ -24, 952, -112},
{ -24, 952, -112},
{ -32, 952, -96},
{ -2... | { -24, 952, -144},
{ -24, 952, -144},
{ -24, 944, -136},
{ -24, 952, -144},
{ -24, 952, -144},
{ -24, 952, -136},
{ -24, 952, -136},
{ -24, 952, -136},
{ -24, 952, -144},
{ -24, 952, -136},
{ -32, 952, -144},
{ -24, 952, -144},
{ -24, 944, -144},
{ -24, 944, -144}... |
{ -8, 952, -168},
{ -8, 944, -168},
{ 0, 952, -168},
// 35 seconds
{ 0, 944, -168},
{ -8, 944, -160},
{ 0, 944, -152},
{ -8, 944, -168},
{ -8, 944, -168},
{ -8, 944, -168},
{ -8, 952, -160},
{ -8, 944, -168},
{ -16, 944, -160},
{ -8, 952, -168},
{ -16, 952, -... |
num_service_instances);
// Assert GATT reads requests to Meta characteristics happened:
fake_gatt_client_op_assert_read(s_characteristics[0][PPoGATTCharacteristicMeta],
GAPLEClientKernel);
fake_gatt_client_op_assert_read(s_characteristics[1][PPoGATTCharacteristicMeta],
... | ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta],
(const uint8_t *) &meta_invalid_uuid,
sizeof(meta_invalid_uuid),
BLEGATTErrorSuccess) | ;
// No client created:
cl_assert_equal_i(ppogatt_client_count(), 0);
cl_assert_equal_b(ppogatt_has_client_for_uuid(&meta_invalid_uuid.app_uuid), false);
}
void test_ppogatt__deletes_existing_client_after_rediscovery(void) {
prv_notify_services_discovered(1);
ppogatt_handle_read_or_notification(s_characteri... |
TION_BAR_WIDTH + PBL_IF_RECT_ELSE(2, -4);
const int32_t width = window->layer.bounds.size.w - width_of_action_bar_with_padding;
const int32_t x_offset = PBL_IF_RECT_ELSE(0, 22);
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
const int32_t info_text_y_offset = 36;
#else
const int32_t info_text_y_offset = PBL_IF_RECT_E... | (&data->device_name_text_layer) | ;
text_layer_deinit(&data->code_text_layer);
gbitmap_destroy(data->approve_bitmap);
gbitmap_destroy(data->decline_bitmap);
action_bar_layer_deinit(&data->action_bar_layer);
new_timer_delete(data->timer);
if (data->ui_state == BTPairingUIStateAwaitingUserConfirmation) {
prv_send_response(fa... |
ith 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 express ... | (info && info->read_complete) | |
); // both OFF
do_not_disturb_set_schedule(WeekdaySchedule, &schedule);
do_not_disturb_set_schedule_enabled(WeekdaySchedule, 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 schedule... | do_not_disturb_is_smart_dnd_enabled() | == false);
do_not_disturb_toggle_smart_dnd(); // Only smart DND is on
cl_assert(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 = fa... |
n/clock.h"
#include "services/common/compositor/compositor.h"
#include "services/common/regular_timer.h"
#include "services/common/system_task.h"
#include "services/common/new_timer/new_timer_service.h"
#include "services/common/new_timer/new_timer.h"
#include "services/common/analytics/analytics.h"
#include "services/... | BLTEST_LOG("BOOTLOADER TEST FAILED") | ;
}
boot_bit_clear(BOOT_BIT_BOOTLOADER_TEST_A | BOOT_BIT_BOOTLOADER_TEST_B);
psleep(10000);
system_hard_reset();
for (;;) {}
// won't get here, rest gets optimized out
#endif
#ifdef RECOVERY_FW
boot_bit_clear(BOOT_BIT_RECOVERY_START_IN_PROGRESS);
#endif
extern uint32_t __kernel_main_stack_start__[];
... |
// for each line segment (do not draw line returning to the first point if open is true)
for (uint32_t i = 0; i < (open ? (path->num_points - 1) : path->num_points); ++i) {
int i2 = (i + 1) % path->num_points;
GPoint rot_start = rotate_offset_point(&path->points[i], path->rotation, &path->offset);
GPoint... | {
continue;
} |
// use the first non-horizontal path segment's direction as the start direction
if (rot_end.y.integer != rot_start.y.integer) {
start_is_down = rot_end.y.integer > rot_start.y.integer;
found_start_direction = true;
}
rot_end = rot_start;
}
const int16_t clip_min_x = ctx->draw_state.c... |
ich results from having multi-click enabled
window_raw_click_subscribe(BUTTON_ID_UP, prv_raw_click_handler, NULL, context);
window_single_repeating_click_subscribe(BUTTON_ID_UP, SCROLL_REPEAT_MS,
prv_single_click_handler);
window_multi_click_subscribe(BUTTON_ID_UP, 2, 2, ... | (&swap_layer->arrow_layer.layer, &arrow_frame) | ;
layer_set_update_proc(&swap_layer->arrow_layer.layer, prv_arrow_layer_update_proc);
layer_add_child(layer, &swap_layer->arrow_layer.layer);
}
void swap_layer_deinit(SwapLayer *swap_layer) {
swap_layer->is_deiniting = true;
gbitmap_deinit(&swap_layer->arrow_layer.arrow_bitmap);
layer_deinit(&swap_layer->arr... |
/*
* 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_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
.appear = prv_window_appear,
}) | |
e current second to be
// 1, and the destination second to be 0. This works because it means we cannot use the current
// time as-is, but it will not influence the other fields more than necessary.
if (!job->may_be_instant) {
current_tm.tm_sec = 1;
}
// Cron tm is based on the current tm
struct tm cron_... | if (prv_adjust_for_wday_spec(job, &cron_tm)) {
// If the day has been adjusted, we need to re-set hour+minute+second.
// Since we are definitely in the future on an adjustment, fields with 'any' should be
// set to 0, otherwise set to the spec value.
cron_tm.tm_hour = MAX(job->hour, 0);
cron_tm.tm_m... |
// Adjust back to 1-indexed
cron_tm.tm_mday += 1;
// Decide the DSTny (Adjust for DST transitions)
cron_tm.tm_gmtoff = current_tm.tm_gmtoff; // We're using the current time's GMT offset
cron_tm.tm_isdst = 0; // We'll do the DST adjust ourselves
time_t t = mktime(&cron_tm);
// Apply offset seconds
t ... |
d) {
prv_discover_and_read_meta_and_reset();
// Simulate getting "Reset Complete" from remote:
prv_receive_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]);
// Expect "Reset Complete" to be sent by FW:
prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]);
// Expe... | prv_discover_and_read_meta_and_reset() | ;
// Timeout waiting for "Reset Complete":
for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) {
regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS);
}
// Expect "Reset Request" sent by FW:
prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
}
void test_ppogatt__serve... |
ze.h; y++) {
const uint8_t mask_pixel_value = (uint8_t)(y / num_pixels_per_mask_value);
for (int16_t x = 0; x < mask_size.w; x++) {
test_graphics_context_mask_set_value_for_coordinate(ctx, mask, mask_pixel_value,
GPoint(x, y));
}
}
return ... | for (int dest_color_index = 0; dest_color_index < num_dest_colors; dest_color_index++) {
for (int mask_value_index = 0; mask_value_index < num_mask_values; mask_value_index++) {
int16_t x1 = (int16_t)((dest_color_index * hline_applying_test_column_width) +
(mask_value_index * num_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... | cl_assert(fpc_pinstrap_get_value() == 0x6) | ;
s_pinstrap_results[1] = PinstrapResult_Vplus;
cl_assert(fpc_pinstrap_get_value() == 0x7);
s_pinstrap_results[1] = PinstrapResult_Float;
cl_assert(fpc_pinstrap_get_value() == 0x8);
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert(ctx.dest_bitmap.info.format == GBitmapFormat8Bit ||
ctx.dest_bitmap.info.format == GBitmapFormat8BitCircular) | |
!= RCC_APB2Periph_SPI1);
periph_config_enable(BOARD_CONFIG.mic_config.spi,
BOARD_CONFIG.mic_config.spi_clock_ctrl);
periph_config_release_lock();
gpio_use(BOARD_CONFIG.mic_config.i2s_ck.gpio);
gpio_use(BOARD_CONFIG.mic_config.i2s_sd.gpio);
// Configure pins as SPI/I2S pins
GPIO_Ini... | periph_config_release_lock() | ;
// Configure I2S to use DMA
SPI_I2S_DMACmd(BOARD_CONFIG.mic_config.spi, SPI_I2S_DMAReq_Rx, ENABLE);
// Enable I2S
I2S_Cmd(BOARD_CONFIG.mic_config.spi, ENABLE);
// DMA config - use single buffer circular mode. Pointer to buffer is a 2-D array for ease of
// access
void *periph_addr = (void *)&BOARD_CO... |
yback_state);
prv_put_pos_changed_event();
}
void music_update_player_volume_percent(uint8_t volume_percent) {
mutex_lock_recursive(s_music_ctx.mutex);
s_music_ctx.player_volume_percent = volume_percent;
mutex_unlock_recursive(s_music_ctx.mutex);
PebbleEvent event = {
.type = PEBBLE_MEDIA_EVENT,
.me... | {
char title[MUSIC_BUFFER_LENGTH];
char artist[MUSIC_BUFFER_LENGTH];
char album[MUSIC_BUFFER_LENGTH];
music_get_now_playing(title, artist, album);
char buffer[128];
dbgserial_putstr_fmt(buffer, 128, "title=%s; artist=%s; album=%s", title, artist, album);
} | |
ClientApp]->node, &context->node) ||
list_contains(&s_client_event_ctxs[GAPLEClientKernel]->node, &context->node));
return exists;
}
void bt_driver_cb_gatt_client_operations_handle_response(GattClientOpResponseHdr *event) {
const GattClientEventContext *data = event->context;
bt_lock();
{
//! Specia... | (obj_ref, &connection) | ;
if (!att_handle) {
ret_val = BTErrnoInvalidParameter;
goto unlock;
}
GattClientEventContext *data = prv_create_event_context(client);
if (!data) {
ret_val = BTErrnoNotEnoughResources;
goto unlock;
}
// Zero'd out and added to list in `prv_create_event_context`
dat... |
bool is_icon_stale =
(!prv_app_resource_info_equal(&generic_glance->displayed_icon_resource_info, res_info));
if (generic_glance->displayed_icon &&
!does_default_icon_need_to_be_loaded &&
!is_icon_stale) {
// Nothing to do, bail out
return;
}
// Destroy the currently displayed icon
p... | {
LauncherAppGlanceGeneric *generic_glance =
launcher_app_glance_structured_get_data(structured_glance);
const time_t existing_reeval_time =
generic_glance->next_slice_subtitle_template_string_reeval_time;
// Bail out if the new re-evaluation time is not earlier than the existing one we have
if ((ne... | |
util.h"
#include "kernel/pbl_malloc.h"
#include "services/common/comm_session/session.h"
#include "services/common/system_task.h"
#include "system/logging.h"
#include "util/list.h"
#include <stdlib.h>
#define SYNC_TIMEOUT_SECONDS 30
static BlobDBSyncSession *s_sync_sessions = NULL;
static bool prv_session_id_filt... | ((ListNode *)s_sync_sessions,
(ListNode *)session) | |
(windows[sub_idx]->on_screen, false) | ;
} while (true);
} while (idx < NumModalPriorities - 1);
}
void test_window_stack__modal_properties_transparent(void) {
const int num_windows_per_stack = 2;
Window *windows[NumModalPriorities][num_windows_per_stack];
WindowStack *window_stacks[NumModalPriorities];
for (ModalPriority idx = ModalPriority... | |
/*
* 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... | compositor_get_framebuffer_as_bitmap() | ;
bitblt_bitmap_into_bitmap(&dest_bitmap, &src_bitmap, dest_bitmap_blit_offset, GCompOpAssign,
GColorWhite);
framebuffer_dirty_all(compositor_get_framebuffer());
// Update modal position for transparent modals
compositor_set_modal_transition_offset(dest_bitmap_blit_offset);
}
stati... |
, 0x01, 0x00, 0x41, 0x2c, 0x42, 0x2e, 0x30,
0x2c, 0x31, 0x38, 0x34, 0x2e, 0x37, 0x35, 0x35,
};
prv_receive_entity_update(nan_playback_info_update, sizeof(nan_playback_info_update));
prv_assert_initial_playback_state();
}
void test_ams__receive_incomplete_csv_list_player_playback_info_update(void) {
prv_co... | ams_create() | ;
// No assert hit.
}
void test_ams__destroy_after_destroy_is_fine(void) {
ams_destroy();
ams_destroy();
// No assert hit.
}
void test_ams__destroy_disconnects_from_music_service(void) {
prv_discover_ams(1 /* num_instances */);
// Simulate successful subscription:
BLECharacteristic entity_update = s_ch... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (0, 0, 10, -20) | |
{
gatt_client_subscriptions_subscribe(client->characteristics.data,
BLESubscriptionNone, GAPLEClientKernel);
} |
if (client->state == StateConnectedOpen) {
comm_session_close(client->session, (CommSessionCloseReason)reason);
}
list_remove(&client->node, (ListNode **) &s_ppogatt_head, NULL);
new_timer_delete(client->rx_ack_timer);
kernel_free(client);
if (s_ppogatt_head == NULL) {
regular_timer_remove_callb... | |
{
prv_init_no_pinnings_no_pinned_address();
// Pin:
cl_will_return(bt_driver_set_local_address, 0);
cl_will_return(bt_persistent_storage_has_pinned_ble_pairings, true);
bt_local_addr_pin(&TEST_PINNED_ADDR_1);
bt_local_addr_handle_bonding_change(TEST_BONDING_ID, BtPersistBondingOpDidAdd);
cl_assert_equal_... |
void test_local_addr__pause_then_pin(void) {
prv_init_no_pinnings_no_pinned_address();
// Pause:
cl_will_return(bt_driver_set_local_address, 0);
bt_local_addr_pause_cycling();
cl_assert_equal_b(false, s_last_driver_allow_cycling);
prv_assert_driver_addr_is_addr1();
// Pin, expect pinned address to be ... | |
in a complex animation
void test_animation__complex_reverse(void) {
#ifdef TEST_INCLUDE_COMPLEX
const int duration_a = 300;
const int duration_total = 2 * duration_a;
const int repeat_count = 2;
uint32_t distance;
// Create animations
Animation *a = prv_create_test_animation();
animation_set_duration(a,... | prv_create_test_animation() | |
bal_deinit();
cl_assert_equal_i(1, s_fonts_get_system_font.call_count);
cl_assert_equal_i(0, s_graphics_text_attributes_destroy.call_count);
s_rocky_text_state.text_attributes = (GTextAttributes *)123;
rocky_global_deinit();
cl_assert_equal_i(1, s_fonts_get_system_font.call_count);
cl_assert_equal_i(1, s_g... | (1, s_graphics_draw_rect_precise.call_count) | ;
GRectPrecise expected_rect = {(int)(8.5*8), 78, (int)(11.5*8), (int)(12.8*8)};
cl_assert_equal_rect_precise(expected_rect, s_graphics_draw_rect_precise.last_call.prect);
}
#define PP(x, y) (GPointPrecise( \
(int16_t)((x) * FIXED_S16_3_FACTOR), \
(int16_t)((y) * FIXED_S16_3_FACTOR)))
void test_rocky_api_grap... |
clip = true;
grect_align(&icon_rect, &rect, GAlignCenter, clip);
#if PBL_ROUND
// Offset needed because the new curvature of the action bar makes the icons look off-center
const int32_t icon_horizontal_offset = -2;
icon_rect.origin.x += icon_horizontal_offset;
#endif
icon_rect.origin.x +=... | {
window_set_click_config_provider_with_context(action_bar->window,
action_bar_click_config_provider, action_bar);
} |
}
void action_bar_layer_set_click_config_provider(ActionBarLayer *action_bar, ClickConfigProvider click_config_provider) {
action_bar->click_config_provider = click_config_provider;
action_bar_update_click_config_provider(action_bar);
}
void action_bar_layer_set_icon_animated(ActionBarLayer *action_bar, ButtonId... |
{
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25660_7
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 80
//> TEST_EXPECTED_MAX 120
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ -640, 864, -88},
{ -5... |
{ 432, 192, -856},
{ 464, 280, -880},
{ 600, 312, -784},
{ 672, 296, -600},
{ 824, 464, -488},
{ 960, 768, -480},
{ 1000, 768, -320},
{ 1016, 760, -200},
{ 976, 760, -112},
{ 944, 632, -48},
{ 1016, 688, -8},
{ 1032, 600, -80},
{ 1064, 584, -120},
{ 1056, 560, -1... | |
sert_equal_b(memcmp(&event[i], &out_event[i], sizeof(PebbleHRMEvent)), false);
}
}
{ // Test reading back unaligned
for (int i = 0; i < NUM_TEST_EVENTS; ++i) {
circular_buffer_write(&cb, (const uint8_t *)&event[i], sizeof(PebbleHRMEvent));
}
PebbleHRMEvent out_event[NUM_TEST_EVENTS];
for (... | fake_system_task_callbacks_invoke_pending() | ;
cl_assert_equal_b(hrm_is_enabled(HRM), true);
prv_advance_time_ms(1000);
// Send the next data, should still be enabled since the interval is less that the spin-up
// time
prv_fake_send_new_data();
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_b(hrm_is_enabled(HRM), true);
prv_advance_... |
fer));
return strcmp(buffer, str) == 0;
}
jerry_value_t jerry_get_object_getter_result(jerry_value_t object, const char *getter_name) {
JS_VAR getter = jerry_get_object_field(object, getter_name);
const bool is_function = jerry_value_is_function(getter);
JS_VAR result = (is_function) ? jerry_call_function(gett... | jerry_create_external_function(getter) | |
p;
}
write_offset += result;
kernel_free(notification.allocated_buffer);
}
s_write_offset = write_offset;
pfs_close(*fd);
pfs_close(new_fd);
*fd = pfs_open(FILENAME, OP_FLAG_READ | OP_FLAG_WRITE, FILE_TYPE_STATIC,
NOTIFICATION_STORAGE_FILE_SIZE);
if (*fd < 0) {
PBL_LOG(LOG_LEVEL_ERR... | (notification, header, read_buffer) | |
/*
* 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) | |
/*
* 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_append((ListNode *)s_read_head, &read->node);
} | |
agg_str = "min";
break;
case HealthAggregationMax:
exp_value = stats->max;
agg_str = "max";
break;
}
// Get the value. Since we are computing min, max, avg and we only store 1 value per day
// in our history, passing in a time range less than a day ... | (s_sys_activity_get_minute_history_values.in[1].num_records,
num_minutes_per_call) | ;
if (agg == HealthAggregationAvg) {
cl_assert_equal_i(result, avg_value);
} else if (agg == HealthAggregationMin) {
cl_assert_equal_i(result, min_value);
} else if (agg == HealthAggregationMax) {
cl_assert_equal_i(result, max_value);
} else {
cl_assert(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... | mutex_unlock_recursive(mutex) | |
/*
* 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_single_click_subscribe(BUTTON_ID_SELECT, expandable_dialog->select_click_handler);
} |
}
static void prv_expandable_dialog_load(Window *window) {
ExpandableDialog *expandable_dialog = window_get_user_data(window);
Dialog *dialog = &expandable_dialog->dialog;
GRect frame = window->layer.bounds;
static const uint16_t ICON_TOP_MARGIN_PX = 16;
static const uint16_t BOTTOM_MARGIN_PX = 6;
static... |
/*
* 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... | pulse_logging_log_sync(
log_message->log_level, log_message->filename,
htons(log_message->line_number), log_message->message) | ;
}
#else
prv_log_serial(log_message->log_level, log_message->filename,
htons(log_message->line_number), log_message->message);
#endif
}
void kernel_pbl_log_flash(LogBinaryMessage *log_message, bool async) {
int length = sizeof(*log_message) + log_message->message_length;
static const uint8_t... |
int;
if (current_codepoint == NEWLINE_CODEPOINT) {
if (is_newline_as_space) {
current_codepoint = SPACE_CODEPOINT;
} else {
break;
}
}
next_glyph_width_px = prv_codepoint_get_horizontal_advance(&ctx->font_cache,
text_box_params->font, current_codepoint);
}
// ... | is_clip_box_overflow_bottom_stop_condition_cb(ctx, line, text_box_params) | ||
is_clip_box_overflow_top_stop_condition_cb(ctx, line, text_box_params));
}
#define TEXT_LINE_BASE_LINE(line) ((line)->height_px)
#define TEXT_LINE_CAP_LINE(line) ((line)->height_px * 1 / 2)
// Based on Gothic fonts, DESCENDER is approx 1/5 of height (ascender + descender)
// Gothic 24 Bold ascent = 840, ... |
Missile Command",
.icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR,
.num_concurrent = 0,
}, false /* animated */);
TimelinePeek *peek = timeline_peek_get_peek();
const Layer *layer = &peek->layout_layer;
// Normally it is animated, but for this unit test, we don't request `animated`
cl_assert(layer->frame.... | (false, false /* animated */) | |
f 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 spec... | toupper((unsigned char)text.buffer[i]) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (cb_data, s_unscheduled_cb_data) | |
nclude <signal.h>
extern void command_hwver_write(const char*);
extern void command_pcba_serial_write(const char*);
// Tests
/////////////////////////////////////////////
void test_mfg_serials__initialize(void) {
fake_otp_reset();
}
void test_mfg_serials__cleanup(void) {
}
void test_mfg_serials__hw_version(void)... | cl_assert_equal_i(r, MfgSerialsResultFailIncorrectLength) | ;
cl_assert_equal_s(sn, "XXXXXXXXXXXX");
// String too short:
const char *short_sn = "ABCDEFGHIJK";
r = mfg_write_serial_number(short_sn, strlen(short_sn), &index);
sn = mfg_get_serial_number();
cl_assert_equal_i(index, 0);
cl_assert_equal_i(r, MfgSerialsResultFailIncorrectLength);
cl_assert_equal_s(sn... |
/*
* 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... | { 24, 0x53, 5901, 177, 0},
{ 49, 0x42, 6183, 182, 0},
{ 0, 0x41, 1487, 183, 0},
{ 0, 0x41, 1158, 175, 0},
{ 0, 0x64, 6016, 179, 0},
{ 0, 0x75, 7902, 180, 0},
{ 20, 0x75, 7532, 181, 0},
// 30: Local time: 2015-11-12 07:51:00 PM
{ 0, 0x65, 9160, 185, 0},
{ 29, 0x53, 7210, 176, 0},
... |
{ 10, 0x41, 4251, 161, 0},
{ 0, 0x52, 3021, 162, 0},
{ 0, 0x41, 2325, 158, 0},
{ 0, 0x41, 657, 155, 0},
// 75: Local time: 2015-11-12 08:36:00 PM
{ 0, 0x41, 724, 158, 0},
{ 10, 0x41, 1322, 159, 0},
{ 0, 0x41, 181, 159, 0},
{ 0, 0x41, 279, 154, 0},
{ 0, 0x51, 2447, 165, 0},
{... |
ge > s_pfs_page_count) || (unlink_count > s_pfs_page_count)) {
rv = E_INTERNAL; // should never happen
break;
}
prv_flash_write((uint8_t *)&hdr.page_flags, sizeof(hdr.page_flags),
prv_page_to_flash_offset(page) + offsetof(PageHeader, page_flags));
unlink_count++;
} while (get_next_pag... | {
closest_match = i;
} | |
TFORM_TINTIN || PLATFORM_SILK
static void prv_shutdown(void *ignored);
#else
static void prv_enter_shutdown_charging(void *ignored);
#endif
static const BatteryUIState ui_states[] = {
[BatteryGood] = { .next_state = {
BatteryWarning, BatteryLowPower, BatteryCritical, BatteryCharging, BatteryFullyCharged
}},
... | battery_ui_dismiss_modal() | ;
status_led_set(StatusLedState_Off);
}
static void prv_display_fully_charged(void *data) {
battery_ui_display_fully_charged();
status_led_set(StatusLedState_FullyCharged);
}
static void prv_dismiss_fully_charged(void) {
battery_ui_dismiss_modal();
status_led_set(StatusLedState_Off);
}
// TODO PBL-39883:... |
rvices/normal/notifications/notification_storage.h"
#include "services/normal/timeline/timeline.h"
#include "services/normal/timeline/timeline_resources.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/size.h"
#include "util/struct.h"
typedef struct {
void *action_data;
void *context;
Ac... | (&data->event_service_info) | ;
prv_cancel_response_timer(data);
applib_free(data);
}
static void prv_show_result_window(ActionResultData *data, const TimelineResourceId timeline_res_id,
const char *msg, bool succeeded) {
const GSize simple_dialog_icon_size = timeline_resources_get_gsize(TimelineResourceSiz... |
/*
* 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... |
static void prv_pin_to_card_second_half(TimelineLayout *pin_timeline_layout,
TimelineLayout *card_timeline_layout) {
KinoReel *from_reel = kino_reel_create_with_resource_system(
card_timeline_layout->icon_res_info.res_app_num,
card_timeline_layout->icon_res_info.r... |
ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon, 8:04:05 PM");
}
void test_rocky_api_datetime__locale_date_string(void) {
rocky_global_init(s_api);
EXECUTE_SCRIPT(
"var d = new Date();\n"
"var s = d.toLocaleDateString();\n"
);
ASSERT_JS_GLOBAL_EQUALS_S("s", "07/25/05");
}
void test_rocky_api_datetime__locale_... | ASSERT_JS_GLOBAL_EQUALS_S("s", "Jul") | ;
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'long'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "July");
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {year: 'numeric'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "2005");
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {year: '2-digit'});");
ASS... |
/*
* 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 (node == NULL) {
return new_node;
}
new_node->next = node->next;
new_node->prev = node;
if (node->next) {
node->next->prev = new_node;
}
node->next = new_node;
return new_node;
} |
ListNode* list_insert_before(ListNode* node, ListNode* new_node) {
if (node == NULL) {
return new_node;
}
new_node->next = node;
new_node->prev = node->prev;
if (node->prev) {
node->prev->next = new_node;
}
node->prev = new_node;
return new_node;
}
ListNode* list_pop_head(ListNode *node) {
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (id, type) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | graphics_draw_rotated_bitmap(ctx, (GBitmap*)&s_gfx_rotated_bitmap_64_bitmap,
bitmap_64_center, DEG_TO_TRIGANGLE(45), bitmap_64_center) | ;
}
static void prv_test_45_set_64px(Layer *layer, GContext* ctx) {
graphics_context_set_compositing_mode(ctx, GCompOpSet);
graphics_draw_rotated_bitmap(ctx, (GBitmap*)&s_gfx_rotated_bitmap_64_bitmap,
bitmap_64_center, DEG_TO_TRIGANGLE(45), bitmap_64_center);
}
static void prv_teard... |
qual();
prv_assert_no_event();
}
void test_gatt_client_subscriptions__subscribe_oom_for_subscription_allocation(void) {
fake_kernel_malloc_mark();
fake_malloc_set_largest_free_block(sizeof(GATTClientSubscriptionNode) - 1);
BTErrno e = gatt_client_subscriptions_subscribe(prv_get_indicatable_characteristic(),
... | prv_assert_subscription_event(characteristic, BLESubscriptionIndications, BLEGATTErrorSuccess,
false /* kernel */, true /* app */) | ;
}
void test_gatt_client_subscriptions__two_subscribers_before_cccd_write_response(void) {
BLECharacteristic characteristic = prv_get_indicatable_characteristic();
// Subscribe kernel:
BTErrno e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications,
... |
= {
.major = 5,
.minor = 13,
},
.app_face_bg_color = {0},
.template_id = 0,
};
// menu layer
static const AppDBEntry menu_layer_app = {
.name = MENU_LAYER_APP_NAME,
.uuid = {0xb8, 0x26, 0x2e, 0x08, 0x57, 0xe9, 0x4e, 0x58,
0x88, 0x02, 0x45, 0xfd, 0xfe, 0xe0, 0xac, 0x77},
.info_flags = PR... | (&data_source) | |
:31)
rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) - 31);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Fri, 12:00 PM", time_buf);
// June 11th 2015, 23:59:30 (T-12:00:30)
rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) - 30);
clock_get... | ("NOW", time_buf) | ;
// June 9th 2015, 12:00:59 (T+00:00:59)
rtc_set_time(event_time + (1 * SECONDS_PER_MINUTE) - 1);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("NOW", time_buf);
// June 9th 2015, 12:01:00 (T+00:01:00)
rtc_set_time(event_time + (1 * SECONDS_... |
mutex.h"
#include "process_management/app_install_manager.h"
#include "process_management/app_manager.h"
#include "process_management/app_storage.h"
#include "services/common/clock.h"
#include "services/common/event_service.h"
#include "services/common/new_timer/new_timer.h"
#include "services/common/system_task.h"
#in... | {
// If app running, send event
PebbleEvent event = {
.type = PEBBLE_WAKEUP_EVENT,
.wakeup = {
.wakeup_info = {
.wakeup_id = wakeup_id,
.wakeup_reason = entry.reason
}
}
};
event_put(&event);
} |
prv_wakeup_timer_next_pending();
}
// This callback is the system dispatcher that wakes up the application by AppInstallId
// OR queues a wakeup callback for that application
// and is triggered by NewTimer
static void prv_wakeup_dispatcher(void *data) {
// Place actual work on system_task to unload it from new_... |
to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "do_not_disturb.h"
#include "do_... | (msg, prv_toggle_smart_dnd) | ;
}
static void prv_push_manual_dnd_first_use_dialog(ManualDNDFirstUseSource source) {
const char *msg = i18n_get("Press and hold the Back button from a notification to turn " \
"Quiet Time on or off.", &s_data);
if (source == ManualDNDFirstUseSourceActionMenu) {
prv_push_first_use_dialog(msg, prv_toggle... |
ent size
GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
TextLayer *text_layer = &dialog->text_layer;
text_layer_init_with_parameters(text_layer, &GRect(x, y, w, h), dialog->buffer, font,
dialog->text_color, GColorClear,
alignment, ... | layer_init(&expandable_dialog->content_down_arrow_layer, &GRect(
0, frame.size.h - CONTENT_DOWN_ARROW_HEIGHT,
PBL_IF_RECT_ELSE(frame.size.w - action_bar_offset, frame.size.w),
CONTENT_DOWN_ARROW_HEIGHT)) | ;
layer_add_child(&window->layer, &expandable_dialog->content_down_arrow_layer);
content_indicator_configure_direction(
indicator, ContentIndicatorDirectionDown,
&(ContentIndicatorConfig) {
.layer = &expandable_dialog->content_down_arrow_layer,
.times_out = false,... |
nt16_t),
sizeof(uint32_t),
sizeof(int8_t),
sizeof(int16_t),
sizeof(int32_t),
0,
... | (tuple->value->cstring, SOME_EMPTY_STRING, strlen(SOME_EMPTY_STRING) + 1) | == 0);
// Check zero termination:
cl_assert(tuple->value->cstring[strlen(SOME_EMPTY_STRING)] == 0);
empty_cstring_found = true;
break;
}
tuple = dict_read_next(&iter);
}
cl_assert(count == key_count);
cl_assert(data_found);
cl_assert(string_found);
cl_assert(uint8_foun... |
tocol,
&s_tx_buffer->information[0],
s_tx_buffer->length);
prv_start_retransmit_timer(retransmit_sequence_number);
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Reached maximum number of retransmit attempts.");
prv_bounce_ncp_state();
}
}
static void prv_s... | {
ppp_control_protocol_init(PULSE2_TRAINCP);
ppp_control_protocol_open(PULSE2_TRAINCP);
s_tx_buffer = kernel_zalloc_check(sizeof(ReliableInfoBuffer) +
pulse_reliable_max_send_size());
s_tx_lock = xSemaphoreCreateBinary();
xSemaphoreGive(s_tx_lock);
} | |
ributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "spi_definitions.h"
#include "drivers/spi.h"
#include "drivers/... | if (bus->spi == SPI1) {
bus->state->spi_clock_periph = RCC_APB2Periph_SPI1;
bus->state->spi_clock_periph_speed = clocks.PCLK2_Frequency;
bus->state->spi_apb = SpiAPB_2;
} else if (bus->spi == SPI2) {
bus->state->spi_clock_periph = RCC_APB1Periph_SPI2;
bus->state->spi_clock_periph_speed = clocks.PC... |
}
static uint16_t prv_spi_find_prescaler(const SPIBus *bus) {
int lg;
if (bus->state->spi_clock_speed_hz > (bus->state->spi_clock_periph_speed / 2)) {
lg = 1; // Underclock to the highest possible frequency
} else {
uint32_t divisor = bus->state->spi_clock_periph_speed / bus->state->spi_clock_speed_hz;
... |
------
// Starts/restarts a measurement session.
static bool prv_session_measurement_encode_start(PLogSession *session) {
const ProtobufLogConfig *config = &session->config;
// Set the types pointer to the space allocated right after the PLogSession
ProtobufLogMeasurementType *types_copy = (ProtobufLogMeasuremen... | (max_data_size) | ;
if (!data_buffer) {
kernel_free(msg_buffer);
return NULL;
}
// Extra space needed for each config to store some variables and information.
// e.g. Measurement needs to store an array of types.
const size_t extra_size = prv_session_extra_space_needed(config);
PLogSession *session = kernel_zalloc(s... |
-------------------------------------------
// Get the last entry for the given handle
static AnimTestHandlerEntry *prv_last_handler_entry(AnimTestHandlerHistory *history,
Animation *animation) {
int last_entry=-1;
for (int i = 0; i < history->num_calls; i++) {
if (!animation || history->entries[i].an... | (animation_private_animation_find(animation), prv_animation_get_current()) | ;
prv_add_handler_entry(&s_update_handler_calls, animation, false,
(void *)(uintptr_t)distance /*context*/);
DPRINTF("%"PRIu64" ms: Executing update handler for %d, distance: %d\n", prv_now_ms(),
(int)animation, (int)distance);
}
// ----------------------------------------------... |
"
#include "stubs_window_manager.h"
#include "stubs_window_stack.h"
// Setup and Teardown
////////////////////////////////////
void test_selection_windows__initialize(void) {
fb = malloc(sizeof(FrameBuffer));
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
test_graphics_context_init(&s_ctx, fb);
frameb... | {
prv_prepare_canvas_and_render_for_each_size(prv_render_time_selection_window);
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
} | |
xt_layer.layer, true);
layer_set_hidden(&data->progress_layer.layer, true);
uint32_t res_id;
uint32_t end_screen_timeout;
if (success) {
res_id = RESOURCE_ID_GENERIC_CONFIRMATION_LARGE;
end_screen_timeout = COMPLETE_SCREEN_VISIBLE_DURATION_MS;
dialog_set_background_color(simple_dialog_get_dialog(&d... | (x_offset, y_offset_progress, load_bar_length, 8) | ;
ProgressLayer *progress_layer = &data->progress_layer;
progress_layer_init(progress_layer, &progress_bounds);
progress_layer_set_corner_radius(progress_layer, 3);
layer_add_child(&window->layer, &progress_layer->layer);
TextLayer *percent_done_text_layer = &data->percent_done_text_layer;
text_layer_init_... |
/*
* 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... | (was_created) | ;
rocky_add_function(console, ROCKY_CONSOLE_LOG, prv_console_log);
rocky_add_function(console, ROCKY_CONSOLE_WARN, prv_console_warn);
rocky_add_function(console, ROCKY_CONSOLE_ERROR, prv_console_error);
}
const RockyGlobalAPI CONSOLE_APIS = {
.init = prv_init,
};
|
prv_handle_status_exchange_complete_isr);
}
static bool prv_handle_rx_buffer_full(void) {
prv_lock();
bool is_rx_buffer_full = (0 == circular_buffer_get_write_space_remaining(&s_spi_transport.rx));
if (is_rx_buffer_full) {
s_spi_transport.should_transact_after_consuming_rx = tru... | PBL_LOG(LOG_LEVEL_ALWAYS, "Bluetooth Host Transport Crash -- Dumping Core") | |
andler,
.stopped = prv_stopped_handler
};
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
// Create the animations
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
animation_set_delay(a, delay_a);
Animation *b = prv_create_test_animation();
an... | prv_create_test_animation() | ;
animation_set_implementation(b, &implementation);
animation_set_duration(b, duration_a);
animation_set_delay(b, delay_a);
animation_set_auto_destroy(b, auto_destroy);
animation_schedule(b);
Animation *c = prv_create_test_animation();
animation_set_duration(c, duration_a);
animation_set_delay(c, delay... |
window_schedule_render(window);
}
}
}
static void prv_legacy2_status_bar_timer_subscribe(void) {
// we only need this tick event if we are a legacy2 app
if (process_manager_compiled_with_legacy2_sdk()) {
ApplibInternalEventsInfo *events_info =
app_state_get_applib_internal_events_info();
// ... | prv_app_callback_handler(&event) | ;
} else if (event.type == PEBBLE_RENDER_REQUEST_EVENT) {
app_request_render();
} else if (event.type == PEBBLE_RENDER_FINISHED_EVENT) {
*app_state_get_framebuffer_render_pending() = false;
} else {
event_service_client_handle_event(&event);
}
mcu_fpu_cleanup();
event_cleanup(... |
/*
* 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... | _Static_assert(sizeof(size_t) <= 4, "size_t larger than expected") | ;
_Static_assert(sizeof(ptrdiff_t) <= 4, "ptrdiff_t larger than expected");
#endif
// -------------------------------------------------------------------------------------------
// If we should use a default log message (because stack space is too limited to use sprintf)
// then copy it into 'msg' and return true
sta... |
"
#include "system/rtc_registers.h"
static void prv_color_led_easter_egg(void) {
#if CAPABILITY_HAS_LED
static int i = 0;
// Simple test code to exercise each of the LEDs in the RGB cluster.
// Start after 3 clicks
switch (i) {
case 3:
led_controller_rgb_set_color(LED_RED);
break;
case 4: l... | (&data->window, &(WindowHandlers) {
.load = prv_information_window_load,
.unload = prv_information_window_unload,
}) | |
[i][3];
(*state)[i][0] = Multiply(a, 0x0e) ^ Multiply(b, 0x0b) ^ Multiply(c, 0x0d) ^ Multiply(d, 0x09);
(*state)[i][1] = Multiply(a, 0x09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d);
(*state)[i][2] = Multiply(a, 0x0d) ^ Multiply(b, 0x09) ^ Multiply(c, 0x0e) ^ Multiply(d, 0x0b);
(*state... | {
Iv = (uint8_t*)iv;
} |
for(i = 0; i < length; i += KEYLEN)
{
XorWithIv(input);
BlockCopy(output, input);
state = (state_t*)output;
Cipher();
Iv = output;
input += KEYLEN;
output += KEYLEN;
}
if(remainders)
{
BlockCopy(output, input);
memset(output + remainders, 0, KEYLEN - remainders); /* add ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
gpio_init.GPIO_Pin =
GPIO_Pin_All & ~(GPIO_Pin_0 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.