prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
ed_render.animation.progress = distance_normalized;
}
return;
}
GContext *ctx = kernel_ui_get_graphics_context();
// Save the draw state in a static to save stack space
static GDrawState prev_state;
prev_state = ctx->draw_state;
func(ctx, animation, distance_normalized);
ctx->draw_state = prev_... | (s_animation_state.animation, &s_compositor_animation_impl) | ;
compositor_animation->init(s_animation_state.animation);
}
const ModalProperty properties = modal_manager_get_properties();
const bool is_modal_existing = (properties & ModalProperty_Exists);
const bool is_modal_transparent = (properties & ModalProperty_Transparent);
if (((s_state == CompositorState_M... |
{ 1192, 320, -216},
{ 1176, 240, -104},
{ 1200, 184, -48},
{ 992, 160, 32},
{ 744, 152, -16},
{ 640, 136, -32},
{ 664, 104, 8},
{ 752, 88, 0},
{ 888, 104, -24},
{ 1128, 112, -40},
{ 1272, 120, -48},
{ 1296, 88, -64},
{ 1184, 72, -72},
{ 1232, 88, -32},
{ 1128, 96,... | ARRAY_LENGTH(samples) | ;
return 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... | (GColorBlue.a == 0b11) | ;
}
void test_graphics_colors__equal(void) {
cl_assert(gcolor_equal(GColorBlue, GColorBlue));
cl_assert(gcolor_equal(GColorRed, GColorRed));
cl_assert(!gcolor_equal(GColorRed, GColorBlue));
// Two colors with zero alpha values should be equal regardless of what their RGB channels are
GColor8 color1 = GColor... |
alid values are 1-4.
uint8_t ratio;
//! The binary value we need to put in the register to select the rail.
uint8_t source_config;
} PmicMonConfig;
// Using the Binary constants GCC extension here, supported in GCC and Clang
// https://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html
static const PmicMonConfig ... | prv_write_register(PmicRegisters_MON_CFG, value) | ;
}
static bool prv_set_mon_config(const PmicMonConfig *config) {
const uint8_t ratio_config = 4 - config->ratio; // 4:1 is 0b00, 1:1 is 0b11.
const uint8_t register_value = (ratio_config << 4) | config->source_config;
bool result = prv_set_mon_config_register(register_value);
// Need to wait a short period ... |
tdio.h>
#include <string.h>
#define HEALTH_DB_DEBUG 0
#define HEALTH_DB_MAX_KEY_LEN 30
static const char *HEALTH_DB_FILE_NAME = "healthdb";
static const int HEALTH_DB_MAX_SIZE = KiBYTES(12);
static PebbleMutex *s_mutex;
#define MOVEMENT_DATA_KEY_SUFFIX "_movementData"
#define SLEEP_DATA_KEY_SUFFIX "_sleepData"
#defi... | strstr(key, WEEKDAY_NAMES[wday]) | ) {
break;
}
}
// For logging
const DayInWeek cur_wday = time_util_get_day_in_week(rtc_get_time());
if (strstr(key, MOVEMENT_DATA_KEY_SUFFIX)) {
MovementData *data = (MovementData *)val;
if (!prv_is_last_processed_timestamp_valid(data->last_processed_timestamp)) {
return;
}
PBL_... |
/*
* 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... | __atomic_or_fetch(&PWR->CR1, PWR_CR1_DBP, __ATOMIC_RELAXED) | |
SCRIPT("ctx.moveTo(4095.375, -4095.5);");
EXECUTE_SCRIPT_EXPECT_ERROR("ctx.moveTo(4096.5, 0);", "TypeError: Value out of bounds");
EXECUTE_SCRIPT_EXPECT_ERROR("ctx.moveTo(0, -4095.625);", "TypeError: Value out of bounds");
EXECUTE_SCRIPT("ctx.lineTo(4095.375, -4095.5);");
EXECUTE_SCRIPT_EXPECT_ERROR("ctx.lineT... | (s_graphics_api) | |
lize the peek layer
if (timeline_res_id || message) {
Layer *root_layer = window_get_root_layer(&data->window);
PeekLayer *peek_layer = &data->peek_layer;
peek_layer_init(peek_layer, &root_layer->frame);
peek_layer_set_title_font(peek_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
Timeli... | {
// Ignore requests to change the result once we already have one
return;
} | |
inutes = len,
.resting_calories = len * 100,
.active_calories = len * 200,
.distance_mm = len * 1000,
};
prv_insert_artificial_activity_session(minute_raw_data, k_minute_data_len, &exp_session);
prv_feed_activity_minutes(minute_raw_data, k_minute_data_len);
cl_assert_equal_i(s_num_cap... | (stats.sleep_len_m, i - k_sleep_start_m - KALG_MAX_UNCERTAIN_SLEEP_M) | ;
cl_assert_equal_i((now - stats.uncertain_start_utc) / SECONDS_PER_MINUTE,
KALG_MAX_UNCERTAIN_SLEEP_M);
}
// After we're certain sleep ended
if (i > k_sleep_end_m + KALG_MAX_UNCERTAIN_SLEEP_M) {
cl_assert_equal_i(stats.sleep_start_utc, k_sleep_start_utc);
cl_asser... |
//////////////////////////////////////////
void test_flash_region__initialize(void) {
s_command_list_index = 0;
}
void test_flash_region__cleanup(void) {
}
void test_flash_region__erase_optimal_range_empty(void) {
flash_region_erase_optimal_range(0, 0, 0, 0);
cl_assert_equal_i(s_command_list_index, 0);
}
voi... | flash_region_erase_optimal_range(32 * 1024, 32 * 1024, (32 + 18) * 1024, (32 + 96) * 1024) | ;
cl_assert_equal_i(s_command_list_index, 5);
cl_assert_equal_i(s_command_list[0].addr, 32 * 1024);
cl_assert_equal_i(s_command_list[0].type, SubsectorEraseCommand);
cl_assert_equal_i(s_command_list[1].addr, 36 * 1024);
cl_assert_equal_i(s_command_list[1].type, SubsectorEraseCommand);
cl_assert_equal_i(... |
ng, 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 "util/keyed_circular_cache.h"
#include "ut... | prv_push(0) | ;
prv_test_get_hit(0, 2);
prv_test_get_miss(1);
prv_test_get_hit(2, 1);
prv_test_get_hit(3, 0);
prv_push(1);
prv_test_get_hit(0, 2);
prv_test_get_hit(1, 0);
prv_test_get_hit(2, 1);
prv_test_get_miss(3);
prv_push(3);
prv_test_get_hit(0, 2);
prv_test_get_hit(1, 0);
prv_test_get_miss(2);
prv_... |
/*
* 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_get_root_layer(appeared_window) | ;
layer_set_bounds(root_layer, &bounds);
window_set_on_screen(appeared_window, true /* new window */, true /* call handlers */);
click_manager_clear(window_manager_get_window_click_manager(appeared_window));
}
static void prv_unload_removed_windows(WindowStack *window_stack) {
// Copy the removed windows lis... |
/*
* 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_ReadInputDataBit(button_config->gpio, button_config->gpio_pin) | ;
gpio_release(button_config->gpio);
return !bit;
}
uint8_t button_get_state_bits(void) {
uint8_t button_state = 0x00;
for (int i = 0; i < NUM_BUTTONS; ++i) {
button_state |= (button_is_pressed(i) ? 0x01 : 0x00) << i;
}
return button_state;
}
void button_init(void) {
// Need to disable button wakeup... |
KS; ++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__server_reset_request_while_pending_ack(void) {
test_ppogatt__open_session_when_found_pebbl... | fake_comm_session_close_call_count() | , 0);
}
void test_ppogatt__ack_received_data(void) {
test_ppogatt__open_session_when_found_pebble_app();
// Receive data:
for (uint8_t i = 0; i < PPOGATT_SN_MOD_DIV + 1; ++i) {
const uint8_t sn = i % PPOGATT_SN_MOD_DIV;
ppogatt_trigger_rx_ack_send_timeout();
prv_receive_short_data_fragment(s_charact... |
{
AlarmId id1, id2;
bool schedule_1[7] = {true, false, false, false, false, false, true};
id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 });
prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_CUSTOM, schedule_1);
// Only 1 pin should ... |
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 3);
cl_assert_equal_i(s_num_alarm_events_put, 3);
cl_assert_equal_i(s_num_timeline_adds, 11);
cl_assert_equal_i(s_num_timeline_removes, 7);
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time());
// Second alarm goes o... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ARRAY_LENGTH(s_heights) | , NULL /* offsets_y */, s_heights,
LINE_WIDTH, LINE_SPACING, offset);
}
void peek_animations_draw_timeline_speed_lines(GContext *ctx, GPoint offset) {
static const uint16_t s_upper_offsets_y[] = { 12, 0, 0, 12, 12, 12, 12, 12 };
static const uint16_t s_upper_heights[] = { 53, 65, 65, 53, ... |
context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_ny_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_ny_origin_layer.${BIT_DEPTH_NAME}.pbi"));
}
#define RADIUS_BIG 15
#define RADIUS_MEDIUM 8
#define RADIUS_MIN_CALCULATED 3
#defin... | gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r0_no_clip.${BIT_DEPTH_NAME}.pbi") | );
}
void test_graphics_draw_circle_${BIT_DEPTH_NAME}__offset_layer(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_init(&layer, &GRect(10, 15, 28, 28));
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&... |
/*
* 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... | regular_timer_seconds_count() | , 0);
regular_timer_deinit();
}
//! Helper to assert whether a piece of ad_data is set to the controller.
//! For convenience, C strings are used (while in reality it can be arbitrary
//! binary data).
#define assert_ad_data(ad_data_cstring) \
{ \
Advertising_Data_t ad_data_out; \
const size_t data_length = str... |
start_ms = prv_now_ms();
animation_schedule(a);
// Seek to just after the end of the second A
prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS);
#endif
}
// --------------------------------------------------------------------------------------
// Test creating a sequence where ... | cl_assert(prv_last_handler_entry(&s_stopped_handler_calls, a)->fire_order
< prv_last_handler_entry(&s_started_handler_calls, b)->fire_order) | ;
// Finish the sequence
prv_advance_to_ms_with_timers(prv_now_ms() + leftover_seq + 2 * MIN_FRAME_INTERVAL_MS);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1);
cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX);
cl_assert_equal_i(prv_count_handler_entries(... |
ed 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 <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "clar.h"
#include "... | (FLASH_BASE, 512 KiB, error_in_middle_cb,
&countdown) | );
cl_assert(flash_locked);
cl_assert_(countdown <= 0, "Callback not called enough times");
}
void malloc_flash_data(uint32_t size) {
flash_data_length = size;
flash_written_data = malloc(size * sizeof(uint8_t));
cl_assert(flash_written_data);
flash_written_flag = malloc(size * sizeof(bool));
cl_assert(... |
id test_ble_ad_parse__128_bit_uuid(void) {
// AD Element, Length: 2, AD Type: Flags
// AD Element, Length: 17, AD Type: More 128-bit UUIDs available,
// Value: 0x68753a444d6f12269c600050e4c00067
uint8_t data[GAP_LE_AD_REPORT_DATA_MAX_LENGTH] =
"\x02\x01\x1a\x11\x06\x67\x00\xc0\xe4\x50\x00\x60\x9c\x26\x12\x... | ble_ad_destroy(ad) | ;
}
void test_ble_ad_parse__set_service_uuids_16_bit(void) {
BLEAdData *ad;
Uuid uuid[15];
for (int i = 0; i < 15; ++i) {
uuid[i] = bt_uuid_expand_16bit(0x1800 + i);
}
// Hand-construct expected raw advertisement data:
uint8_t expected_ad_data[] = {
(2 * sizeof(uint16_t)) + 1 /* +1 for Type byte ... |
0x26, 0x2e, 0x08, 0x57, 0xe9, 0x4e, 0x58,
0x88, 0x02, 0x45, 0xfd, 0xfe, 0xe0, 0xac, 0x77},
.info_flags = PROCESS_INFO_STANDARD_APP,
.app_version = {
.major = 2,
.minor = 0,
},
.sdk_version = {
.major = 5,
.minor = 13,
},
.app_face_bg_color = {0},
.template_id = 0,
.icon_resou... | (true, app_install_get_entry_for_uuid(&tictoc_uuid, &uuid_entry)) | |
s_state <= SessionState_StartSession) ?
VoiceEventTypeSessionSetup : VoiceEventTypeSessionResult;
prv_send_event(event_type, VoiceStatusErrorGeneric, NULL);
return false;
}
if (s_session_id != session_id) {
PBL_LOG(LOG_LEVEL_WARNING, "Received session result for wrong session (Expected: "
... | prv_reset() | ;
mutex_unlock(s_lock);
}
DEFINE_SYSCALL(VoiceSessionId, sys_voice_start_dictation, VoiceEndpointSessionType session_type) {
if (session_type >= VoiceEndpointSessionTypeCount) {
return AUDIO_ENDPOINT_SESSION_INVALID_ID;
}
return voice_start_dictation(session_type);
}
DEFINE_SYSCALL(void, sys_voice_stop_di... |
elBit;
typedef enum LineHue {
HUE_RED,
HUE_GREEN,
HUE_BLUE,
HUE_WHITE,
HUE_COUNT
} LineHue;
typedef enum LineAttribute {
ATTRIBUTE_HUE,
ATTRIBUTE_PIXEL_BIT,
ATTRIBUTE_X,
ATTRIBUTE_Y,
ATTRIBUTE_COUNT
} LineAttribute;
typedef struct AppData {
Layer *canvas_layer;
// UI state
LineAttribute s... | GRect(90, 80, 20, 20) | |
, -16},
{ 1480, 384, -112},
{ 1312, 296, -216},
{ 1016, -72, -120},
{ 672, -296, -152},
{ 752, -208, -512},
{ 1184, -336, -128},
{ 1392, 104, -280},
{ 1568, 184, -232},
{ 1816, 280, -192},
{ 1952, 408, -272},
{ 1760, 488, -152},
{ 1616, 600, -136},
{ 1336, 760, -40},
... | ARRAY_LENGTH(samples) | ;
return samples;
}
// ----------------------------------------------------------------
// Sample captured: 2015-09-22 12:01:41 local
AccelRawData *activity_sample_100_steps_heather_3(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_heather_3
//> TEST_EX... |
/*
* 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... | (&DEBUG_GPIOS->debug_gpio[i], 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... | {
s_stroke_color = color;
} |
void graphics_context_set_fill_color(GContext* ctx, GColor color) {
s_fill_color = color;
}
void graphics_context_set_antialiased(GContext *ctx, bool enable) {
}
void graphics_context_set_stroke_width(GContext* ctx, uint8_t stroke_width) {
s_stroke_width = stroke_width;
}
void gpath_draw_stroke(GContext* ctx,... |
/*
* 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... | strcpy(s1, s2) | ;
return rc;
}
char *strncat(char * restrict s1, const char * restrict s2, size_t n) {
char * rc = s1;
s1 += strlen(s1);
size_t strn = strlen(s2);
if (strn > n) {
strn = n;
}
memcpy(s1, s2, strn);
s1[strn] = '\0';
return rc;
}
|
ructures are accessed below in __asm. Because the Cortex-M0 doesn't handle
// unaligned accesses automatically, and we don't want to do it ourselves, let's force the
// elements we care about to be aligned correctly.
typedef struct {
int8_t padding[3];
CoreDumpThreadInfo ti;
} CoreDumpThreadInfo_Wrapper;
static Cor... | hw_cpm_disable_xtal32k() | ;
SCB->SCR |= (1 << 2);
cm_sys_clk_sleep(true);
hw_cpm_pll_sys_off();
hw_cpm_activate_pad_latches();
hw_cpm_power_down_periph_pd();
hw_cpm_wait_per_power_down();
hw_cpm_wait_rad_power_down();
hw_cpm_rfcu_clk_off();
hw_cpm_disable_rc16();
hw_cpm_dcdc_off();
hw_cpm_ldo_io_ret_off();
hw_watchdog_f... |
// 52 seconds
{ 912, 224, 96},
{ 848, 232, 104},
{ 872, 256, 128},
{ 864, 216, 152},
{ 816, 192, 128},
{ 736, 208, 104},
{ 760, 168, 112},
{ 888, 200, 88},
{ 920, 184, -8},
{ 1416, 88, 208},
{ 1600, 472, -328},
{ 1384, 64, -176},
{ 1632, 16, -104},
{ 1544, 40,... | { 960, 488, 104},
{ 1240, 440, 168},
{ 1512, 496, 184},
{ 1208, 440, 248},
{ 896, 200, 296},
{ 800, 144, 208},
// 58 seconds
{ 872, 232, 208},
{ 984, 344, 240},
{ 1016, 288, 272},
{ 960, 208, 256},
{ 1000, 144, 224},
{ 1080, 72, 184},
{ 1208, 56, 176},
{ 1296,... |
{ 952, 232, -424},
{ 768, 56, -384},
{ 696, 136, -448},
{ 616, 80, -536},
{ 560, 0, -640},
{ 520, 48, -768},
{ 416, 32, -760},
{ 472, 80, -696},
{ 368, 32, -752},
{ 368, 128, -856},
{ 312, -24, -1088},
{ 328, 88, -832},
{ 376, 104, -952},
{ 408, 48, -1008},
};
... |
/*
* 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... | (a.size.h, b.size.h) | ;
}
// --------------------------------------------------------------------------------------
static void cl_assert_equal_gtransform(const GTransform a, const GTransform b) {
cl_assert_equal_i(a.a.raw_value, b.a.raw_value);
cl_assert_equal_i(a.b.raw_value, b.b.raw_value);
cl_assert_equal_i(a.c.raw_value, b.c.ra... |
, 20, 40, 10));
ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10)));
setup_test(&context, false, 2, GColorBlack, GColorBlack, false);
graphics_draw_circle(&context, GPoint(50, 50), 10);
ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, 2));
setup_test(&context, false... | GPoint(5, 5) | |
eep:
case ActivitySessionType_Nap:
case ActivitySessionType_RestfulSleep:
case ActivitySessionType_RestfulNap:
continue;
case ActivitySessionType_Walk:
prefix = "W";
break;
case ActivitySessionType_Run:
prefix = "R";
break;
default:
con... | PBL_LOG(LOG_LEVEL_DEBUG, "Got %d minutes with UTC of %d (delta of %d min)", (int)chunk,
(int)utc_start, (int)(utc_start - prior_start) / SECONDS_PER_MINUTE) | ;
num_records += chunk;
utc_start += chunk * SECONDS_PER_MINUTE;
if (chunk == 0) {
break;
}
}
// Print summary
snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text),
"Retrieved %d minute data records", (int)num_records);
// Print detail on the last few m... |
TIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "compositor_port_hole_transitions.h"
#include "applib/graphics/bitblt.h"
#include "applib/graphics/framebuffer.h"
#include "applib/graphics/g... | ABS(current_offset_px) | , GColorBlack);
s_data.animation_offset_px = current_offset_px;
}
const CompositorTransition *compositor_port_hole_transition_app_get(
CompositorTransitionDirection direction) {
if (compositor_transition_app_to_app_should_be_skipped()) {
return NULL;
}
s_data.direction = direction;
static const Com... |
{ 1160, -512, 64},
{ 992, 96, -280},
{ 1400, 1680, -1464},
{ 1528, 3952, -2400},
{ 536, 3176, -2152},
{ -344, 1712, -1064},
// 43 seconds
{ -584, 1088, -584},
{ -640, 280, -240},
{ -1472, -120, 152},
{ -1592, -208, 56},
{ -1280, 144, 296},
{ -1016, 1064, -496},
{ -... | { 1312, -552, -256},
{ 1664, -880, -256},
{ 1400, -616, 112},
{ 1248, -232, 200},
{ 1744, 1568, -1056},
{ 1416, 4000, -1880},
{ 864, 3760, -2296},
{ -304, 1824, -1376},
{ -888, 856, -792},
{ -1080, 280, -400},
{ -1472, -200, 8},
{ -1112, -72, -224},
{ -952, 296, 40},
... |
{ -152, 2432, -2224},
{ -760, 1232, -1792},
{ -912, 648, -1080},
{ -1144, -224, -168},
{ -1376, -336, 24},
{ -1048, -176, 24},
{ -1056, 360, 144},
{ -2424, 1464, -136},
{ -1112, 4000, -2592},
{ 992, 4000, -1768},
{ 1816, 1320, -720},
{ 1832, 104, 96},
// 51 seconds
... |
for_activity_type(
ActivitySessionType_Run, &s_workout_data, &s_workout_controller);
prv_create_window_and_render(active_window, 0);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_workout_active__workout_render_open_workout(void) {
s_workout_data = (WorkoutData) {
.steps = 0,
... | (active_window, 0) | |
Conceptually each frame consists of three 16-bit words corresponding to the x, y and z- axis.
#define BMA255_FIFO_MAX_FRAMES (32)
#define BMA255_FIFO_FRAME_SIZE_BYTES (3 * 2)
#define BMA255_FIFO_SIZE_BYTES (BMA255_FIFO_MAX_FRAMES * BMA255_FIFO_FRAME_SIZE_BYTES)
// Driver state
static BMA255PowerMode s_... | {
int16_t mgs = ((int32_t)raw_val * s_raw_unit_to_mgs) / 1000;
return mgs;
} |
static int16_t prv_conv_raw_to_12bit(const uint8_t registers[2]) {
int16_t reading = ((registers[0] >> 4) & 0x0F) | ((int16_t)registers[1] << 4);
if (reading & 0x0800) {
reading |= 0xF000;
}
return reading;
}
static void prv_convert_accel_raw_data_to_mgs(const uint8_t *buf, AccelDriverSample *data) {
i... |
rvices/normal/weather/weather_types.h"
#include "util/pstring.h"
// Fixture
////////////////////////////////////////////////////////////////
// Fakes
////////////////////////////////////////////////////////////////
#include "fake_pbl_malloc.h"
#include "fake_spi_flash.h"
// Stubs
////////////////////////////////////... | prv_assert_forecast_equal(¤t->forecast, &s_forecasts[id]) | ;
id++;
current = (WeatherDataListNode *)current->node.next;
}
cl_assert_equal_i(count_out, 4);
cl_assert_equal_i(id, 4);
weather_service_locations_list_destroy(head);
}
void test_weather_service__get_default_location_forecast_from_weather_db_update(void) {
WeatherLocationForecast *forecast = weath... |
ic UARTDeviceState s_qemu_uart_state;
static UARTDevice QEMU_UART_DEVICE = {
.state = &s_qemu_uart_state,
// GPIO? Where we're going, we don't need GPIO. (connected to QEMU)
.periph = USART2,
.irq_channel = USART2_IRQn,
.irq_priority = 13,
.rcc_apb_periph = RCC_APB1Periph_USART2
};
UARTDevice * const QEMU_U... | {
i2c_init(&I2C_MAIN_BUS);
i2c_init(&I2C_2V5_BUS);
voltage_monitor_device_init(VOLTAGE_MONITOR_ALS);
voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY);
} | |
l_putstr(error_code_buffer);
display_error_code(error_code);
static uint8_t prev_button_state = 0;
prev_button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK;
while (1) {
// See if we should restart
uint8_t button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK;
if (button_state != pr... | switch_to_recovery_fw() | ) {
// We've failed to load recovery mode too many times.
sad_watch(ERROR_CANT_LOAD_FW);
}
} else {
check_update_fw();
}
if (check_and_increment_reset_loop_detection_bits()) {
sad_watch(ERROR_RESET_LOOP);
}
if (boot_bit_test(BOOT_BIT_SHUTDOWN_REQUESTED)) {
boot_bit_clear(BOOT_BIT... |
0, -56, 40},
{ 1040, -80, 64},
{ 1016, -88, 72},
{ 976, -96, 56},
{ 952, -40, 16},
{ 952, -40, -32},
{ 944, -64, -24},
{ 1000, -72, -40},
{ 1048, -104, -72},
{ 1512, -120, 0},
{ 1328, -80, -112},
// 29 seconds
{ 1264, -80, -216},
{ 968, -56, -376},
{ 848, -56, -28... | { 1152, -288, -160},
{ 1048, -280, -168},
{ 1040, -240, -200},
{ 1032, -216, -176},
{ 1000, -192, -136},
{ 1016, -152, -144},
{ 1024, -120, -144},
{ 1064, -112, -136},
{ 1096, -104, -136},
{ 1104, -104, -144},
{ 1096, -136, -144},
{ 1120, -136, -144},
{ 1088, -144, -1... |
{ 920, 0, -152},
{ 960, -48, -184},
{ 1024, -56, -184},
{ 1016, -80, -168},
{ 1016, -40, -176},
{ 944, 0, -168},
{ 944, 24, -136},
// 37 seconds
{ 1048, 72, -112},
{ 1056, 48, -48},
{ 1320, 48, -24},
{ 1344, 96, -16},
{ 1336, 136, 8},
{ 1136, 128, 80},
{ 992,... |
nd_for_music_command(MusicCommand command) {
switch (command) {
case MusicCommandPlay:
return 0x00;
case MusicCommandPause:
return 0x01;
case MusicCommandTogglePlayPause:
return 0x02;
case MusicCommandNextTrack:
return 0x03;
case MusicCommandPreviousTrack:
return 0x04... | (false /* reduced_latency */) | ;
cl_assert_equal_i(s_conn_mgr_states[BtConsumerMusicServiceIndefinite].state,
ResponseTimeMax);
}
void test_ams__music_request_low_latency_for_period(void) {
prv_connect_ams();
const uint32_t period_s = 1234;
music_request_low_latency_for_period(period_s * 1000);
cl_assert_equal_i(s_con... |
.h"
#include "stubs_mutex.h"
#include "stubs_passert.h"
#include "stubs_prompt.h"
#include "stubs_sleep.h"
#include "stubs_task_watchdog.h"
// Fakes
#include "fake_accel_service.h"
#include "fake_new_timer.h"
#include "fake_rtc.h"
#include "fake_spi_flash.h"
#include "fake_system_task.h"
#define ASSERT_EQUAL_I(i1,i2... | ARRAY_LENGTH(s_dls_records) | );
s_dls_records[s_num_dls_records++] = records[i];
}
return DATA_LOGGING_SUCCESS;
}
DataLoggingSession *dls_create(uint32_t tag, DataLoggingItemType item_type, uint16_t item_size,
bool buffered, bool resume, const Uuid *uuid) {
s_dls_created = true;
cl_assert_equal_i(item_s... |
LENGTH(s_unknown_app_dict), (uint8_t *)s_unknown_app_dict);
s_num_ds_notifications_received++;
} else if (uid == unknown_app_unique_title_dict_uid) {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_unknown_app_unique_title_dict), (uint8_t *)s_unknown_app_unique_title_dict);
s_num_ds_notifications_receiv... | cl_assert_equal_i(s_num_requested_notif_attributes, 1) | |
736, 56, 168},
// 15 seconds
{ 1000, -176, -280},
{ 1008, -112, -208},
{ 1048, 32, -344},
{ 1200, 32, -376},
{ 1256, 120, -456},
{ 1000, 136, -280},
{ 888, 152, -344},
{ 1088, 224, -256},
{ 1336, 368, -320},
{ 1296, 408, -392},
{ 1328, 672, -624},
{ 1528, 752, -704},
... | { 848, 168, -296},
{ 1160, 240, -408},
{ 1312, 392, -448},
{ 1240, 576, -536},
{ 1432, 592, -664},
{ 1128, 632, -512},
{ 1152, 552, -480},
{ 1272, 560, -456},
{ 1160, 472, -504},
{ 1208, 416, -384},
{ 1280, 328, -168},
{ 1280, 264, -216},
{ 1192, 200, -136},
{ 128... |
// 23 seconds
{ 1184, 128, -272},
{ 1056, 64, -264},
{ 1200, -8, -296},
{ 912, -136, -288},
{ 1056, -40, -152},
{ 840, 56, -192},
{ 872, 176, -280},
{ 1128, 216, -336},
{ 1248, 216, -352},
{ 1040, 264, -336},
{ 960, 240, -344},
{ 1096, 272, -264},
{ 1264, 296, -3... |
ds.size.h;
Animation *curr_out = prv_create_slide_animation(current_card_layer, &window_bounds, &curr_stop);
Animation *next_in = prv_create_slide_animation(next_card_layer, &next_start, &window_bounds);
Animation *bg_anim = animation_create();
animation_set_duration(bg_anim, interpolate_moook_soft_duration(N... | layer_set_update_proc(&health_card_view->select_indicator_layer,
prv_select_indicator_layer_update_proc) | ;
// setup content indicators
const int content_indicator_height = PBL_IF_ROUND_ELSE(18, 11);
const GRect down_arrow_layer_frame = grect_inset(window_root->frame,
GEdgeInsets(window_root->frame.size.h - content_indicator_height, 0, 0));
layer_init(&health_card_view->down_arrow_layer, &down_arrow_layer_fr... |
case OP_ROTATE3:
if (data->stroke_width < MAX_STROKE) data->stroke_width++;
break;
case OP_TEST5:
if (data->size < 100) data->size++;
break;
case OP_MOVE_P1_X:
data->p1.x++;
break;
case OP_MOVE_P1_Y:
data->p1.y++;
break;
case OP_MOVE_P2_X:
data->p2... | GPoint(x1, y1) | ;
GPoint p1 = GPoint(x1, y2);
GPoint p2 = GPoint(x2, y2);
GPoint p3 = GPoint(x2, y1);
graphics_context_set_antialiased(ctx, true);
graphics_context_set_stroke_width(ctx, data->stroke_width);
graphics_draw_line(ctx, p0, p1);
graphics_draw_line(ctx, p2, p3);
return;
}
if (data->oper... |
d_circular_buffer_read(&buffer, &client1, 1, &out_buffer, &out_length));
cl_assert(!shared_circular_buffer_read(&buffer, &client2, 1, &out_buffer, &out_length));
// Fill with data
cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "123456", 6, false));
// Read different amounts from each client
cl_a... | (shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0) | ;
// Write 2 more
cl_assert(shared_circular_buffer_write(&buffer, storage, 2, false));
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 2);
// Consume it
prv_read_and_consume(&buffer, &client, storage, 2);
cl_assert_equal_i(shared_circular_buffer_get_read_space_remainin... |
/*
* 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... | (fill_color) | ) {
fill_color = GColorWhite;
}
// as this function will only be called with radius 0 to or
// to support the legacy2 behavior (where the radius is clamped to 8) it's safe to assume 8px here
PBL_ASSERTN(radius <= 8);
GBitmap* bitmap = graphics_context_get_bitmap(ctx);
// translate to absolute bitmap c... |
ive_ble_gateway_bonding();
cl_assert(ret);
}
void test_bluetooth_persistent_storage__test_is_faithful(void) {
bool ret;
// No pairing yet, we should be unfaithful
ret = bt_persistent_storage_is_unfaithful();
cl_assert(ret);
// Add a pairing, still unfaithful
BTDeviceAddress addr_1 = {{0x11, 0x12, 0x13,... | bt_persistent_storage_get_root_key(0, &keys_out[0]) | ;
bt_persistent_storage_get_root_key(1, &keys_out[1]);
cl_assert_equal_m(&keys[0], &keys_out[0], sizeof(SM128BitKey));
cl_assert_equal_m(&keys[1], &keys_out[1], sizeof(SM128BitKey));
}
void test_bluetooth_persistent_storage__delete_all(void) {
bool ret;
// Add some pairings
// BT Classic pairing 1
BTDe... |
g it up by the
// delay and any repeats we have already done
uint32_t start_ms = parent->abs_start_time_ms;
start_ms -= parent->times_played * (parent->duration_ms + parent->delay_ms);
// Loop through animation and all of it's children until the "virtual now" catches up to
// the desired elapsed
const uint... | {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
PBL_ASSERTN(!animation_private_using_legacy_2(state));
AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/);
if (!animation) {
return false;
}
return prv_animation_clone(state, animation);... |
// ------------------------------------------------------------------------------------------
static void prv_dump_animations(ListNode *node, bool is_scheduled, char *buffer, int buffer_size) {
while (node) {
AnimationPrivate *animation = (AnimationPrivate *)node;
dbgserial_putstr_fmt(buffer, buffer_size,
... |
/*
* 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... | (state, handler) | ;
}
void event_service_client_handle_event(PebbleEvent *e) {
EventServiceInfo *state = prv_get_state();
const uintptr_t type = e->type;
// find the first callback
ListNode *handler = list_find(&state->list_node, event_service_filter, (void *) type);
while (handler) {
// find the next callback before we c... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prompt_send_response("ERROR") | ;
}
}
void command_disp_offset_read(void) {
char buffer[16];
prompt_send_response_fmt(buffer, sizeof(buffer), "X: %"PRId16" Y: %"PRId16,
mfg_info_get_disp_offsets().x,
mfg_info_get_disp_offsets().y);
}
void command_disp_offset_write(const char* offset_x_str,... |
/*
* 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_sanity_check() | ;
}
|
check_for_fw_start_failure() {
// Add more failure conditions here.
if (!watchdog_check_reset_flag() && !boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) {
// We're good, we're just starting normally.
PBL_LOG_VERBOSE("We're good, we're just starting normally.");
boot_bit_clear(BOOT_BIT_FW_START_FAIL... | ("i2c inited") | ;
pmic_init();
dbgserial_putstr("pmic inited");
boot_bit_init();
dbgserial_putstr("boot bit");
boot_version_write();
// Write the bootloader version to serial-out
{
char bootloader_version_str[12];
memset(bootloader_version_str, 0, 12);
itoa_hex(boot_version_read(), bootloader_version_st... |
/*
* 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(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)) | ;
}
|
ne GIT_TAG_V_MAJOR 4
#define GIT_TAG_V_MINOR 17
#define GIT_TAG_V_PATCH "ROBERT-mfg4-6-gb91951a"
void version_get_major_minor_patch(unsigned int *major, unsigned int *minor,
const char **patch_ptr) {
*major = GIT_TAG_V_MAJOR;
*minor = GIT_TAG_V_MINOR;
*patch_ptr = GIT_TAG_V_PATC... | LOG("payload_send_time: %"PRIu32"", s_parsed_msg.payload_send_time) | ;
LOG("MeasurementSet:");
char uuid_str[UUID_STRING_BUFFER_LENGTH];
uuid_to_string(&s_parsed_msg.msrmt.uuid, uuid_str);
LOG(" Uuid: %s", uuid_str);
LOG(" time_utc: %"PRIu32", time_end_utc: %"PRIu32", utc_to_local: %"PRIi32"",
s_parsed_msg.msrmt.time_utc, s_parsed_msg.msrmt.time_end_utc,
... |
utes_restore_default_text_flow((GTextLayoutCacheRef) &l);
cl_assert_equal_p(l.flow_data.perimeter.impl, NULL);
}
// just a fake value to have something to compare against
const GPerimeter * const g_perimeter_for_display = (const GPerimeter *) &g_perimeter_for_display;
void test_text_layout__enable_text_flow(void) {... | cl_assert(layout.hash != 0) | ;
cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX);
if (!process_manager_compiled_with_legacy2_sdk()) {
// 3 lines - but not 4, since the fourth has no chance of appearing ("Jr\nWho-\npper\n 123")
cl_assert_equal_i(layout.max_used_size.h, 3 * (FONT_HEIGHT + (FONT_LINE_DELTA - 1)));
} else {... |
stfulSleep, ActivitySessionType_RestfulNap
ActivityClass_RestfulSleep = 1,
// for ActivitySessionType_Walk, ActivitySessionType_Run, ActivitySessionType_Open
ActivityClass_Step = 2,
// Leave at end
ActivityClassCount,
};
// List of event classes and info on each
typedef struct {
Activity... | if (stored_len != sizeof(state->activity_sessions)) {
PBL_LOG(LOG_LEVEL_WARNING, "Stored activities not found or incompatible");
return;
} | |
SECONDS_PER_MINUTE);
// Open the app, confirm that we are now subscribed with no end in sight
workout_service_frontend_opened();
cl_assert_equal_b(s_hrm_subscribed, true);
cl_assert_equal_i(s_hrm_expiration, 0);
cl_assert(workout_service_start_workout(ActivitySessionType_Run));
workout_service_frontend_c... | cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 0) | ;
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 0);
prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good);
prv_inc_time(10);
prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s));
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0);
cl_assert_... |
/*
* 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... | attributes_address_get_buffer_size(serialized_contact->num_attributes,
serialized_contact->num_addresses,
attributes_per_address,
s... | ;
Contact *contact = kernel_zalloc_check(sizeof(Contact) + alloc_size);
uint8_t *buffer = (uint8_t *)contact + sizeof(Contact);
uint8_t *const buf_end = buffer + alloc_size;
attributes_address_init(&contact->attr_list,
&contact->addr_list,
&buffer,
... |
ine GIT_TAG_V_PATCH "ROBERT-mfg4-6-gb91951a"
void version_get_major_minor_patch(unsigned int *major, unsigned int *minor,
const char **patch_ptr) {
*major = GIT_TAG_V_MAJOR;
*minor = GIT_TAG_V_MINOR;
*patch_ptr = GIT_TAG_V_PATCH;
}
// -------------------------------------------... | ("MeasurementSet:") | |
update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_ny);
layer_render_tree(&canvas, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_ny.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &draw_text_single_line_e... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_ny.${BIT_DEPTH_NAME}.pbi")) | ;
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_y);
layer_render_tree(&canvas, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_y.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
... |
meart.org/content/medals-3
// http://opengameart.org/content/open-pixel-platformer-tiles-sprites
#if SCREEN_COLOR_DEPTH_BITS == 8
#include "applib/graphics/8_bit/framebuffer.c"
#elif SCREEN_COLOR_DEPTH_BITS == 1
#include "applib/graphics/1_bit/framebuffer.c"
#endif
// Fakes
////////////////////////////////////
#inclu... | (status, true) | ;
cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(1)));
// each frame has delay 100ms, so (33 - 1) * 100 ms shows 33rd frame
status = gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, (33 - 1) * 100);
cl_assert_equal_b(status, true);
cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(33)));
stat... |
, // Attribute ID - Title
0x11, 0x00, // Attribute Length
// Attribute text: "Test Notification"
0x54, 0x65, 0x73, 0x74, 0x20, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e,
// Attribute 2
0x02, // Attribute ID - Su... | attribute_get_string(&list, AttributeIdSubtitle, "") | |
"test_bitblt__bitmap_into_bitmap_sub_bitmap-expect.8bit.pbi"));
gbitmap_destroy(src_bitmap);
}
// Test:
// - source origin offset
// - source bounds origin and size
// - wrapping into larger destination
// - dest rect not at { 0, 0 }
// Setup:
// - Source has non-zero bounds origin, { 5, 5 }, ou... | (&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_black_on_black-expect.1bit.pbi") | );
gbitmap_destroy(src_bitmap);
}
// Test:
// - source origin offset
// - source bounds origin and size
// - Source bounds origin is beyond (32, y) to pass word boundary.
// - Source origin offset is beyond (32, y) to pass another word boundary.
// - wrapping into larger destination
// - dest rect n... |
= Fixed_S32_16_add(num1, num2);
sum_c = (Fixed_S32_16){ .raw_value = (int32_t)(216269) };
cl_assert(sum.raw_value == sum_c.raw_value);
// sum = 2.1 - 5.4 = -3.3
// math is as follows:
// 2.1 * (1 << 16) = 137625.6 = 137625 (drop fraction)
// -5.4 * (1 << 16) = -353894.4 = -353894 (drop fraction)
// 13762... | (mul.raw_value == mul_c.raw_value) | ;
// 3.5*1 = 3.5
num1 = (Fixed_S16_3){ .raw_value = (int32_t)((float)3.5 * (1 << FIXED_S16_3_PRECISION)) };
num2 = FIXED_S32_16_ONE;
mul = Fixed_S16_3_S32_16_mul(num1, num2);
mul_c = (Fixed_S16_3){ .raw_value = (int32_t)((float)3.5 * (1 << FIXED_S16_3_PRECISION)) };
cl_assert(mul.raw_value == mul_c.raw_val... |
-----------------------------------------
// Stopped handler that calls reschedule the first time it is called
static void prv_stopped_handler_reschedule(Animation *animation, bool finished, void *context) {
prv_add_handler_entry(&s_stopped_handler_calls, animation, finished, context);
if (s_stopped_handler_calls.... | {
*p = value;
} |
static Fixed_S32_16 prv_fixed_s32_16_getter(Fixed_S32_16 *p) {
return *p;
}
// --------------------------------------------------------------------------------------
static void prv_uint32_setter(int32_t *p, uint32_t value) {
*p = value;
}
static uint32_t prv_uint32_getter(uint32_t *p) {
return *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... | if (dialog->buffer && dialog->is_buffer_owned) {
applib_free(dialog->buffer);
} | |
// Sample captured at: 2015-11-09 14:23:00 local, 2015-11-09 22:23:00 GMT
AlgDlsMinuteData *activity_sample_2015_11_09_14_23_00(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME pbl_29016
//> TEST_VERSION 3
//> TEST_TOTAL -1
//> TEST_TOTAL_MIN -1
//> TEST_TOTAL_M... | { 0, 0x61, 470, 185, 0},
{ 0, 0x62, 824, 173, 0},
{ 0, 0x75, 0, 174, 0},
{ 0, 0x75, 57, 175, 0},
{ 0, 0x74, 330, 202, 0},
{ 0, 0x63, 2167, 174, 0},
{ 0, 0x64, 2449, 199, 0},
{ 0, 0x73, 1222, 181, 0},
{ 0, 0x73, 2221, 157, 0},
{ 0, 0x74, 598, 159, 0},
{ 0, 0x53, 3871, 163, 0},... |
{ 0, 0x43, 54, 145, 0},
{ 0, 0x43, 719, 147, 0},
{ 0, 0x54, 1471, 155, 0},
{ 0, 0x53, 572, 149, 0},
{ 0, 0x43, 47, 152, 0},
{ 12, 0x54, 1621, 157, 0},
{ 4, 0x54, 2445, 143, 0},
{ 0, 0x55, 720, 145, 0},
{ 0, 0x53, 1898, 147, 0},
{ 0, 0x73, 376, 145, 0},
// 135: Local time: 04... |
test_battery_monitor__curve_doesnt_shift_too_far(void) {
int charge_mv = battery_curve_lookup_voltage_by_percent(0, true);
int charge_terminate_mv = battery_curve_lookup_voltage_by_percent(80, false);
fake_battery_init(charge_mv, true, true);
battery_monitor_init();
periodic_timer_trigger(1);
fake_batter... | standby_timer_get_timeout() | , 30000);
fake_battery_set_charging(true);
fake_battery_set_connected(true);
periodic_timer_trigger(1);
standby_timer_trigger(1);
cl_assert(!s_entered_standby);
}
void test_battery_monitor__increase_discharging(void) {
int low_mv = battery_curve_lookup_voltage_by_percent(50, false);
int high_mv = battery... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return 123;
} |
size_t resource_load_byte_range_system(ResAppNum app_num, uint32_t id, uint32_t start_offset, uint8_t *data, size_t num_bytes) {
const size_t some_bytes = 20; // a real snapshot is larger than just the header
// in our test setup, we will treat resource
// 10 as an invalid snapshot header, and
// 20 as a val... |
(ctx, menu_layer, cell_layer, cursor, true) | ;
}
// Restore current drawing state:
graphics_context_set_drawing_state(ctx, prev_state);
}
static inline void prv_menu_layer_draw_section_header(MenuLayer *menu_layer, Layer *cell_layer,
MenuCellSpan *cursor, GContext* ctx) {
cell_layer->bounds.size.h = cursor->h;
cell_layer->frame.size.h = cursor->h;... | |
= s_basic_action_list;
cl_assert_equal_p(timeline_item_find_action_with_id(&item, 0), &s_basic_action_list[0]);
cl_assert_equal_p(timeline_item_find_action_with_id(&item, 1), &s_basic_action_list[1]);
cl_assert_equal_p(timeline_item_find_action_with_id(&item, 2), &s_basic_action_list[2]);
cl_assert_equal_p(time... | timeline_item_find_reply_action(&item) | , NULL);
free(action_list);
}
|
t_equal_i(stop_count_before_rediscovery + 1, fake_gatt_is_service_discovery_stop_count());
// Expect "Database Changed" event:
prv_assert_event(&device, BTErrnoServiceDiscoveryDatabaseChanged);
// Put one, expect one:
prv_simulate_and_assert_discovery_of_one_service(&device);
}
extern void gatt_client_discov... | (&device, BTErrnoServiceDiscoveryDatabaseChanged) | ;
prv_simulate_and_assert_discovery_of_one_service(&device);
// None of the batched up jobs should have run
cl_assert_equal_i(2, fake_gatt_is_service_discovery_start_count());
// nothing should still be running
cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false);
}
// ----------------------... |
nst char *title = NULL;
switch (row) {
case NotificationsItemFilter:
title = i18n_noop("Filter");
subtitle = prv_alert_mask_to_label(alerts_get_mask());
break;
#if !CAPABILITY_HAS_VIBE_SCORES
case NotificationsItemVibration:
title = i18n_noop("Vibration");
if (battery_is_usb_con... | (vibe_intensity_get()) | ;
analytics_set(ANALYTICS_DEVICE_METRIC_SETTING_VIBRATION_STRENGTH,
strength, AnalyticsClient_System);
}
|
>name));
} else {
strncpy(remote->name, name, sizeof(remote->name));
}
}
static void prv_add_bt_classic_remote(BTDeviceAddress *addr, SM128BitKey *link_key,
const char *name, uint8_t *platform_bits, void *context) {
SettingsBluetoothData *data = (SettingsBluetoothData*) ... | list_pop_head(&remote->list_node) | ;
task_free(remote);
}
}
static void prv_reload_remote_list(SettingsBluetoothData* data) {
prv_clear_remote_list(data);
prv_add_bt_classic_remotes(data);
prv_add_and_merge_ble_remotes(data);
}
static void settings_bluetooth_update_remotes_private(SettingsBluetoothData* data) {
prv_reload_remote_list(dat... |
/*
* 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... | resource_init() | ;
prv_initialize_icons();
}
void test_menu_layer_system_cells__cleanup(void) {
free(fb);
fb = NULL;
gbitmap_deinit(&s_tictoc_icon_bitmap);
gbitmap_deinit(&s_smart_alarm_icon_bitmap);
gbitmap_destroy(s_dest_bitmap);
s_dest_bitmap = NULL;
}
// Helpers
//////////////////////
// This struct represents t... |
nerTopRight}
}));
// # Section with quadrant filling
// Tests for full quadrants
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(0), TO_TRIG(90)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight},
.full_quadrants = GCornerTopRight,
.end_quadran... | cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(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_edc(prv_calc_draw_config_ellipsis(TO_TRIG(45), TO_TRIG(270 + 45)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(45),GCornerTopRight},
.full_quadrants = GCornersBottom,
.end_quadrant = (EllipsisP... |
ing permissions and
* limitations under the License.
*/
#include "clar.h"
#include "services/common/debounced_connection_service.h"
#include "services/common/regular_timer.h"
#include "syscall/syscall.h"
#include "fake_new_timer.h"
#include "fake_rtc.h"
#include "fake_system_task.h"
#include "fake_pbl_malloc.h"
#i... | {
//! Currently disconnected
init(false /* disconnected */);
check_disconnected();
//! Get disconnected event
prv_send_connection_event(false);
check_waiting_to_send_second_disconnect();
//! Timer fires
regular_timer_fire_seconds(1);
check_disconnected();
// Event put
prv_assert_event_receiv... |
void test_debounced_connection_service__reconnected_quickly(void) {
//! Currently connected
init(true /* connected */);
check_connected();
//! Get disconnected event
prv_send_connection_event(false);
check_waiting_to_send_disconnect();
// No event put
cl_assert_equal_i(s_event_count, 0);
//! Get... |
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 1... | gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_health_activity_summary_card__render_current_above_typical1(void) {
HealthData health_data = {
.step_data = 340,
.step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,... |
cl_assert_equal_i(prv_num_system_task_events_queued(), 1);
// Make sure we successfully consume the event
fake_system_task_callbacks_invoke_pending();
// Make sure we got the expected data
cl_assert_equal_i(s_num_cb_events_1, 1);
cl_assert_equal_i(s_cb_events_1[0].event_type, HRMEvent_BPM);
cl_assert_equa... | sys_hrm_manager_set_update_interval(session_ref, update_interval_b_s, expire_b_s) | ;
cl_assert(prv_get_subscriber_state_from_ref(session_ref) == state);
cl_assert(state->update_interval_s == update_interval_b_s);
cl_assert(state->expire_utc == rtc_get_time() + expire_b_s);
}
#define NUM_TEST_EVENTS 2
void test_hrm_manager__circular_buffer_event_copy(void) {
// Make sure there will be unalign... |
ytes, &new_read_offset);
if (read_bytes < 0) {
goto exit;
}
PBL_ASSERTN((uint32_t)read_bytes <= DLS_ENDPOINT_MAX_PAYLOAD);
unsigned int leftover_bytes = read_bytes % logging_session->item_size;
if (leftover_bytes) {
PBL_LOG(LOG_LEVEL_ERROR, "leftover bytes in the session. Flushing...");
// remove... | (session->data->mutex) | ;
kernel_free(session->data);
session->data = NULL;
}
}
return true;
}
// ----------------------------------------------------------------------------------------
void dls_send_all_sessions(void) {
// If sends are not enabled, do nothing
if (!prv_sends_enabled()) {
PBL_LOG(LOG_LEVEL_INFO,... |
ts[i]);
}
gpath_init(&s_data.path, &s_path_quad);
gpath_draw_outline(ctx, &s_data.path);
gpath_draw_filled(ctx, &s_data.path);
}
// Moves the current framebuffer around
static int16_t prv_move_in(GContext *ctx, int move_size, uint32_t distance, bool vertical) {
const int16_t current_offset_px = prv_interpola... | compositor_get_app_framebuffer_as_bitmap() | ;
s_data.sampled_color = graphics_private_sample_line_color(&app_bitmap,
(GColorSampleEdge)s_data.direction,
GColorBlack);
// Force the sampled color to be completely opaque, because we're... |
_player->animation, 300);
animation_set_elapsed(test_player->animation, 20);
prv_play_animation_update(test_player->animation, 0); // intentionally bad value
cl_assert_equal_i(kino_reel_get_elapsed(test_reel), ANIMATION_DURATION_INFINITE);
}
void test_kino_player__create_finite_animation_infinite_reel_reverse(... | kino_player_set_reel(test_player, test_reel, true) | ;
cl_assert_equal_p(test_player->reel, test_reel);
cl_assert_equal_i(s_num_destructor_calls, 0);
kino_player_set_reel(test_player, NULL, true);
cl_assert_equal_p(test_player->reel, NULL);
cl_assert_equal_i(s_num_destructor_calls, 1);
kino_player_set_reel(test_player, NULL, true);
cl_assert_equal_p(test_... |
first_fire_b,
prv_last_handler_entry(&s_started_handler_calls, b2)->fire_order);
first_fire_b = MIN(first_fire_b,
prv_last_handler_entry(&s_started_handler_calls, b3)->fire_order);
first_fire_b = MIN(first_fire_b,
prv_last_handler_entry(&s_started_handler_... | (&s_started_handler_calls, b) | |
gets started, and needs to be manually stopped.
// This means that setup setup goes like this:
//
// 1. User Signals "RUN"
// 2. bt_test_start()
// 3. bt_driver_le_transmitter_test / bt_driver_le_receiver_test
// 4. User Signals "STOP"
// 5. bt_driver_le_test_end()
// 6. In case of RX test, gather results
// 7. bt_tes... | (BTLETestStep_BTLEReceiverStart, data) | |
, FILE_TYPE_STATIC, strlen(overwrite_string));
cl_assert(tmp_fd >= 0);
rv = pfs_write(tmp_fd, (uint8_t *)overwrite_string, strlen(overwrite_string));
cl_assert_equal_i(rv, strlen(overwrite_string));
cl_assert_equal_i(pfs_close(tmp_fd), S_SUCCESS);
uint8_t new_buf[strlen(overwrite_string)];
fd = pfs_open(fi... | (buf, sizeof(buf), "This is small buf %d!", 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... | xSemaphoreGive(s_erase_mutex) | ;
}
#endif
static void prv_async_erase_done_cb(void *ignored, status_t result) {
if (PASSED(result) &&
s_erase_state.next_erase_addr < s_erase_state.end_addr) {
// Chain the next erase from a new callback to prevent recursion (and the
// potential for a stack overflow) if the flash_erase_sector calls t... |
layer_set_update_proc(&layer, &white_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &corners_all_update_callback);
layer_render_tree(&layer,... | graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 7, GCornersAll) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r7_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 8, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_orig... |
_enable(bus_idx);
}
/*---------------INIT/USE/RELEASE/RESET FUNCTIONS----------------------*/
void i2c_init(void) {
for (uint32_t i = 0; i < ARRAY_LENGTH(i2c_buses); i++) {
i2c_buses[i].i2c = BOARD_CONFIG.i2c_bus_configs[i].i2c;
i2c_buses[i].user_count = 0;
i2c_buses[i].busy = false;
i2c_buses[i].tr... | (device_id < BOARD_CONFIG.i2c_device_count) | |
"applib/ui/dialogs/expandable_dialog.h"
#include "apps/system_app_ids.h"
#include "apps/system_apps/launcher/launcher_app.h"
#include "apps/system_apps/timeline/timeline.h"
#include "kernel/event_loop.h"
#include "kernel/ui/modals/modal_manager.h"
#include "popups/timeline/peek.h"
#include "process_management/app_mana... | click_manager_reset(&data->click_manager) | ;
}
|
/*
* 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... | (line.height_px == 10) | ;
cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX);
cl_assert(iter_next(&word_iter));
cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params));
cl_assert(line.height_px == 10);
cl_assert(line.width_px == 7 * HORIZ_ADVANCE_PX);
// Should not have room for another word
cl_asser... |
equal_i(pfs_read(fd, (uint8_t *)rbuf, len), len);
cl_assert(memcmp(rbuf, buf, len) == 0);
cl_assert(fd >= 0);
cl_assert(pfs_close(fd) == S_SUCCESS);
}
}
static uint32_t s_watch_file_callback_called_count = 0;
static void prv_file_changed_callback(void *data) {
s_watch_file_callback_called_count++;
}
v... | {
snprintf(file_small, sizeof(file_small), "file%d", i);
uint8_t buf[PFS_SECTOR_SIZE * 2];
uint8_t bufcmp[PFS_SECTOR_SIZE * 2];
memset(&bufcmp[0], i, sizeof(bufcmp));
int fd = pfs_open(file_small, OP_FLAG_READ, FILE_TYPE_STATIC, 0);
cl_assert(fd >= 0);
cl_assert_equal_i(pfs_read(fd, &buf... |
}
static bool prv_filename_filter_a_prefix_cb(const char *name) {
return (strncmp(name, "a_", 2) == 0);
}
static bool prv_find_name(ListNode *node, void *data) {
PFSFileListEntry *entry = (PFSFileListEntry *)node;
return (strcmp(entry->name, (char *)data) == 0);
}
void test_pfs__file_list(void) {
pfs_format... |
/*
* 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, false/*animated*/) | |
/*
* 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... | (sizeof(Uuid)) | |
---------------------
// Sample captured: 2015-09-24 06:50:23 local
AccelRawData *activity_sample_50_steps_barefoot_2(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_50_barefoot_2
//> TEST_EXPECTED 50
//> TEST_EXPECTED_MIN 45
//> TEST_EXPECTED_MAX 60
//> TE... | { 832, 56, 56},
{ 784, 96, 16},
{ 808, 200, 16},
{ 864, 280, 0},
{ 912, 344, -24},
{ 1024, 368, -40},
{ 1112, 400, -104},
{ 1176, 344, 0},
{ 1224, 360, -32},
{ 1160, 344, 8},
{ 928, 312, 8},
{ 936, 312, 0},
{ 968, 280, 80},
{ 880, 224, 128},
{ 864, 192, 128},
... |
{ 1096, 96, 136},
{ 960, 72, 136},
{ 816, 216, -96},
{ 856, 264, -152},
{ 880, 232, -56},
{ 944, 192, 48},
{ 888, 168, 24},
{ 840, 224, -8},
{ 848, 256, -16},
{ 880, 280, -40},
{ 912, 304, -48},
{ 1008, 336, -56},
{ 1096, 376, -40},
{ 952, 344, -8},
{ 1168, 3... |
/*
* 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... | layer_add_child(&window->layer, &title->layer) | ;
app_window_stack_push(window, true /* Animated */);
// Enter the bluetooth test mode
if (!bt_test_bt_sig_rf_test_mode()) {
PBL_LOG(LOG_LEVEL_WARNING, "Failed to enter bt_sig_rf!");
}
}
static void s_main(void) {
prv_handle_init();
app_event_loop();
// Bring us out of test mode. Do this on the k... |
a key to a large value. This should succeed with
// plenty of room to spare if our space tracking is functioning correctly.
uint8_t big_val[SETTINGS_VAL_MAX_LEN] = {};
set_and_verify(&file, key, key_len, big_val, 511);
}
typedef enum {
RecordResultOld,
RecordResultNew,
RecordResultEnd,
} RecordResult;
st... | (&file, "test_file_zero_length", 4096) | );
uint8_t key[4];
int key_len = sizeof(key) - 1;
memcpy(key, "key", sizeof(key));
uint8_t val[4];
int val_len = sizeof(val) - 1;
memcpy(val, "val", sizeof(val));
set_and_verify(&file, key, key_len, val, val_len);
set_and_verify(&file, key, key_len, val, 0);
// This one's a little funny... We could ... |
a->ble_data.name);
SMPairingInfo info = {};
bt_persistent_storage_assign_sm_pairing_info(&info, &data->ble_data.pairing_info);
bluetooth_persistent_storage_debug_dump_ble_pairing_info(&display_buf[0], &info);
// does this info match the key stored in shared resources
SMPairingInfo sprf_info = {};
... | BT_DEVICE_ADDRESS_XPLODE_PTR(address) | );
}
} else if (info->key_len == sizeof(BTBondingID)) {
PBL_ASSERTN(sizeof(BtPersistBondingData) == info->val_len);
BTBondingID id;
memcpy(&id, key, sizeof(BTBondingID));
prv_dump_bonding_db_data(display_buf, id, (BtPersistBondingData *)&val);
} else {
prompt_send_response("Something new be ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.