prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ader = { // [3] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4}, .parent_id = {0}, .timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 30, .type = TimelineItemTypePin, .flags = 0, ...
uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)
ack(prv_update_hrm_enable_system_cb, NULL); } void hrm_manager_init(void) { s_hrm_present = mfg_info_is_hrm_present(); s_manager_state = (struct HRMManagerState) { .lock = mutex_create_recursive(), .accel_data_lock = mutex_create(), .update_enable_timer_id = new_timer_create(), .enabled_charging_st...
pebble_task_get_current()
, app_id); if (state) { ref = state->session_ref; } mutex_unlock_recursive(s_manager_state.lock); return ref; } DEFINE_SYSCALL(bool, sys_hrm_manager_get_subscription_info, HRMSessionRef session, AppInstallId *app_id, uint32_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert_equal_i(sign_extend(0, 32), 0); cl_assert_equal_i(sign_extend(0, 3), 0); cl_assert_equal_i(sign_extend(1, 32), 1); cl_assert_equal_i(sign_extend(1, 3), 1); cl_assert_equal_i(sign_extend(-1, 32), -1); cl_assert_equal_i(sign_extend(-1, 3), -1); cl_assert_equal_i(sign_extend(7, 32), 7); cl_a...
void test_math__serial_distance32(void) { { int32_t dist = serial_distance32(0x0, 0x1); cl_assert_equal_i(dist, 1); } { int32_t dist = serial_distance32(0x1, 0x0); cl_assert_equal_i(dist, -1); } { int32_t dist = serial_distance32(0x0, 0xffffffff); cl_assert_equal_i(dist, -1); } ...
vitySessionType_Walk, .step_data = { .steps = 100, .active_kcalories = 200, .resting_kcalories = 300, .distance_meters = 400, }, }; ActivitySession new_activity = { .start_utc = day_start + 23 * SECONDS_PER_HOUR, .length_min = 120, .type = ActivitySessionType_Run, .st...
ROUND(k_bmr_cal * k_minute_start / MINUTES_PER_DAY, ACTIVITY_CALORIES_PER_KCAL)
); cl_assert_equal_i(health_service_sum_today(HealthMetricRestingKCalories), value); // Feed in 100 steps/minute over 1 hour (walking rate) prv_feed_cannned_accel_data(SECONDS_PER_HOUR, 100, ActivitySleepStateAwake); const int k_exp_steps = 100 * MINUTES_PER_HOUR; // Test the derived metrics activity_get_...
n theory possible for a misbehaving app to pass in a consumed_up_to_ptr that is //! mid-way in a message. If it does so, it won't crash the kernel, but it will result in delivery //! of broken messages to the app, but it won't be our fault... static void prv_consume(AppInboxConsumerInfo *consumer_info) { prv_lock(); ...
if (info.num_failed) { if (info.dropped_handler) { info.dropped_handler(info.num_failed); } else { PBL_LOG(LOG_LEVEL_ERROR, "Dropped %"PRIu32" messages but no dropped_handler", info.num_failed); } }
// Report back up to which byte we've consumed the data. sys_app_inbox_service_consume(&info); } bool app_inbox_service_register(uint8_t *storage, size_t storage_size, AppInboxMessageHandler message_handler, AppInboxDroppedHandler dropped_handler, A...
v_create_test_data(num_minutes, minute_data); // Call the minute handler to feed in enough data to write to flash. This computes the minute // stats and saves them to data logging as well as to the sleep PFS file. prv_feed_minute_data(ALG_MINUTES_PER_FILE_RECORD, minute_data, false /*simulate_bg_delays*/); uin...
ARRAY_LENGTH(sessions)
src_bitmap->bounds.size.w)); // how many 32-bit blocks do we need to bitblt on this row: const int16_t dest_end_x = (dest_rect.origin.x + dest_rect.size.w); const uint8_t num_dest_blocks_per_row = (dest_end_x / 32) + ((dest_end_x % 32) ? 1 : 0) - dest_begin_x; ...
(tint_color)
); }
cense, 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 * distributed under the License is distribute...
Fixed_S32_16_mul(t1->d, t2->c)
; Fixed_S32_16 c_b = Fixed_S32_16_mul(t1->c, t2->b); Fixed_S32_16 d_d = Fixed_S32_16_mul(t1->d, t2->d); Fixed_S32_16 tx_a = Fixed_S32_16_mul(t1->tx, t2->a); Fixed_S32_16 ty_c = Fixed_S32_16_mul(t1->ty, t2->c); Fixed_S32_16 tx_b = Fixed_S32_16_mul(t1->tx, t2->b); Fixed_S32_16 ty_d = Fixed_S32_16_mul(t1->t...
UPPORTED_HCI_PARAM_LEN 25 #define MAX_SUPPORTED_HCI_CMD_LEN (MAX_SUPPORTED_HCI_PARAM_LEN + HCI_CMD_HEADER_LEN) typedef struct { bool found_cmd_start; uint8_t param_len; uint8_t write_offset; uint8_t data_buf[MAX_SUPPORTED_HCI_CMD_LEN]; // holds one HCI cmd } HciCmdInfo; static void prv_handle_hci_cmd(void *hc...
{ return false; }
void (*flush_data)(char *) = serial_console_is_prompt_enabled() ? prv_dbgserial_putstr : prv_accessory_putstr; char buf[40]; uint8_t status = e->payload[0]; snprintf(buf, sizeof(buf), "%s: cmd = 0x%x Status = 0x%x\r\n", (status == HciStatusCode_Success) ? "Success!" : "Failure", (...
nt32_t)((float)-0.250 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 6); test_num = (int32_t)((float)-0.125 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); ...
Fixed_S16_3(-4)
)); cl_assert_equal_i(-1, Fixed_S16_3_rounded_int(Fixed_S16_3(-5))); cl_assert_equal_i(-1, Fixed_S16_3_rounded_int(Fixed_S16_3(-8))); cl_assert_equal_i(-2, Fixed_S16_3_rounded_int(Fixed_S16_3(-12))); } void test_math_fixed__S16_3_rounding(void) { Fixed_S16_3 num; int16_t test_num; // This test shows how t...
B1PeriphClockCmd, RCC_APB1Periph_PWR); if (PWR_GetFlagStatus(PWR_FLAG_SB) == SET) { // We just woke up from standby. For some reason this leaves the system in a funny state, // so clear the flag and reboot again to really clear things up. PWR_ClearFlag(PWR_FLAG_SB); dbgserial_putstr("exit standby"); ...
watchdog_start()
; #endif jump_to_fw(); }
/* * 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...
scale_int32(data->normalized, ANIMATION_NORMALIZED_MAX, data->duration)
case ActivitySessionType_RestfulNap: return true; case ActivitySessionType_Walk: case ActivitySessionType_Run: case ActivitySessionType_Open: return false; case ActivitySessionType_None: case ActivitySessionTypeCount: break; } WTF; } // ------------------------------------...
{ return 1; }
bool kalg_init(KAlgState *state, KAlgStatsCallback stats_cb) { return true; } uint32_t kalg_analyze_samples(KAlgState *state, AccelRawData *data, uint32_t num_samples, uint32_t *consumed_samples) { *consumed_samples = 0; return s_alg_next_steps; } void kalg_minute_stats(KAlgState...
RIu32, US_PER_SECOND / interval_us, max_batch); accel_set_num_samples(max_batch); } static bool prv_call_data_callback(AccelManagerState *state) { switch (state->task) { case PebbleTask_App: case PebbleTask_Worker: case PebbleTask_KernelMain: { PebbleEvent event = { .type = PEB...
{ PBL_LOG(LOG_LEVEL_INFO, "Received %" PRIu32 " accel samples for KernelMain.", num_samples); }
static void prv_kernel_tap_subscription_handler(AccelAxisType axis, int32_t direction) { PBL_LOG(LOG_LEVEL_INFO, "Received a tap event for KernelMain, axis: %d, " "direction: %" PRId32, axis, direction); } #endif // Compute and return the device's delta position to help determine movement as idle. static...
XIS_Z; invert = cfg->axes_inverts[AXIS_Z]; } else { BMA255_DBG("No Axis?: 0x%"PRIx8" 0x%"PRIx8, int0_status, int2_status); } int32_t direction = ((int2_status & BMA255_INT_STATUS_2_SLOPE_SIGN) == 0) ? 1 : -1; direction *= (invert ? -1 : 1); accel_cb_shake_detected(axis, direction); } ...
{ if (s_accel_power_mode == BMA255PowerMode_LowPower1) { prv_enter_power_mode(BMA255PowerMode_Suspend); } else if (s_accel_power_mode == BMA255PowerMode_LowPower2) { prv_enter_power_mode(BMA255PowerMode_Standby); } }
prv_enter_power_mode(mode); BMA255_DBG("BMA555: power level set to: 0x%x and 0x%x", bma255_read_register(BMA255Register_PMU_LPW), bma255_read_register(BMA255Register_PMU_LOW_POWER)); s_accel_power_mode = mode; } static BMA255ODR prv_get_odr(BMA255SampleInterval sample_interval) { ...
meHeader) + FRAME_FOOTER_LENGTH) typedef struct PACKED { uint8_t version; union { struct PACKED { uint8_t is_read:1; uint8_t is_master:1; uint8_t is_notify:1; uint32_t reserved:29; }; uint32_t raw; } flags; uint16_t profile; } FrameHeader; typedef struct { //! HDLC contex...
smartstrap_profiles_handle_notification(context.success, read_profile)
; } else { smartstrap_profiles_handle_read(context.success, read_profile, read_length); } } static void prv_read_timeout(void *context) { if (smartstrap_fsm_state_test_and_set(SmartstrapStateReadInProgress, SmartstrapStateReadComplete)) { // we need to handle the t...
} first_container = false; } else { // Insure that restful sessions are inside the previous container cl_assert(container_session != NULL); cl_assert(session->start_utc >= container_session->start_utc); cl_assert(session->start_utc < container_session->start_utc ...
printf("\nRunning sleep sample set: \"%s\"\n", entry->name)
; // It's easier to understand the algorithm log messages if we start at 0 time rtc_set_time(0); memset(s_kalg_state, 0, kalg_state_size()); kalg_init(s_kalg_state, prv_stats_cb); s_num_captured_sleep_sessions = 0; // Run samples through the activity detector time_t now = rtc_get_time(); ...
/* * 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...
timeline_event_init()
; dls_init(); wakeup_init(); app_order_storage_init(); #if CAPABILITY_HAS_HEALTH_TRACKING activity_init(); #endif notifications_init(); alerts_init(); send_text_service_init(); protobuf_log_init(); #if CAPABILITY_HAS_WEATHER weather_service_init(); #endif #if CAPABILITY_HAS_MICROPHONE voice_in...
key, &uuid_buffer, sizeof(uuid_buffer)), size); cl_assert(uuid_equal(&test_uuid_a, &uuid_buffer)); } void test_persist__data_too_big(void) { char buf[PERSIST_DATA_MAX_LENGTH+2]; memset(buf, '~', sizeof(buf)); cl_assert_equal_i(persist_write_data(0, lipsum, sizeof(lipsum)), PERSIST_DATA_MA...
(persist_read_string(0, buffer, 2), 2)
; cl_assert_equal_i(strlen(buffer), 2 - 1); // -1 because null termination cl_assert_equal_i(buffer[0], 'H'); // Then attempt to read back the entire thing cl_assert_equal_i(persist_read_string(0, buffer, sizeof(buffer)), sizeof(buffer)); cl_assert_equal_i(strlen(buffer), 10); cl_assert(strcmp(buffer, "Hell...
------------------------------ // Sample captured: 2015-10-07 13:22:41 local AccelRawData *activity_sample_walk_100_temp_94473_5(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_temp_94473_5 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 70 //> TEST_EXPECTED_...
{ -88, 984, -760}, { -184, 856, -568}, { -496, 536, -536}, { -640, 488, -560}, { -728, 480, -552}, { -592, 320, -480}, { -512, 208, -456}, { -568, 160, -376}, { -504, 48, -344}, // 5 seconds { -536, -88, -248}, { -568, -176, -248}, { -520, -248, -144}, { -648, -80...
{ 1184, 536, 120}, { 1328, 584, 200}, { 1552, 368, 144}, { 1088, 288, 40}, { 1192, 256, 104}, { 1776, 112, 304}, { 1856, -72, 456}, { 1640, -112, 224}, { 1368, -48, 144}, { 1136, 24, 136}, { 1056, 32, 40}, { 1128, -80, 72}, { 1064, -208, 24}, { 760, -312, -40}, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return window && window->is_render_scheduled; }
WeatherDBEntry *prv_create_entry(const WeatherDBEntry *base_entry, char *location, char *phrase, size_t *size_out) { PascalString16List pstring16_list; PascalString16 *location_name; PascalString16 *short_phrase; size_t data_size; location_name = pstring_create_pstring...
cl_assert_equal_i(to_check->last_update_time_utc, original->last_update_time_utc)
; PascalString16List pstring16_list; pstring_project_list_on_serialized_array(&pstring16_list, &to_check->pstring16s); cl_assert_equal_i(pstring16_list.count, 2); PascalString16 *pstring; pstring = pstring_get_pstring16_from_list(&pstring16_list, 0); int index = weather_shared_data_get_index_of_key(key)...
hGraphCard *graph_card, GContext *ctx, int offset_x, int offset_y, int height) { const GRect *bounds = &graph_card->layer.bounds; const GRect avg_text_box = {{ offset_x, offset_y }, { bounds->size.w, height }}; graphics_draw_text(ctx, graph_card->info_avg, graph_card->legend_fon...
(graph_card, ctx, cursor_x, info_offset_y, custom_text_size)
(dstbuf, 256, "There are %u lights, %u", 4, -4)
; cl_assert_equal_s(dstbuf, "There are 4 lights, 4294967292"); // Alternate form snprintf(dstbuf, 256, "There are %#u lights, %#u", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, 4294967292"); // Zero padded minimum character output snprintf(dstbuf, 256, "There are %02u lights, %02u", 4, -4); cl...
was_mini_peek); animation_set_handlers(intro, (AnimationHandlers) { .started = prv_intro_or_exit_anim_started, .stopped = prv_intro_anim_stopped, }, data); data->current_animation = intro; animation_schedule(intro); if (!layer_get_hidden((Layer *)&data->peek_layer)) { prv_scale_peek_to_first_pin...
prv_get_icon_animation_frame(data, &icon_from, use_pin, shift_offscreen)
; peek_layer_set_icon_with_size(peek_layer, &first_timeline_layout->icon_info, TimelineResourceSizeTiny, icon_from); } else { const bool use_pin = false; prv_setup_peek_animation(data, &first_timeline_layout->icon_info, use_pin); } } static void NOINLINE prv_setup_peek...
/* * 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...
((uint8_t *)&received_crc, sizeof(received_crc))
; PBL_LOG(LOG_LEVEL_DEBUG, "VT Crc. Expected: 0x%x Received CRC: 0x%x", (int)expected_crc, (int)received_crc); return (received_crc == expected_crc); } static bool prv_send_hi_cmd(void) { uint8_t send[] = {'H', 'I'}; dialog_spi_transmit_data(send, sizeof(send)); uint8_t response[4] = {}; dialog...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert(data->updated); cl_assert_equal_p(*data->updated, false); *data->updated = true; recognizer_transition_state(recognizer, *data->new_state); }
} static bool prv_cancel(Recognizer *recognizer) { TestImplData *data = recognizer_get_impl_data(recognizer, &s_test_impl); cl_assert_equal_i(data->test, TEST_PATTERN); if (data->cancelled) { cl_assert_equal_b(*data->cancelled, false); *data->cancelled = true; } return true; } static void prv_reset...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(rv, MagCalStatusNoSolution)
; } } cl_assert_equal_i(rv, ((num_entries - 1) == i) ? MagCalStatusNewLockedSolutionAvail : MagCalStatusNewSolutionAvail); if (rv == MagCalStatusNewSolutionAvail) { solution_and_estimate_match(solution, s_sample_data[i].sphere_fit_corr); // should be avg of last 3 solutions } el...
micRegisters_PWR_CFG = 0x1F } PmicRegisters; //! The different power rails that our PMIC controls typedef enum PmicRail { PmicRail_BUCK1, //!< 1.2V PmicRail_BUCK2, //!< 1.8V PmicRail_LDO1, //!< 2.0V - Auto - RTC PmicRail_LDO2, //!< 3.2V - Manual - FPGA //! snowy_bb: 2.5V - Manual - MFi, Magnetometer //! s...
while (1) {}
__builtin_unreachable(); } return false; } static bool prv_set_mon_config_register(uint8_t value) { return prv_write_register(PmicRegisters_MON_CFG, value); } static bool prv_set_mon_config(const PmicMonConfig *config) { const uint8_t ratio_config = 4 - config->ratio; // 4:1 is 0b00, 1:1 is 0b11. con...
//////////////////////////////////////////// extern void gap_le_connect_bluetopia_connection_callback( unsigned int stack_id, GAP_LE_Event_Data_t* event_data, unsigned long CallbackParameter); void test_gap_le_connect__initialize(void) { fake_GAPAPI_init(); // Register slave connection event callback for tests...
gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_will_return(dcache_line_size, 1)
; cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x20, 0x1); cl_assert_equal_i(s_flush_addr, 0x20); cl_assert_equal_i(s_flush_size, 0x01); cl_assert_equal_i(s_invalidate_addr, 0x20); cl_assert_equal_i(s_invalidate_size, ...
e_c[TEST_FILE_C_SIZE]; static uint32_t num_pages(void) { return pfs_get_size() / PFS_SECTOR_SIZE; } void test_pfs__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); // should have: this should be baked into an image. Perhaps with a test run ...
(fd == E_DOES_NOT_EXIST)
; char name[] = {'a'}; int fds[100]; // arbitrarily large # of FDs int i; for (i = 0; i < (sizeof(fds) - 1); i++) { fds[i] = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); name[0]++; if (fds[i] < 0) { break; } } cl_assert(fds[i] == E_OUT_OF_RESOURCES); for (int j = 0; j < i; j...
/* * 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...
sys_process_set_exit_reason(exit_reason)
; cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + 10); // Cancel wakeup event sys_wakeup_delete(wakeup_id); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); // Schedule again wakeup_id = sys_wakeup_schedule(sys_get_time() + 10, 0, false); cl_assert_equal_i(sys_wakeup_que...
sys_wakeup_schedule(first_event, 0, false)
; cl_assert_equal_i(sys_wakeup_query(first_wakeup_id), first_event); TimerID first_timer = wakeup_get_current(); // Schedule another a minute away time_t second_event = sys_get_time() + WAKEUP_EVENT_WINDOW * 2; WakeupId second_wakeup_id = sys_wakeup_schedule(second_event, 0, false); cl_assert_equal_i(sys_...
en we start up cl_assert_equal_i(s_hrm_manager_update_interval, 1); // The last update time should be 0 int32_t last_update_utc; activity_get_metric(ActivityMetricHeartRateRawUpdatedTimeUTC, 1, &last_update_utc); cl_assert_equal_i(last_update_utc, 0); // Simulate callbacks one second away from turning dow...
(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, &last_update_utc)
; cl_assert_equal_i(last_median, 51); cl_assert(last_update_utc >= rtc_get_time() - 1); cl_assert(last_update_utc <= rtc_get_time()); // Reset the stats, the median should be 0 activity_metrics_prv_reset_hr_stats(); activity_metrics_prv_get_median_hr_bpm(&median, &total_weight); cl_assert_equal_i(median,...
/* * 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_transport = fake_transport_create(TransportDestinationSystem, NULL, NULL); s_session = fake_transport_set_connected(s_transport, true); }
s_default_connection_state = connected; regular_timer_init(); debounced_connection_service_init(); } static void check_connected(void) { // Connected = true cl_assert(sys_mobile_app_is_connected_debounced()); } static void check_waiting_to_send_disconnect(void) { // Connected = true cl_assert(sys_m...
/* * 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 (size_t i = 0; i < CONTENT_INDICATOR_BUFFER_SIZE; i++) { content_indicator_init(&content_indicator); helper_check_buffer_for_content_indicator(i, &content_indicator); }
// Initializing more content indicators than the buffer can hold should assert cl_assert_passert(content_indicator_init(&content_indicator)); } void test_content_indicator__deinit_should_remove_from_buffer(void) { ContentIndicatorsBuffer *content_indicators_buffer = content_indicator_get_current_buffer(); Bu...
CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 11 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 11...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); #endif // SW = 5 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 5); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_R...
Resetting...", data)); peek_layer_set_background_color(peek_layer, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite)); peek_layer_play(peek_layer); layer_add_child(&window->layer, &peek_layer->layer); // give it a chance to animate const uint32_t factory_reset_start_delay = 100; app_timer_register(PEEK_LAYER...
(action_bar, BUTTON_ID_UP, data->action_bar_icon_check)
; action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, data->action_bar_icon_x); } static void prv_window_unload(Window *window) { ConfirmUIData *data = window_get_user_data(window); gbitmap_destroy(data->action_bar_icon_check); gbitmap_destroy(data->action_bar_icon_x); i18n_free_all(data); app_free(data)...
we explicitly do not allow stop mode. // FIXME: This seems overly cautious to me, we shouldn't have to do this. stop_mode_disable(InhibitorMain); // Turn off power to internal flash when in stop mode periph_config_enable(PWR, RCC_APB1Periph_PWR); pwr_flash_power_down_stop_mode(true /* power_down */); perip...
pulse_logging_init()
; #endif pebble_task_configure_idle_task(); task_init(); memory_layout_setup_mpu(); board_early_init(); display_show_splash_screen(); kernel_applib_init(); system_task_init(); events_init(); new_timer_service_init(); regular_timer_init(); clock_init(); task_watchdog_init(); analytics_...
---------------------------------------- HealthValue health_service_peek_current_value(HealthMetric metric) { time_t now_utc = sys_get_time(); return health_service_aggregate_averaged(metric, now_utc, now_utc, HealthAggregationAvg, HealthServiceTimeScopeOnce); } static H...
(state, metric, &averages, local_tm->tm_wday)
) { result += prv_sum_intraday_averages(&averages, time_start, time_end); num_sums++; } } else if ((scope == HealthServiceTimeScopeDaily) || (scope == HealthServiceTimeScopeDailyWeekdayOrWeekend)) { for (DayInWeek day = Sunday; day <= Saturday; day++) { if (scope == Health...
] = 800, [BMA255Axis_Z] = 400, }; static const char AXIS_NAMES[] = { [BMA255Axis_X] = 'X', [BMA255Axis_Y] = 'Y', [BMA255Axis_Z] = 'Z', }; static const uint8_t AXIS_REGISTERS[] = { [BMA255Axis_X] = BMA255Register_ACCD_X_LSB, [BMA255Axis_Y] = BMA255Register_ACCD_Y_LSB, [BMA255Axis_Z] = BMA255Register_ACCD...
bma255_read_register(BMA255Register_INT_STATUS_2)
; const uint8_t int_status_3 = bma255_read_register(BMA255Register_INT_STATUS_3); char buf[64]; prompt_send_response_fmt(buf, 64, "(0x10) Bandwidth: 0x%"PRIx8, bw); prompt_send_response_fmt(buf, 64, "(0x11) LPW: 0x%"PRIx8, lpw); prompt_send_response_fmt(buf, 64, " suspend: 0x%"PRIx8, (lpw & (1 << 7)) != 0)...
ame dummy configuration (which has the same layer) to configure a different // direction should fail cl_assert(!content_indicator_configure_direction(&content_indicator, ContentIndicatorDirectionDown, &dummy_config...
cl_assert(buffer->bytes_written == sizeof(ContentIndicator *))
; // Finally, calling content_indicator_get_for_scroll_layer() again should return the same // ContentIndicator ContentIndicator *content_indicator2 = content_indicator_get_for_scroll_layer(&scroll_layer); cl_assert(content_indicator2); cl_assert_equal_p(content_indicator2, content_indicator); // The buffe...
ile (s_vibe_history && s_vibe_history->time_end != END_NOT_SET) { VibeHistory *vibe = s_vibe_history; if (cutoff != HISTORY_CLEAR_ALL && vibe->time_end >= cutoff) { break; } s_vibe_history = (VibeHistory*)list_get_next((ListNode*)vibe); kernel_free(vibe); } } DEFINE_SYSCALL(void, sys_vibe_h...
(s_vibe_pattern_mutex)
; // remove the event I've finished VibePatternStep *removed_node = s_vibe_queue_head; s_vibe_queue_head = (VibePatternStep*)list_pop_head((ListNode*)s_vibe_queue_head); kernel_free(removed_node); if (s_vibe_queue_head != NULL) { // move to the next step prv_vibes_set_vibe_strength(s_vibe_queue_head...
{ -624, 656, -488}, { -576, 608, -368}, { -544, 544, -280}, { -520, 424, -176}, { -512, 408, -200}, { -520, 568, -224}, { -616, 520, -176}, { -672, 680, -176}, { -680, 760, -152}, { -664, 776, -112}, { -608, 776, -208}, // 322 seconds { -568, 688, -280}, { -544, ...
{ -840, -96, -312}, { -824, -72, -384}, { -840, -96, -344}, { -848, -64, -272}, { -816, -16, -360}, { -800, -8, -408}, { -856, 8, -304}, { -920, -8, -296}, { -896, -136, -392}, { -984, -112, -400}, { -1040, -120, -320}, { -992, -160, -368}, { -920, -176, -416}, { ...
{ -40, 664, -880}, { -72, 584, -840}, { -136, 656, -864}, { -168, 672, -864}, { -144, 696, -816}, { -80, 648, -840}, { -16, 560, -864}, { 16, 488, -896}, { 48, 368, -904}, // 330 seconds { 64, 320, -936}, { 48, 392, -1000}, { -8, 440, -944}, { -48, 464, -976}, ...
k_handler(ClickRecognizerRef recognizer, Window *window) { AppState *data = window_get_user_data(window); ButtonId button = click_recognizer_get_button_id(recognizer); GRect frame = data->text_layer.layer.frame; if (button == BUTTON_ID_UP) { if (data->select_index == SelectIndexPixels) { // Do invers...
fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)
er_update_callback); layer_render_tree(&layer, &ctx); #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_clear.8bit.pbi")); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } #define RADIUS_DEFAULT 4 #define...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi"))
the timeout immediately. This will result the in the timer being rescheduled if we're still // waiting for an ack. check_ack_timeout(); return; } // Convert from ticks to ms for the timer RtcTicks ticks_until_timeout = soonest_ack_timeout - current_ticks; uint32_t ms_until_timeout = ((uint64_t) ti...
if (!sb) { mutex_unlock(s_endpoint_data.mutex); return false; }
analytics_inc(ANALYTICS_DEVICE_METRIC_DATA_LOGGING_ENDPOINT_SENDS, AnalyticsClient_System); const DataLoggingSendDataMessage header = (const DataLoggingSendDataMessage) { .command = DataLoggingEndpointCmdData, .session_id = logging_session->comm.session_id, .items_left_hereafter = 0xf...
EraseCommand }; } void flash_erase_sector_blocking(uint32_t subsector_addr) { s_command_list[s_command_list_index++] = (EraseCommand) { .addr = subsector_addr, .type = SectorEraseCommand }; } // Tests /////////////////////////////////////////////////////////// void test_flash_region__initialize(void) { s_command...
(s_command_list[2].addr, 68 * 1024)
; cl_assert_equal_i(s_command_list[2].type, SubsectorEraseCommand); s_command_list_index = 0; // App that's in an unaligned bank but smaller than 64k flash_region_erase_optimal_range(32 * 1024, 32 * 1024, (32 + 18) * 1024, (32 + 96) * 1024); cl_assert_equal_i(s_command_list_index, 5); cl_assert_equal_i(...
fset_aa_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 2); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFS...
(&ctx.dest_bitmap, "draw_rect_offset_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, fal...
ssage_Param_v1 *msg = (BinLogMessage_Param_v1 *)&msg_buffer[sizeof(HcProtocolMessage)]; msg->header.version = BINLOGMSG_VERSION_PARAM_V1; msg->header.length = msg_size; msg->header.time.millisecond = LEVEL_MAP[level]; // HACK: Carry the level in the millisecond field // msg->header.date & msg->header.time will...
va_start(args, fmt)
; msg->body.length = vsnprintf((char *)msg->body.string, max_str_len, fmt, args); va_end(args); // Temporarily force NULL termination. The buffer is already set to zero -- increment the length // by one to reflect the increased string length // TODO: remove NULL termination msg->body.length++; // Calcul...
SystemCertificationMenuItem *item) { PBL_ASSERTN(item->draw_cell_fn); cd->menu_items = app_realloc(cd->menu_items, sizeof(*cd->menu_items) * ++cd->menu_count); PBL_ASSERTN(cd->menu_items); cd->menu_items[cd->menu_count - 1] = *item; } static void prv_append_regulatory_comp...
cd->menu_items[cell_index->row].select_cb(cd)
; } } static void prv_certification_window_load(Window *window) { SettingsSystemData *data = (SettingsSystemData*) window_get_user_data(window); prv_init_status_bar(&data->status_layer, &data->window, i18n_get("Certification", data)); SystemCertificationData *cd = &data->certification_data; *cd = (SystemCe...
_cache_len; i++) { FilePageCache *pgc = &f->pg_cache[i]; if (pgc->virtual_pg > pages_to_seek) { continue; } else if ((closest_match == -1) || (f->pg_cache[closest_match].virtual_pg < pgc->virtual_pg)) { closest_match = i; } } } if (closest_m...
(buf + bytes_read, bytes_to_read, prv_page_to_flash_offset(file->curr_page) + AVAIL_BYTES_OFFSET + pg_offset)
romRGB(red, green, blue) GColorARGB8FromRGBA(red, green, blue, 255) #define GColorARGB8FromHEX(v) \ GColorARGB8FromRGB(((v) >> 16) & 0xff, ((v) >> 8) & 0xff, ((v) & 0xff)) // if performance ever becomes an issue with this, we can sort the names and to a binary search T_STATIC const RockyAPIGraphicsColorDefinition s_...
GColorARGB8FromHEX(0xfffacd)
/* * 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_background_color(&dialog->window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite))
; // initial values dialog->icon_anim_direction = DialogIconAnimationFromRight; dialog->destroy_on_pop = true; dialog->text_color = GColorBlack; } void dialog_pop(Dialog *dialog) { window_stack_remove(&dialog->window, DIALOG_IS_ANIMATED); } void dialog_push(Dialog *dialog, WindowStack *window_stack) { wi...
/* * 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_close(fd); if (delete_file) { pfs_remove(ORDER_FILE); } mutex_unlock(s_data.order_mutex); return storage; }
//! Should be called on system task. static void prv_app_order_write_order(AppMenuOrderStorage *storage) { mutex_lock(s_data.order_mutex); int storage_size = sizeof(AppMenuOrderStorage) + (storage->list_length * sizeof(AppInstallId)); int fd = pfs_open(ORDER_FILE, OP_FLAG_OVERWRITE, FILE_TYPE_STATIC, storage_...
ue + (FIXED_S16_3_ONE.raw_value / 2)) / FIXED_S16_3_ONE.raw_value; if (x1_rounded > x2_rounded) { // AA algorithm will draw lines in one way only, so non-AA should reject those too return; } prv_assign_line_horizontal_non_aa(ctx, y, x1_rounded, x2_rounded); } void graphics_private_draw_vertical_line(GC...
{ return; }
int16_t y_min = MAX(MIN(y0, y1), clip_box->origin.y); int16_t y_max = MIN(MAX(y0, y1), clip_box->origin.y + clip_box->size.h); #if PBL_COLOR color.a = (uint8_t)(MAX_PLOT_BRIGHTNESS - opacity); #else if (opacity > (MAX_PLOT_BRIGHTNESS / 2)) { // We're not plotting anything, bail return; } #endif // ...
pping at the top of the character. We need to skip a number of bits in our source data. const unsigned int bits_to_skip = glyph_metrics.size.w * (clipped_glyph_target.origin.y - glyph_target.origin.y); if (bits_to_skip) { glyph_block += bits_to_skip / 32; src = *glyph_block; // Simulate the rotate that...
{ GColor dest_color; if (ctx->draw_state.compositing_mode == GCompOpSet) { // Blend (i.e. for transparency) if GCompOpSet dest_color = gcolor_alpha_blend(ctx->draw_state.text_color, (GColor) {.argb = dest_addr[bitindex]});...
} } #else if (gcolor_equal(ctx->draw_state.text_color, GColorBlack)) { *(dest_block) &= ~(mask & src); } else { *(dest_block) |= mask & src; } #endif dest_shift = (dest_shift + number_of_bits) % 32; glyph_block_bits_left -= number_of_bits; glyph_line_b...
&s_phone_ui_data->select_bitmap); prv_set_action_bar_icon(BUTTON_ID_DOWN, down_icon, &s_phone_ui_data->down_bitmap); } else { prv_hide_action_bar(); } action_bar_layer_set_click_config_provider(&s_phone_ui_data->action_bar, prv_click_config_provider); } //! ...
(window, WINDOW_NAME("Phone"))
; window_set_status_bar_icon(window, (GBitmap*)&s_status_icon_phone_bitmap); layer_set_update_proc(&window->layer, prv_window_update_proc); window_set_window_handlers(&s_phone_ui_data->window, &(WindowHandlers) { .unload = prv_handle_window_unload, }); window_set_overrides_back_button(window, true); #if !...
->stroke_width > 0)) { graphics_context_set_stroke_color(ctx, command->stroke_color); graphics_context_set_stroke_width(ctx, command->stroke_width); gpath_draw_stroke(ctx, &path, command->path_open); } } static void prv_draw_circle(GContext *ctx, GDrawCommand *command) { // draw all values of alpha, ex...
{ if (!command || (command->type != GDrawCommandTypeCircle)) { return 0; } return command->radius; }
void gdraw_command_set_path_open(GDrawCommand *command, bool path_open) { if (!command || ((command->type != GDrawCommandTypePath) && (command->type != GDrawCommandTypePrecisePath))) { return; } command->path_open = path_open; } bool gdraw_command_get_path_open(GDrawCommand *command) { if (!...
PIC, QSPIC_CTRLMODE_REG, QSPIC_USE_32BA, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_FORCENSEQ_EN, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_PCLK_MD, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_RPIPE_EN, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_RXD_NEG, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMOD...
(GPREG, PLL_SYS_CTRL3_REG, PLL_RECALIB, 0x0)
; // GUESS REG_SETF(GPREG, PLL_SYS_CTRL3_REG, PLL_START_DEL, 0xF); REG_SETF(GPREG, PLL_SYS_CTRL3_REG, PLL_ICP_SEL, 0x9); REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_LOCK_DET_RES_CNT, 0x0); REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_SEL_R_DIV_TEST, 0x0); REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_SEL_N_DIV_TEST, 0x0); REG_...
tMetricType_Speed; if (metric_type != data->pace_speed_metric) { data->pace_speed_metric = metric_type; prv_update_scrollable_metrics(data); } break; } case SPORTS_UNITS_KEY: break; case SPORTS_HRM_KEY: { // This returns if the SPORTS_HRM_KEY value has not c...
app_sync_get(&data->sync, SPORTS_UNITS_KEY)
; uint8_t is_metric = 1; if (metric_tuple != NULL) { is_metric = MIN(metric_tuple->value->uint8, 1); } if (is_metric) { return km_string; } else { return miles_string; } } static char *prv_get_custom_metric_label_string(void) { SportsAppData *data = app_state_get_user_data(); return data->...
{ -368, 472, 304}, { -400, 512, 448}, { -360, 648, 424}, { -440, 840, 776}, // 420 seconds // elapsed: 7 minutes { -320, 848, 728}, { -400, 848, 672}, { -448, 856, 720}, { -304, 832, 688}, { -200, 840, 504}, { -240, 760, 464}, { -264, 624, 376}, { -312, 504, 288}...
{ -400, 584, 376}, { -440, 496, 328}, { -504, 464, 352}, { -576, 464, 328}, { -640, 472, 304}, { -720, 536, 384}, { -760, 712, 480}, { -744, 784, 608}, { -840, 936, 792}, { -624, 856, 672}, { -560, 632, 592}, { -528, 552, 560}, { -376, 504, 416}, { -400, 408, 344}...
const InterpolateInt64Function interpolate = is_hasted ? timeline_animation_interpolate_moook_second_half : timeline_animation_interpolate_moook_soft; Animation *move_animation = timeline_layer_create_up_down_animation( &data->timeline_layer, duration, interpolate); if (timeline_layer_should_an...
static void prv_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_BACK, prv_back_click_handler); window_single_click_subscribe(BUTTON_ID_UP, prv_up_down_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_up_down_click_handler); window_single_click_subscribe(BUTTON_I...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (context->window_to) { // store starting position of window_to to know which pixels to update context->window_to_last_x = context->window_to->layer.frame.origin.x; }
/* * 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...
DFSDM_FilterCmd(this->filter, DISABLE)
/* * 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_time_base += new_ms / 1000; }
s_time_ms_base = new_ms % 1000; } void fake_rtc_set_ticks(RtcTicks new_ticks) { s_rtc_tick_count = new_ticks; } void fake_rtc_increment_ticks(RtcTicks tick_increment) { s_rtc_tick_count += tick_increment; } void fake_rtc_auto_increment_ticks(RtcTicks auto_increment) { s_rtc_auto_increment = auto_increment; ...
rmal mode, and attempt to reconnect to // the phone. void accel_enable_high_sensitivity(bool high_sensitivity) { mutex_lock_recursive(s_accel_manager_mutex); accel_set_shake_sensitivity_high(high_sensitivity); mutex_unlock_recursive(s_accel_manager_mutex); } /* * Driver Callbacks - See accel.h header for more c...
prompt_send_response_fmt(buffer, sizeof(buffer), "X: %"PRId16, data.x)
; prompt_send_response_fmt(buffer, sizeof(buffer), "Y: %"PRId16, data.y); prompt_send_response_fmt(buffer, sizeof(buffer), "Z: %"PRId16, data.z); } void command_accel_num_samples(char *num_samples) { int num = atoi(num_samples); mutex_lock_recursive(s_accel_manager_mutex); accel_set_num_samples(num); mutex...
true); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_i(windows[1][0]->on_screen, true); cl_assert_equal_i(windows[1][0]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][1]); for (ModalPriority idx = ModalPriorityMin; idx < NumModalPri...
(windows[3][1]->on_screen, true)
; cl_assert_equal_i(windows[3][1]->is_click_configured, false); cl_assert_equal_i(windows[3][0]->on_screen, false); cl_assert_equal_i(windows[3][0]->is_click_configured, false); cl_assert_equal_i(windows[2][1]->on_screen, false); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_...
!(modal_manager_get_properties() & ModalProperty_Unfocused)); if (is_modal_focused) { // mask the app task if a modal is on top e->task_mask |= 1 << PebbleTask_App; modal_manager_handle_button_event(e); return; } if (watchface_running) { watchface_handle_button_event(e); ...
app_fetch_put_bytes_event_handler(&e->put_bytes)
; #endif return; case PEBBLE_SYSTEM_MESSAGE_EVENT: firmware_update_event_handler(&e->firmware_update); return; case PEBBLE_ECOMPASS_SERVICE_EVENT: #if CAPABILITY_HAS_MAGNETOMETER ecompass_service_handle(); #endif return; case PEBBLE_SET_TIME_EVENT: { #ifndef RECOVERY_FW ...
er_is_app_supported(const PebbleProcessMd *md) { // Get the app ram size depending on the SDK type. // Unsupported SDK types will have a size of 0. return prv_get_app_segment_size(md) > 0; } // Commands /////////////////////////////////////////////////////////// void command_get_active_app_metadata(void) { c...
(app_manager_get_current_app_md())
ColorWhite.g == 0b11); cl_assert(GColorWhite.b == 0b11); cl_assert(GColorWhite.a == 0b11); } void test_graphics_colors__red(void) { cl_assert(GColorRed.r == 0b11); cl_assert(GColorRed.g == 0b00); cl_assert(GColorRed.b == 0b00); cl_assert(GColorRed.a == 0b11); } void test_graphics_colors__green(void) { c...
(GColorLightGrayARGB8, gcolor_get_grayscale(GColorTiffanyBlue).argb)
; cl_assert_equal_i(GColorDarkGrayARGB8, gcolor_get_grayscale(GColorOrange).argb); } void test_graphics_colors__bw_colors(void) { cl_assert_equal_i(GColorClearARGB8, gcolor_get_bw(GColorClear).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_bw(GColorWhite).argb); cl_assert_equal_i(GColorBlackARGB8, gcolo...
/* * 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...
(health_data)
; layer_set_frame(card_layer, &window_layer->bounds); layer_add_child(window_layer, card_layer); window_set_background_color(&window, health_activity_summary_card_get_bg_color(card_layer)); window_set_on_screen(&window, true, true); window_render(&window, &s_ctx); } // Tests ////////////////////// void test...
.text_attributes = (GTextAttributes *)123; rocky_global_deinit(); cl_assert_equal_i(1, s_fonts_get_system_font.call_count); cl_assert_equal_i(1, s_graphics_text_attributes_destroy.call_count); } void test_rocky_api_graphics__request_draw(void) { rocky_global_init(s_graphics_api); cl_assert_equal_i(0, s_laye...
(expected_rect, s_graphics_draw_rect_precise.last_call.prect)
; } #define PP(x, y) (GPointPrecise( \ (int16_t)((x) * FIXED_S16_3_FACTOR), \ (int16_t)((y) * FIXED_S16_3_FACTOR))) void test_rocky_api_graphics__fill_radial(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, 10, 20, 0, Math.PI);\n" ); cl_assert_equal_i(1, s_graphics...
{ PBL_LOG(LOG_LEVEL_WARNING, "Found reminder with invalid key size %d; ignoring.", info->key_len); }
return true; } SerializedTimelineItemHeader hdr; info->get_val(file, &hdr, sizeof(SerializedTimelineItemHeader)); // Restore flags & status hdr.common.flags = ~hdr.common.flags; hdr.common.status = ~hdr.common.status; NextInfo *next_info = (NextInfo *)context; time_t timestamp = timeline_item_get...
/* * 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...
{ //uint8_t *buffer = (uint8_t *)"hello world"; CommSession *session = comm_session_get_system_session(); if (!session) { s_pending_count--; s_connected = false; return; } PBL_LOG(LOG_LEVEL_INFO, "sending data"); comm_session_send_data(session, 2000, (uint8_t *)0x08000000, ...
// ================================================================================= // You can capture when the user selects a menu icon with a menu item select callback static void menu_select_callback(int index, void *ctx) { PBL_LOG(LOG_LEVEL_DEBUG, "Hit menu item %d", index); // Here we just change the su...
vice's delta position to help determine movement as idle. static uint32_t prv_compute_delta_pos(AccelData *cur_pos, AccelData *last_pos) { return (abs(last_pos->x - cur_pos->x) + abs(last_pos->y - cur_pos->y) + abs(last_pos->z - cur_pos->z)); } //! The orientation of the accelerometer is checked every minu...
{ #if !STATIONARY_MODE return; #endif const bool inhibit = !enable; if (inhibit == s_stationary_mode_inhibit) { return; } s_stationary_mode_inhibit = inhibit; launcher_task_add_callback(prv_update_stationary_enabled, NULL); }
void stationary_wake_up(void) { if (!prv_is_allowed_to_run()) { return; } prv_handle_action(StationaryActionWakeUp); } static void prv_reset_stationary_counter(void) { s_stationary_count_down = STATIONARY_WAIT_BEFORE_ENGAGING_TIME_MINS; } static void prv_enter_awake_state(void) { PBL_LOG(LOG_LEVEL_INF...
/* * 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...
portENTER_CRITICAL()
/* * 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...
gdraw_command_image_draw_processed(ctx, image, offset, NULL)
; } void gdraw_command_image_draw_processed(GContext *ctx, GDrawCommandImage *image, GPoint offset, GDrawCommandProcessor *processor) { if (!ctx || !image) { return; } // Offset graphics context drawing box origin by specified amount graphics_context_move_draw_box(c...
.duration = 120, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, } }, { .header = { .id = {0xdd}, .parent_id = {0}, .timestamp = s_feb_5_midnight + 8 * 60 * 60 + 15 * 60, // 8:15-8:16 am .duration = 1, .type = TimelineItemTypePin, .flags =...
cl_assert(iter_next(&iterator))
; cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)); // check fourth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); // check third again cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)...
A == *resp_ptr); resp_ptr += sizeof(uint8_t); cl_assert((resp_ptr - s_data) == s_sending_data_length); } /************************************************** * Checking for length data mismatch INSERT command * **************************************************/ static const uint8_t s_insert_cmd_size_value_wron...
((resp_ptr - s_data) == s_sending_data_length)
; } /************************************* * Checking for valid CLEAR command * *************************************/ static const uint8_t s_clear_cmd_success[] = { // Message Header 0x05, // Pebble protocol message ID: DELETE 0x17, 0x00, // Token TEST_DB_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...
(get_bitmap_bit(test_image_color, 30, 30) == 1)
; #elif SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gcolor_equal(get_bitmap_color(test_image_bw, 8, 16), GColorWhite)); cl_check(gcolor_equal(get_bitmap_color(test_image_bw, 8, 24), GColorBlack)); cl_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 2), GColorClear)); cl_check(gcolor_equal(get_bitmap_color(te...
newer version of the Pebble firmware."); dialog_set_text(dialog, i18n_get(error_text, expandable_dialog)); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_SMALL); i18n_free(error_text, expandable_dialog); if (pebble_task_get_current() == PebbleTask_KernelMain) { WindowStack *window_stack = modal_manage...
{ app_manager_launch_new_app(&(AppLaunchConfig) { .md = md, .common = config->common, .forcefully = config->forcefully, }); }
} // --------------------------------------------------------------------------------------------- extern void analytics_external_collect_app_cpu_stats(void); extern void analytics_external_collect_app_flash_read_stats(void); static void prv_handle_app_stop_analytics(const ProcessContext *const context, ...
SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating } FindByAddrItrData *itr_data = (FindByAddrItrData *) context; BTBondingID key; BtPersistBondingData stored_data; info->get...
itr_data->cb(&stored_data->ble_data.pairing_info.identity, &stored_data->ble_data.pairing_info.irk, stored_data->ble_data.name, &key, itr_data->cb_data)
; } static bool prv_ble_pairing_internal_for_each_itr(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating } ForEachBLEPa...
xt_set_stroke_color(GContext* ctx, GColor color) { record_mock_call(s_graphics_context_set_stroke_color) { .ctx = ctx, .color = color, }; ctx->draw_state.stroke_color = color; } static MockCallRecordings s_graphics_context_set_stroke_width; void graphics_context_set_stroke_width(GContext* ctx, uint8_t stroke...
(JERRY_INIT_EMPTY)
{ int stage = s_sys_activity_get_minute_history_values.stage++; cl_assert(stage < ARRAY_LENGTH(s_sys_activity_get_minute_history_values.out)); sys_activity_get_minute_history_out_values *out = &s_sys_activity_get_minute_history_values.out[stage]; cl_assert_equal_b(out->asserts, false); cl_assert(minute...
static bool s_activity_sessions_ongoing[ActivitySessionTypeCount]; bool sys_activity_sessions_is_session_type_ongoing(ActivitySessionType type) { return s_activity_sessions_ongoing[type]; } ///////////////////////////////////////// void test_health__initialize(void) { TimezoneInfo tz_info = { .tm_zone = "...
= actual->value - expected->value; printf(" (%3d,%3d) %s%3d (%+4d) ", expected->min, expected->max, indicator, actual->value, delta); } else { printf(" (NA, NA ) %s%3d ", indicator, actual->value); } } printf(" %-10.2f %-10s", results->weighted_err, status);...
rtc_set_time(now)
; } } // --------------------------------------------------------------------------------------- // Test that we correectly recognize walk and run activities void test_kraepelin_algorithm__walks_and_runs(void) { const int k_minute_data_len = 60; const int k_minute_data_bytes = k_minute_data_len * sizeof(KAlgTest...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_b(shared_prf_storage_get_ble_pairing_data(NULL, NULL, NULL, NULL), false)
; } void test_shared_prf_storage_v2__getting_started_complete(void) { shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false); shared_prf_storage_set_getting_started_complete(true); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), true); ...
OG(LOG_LEVEL_DEBUG, " - GSR"); } if (app_ids & AS7000AppId_NTC) { PBL_LOG(LOG_LEVEL_DEBUG, " - NTC"); } } } static bool prv_get_and_log_device_info(HRMDevice *dev, AS7000InfoRecord *info, bool log_version) { // get the device info if (!prv_read_register_b...
PBL_LOG(LOG_LEVEL_ERROR, "Trying to enable HRM before initialization.")
; } else if (dev->state->enabled_state == HRMEnabledState_Disabled) { led_enable(LEDEnablerHRM); analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_HRM_ON_TIME, AnalyticsClient_System); // Enable the device and schedule a timer callback for when we can start communicating with it. gpio_output_set(&de...
w.window); } } static void prv_exit_and_send_result_event(VoiceUiData *data, DictationSessionStatus result) { VOICE_LOG("Send result"); PebbleEvent event = { .type = PEBBLE_DICTATION_EVENT, .dictation = { .result = result, .text = (result == DictationSessionStatusSuccess) ? data->message : N...
(data, i18n_noop("No internet connection"), RESOURCE_ID_CHECK_INTERNET_CONNECTION_LARGE, dialog_bg_color)
; data->error_exit_status = DictationSessionStatusFailureConnectivityError; } else { prv_exit_and_send_result_event(data, DictationSessionStatusFailureConnectivityError); } } static void prv_handle_bt_conn_result(bool connected, void *context) { VoiceUiData *data = context; if (connected) { if (dat...
c); PBL_ASSERTN(i2c_read_block(EWD1000->i2c, len, data)); i2c_release(EWD1000->i2c); } static void prv_wait_for_interrupt(void) { const RtcTicks timeout = rtc_get_ticks() + RTC_TICKS_HZ * INIT_TIMEOUT_S; while (gpio_input_read(&EWD1000->int_gpio)) { if (rtc_get_ticks() > timeout) { PBL_CROAK("Touch c...
(packet.packet_id == PACKET_ID_FLASH_RESPONSE)
ll be failed, rather than cancelled prv_set_all_states(recognizers, k_rec_count, RecognizerState_Possible); prv_cancel_layer_tree_recognizers(&manager, NULL, &layer_c); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Failed); cl_asse...
cl_assert_equal_p(manager.active_layer, &layer_c)
_page = test_get_file_start_page(fd); pfs_close_and_remove(fd); // lets force garbage collection on every sector test_force_garbage_collection(target_start_page); // now lets try to create a file fd = pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(file_name)); cl_assert_equal_i(target_start_p...
(fd, 0, FSeekSet)
*)list_get_next(&callback_node->list_node); } } status_t pfs_close(int fd) { mutex_lock_recursive(s_pfs_mutex); int res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; goto cleanup; } File *f = &PFS_FD(fd).file; if (f->is_tmp) { // TODO: For safety, could disallow this op if us...
read_header(pg, &pg_hdr, &file_hdr)
!= PageAndFileHdrValid) { PBL_LOG(LOG_LEVEL_WARNING, "%d: Invalid page/file header", pg); continue; } // Add a new entry PFSFileListEntry *entry = kernel_malloc_check(sizeof(PFSFileListEntry) + file_hdr.file_namelen + 1); *entry = (PFSFileL...
/* * 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, flip_lid_color); const int16_t circle_radius = DISP_COLS * 3 / 4; const GPoint display_center = GPoint(DISP_COLS / 2, DISP_ROWS / 2); // The flip overlap region is the intersection of the two large circles (think of a Venn diagram) const uint16_t flip_overlap_region_wid...
flip_boundary_from_x, flip_boundary_to_x); const GPoint circle_center = GPoint(current_flip_boundary_x + circle_radius - 1, display_center.y); if (...
app_name) { app_name = entry->name; } len = strlen(app_name) + 1; node->name = app_malloc_check(len); strncpy(node->name, app_name, len); prv_sorted_add(source, node); } static AppMenuNode * prv_find_node_with_install_id(const AppInstallId install_id, cons...
{ if (node->install_id == install_id) { return prv_transform_index(source, index); } node = (AppMenuNode*)list_get_next((ListNode*)node); ++index; }
ue__copy_less_than_head_job_zero_offset(void) { int num_jobs = 3; prv_add_jobs(num_jobs); uint8_t data_out[2]; memset(data_out, 0, sizeof(data_out)); cl_assert_equal_i(sizeof(data_out), comm_session_send_queue_copy(s_valid_session, 0, sizeof(data_out), data_out)); cl_assert_equal_m(data...
(s_free_count, num_jobs)
; } void test_session_send_queue__session_closed_when_add_is_called(void) { s_valid_session = NULL; SessionSendQueueJob *job = prv_create_test_job(TEST_DATA, sizeof(TEST_DATA)); comm_session_send_queue_add_job(s_valid_session, &job); cl_assert(!job); cl_assert_equal_i(s_free_count, 1); }
ped_ms = ((rtc_get_ticks() - bus->state->last_rail_stop_ticks) * RTC_TICKS_HZ) / 1000; I2C_DEBUG("Bus %s rail start after a delay of %"PRIu32"ms", bus->name, (uint32_t)time_stopped_ms); if (time_stopped_ms < MIN_STOP_TIME_MS) { I2C_DEBUG("Waiting %"PRIu32"ms before enabling I2C bus %s r...
mutex_unlock(slave->bus->state->bus_mutex)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ struct tm time_struct; gmtime_r(t, &time_struct); const bool result = rtc_sanitize_struct_tm(&time_struct); *t = mktime(&time_struct); return result; }
void rtc_get_time_tm(struct tm* time_tm) { time_t t = rtc_get_time(); localtime_r(&t, time_tm); } const char* rtc_get_time_string(char* buffer) { return time_t_to_string(buffer, rtc_get_time()); } const char* time_t_to_string(char* buffer, time_t t) { struct tm time; localtime_r(&t, &time); strftime(bu...
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...
(session, &s_put_bytes_endpoint, length)