prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
per(slave);
}
void spi_slave_burst_read_write_scatter(const SPISlavePort *slave,
const SPIScatterGather *sc_info,
size_t num_sg) {
prv_spi_acquire_helper(slave);
spi_ll_slave_burst_read_write_scatter(slave, sc_info, num_sg);
prv_spi_release_helper(slave);... | (slave->spi_bus, *(cptr++)) | ;
prv_spi_transmit_flush_blocking(slave->spi_bus);
}
}
void spi_ll_slave_burst_read_write(const SPISlavePort *slave,
const void *out,
void *in,
size_t len) {
PBL_ASSERTN(slave->slave_state->initialized);
... |
terval_10HZ:
odr = BMA255ODR_10HZ;
break;
case BMA255SampleInterval_19HZ:
odr = BMA255ODR_19HZ;
break;
case BMA255SampleInterval_83HZ:
odr = BMA255ODR_83HZ;
break;
case BMA255SampleInterval_125HZ:
odr = BMA255ODR_125HZ;
break;
case BMA255SampleInterval_166... | PBL_ASSERTN(s_accel_power_mode == BMA255PowerMode_Standby) | ;
const int retries = 2;
uint8_t value;
for (int i = 0; i <= retries; i++) {
bma255_write_register(address, data);
value = bma255_read_register(address);
if (value == data) {
return; // Write took, we are good
}
PBL_LOG(LOG_LEVEL_DEBUG, "FIFO config write failed, initiating workaround ..... |
*addr) {
return (GAPLEConnection *) list_find(&s_connections->node,
prv_list_filter_for_addr,
(void *) addr);
}
static bool prv_list_filter_for_device(ListNode *found_node, void *data) {
const BTDeviceInternal *device = (const BTDeviceIn... | {
GAPLEConnection *connection = prv_find_connection(device);
// Verify that:
// the reason we can't find a connection is because we have deinitialized everything
// we only have connections stored after the module has been initialized
PBL_ASSERTN((connection != NULL) == s_le_connection_module_ini... |
bt_unlock();
}
// -------------------------------------------------------------------------------------------------
bool gap_le_connection_is_connected(const BTDeviceInternal *device) {
bt_lock();
const bool connected = (prv_find_connection(device) != NULL);
bt_unlock();
return connected;
}
// -----------... |
BLE[0] (main stack pointer)
// PSP = Unknown (process stack pointer)
// LR = 0xFFFFFFFF
// PC = VECTOR_TABLE[1]
// PRIMASK = 0x0
// FAULTMASK = 0x0
// BASEPRI = 0x0
// CONTROL = 0x0
//
// Attempt to put the processor into as close to the reset state as possible
// bef... | if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK))) {
// stop waiting if not held down any longer
return false;
} |
delay_ms(1);
}
return true;
}
void *reset_vector, *initial_sp;
prv_get_fw_reset_vector(&reset_vector, &initial_sp);
if ((uintptr_t)reset_vector == 0xffffffff ||
(uintptr_t)initial_sp == 0xffffffff) {
dbgserial_putstr("Firmware is erased");
return true;
}
return false;
}
stati... |
/*
* 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... | (stream->index < stream->length) | ;
return stream->data[stream->index++];
}
static void prv_byte_stream_write(WriteByteStream *stream, uint8_t data) {
PBL_ASSERTN(stream->index < stream->length);
stream->data[stream->index++] = data;
}
uint32_t sle_decode(const uint8_t *in, uint32_t in_len, uint8_t *out, uint32_t out_len) {
ReadByteStream in_... |
ed || tracking_on;
bool test_mode = s_activity_state.test_mode;
activity_stop_tracking();
while (s_activity_state.started) {
// Wait for stop_tracking KernelBG callback to run
sys_psleep(1);
}
cron_job_unschedule(&s_activity_job);
mutex_destroy((PebbleMutex *)s_activity_state.mutex);
if (reset_se... | activity_sessions_prv_send_activity_session_to_data_logging(&session) | ;
session_start_utc += 20 * SECONDS_PER_MINUTE;
}
// Send a fake minute-data record
activity_algorithm_test_send_fake_minute_data_dls_record();
}
bool activity_test_send_fake_dls_records(void) {
// Enqueue it for KernelBG to process
return system_task_add_callback(prv_send_fake_dls_records_system_cb, NU... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ("", string_list_get_at(list, 2)) | |
h"
#include "process_management/worker_manager.h"
#include "process_state/app_state/app_state.h"
#include "resource/resource.h"
#include "resource/resource_ids.auto.h"
#include "services/runlevel.h"
#include "services/common/status_led.h"
#include "system/logging.h"
#include "system/passert.h"
#include "system/reboot_r... | battery_state_service_peek() | );
app_simple_dialog_push(data->dialog);
// TODO: have the runlevel machinery disable bluetooth and worker.
services_set_runlevel(RunLevel_BareMinimum);
worker_manager_disable();
}
static void s_main(void) {
prv_handle_init();
app_event_loop();
}
const PebbleProcessMd* shutdown_charging_get_app_info(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... | SET_BIT(RCC->AHB1ENR, (0x1 << idx)) | |
e; sn < 2 * s_tx_window_size; ++sn) {
cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport,
s_short_data_fragment,
sizeof(s_short_data_fragment)), true);
ppogatt_... | (transport,
s_short_data_fragment,
sizeof(s_short_data_fragment) - sn) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (app_data->result_text) | |
GPIO_InitTypeDef gpio_init = {
.GPIO_Pin = GPIO_Pin_2,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_Speed = GPIO_Speed_100MHz,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_NOPULL
};
GPIO_Init(GPIOD, &gpio_init);
GPIO_WriteBit(GPIOD, GPIO_Pin_2, Bit_SET);
// Configure pins relating to the FMC peripheral... | if (FAILED(error)) {
result = error;
goto done;
} |
}
prv_allow_write_if_sector_is_not_protected(false, sector_addr);
prv_issue_command(sector_addr, S29VSCommand_EraseSetup);
prv_issue_command_argument(sector_addr,
S29VSCommandEraseAguments_SectorErase);
prv_allow_write_if_sector_is_not_protected(true, sector_addr);
// Check ... |
ration(b, duration_b);
animation_set_delay(b, delay_b);
Animation *seq = animation_sequence_create(a, b, NULL);
animation_set_handlers(seq, handlers, seq);
animation_schedule(seq);
// The duration of seq should include all of a and b
uint32_t duration = animation_get_duration(seq, true, true);
cl_assert... | animation_get_elapsed(seq, &position) | ;
cl_assert_equal_i(position, -delay_seq);
// Finish the sequence
prv_advance_to_ms_with_timers(prv_now_ms() + delay_b + duration_b + delay_seq
+ 2 * MIN_FRAME_INTERVAL_MS);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1);
cl_assert_equal_i(prv_co... |
&input->msrmt.values[i * values_per_samples]);
cl_assert(success);
}
return session_ref;
}
static void prv_test_decode_payload(TestPLParsedMsg *input, bool use_data_logging,
ProtobufLogRef session_ref) {
TestPLParsedMsg *record = prv... | prv_test_decode_payload(&input, false /*use_data_logging*/, ref) | ;
}
}
// ---------------------------------------------------------------------------------------------
// Try doing multiple flushes from the same session
void test_protobuf_log__measurements_multiple(void) {
ProtobufLogMeasurementType types[] = {ProtobufLogMeasurementType_Steps,
... |
/*
* 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... | {
EventServiceAppData *data = app_state_get_user_data();
text_layer_set_text(&data->connected_layer, connected ? "connected" : "disconnected");
} |
static void handle_deinit(void) {
EventServiceAppData *data = app_state_get_user_data();
app_free(data);
accel_tap_service_unsubscribe();
connection_service_unsubscribe();
}
static void handle_init(void) {
EventServiceAppData *data = app_malloc_check(sizeof(EventServiceAppData));
memset(data, 0, sizeof(... |
alue, ROUND(steps_per_minute * k_elapsed_sec, SECONDS_PER_MINUTE), 5);
activity_get_metric(ActivityMetricDistanceMeters, 1, &value);
act_distance[i] = value;
float err = abs(exp_distance_m - value);
float pct_err = err * 100.0 / exp_distance_m;
printf("\nTest %d: height:%d, steps:%d, seconds:%.1f, ... | (ACTIVITY_DEFAULT_HR_ON_TIME_SEC - 1, 100 /*bpm*/,
HRMQuality_Acceptable, false /*force_continuous*/) | ;
// The last update time should be within a second
activity_get_metric(ActivityMetricHeartRateRawUpdatedTimeUTC, 1, &last_update_utc);
cl_assert(last_update_utc >= rtc_get_time() - 1);
cl_assert(last_update_utc <= rtc_get_time());
// Should still be sampling every 1 second
cl_assert_equal_i(s_hrm_manager... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_version_copy_flash_fw_metadata(&out_metadata,
FLASH_REGION_SAFE_FIRMWARE_BEGIN,
check_crc) | |
/*
* 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_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_line_inside_origin_layer"))) | ;
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_x_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_line_across_x_origin_layer")));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc... |
s(&s_setup_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, d), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, d), 1);
cl_assert_equal_i(prv_count_handler_entrie... | animation_get_duration(a, false, true) | , play_count_a * duration_a);
cl_assert_equal_i(animation_get_duration(a, true, false), delay_a + duration_a);
cl_assert_equal_i(animation_get_duration(a, true, true), total_duration_a);
cl_assert_equal_i(animation_get_duration(b, false, false), duration_b);
cl_assert_equal_i(animation_get_duration(b, false, t... |
sizeof(s_short_data_fragment) - sn), true);
ppogatt_send_next(transport);
prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn,
s_short_data_fragment, sizeof(s_short_data_fragment) - sn);
if (sn == 0 || sn == 1) {
... | (PPOGATT_TIMEOUT_TICK_INTERVAL_SECS) | ;
}
fake_comm_session_process_send_next();
prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn,
s_short_data_fragment, sizeof(s_short_data_fragment) - sn);
}
// The last straw:
for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) {
regular_timer_fire_secon... |
"%d)", session_id);
return;
}
mutex_lock(s_lock);
prv_handle_subsystem_started(SessionState_AudioEndpointSetupReceived);
mutex_unlock(s_lock);
}
static void prv_session_result_timeout(void * data) {
mutex_lock(s_lock);
PBL_ASSERTN(s_state == SessionState_WaitForSessionResult);
prv_reset();... | {
mutex_lock(s_lock);
if ((s_state == SessionState_Idle) ||
(session_id != s_session_id) ||
(session_id == VOICE_SESSION_ID_INVALID)) {
goto unlock;
}
if (s_state != SessionState_Recording) {
mutex_unlock(s_lock);
voice_cancel_dictation(session_id);
return;
}
s_state = SessionS... |
void voice_cancel_dictation(VoiceSessionId session_id) {
mutex_lock(s_lock);
if ((session_id != s_session_id) ||
(session_id == VOICE_SESSION_ID_INVALID)) {
goto unlock;
}
if (s_state != SessionState_Idle) {
new_timer_stop(s_timeout);
if (s_state == SessionState_StartSession ||
s_st... |
392},
{ 112, 1056, 320},
{ 152, 1008, 328},
{ 0, 1056, 280},
{ -24, 1072, 256},
{ -112, 1392, 480},
{ -136, 1192, 216},
{ -80, 1248, -104},
{ 128, 1176, -72},
// 101 seconds
{ 272, 776, -192},
{ 376, 832, -264},
{ 352, 752, -64},
{ 320, 824, 0},
{ 256, 1008, -232... | { 264, 944, 120},
{ 328, 1008, 32},
{ 112, 872, 280},
{ 208, 1032, 552},
{ 128, 1384, 720},
{ -40, 1112, 760},
{ -40, 1232, 688},
{ 40, 512, 608},
{ 56, 848, 304},
{ 160, 512, 288},
{ 168, 624, 176},
{ 248, 672, 280},
{ 256, 728, 344},
{ 288, 904, 368},
// 107... | |
/*
* 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... | (&text_layer->layer) | ;
}
GSize text_layer_legacy2_get_size(TextLayerLegacy2* text_layer) {
if (text_layer == NULL) {
return GSizeZero;
}
return text_layer->layer.frame.size;
}
void text_layer_legacy2_set_text(TextLayerLegacy2 *text_layer, const char *text) {
if (text_layer == NULL) {
return;
}
text_layer->text = text;... |
/*
* 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_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi")) | ;
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_ny_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_ny_origin_layer.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_rect_${BIT_DEPTH_NAME}__offset_layer(void) ... |
/*
* 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_NAME("Weather - Splash Screen") | );
const GColor background_color = PBL_IF_COLOR_ELSE(GColorBlue, GColorBlack);
window_set_background_color(window, background_color);
const WindowHandlers window_handlers = {
.load = prv_window_load,
.unload = prv_window_unload,
};
window_set_window_handlers(window, &window_handlers);
window_set_u... |
/*
* 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... | (action2_attributes) | ,
.attributes = action2_attributes
}
},
{
.id = 2,
.type = TimelineItemActionTypeResponse,
.attr_list = {
.num_attributes = ARRAY_LENGTH(action3_attributes),
.attributes = action3_attributes
}
},
};
static Attribute attributes[] = {
{.id = AttributeIdTitle, .cstring = "S... |
{ 688, -160, -600},
{ 736, 16, -608},
{ 736, 16, -624},
{ 712, -72, -632},
{ 704, -40, -640},
{ 720, -48, -640},
{ 720, -88, -624},
{ 712, -88, -616},
// 126 seconds
{ 720, -48, -624},
{ 720, -96, -624},
{ 728, -96, -608},
{ 728, -80, -616},
{ 736, -72, -600},
{... | { 280, -152, -968},
{ 272, -224, -944},
{ 320, -200, -944},
{ 272, -272, -904},
{ 248, -296, -896},
{ 272, -272, -912},
{ 288, -288, -920},
{ 280, -272, -880},
{ 320, -144, -784},
{ 336, -496, -776},
{ 256, -584, -816},
{ 216, -408, -920},
{ 128, -544, -872},
{ 96... | |
36, 784, -240},
{ 1456, 304, -160},
{ 1352, 656, -144},
{ 1592, 1224, -16},
{ 880, 1264, -96},
{ 1104, 1016, -192},
{ 920, 880, -280},
{ 1048, 648, -280},
{ 1560, 656, -80},
{ 1872, 648, 16},
{ 1728, 568, -112},
{ 1712, 464, -88},
{ 1672, 344, 64},
{ 1608, 368, -24},
... | { 1360, -16, -128},
{ 1000, -344, -72},
{ 664, -400, -224},
{ 704, -320, -288},
{ 1136, -112, -96},
{ 1560, 184, -216},
{ 1856, 192, -208},
{ -1904, 296, -264},
{ 1768, 496, -104},
{ 1376, 488, -144},
{ 1352, 632, -200},
{ 1416, 688, -160},
{ 1416, 952, -416},
{ 1... |
{ 856, 840, -168},
{ 1096, 704, -160},
{ 1640, 760, -16},
{ 1840, 704, 32},
{ 1776, 608, -40},
{ 1688, 520, 16},
{ 1800, 376, 8},
{ 1744, 392, -232},
{ 1544, 216, -216},
{ 1328, -136, -184},
{ 888, -312, -136},
{ 664, -224, -264},
{ 1016, -96, -224},
{ 1080, 32, ... |
GTextNodeText text_node = {};
text_node.text = (char *)TEST_TEXT;
text_node.font = TEST_FONT;
text_node.overflow = GTextOverflowModeTrailingEllipsis;
text_node.alignment = GTextAlignmentCenter;
s_data.text_node = &text_node.node;
s_data.max_used_size = TEST_TEXT_SIZE;
GSize size;
graphics_text_node_dr... | cl_assert_equal_i(horizontal_a->container.max_nodes, 3) | |
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.
*/
#include "applib/applib_resour... | {
return;
} |
switch (command->type) {
case GDrawCommandTypePath:
prv_draw_path(ctx, command);
break;
case GDrawCommandTypePrecisePath:
prv_draw_precise_path(ctx, command);
break;
case GDrawCommandTypeCircle:
prv_draw_circle(ctx, command);
break;
default:
WTF;
}
}
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... | ((const uint8_t *)&fpga_header,
BOOT_FPGA_FLASH_ADDR, sizeof fpga_header) | ;
flash_write_bytes((const uint8_t *)s_boot_fpga,
BOOT_FPGA_FLASH_ADDR + sizeof fpga_header,
sizeof s_boot_fpga);
}
|
/*
* 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... | (MAX(x0, x1), framebuffer->bounds.origin.x + framebuffer->bounds.size.w) | |
liance 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 ... | shared_circular_buffer_get_write_space_remaining(&s_buffer) | >= length + 1) {
// Ideally we could figure out a way to skip out on this copy but then you'd potentially need to sniprintf
// into a non-contiguous buffer... whatever, we have CPU to burn.
uint8_t msg_length = length;
// Do not advance slackers. Data loss and/or corruption will occur! See wri... |
208},
{ 1472, 160, 96},
{ 984, 336, -104},
{ 984, -40, 48},
{ 840, -96, 56},
{ 728, -16, 40},
{ 792, 168, -56},
{ 808, 216, 40},
{ 712, 112, 72},
{ 696, 272, -120},
{ 696, 176, 144},
{ 672, 368, 0},
{ 864, 408, 32},
// 25 seconds
{ 1160, 352, 312},
{ 1344, 368... | { 752, 128, 128},
{ 728, 16, 184},
{ 776, 72, 160},
{ 776, 152, 152},
{ 784, 240, 40},
{ 752, 200, 24},
{ 848, 216, 0},
{ 920, 152, -8},
{ 1112, -8, -32},
{ 1216, -8, -16},
{ 1448, 96, 120},
{ 1488, 264, 48},
{ 1096, 344, 112},
{ 960, 160, 88},
{ 1016, 48, 56}... |
{ 1056, 80, 128},
{ 912, -24, 120},
{ 640, -144, 16},
{ 688, 80, 40},
{ 712, 32, 112},
{ 696, 128, 56},
{ 768, 104, 112},
{ 896, 48, 184},
{ 1064, 32, 200},
{ 1160, 112, 168},
{ 1280, 120, 144},
{ 1536, -32, 328},
{ 1064, 432, 16},
{ 1024, 352, -136},
{ 888, ... |
except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY... | grect_get_max_y(&ctx->draw_state.clip_box) | - 1;
const int x_min = ctx->draw_state.clip_box.origin.x;
const int x_max = grect_get_max_x(&ctx->draw_state.clip_box) - 1;
y1 = MAX(y1, y_min);
y2 = MIN(y2, y_max + 1); // Thats because we added one to end of the line
if (!WITHIN(x, x_min, x_max) || y1 > y2) {
// Outside of drawing bounds..
return;... |
;
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_CUSTOM, custom_schedule1);
alarm_set_kind(id, ALARM_KIND_EVERYDAY);
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
}
void test_alarm__alarm_set_recurring_weekends(void) {
AlarmId id;
id = alarm_create(&(AlarmInfo) {... | (schedule_2, alarm_day_text_2) | ;
cl_assert_equal_s(alarm_day_text_2, "Mon,Tue,Wed,Thu,Fri,Sat,Sun");
bool schedule_3[7] = {false, true, false, false, false, false, false};
char alarm_day_text_3[32] = {0};
alarm_get_string_for_custom(schedule_3, alarm_day_text_3);
cl_assert_equal_s(alarm_day_text_3, "Mondays");
bool schedule_4[7] = {fal... |
/*
* 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_pbi_eq(bitmap, TEST_PBI_FILE_FMT(4bitpalette))) | ;
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat4BitPalette);
}
// Tests 8-bit palettized 64-color PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__color_8_bit(void) {
GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(8bit));
cl_assert(gbitmap_pbi_eq(bit... |
216},
{ 904, -208, 8},
{ 968, -248, -24},
{ 1000, -224, 40},
{ 1320, -392, 64},
{ 920, -240, 104},
{ 1448, -192, -8},
{ 1576, -56, -144},
{ 1456, -104, -8},
{ 1168, -120, 48},
{ 1000, -16, 184},
{ 992, 96, 208},
{ 1144, 144, 96},
{ 1440, 264, 0},
{ 1400, 176, 16},... | { 1536, -80, 184},
{ 1280, -72, 64},
{ 1032, -8, 80},
{ 872, -80, 80},
{ 816, -96, 64},
{ 800, -104, 64},
// 32 seconds
{ 784, -160, 40},
{ 872, -184, -8},
{ 968, -232, 8},
{ 1344, -376, -24},
{ 952, -120, 24},
{ 1536, -200, -104},
{ 1808, -8, -184},
{ 1496, -... | |
/*
* 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... | (InhibitorBluetooth) | ;
// Bring the normal BT stack back up - airplane mode makes this simple
bt_ctl_set_override_mode(BtCtlModeOverrideNone);
s_test_mode_enabled = false;
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (!WITHIN(point.x, data_row_info.min_x, data_row_info.max_x)) {
return;
} |
uint8_t *line = data_row_info.data;
GColor color = ctx->draw_state.stroke_color;
if (!gcolor_is_transparent(color)) {
// Force alpha to be opaque since that represents how framebuffer discards it in display.
// Also needed for unit tests since PNG tests interpret alpha
color.a = 3;
line[point.x] ... |
SET_X,
COMPOSITE_TEST_OFFSET_Y));
prv_composite_test_draw_bitmap(&s_ctx, bitmap, offset_point, compositing_mode);
// Check the result
char unit_test_result_image_file_base_name[PATH_STRING_LENGTH] = {0};
snprintf(unit_test_result_image_file_base_name, ... | {
prv_offset_bitmap_layer_test(GPoint(0, -25));
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
} |
void test_graphics_draw_bitmap__composite_assign(void) {
prv_composite_test(__func__, GCompOpAssign);
}
void test_graphics_draw_bitmap__composite_assign_inverted(void) {
prv_composite_test(__func__, GCompOpAssignInverted);
}
void test_graphics_draw_bitmap__composite_or(void) {
prv_composite_test(__func__, GCo... |
= GTextNodeType_Horizontal) {
prv_clip_height(&ctx->box.size, &child_node->cached_size);
}
return true;
}
static bool prv_did_draw_container_child(GTextNodeDrawContext *ctx, GTextNode *child_node) {
const GValue *size = ToGValue(&child_node->cached_size);
const GAxis axis = prv_container(ctx->node)->axis;
... | {
return false;
} |
if (render && node->cached_size.h) {
GRect global_box = grect_to_global_coordinates((GRect) { box->origin, node->cached_size }, ctx);
grect_clip(&global_box, &ctx->draw_state.clip_box);
if (!global_box.size.h) {
return false;
}
}
return true;
}
static void prv_iter_will_draw(GTextNodeDrawC... |
f, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x1f, 0xe0, /* bytes 2928 - 2944 */
0x1f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf8, /* bytes 2944 - 2960 */
0xff, 0xff, 0x7f, 0xf8, 0x7f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0... | {
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, true /* is_next */);
fake_boot_bit_set(BOOT_BIT_NEW_SYSTEM_RESOURCES_AVAILABLE);
resource_init();
} |
void test_resource__pug(void) {
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, PUG_FIXTURE_NAME, "pug");
size_t pug_size = resource_size(SYSTEM_APP, RESOURCE_ID_PUG);
cl_assert_equal_i(pug_size, sizeof(pug));
uint8_t pug_buf[pug_size];
cl_assert_equal_i(
resource_load_byte_range_system(SYSTEM_AP... |
tion_get_elapsed(seq, &elapsed_ms);
cl_assert_equal_i(elapsed_ms, -1 * (delay_seq));
animation_get_elapsed(a, &elapsed_ms);
cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a));
animation_get_elapsed(b, &elapsed_ms);
cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a + duration_a + delay_b));
/... | animation_get_elapsed(b, &elapsed_ms) | ;
cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn + delay_b));
// Start
prv_advance_to_ms_with_timers(start_ms + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handle... |
tionary ||
prev_state == TimelineAppStateUpDown) {
TimelineLayout *first_timeline_layout =
timeline_layer_get_current_layout(&data->timeline_layer);
if (!first_timeline_layout) {
return NULL;
}
prv_init_peek_layer(data);
GRect icon_from;
layer_get_global_frame((Layer... | (-layer->bounds.size.w, 0) | ;
Animation *animation = (Animation *)property_animation_create_bounds_origin(layer, NULL,
&to_origin);
animation_set_handlers(animation, (AnimationHandlers) {
.stopped = prv_move_timeline_layer_stopped,
}, data);
animation_set_du... |
/*
* 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... | event_service_client_subscribe(&state->bss_info) | ;
}
BatteryChargeState battery_state_service_peek(void) {
return (sys_battery_get_charge_state());
}
void battery_state_service_unsubscribe(void) {
BatteryStateServiceState *state = prv_get_state(PebbleTask_Unknown);
event_service_client_unsubscribe(&state->bss_info);
state->handler = NULL;
}
void battery_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... | PBL_ASSERTN(impl) | ;
PBL_ASSERTN(impl->handle_touch_event && impl->cancel && impl->reset);
PBL_ASSERTN(data && (data_size > 0));
// This might be passed from the public interface, so just return NULL
if (!event_cb) {
return NULL;
}
// TODO: Use applib_malloc_size to get the size of Recognizer when we have an implementat... |
(BTPairingUIData *data) {
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
const char *font_key_default = FONT_KEY_GOTHIC_28_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_24_PAIR;
#else
const char *font_key_default = FONT_KEY_GOTHIC_24_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_20_PAIR;
#endif
cons... | PBL_ASSERTN(data->info_text_out_animation) | |
TE_CHANGE_EVENT,
.handler = prv_charger_event_cb,
},
};
circular_buffer_init(&s_manager_state.system_task_event_buffer,
s_manager_state.system_task_event_storage,
EVENT_STORAGE_SIZE);
event_service_client_subscribe(&s_manager_state.charger_subscription);
}
... | mutex_lock_recursive(s_manager_state.lock) | ;
HRMSubscriberState *state = prv_get_subscriber_state_from_ref(session);
if (state) {
if (app_id) {
*app_id = state->app_id;
}
if (update_interval_s) {
*update_interval_s = state->update_interval_s;
}
if (expire_s) {
int16_t expire_in_s = 0;
if (state->expire_utc != 0) {... |
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language gove... | if (node == head) {
return new_node;
} else {
return head;
} |
}
ListNode *next = node->next;
if (next == NULL) {
list_insert_after(node, new_node);
return head;
}
node = next;
}
}
bool list_contains(const ListNode *node, const ListNode *node_to_search) {
if (node == NULL || node_to_search == NULL) {
return false;
}
while (node) {
... |
prv_flash_erase_blocking(sector_addr, false /* is_subsector */) | ;
}
void flash_erase_subsector_blocking(uint32_t subsector_addr) {
prv_flash_erase_blocking(subsector_addr, true /* is_subsector */);
}
void flash_enable_write_protection(void) {
flash_impl_enable_write_protection();
}
void flash_prf_set_protection(bool do_protect) {
status_t status;
mutex_lock(s_flash_lock)... | |
(0b11000000 | color) });
graphics_fill_rect(ctx, &rect);
*row += num_pixels;
}
#if PBL_ROUND
static void prv_draw_round_border(Layer *layer, GContext *ctx, uint8_t radial_padding_size) {
for (int i = 0; i < layer->bounds.size.h / 2 - radial_padding_size; ++i) {
const GBitmapDataRowInfoInternal *data_row_in... | prv_draw_crosshair_screen(layer, ctx, 4) | ;
break;
#endif
#if PBL_COLOR
case TestPattern_Pinwheel:
prv_draw_bitmap(layer, ctx, RESOURCE_ID_TEST_IMAGE_PINWHEEL);
break;
case TestPattern_Veggies:
prv_draw_bitmap(layer, ctx, RESOURCE_ID_TEST_IMAGE_VEGGIES);
break;
#endif
default:
break;
}
}
static void prv_button_click_handler(Cli... |
/*
* 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_init(&s_ctx, &s_fb, GContextInitializationMode_App) | ;
s_app_state_get_graphics_context = &s_ctx;
// Setup resources
fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */);
pfs_init(false /* run filesystem check */);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
... |
the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/dbgserial.h"
#include "drivers/periph_config.h"
#include "drivers/gpio.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_usart.h"
#include "util/attributes.h"
#include "util/cobs.h"
#... | (raw_length) | ];
size_t cooked_length = 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_DELIMITE... |
luetooth_types.h>
#include <bluetooth/classic_connect.h>
#include <bluetooth/reconnect.h>
#include <bluetooth/sm_types.h>
#include <btutil/bt_device.h>
#include <stdio.h>
#include <string.h>
#define HEADER_BUFFER_SIZE 22
#define SHARING_HEART_RATE_EXTRA_HEIGHT_PX (18)
typedef enum SettingsBluetooth {
SettingsBlue... | add_remote(data, remote) | ;
}
static void prv_add_bt_classic_remotes(SettingsBluetoothData *data) {
bt_persistent_storage_for_each_bt_classic_pairing(prv_add_bt_classic_remote, data);
}
static bool dual_remote_filter(ListNode *node, void *data) {
StoredRemote *classic_remote = (StoredRemote *) node;
BTDeviceInternal *device = (BTDevice... |
.all_day = 1,
.layout = LayoutIdTest,
},
.attr_list = {
.num_attributes = 0,
.attributes = NULL,
},
.action_group = {
.num_actions = 0,
.actions = NULL,
},
.allocated_buffer = NULL,
}
};
static const int s_feb_5_midnight = 1423123200; // 2015 PST
sta... | uuid_equal(&state.pin.header.id, &s_items[0].header.id) | |
r *it) {
MenuLayer *menu_layer = it->menu_layer;
const int16_t prev_selection_height = menu_layer->selection.h;
const MenuIndex prev_selection_index = menu_layer->selection.index;
if (menu_layer->center_focused) {
it->row_callback_before_geometry = it->row_callback_after_geometry;
it->row_callback_afte... | {
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 *animation,
const AnimationProgress progress) {
const AnimationProgress half_progress = ANIMATION_NORMALIZED_MAX / 2;
const bool second_hal... |
/*
* 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... | periph_config_acquire_lock() | ;
gpio_output_init(&ICE40LP->creset, GPIO_OType_OD, GPIO_Speed_25MHz);
gpio_input_init(&ICE40LP->cdone);
gpio_input_init(&ICE40LP->busy);
periph_config_release_lock();
}
static bool prv_spin_until_creset_is(bool level) {
int timeout_us = 500 * 1000;
InputConfig creset_input = {
.gpio = ICE40LP->crese... |
}
r = strftime(buf, buf_size, "%d", &good_data);
if (r == 0 || strncmp(buf, "05", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"d\": %s", buf);
}
r = strftime(buf, buf_size, "%D", &good_data);
if (r == 0 || strncmp(buf, "05/05/15", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Er... | {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"X\": %s", buf);
} |
r = strftime(buf, buf_size, "%y", &good_data);
if (r == 0 || strncmp(buf, "15", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"y\": %s", buf);
}
r = strftime(buf, buf_size, "%Y", &good_data);
if (r == 0 || strncmp(buf, "2015", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with... |
er_app_glance_structured_get_data(structured_glance);
if (music_glance) {
strncpy(buffer, music_glance->subtitle, buffer_size);
buffer[buffer_size - 1] = '\0';
}
}
static GTextNode *prv_create_subtitle_node(LauncherAppGlanceStructured *structured_glance) {
return launcher_app_glance_structured_create_sub... | prv_set_glance_icon(music_glance, new_icon_resource_id) | ;
// Broadcast to the service that we changed the glance
launcher_app_glance_structured_notify_service_glance_changed(structured_glance);
}
static void prv_music_event_handler(PebbleEvent *event, void *context) {
switch (event->media.type) {
case PebbleMediaEventTypeNowPlayingChanged:
case PebbleMediaEv... |
error_ref = JERRY_ERROR(URIError, message_p, message_size);
break;
default:
EM_ASM_INT({
abort('Cannot create error type: ' + $0);
}, error_type);
break;
}
jerry_value_set_error_flag(&error_ref);
return error_ref;
}
jerry_value_t jerry_create_external_function(jerry_extern... | __jerryRefs.ref(obj[$1]) | |
2016-03-01 20:05:00 local, 2016-03-02 04:05:00 GMT
AlgDlsMinuteData *activity_sample_run_shut_down_2(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
// NOTE: The TEST_ACTIVITY_TYPE is one of the KAlgActivityType enum values
//> TEST_NAME run_shut_down_2
//> TEST_VERSION 3
//> ... | { 0, 0x64, 337, 180, 0},
{ 0, 0x55, 0, 180, 0},
{ 0, 0x55, 0, 180, 0},
{ 0, 0x55, 0, 180, 0},
{ 0, 0x55, 0, 175, 0},
{ 0, 0x55, 0, 150, 0},
{ 0, 0x61, 1046, 144, 0},
{ 0, 0x61, 0, 144, 0},
{ 0, 0x61, 0, 144, 0},
{ 0, 0x60, 926, 140, 0},
// 90: Local time: 2016-03-01 09:35:00 ... |
{ 0, 0x69, 0, 148, 0},
{ 0, 0x69, 0, 147, 0},
{ 0, 0x69, 0, 144, 0},
// 135: Local time: 2016-03-01 10:20:00 PM
{ 0, 0x69, 0, 147, 0},
{ 0, 0x69, 0, 148, 0},
{ 0, 0x69, 0, 148, 0},
{ 0, 0x69, 0, 147, 0},
{ 0, 0x69, 0, 150, 0},
{ 0, 0x69, 0, 148, 0},
{ 0, 0x69, 0, 148, 0},
... |
S OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ice40lp.h"
#include "board/board.h"
#include "drivers/dbgserial.h"
#include "drivers/display/ice40lp_definitions.h"
#include "drivers/gpio.h"
#include "drive... | (&ICE40LP->cdone) | ) {
dbgserial_putstr("CDONE not high after programming");
return false;
}
return true;
}
void display_power_enable(void) {
// The display requires us to wait 1ms between each power rail coming up. The PMIC
// initialization brings up the 3.2V rail (VLCD on the display, LD02 on the PMIC) for us, but
/... |
return (s_pb_state.receiver.buffer != NULL);
}
Receiver *prv_receiver_prepare(CommSession *session, const PebbleProtocolEndpoint *endpoint,
size_t total_payload_length) {
// This receiver should only be used for the Put Bytes endpoint (which has a NULL handler,
// because this receiv... | {
return s_pb_semaphore;
} |
TimerID put_bytes_get_timer_id(void) {
return s_pb_state.timer_id;
}
uint32_t put_bytes_get_index(void) {
return s_pb_state.index;
}
T_STATIC uint8_t prv_put_bytes_get_max_batched_pb_ops(void) {
return MAX_BATCHED_PB_PUT_OPS;
}
|
2, -296, -968},
{ -32, -312, -984},
{ -24, -304, -976},
{ -16, -304, -984},
{ -16, -304, -976},
{ -24, -304, -960},
{ -16, -296, -960},
{ -24, -336, -952},
{ -32, -288, -968},
{ -32, -320, -976},
{ -40, -328, -960},
{ -32, -304, -968},
{ -24, -336, -968},
// 62 second... | { -8, 864, -72},
{ -96, 936, 168},
{ -32, 880, -64},
{ -56, 952, 64},
{ -56, 904, 80},
{ -64, 840, -24},
{ -120, 808, 32},
{ -184, 824, 80},
{ -104, 888, 80},
{ -176, 904, 0},
{ -160, 824, -40},
{ -120, 1160, -48},
{ -56, 920, -72},
{ 64, 1000, -96},
{ 152, 77... |
{ 344, 696, -440},
{ 368, 728, -416},
{ 384, 688, -424},
// 5 seconds
{ 392, 680, -440},
{ 400, 608, -416},
{ 392, 680, -448},
{ 392, 696, -408},
{ 384, 680, -416},
{ 368, 672, -408},
{ 360, 648, -384},
{ 328, 688, -392},
{ 328, 552, -200},
{ 264, 624, -272},
... |
{
// Else, if the FIFO is 1 deep, we can ask the accel driver for the cached reading from the
// last FIFO read
if (s_temp_peek_mode) {
prv_set_restore_fifo_mode_timer(); // Give us another N seconds
}
accel_get_latest_reading((AccelRawData *)accel_data);
accel_data->times... | accel_get_latest_timestamp() | - (num_samples * 1000 / state->sampling_rate);
ACCEL_LOG_DEBUG("resyncing time");
}
state->num_samples += num_samples;
analytics_add(ANALYTICS_DEVICE_METRIC_ACCEL_SAMPLE_COUNT, num_samples,
AnalyticsClient_System);
PBL_ASSERTN(state->num_samples <= state... |
so tackle this later.
sector_addr = flash_impl_get_sector_base_address(sector_addr);
flash_impl_use();
prv_issue_command(sector_addr, S29VSCommand_ClearStatusRegister);
// Some sanity checks
{
status_t error = S_SUCCESS;
const uint8_t sr = prv_read_status_register(sector_addr);
if ((sr & S29VSSt... | (0, S29VSCommandEraseAguments_ChipErase) | ;
flash_s29vs_release();
}
#endif
static void prv_read_words_pio(uint16_t* buffer, uint16_t* flash_data_region,
uint32_t num_words) {
for (uint32_t words_read = 0; words_read < num_words; words_read++) {
buffer[words_read] = flash_data_region[words_read];
}
}
// Currently thi... |
/*
* 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 (test_image_bw) {
if (test_image_bw->addr) {
free(test_image_bw->addr);
}
free(test_image_bw);
} |
if (test_image_color) {
if (test_image_color->addr) {
free(test_image_color->addr);
}
free(test_image_color);
}
}
static void setup_test_rotate_bitmap(GContext *ctx, FrameBuffer *fb,
GRect clip_box, GRect drawing_box,
GCo... |
er;
uint8_t data[];
} BLEAdElement;
// -----------------------------------------------------------------------------
// Consuming BLEAdData:
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//! Internal ... | { // 32 bit
uint32_t u32 = *(uint32_t *) uuid_data;
uuids[i] = bt_uuid_expand_32bit(u32);
uuid_data += sizeof(uint32_t);
break;
} |
case 3: // 128-bit
uuids[i] = UuidMakeFromLEBytes(uuid_data);
uuid_data += sizeof(Uuid);
break;
}
}
// Call back to client with parsed data:
return callbacks->services_cb(uuids, num_uuids, cb_data);
}
// -------------------------------------------------------------------------... |
false);
graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4);
ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, 2));
}
void test_graphics_context_${BIT_DEPTH_NAME}__draw_stroke_width_even(void) {
// Stroke width even > 2, non-antialiased
setup_test(&context, false, SW_EVEN... | graphics_draw_rect(&context, &GRect(10, 20, 40, 10)) | ;
#if PBL_COLOR
ASSERT_CALLED(prv_draw_rect_aa_stroked(&context, &GRect(10, 20, 40, 10), SW_EVEN));
#else
ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_EVEN));
#endif
setup_test(&context, true, SW_EVEN, GColorBlack, GColorBlack, false);
graphics_draw_circle(&context, GPoint(50, 50), ... |
---------------------------------------------------------------
// Test unscheduling a complex animation
void test_animation__sequence_unschedule(void) {
#ifdef TEST_INCLUDE_COMPLEX
const int duration_a = 300;
const int duration_b = 200;
const int duration_c = 500;
const int repeat_count = 5;
int duration_tot... | (&s_setup_handler_calls, a) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b)... |
a(layer) * (index - center_index) * bounds->size.h / 2;
}
void timeline_layer_get_icon_frame(TimelineLayer *layer, int index, GRect *icon_frame) {
return PBL_IF_RECT_ELSE(prv_get_icon_frame_exact,
prv_get_icon_frame_centered)(layer, index, icon_frame);
}
static void prv_get_end_of_timeline... | for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER; i++) {
TimelineLayout *layout = layer->layouts[i];
TimelineIterState *state = timeline_model_get_iter_state(i - 1);
if (layout && state->current_day != layer->current_day) {
prv_set_layout_hidden(layout, true);
}
} |
}
static void prv_reset_layouts(TimelineLayer *layer) {
int num_items = timeline_model_get_num_items();
for (int i = 0; i < (int)ARRAY_LENGTH(s_visible_items); i++) {
if (layer->layouts[s_visible_items[i]]) {
prv_destroy_layout(layer, s_visible_items[i]);
}
TimelineIterState *state = timeline_mo... |
t_equal_b(s_nack_sent_is_called, true);
cl_assert_equal_i(s_out_sent_call_count, 0);
cl_assert_equal_i(s_out_failed_call_count, 1);
cl_assert_equal_i(s_failure_result, APP_MSG_SEND_REJECTED);
// Check the state is reset properly
cl_assert_equal_b(app_message_is_accepting_outbound(), true);
}
void test_app_... | (prv_receive_ack_nack_callback) | ;
prv_receive_test_data(TEST_TRANSACTION_ID_1, false);
cl_assert_equal_i(s_app_inbox_consume_call_count, 1);
prv_process_sent_data();
// First Message
cl_assert(s_in_received_is_called == true);
// ACK the messages
// Check that state was reset properly
check_in_accepting_again();
}
void test_app_me... |
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 "comm/ble/gap_le_advert.h"
#include "comm/ble/gap_le_connection.h"
#include "services/common/regular_timer.... | ((char *) ad->data,
ad_data, ad_data_length) | ;
}
if (scan_resp_data_length) {
strncpy((char *) ad->data + ad_data_length,
scan_resp_data, scan_resp_data_length);
}
return ad;
}
void test_gap_le_advert__single_job(void) {
const char ad_data[] = "ad data";
const char scan_resp_data[] = "scan resp data";
BLEAdData *ad = create_ad(ad_dat... |
mmon.flags = ~header->common.flags;
header->common.status = ~header->common.status;
int result = pfs_write(fd, (uint8_t *) header, sizeof(*header));
// Restore flags & status
header->common.flags = ~header->common.flags;
header->common.status = ~header->common.status;
if (result < 0) {
PBL_LOG(LOG_LE... | pfs_seek(*fd, iter_state.header.payload_length, FSeekCur) | ;
continue;
}
TimelineItem notification;
if (!prv_get_notification(¬ification, &iter_state.header, *fd)) {
// Error occurred
goto cleanup;
}
int result = prv_write_notification(¬ification, &iter_state.header, new_fd);
if (result < 0) {
// Error occurred
kerne... |
const uint8_t *buffer,
const uint8_t *buf_end) {
SerializedAddressHeader *serialized_address = (SerializedAddressHeader *)*cursor;
*cursor += sizeof(SerializedAddressHeader);
address->id = serialized_address->uuid;
address->type = ... | {
size += prv_get_serialized_address_list_size((AddressList *)group_ptr);
} |
}
return size;
}
// -----------------------------------------------------------------------------
static AttributeList *prv_serialize_action(TimelineItemAction *action,
uint8_t **buffer) {
SerializedActionHeader *serialized_action = (SerializedActionHeader *)*buffer;
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (easy_walk_distance_m, 900, 1100) | ;
// Walk for 12 mins again, but this time faster. More distance should be covered
steps = (walking_cadence_spm * 1.2) * walk_time;
time_ms = walk_time * SECONDS_PER_MINUTE * MS_PER_SECOND;
int fast_walk_distance_m = activity_private_compute_distance_mm(steps, time_ms) / MM_PER_METER;
cl_assert_gt(fast_walk_... |
, "foo");
}
HealthValue result = health_service_aggregate_averaged(HealthMetricHeartRateBPM,
time_start, time_end,
agg, HealthServiceTimeScopeOnce);
cl_assert_equal_i(s_sys_activity_get_min... | (fail_alert == NULL) | ;
// Cancel the original
health_service_cancel_metric_alert(alert);
// Should be able to register another now
alert = health_service_register_metric_alert(HealthMetricHeartRateBPM, 65);
cl_assert(alert != NULL);
}
|
/*
* 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 (shared_prf_storage_get_bt_classic_pairing_data(&addr, &name[0],
&link_key, &platform_bits)) {
bluetooth_persistent_storage_debug_dump_classic_pairing_info(
&buf[0], &addr, &name[0], &link_key, platform_bits);
} else {
prompt_send... |
if (shared_prf_storage_get_local_device_name(name, BT_DEVICE_NAME_BUFFER_SIZE)) {
prompt_send_response_fmt(buf, BT_DEVICE_NAME_BUFFER_SIZE, "Local device name: %s", name);
} else {
prompt_send_response("No Device Name");
}
prompt_send_response_fmt(buf, BT_DEVICE_NAME_BUFFER_SIZE, "Started Complete: %... |
FORCE_SLEEP_REG, FORCE_FTDF_SLEEP, 0x0); // GUESS
REG_SETF(CRG_TOP, LDOS_DISABLE_REG, LDOS_DISABLE, 0x0); // GUESS
REG_SETF(CRG_TOP, AON_SPARE_REG, OSC16_HOLD_AMP_REG, 0x0); // GUESS
REG_SETF(CRG_TOP, AON_SPARE_REG, OSC16_SH_DISABLE, 0x0); // GUESS
REG_SETF(CRG_TOP, AON_SPARE_REG, EN_BATSYS_RET, 0x0); // GUES... | (QSPIC, QSPIC_STATUSCMD_REG, QSPIC_RSTAT_INST, 0x0) | ;
REG_SETF(QSPIC, QSPIC_CHCKERASE_REG, QSPIC_CHCKERASE, 0x0);
REG_SETF(QSPIC, QSPIC_GP_REG, QSPIC_PADS_SLEW, 0x0);
REG_SETF(QSPIC, QSPIC_GP_REG, QSPIC_PADS_DRV, 0x0);
REG_SETF(QSPIC, QSPIC_UCODE_START, QSPIC_UCODE_X, 0x0);
// GPREG
REG_SETF(GPREG, PLL_SYS_CTRL1_REG, PLL_R_DIV, 0x1);
REG_SETF(GPREG, P... |
ms / MS_PER_SECOND);
}
// Test that we handle different update intervals correctly
void test_hrm_manager__update_interval(void) {
AppInstallId app_id = 1;
uint32_t update_interval_s = 600;
const uint16_t expire_s = 30 * SECONDS_PER_MINUTE;
HRMFeature features = HRMFeature_BPM;
HRMSessionRef session_ref = sys... | prv_can_turn_sensor_on() | );
fake_system_task_callbacks_invoke_pending();
cl_assert(!hrm_is_enabled(HRM));
s_activity_prefs_heart_rate_is_enabled = true;
hrm_manager_handle_prefs_changed();
cl_assert(prv_can_turn_sensor_on());
fake_system_task_callbacks_invoke_pending();
cl_assert(hrm_is_enabled(HRM));
// Test charging state c... |
ce time to just before the expiration time
rtc_set_time(rtc_get_time() + expire_s - 1);
// Send more data, the callback should get the expiring event
prv_fake_send_new_data();
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_i(s_num_cb_events_1, 3);
cl_assert_equal_i(s_cb_events_1[1].event_typ... | cl_assert_equal_i(s_event_count, 4) | ;
sys_hrm_manager_unsubscribe(bpm_session);
sys_hrm_manager_unsubscribe(led_session);
sys_hrm_manager_unsubscribe(all_session);
sys_hrm_manager_unsubscribe(no_session);
}
void test_hrm_manager__multiple_feature_callbacks(void) {
const int num_refs = 2;
HRMSessionRef session_refs[num_refs];
AppInstallId... |
ndle_data_notification(client, value, value_length);
} else {
prv_handle_meta_read(client, value, value_length, error);
}
}
unlock:
bt_unlock();
}
// -------------------------------------------------------------------------------------------------
static PPoGATTPacket * prv_lazily_allocate_packet_if... | new_timer_scheduled(client->rx_ack_timer, NULL) | ) {
new_timer_stop(client->rx_ack_timer);
}
// Ack packet (zero payload size):
*payload_size_out = 0;
return &client->out.ack_packet_to_send;
}
if (!new_timer_scheduled(client->rx_ack_timer, NULL)) {
new_timer_start(client->rx_ack_timer, PPOGATT_MAX_DATA_ACK_LATENCY_MS,
... |
/*
* 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... | {
WTF;
} |
int lg;
if (bus_frequency > (clock / 2)) {
lg = 1; // Underclock to the highest possible frequency
} else {
uint32_t divisor = clock / bus_frequency;
lg = ceil_log_two(divisor);
}
// Prescalers only exists for values in [2 - 256] range
PBL_ASSERTN(lg > 0);
PBL_ASSERTN(lg < 9);
// return ... |
for (int i = 0; i < s_num_dls_activity_records; i++) {
if (!memcmp(record, &s_dls_activity_records[i], sizeof(*record))) {
return;
}
}
printf("\nFound records:");
for (int i = 0; i < s_num_dls_activity_records; i++) {
printf("\ntype: %d, start_utc: %"PRIu32", elapsed: %"PRIu32", utc_to_local:... | ("\nFound activities:") | ;
for (int i = 0; i < num_sessions; i++) {
printf("\nFound: type: %d, start_utc: %d, len: %"PRIu16" ",
(int)sessions[i].type, (int)sessions[i].start_utc, sessions[i].length_min);
}
printf("\nLooking for: type: %d, start_utc: %d, len: %"PRIu16" ",
(int)exp_session->type, (int)exp_sess... |
if (!viewing_entire_notif && !at_bottom && text_visible) {
hide_it = false;
}
#else
const bool at_top = (cur_frame->origin.y == 0);
if (at_top && (!viewing_entire_notif || swap_layer->next)) {
hide_it = false;
}
#endif
}
layer_set_hidden(&swap_layer->arrow_layer.layer, hide_it);
}
... | prv_announce_layout_did_appear(swap_layer, swap_layer->current, -1) | ;
// refresh the layer down below in case we have jumped around in our data model
prv_refresh_next_layer(swap_layer);
}
static Animation *prv_create_swap_up_animation(SwapLayer *swap_layer, bool full_swap) {
int16_t dy;
const GRect *prev_frame = &swap_layer->previous->layer.frame;
const GRect *current_fram... |
WeatherType_CloudyDay
},
{
.location_name = TEST_WEATHER_DB_LOCATION_WATERLOO,
.is_current_location = false,
.current_temp = -99,
.today_high = -98,
.today_low = -99,
.current_weather_type = WeatherType_HeavySnow,
.current_weather_phrase = TEST_WEATHER_DB_SHORT_PHRASE_HEAVY_SNOW,
.to... | {
WeatherLocationForecast *forecast = weather_service_create_default_forecast();
// no blob db events were fired during unit test, therefore forecast cache never updated
cl_assert(!forecast);
const int default_location_index = 0;
const WeatherDBKey *default_location_key = weather_shared_data_get_key(0);
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... | outbox->failed_callback(&outbox->iterator, outbox->result, outbox->user_context) | |
ack.h"
#include "applib/ui/simple_menu_layer.h"
#include "applib/ui/text_layer.h"
#include "applib/ui/window.h"
#include "applib/ui/window_stack.h"
#include "mfg/mfg_apps/mfg_flash_test.h"
#include "process_state/app_state/app_state.h"
#include "services/common/system_task.h"
#include "system/logging.h"
#include "ke... | (msg_text_layer, "Press Select To Start") | ;
}
text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter);
text_layer_set_background_color(msg_text_layer, GColorBlack);
text_layer_set_text_color(msg_text_layer, GColorWhite);
text_layer_set_font(msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD));
layer_add_child(&window->layer, ... |
/*
* 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 (!gdraw_command_resource_is_valid(app_num, resource_id, PDCS_SIGNATURE, &data_size)) {
return NULL;
} |
GDrawCommandSequence *draw_command_sequence = applib_resource_mmap_or_load(app_num, resource_id,
PDCS_DATA_OFFSET,
data_size, false);
// Validate the loaded co... |
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 "mfg_serials.h"
#include "console/prompt.h"
#include "util/size.h"
static const uint8_t OTP_SERIAL_SLOT_INDICES[] =... | ARRAY_LENGTH(OTP_HWVER_SLOT_INDICES) | |
vent_PositionUpdate, &GPointZero, 3686380, 0,
&GPoint(10, 10), 20, 5, true);
fake_event_reset_count();
touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420);
cl_assert_equal_i(fake_event_get_count(), 0); // no event if previous one not handled
touch_event = touch_e... | (0, TouchState_FingerUp, NULL, 0, 3686440) | ;
touch_event = touch_event_queue_get_event(0, 1);
prv_test_touch_event(touch_event, 0, TouchEvent_Liftoff, &GPointZero, 3686380, 0,
&GPoint(13, 13), 60, 0, true);
}
void test_touch__assert_null_pos_not_liftoff(void) {
// NULL position not valid for touchdown event
cl_assert_passert(tou... |
/*
* 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... | {
case VibeClient_Notifications: {
alert_type = AlertType_Notifications;
break;
}
case VibeClient_PhoneCalls: {
alert_type = AlertType_Calls;
break;
}
case VibeClient_Alarms: {
alert_type = AlertType_Alarms;
break;
}
default: {
WTF;
}
} |
unsigned int currently_showing_index = prv_get_index(curr_id);
unsigned int search_index = (currently_showing_index + 1) % VIBE_MAP_SIZE;
while (search_index != currently_showing_index) {
if ((S_VIBE_MAP[search_index].alert_types & alert_type) == alert_type) {
return S_VIBE_MAP[search_index].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... | ("*** WTF ") | ;
dbgserial_print_hex(saved_lr);
dbgserial_putstr("");
reset_due_to_software_failure();
}
//! Assert function called by the STM peripheral library's
//! 'assert_param' method. See stm32f2xx_conf.h for more information.
void assert_failed(uint8_t* file, uint32_t line) {
register uintptr_t lr __asm("lr");
uint... |
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 "services/normal/notifications/do_not_disturb.h"
#include "applib/ui/action_... | {
const char *key = "dndManuallyEnabled";
prv_assert_settings_value((void*)key, strlen("dndManuallyEnabled"),
(void*)&expected_value, sizeof(bool));
} |
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Tests
void test_do_not_disturb__initialize(void) {
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(false);
rtc_set_time(s_thursday_00_00);
alerts_preferences_init();
do_not_disturb_init... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (from + (delta * (progress - index * stride)) / stride) | ;
}
AnimationProgress animation_timing_interpolate(
AnimationProgress time_normalized, const uint16_t *table, size_t num_entries) {
return prv_animation_timing_interpolate(time_normalized, table, prv_uint16_getter, num_entries);
}
AnimationProgress animation_timing_interpolate32(
AnimationProgress time_norm... |
re_day_sep_dot_offset_y = 16,
};
static const TimelineLayerStyle * const s_styles[NumPreferredContentSizes] = {
[PreferredContentSizeSmall] = &s_style_medium,
[PreferredContentSizeMedium] = &s_style_medium,
[PreferredContentSizeLarge] = &s_style_large,
[PreferredContentSizeExtraLarge] = &s_style_large,
};
sta... | (style->sidebar_width, 0) | ;
}
static void prv_get_day_sep_frame(TimelineLayer *layer, int index, GRect *frame) {
prv_get_frame(layer, index, frame);
const bool is_future = (layer->scroll_direction == TimelineScrollDirectionDown);
const TimelineLayerStyle *style = prv_get_style();
frame->origin.y += is_future ? style->future_day_sep_dot... |
no_player_create_play_animation(test_player);
cl_assert_equal_i(animation_is_scheduled(animation), false);
animation_schedule(animation);
animation_set_elapsed(animation, 1234); // intentionally bad value
prv_play_animation_update(animation, ANIMATION_NORMALIZED_MAX * 20 / 300);
cl_assert_equal_i(kino_reel... | kino_reel_get_elapsed(test_reel) | , 20);
}
void test_kino_player__infinite_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_e... |
/*
* 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... | ancs_notifications_util_is_sms(app_id) | ) {
return false;
}
// The defining feature of a group sms (vs a regular sms) is that it has a subtitle field
if (!subtitle || subtitle->length == 0) {
return false;
}
return true;
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (second, 1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.