prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
TF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_IDLE, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18P, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_VDD, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V14, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_F... | REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_INST_MD, 0x0) | |
ck for address bits stuck at low or shorted
/////////////////////////////////////////////////////////////
PBL_LOG(LOG_LEVEL_DEBUG, ">START - ADDR TEST 2: Check for address bits stuck at low or shorted");
// NOTE that the previous test only modified the data at base_addr and left all other
// power-of-2 address... | if ((stress_addr1 < FLASH_REGION_FILESYSTEM_BEGIN) ||
(stress_addr1 >= FLASH_REGION_FILESYSTEM_END)) {
PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Invalid range");
return FLASH_TEST_ERR_ADDR_RANGE;
} |
if ((stress_addr2 < FLASH_REGION_FILESYSTEM_BEGIN) ||
(stress_addr2 >= FLASH_REGION_FILESYSTEM_END)) {
PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Invalid range");
return FLASH_TEST_ERR_ADDR_RANGE;
}
// Erase sectors
flash_erase_sector_blocking(stress_addr1);
status = prv_read_verify_halfword(stress_add... |
char *s_pbi2png_path;
// Stubs
void passert_failed(const char* filename, int line_number, const char* message, ...) {
exit(EXIT_FAILURE);
}
void passert_failed_no_message(const char* filename, int line_number) {
exit(EXIT_FAILURE);
}
void wtf(void) {
exit(EXIT_FAILURE);
}
bool process_manager_compiled_with_le... | printf("File not found: %s\n", filename) | ;
return;
}
// Check that file is a PDC file
char magic[4];
if (fread(magic, sizeof(magic), 1, f) != 1) {
printf("Failed to read PDC magic word: %s\n", filename);
fclose(f);
return;
}
// Read size of data
size_t size;
if (fread(&size, sizeof(size), 1, f) != 1) {
printf("Failed to r... |
/*
* 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... | (strtol(" 713713", NULL, 10), 713713) | ;
}
void test_strtol__suffix(void) {
cl_assert_equal_i(strtol("500hurf", NULL, 10), 500);
cl_assert_equal_i(strtol("765berserker", NULL, 10), 765);
cl_assert_equal_i(strtol("573888 redmage", NULL, 10), 573888);
cl_assert_equal_i(strtol("713713 4 job fiesta111", NULL, 10), 713713);
}
void test_strtol__sign(voi... |
/*
* 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((memcmp(&t_c, &test_array, sizeof(GTransform)) == 0)) | ;
cl_assert(gtransform_is_equal(&t_c, (const GTransform*)&test_array));
t_c = GTransformFromNumbers(1, 2, 3, 4, 5, 6);
cl_assert(gtransform_is_equal(&t_c, (const GTransform*)&test_array));
// Test to make sure implemented rotation calculation is correct
int32_t angle = DEG_TO_TRIGANGLE(45);
int32_t cosine... |
assert(tuple->length == sizeof(uint32_t));
cl_assert(tuple->value->uint32 == 32);
uint32_found = true;
break;
case SOME_INT8_KEY:
cl_assert(tuple->length == sizeof(int8_t));
cl_assert(tuple->value->int8 == -8);
int8_found = true;
break;
case SOME_INT16... | TupletCString(SOME_STRING_KEY, NEW_STRING) | |
{
// Wrap-around source bitmap horizontally:
src_block = src_block_begin;
src_start_idx = src_line_wrap_idx;
src_end_idx = MIN(src_line_wrap_end_idx, src_start_idx + row_bits_left);
} | else {
src_start_idx = 0;
src_end_idx = MIN(32, row_bits_left);
}
src = *src_block;
}
}
}
}
void bitblt_bitmap_into_bitmap_tiled(GBitmap* dest_bitmap, const GBitmap* src_bitmap,
GRect dest_rect, GPoint src_origin_offset,
... | |
ze_t header_size = sizeof(ROCKY_EXPECTED_SNAPSHOT_HEADER);
cl_assert_equal_i(8, header_size);
// NOTE: the snapshot header in this unit test is fixed to
// CAPABILITY_JAVASCRIPT_BYTECODE_VERSION=1 only use the resulting binary
// if the true JS version matches
memcpy(snapshot, &ROCKY_EXPECTED_SNAP... | (date_builtin != global_date) | ;
jerry_release_value(global_date);
jerry_release_value(global_object);
jerry_release_value(date_builtin);
}
void test_js__capture_mem_stats_upon_exiting_event_loop(void) {
prv_deinit();
s_app_event_loop_callback = NULL;
const char *source = ";";
cl_assert_equal_b(true, rocky_event_loop_with_string_or_... |
/*
* 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... | dictation_session_destroy(session) | ;
}
}
static void prv_app_focus_handler(PebbleEvent *e, void *context) {
DictationSession *session = context;
if (e->app_focus.in_focus) {
event_service_client_subscribe(&session->dictation_result_sub);
voice_window_regain_focus(session->voice_window);
} else {
event_service_client_unsubscribe(&ses... |
est_num = (int16_t)((float)-2 * (1 << FIXED_S16_3_PRECISION));
cl_assert(memcmp(&num, &test_num, sizeof(Fixed_S16_3)) == 0);
num = (Fixed_S16_3){ .raw_value = (int16_t)((float)-3.5 * (1 << FIXED_S16_3_PRECISION)) };
test_num = (int16_t)((float)-3.5 * (1 << FIXED_S16_3_PRECISION));
cl_assert(memcmp(&num, &test_... | (num.integer == 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... | (buffer, buffer_size, metric_value, conversion_factor) | |
ssion;
void test_phone_pp__initialize(void) {
fake_event_init();
fake_comm_session_init();
s_transport = fake_transport_create(TransportDestinationSystem, NULL, NULL);
s_session = fake_transport_set_connected(s_transport, true /* connected */);
pp_get_phone_state_set_enabled(false);
}
void test_phone_pp__cl... | {
fake_transport_set_sent_cb(s_transport, prv_assert_decline_call_sent_cb);
pp_decline_call(expected_cookie);
fake_comm_session_process_send_next();
} |
static void prv_assert_get_phone_call_state_sent_cb(uint16_t endpoint_id,
const uint8_t* data, unsigned int data_length) {
uint8_t expected_request_msg[] = {0x03};
cl_assert_equal_i(sizeof(expected_request_msg), data_length);
cl_assert_equal_i(memcmp(expected_requ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (log_level) | |
et_layer(status_layer));
}
// Deinit the common status bar component.
static void prv_deinit_status_bar(StatusBarLayer *status_layer) {
layer_remove_from_parent(status_bar_layer_get_layer(status_layer));
status_bar_layer_deinit(status_layer);
}
// Dialog callbacks for confirmation.
///////////////////////////////... | {
ExpandableDialog *s_dialog = expandable_dialog_create("Core Dump Reset");
Dialog *dialog = expandable_dialog_get_dialog(s_dialog);
dialog_set_text(dialog, i18n_get("The core dump was created successfully. "
"Please create a support request as usual.", s_dialog));
dialog_set_text_color(dialog, GColorWhi... |
static void prv_coredump_reset_decline_cb(ClickRecognizerRef recognizer, void *context) {
ConfirmationDialog *confirmation_dialog = prv_settings_confirm("Core Dump",
i18n_noop("Core dump and reboot?"), RESOURCE_ID_GENERIC_QUESTION_LARGE);
confirmation_dialog_set_click_config_provider(confirmation_dialog,
... |
s.h"
#include "kernel/ui/modals/modal_manager.h"
#include "process_state/app_state/app_state.h"
#include "resource/resource_ids.auto.h"
#include "services/common/analytics/analytics.h"
#include "services/common/i18n/i18n.h"
#include "services/common/new_timer/new_timer.h"
#include "services/common/system_task.h"
#inclu... | (WeekendSchedule) | ) {
prv_set_schedule_mode_timer();
} else {
new_timer_stop(s_data.update_timer_id);
s_data.is_in_schedule_period = false;
}
prv_do_update();
}
static void prv_try_update_schedule_mode_callback(bool clear_manual_override) {
system_task_add_callback(prv_try_update_schedule_mode, (void*)(uintptr_t) cl... |
CT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS);
graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4);
graphics_draw_vertical_line_dotted(&ctx, GPoint(5, 0), 0);
graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1);
grap... | graphics_draw_vertical_line_dotted(&ctx, GPoint(5, 0), 0) | ;
graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(9, 0), 2);
graphics_draw_vertical_line_dotted(&ctx, GPoint(11, 0), 3);
graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4);
graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20);
graphic... |
, stack[0]);
cl_assert_equal_p(ab, stack[1]);
// go back one level and then to sibling
actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), ¤t_stack, true);
cl_assert_equal_p(b, actual);
cl_assert_equal_i(0, current_stack);
cl_assert_equal_p(b, stack[0]);
// no more sibli... | (&parent, &GPoint(-5, -5)) | , NULL);
cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(21, 21)), NULL);
layer_remove_from_parent(&child_f);
layer_add_child(&parent, &child_b);
layer_add_child(&parent, &child_c);
cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_a);
cl_assert_equal_... |
ower_up(bus);
}
prv_bus_pins_cfg_i2c(bus);
i2c_hal_enable(bus);
}
//! De-initialize and gate the clock to the peripheral
//! Power down rail if the bus supports that and no devices are using it
//! Always lock the bus and peripheral config access before disabling it
static void prv_bus_disable(I2CBus *bus) {
... | {
PBL_LOG(LOG_LEVEL_ERROR, "I2C Bus %s still hung after bitbang reset", slave->bus->name);
} |
prv_bus_pins_cfg_i2c(slave->bus);
prv_bus_reset(slave->bus);
mutex_unlock(slave->bus->state->bus_mutex);
return recovered;
}
/*--------------------DATA TRANSFER FUNCTIONS--------------------------*/
//! Wait a short amount of time for busy bit to clear
static bool prv_wait_for_not_busy(I2CBus *bus) {
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... | GPIO_Init(DISP_GPIO, &gpio_cfg) | ;
gpio_cfg.GPIO_Pin = DISP_PIN_SI;
GPIO_Init(DISP_GPIO, &gpio_cfg);
gpio_cfg.GPIO_Pin = DISP_PIN_SO;
GPIO_Init(DISP_GPIO, &gpio_cfg);
gpio_cfg.GPIO_Mode = GPIO_Mode_IN;
gpio_cfg.GPIO_PuPd = GPIO_PuPd_UP;
gpio_cfg.GPIO_Pin = DISP_PIN_CDONE;
GPIO_Init(DISP_GPIO, &gpio_cfg);
gpio_cfg.GPIO_Mode = GPIO... |
56, -352},
// 2 seconds
{ 464, 592, -280},
{ 456, 400, -336},
{ 520, 512, -400},
{ 616, 408, -376},
{ 672, 312, -344},
{ 808, 376, -424},
{ 1152, 168, -384},
{ 1312, 56, -256},
{ 1976, 120, -320},
{ 1432, 304, -568},
{ 608, 296, -576},
{ 776, 16, -416},
{ 808, 88,... | { 1216, 320, -64},
{ 1000, 416, -232},
{ 1048, 336, -24},
{ 792, 240, 88},
{ 712, 144, 88},
{ 744, 248, 112},
{ 800, 344, 24},
// 8 seconds
{ 752, 360, 16},
{ 832, 384, -56},
{ 1016, 384, -64},
{ 1200, 400, -112},
{ 1240, 320, -16},
{ 2080, 360, 96},
{ 1320, 4... |
{ 864, 160, 184},
{ 760, 160, 88},
{ 736, 128, 88},
{ 728, 104, 80},
{ 728, 88, 48},
{ 752, 40, 96},
{ 864, 48, 56},
{ 1096, 112, -16},
{ 1248, 8, 88},
{ 1752, 0, 192},
{ 1144, 248, -80},
{ 1024, 272, -56},
// 11 seconds
{ 1056, 232, -40},
{ 696, 224, 88},
... |
nCurve animation_get_curve(Animation *animation_h) {
if (animation_private_using_legacy_2(NULL)) {
// We need to enable other applib modules like scroll_layer, menu_layer, etc. which are
// compiled to use the 3.0 animation API to work with 2.0 apps.
return ((AnimationLegacy2 *)animation_h)->curve;
}
... | (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;
}
animation->immutable = true;
return true;
}
// ------------------------------------------------------------------... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | fake_spi_flash_init(0, 0x1000000) | ;
pfs_init(false);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */);
resource_init();
}
// Corner Tests
void draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset(Layer* me, GContext* ctx) {
graphics_... |
Fixed_S16_3 right_margin = {.raw_value = INT16_MIN};
// Find edges of the line's straigth part
if (y >= far_top.y.integer && y <= far_bottom.y.integer) {
// TODO: possible performance optimization: PBL-14744
// TODO: ^^ also possible avoid of following logic to avoid division by zero
... | const int16_t clip_min_x = ctx->draw_state.clip_box.origin.x
- ctx->draw_state.drawing_box.origin.x;
const int16_t clip_max_x = clip_min_x + ctx->draw_state.clip_box.size.w;
const int16_t x_min = CLIP((MIN(p0.x.raw_value, p1.x.raw_value) - radius.raw_value)
... | |
ed) + dst * (1 - alpha_normalized)
static ALWAYS_INLINE void prv_gbitmap_sequence_blend_over(GColor8 src_color, GColor8 *dst) {
if (src_color.a == 3) {
// Fast path: 100% opacity
*dst = src_color;
} else if (src_color.a == 0) {
// Fast path: 0% opacity, no-op!
} else {
const GColor8 dest_color = *dst;
... | applib_free(bitmap_sequence->png_decoder_data.palette) | ;
applib_free(bitmap_sequence);
}
}
static ALWAYS_INLINE GColor8 *prv_target_pixel_addr(GBitmap *bitmap, apng_fctl *fctl,
uint32_t x, uint32_t y) {
uint32_t offset = (fctl->y_offset + y + bitmap->bounds.origin.y) * bitmap->row_size_bytes +
(fctl->x_offs... |
ame_buffer(GContext* ctx) {
return NULL;
}
bool graphics_release_frame_buffer(GContext* ctx, GBitmap* buffer) {
return true;
}
void graphics_draw_pixel(){}
void graphics_fill_rect(GContext* ctx, const GRect *rect) {}
void graphics_private_draw_horizontal_line(){}
void graphics_private_draw_vertical_line(){}
void g... | GRect(3, 0, 2, 4) | );
// Odd-length width and height for container rect, 180 degree angle
const GRect container_rect3 = GRect(2, 2, 5, 5);
const GRect resulting_rect3 = grect_centered_from_polar(container_rect3, mode,
DEG_TO_TRIGANGLE(180), GSize(2, 4));
cl_assert_equal_g... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (msg->session_id == s_session.id) {
prv_session_deinit(true /* call_stop_handler */);
} else {
PBL_LOG(LOG_LEVEL_WARNING, "Received mismatching session id: %u vs %u",
msg->session_id, s_session.id);
} |
}
}
#else
void audio_endpoint_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t size) {
}
#endif
static void prv_responsiveness_granted_handler(void) {
if (s_session.id == AUDIO_ENDPOINT_SESSION_INVALID_ID) {
return; // Party's over
}
AudioEndpointSetupCompleteCallback cb = NULL;
... |
1000);
cl_assert_equal_i(s_num_alarm_events_put, 0);
s_current_minute = 10;
cl_assert_equal_i(s_num_alarm_events_put, 1);
}
void test_alarm__get_string_for_kind(void) {
bool all_caps = false;
cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "Every Day");
cl_assert_equal_s(alarm_g... | cron_service_wakeup() | |
// CRESET needs to be low for at least 200 ns
GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_RESET);
delay_ms(1);
GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_SET);
return prv_wait_programmed();
}
static bool prv_reset_fpga(void) {
#ifdef BLANK_FPGA
return display_program(s_fpga_bitstream, sizeof(s_fpga_bit... | ("Does the draw-scene command complete? ") | ;
dbgserial_putstr(prv_wait_busy()? "Yes" : "No");
#endif
// Work around an issue which some boards exhibit where the FPGA ring
// oscillator can start up with higher harmonics, massively overclocking the
// design and causing malfunction. When this occurrs, the draw-scene command
// will not work, asserting... |
nds->start == utf8_bounds->end);
if (is_string_empty) {
return;
}
const GTextOverflowMode overflow_mode = text_box->overflow_mode;
bool is_ellipsis_on_overflow = (overflow_mode == GTextOverflowModeTrailingEllipsis ||
overflow_mode == GTextOverflowModeFill);
if (is_ellips... | graphics_text_layout_get_max_used_size(ctx, text, font,
box, overflow_mode, alignment, NULL) | ;
return size.h;
}
GSize graphics_text_layout_get_max_used_size(GContext *ctx, const char *text, GFont const font,
const GRect box, const GTextOverflowMode overflow_mode,
const GTextAlignment alignment,
... |
ed 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 "apps/system_apps/workout/wor... | {
s_hrm_is_present = true;
s_workout_data = (WorkoutData) {};
s_sports_data = (SportsData) {};
// Setup graphics context
framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS});
framebuffer_clear(&s_fb);
graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App);
s_app_state_get_graphics_co... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | hc_protocol_enqueue_with_payload_and_expect(HcEndpointID_Ctl, cmd_id, payload, payload_len) | ;
if (!response) {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to receive response to ctl command %"PRIu8, cmd_id);
return false;
}
PBL_LOG(LOG_LEVEL_INFO, "Received ctl response for command %"PRIu8, cmd_id);
kernel_free(response);
return true;
}
bool hc_endpoint_ctl_init_sync(const BTDriverConfig *config) {
... |
imation(test_player);
cl_assert_equal_i(animation_is_scheduled(animation), false);
animation_schedule(animation);
animation_set_reverse(animation, true);
animation_set_elapsed(animation, 1234); // intentionally bad value
prv_play_animation_update(animation,
ANIMATION_NORMALIZED_M... | (test_reel) | , 20);
}
void test_kino_player__infinite_animation_finite_reel_reverse(void) {
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number
test_reel_data->duration_ms = 300;
kino_player_play(test_player);
animation_set_reverse(test_player->animat... |
r %"PRId8, event->status);
prv_handle_dictation_error(data, event->status);
break;
case VoiceStatusRecognizerResponseError:
VOICE_LOG("Result: speech not recognized");
prv_handle_dictation_error(data, event->status);
break;
case VoiceStatusTimeout:
VOICE_LOG("Result: timeou... | (data->dictation_timeout) | ;
}
static void prv_cancel_dictation(VoiceUiData *data) {
if ((data->state != StateStart) && (data->state != StateFinished) &&
(data->state != StateExiting) && (data->state != StateError)) {
VOICE_LOG("Cancel dictation session");
sys_voice_cancel_dictation(data->session_id);
data->session_id = VOIC... |
/*
* 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... | (ctx, &image->layer.bounds) | ;
}
graphics_context_set_compositing_mode(ctx, image->compositing_mode);
if (image->bitmap != NULL) {
const GSize size = image->bitmap->bounds.size;
const bool clips = true; // bitmap layer not allowed to draw outside of its frame
GRect rect = (GRect){{0, 0}, size};
grect_align(&rect, &image->lay... |
phics_circle__grect_centered_internal(void) {
GPointPrecise p1 = GPointPrecise(0, 0);
// GRectZero + standardize
cl_assert_equal_grect(GRect(0, 0, 0, 0), grect_centered_internal(&p1, GSize(0, 0)));
cl_assert_equal_grect(GRect(0, -1, 1, 2), grect_centered_internal(&p1, GSize(-1, -2)));
// handles fixed point
... | cl_assert_fixedS16_3(radius, 0.5) | ;
}
void test_graphics_circle__grect_polar_calc_values_standardizes(void) {
GPointPrecise center = {};
Fixed_S16_3 radius = {};
const GOvalScaleMode mode = GOvalScaleModeFitCircle;
GRect r = GRect(0, 0, 10, 20);
grect_polar_calc_values(&r, mode, ¢er, &radius);
cl_assert_gpoint_precise(center, 4.5, 9.5... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
disable_mcu_debugging();
} |
}
|
!= UPNG_EOK) {
APP_LOG(APP_LOG_LEVEL_ERROR, (upng_state == UPNG_ENOMEM) ? PNG_MEMORY_ERROR : PNG_DECODE_ERROR);
goto cleanup;
}
// Use UPNG to decode image and get data
uint32_t width = upng_get_width(upng);
uint32_t height = upng_get_height(upng);
uint8_t *upng_buffer = (uint8_t*)upng_get_buffer(upn... | if (palette == NULL) {
return 0;
} |
memset(palette, 0, padded_palette_size * sizeof(GColor8));
// Convert rgb + alpha palette to GColor8 palette
for (int i = 0; i < palette_entries; i++) {
(palette)[i] = GColorFromRGBA(
rgb_palette[i].r, rgb_palette[i].g, rgb_palette[i].b, // RGB
(i < alpha_palette_entries) ? alpha_palette[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... | {
return option_menu_default_cell_height(option_menu->content_type, is_selected);
} |
}
static int32_t prv_draw_selection_icon(const OptionMenu *option_menu, GContext *ctx,
const GRect *cell_layer_bounds, bool is_chosen) {
const int32_t left_icon_spacing = PBL_IF_RECT_ELSE(0, 14);
const GSize not_chosen_icon_bounds = gbitmap_get_bounds(&option_menu->not_chose... |
ffer[buffer_size];
AttributeList attr_list_out = {};
attribute_list_init_list(attr_list.num_attributes, &attr_list_out);
const uint8_t *buffer = (uint8_t *)deserialized_buffer;
const uint8_t *cursor = serialized_buffer;
attribute_deserialize_list((char **)&buffer, (char *)&deserialized_buffer[buffer_size],
... | attribute_list_add_cstring(&list, AttributeIdTitle, "Title1") | |
/*
* 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, &manifest, sizeof(ResourceManifest)) | ;
return manifest;
}
static bool prv_get_table_entry(ResTableEntry *entry, uint32_t index) {
uint32_t addr = sizeof(ResourceManifest) + index * sizeof(ResTableEntry);
return prv_read(addr, entry, sizeof(ResTableEntry));
}
static bool prv_get_resource(uint32_t resource_id, Resource *res) {
*res = (Resource){
... |
rivate handlers for compass service
static void prv_calibration_time_expired_cb(void* data) {
PBL_LOG(LOG_LEVEL_DEBUG, "Calibration time expired, complete, or app exit, "
"dropping back to low frequency");
if (!mag_change_sample_rate(MagSampleRate5Hz)) {
PBL_LOG(LOG_LEVEL_WARNING, "Forcing reset to ... | PBL_LOG(LOG_LEVEL_WARNING, "Read after %d samples failed, "
"restarting compass", samples_collected) | ;
mag_release();
mag_start_sampling();
}
return;
}
#ifdef RECOVERY_FW
s_last_mag_sample = mag_data;
#endif
// industry standard for heading coordinates uses NED convention (check out
// Freescale's AN4248 or ST's AN3192 as examples). Therefore, we map pebbles
// coordinate system (ENU) t... |
NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_16KB_sectors(void) {
cl_assert(system_flash_erase(FLASH_BASE, 48 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 2), erased_sector);
cl_assert(flash_locked);
}
void callback_is_called_... | {
fprintf(stderr, "0x%.08x", num);
} |
extern void dbgserial_putstr(char *str) {
fprintf(stderr, "%s\n", str);
}
|
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 "text_clipping.h"
#include "applib/app.h"
#include "applib/fonts/fonts.h"
#include "applib/ui/ui.h"
#include "... | {
text_layer_set_text(&data->word_wrap_layer, "Overflow: Word Wrap");
text_layer_set_overflow_mode(&data->text_layer, GTextOverflowModeWordWrap);
} | else {
text_layer_set_text(&data->word_wrap_layer, "Overflow: Ellipsis");
text_layer_set_overflow_mode(&data->text_layer, GTextOverflowModeTrailingEllipsis);
}
}
static void config_provider(Window *window) {
window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, (ClickHandler)click_handler);
window_... |
;
prv_insert_health_minute_record(context, minute_utc, ¤t_minute.base,
current_minute.heart_rate_bpm);
}
exit:
// Restore the circular buffer client to where it was before
*cbuf_client = cbuf_client_bck;
}
// --------------------------------------------------------... | (&record.hdr, utc_sec, true /*for_file*/) | |
te) == (1 << BITS_PER_PIXEL));
GBitmap s_bmp = (GBitmap) {
.addr = s_data,
.row_size_bytes = ROW_STRIDE,
.info.format = GBitmapFormat2BitPalette,
.info.version = GBITMAP_VERSION_CURRENT,
.bounds = { .size = { WIDTH, HEIGHT } },
.palette = s_palette,
};
memset(s_data, 0, sizeof(s_data));
... | (GCompOpAssign, GColorWhite, true /* transparent */) | ;
}
void test_bitblt_palette__4Bit_set_opaque(void) {
prv_4bit_simple(GCompOpSet, GColorWhite, false /* opaque */);
}
void test_bitblt_palette__4Bit_set_transparent(void) {
prv_4bit_simple(GCompOpSet, GColorWhite, true /* transparent */);
}
void test_bitblt_palette__4Bit_comptint_opaque(void) {
prv_4bit_simple... |
int8_t *)hello, sizeof(hello));
cl_assert(bytes_written == sizeof(hello));
pfs_close(fd_z);
}
extern void test_force_garbage_collection(uint16_t start_page);
extern uint16_t test_get_file_start_page(int fd);
void test_pfs__garbage_collection(void) {
char file_small[10];
uint16_t start_page = 0;
// create a s... | (buf_small, sizeof(buf_small), "This is small buf_small %d!", i) | ;
int len = strlen(buf_small);
int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len);
cl_assert(fd >= 0);
cl_assert(pfs_write(fd, (uint8_t *)buf_small, len) == len);
cl_assert(pfs_close(fd) == S_SUCCESS);
// delete every few files and a bunch of pages near the end
if (((i & 0x1... |
with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express... | (copy, info, sizeof(*info)) | ;
// We put to system task because analytics need to be init'ed first
system_task_add_callback(prv_analytics_bt_chip_boot_cb, copy);
}
break;
}
case HcMessageID_Analytics_LogBleMicErrorEvent: {
HcAnalyticsLogBleMicErrorEvent *info = (HcAnalyticsLogBleMicErrorEvent *)&msg->paylo... |
l/util/freertos_utils.h"
#include "system/passert.h"
#include <util/list.h>
#include <util/size.h>
#include <os/mutex.h>
// FreeRTOS
#include "FreeRTOSConfig.h"
// Dialog SDK
#include "sys_rtc.h"
#include <stdint.h>
#define MS_PER_SECOND (1000)
// Stopwatch
typedef struct {
ListNode node;
DialogAnalyticsMetri... | prv_unlock() | |
{
}
void test_ancs_pebble_actions__test_sms_reply(void) {
prv_support_sms_replies();
ANCSAttribute *notif_attributes[NUM_FETCHED_NOTIF_ATTRIBUTES] = {0};
ANCSAttribute *app_attrs[NUM_FETCHED_APP_ATTRIBUTES] = {0};
const size_t header_len = sizeof(GetNotificationAttributesMsg);
bool error = false;
const ... | (notif->action_group.actions[0].type, TimelineItemActionTypeAncsNegative) | ;
TimelineItemAction *response_action = ¬if->action_group.actions[1];
cl_assert_equal_i(response_action->type, TimelineItemActionTypeAncsResponse);
cl_assert_equal_i(response_action->attr_list.num_attributes, 2);
cl_assert_equal_i(response_action->attr_list.attributes[0].id, AttributeIdTitle);
cl_assert_eq... |
f, 0x00, 0x7f, 0xfc, 0x00, 0x00, 0x7f, 0x7c, 0x00, 0x00, /* bytes 64 - 80 */
0x03, 0x3c, 0x00, 0x00, 0x01, 0x3c, 0x00, 0x00, 0x00, 0x3c, 0x80, 0x00, 0x00, 0x3c, 0xc0, 0x00, /* bytes 80 - 96 */
0x00, 0x7e, 0xe0, 0x00, 0x00, 0xff, 0xff, 0x00, 0x81, 0xff, 0xff, 0x00,
};
static const GBitmap s_music_launcher_icon_bitm... | (menu_layer, window) | ;
layer_add_child(&window->layer, menu_layer_get_layer(menu_layer));
}
static void push_window(AppData *data) {
Window *window = &data->window;
window_init(window, WINDOW_NAME("Demo Menu"));
window_set_user_data(window, data);
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load... |
handler,
prv_volume_long_click_end_handler);
window_long_click_subscribe(BUTTON_ID_SELECT, 0, prv_play_pause_long_click_start_handler,
prv_play_pause_long_click_end_handler);
}
static void prv_volume_click_config_provider(void *context) {
window_single_re... | ((Layer *)&data->track_pos_bar, !music_is_progress_reporting_supported()) | |
ctivity_sessions[2] = {
.start_utc = start_of_today + (2 * SECONDS_PER_HOUR), // 2am
.length_min = (1 * MINUTES_PER_HOUR) + 30,
.type = ActivitySessionType_RestfulSleep,
},
};
prv_create_card_and_render(&health_data);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test... | prv_create_card_and_render(&health_data) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_health_sleep_summary_card__render_sleep_late_start_late_end1(void) {
const time_t start_of_today = time_util_get_midnight_of(s_now_utc);
HealthData health_data = {
// Used for text
.sleep_data[0] = (8 * SECONDS_PER_HOUR) + (12 *... |
l_ui.h"
#include "kernel/ui/modals/modal_manager.h"
#include "process_management/app_manager.h"
#include "resource/resource_ids.auto.h"
#include "services/common/battery/battery_curve.h"
#include "services/common/clock.h"
#include "services/common/i18n/i18n.h"
#include "services/common/light.h"
#include "system/logging... | (text_layer, line_spacing_delta) | ;
}
#endif
if (old_dialog) {
dialog_pop(old_dialog);
}
}
// Public API
////////////////////
void battery_ui_display_plugged(void) {
// If we're plugged in for charging, we want to alert the user of this,
// but we don't want to overlay ourselves over anything they may have
// on the screen at the mom... |
rt(pfs_remove(file_small) == S_SUCCESS);
}
}
// We limit this number because we would overflow our uint8_t.
const int num_regions = MIN(UINT8_MAX, (num_pages() * 5) / 10);
int fd = pfs_open("page_lookup", OP_FLAG_WRITE, FILE_TYPE_STATIC, PFS_SECTOR_SIZE * num_regions);
cl_assert(fd >= 0);
char buf[PFS... | (fd, len + 1, FSeekSet) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (LOG_LEVEL_ERROR, "Error opening file %d", fd) | ;
// Remove file so next open will create a new one (notification storage trashed)
pfs_remove(FILENAME);
}
notification_storage_unlock();
}
return fd;
}
static void prv_file_close(int fd) {
pfs_close(fd);
notification_storage_unlock();
}
static int prv_write_notification(TimelineItem *noti... |
info();
prv_reset_read_consumer();
smartstrap_fsm_state_set(SmartstrapStateReadReady);
smartstrap_state_unlock();
if (context.is_notify) {
smartstrap_profiles_handle_notification(context.success, read_profile);
} else {
smartstrap_profiles_handle_read(context.success, read_profile, read_length);
}
... | hdlc_streaming_decode(&s_read_info.hdlc_ctx, &data, &should_store, &hdlc_err) | ;
if (hdlc_err) {
// the rest of the frame is invalid
s_read_info.should_drop = true;
} else if (is_complete) {
prv_handle_complete_frame(&should_context_switch);
} else if (should_store && !s_read_info.should_drop) {
prv_store_byte(data);
}
return should_context_switch;
}
void prv_notify_ti... |
W_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_BITS == 8
// AA = true, SW = 4
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP,... | 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_sw2_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 2);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw... |
,
contract_to_dot_distance);
prv_modal_transition_fill_update(ctx, distance_normalized, false /* fill outer */);
} else {
// For the second half of the animation where the app is the destination, draw the "expand to
// app" frame and fill its inner ring wi... | animation_set_curve(animation, AnimationCurveLinear) | ;
}
static void prv_modal_transition_animation_teardown_rect(Animation *animation) {
if (s_data.animation_sequence) {
gdraw_command_sequence_destroy(s_data.animation_sequence);
s_data.animation_sequence = NULL;
}
}
const CompositorTransition *prv_modal_transition_get_rect(bool modal_is_destination) {
//... |
l, new_selected_index);
menu_layer_set_selected_index(&aml->menu_layer, MenuIndex(0, menu_layer_index),
MenuRowAlignCenter, animated);
}
static void prv_scroll_handler(ClickRecognizerRef recognizer, void *context) {
ActionMenuLayer *aml = context;
const bool up = (click_recognizer... | {
const PreferredContentSize runtime_platform_default_size =
system_theme_get_default_content_size_for_runtime_platform();
const ActionMenuSeparatorConfig *config = &s_separator_configs[runtime_platform_default_size];
// If this index is the seperator index, we want to draw the separator line
/... |
}
static int16_t prv_get_header_height_cb(struct MenuLayer *menu_layer, uint16_t second_index,
void *callback_context) {
ActionMenuLayer *aml = callback_context;
if (!prv_should_center(aml) || prv_aml_is_short(aml) || aml->num_items == 0) {
return 0;
}
const int16_... |
%s\n", i, key, val);
set_and_verify(&file, key, key_len, val, val_len);
// delete the first iteration
if (j < 255) {
settings_file_delete(&file, key, key_len);
}
}
printf("Making sure we handle running out of storage gracefully...\n");
memcpy(key, "k255", 5);
memcpy(val, "v255", 5);
cl_... | {
printf("original! %d\n", original_value_length);
cl_assert_equal_m(original_value, val_out, val_len_out);
free(val_out);
return RecordResultOld;
} | else if (val_len_out == new_value_length) {
printf("new! %d\n", new_value_length);
cl_assert_equal_m(new_value, val_out, val_len_out);
free(val_out);
return RecordResultNew;
}
// Should not get here! This means that neither the old nor the new value
// could be retreived, and thus t... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | app_get_current_graphics_context() | ,
&data->text_layer);
PBL_LOG(LOG_LEVEL_DEBUG, "Line Delta: %d, Size %d x %d, Overflow: %d", data->line_spacing_delta,
size_used.w, size_used.h, data->overflow_mode);
}
static void config_provider(Window *window) {
window_single_click_subscribe(BUTTON_ID_UP... |
/*
* 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... | ("res_bank", 255, buf, sizeof(buf)) | |
text.draw_state.fill_color.argb, GColorOrange.argb);
#else
cl_assert_equal_i(context.draw_state.fill_color.argb, GColorDarkGray.argb);
#endif
color.a = 1;
graphics_context_set_fill_color(&context, color);
cl_assert_equal_i(context.draw_state.fill_color.argb, GColorClear.argb);
color.a = 0;
graphics_contex... | GPoint(5, 5) | , GPoint(45, 10)));
setup_test(&context, false, 1, GColorBlack, GColorBlack, false);
graphics_draw_rect(&context, &GRect(10, 20, 40, 10));
ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10)));
setup_test(&context, false, 1, GColorBlack, GColorBlack, false);
graphics_draw_circle(&context, GPoint(50... |
/*
* 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... | (3, string_list_count(list)) | ;
cl_assert_equal_s("ab", string_list_get_at(list, 0));
cl_assert_equal_s("", string_list_get_at(list, 1));
cl_assert_equal_s("", string_list_get_at(list, 2));
cl_assert_equal_s(NULL, string_list_get_at(list, 3));
// 4 strings (first and last two are empty)
list->serialized_byte_length = 4;
list->data[0]... |
_cross_black_corners-expect.8bit.pbi"));
memset(dest_data, GColorWhite.argb, sizeof(dest_data));
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorLightGray);
cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_comptint_white_cross_lightgray_corners-expect.8bit.pbi"... | GRect(0, 0, src_bitmap->bounds.size.w - 2, src_bitmap->bounds.size.h - 4) | ;
GPoint src_origin_offset = { 2, 4 }; // Offset past the black
bitblt_bitmap_into_bitmap_tiled_1bit_to_8bit(
&dest_bitmap, src_bitmap, dest_rect, src_origin_offset, GCompOpAssign, GColorWhite);
cl_assert(gbitmap_pbi_eq(&dest_bitmap,
"test_bitblt__1bit_to_8bit_src_origin_offset-... |
/*
* 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 (!stop) {
// track (# connection attempts * 10^3) / sec
uint32_t conn_attempts_per_sec = ((1000 * 1000 * 5) / (interval_1_25ms)) / 4;
analytics_stopwatch_start_at_rate(
ANALYTICS_DEVICE_METRIC_BLE_CONN_EVENT_COUNT,
conn_attempts_... |
bt_unlock();
}
void bluetooth_analytics_handle_param_update_failed(void) {
analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_CONN_PARAM_UPDATE_FAILED_COUNT,
AnalyticsClient_System);
}
//! only called when we are connected as a slave
void bluetooth_analytics_handle_connection_params_update(const BleConnec... |
mpare the first activity found
if (!found_activity) {
result.activity_type.value = (int)session->activity;
result.len.value = (int)session->len_minutes;
result.start_at.value = start_idx;
found_activity = true;
}
}
result.weighted_err = 0.0;
result.all_passed = t... | {
// Run the 30 step sample.
// The expected results were obtained empirically on a known good commit
{
int num_samples;
AccelRawData *samples = activity_sample_30_steps(&num_samples);
TestMinuteData exp_minutes[] = {
{
.steps = 28,
.orientation = 0x47,
.vmc = 1205,
... |
// ---------------------------------------------------------------------------------------
// Utility for feeding in artificial walk/run activity samples into the algorithm's
// activity detector logic
static void prv_insert_artificial_activity_session(KAlgTestActivityMinute *samples, int samples_len,
... |
ixed_S32_16 value;
Fixed_S32_16 start_value, end_value, mid_value;
const int duration = 1000;
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped = prv_stopped_handler
};
// NOTE: We are not exposing the GTransform in the public SDK, so the setter and getter
// must be ty... | property_animation_set_from_uint32(prop_h, &start_value) | |
orBlack);
graphics_fill_round_rect(ctx, &GRect(10, 2, 18, 4), 4, GCornersAll);
}
void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_antialiased(ctx, false);
graphics_context_set_fill_color(ctx, GColorBlack);
graphics_fill_round_rect(ctx, &GRect(-10, 2, 18, 4), 4, GCornersAll)... | (&layer, &across_y_layer_update_callback) | |
egacy2Scheduler *animation_legacy2_scheduler = get_current_scheduler();
return list_contains(animation_legacy2_scheduler->head, &animation->list_node);
}
static void animation_legacy2_private_run(AnimationLegacy2Scheduler *animation_legacy2_scheduler) {
AnimationLegacy2 *animation = (AnimationLegacy2 *) animation_... | {
return animation->context;
} |
void animation_legacy2_set_delay(AnimationLegacy2 *animation, uint32_t delay_ms) {
PBL_ASSERTN(animation->abs_start_time_ms == 0); // can't set after animation has been added
animation->delay_ms = delay_ms;
}
void animation_legacy2_set_duration(AnimationLegacy2 *animation, uint32_t duration_ms) {
PBL_ASSERTN(a... |
CompositorTransitionDirectionLeft,
GColorWhite);
}
void test_graphics_window_stack_animation__left_flip_last_frame_clipping(void) {
prv_test_clipping_mask(prv_left_flip_last_frame_clipping, "left_flip_last_frame_cli... | (ctx, 0,
CompositorTransitionDirectionRight,
GColorWhite) | |
e of the
// different possible dest_colors
for (int16_t x = 0; x < bitmap_size.w; x++) {
for (int16_t row_index = 0; row_index < num_dest_colors; row_index++) {
const int16_t starting_y = row_index * vline_applying_test_row_height;
for (int16_t y = starting_y; y < starting_y + vline_applying_test_ro... | prv_mask_record_hline_test_pattern(prv_hline_pattern_record_assign_horizontal_line_raw) | ;
CHECK_EXPECTED_TEST_IMAGE(s_ctx);
};
void prv_mask_recording_blend_horizontal_line_raw(GContext *ctx, int16_t y, int16_t x1,
int16_t x2, GColor color);
void test_graphics_context_mask__record_blend_horizontal_line_raw(void) {
prv_mask_record_hline_test_pattern(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... | bitblt_bitmap_into_bitmap(&s_dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite) | ;
cl_assert(gbitmap_pbi_eq(&s_dest_bitmap,
"test_bitblt_palette_1bit__1bit_palette_to_1bit_assign-expect.pbi"));
gbitmap_destroy(src_bitmap);
}
// Test images reside in "tests/fw/graphics/test_images/".
// The wscript will convert them from PNGs in that directory to PBIs in the build directory.
... |
ingsDisplayAdjustAlignment,
#endif
NumSettingsDisplayItems
};
// number of items under SettingsDisplayBacklightMode which are hidden when backlight is disabled
static const int NUM_BACKLIGHT_SUB_ITEMS = SettingsDisplayBacklightTimeout -
SettingsDisplayBacklightMode;
static... | settings_window_create(SettingsMenuItemDisplay, &data->callbacks) | ;
}
const SettingsModuleMetadata *settings_display_get_info(void) {
static const SettingsModuleMetadata s_module_info = {
.name = i18n_noop("Display"),
.init = prv_init,
};
return &s_module_info;
}
|
/*
* 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 (; length >= 4; length -= 4) {
*reg = prv_crc_byte(*reg, data_bytes[3]);
*reg = prv_crc_byte(*reg, data_bytes[2]);
*reg = prv_crc_byte(*reg, data_bytes[1]);
*reg = prv_crc_byte(*reg, data_bytes[0]);
data_bytes += 4;
} |
for (; length; length--) {
accumulator[(*accumulated_length)++] = *data_bytes++;
}
}
uint32_t legacy_defective_checksum_finish(LegacyChecksum *checksum) {
if (checksum->accumulated_length) {
// CRC the final bytes forwards (reversed relative to the normal checksum)
// padded on the left(!) with nul... |
pp_install_manager.h"
#include "stubs_app_timer.h"
#include "stubs_app_window_stack.h"
#include "stubs_bootbits.h"
#include "stubs_click.h"
#include "stubs_event_service_client.h"
#include "stubs_layer.h"
#include "stubs_logging.h"
#include "stubs_memory_layout.h"
#include "stubs_modal_manager.h"
#include "stubs_mutex.... | if (config->icon_timeline_res_id != TIMELINE_RESOURCE_INVALID) {
attribute_list_add_resource_id(&attr_list, AttributeIdIconPin, config->icon_timeline_res_id);
} | |
/*
* 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... | gbitmap_create_blank(s10, GBitmapFormat8Bit) | |
scheduled(state, child)
|| prv_animation_children_scheduled(state, child)) {
return true;
}
}
}
return false;
}
// -------------------------------------------------------------------------------------------
// Unschedule of an animation and optional destroy, recurses into childre... | PBL_ASSERTN(list_contains(state->unscheduled_head, &animation->list_node)
|| list_contains(state->scheduled_head, &animation->list_node)) | ;
#endif
if (force_destroy || animation->defer_delete
|| ((allow_auto_destroy && animation->auto_destroy)
&& !prv_animation_is_scheduled(state, animation))) {
// It's possible the stopped handler rescheduled, so check before we destroy it
prv_unlink_and_free(state, animation);
}
}
// ---... |
/*
* 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... | {
const GBitmap *icon = action_bar->icons[index];
if (icon) {
const bool is_highlighted = action_bar_legacy2_is_highlighted(action_bar, index);
if (is_highlighted) {
graphics_context_set_fill_color(ctx, highlighted_color);
GCornerMask corner;
switch (index) {
case 0... |
}
void action_bar_layer_legacy2_init(ActionBarLayerLegacy2 *action_bar) {
*action_bar = (ActionBarLayerLegacy2){};
layer_init(&action_bar->layer, &GRectZero);
action_bar->layer.update_proc = (LayerUpdateProc) action_bar_legacy2_update_proc;
action_bar->layer.property_changed_proc =
(PropertyChangedProc)... |
LOGMSG_VERSION_STRING_V1, .length = 8, },
.string = "OVERRUN\0",
};
void pbl_log_set_level(uint8_t level) {
s_log_buffer.level = level;
}
uint8_t pbl_log_get_level(void) {
return s_log_buffer.level;
}
int printf(const char *__restrict format, ...) {
char line_buffer[128];
va_list args;
va_start(args... | (&s_log_buffer.circular_buffer, (uint8_t *)&OVERRUN.header,
sizeof(OVERRUN) - sizeof(HcProtocolMessage)) | ;
}
prv_start_tx();
prv_unlock();
}
#ifdef PBL_LOGS_HASHED
void pbl_log_hashed(const uint32_t packed_loghash, ...) {
unsigned num_fmt_conversions = (packed_loghash >> PACKED_NUM_FMT_OFFSET) & PACKED_NUM_FMT_MASK;
unsigned str_index_1 = (packed_loghash >> PACKED_STR1FMT_OFFSET) & PACKED_STR1FMT_MASK;
unsig... |
#include "stubs_bluetopia_interface.h"
#include "stubs_bt_lock.h"
#include "stubs_gatt_client_discovery.h"
#include "stubs_gatt_client_subscriptions.h"
#include "stubs_logging.h"
#include "stubs_mutex.h"
#include "stubs_passert.h"
#include "stubs_prompt.h"
void gap_le_connect_bluetopia_connection_callback(uint32_t st... | (ad,
&advert_term,
sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm),
unscheduled_callback, s_unscheduled_cb_data, 0) | |
se and delay callbacks for worker closing");
s_install_callback_data.callback_paused_for_worker = true;
s_pending_worker_deletion = cur_worker_id;
worker_manager_handle_remove_current_worker();
}
if (s_install_callback_data.callback_paused_for_app ||
s_install_callback_da... | if (s_install_callback_data.callback_paused_for_worker) {
if (!s_install_callback_data.callback_paused_for_app) {
app_install_launcher_task_callback(NULL);
} else {
s_install_callback_data.callback_paused_for_worker = false;
}
} | |
>next, SWAP_MS, dy,
NULL);
return animation_spawn_create(prev_down, current_down, next_down, NULL);
}
static bool prv_setup_swap_up(SwapLayer *swap_layer) {
LayoutLayer *new_previous = prv_fetch_next_layout(swap_layer, -1);
// if there is no layout to swap u... | animation_schedule(animation) | ;
}
// scroll to top of current notification
static void prv_scroll_to_top(SwapLayer *swap_layer) {
int16_t offset = prv_get_current_notification_offset(swap_layer);
prv_scroll(swap_layer, offset, AnimationCurveEaseOut);
}
// scroll to bottom of current notification
static void prv_scroll_to_bottom(SwapLayer *swa... |
<stdint.h>
#include "drivers/flash/flash_impl.h"
#include "drivers/task_watchdog.h"
#include "drivers/watchdog.h"
#include "flash_region/flash_region.h"
#include "kernel/util/stop.h"
#include "os/mutex.h"
#include "os/tick.h"
#include "process_management/worker_manager.h"
#include "services/common/analytics/analytics... | mutex_lock(s_flash_lock) | ;
flash_impl_init(false /* coredump_mode */);
uint32_t erase_in_progress_address = 0;
bool is_subsector = false;
if (flash_impl_get_nvram_erase_status(
&is_subsector, &erase_in_progress_address) == S_TRUE) {
// An erase was interrupted by e.g. a crash. Retry the erase so the
// incompletely-era... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(0b00011111, BITS(4)) | |
_HZ)), ticks_to_time(s_coarse_ticks));
//save_rtc_time_state(0);
}
void rtc_init(void) {
periph_config_acquire_lock();
rtc_enable_backup_regs();
periph_config_release_lock();
restore_rtc_time_state();
initialize_fast_mode_state();
#ifdef PBL_LOG_ENABLED
char buffer[TIME_STRING_BUFFER_SIZE];
PBL_LOG(L... | RTC_AlarmCmd(RTC_Alarm_A, ENABLE) | |
{ 672, -32, -192},
{ 480, 16, -168},
{ 464, -32, -120},
{ 600, -24, -152},
{ 840, 16, -200},
{ 1096, -8, -256},
{ 1248, -80, -280},
{ 1704, -264, -304},
{ 976, 128, -336},
{ 1160, -56, -408},
{ 1168, 120, -440},
{ 952, -32, -336},
{ 600, -64, -224},
{ 432, 0, -200},
... | { 1328, 264, -312},
{ 1336, 96, -184},
{ 1280, 24, -120},
{ 896, 24, -192},
{ 608, 40, -208},
{ 456, 40, -200},
{ 504, 48, -160},
{ 672, 48, -160},
{ 936, -8, -184},
// 51 seconds
{ 1176, -24, -256},
{ 1272, -120, -248},
{ 1256, -128, -216},
{ 872, 128, -320},
... | |
raw(void) {
prv_mask_apply_hline_test_pattern(prv_hline_pattern_apply_assign_horizontal_line_delta_raw);
CHECK_EXPECTED_TEST_IMAGE(s_ctx);
};
//////////////////////////////////
// APPLYING VERTICAL LINE TESTS //
//////////////////////////////////
// These tests initialize a mask that has 4 * 64 rows, each of heig... | (NULL, NULL) | );
// Should start with default draw implementation
cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default_draw_implementation);
GDrawMask *mask1 = graphics_context_mask_create(ctx, true /* transparent */);
cl_assert(mask1);
cl_assert(graphics_context_mask_record(ctx, mask1));
// Should have sw... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (prv_get_irq_enum(exti_line)) | ;
periph_config_release_lock();
}
void exti_enable_other(ExtiLineOther exti_line) {
prv_lock();
EXTI->IMR |= prv_exti_line_to_bit(exti_line);
prv_unlock();
}
void exti_disable_other(ExtiLineOther exti_line) {
prv_lock();
uint32_t exti_bit = prv_exti_line_to_bit(exti_line);
EXTI->IMR &= ~exti_bit;
... |
_Closed);
break;
default:
break;
}
}
mutex_unlock(this->state->lock);
}
static bool prv_handle_configure_request(PPPControlProtocol *this,
struct LCPPacket *packet) {
if (ntoh16(packet->length) == LCP_HEADER_LEN) { // The request has no options
... | prv_handle_nak_or_reject(this, packet) | ;
prv_transition_to(this, LinkState_RequestSent);
break;
case LinkState_AckSent:
prv_handle_nak_or_reject(this, packet);
break;
default:
break;
}
}
static void prv_on_terminate_request(PPPControlProtocol *this,
struct LCPPacket *packet) {
i... |
than the other bars
// Note that Thursday is the center bar, not Wednesday since drawing begins with Monday
// S M T W T F S
const int bar_widths[DAYS_PER_WEEK] = { w, w, w, w + 1, w + 1, w + 1, w };
const int bar_width = bar_widths[weekday];
#else
const... | prv_bar_should_be_wide(i, graph_card->current_day) | ;
const GColor bar_color = prv_get_bar_color(graph_card, is_active, is_wide);
const int16_t next_x = prv_draw_day_bar(ctx, i, &box, bar_color, is_wide);
// Draw the day character legend
const int char_offset_y = 1;
box.origin.y = LABEL_OFFSET_Y + char_offset_y;
box.size.h = legend_line_height;
... |
se:
storage_release();
return success;
}
static void handle_evt_gap_connected(ble_evt_gap_connected_t *evt) {
PBL_LOG(LOG_LEVEL_DEBUG, "Connected, idx=%d!", (int)evt->conn_idx);
prv_log_conn_params(&evt->conn_params);
if (!evt->is_master) {
// To be compliant with BT Core Spec section 7.8.9, stop advert... | {
PBL_LOG(LOG_LEVEL_ERROR, "No connection for idx=%d", conn_idx);
return;
} |
BTDeviceInternal addr;
connection_get_address(conn, &addr);
BleConnectionParams params = {
.conn_interval_1_25ms = event->conn_params.interval_min,
.slave_latency_events = event->conn_params.slave_latency,
.supervision_timeout_10ms = event->conn_params.sup_timeout,
};
connection_set_conn_params... |
/*
* 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... | number_window_destroy(data) | ;
}
static void s_main(void) {
handle_init();
app_event_loop();
handle_deinit();
}
const PebbleProcessMd* light_config_get_info() {
static const PebbleProcessMdSystem s_accel_config_info = {
.common.main_func = s_main,
.name = "Light Config"
};
return (const PebbleProcessMd*) &s_accel_config_info;... |
*units_string =
active_window->workout_controller->get_distance_string(i18n_noop("MPH"),
i18n_noop("KM/H"));
GTextNodeText *units_text_node = health_util_create_text_node_with_text(
i18n_get(units_string, i18n_owner), units_font,... | (active_window->heart_icon) | ;
bounds.origin = box->origin;
prv_draw_heart_icon(ctx, active_window->heart_icon, &bounds, render, size_out);
}
static void prv_draw_hr_measuring_node_callback(GContext *ctx, const GRect *box,
const GTextNodeDrawConfig *config, bool render,
... |
memcpy(&feats->feats[0], &llm_local_le_feats.feats[0], LE_FEATS_LEN) | ;
feats->feats[0] &= ~BLE_CON_PARAM_REQ_PROC_FEATURE;
#if !SUPPORTS_PACKET_LENGTH_EXTENSION
feats->feats[0] &= ~BLE_LE_LENGTH_FEATURE;
#endif
}
#if !SUPPORTS_PACKET_LENGTH_EXTENSION
void llc_pdu_send_func(uint16_t conhdl, uint8_t length);
// This is called in the ROM by llcp_length_req_handler(). We want to p... | |
alls++;
}
static void prv_change(AnimationProgress progress, void *context) {
s_data.last_change_progress = progress;
cl_assert_equal_p(context, s_data.context);
s_data.num_change_calls++;
}
static void prv_did_change(void *context) {
cl_assert_equal_p(context, s_data.context);
s_data.num_did_change_calls++... | (from_area.size.h, to_area.size.h) | ;
cl_assert_passert(fake_event_service_handle_last());
}
void test_unobstructed_area_service__change(void) {
UnobstructedAreaHandlers handlers = {
.change = prv_change,
};
app_unobstructed_area_service_subscribe(handlers, s_data.context);
cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVE... |
w(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 3);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_B... | setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 2) | ;
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// SW = 3
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 3);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP);
cl_chec... |
0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.min);
} else if (strcmp(token, "TEST_LEN_MAX") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.max);
} else if (strcmp(token, "TEST_START_AT") == 0) {
sscanf(token + strlen(token) + 1, "%d", ... | {
if (state->dp == NULL) {
return false;
}
while (!state->file) {
state->ep = readdir(state->dp);
if (!state->ep) {
// No more files
return false;
}
// See if it's the right extension
int name_len = strlen(state->ep->d_name);
if (name_len < 3 || (strcmp(state->ep->d_name ... |
// ---------------------------------------------------------------------------------------
// Return info on the next set of samples
static bool prv_accel_sample_discovery_next(StepFileTestEntry *entry) {
AccelSampleDiscoveryState *state = &s_accel_sample_discovery_state;
while (true) {
// Read next entry i... |
Top-left center rotation point, Angle 45
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet);
graphics_draw_rotated_bitmap(&ctx, test_image_bw,
GPoint(27, 40), DEG_TO_TRIGANGLE(45), GPointZero);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
... | DEG_TO_TRIGANGLE(45) | , GPointZero);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
"draw_rotated_bitmap_origin_color_set_corner_45.Xbit.pbi"));
// Top-left center rotation point, Angle 45
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet);
graphics_draw_rotated_bitmap(&ctx, test_image_co... |
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 "services/common/shared_prf_storage/shared_prf_storage.h"
#include "shared_prf_storage_private.h"
#include "drivers/flash.h"
#include "flash_... | ((uint8_t *)&data->pinned_address, sizeof(data->pinned_address)) | &&
prv_field_valid((uint8_t *)&data->local_name, sizeof(data->local_name)) &&
prv_field_valid((uint8_t *)&data->getting_started, sizeof(data->getting_started)))) {
return true;
}
return false;
}
// Stored struct setters
static void prv_write_to_current_page(SharedPRFData *data, bool write_meta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.