prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
60},
{ 1224, 528, 8},
{ 1592, 440, 48},
{ 1384, 224, 32},
{ 1152, 112, 32},
{ 1000, 16, 48},
{ 984, 112, 16},
{ 968, 192, 16},
{ 896, 240, -8},
{ 1064, 200, 40},
// 43 seconds
{ 1232, 192, 8},
{ 952, 208, -48},
{ 1352, 168, -8},
{ 1448, 288, -80},
{ 1256, 280,... | { 1352, 112, 120},
{ 1240, 120, 96},
{ 1144, 152, 24},
{ 992, 176, 16},
{ 832, 168, 0},
{ 896, 136, 48},
{ 1080, 176, -32},
{ 960, 176, -152},
{ 1224, 136, 24},
{ 1544, 248, -40},
{ 1456, 360, -296},
{ 1352, 312, -288},
{ 1200, 152, -304},
{ 1064, 8, -144},
{ ... |
{ 112, -128, -1072},
{ 304, -112, -1016},
{ 280, -208, -864},
{ 152, -168, -792},
{ -16, -208, -720},
{ -96, -232, -696},
{ -88, -240, -712},
{ -80, -184, -776},
{ -88, -224, -904},
{ -192, -264, -1056},
{ -152, -216, -1208},
{ -160, -96, -1288},
{ -200, -72, -1336},... |
/*
* 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... | (job->cached_execute_time, UINT32_MAX) | ;
job->cached_execute_time = UINT32_MAX;
prv_clock_change(0, 0, true);
cl_assert_equal_i(job->cached_execute_time, target);
job->cached_execute_time = UINT32_MAX;
prv_clock_change(0, 1, false);
target--; // adjust for GMT offset change
cl_assert_equal_i(job->cached_execute_time, target);
job->cached_exe... |
CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "dbgserial.h"
#include "drivers/gpio.h"
#include "drivers/periph_config.h"
#include "stm32f7haxx_rcc.h"
#include "stm32f7haxx_gpio.h"
#include "util/... | cobs_encode(cooked_packet, raw_packet, raw_length) | ;
prv_putchar(FRAME_DELIMITER);
for (size_t i = 0; i < cooked_length; ++i) {
if (cooked_packet[i] == FRAME_DELIMITER) {
prv_putchar('\0');
} else {
prv_putchar(cooked_packet[i]);
}
}
prv_putchar(FRAME_DELIMITER);
s_message_length = 0;
}
void dbgserial_putstr(const char* str) {
dbg... |
/*
* 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, watchfaces_glance->subtitle, buffer_size) | ;
buffer[buffer_size - 1] = '\0';
}
}
static GTextNode *prv_create_subtitle_node(LauncherAppGlanceStructured *structured_glance) {
return launcher_app_glance_structured_create_subtitle_text_node(
structured_glance, prv_watchfaces_glance_subtitle_dynamic_text_node_update);
}
static void prv_destructor(La... |
------------
Animation *animation_sequence_init_from_array(Animation *parent, Animation **animation_array,
uint32_t array_len) {
PBL_ASSERTN(!animation_private_using_legacy_2(NULL));
return prv_complex_init(parent, animation_array, array_len, AnimationTypeSequence);
}
... | {
portENTER_CRITICAL();
if (animation_private_using_legacy_2(state)) {
AnimationLegacy2Scheduler *legacy_state = (AnimationLegacy2Scheduler *)state;
prv_dump_legacy_animations(legacy_state->head, buffer, buffer_size);
} else {
prv_dump_animations(state->scheduled_head, true, buffer, buffer_size);
... |
// -------------------------------------------------------------------------------------------
void animation_private_pause(void) {
s_paused = true;
}
// -------------------------------------------------------------------------------------------
void animation_private_resume(void) {
s_paused = false;
}
// --... |
y rendered those first few lines.
rotl32(src, (dest_shift_at_line_begin + ((0 - ((uint8_t)glyph_metrics.size.w)) % 32) * (clipped_glyph_target.origin.y - glyph_target.origin.y)) % 32);
src_rotated = (dest_shift_at_line_begin + ((0 - ((uint8_t)glyph_metrics.size.w)) % 32) * (clipped_glyph_target.origin.y - glyph... | {
*(dest_block) |= mask & src;
} |
#endif
dest_shift = (dest_shift + number_of_bits) % 32;
glyph_block_bits_left -= number_of_bits;
glyph_line_bits_left -= number_of_bits;
if (glyph_block_bits_left <= 0) {
// We ran out of bits in the current glyph block. Get the next glyph blob:
src = *(++glyph_block);
... |
_i(size.w, TEST_TEXT_SIZE.w);
cl_assert_equal_i(size.h, TEST_TEXT_SIZE.h);
}
void test_graphics_text_node__text_size(void) {
GContext *ctx = &s_data.gcontext;
GTextNodeText text_node = {};
text_node.text = (char *)TEST_TEXT;
text_node.font = TEST_FONT;
text_node.overflow = GTextOverflowModeTrailingEllipsis... | (&horizontal_a->container, &custom_a->node) | );
cl_assert_equal_i(horizontal_a->container.num_nodes, 3);
GTextNodeVertical *vertical_a = graphics_text_node_create_vertical(2);
cl_assert(vertical_a->container.node.free_on_destroy);
cl_assert_equal_i(vertical_a->container.max_nodes, 2);
cl_assert_equal_i(vertical_a->container.num_nodes, 0);
cl_assert(g... |
storage_acquire() | ;
{
const device_t *dev = find_device_by_conn_idx(conn_idx);
should_auto_accept_re_pairing = (dev &&
(dev->flags & BleBondingFlag_ShouldAutoAcceptRePairing));
}
storage_release();
should_auto_accept_re_pairing &= connection_should_auto_accept_re_pairing(conn);
return should_auto_accept_re_pai... | |
);
I2C_DeInit(bus->hal->i2c);
}
static uint32_t prv_get_apb1_frequency(void) {
RCC_ClocksTypeDef rcc_clocks;
RCC_GetClocksFreq(&rcc_clocks);
return rcc_clocks.PCLK1_Frequency;
}
static const int DUTY_CYCLE_DIVIDERS[] = {
[I2CDutyCycle_16_9] = 25,
[I2CDutyCycle_2] = 3
};
static uint32_t prv_prescalar_to_f... | i2c_handle_transfer_event(bus, event) | |
eturn false;
}
if (bonding_out) {
*bonding_out = active_gateway;
}
if (type_out) {
*type_out = prv_get_type_for_id(active_gateway);
}
return true;
}
bool bt_persistent_storage_is_unfaithful(void) {
return prv_file_get_bool(&IS_UNFAITHFUL_KEY, sizeof(IS_UNFAITHFUL_KEY), true /* default */);
}
v... | event_put(&event) | ;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Common
void bt_persistent_storage_init(void) {
// Note: this gets called well before the BT stack is initialized, make sure there is no code
// that tries to use the BT stack in this path.
s_db_mutex ... |
e(prv_get_baudrate(baud_select), false /* !force_update */);
prv_unlock();
}
void accessory_set_power(bool on) {
if (on == s_power_enabled) {
return;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Setting accessory power %s", on?"on":"off");
s_power_enabled = on;
gpio_output_set(&BOARD_CONFIG_ACCESSORY.power_en, on);
}
... | accessory_send_stream(prv_test_send_stream, NULL) | ;
accessory_enable_input();
accessory_set_baudrate(DEFAULT_BAUD);
accessory_use_dma(false);
char buffer[50];
if (!success) {
prompt_send_response_fmt(buffer, sizeof(buffer), "FAILED: send timed-out");
} else if (s_num_test_bytes == 0) {
prompt_send_response_fmt(buffer, sizeof(buffer), "PASS!");
}... |
_malloc.h"
#include "fake_system_task.h"
#include "fake_queue.h"
#include "fake_rtc.h"
#include "stubs_accel_manager.h"
#include "stubs_analytics.h"
#include "stubs_event_service_client.h"
#include "stubs_logging.h"
#include "stubs_mutex.h"
#include "stubs_passert.h"
#include "stubs_prompt.h"
#include "stubs_worker_ma... | {
PebbleEvent e = {
.type = PEBBLE_BATTERY_STATE_CHANGE_EVENT,
.battery_state.new_state.is_plugged = is_plugged_in,
};
event_put(&e);
} |
// -----------------------------------------------------------------------------
// Tests
// -----------------------------------------------------------------------------
void test_hrm_manager__initialize(void) {
// Init time
fake_rtc_init(100 /*initial_ticks*/, 1465243370);
stub_pebble_tasks_set_current(Pebb... |
h(r);
prv_process_events();
cl_assert_equal_b(false, s_kernel_receiver_is_receiving);
cl_assert_equal_b(true, s_kernel_receiver_finish_called);
}
void test_app_message_receiver__receive_push_but_inbox_not_opened_then_cleanup(void) {
Receiver *r = s_rcv_imp->prepare(s_session, &s_app_message_endpoint,
... | (true, s_kernel_receiver_finish_called) | ;
// Only Ack is received:
cl_assert_equal_i(s_app_message_pp_received_length, sizeof(AppMessageAck));
prv_destroy_inbox();
}
// Covers race as described here: PBL-41464
// 1. A part of a big app message is being received, causing it to get received in chunks.
// It's not received completely yet.
// 2. app_m... |
ffer, GColorWhite));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &outside_y_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(framebuffer_is_empty("outside_y_offset_layer", ctx.parent_framebuffer, GColorWhite));
test_graphics_context_reset(&ctx, fb);
layer_set_upda... | GPoint(p.x + 0, p.y + 3) | );
graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 3));
graphics_draw_pixel(ctx, GPoint(p.x + 2, p.y + 3));
graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 3));
graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y + 3));
graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y + 3));
graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y ... |
s == AS7000AppId_Idle;
}
return running_apps & app;
}
//! Set the applications that should be running on the HRM.
//!
//! This commands the HRM to start or continue running any apps whose
//! flags are set, and to stop all apps whose flags are unset. Depending
//! on the firmware loaded onto the HRM, multiple apps... | PBL_LOG(LOG_LEVEL_ERROR, "Watchdog logic detected frozen sensor. Resetting now.") | ;
analytics_inc(ANALYTICS_DEVICE_METRIC_HRM_WATCHDOG_TIMEOUT, AnalyticsClient_System);
prv_disable(dev);
psleep(SHUT_DOWN_DELAY_MS);
prv_enable(dev);
}
exit:
mutex_unlock(dev->state->lock);
}
// This regular timer callback executes once a second. It is part of the watchdog logic used to
// detect i... |
n"
"try {f2();} catch(e) {e2 = e;}\n"
"try {f3();} catch(e) {e3 = e;}\n";
EXECUTE_SCRIPT(script);
jerry_value_t e1 = prv_js_global_get_value("e1");
jerry_value_t e2 = prv_js_global_get_value("e2");
jerry_value_t e3 = prv_js_global_get_value("e3");
// error
s_log_internal__expected = (const char *[... | jerry_value_is_object(json_builtin) | );
jerry_release_value(json_builtin);
jerry_value_t not_builtin = jerry_get_global_builtin((const jerry_char_t *)"_not_builtin_");
cl_assert(jerry_value_is_undefined(not_builtin));
}
void test_js__get_global_builtin_compare(void) {
jerry_value_t date_builtin = jerry_get_global_builtin((const jerry_char_t *)"D... |
/*
* 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_test_get_miss(3) | ;
prv_push(2);
prv_test_get_hit(0, 0);
prv_test_get_hit(1, 1);
prv_test_get_hit(2, 2);
prv_test_get_miss(3);
prv_push(3);
prv_test_get_miss(0);
prv_test_get_hit(1, 1);
prv_test_get_hit(2, 2);
prv_test_get_hit(3, 0);
prv_push(2);
prv_test_get_miss(0);
prv_test_get_miss(1);
prv_test_get_hit... |
ndow *active_window) {
ActionBarLayer *action_bar = &active_window->action_bar;
bool is_paused = false;
bool can_stop = false;
if (active_window->workout_controller) {
is_paused = active_window->workout_controller->is_paused();
can_stop = active_window->workout_controller->stop != NULL;
}
if (is_pa... | (ctx, active_window->hr_measuring_icon, &bounds, render, size_out) | ;
}
static void prv_render_separator(GContext *ctx, Layer *layer) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_horizontal_line_dotted(ctx, GPoint(0, layer->bounds.size.h - 1),
layer->bounds.size.w);
}
static void prv_render_bg_color(GContext *ctx, GRe... |
P_XY GRect(6, 6, RECT_WIDTH, RECT_HEIGHT)
#define ORIGIN_DRAW_RECT_CLIP_NXNY GRect(-16, -16, RECT_WIDTH, RECT_HEIGHT)
void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_aa_sw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// TODO: Fix offset calculation and reenable this: - PBL-16509
#i... | 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_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 4);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_REC... |
// AA = true, SW = 11
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT);
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_BITS == 8
cl_check(gbitmap_pbi_eq(&ctx.dest_bi... |
/*
* 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... | (BMI160_SPI, sg_info, ARRAY_LENGTH(sg_info)) | ;
return value;
}
void bmi160_write_reg(uint8_t reg, uint8_t value) {
reg &= BMI160_REG_MASK;
SPIScatterGather sg_info[2] = {
{.sg_len = 1, .sg_out = ®, .sg_in = NULL}, // address
{.sg_len = 1, .sg_out = &value, .sg_in = NULL} // register write
};
spi_slave_burst_read_write_scatter(BMI160_SPI, sg_... |
/*
* 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... | itoa_int(i, response, 10) | ;
strcat(response, " - ");
strcat(response, s_runlevel_debug_names[i]);
prompt_send_response(response);
}
}
void command_set_runlevel(char *arg) {
if (strcmp(arg, "list") == 0) {
prv_list_runlevels();
return;
}
int runlevel = atoi(arg);
if (runlevel < 0 || runlevel >= RunLevel_COUNT) {
... |
/*
* 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(expected) | |
em,
void *context) {
AlarmDetailData *data = (AlarmDetailData *) context;
alarm_delete(data->alarm_id);
if (data->alarm_editor_callback) {
data->alarm_editor_callback(DELETED, data->alarm_id, data->callback_context);
}
}
static ActionMenuLevel *prv_create_main_menu(void... | i18n_noop("1 hour") | |
/*
* 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 (; *str && s_message_length < MAX_MESSAGE; ++str) {
if (*str == '\n') {
dbgserial_newline();
} else if (*str != '\r') {
s_message_buffer[s_message_length++] = *str;
}
}
} | |
RCC_APB1Periph_I2C2
| RCC_APB1Periph_I2C3 | RCC_APB1Periph_CAN1 | RCC_APB1Periph_CAN2
| RCC_APB1Periph_PWR | RCC_APB1Periph_DAC | RCC_APB1Periph_UART7
| RCC_APB1Periph_UART8;
const uint32_t apb2_periphs =
RCC_APB2Periph_TIM1 | RCC_APB2Periph_TIM8 | RCC_APB2Periph_USART1 |
RCC_APB2Periph_USART6 | ... | boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED) | ) {
dbgserial_putstr("Software failure caused a reset");
}
// Clean up after the last failure.
boot_bit_clear(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED);
// We have a "three strikes" algorithm: if the watch fails three times, return true
// to tell the parent we should load the recovery firmware. A reset for a... |
s->filter, this->rcc_apb_periph);
periph_config_release_lock();
}
static void prv_disable_clocks(MicDevice *this) {
// Disable DFSDM clock
periph_config_acquire_lock();
periph_config_disable(this->filter, this->rcc_apb_periph);
periph_config_release_lock();
}
//! Configure GPIOs for DFSDM use
static void pr... | (this->channel, ENABLE) | ;
// Wait for microphone to power up
psleep(this->power_on_delay_ms);
// Configure DFSDM to use DMA and start the filter + DMA
DFSDM_DMATransferConfig(this->filter, DFSDM_DMAConversionMode_Regular, ENABLE);
DFSDM_FilterCmd(this->filter, ENABLE);
DFSDM_RegularContinuousModeCmd(this->filter, ENABLE);
DFSD... |
s_num_captured_activity_sessions--;
}
cl_assert(entry_idx < MAX_CAPTURED_SESSIONS);
s_captured_activity_sessions[entry_idx] = (KAlgTestActivitySession) {
.activity = activity_type,
.len_minutes = len_sec / SECONDS_PER_MINUTE,
.start_utc = start_utc,
.ongoing = ongoing,
.steps = steps,
.a... | qsort(&test_entry[0], num_tests, sizeof(test_entry[0]), prv_qsort_step_test_entry_cb) | ;
// ------------------------------------------------------------------------------------------
// Print summery of results
printf("\n\n");
printf("\n%-40s %-10s %-10s %-10s %-10s %-10s %-10s %-10s %-10s",
"name",
"exp_steps",
"act_steps",
"error",
"min",
"... |
/*
* 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_LOG_LEVEL_INFO, "Vertical lines") | ;
start = GPoint(bounds.size.w / 2, bounds.origin.y);
end = GPoint(bounds.size.w / 2, bounds.size.h);
break;
case LineDirection_Diagonal:
APP_LOG(APP_LOG_LEVEL_INFO, "Diagonal lines");
start = bounds.origin;
end = GPoint(bounds.size.w, bounds.size.h);
break;
}
__profil... |
t8_t discovery_gen) { return 0;}
void gatt_client_service_get_all_characteristics_and_descriptors(
GAPLEConnection *connection, GATTService *service,
BLECharacteristic *characteristic_hdls_out,
BLEDescriptor *descriptor_hdls_out) { }
void launcher_task_add_callback(void (*callback)(void *data), void *data... | cl_assert_equal_b(handled, false) | ;
}
void test_gatt_service_changed_client__handle_indication_service_changed(void) {
fake_gatt_put_discovery_indication_gatt_profile_service(TEST_GATT_CONNECTION_ID,
true /* has_service_changed_characteristic */);
const uint16_t att_handle = fake_gatt_gatt_profi... |
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/string.h"
#include "clar.h"
#include "stubs_logging.h"
#include "stubs_passert.h"
#include <string.h>
v... | memcmp(&result_buf[0], expected_result_fwd, strlen(expected_result_fwd) - 2) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
cb(cell_index->row, simple_menu->callback_context);
} |
}
void simple_menu_layer_init(SimpleMenuLayer *simple_menu, const GRect *frame, Window *window,
const SimpleMenuSection *sections, int num_sections,
void *callback_context) {
if (process_manager_compiled_with_legacy2_sdk()) {
menu_layer_legacy2_init(&simp... |
func = NULL;
bad_func();
}
}
// -----------------------------------------------------------------------------------------------
void handle_accel(AccelRawData *accel_data, uint32_t num_samples, uint64_t timestamp) {
// Display data
//for (uint32_t i=0; i<num_samples; i++) {
// APP_LOG(APP_LOG_LEVEL_INFO,... | worker_event_loop() | ;
accel_data_service_unsubscribe();
health_service_events_unsubscribe();
}
|
-----------------------------------------------------------------------------------
bool shared_circular_buffer_read_consume(SharedCircularBuffer *buffer, SharedCircularBufferClient *client,
uint16_t length, uint8_t *data, uint16_t *length_out) {
uint16_t data_length = prv_get_data_length(b... | (buffer, &client->buffer_client,
item_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... | (&s_device) | ;
cl_assert(s_connection);
s_connection->gatt_connection_id = s_connection_id;
}
void test_gatt_service_changed_server__cleanup(void) {
if (s_connection) {
gap_le_connection_remove(&s_device);
s_connection = NULL;
}
gap_le_connection_deinit();
stub_new_timer_cleanup();
}
void test_gatt_service_cha... |
.res_key = FONT_KEY_GOTHIC_24_BOLD},
{.js_name = "28px Gothic", .res_key = FONT_KEY_GOTHIC_28},
{.js_name = "28px bold Gothic", .res_key = FONT_KEY_GOTHIC_28_BOLD},
{.js_name = "30px bolder Bitham", .res_key = FONT_KEY_BITHAM_30_BLACK},
{.js_name = "42px bold Bitham", .res_key = FONT_KEY_BITHAM_42_BOLD},
{.js... | if (s_rocky_text_state.text_attributes) {
graphics_text_attributes_destroy(s_rocky_text_state.text_attributes);
s_rocky_text_state.text_attributes = NULL;
} | |
uint8_t *)&write, i, sizeof(write));
}
flash_read_bytes((uint8_t *)&read, i, sizeof(read));
if (read != write) {
PBL_LOG_SYNC(LOG_LEVEL_INFO, ">>>> Address 0x%lx failed to write: 0x%lx 0x%lx",
i, read, write);
success = false;
}
}
return success;
}
// Writes 0's to the first ... | GRect(4, 44, width, 60) | );
TextLayer *text_layer = stress_data.text_layer;
text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
text_layer_set_background_color(text_layer, GColorClear);
layer_add_child(layer, text_layer_get_layer(text_layer));
text_layer_set_text(stress_data.text_layer, "Starting Stress ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (noreturn) | ) void handle_passert_failed_vargs(const char* filename, int line_number,
uintptr_t lr, const char* expr, const char* fmt, va_list fmt_args) {
dbgserial_print("ASSERT: ");
dbgserial_print(expr);
dbgserial_print(" ");
dbgserial_print(filename);
dbgserial_print(":");
dbgserial_print_hex(line_number);
i... |
0x31)
#define RUN_STATE_KEY (1)
#define STATE_FETCH_KEY (2)
#define INVALID_KEY (0xffffffff)
#define RUNNING (1)
#define NOT_RUNNING (0)
#define TRANSACTION_ID (0xA5)
#define assert_ack(ack) \
fake_comm_session_process_send_next(); \
const AppMessageAck ack_message = {... | (s_transport) | ;
}
void test_launcher_app_message__send_app_state(void) {
Uuid uuid = {APP_UUID_RAW};
bool running = true;
launcher_app_message_send_app_state_deprecated(&uuid, running);
// Even though the Launcher App Message documentation states that the value is a uint8_t,
// the original implementation used uint32_t f... |
const char *)va_arg(args, const char *);
int str_len = ((index + 1) == str_index_1) ? str1_len : str2_len;
str_param->length = str_len;
// TODO remove NULL termination
memcpy(str_param->string, str, str_len - 1);
str_param->string[str_len - 1] = '\0';
param += (str_len + 1 + 3) / s... | ((HcProtocolMessage *)&OVERRUN.hc_header) | |
t(&BOARD_CONFIG_DISPLAY.cs, false);
// hold time > 1us
// this produces a delay of ~3.5us
for (volatile int i = 0; i < 16; i++);
}
static void prv_display_start(void) {
periph_config_acquire_lock();
gpio_af_init(&BOARD_CONFIG_DISPLAY.clk, GPIO_OType_PP, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL);
gpio_af_init(&... | SPI_I2S_DMACmd(BOARD_CONFIG_DISPLAY.spi, SPI_I2S_DMAReq_Tx, ENABLE) | ;
prv_display_context_init(&s_display_context);
s_display_context.get_next_row = nrcb;
s_display_context.complete = uccb;
prv_do_dma_update();
// Block while we wait for the update to finish.
TickType_t ticks = milliseconds_to_ticks(4000); // DMA should be fast
if (xSemaphoreTake(s_dma_update_in_progre... |
r_and_update_mask(ctx, y1.integer, x, x, color,
(uint8_t)(FIXED_S16_3_ONE.raw_value - y1.fraction));
y1.integer++;
}
// middle pixels
while (y1.integer <= y2.integer) {
prv_update_mask(ctx, y1.integer, x, x, color);
y1.integer++;
}
// last pixel with blending ... | {
prv_blend_color_and_update_mask(ctx, y, x1.integer, x1.integer, color, (uint8_t)x2.fraction);
} | |
ontext;
}
handler(recognizer, context);
}
if (needs_reset) {
prv_click_reset(recognizer);
}
return true;
} else {
return false;
}
}
inline static bool prv_is_hold_to_repeat_enabled(ClickRecognizer *recognizer) {
return (recognizer->config.click.repeat_interval_ms >= 30);
... | prv_dispatch_event(recognizer, ClickHandlerOffsetLong, needs_reset) | ;
}
//! Called at the end of a click pattern, either on the button up, or after a multi-click timeout:
static void prv_click_pattern_done(ClickRecognizer *recognizer) {
// In case multi_click is also configured, if there was only one click, regard it as
// a "single click" after the multi-click timeout passed and ... |
/*
* 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... | crc32(CRC32_INIT, (const uint8_t *)FIRMWARE_BASE,
firmware_description->firmware_length) | ;
dbgserial_print("Checksum - wanted ");
dbgserial_print_hex(firmware_description->checksum);
dbgserial_print(" got ");
dbgserial_print_hex(crc);
dbgserial_newline();
return crc == firmware_description->checksum;
}
typedef enum UpdateFirmwareResult {
UPDATE_FW_SUCCESS = 0,
UPDATE_FW_ERROR_MICRO_FLASH... |
/*
* 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_discover_ams(1);
cl_assert_equal_b(ams_can_handle_characteristic(s_unknown_characteristic), false);
} |
void test_ams__discover_of_ams_should_subscribe_to_entity_update_characteristic(void) {
// Pass in 2 instances, it should be able to cope with this
prv_discover_ams(2 /* num_instances */);
// Assert ams.c can now handle the characteristic reference for the first instance:
prv_assert_can_handle_characteristic... |
INLINE activity_insights_process_sleep_data(time_t now_utc) {
// Check sleep insights
if (activity_prefs_sleep_insights_are_enabled()) {
prv_do_sleep_reward(now_utc);
}
prv_do_sleep_summary(now_utc);
}
// ------------------------------------------------------------------------------------------------
// C... | attribute_list_add_cstring(&response_action_attr_list, AttributeIdTitle,
i18n_get(config->response.title, ¬if_attr_list)) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | graphics_context_set_fill_color(ctx, GColorBlack) | ;
graphics_fill_rect(ctx, &GRect(0, time_max_y + line_top_margin, DISP_COLS, line_stroke_width));
#endif
}
static void prv_update_time(SdkAppData *data) {
#if CAPABILITY_HAS_SDK_SHELL4
clock_copy_time_string(data->time_buffer, sizeof(data->time_buffer));
text_layer_set_text(&data->time_text_layer, data->time_buf... |
this shifts it down and to the right, but it works for us.
pointP.x.fraction += FIXED_S16_3_HALF.raw_value;
pointP.y.fraction += FIXED_S16_3_HALF.raw_value;
return pointP;
}
static GPoint prv_get_point_between_points(GPoint p1, GPoint p2, HealthProgressBarValue val) {
int x = p1.x + ((p2.x - p1.x) * val / HEA... | while (value_to_mark > segment->amount_of_total) {
value_to_mark -= segment->amount_of_total;
segment++;
} |
if (prv_is_segment_corner(segment)) {
segment++;
}
const int from = prv_total_offset_to_segment_offset(segment, value_to_mark);
// Fill backwards if we can, otherwise forwards
const int dir = value_to_mark - segment->mark_width < 0 ? 1 : -1;
const int to_total = value_to_mark + (dir * segment->mark_... |
ces/normal/accessory/smartstrap_comms.h"
#include "services/normal/accessory/smartstrap_link_control.h"
#include "services/normal/accessory/smartstrap_state.h"
#include "syscall/syscall.h"
#include "syscall/syscall_internal.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/attributes.h"
#include... | {
mbuf_free(s_reserved_read_mbuf);
s_reserved_read_mbuf = NULL;
} |
PBL_LOG(LOG_LEVEL_DEBUG, "Sent service discovery message (result=%d)", result);
}
static void prv_set_connected(bool connected) {
s_has_done_service_discovery = false;
}
static bool prv_handle_management_attribute_read(bool success, ManagementServiceAttribute attr,
... |
ty(bus->hal->er_irq_channel, I2C_IRQ_PRIORITY);
NVIC_EnableIRQ(bus->hal->ev_irq_channel);
NVIC_EnableIRQ(bus->hal->er_irq_channel);
I2C_DeInit(bus->hal->i2c);
}
static uint32_t prv_get_apb1_frequency(void) {
RCC_ClocksTypeDef rcc_clocks;
RCC_GetClocksFreq(&rcc_clocks);
return rcc_clocks.PCLK1_Frequency;
}
... | {
prv_disable_all_interrupts(bus);
// Generate stop condition
bus->hal->i2c->CR1 |= I2C_CR1_STOP;
bus->state->transfer.state = I2CTransferState_Complete;
I2CTransferEvent event = result ? I2CTransferEvent_TransferComplete : I2CTransferEvent_Error;
return i2c_handle_transfer_event(bus, event);
} |
//! Pause a transfer, disabling interrupts during the pause
//! Only call from interrupt functions
static portBASE_TYPE prv_pause_transfer_irq(I2CBus *bus) {
prv_disable_all_interrupts(bus);
return i2c_handle_transfer_event(bus, I2CTransferEvent_NackReceived);
}
//! Handle an IRQ event on the specified \a 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... | __profiler_start() | ;
for (int i = 0; i < ITERATIONS; ++i) {
graphics_draw_text(ctx, TEXT, fonts_get_system_font(FONT_KEY_GOTHIC_14),
bounds, GTextOverflowModeWordWrap, GTextAlignmentLeft,
NULL);
}
__profiler_stop();
APP_LOG(APP_LOG_LEVEL_INFO, "Draw Text");
__profiler_print_stat... |
.quality);
// Perform a basic validity check so we only proceed with reasonable data
// TODO: Use quality to filter out some readings,
// TODO PBL-40784: Use HRMQuality_OffWrist as a special case to slow down the HRM subscription
bool valid_hr_reading = true;
if (hrm_event->bpm.bpm < ACTIVITY_DEFAU... | kernel_free(file) | |
layer_add_child(&parent, &child_c);
cl_assert(child_c.parent == &parent);
cl_assert(child_b.next_sibling == &child_c);
layer_add_child(&child_a, &grand_child_a);
cl_assert(grand_child_a.parent == &child_a);
// Remove non-first-child (child_b):
//
// +-parent
// |
// '->child_a->child_c
//... | layer_create(GRectZero) | ;
Layer *aaaa = layer_create(GRectZero);
Layer *ab = layer_create(GRectZero);
Layer *b = layer_create(GRectZero);
layer_add_child(a, aa);
layer_add_child(aa, aaa);
layer_add_child(aaa, aaaa);
layer_add_child(a, ab);
a->next_sibling = b;
stack[0] = a;
// go to child if possible
Layer *actual = _... |
GPathInfo MINUTE_PATH_INFO = {
.num_points = 5,
.points = (GPoint[]) {
{-5, 10}, {5, 10}, {5, -61}, {0, -66}, {-5, -61},
},
};
void watch_model_handle_change(ClockModel *model) {
MultiWatchData *data = app_state_get_user_data();
data->clock_model = *model;
layer_mark_dirty(window_get_root_layer(&data->... | (ctx, &face->hour_hand, center, data->hour_path) | ;
prv_draw_watch_hand(ctx, &face->minute_hand, center, data->minute_path);
// Draw bob.
GRect bob_rect = (GRect) {
.size = GSize(face->bob_radius * 2, face->bob_radius * 2)
};
GRect bob_center_rect = (GRect) {
.size = GSize(face->bob_center_radius * 2, face->bob_center_radius * 2)
};
grect_al... |
ert_equal_i(pin_db_flush(), 0);
cl_assert(timeline_add(&item));
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
cl_assert_equal_i(timeline_init(&head), S_SUCCESS);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture,
143023680... | (uuid_equal(&state.pin.header.id, &all_day_item.header.id)) | ;
cl_assert(uuid_equal(&state.node->id, &all_day_item.header.id));
cl_assert(!state.node->all_day);
cl_assert_equal_i(state.node->timestamp, midnight_march_3_utc);
cl_assert_equal_i(state.node->duration, 0);
cl_assert_equal_i(state.current_day, midnight_march_2_pst);
// no more
cl_assert(!iter_next(&iter... |
{
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number
test_reel_data->duration_ms = 300;
Animation *animation = (Animation *)kino_player_create_play_animation(test_player);
cl_assert_equal_i(animation_is_scheduled(animation), false);
ani... |
void test_kino_player__finite_animation_infinite_reel_forward(void) {
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number
test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE;
kino_player_play(test_player);
animation_set_elapsed(tes... | |
0x0474)
#define RAM_ADDR_LIFTOFF_RETRIES (0x04D3)
// magic number for enabling palm detection + reporting
#define RAM_VALUE_ENABLE_PALM_DETECTION (0x02BC)
// If we don't service an interrupt, the controller will retry every 10ms. We never want to lose a
// touch event, so we set the number of retries to a very high v... | if (type == StatusReadType_12bit) {
// The 3 data bytes are ST PQ R1 (in hex) with ST being the address and RPQ being the value.
PBL_ASSERTN(response.data[0] == address);
PBL_ASSERTN((response.data[2] & 0x0F) == PACKET_FOOTER);
*(uint16_t *)result = response.data[1] | ((uint16_t)(response.data[2] & 0xF0... |
}
#endif
// Memory Operations
////////////////////////////////////////////////////////////////////////////////
#if 0
// TODO: we might want to use these this to verify configuration settings
static uint16_t prv_read_ram(uint16_t address) {
address = htons(address);
MemoryPacket packet = {
.packet_id = PACKE... |
/*
* 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... | otp_get_slot(index) | ;
strcpy(slot, value);
// Lock the OTP sector
uint8_t *lock = otp_get_lock(index);
*lock = 0;
return OtpWriteSuccess;
}
|
// Write Page Header + DataLen
if (do_copy) {
pfs_write(fd, &hdr, sizeof(hdr));
pfs_write(fd, &data_len, sizeof(data_len));
} else { // recover
pfs_read(fd, &hdr, sizeof(hdr));
pfs_read(fd, &data_len, sizeof(data_len));
prv_flash_write(&hdr, sizeof(hdr), base_addr);
}
ba... | pfs_open_gc_file(0, false) | ) >= S_SUCCESS) {
// we rebooted while we were in the middle of a garbage collection
PBL_LOG(LOG_LEVEL_INFO, "Recovering flash region from GC file");
recover_region_from_file(fd);
}
// find a free region
if (!prv_update_gc_reserved_region()) {
PBL_LOG(LOG_LEVEL_ERROR, "No free flash erase units!"... |
poll_timer, remaining_ms, prv_flash_erase_timer_cb, NULL, 0);
}
}
static void prv_blocking_erase_complete(void *context, status_t status) {
PBL_ASSERT(PASSED(status), "Flash erase failure: %" PRId32, status);
}
static void prv_flash_erase_blocking(uint32_t sector_addr, bool is_subsector) {
uint32_t total_time_s... | {
// the S29VS flash automatically enters and exits standby
} |
bool flash_get_sleep_when_idle(void) {
return false;
}
bool flash_is_initialized(void) {
return (s_flash_lock != NULL);
}
void flash_stop(void) {
if (!flash_is_initialized()) {
// Not yet initialized, nothing to do.
return;
}
mutex_lock(s_flash_lock);
if (s_erase.in_progress) {
new_timer_st... |
tted(&ctx, GPoint(16, 0), 21);
graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22);
graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_NUM_ROWS - 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS + 1 );
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE... | GPoint(97, 37) | , 10);
// T facing left - lined up
graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 70), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 76), 5);
// T facing right - even vert, odd horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 70), 10);
graphics_draw_horizontal_line_dotted(&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... | window_set_click_context(BUTTON_ID_SELECT, context) | ;
}
static void prv_window_appear(Window *window) {
KinoLayerDemoData *data = window_get_user_data(window);
kino_layer_play(&data->kino_layer);
}
static void prv_window_load(Window *window) {
KinoLayerDemoData *data = window_get_user_data(window);
Layer *root = window_get_root_layer(window);
// init the kin... |
ndif
[TextStyleFont_TimeHeaderWords] = FONT_KEY_GOTHIC_14_BOLD,
[TextStyleFont_PinSubtitle] = FONT_KEY_GOTHIC_18,
[TextStyleFont_ParagraphHeader] = FONT_KEY_GOTHIC_14,
},
},
[PreferredContentSizeLarge] = {
.fonts = {
[TextStyleFont_Header] = FONT_KEY_GOTHIC_24_BOLD,
#if !RECOVERY_FW
... | (system_theme_get_font_key(font)) | |
er, cell_index,
menu_layer->callback_context);
menu_layer->selection.index = prev_selection_index;
return result;
} else {
return menu_cell_basic_cell_height(); // default
}
}
static inline void prv_menu_layer_draw_separator(MenuLayer *... | prv_prepare_and_draw_row(ctx, menu_layer, cell_layer, cursor, fully_covered) | |
(BUTTON_ID_DOWN, 100, down_handler);
}
static void draw_ui_element(GContext *ctx, GRect bounds, const char *text,
bool chosen, bool selected) {
GFont font = fonts_get_system_font(chosen || selected?
FONT_KEY_GOTHIC_14_BOLD
... | task_zalloc(sizeof(AppData)) | ;
if (!data) {
return;
}
s_window = window_create();
window_set_user_data(s_window, data);
window_set_fullscreen(s_window, true);
window_set_window_handlers(s_window, &(WindowHandlers) {
.load = main_window_load,
.unload = main_window_unload,
});
window_set_click_config_provider(s_window, ... |
ER_SIZE; i++) {
content_indicator_deinit(&content_indicator);
bytes_written -= sizeof(ContentIndicator *);
cl_assert_equal_i(buffer->bytes_written, bytes_written);
}
}
void test_content_indicator__configuring_should_configure(void) {
ContentIndicator content_indicator;
content_indicator_init(&content... | (
&scroll_layer) | ;
cl_assert(content_indicator2);
// Should save a reference to the scroll layer
cl_assert_equal_p(content_indicator2->scroll_layer, &scroll_layer);
cl_assert_equal_p(content_indicator2, content_indicator);
// Should retrieve a different content indicator for a different scroll layer
ScrollLayer scroll_laye... |
{ 1048, 168, -392},
{ 880, 96, -192},
{ 840, 24, -96},
{ 1072, 56, -112},
{ 1304, 176, -200},
{ 1256, 304, -248},
{ 1256, 384, -80},
{ 1512, 600, -72},
{ 1216, 616, -88},
// 5 seconds
{ 1056, 352, -88},
{ 1088, 512, -136},
{ 1024, 456, -72},
{ 1104, 376, 16},
{... | { 960, 408, -48},
{ 1024, 344, 0},
{ 1232, 408, 48},
{ 1576, 376, 56},
{ 1400, 216, 112},
{ 1448, 16, 176},
{ 1472, -56, 80},
{ 1392, -16, 16},
{ 1168, 32, 0},
{ 856, 64, -64},
{ 880, -200, 48},
{ 576, -200, 0},
{ 736, -112, -24},
{ 1272, -56, 88},
{ 1248, 152... | |
uffer *)found_node;
return (esb->ptr == data);
}
static EventServiceBuffer* prv_get_esb_for_event(PebbleEvent *e) {
void **buf_ptr = event_get_buffer(e);
EventServiceBuffer *esb = NULL;
if (buf_ptr && *buf_ptr) {
esb = (EventServiceBuffer *)list_find((ListNode *)s_event_service_buffers,
... | ((ListNode *)esb, (ListNode **)&s_event_service_buffers, NULL) | ;
kernel_free(esb);
event_deinit(e);
}
}
}
|
it(void) {
// Make sure the files we have are valid
for (unsigned int i = 0; i < g_num_file_resource_stores; ++i) {
// The only way we can check this file is valid is by making sure each resource in each file
// is valid.
// Get the length of the file to see if we're checking a large file
const cha... | (prv_app_file_open(entry, op_flags), num_bytes, entry_offset) | ;
}
static uint32_t resource_storage_app_file_read(ResourceStoreEntry *entry, uint32_t offset,
void *data, size_t num_bytes) {
const uint8_t op_flags = OP_FLAG_READ | OP_FLAG_SKIP_HDR_CRC_CHECK | OP_FLAG_USE_PAGE_CACHE;
return prv_file_common_read(prv_app_file_open(en... |
440, -880},
{ -280, 432, -872},
{ -272, 432, -880},
{ -272, 432, -888},
{ -272, 440, -880},
{ -272, 432, -880},
{ -264, 464, -920},
{ -272, 432, -896},
{ -288, 416, -880},
{ -288, 384, -888},
{ -280, 368, -888},
{ -280, 376, -880},
{ -280, 384, -904},
{ -288, 400, -8... | { -296, 384, -896},
{ -288, 400, -904},
{ -288, 384, -904},
{ -288, 376, -904},
{ -288, 384, -888},
{ -288, 368, -904},
{ -296, 384, -904},
{ -296, 400, -896},
{ -296, 392, -904},
{ -296, 376, -904},
{ -288, 368, -896},
{ -304, 384, -896},
{ -296, 392, -896},
// 1... |
{ -288, 360, -920},
{ -280, 360, -912},
{ -280, 368, -904},
{ -272, 376, -904},
{ -272, 384, -912},
{ -280, 384, -936},
{ -272, 352, -904},
{ -272, 360, -912},
{ -272, 368, -912},
{ -272, 376, -920},
{ -272, 368, -920},
{ -280, 360, -912},
{ -272, 368, -912},
{ -... |
th_card_view->card_layers[health_card_view->current_card_index], false);
layer_set_hidden(&health_card_view->select_indicator_layer, true);
prv_hide_content_indicators(health_card_view);
}
static void prv_bg_animation_stopped_handler(Animation *animation, bool finished, void *context) {
HealthCardView *health_... | (health_card_view) | ;
}
// Click config provider
static void prv_click_config_provider(void *context) {
window_set_click_context(BUTTON_ID_UP, context);
window_set_click_context(BUTTON_ID_SELECT, context);
window_set_click_context(BUTTON_ID_DOWN, context);
window_single_click_subscribe(BUTTON_ID_UP, prv_up_down_click_handler);
... |
/*
* 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, GColorClear) | ;
graphics_fill_round_rect(ctx, &GRect(2, 2, 28, 20), 4, GCornersAll);
}
void corners_clipped_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(-19, 0, 20, 20), 4, GCornersAll);
}
vo... |
HEX_RECORD_LENGTH(MAX_HEX_DATA_BYTES) <= 256,
"The value of MAX_HEX_DATA_BYTES will result in HEX records "
"which are longer than the AS7000 loader can handle.");
// The sw_version_major field is actually a bitfield encoding both the
// major and minor components of the SDK version numb... | ntohs(ppg_reading.tia) | ;
success = true;
break;
}
PPG_DBG_VERBOSE("FAIL: got %"PRIu16" expected %u tia %"PRIu16,
ppg_reading.idx, i + 1, ntohs(ppg_reading.tia));
// Keep trying...
}
if (!success) {
// We didn't find a sample, just give up on reading PPG for this handsha... |
-96},
{ -672, 384, -128},
{ -592, 400, -144},
{ -616, 432, -168},
{ -856, 480, -216},
{ -944, 472, -184},
{ -1136, 472, -160},
// 36 seconds
{ -1144, 584, -216},
{ -1032, 544, -144},
{ -760, 544, -168},
{ -840, 576, -264},
{ -792, 408, -32},
{ -704, 320, 8},
{ -5... | { -736, 336, 72},
{ -728, 336, 72},
{ -888, 352, 88},
{ -992, 336, 72},
{ -832, 360, 8},
{ -1032, 336, -72},
{ -1064, 416, -112},
{ -920, 336, -168},
{ -904, 448, -240},
{ -784, 496, -296},
{ -552, 344, -248},
{ -480, 304, -200},
{ -488, 320, -200},
{ -568, 296, -... |
{ -1304, 480, -144},
{ -1208, 552, -392},
{ -976, 496, -336},
{ -872, 352, -248},
{ -736, 272, -208},
// 44 seconds
{ -544, 272, -160},
{ -424, 272, -168},
{ -424, 224, -120},
{ -496, 264, -72},
{ -592, 272, -24},
{ -656, 336, -40},
{ -648, 360, -64},
{ -736, 448... |
le LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* di... | {
ClickAppData *data = window_get_user_data(window);
sniprintf(data->text_buffer, TEXT_BUFFER_SIZE, "Long Click Released!");
PBL_LOG(LOG_LEVEL_DEBUG, "Long Click Released!");
text_layer_set_text(&data->text, data->text_buffer);
toggle_color(window);
(void)recognizer;
} | |
fs_get_size()));
// delete every page and make sure pfs is active
for (int i = 0; i < num_pages(); i++) {
snprintf(file_name, sizeof(file_name), "file%d", i);
cl_assert(pfs_remove(file_name) == S_SUCCESS);
}
cl_assert(pfs_active_in_region(0, pfs_get_size()));
// continuation page on region and make ... | (file_small, OP_FLAG_READ, FILE_TYPE_STATIC, 0) | ;
cl_assert(fd >= 0);
cl_assert_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_... |
nt/app_manager.h"
#include "process_management/process_manager.h"
#include "process_state/app_state/app_state.h"
#include "system/logging.h"
#include "system/passert.h"
#include "system/profiler.h"
#include "util/size.h"
// The number of pixels for a given row which get set to black to round the corner. These numbers
... | {
if (row_index >= num_rows) {
return 0;
}
if (row_index < (int)ARRAY_LENGTH(s_rounded_corner_width)) {
return s_rounded_corner_width[row_index];
} else if (num_rows - row_index - 1 < (int)ARRAY_LENGTH(s_rounded_corner_width)) {
return s_rounded_corner_width[num_rows - row_index - 1];
}
return 0... | |
NG)) {
data->test_case_status = FLASH_TEST_STATUS_STOPPED;
stop_flash_test_case();
update_test_case_status(data);
}
}
static void run_test(void* context) {
struct FlashTestData *data = app_state_get_user_data();
FlashTestErrorType status = FLASH_TEST_SUCCESS;
// Execute test - pass in 0 by default... | ("Flash Test") | );
window_set_user_data(&data_ptr->window, data_ptr);
window_set_window_handlers(&data_ptr->window, &(WindowHandlers){
.load = flash_test_window_load,
});
const bool animated = true;
app_window_stack_push(&data_ptr->window, animated);
tick_timer_service_subscribe(SECOND_UNIT, handle_timer);
}
stati... |
elper(slave);
}
void spi_slave_set_frequency(const SPISlavePort *slave, uint32_t frequency_hz) {
slave->spi_bus->state->spi_clock_speed_hz = frequency_hz;
prv_spi_slave_init(slave);
}
void spi_slave_wait_until_idle_blocking(const SPISlavePort *slave) {
while (prv_spi_get_flag_status(slave->spi_bus, SpiI2sFlag_B... | PBL_ASSERTN(slave->slave_state->initialized) | ;
PBL_ASSERTN(slave->slave_state->acquired);
const uint8_t *outp = out;
uint8_t *inp = in;
for (size_t n = 0; n < len; ++n) {
uint8_t byte_out = outp ? *(outp++) : 0;
uint8_t byte_in = spi_ll_slave_read_write(slave, byte_out);
if (inp) {
*(inp++) = byte_in;
}
}
}
void spi_ll_slave_burst... |
nt8_t age_years;
ActivityGender gender;
uint16_t weight_dag;
uint16_t height_mm;
} HumanPrefs;
#define ACTIVITY_DEFAULT_HEIGHT_MM 1620 // 5'3.8"
// dag - decagram (10 g)
#define ACTIVITY_DEFAULT_WEIGHT_DAG 7539 // 166.2 lbs
#define ACTIVITY_DEFAULT_GENDER Acti... | cl_assert_within(short_guy_distance, 36000, 44000) | |
/*
* 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... | pfs_format(true /* write erase headers */) | ;
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
false /* is_next */);
resource_init();
// Initialize peek
s_is_watchface_running = true;
timeline_peek_init();
}
void test_timeline_peek__cleanup(void) {
}
// Helpers
///////////////////... |
-----------------------------------
bool workout_service_is_workout_ongoing(void) {
prv_lock();
bool rv = (s_workout_data.current_workout != NULL);
prv_unlock();
return rv;
}
// ---------------------------------------------------------------------------------------
bool workout_service_takeover_activity_sessio... | {
if (workout_service_is_workout_ongoing()) {
*active = ROUND(s_workout_data.current_workout->active_calories, ACTIVITY_CALORIES_PER_KCAL);
}
} |
void workout_service_reset(void) {
if (s_workout_data.current_workout) {
kernel_free(s_workout_data.current_workout);
}
s_workout_data = (WorkoutServiceData) {};
}
#endif
|
e = ctx->node;
parent_node->cached_size = ctx->box.size;
if (parent_node->type == GTextNodeType_Horizontal &&
child_node->type == GTextNodeType_Vertical) {
prv_clip_width(&ctx->box.size, &child_node->cached_size);
} else if (parent_node->type == GTextNodeType_Vertical &&
child_node->type ==... | {
*ctx = (GTextNodeDrawContext) {
.config = config,
.gcontext = gcontext,
.node = node,
.draw_box = box,
.box = { gpoint_add(box->origin, node->offset), box->size },
.render = render,
.size_out = &node->cached_size,
};
} |
static bool prv_should_draw_text_node(GTextNode *node, GContext *ctx, const GRect *box,
bool render) {
if (!render && node->cached_size.h) {
return false;
}
if (render && node->cached_size.h) {
GRect global_box = grect_to_global_coordinates((GRect) { box->origin, no... |
nd_buffer_write(write_sb, fake_data, max_length);
comm_session_send_buffer_end_write(write_sb);
// Set a yield callback that gives the semph in time but does not clear out the send buffer:
SemaphoreHandle_t write_semph = comm_session_send_buffer_write_semaphore();
fake_queue_set_yield_callback(write_semph, prv... | comm_session_send_buffer_end_write(write_sb2) | ;
// write_sb is already cleaned up because it got sent out
prv_cleanup_send_buffer(write_sb2);
}
void test_session_send_buffer__writing_but_then_session_closed(void) {
s_valid_session = &s_session;
// Fill the send buffer completely:
const size_t max_length = comm_session_send_buffer_get_max_payload_lengt... |
/*
* 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, ResponseTimeMin) | |
(shared_prf_storage_get_writeback_timer()) | ;
}
// Tests
///////////////////////////////////////////////////////////
static SMPairingInfo s_pairing_info = (const SMPairingInfo) {
.local_encryption_info = {
.ediv = 123,
.div = 456,
},
.remote_encryption_info = {
.ltk = (const SMLongTermKey) {
.data = {
0x00, 0x11... | |
ansport *transport = (Transport *) TransportID1;
CommSession *session = comm_session_open(transport, &s_transport_imp,
TransportDestinationSystem);
cl_assert_equal_i(comm_session_get_type(session), CommSessionTypeSystem);
cl_assert_equal_p(comm_session_get_system_session... | comm_session_close(legacy_app_session, CommSessionCloseReason_UnderlyingDisconnection) | ;
comm_session_close(modern_app_session, CommSessionCloseReason_UnderlyingDisconnection);
}
void test_session__assert_if_deinit_and_transport_did_not_clean_up_properly(void) {
Transport *transport = (Transport *) TransportID1;
CommSession *session = comm_session_open(transport, &s_transport_imp,
... |
time_21_00_march_1_pst), S_SUCCESS);
const time_t midnight_march_3_pst = 1425369600;
// day 1
cl_assert(uuid_equal(&state.pin.header.id, &all_day_item.header.id));
cl_assert(uuid_equal(&state.node->id, &all_day_item.header.id));
cl_assert(state.node->all_day);
cl_assert_equal_i(state.node->timestamp, midn... | (&iterator) | |
quired by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#inclu... | (dest, 0, 5) | |
HealthServiceTimeScopeWeekly);
}
static void prv_update_daily_steps_avg(KickstartData *data) {
data->daily_steps_avg = health_service_sum_averaged(HealthMetricStepCount,
time_start_of_today(),
... | (&data->base_layer, prv_base_layer_update_proc) | ;
layer_add_child(window_layer, &data->base_layer);
// update steps and time
prv_update_steps_buffer(data);
// subscribe to health service
health_service_events_subscribe(prv_health_service_events_handler, data);
// subscribe to tick timer for minute ticks
tick_timer_service_subscribe(MINUTE_UNIT, 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... | crc32(crc, message, 10) | ;
message[10] = crc & 0xff;
message[11] = (crc >> 8) & 0xff;
message[12] = (crc >> 16) & 0xff;
message[13] = (crc >> 24) & 0xff;
assert_equal_hex(crc32(crc32(0, NULL, 0), message, 14), CRC32_RESIDUE);
}
void test_crc32__null_residue(void) {
uint8_t data[4] = {0, 0, 0, 0};
crc = crc32(crc, data, 4);
as... |
frame.size;
// when scrolling up, bounce back at the top (otherwise at the bottom)
if (!state.up) {
state.menu_layer->inverter.layer.frame.origin.y -= abs_content_offset;
}
}
layer_mark_dirty(&state.menu_layer->scroll_layer.layer);
}
void prv_center_focus_animation_update_in_and_out(Animation *a... | animation_set_duration(anim, duration) | ;
animation_set_curve(anim, AnimationCurveEaseInOut);
animation_schedule(anim);
if (was_animating) {
// create visual state that's already reflecting the beginning of the "out" animation
prv_center_focus_animation_update_out_only(anim, 0);
}
}
static void prv_apply_selection_change(MenuLayer *menu_lay... |
20, 264},
{ -32, 928, 264},
{ -40, 912, 248},
{ -40, 920, 264},
{ -40, 912, 272},
{ -40, 912, 264},
{ -40, 912, 256},
{ -40, 912, 256},
{ -40, 920, 256},
{ -40, 912, 256},
{ -40, 912, 248},
{ -32, 912, 256},
{ -40, 912, 256},
{ -40, 912, 248},
{ -40, 920, 256},
... | { -32, 920, 256},
{ -32, 912, 256},
// 136 seconds
{ -32, 920, 256},
{ -32, 912, 256},
{ -40, 920, 264},
{ -40, 920, 256},
{ -32, 912, 256},
{ -40, 912, 256},
{ -40, 920, 256},
{ -40, 912, 256},
{ -32, 920, 256},
{ -40, 920, 248},
{ -40, 912, 256},
{ -40, 912,... |
{ -40, 920, 240},
{ -40, 920, 248},
{ -48, 920, 240},
{ -40, 920, 240},
{ -40, 920, 240},
{ -40, 928, 240},
{ -40, 920, 240},
{ -40, 920, 240},
{ -40, 920, 232},
{ -40, 920, 240},
{ -40, 920, 232},
{ -48, 920, 232},
{ -40, 920, 232},
{ -40, 928, 232},
{ -32, ... |
4, 200, -256},
{ 896, 128, -144},
{ 968, 232, -168},
{ 1096, 272, -24},
{ 1176, 384, -16},
{ 1104, 432, -80},
{ 904, 416, -48},
{ 1344, 480, 80},
{ 1256, 568, 72},
{ 1392, 688, -48},
{ 1152, 768, -392},
{ 720, 464, -248},
{ 992, 528, -152},
{ 1536, 600, -88},
{ 15... | { 976, 48, -168},
{ 1024, 128, -16},
{ 944, 368, 0},
{ 832, 552, -88},
{ 1192, 664, -96},
// 32 seconds
{ 1488, 752, -96},
{ 968, 672, 64},
{ 1304, 440, -40},
{ 1104, 456, -40},
{ 872, 528, -112},
{ 1024, 552, -24},
{ 1288, 512, 56},
{ 1296, 368, 136},
{ 1248,... |
{ 1088, 720, -240},
{ 1352, 416, -184},
{ 1000, 536, -168},
{ 992, 552, -120},
{ 1352, 464, -56},
{ 1544, 320, -48},
{ 1504, 160, 48},
{ 1152, 72, 104},
{ 1072, 56, 8},
{ 1000, 152, 40},
{ 912, 272, -8},
{ 768, 256, 0},
{ 1080, 232, 40},
// 35 seconds
{ 1240,... |
ode *)current->node.next;
}
return current;
}
static TimelineNode *prv_find_first(TimelineNode *head, TimelineIterDirection direction,
time_t timestamp, time_t today_midnight, bool show_all_day_events) {
if (direction == TimelineIterDirectionPast) {
return prv_find_first_past(head, timestamp, today_midnigh... | prv_set_nodes_all_day(nodes, header, num_nodes) | |
f_size,
char payload_sender_type[PLOG_MAX_SENDER_TYPE_LEN],
char payload_sender_id[PLOG_MAX_SENDER_ID_LEN],
char payload_sender_version_patch[FW_METADATA_VERSION_TAG_BYTES],
uint32_t *payl... | (encoded_buf, encoded_buf_size) | ;
const uint32_t max_num_events = *num_events;
const uint32_t max_num_sessions = *num_sessions;
*num_events = 0;
*num_sessions = 0;
PLogEventsDecoderArg event_arg = {
.max_num_events = max_num_events,
.num_events = num_events,
.events = events,
.event_uuids = event_uuids,
.max_num_sessi... |
sic_ctx.mutex);
prv_put_now_playing_changed_event();
}
void music_update_player_name(const char *player_name, size_t player_name_length) {
// TODO: actually do something with this
off_t o = offsetof(__typeof__(s_music_ctx), player_name);
prv_update_string_and_put_event(player_name, player_name_length, o);
}
v... | {
PebbleEvent event = {
.type = PEBBLE_MEDIA_EVENT,
.media = {
.type = PebbleMediaEventTypePlaybackStateChanged,
.playback_state = playback_state,
},
};
event_put(&event);
} |
void music_update_player_playback_state(const MusicPlayerStateUpdate *state) {
mutex_lock_recursive(s_music_ctx.mutex);
s_music_ctx.playback_state = state->playback_state;
s_music_ctx.playback_rate_percent = state->playback_rate_percent;
s_music_ctx.track_pos_ms = state->elapsed_time_ms;
s_music_ctx.track_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... | (s, sizeof(s), template, args) | |
/*
* 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_LOG_LEVEL_ERROR, "Invalid timer %u used in app_timer_reschedule", (unsigned)timer) | ;
syscall_failed();
}
}
return evented_timer_get_data((EventedTimerID)timer);
}
|
top_vibes();
launcher_task_add_callback(prv_stop_animation_kernel_main_cb, NULL);
}
}
}
static void prv_vibe(void *unused) {
launcher_task_add_callback(prv_vibe_kernel_main_cb, NULL);
}
static void prv_start_vibes(void) {
s_alarm_popup_data->vibe_count = 0;
unsigned int vibe_repeat_interval_ms = TIN... | (display_time, 16, "%H:%M", &alarm_tm) | ;
} else {
strftime(display_time, 16, "%I:%M %p", &alarm_tm);
}
dialog_set_text(dialog, display_time);
dialog_set_icon(dialog, RESOURCE_ID_ALARM_CLOCK_LARGE);
dialog_set_background_color(dialog, GColorJaegerGreen);
DialogCallbacks callback = {
.unload = prv_cleanup_alarm_popup,
};
dialog_set_cal... |
void) {
TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) {
.title = "CoreUX Design x Eng",
.subtitle = "ConfRM-Missile Command",
.icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR,
.num_concurrent = 0,
}, false /* animated */);
TimelinePeek *peek = timeline_peek_get_peek();
const La... | cl_assert(layer->frame.origin.y >= DISP_ROWS) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.