prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_callback_events(0); // Expect 3rd message callbacks and still 1 drop callback (same as before): assert_num_message_callbacks(3); assert_message(2, s_test_data, BUFFER_SIZE); assert_num_dropped_callbacks(1); } void test_app_inbox__multiple_writes_consume_from_message_handler(void) { prv_create_test_inbox_...
app_inbox_destroy_and_deregister(s_inbox)
); cl_assert_equal_b(false, app_inbox_service_end(AppInboxServiceTagUnitTest)); } void test_app_inbox__app_inbox_service_end_inbox_closed_in_mean_time_with_pending_failure(void) { prv_create_test_inbox_and_begin_write(); // One message, too large, so it should get dropped: cl_assert_equal_b(false, app_inbox_se...
{ 0, 0x45, 0, 145, 0}, { 0, 0x45, 456, 148, 0}, { 0, 0x55, 57, 148, 0}, { 0, 0x55, 0, 148, 0}, { 0, 0x65, 209, 148, 0}, { 0, 0x66, 0, 144, 0}, // 480: Local time: 2015-11-15 04:38:00 AM { 0, 0x66, 0, 148, 0}, { 0, 0x66, 0, 148, 0}, { 0, 0x66, 0, 148, 0}, { 0, 0x66, 0, 148, 0}...
{ 0, 0x24, 0, 149, 0}, { 0, 0x45, 2134, 145, 0}, // 585: Local time: 2015-11-15 06:24:00 AM { 0, 0x67, 0, 148, 0}, { 0, 0x67, 0, 149, 0}, { 0, 0x67, 0, 148, 0}, { 0, 0x67, 0, 149, 0}, { 0, 0x67, 0, 150, 0}, { 0, 0x67, 0, 149, 0}, { 0, 0x67, 0, 149, 0}, { 0, 0x67, 0, 149, 0}, ...
{ 0, 0x6a, 0, 155, 0}, { 0, 0x6a, 0, 155, 0}, { 0, 0x6a, 0, 156, 0}, { 0, 0x6a, 15, 155, 0}, { 0, 0x69, 0, 157, 0}, { 0, 0x69, 0, 152, 0}, { 0, 0x59, 785, 151, 0}, { 0, 0x9, 0, 152, 0}, { 0, 0x9, 0, 151, 0}, { 0, 0x9, 0, 168, 0}, { 0, 0x3b, 2146, 164, 0}, // 645: Local t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(true /* write erase headers */)
; load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); } void t...
{ mutex_unlock(s_lock); voice_cancel_dictation(session_id); return; } s_state = SessionState_WaitForSessionResult; prv_stop_recording(); prv_start_result_timeout(); unlock: mutex_unlock(s_lock); } void voice_cancel_dictation(VoiceSessionId session_id) { mutex_lock(s_lock); if ((session_id !...
if (s_state == SessionState_Idle) { return false; }
// stop timer before changing state variable new_timer_stop(s_timeout); if (s_state != SessionState_WaitForSessionResult) { // This handles erroneous replies from the phone app (sometimes the phone app sends a session // result immediately after we start streaming PBL_LOG(LOG_LEVEL_WARNING, "Sessio...
config.end_quadrant.angle_end); // // if (config.full_quadrants != GCornerNone) { // graphics_circle_quadrant_draw_1px_aa(ctx, center, radius, config.full_quadrants); // } } inline void prv_vline_quadrant(GCornerMask quadrant, GCornerMask desired, GContext *ctx, int16_t x, ...
if (ctx->draw_state.antialiased) { if (stroke_width > 1) { // Antialiased and Stroke Width > 1 graphics_circle_quadrant_draw_stroked_aa(ctx, p, radius, stroke_width, quadrant); return; } else { // Antialiased and Stroke Width == 1 (not suppported on 1-bit color) graphics_circle_qua...
/* * 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...
memset(s_buffer, 0, BUFFER_LENGTH)
; while (callback(context)) { cl_assert(s_did_send_byte); } } void fake_accessory_get_buffer(uint8_t **buffer, int *length) { *buffer = s_buffer; *length = s_buffer_index; }
eak; case ActionResultTypeDoResponse: prv_handle_do_response_response(data); break; default: prv_cleanup_action_result(data, false /* success */); PBL_LOG(LOG_LEVEL_WARNING, "Unknown Action Response"); break; } } static void prv_subscribe_to_action_results_and_timeouts(ActionRes...
(pin, action, &response_attributes)
; break; } case TimelineItemActionTypePostpone: { Attribute timestamp_attr = { .id = AttributeIdTimestamp, .uint32 = (uint32_t)(uintptr_t)context, }; AttributeList response_attributes = { .num_attributes = 1, .attributes = &timestamp_attr, }; ...
(p.x, p.y - radius)); graphics_private_set_pixel(ctx, GPoint(p.x + radius, p.y)); graphics_private_set_pixel(ctx, GPoint(p.x - radius, p.y)); } #if PBL_COLOR T_STATIC void graphics_circle_draw_1px_aa(GContext* ctx, GPoint p, uint16_t radius) { graphics_circle_quadrant_draw_1px_aa(ctx, p, radius, GCornersAll); } ...
GPoint(x0 - x, y0 - y)
, x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 - x), y + 1); } if (quadrant & GCornerTopRight) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0, y0), radius + 1); } prv_fill_horizontal_line(ctx, GPoint(x0, y0 - y), x + 1); prv_fill_horizontal_line(ctx, GP...
} content_indicator_set_content_available(&health_card_view->up_indicator, ContentIndicatorDirectionUp, is_up_visible); // Down is always visible (the watchface is always an option) content_indicator_set_content_available(&healt...
prv_create_slide_animation(current_card_layer, &window_bounds, &curr_stop)
; Animation *next_in = prv_create_slide_animation(next_card_layer, &next_start, &window_bounds); Animation *bg_anim = animation_create(); animation_set_duration(bg_anim, interpolate_moook_soft_duration(NUM_MID_FRAMES)); animation_set_handlers(bg_anim, (AnimationHandlers){ .started = prv_bg_animation_star...
HZ) * RTC_TICKS_HZ; save_rtc_time_state_exact(current_rtc_ticks_at_second, ticks_to_time(s_coarse_ticks + current_rtc_ticks)); } static void initialize_fast_mode_state(void) { RtcIntervalTicks before_ticks = get_rtc_interval_ticks(); // Set the RTC to value 0 so we start from scratch nicely RTC_TimeTypeDef r...
RTC_ITConfig(RTC_IT_ALRA, DISABLE)
; RTC_AlarmCmd(RTC_Alarm_A, DISABLE); RTC_AlarmTypeDef alarm_config; RTC_AlarmStructInit(&alarm_config); alarm_config.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay; s_alarm_set_time = rtc_get_ticks(); RtcTicks alarm_expiry_time = s_alarm_set_time + num_ticks; uint32_t days, hours, minutes, seconds; time...
_timeout_10ms = atoi(timeout_10ms), }; GAPLEConnection *conn = prv_get_le_connection_and_print_info(); BTDeviceInternal addr = {}; if (conn) { addr.address = conn->device.address; } bt_driver_le_connection_parameter_update(&addr, &req); } // Not in a header because it's really only used ...
{ bt_driver_le_test_pa(index); prompt_send_response_fmt(buffer, sizeof(buffer), "BTLE PA set to: %s", s_btle_pa_config_strings[index]); }
} //# endif #endif extern void hc_endpoint_logging_set_level(uint8_t level); void command_ble_logging_set_level(const char *level) { char buffer[32]; int log_level = atoi(level); if (log_level < 0) { log_level = 0; } else if (log_level > 255) { log_level = 255; } hc_endpoint_logging_set_level(log_...
tAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_NEG, RECT_NEG, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL, GTextOverflowModeTrailingEll...
(&ctx, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR" "STUVWXYZabcdefghijklmnopqrstuvwxyz", &s_font_info, RECT_TEXT_0_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL)
_RECT_ELSE(18, 15); } // adjust rect for drawing the text node rect.origin.x -= PBL_IF_RECT_ELSE(1, 46); rect.size.w += (rl_margin * 2); GTextNode *text_node = prv_create_text_node(active_window, metric_type, prefer_larger_font, layer); graphics_text_node_draw...
(workout_dialog)
; workout_dialog_set_click_config_provider(workout_dialog, prv_end_workout_click_config_provider); workout_dialog_set_click_config_context(workout_dialog, context); app_workout_dialog_push(workout_dialog); } //////////////////////////////////////////////////////////////////////////////////////////////////// //...
) { .data = (uint8_t*)bitmap->addr + y * bitmap->row_size_bytes, .min_x = 0, // while this is conceptually wrong for .max_x as it should be // (.row_size_bytes / .bytes_per_pixel) - 1 // it's still a valid value as we assume grect_get_max_x(.bounds) < .row_size_bytes * bpp ...
{ return DISPLAY_FRAMEBUFFER_BYTES; }
#endif return gbitmap_format_get_row_size_bytes(size.w, format) * size.h; } static bool prv_gbitmap_allocate_data_for_size(GBitmap *bitmap, GSize size, GBitmapFormat format) { if (!bitmap) { return false; } bitmap->row_size_bytes = gbitmap_format_get_row_size_bytes(size.w, format); bitmap->bounds.size....
(&out_scl, GPIO_PuPd_NOPULL, GPIO_Speed_2MHz)
; gpio_output_set(&out_scl, true); bool recovered = false; for (int i = 0; i < MAX_TOGGLE_COUNT; ++i) { gpio_output_set(&out_scl, false); delay_ms(TOGGLE_DELAY); gpio_output_set(&out_scl, true); delay_ms(TOGGLE_DELAY); if (gpio_input_read(&in_sda)) { recovered = true; break; ...
/* * 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...
{ IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); IWDG_SetPrescaler(IWDG_Prescaler_64); // ~8 seconds IWDG_SetReload(0xfff); IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable); DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP, ENABLE); }
alue == 0) { passed = false; goto exit; } // Getting resting calories with anything other than sum should fail value = health_service_aggregate_averaged(HealthMetricRestingKCalories, time_start_of_today(), time(NULL), HealthAggregationAvg, ...
snprintf(temp, sizeof(temp), "%s: min: %"PRIi32", max: %"PRIi32", avg: %"PRIi32" \n", ranges[i].desc, min, max, avg)
; APP_LOG(APP_LOG_LEVEL_DEBUG, "%s", temp); prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); } prv_display_alert(data->debug_card.dialog_text); } // ----------------------------------------------------------------------------------------- static void debug_window_...
buffer, GRect *clip_box, int16_t x, Fixed_S16_3 y1, Fixed_S16_3 y2, GColor color) { if (gcolor_is_invisible(color)) { return; } // look for clipbox if (!WITHIN(x, clip_box->origin.x, grect_get_max_x(clip_box...
grect_contains_point(clip_box, &point)
) { return; } #if PBL_COLOR // Checking for data row min/max x const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer, y); if (!WITHIN(x, data_row_info.min_x, data_row_info.max_x)) { return; } GColor *output = (GColor *)(data_row_info.data + x); color.a = (uint8_t)(MAX_PLO...
// Set up a SPI bus on SPI1 SPI_InitTypeDef spi_cfg; SPI_I2S_DeInit(FLASH_CONFIG.spi); spi_cfg.SPI_Direction = SPI_Direction_2Lines_FullDuplex; spi_cfg.SPI_Mode = SPI_Mode_Master; spi_cfg.SPI_DataSize = SPI_DataSize_8b; spi_cfg.SPI_CPOL = SPI_CPOL_Low; spi_cfg.SPI_CPHA = SPI_CPHA_1Edge; spi_cfg.SPI_N...
prv_is_whoami_correct()
; } void flash_read_bytes(uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) { if (!buffer_size) { return; } prv_enable_flash_spi_clock(); prv_flash_wait_for_write(); prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ); prv_flash_send_24b_address(start_addr); while (...
#else #define PROF_LOG(buf, sz, fmt, ...) dbgserial_putstr_fmt(buf, sz, fmt, ## __VA_ARGS__) #endif Profiler g_profiler; #undef PROFILER_NODE #define PROFILER_NODE(name) ProfilerNode g_profiler_node_##name = {.module_name = #name}; #include "profiler_list.h" #undef PROFILER_NODE #if PROFILE_INTERRUPTS #define IRQ_DEF...
PROF_LOG(buf, sizeof(buf), "%-24s %-8"PRIu32" %-11"PRIu32" %-15"PRIu32" %-8"PRIu32 " %-7"PRIu32, node->module_name, node->count, node->total, node->total / mhz, (node->total/node->count)/mhz, percent)
/* * 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...
factory_registry_init()
; #endif } static struct ServiceRunLevelSetting s_runlevel_settings[] = { { .set_enable_fn = accel_manager_enable, .enable_mask = R_Stationary | R_FirmwareUpdate | R_Normal, }, { .set_enable_fn = light_allow, .enable_mask = R_LowPower | R_FirmwareUpdate | R_Normal, }, { .set_enable_fn = v...
cl_assert(jerry_value_is_object(object)); JS_VAR x = jerry_get_object_field(object, "x"); cl_assert(jerry_value_is_number(x)); cl_assert_equal_d(jerry_get_number_value(x), 42.0); } void test_rocky_api_app_message__json_parse_stress(void) { const int num_attempts = 0x3ff + 10; // Want this to be higher than t...
strlen(expected_json)
+ 1; size_t json_bytes_remaining = expected_json_size; uint8_t *buffer = task_malloc(sizeof(PostMessageChunkPayload) + TINY_CHUNK_SIZE); // Chunk 1: { const size_t json_bytes_size = MIN(TINY_CHUNK_SIZE, json_bytes_remaining); const size_t expected_size = sizeof(PostMessageChunkPayload) + json_bytes_s...
/* * 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 (cmd == RCC_APB1PeriphClockCmd) { return "APB1"; } else if (cmd == RCC_APB2PeriphClockCmd) { return "APB2"; } else if (cmd == RCC_AHB1PeriphClockCmd) { return "AHB1"; } else if (cmd == RCC_AHB2PeriphClockCmd) { return "AHB2"; } else { return NULL; } }
#endif // F(S)MC is the only AHB3 peripheral #ifdef FMC_R_BASE #define AHB3_BASE FMC_R_BASE #else #define AHB3_BASE FSMC_R_BASE #endif _Static_assert(APB1PERIPH_BASE < APB2PERIPH_BASE, "Clock mapping assumptions don't hold"); _Static_assert(APB2PERIPH_BASE < AHB1PERIPH_BASE, "Clock mapping assumptions don't hold"); ...
G); cl_assert(jerry_value_has_error_flag(error_val)); // NOTE: prv_log_uncaught_error() will call jerry_release_value(), so don't use error_val after // this call returns: prv_log_uncaught_error(error_val); cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_util__call_no_error(void) { s_...
(2016, 9, 1)
); // Oct-01 cl_assert_equal_d(17045, ecma_date_make_day(2016, 8, 1)); // Sept-01 #endif // EMSCRIPTEN } void test_rocky_api_util__ecma_date_make_day_list(void) { #ifdef EMSCRIPTEN printf("Skipping test %s", __FUNCTION__); #else int fail_count = 0; for(int y = 1950; y < 2050; y++) { for(int m = 0; m < 1...
; cl_assert_equal_i(s_num_alarms_fired, 0); // Enable the 11:30 alarm - now it should go off s_current_hour = 11; alarm_set_enabled(id2, true); s_current_hour = 12; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); } void test_alarm__delete_upcoming_alarm(void) { AlarmId id1, id2; id1...
{ // Declarations AlarmId id1; AlarmId id2; AlarmId id3; // No alarms scheduled, our function should return false cl_assert_equal_b(alarm_is_next_enabled_alarm_smart(), false); // Schedule a basic (non-smart) alarm, our function should return false id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute...
void test_alarm__skip_two_alarms(void) { AlarmId id1, id2; bool just_once_schedule_thursday[7] = {false, false, false, false, true, false, false}; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 10, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id1, 10, 10, false, ALARM_KIND_JUST_ONCE, just...
stributed 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 "fake_session.h" #include "comm/bt_lock.h" #include "kernel/pbl_malloc.h" #include "system/l...
(sizeof(CommSession))
; memset(session, 0, sizeof(*session)); *session = (const CommSession) { .transport = transport, .transport_imp = implementation, .destination = destination, .max_out_payload_length = COMM_MAX_OUTBOUND_PAYLOAD_SIZE, }; const size_t max_pp_msg_size = session->max_out_payload_length + sizeof(Pebb...
/* * 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_compositing_mode(ctx, GCompOpAssignInverted); GBitmap sad_watch_bitmap; gbitmap_init_with_data(&sad_watch_bitmap, sad_watch); const GRect bitmap_dest_rect = GRect(56, 68, 32, 32); graphics_draw_bitmap_in_rect(ctx, &sad_watch_bitmap, &bitmap_dest_rect); GFont error_code_face = fonts...
static void prv_panic_reset_callback(void* data) { RebootReason reason = { .code = RebootReasonCode_LauncherPanic, .extra = launcher_panic_get_current_error() }; reboot_reason_set(&reason); system_reset(); } static void prv_panic_button_click_handler(ClickRecognizerRef recognizer, void *context) { ...
sin_lookup(rotation) * (line_length * FIXED_S16_3_ONE.raw_value) / TRIG_MAX_RATIO) + p0.x.raw_value; p1.y.raw_value = (-cos_lookup(rotation) * (line_length * FIXED_S16_3_ONE.raw_value) / TRIG_MAX_RATIO) + p0.y.raw_value; graphics_context_set_antialiased(ctx, true); ...
{ AppData *data = task_zalloc(sizeof(AppData)); if (!data) { return; } s_window = window_create(); window_set_user_data(s_window, data); window_set_fullscreen(s_window, true); window_set_window_handlers(s_window, &(WindowHandlers) { .load = main_window_load, .unload = main_window_unload, })...
static void deinit(void) { AppData *data = window_get_user_data(s_window); task_free(data); window_destroy(s_window); } static void s_main(void) { init(); app_event_loop(); deinit(); } const PebbleProcessMd* stroke_width_get_app_info(void) { static const PebbleProcessMdSystem s_app_info = { .commo...
ranscription_dialog.h" #include "applib/applib_malloc.auto.h" #include "applib/app_timer.h" #include "applib/event_service_client.h" #include "applib/fonts/fonts.h" #include "applib/graphics/text_render.h" #include "applib/graphics/utf8.h" #include "util/uuid.h" #include "applib/ui/animation.h" #include "applib/ui/ani...
(ModalPriorityVoice)
app_timer_register(VOLUME_REPEAT_INTERVAL_MS, prv_handle_volume_repeat, data)
; prv_change_volume(data->volume_is_up); prv_do_haptic_feedback_vibe(context); } static void prv_volume_long_click_start_handler(ClickRecognizerRef recognizer, void *context) { const bool volume_is_up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP); prv_change_volume(volume_is_up); prv_set_act...
/* * 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...
(menu_layer_get_layer(&launcher_menu_layer->menu_layer))
; } } ////////////////////////////////////// // LauncherAppGlanceService handlers static void prv_glance_changed(void *context) { LauncherMenuLayer *launcher_menu_layer = context; prv_launcher_menu_layer_mark_dirty(launcher_menu_layer); } //////////////////////// // MenuLayer callbacks static void prv_menu_la...
success = false; } } return success; } // Writes 0's to the first half of a flash sector and confirms that everything // reads as 0. Then uses 8 subsector erases to erase the second half of the // sector. Then re-reads the first half to see if any bits have flipped static bool check_subsector_bitflip(...
layer_add_child(layer, text_layer_get_layer(text_layer))
; text_layer_set_text(stress_data.text_layer, "Starting Stress Test"); abort_stress_test = false; app_timer_register(500, app_timer_cb, NULL); }; static void stress_window_unload(Window *data) { abort_stress_test = true; } static void file_system_stress_callback(int index, void *data) { stress_data.stress_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // stepped white bezel case WATCH_INFO_COLOR_TIME_ROUND_ROSE_GOLD_14: case WATCH_INFO_COLOR_TIME_ROUND_SILVER_14: return 3200; case WATCH_INFO_COLOR_TIME_ROUND_BLACK_14: case WATCH_INFO_COLOR_TIME_ROUND_SILVER_20: return 3330; case WATCH_INFO_COLOR_TIME_ROUND_BLACK_20: return...
} //! Turn on or off the ambient light sensor. //! @param enable True to turn the light sensor on, false to turn it off. static void prv_sensor_enable(bool enable) { const BitAction set = enable ? Bit_SET : Bit_RESET; gpio_use(BOARD_CONFIG.photo_en.gpio); GPIO_WriteBit(BOARD_CONFIG.photo_en.gpio, BOARD_CONFIG.p...
ner = GCornerNone; break; } graphics_fill_round_rect(ctx, &rect, radius - margin, corner); } GRect icon_rect = icon->bounds; const bool clip = true; grect_align(&icon_rect, &rect, GAlignCenter, clip); const GCompOp op = (is_white != is_highlighted) ? GCompOpAssign : GCompOp...
{ window_set_click_config_provider_with_context( action_bar->window, (ClickConfigProvider) action_bar_legacy2_click_config_provider, action_bar); }
} void action_bar_layer_legacy2_set_click_config_provider(ActionBarLayerLegacy2 *action_bar, ClickConfigProvider click_config_provider) { action_bar->click_config_provider = click_config_provider; action_bar_legacy2_update_click_config_provider(action_bar); ...
_due_to_software_failure(); } else { app_heap_analytics_log_native_heap_oom_fault(bytes, heap_ptr); sys_app_fault(lr); } } void NOINLINE app_crashed(void) { // Just sit here and look pretty. The purpose of this function is to give app developers a symbol // that they can set a breakpoint on to debug ap...
pebble_task_get_name(task)
); if (mcu_state_is_thread_privileged()) { // We're hosed! We can't recover so just reboot everything. RebootReason reason = { .code = RebootReasonCode_StackOverflow, .data8[0] = task }; reboot_reason_set(&reason); reset_due_to_software_failure(); return; } // We got this! Let's redirect thi...
_test_impl_data, sizeof(s_test_impl_data), dummy, NULL)); cl_assert_passert(recognizer_create_with_data(&s_test_impl, NULL, sizeof(s_test_impl_data), dummy, ...
(event_type, RecognizerEvent_Updated)
; cl_assert_equal_i(r->state, RecognizerState_Updated); cl_assert(!s_manager_state_change); recognizer_transition_state(r, RecognizerState_Completed); cl_assert_equal_i(event_type, RecognizerEvent_Completed); cl_assert_equal_i(r->state, RecognizerState_Completed); cl_assert_passert(recognizer_transition_st...
ART_FAIL_STRIKE_ONE)) { dbgserial_putstr("Failed to start firmware, strike two."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); } else { dbgserial_putstr("Failed to start firmware, strike one."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); } return false; } static bool check_force_boot_...
{ display_error_code(i * 0x11111111); delay_us(200000); }
for (uint32_t i=0; i < 8; ++i) { for (uint32_t j=1; j<=0xf; ++j) { display_error_code(j << (i*4)); delay_us(200000); } } display_error_code(0x01234567); delay_us(200000); display_error_code(0x89abcdef); delay_us(200000); display_error_code(0xcafebabe); delay_...
/* * 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(america_los_angeles_region != -1)
; char region_name[TIMEZONE_NAME_LENGTH]; const bool result = timezone_database_load_region_name(america_los_angeles_region, region_name); cl_assert(result); cl_assert_equal_s(region_name, america_los_angeles_region_name); } void test_timezone_database__load_dst_rule_los_angeles(void) { const int america_lo...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gpio_input_init(&input_config)
; } if (dev->rx_gpio.gpio) { const InputConfig input_config = { .gpio = dev->rx_gpio.gpio, .gpio_pin = dev->rx_gpio.gpio_pin }; gpio_input_init(&input_config); } } void uart_set_baud_rate(UARTDevice *dev, uint32_t baud_rate) { PBL_ASSERTN(dev->state->initialized); RCC_ClocksTypeDef R...
* * 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 governing permissions and * limitations under the Licens...
(OFFSET_X, OFFSET_Y + i, STRIPE_WIDTH, STRIPE_HEIGHT)
, (GColor){.argb = color | alpha}); color++; } // Compare the results cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "blendtest_33_66.pbi")); #endif gbitmap_destroy(background_0_100); gbitmap_destroy(background_33_66); free(fb); }
t, test_start_utc, test_end_utc, last_processed_utc); result.weighted_err = 0.0; result.all_passed = true; ActualValue *actual = &result.total; ExpectedValue *expected = &entry->total; for (int j = 0; j < ARRAY_LENGTH(metrics); j++, actual++, expected++) { result.weighted_err += prv_compute_t...
(entry->name, ACTIVITY_TEST_ONLY)
) { continue; } #endif entry->test_idx = num_tests; printf("\n\n========================================================"); printf("\nRunning activity sample set: \"%s\"\n", entry->name); memset(s_kalg_state, 0, kalg_state_size()); kalg_init(s_kalg_state, prv_stats_cb); s_num_capture...
, GColorBlack.argb); #endif color.a = 1; graphics_context_set_stroke_color(&context, color); cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorClear.argb); color.a = 0; graphics_context_set_stroke_color(&context, color); cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorClear.argb)...
GRect(10, 20, 40, 10)
); ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context, true, 1, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); #if PBL_COLOR ASSERT_CALLED(graphics_circle_draw_1px_aa(&context, GPoint(50, 50), 10)); #else ASSERT_CALLED(graphics_circle_dr...
, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricDistanceMeters, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTotalSeconds, ...
(ActivityMetricDistanceMeters, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){exp_distance, 0, 0, 0, 0, 0, 0}))
es by clip_box adjusted_top = MAX(adjusted_top, clip_box.origin.y); adjusted_top = MIN(adjusted_top, clip_box.origin.y + clip_box.size.h); adjusted_bottom = MAX(adjusted_bottom, clip_box.origin.y); adjusted_bottom = MIN(adjusted_bottom, clip_box.origin.y + clip_box.size.h); // Remove offset from adjusted val...
(y, radius_inner_y_sq, radius_inner_x_sq)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ARRAY_LENGTH(s_dls_records)
); s_dls_records[s_num_dls_records++] = records[i]; } return DATA_LOGGING_SUCCESS; } DataLoggingSession *dls_create(uint32_t tag, DataLoggingItemType item_type, uint16_t item_size, bool buffered, bool resume, const Uuid *uuid) { if (tag == DlsSystemTagProtobufLogSession) { ...
N_IDX_X]; #else return NULL; #endif } static void prv_load_icons(void) { #if MFG_INFO_RECORDS_TEST_RESULTS // The icons in resources are black boxes with either a white checkmark or X. // In order to make them look correct in the way we are using them, we want to // invert the icons so that they are black icon...
prv_create_menu_items(&menu_items)
; data->menu_section = (SimpleMenuSection) { .num_items = num_items, .items = menu_items }; data->menu_layer = simple_menu_layer_create(bounds, data->window, &data->menu_section, 1, NULL); layer_add_child(window_layer, simple_menu_layer_get_layer(data->menu_layer)); // Set the menu layer back to it...
/* * 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...
gpoint_add(bounds.origin, offset)
; // Save compositing mode GCompOp prev_compositing_mode = ctx->draw_state.compositing_mode; GCompOp op = (bitmap_reel->bitmap->info.format == GBitmapFormat1Bit) ? GCompOpAssign : GCompOpSet; graphics_context_set_compositing_mode(ctx, op); graphics_draw_bitmap_in_rect_processe...
&notif_prefs->action_group, buffer, buf_end, serialized_prefs->data, serialized_prefs_data_len)) { char buffer[key_len + 1]; strncpy(buffer, (con...
{ mutex_lock(s_mutex); status_t rv = pfs_remove(iOS_NOTIF_PREF_DB_FILE_NAME); mutex_unlock(s_mutex); return rv; }
status_t ios_notif_pref_db_is_dirty(bool *is_dirty_out) { SettingsFile file; status_t rv = prv_file_open_and_lock(&file); if (rv != S_SUCCESS) { return rv; } *is_dirty_out = false; rv = settings_file_each(&file, sync_util_is_dirty_cb, is_dirty_out); prv_file_close_and_unlock(&file); return rv; ...
/* * 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 (!prv_scroll_layer_is_paging_enabled(scroll_layer)) { return 0; }
return MAX(0, scroll_layer->layer.frame.size.h); } //! Return callback_context or if NULL, inline static void* get_callback_context(ScrollLayer *scroll_layer) { return scroll_layer->context ? scroll_layer->context : scroll_layer; } void scroll_layer_draw_shadow_sublayer(Layer *shadow_sublayer, GContext* ctx) { ...
RAW_RECT_NO_CLIP, 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 2, GCornersAll); cl_check(gbitmap_pbi_e...
(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1)
; graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_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...
text_layer_set_text_alignment(status, GTextAlignmentCenter)
stom animation with a custom update procedure Animation *d = animation_create(); animation_set_implementation(d, &s_custom_implementation); animation_set_duration(d, DURATION); return d; } static void click_handler(ClickRecognizerRef recognizer, Window *window) { // If the animation is still running, fast-f...
text_layer_create(from_rect_a)
; text_layer_set_text(s_text_layer_a, "Started!"); layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_text_layer_a)); s_text_layer_b = text_layer_create(from_rect_b); text_layer_set_text(s_text_layer_b, "Spawned"); layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_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...
cl_assert_equal_i(day, 3)
; cl_assert_equal_i(hour, 2); cl_assert_equal_i(minute, 4); cl_assert_equal_i(second, 5); } }
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 <bluetooth/bt_driver_c...
{ const PebbleProtocolCapabilities capabilities = { .flags = capability_flags }; bt_persistent_storage_set_cached_system_capabilities(&capabilities); }
} //! Resets the session (close and attempt re-opening the session) //! @note If the underlying transport is iAP, this will end up closing all the sessions on top of //! the transport, since we don't really have the ability to close a single iAP session. void comm_session_reset(CommSession *session) { bt_lock(); ...
; } // Log Consume for (int i = 0; i < 5; i++) { // Each write is 1/8 to 1/4 of the initial file size. int num_bytes = DLS_FILE_INIT_SIZE_BYTES/8 + (rand() % DLS_FILE_INIT_SIZE_BYTES/8); // By doing 16 loops, we are sure to cycle through the allocated file size at least twice. for (int j=0; j<16...
(nb, bytes_left[i])
; if (!nb) { continue; } did_some = true; prv_data_log_chain(logging_sessions[i], buf[i], item_size, nb); bytes_left[i] -= nb; buf[i] += nb; } } for (int i = 0; i < 10; i++) { prv_check_session_data(logging_sessions[i], crcs[i], buf_size[i]); } } // ---------...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return; }
#if PBL_BW set_pixel_raw_2bit(ctx, point); #elif PBL_COLOR set_pixel_raw_8bit(ctx, point); #endif const GRect dirty_rect = { point, { 1, 1 } }; graphics_context_mark_dirty_rect(ctx, dirty_rect); } // ## Private blending wrapper functions for non-aa uint32_t graphics_private_get_1bit_grayscale_pattern(GColo...
NULL); } static void prv_render_hr_zones(GContext *ctx, GRect *box, WorkoutActiveWindow *active_window) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_fill_color(ctx, GColorBlack); GRect zone_rect = *box; zone_rect.origin.x += PBL_IF_RECT_ELSE(1, 69); // add some padding afte...
prv_render_metric(ctx, metric_type, layer, bg_color, draw_zones, prefer_larger_font)
; if (layer == &active_window->top_metric_layer) { status_bar_layer_set_colors(&active_window->status_layer, bg_color, GColorBlack); } if (active_window->layout == WorkoutLayout_StaticAndScrollable || (active_window->layout == WorkoutLayout_TwoStaticAndScrollable && layer == &active_window->mid...
/* * 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...
((region->base_address & 0x1f) == 0)
; PBL_ASSERTN((region->region_num & ~0xf) == 0); PBL_ASSERTN((region->cache_policy != MpuCachePolicy_Invalid) && (region->cache_policy < MpuCachePolicyNum)); // MPU Region Base Address Register // | Addr (27 bits) | Region Valid Bit | Region Num (4 bits) | // The address is unshifted, we take t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return "yes"; }
else { return "no"; } } void itoa(uint32_t num, char *buffer, int buffer_length) { if (buffer_length < 11) { return; } *buffer++ = '0'; *buffer++ = 'x'; for (int i = 7; i >= 0; --i) { uint32_t digit = (num & (0xf << (i * 4))) >> (i * 4); char c; if (digit < 0xa) { c = '0' + dig...
//////////////////////////////////////////////////////////////////////////////////////////////// //! Time Picker static void prv_time_picker_window_unload(Window *window) { AlarmEditorData *data = (AlarmEditorData *)window_get_user_data(window); if (data->creating_alarm) { #if !CAPABILITY_HAS_HEALTH_TRACKING p...
app_window_stack_push(&data->time_picker_window.window, true)
; } else { alarm_set_smart(data->alarm_id, (data->alarm_type == AlarmType_Smart)); app_window_stack_remove(&option_menu->window, true); } } static void prv_setup_type_menu_window(AlarmEditorData *data) { const OptionMenuCallbacks callbacks = { .select = prv_type_menu_select, .unload = prv_type_me...
/* * 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...
(address_str)
s_wakeup_state.current_wakeup_id && new_timer_scheduled(s_current_timer_id, NULL)) { new_timer_stop(s_current_timer_id); } prv_wakeup_settings_delete_entry(wakeup_id); prv_wakeup_timer_next_pending(); } } static bool prv_check_count_and_availability_callback(SettingsFile *file, Setting...
prv_wakeup_timer_next_pending()
; } DEFINE_SYSCALL(time_t, sys_wakeup_query, WakeupId wakeup_id) { status_t status = E_DOES_NOT_EXIST; WakeupEntry entry = {}; if (wakeup_id < 0) { return status; } mutex_lock(s_mutex); { SettingsFile wakeup_settings; if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_...
QUADSPI_CCR_SIOO | \ QUADSPI_CCR_DHHC | \ QUADSPI_CCR_DDRM)) static void prv_set_comm_config(uint32_t modes_bitset, uint32_t dummy_cycles) { uint32_t ccr = QUADSPI->CCR; ccr &= QSPI_CCR_CLEAR_MASK; ccr |= modes_bitset; ccr |...
(InhibitorFlash)
; dma_request_start_direct(dev->dma, (void *)start_address_aligned, (void *)&QUADSPI->DR, dma_size, prv_dma_irq_handler, (void *)dev); xSemaphoreTake(dev->state->dma_semaphore, portMAX_DELAY); stop_mode_enable(InhibitorFlash); } if (trailing_bytes > 0) { prv_read_bytes...
/* * 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_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, })
; const bool animated = true; app_window_stack_push(window, animated); } //////////////////// // App boilerplate static void handle_init(void) { ScrollAppData *data = app_malloc_check(sizeof(ScrollAppData)); app_state_set_user_data(data); push_window(data); } static void handle_deinit(void) { ScrollAppD...
(&ctx, GPoint(46, 95), 5); // T facing right - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(71, 91), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(67, 96), 5); // T facing left - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 90), 10); graphics_d...
setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1)
ctionary == NULL || iter->cursor == NULL) { return NULL; } iter->cursor = iter->dictionary->head; return get_safe_cursor(iter); } uint32_t dict_calc_buffer_size(const uint8_t count, ...) { uint32_t total_size = sizeof(Dictionary); if (count == 0) { return total_size; } va_list vl; va_star...
(&iter, tuplets, tuplets_count, buffer, size_in_out)
; } DictionaryResult dict_serialize_tuplets(DictionarySerializeCallback callback, void *context, const Tuplet * const tuplets, const uint8_t tuplets_count) { if (tuplets_count == 0) { const Dictionary dict = { .count = 0 }; callback((const uint8_t *)&dict, sizeof(Dictionary), context); return DICT_OK; ...
-120}, { 1048, 8, -160}, { 1304, 16, -72}, { 1248, -40, 8}, { 1120, -72, 0}, { 1064, -80, 16}, { 1048, -56, 32}, { 1000, -16, 48}, { 952, -64, -64}, { 968, -48, -80}, { 936, -88, -88}, { 944, -120, -72}, { 952, -136, -96}, { 1000, -144, -88}, { 1104, -144, -24}, ...
{ 992, -48, -224}, { 1088, -56, -224}, { 1136, -80, -176}, { 1128, -112, -104}, { 1712, -56, -224}, { 1432, -8, -200}, { 1112, 32, -88}, { 752, -32, -8}, // 61 seconds { 1056, 0, 8}, { 1312, 16, 72}, { 1112, -8, 104}, { 1024, -8, 16}, { 1016, -24, 24}, { 1040,...
_workout_data.current_workout->steps, .step_data.distance_meters = s_workout_data.current_workout->distance_m, .step_data.active_kcalories = ROUND(s_workout_data.current_workout->active_calories, ACTIVITY_CALORIES_PER_KCAL), .step_data.resting_kcalorie...
if (distance_m_out) { *distance_m_out = s_workout_data.current_workout->distance_m; }
if (current_bpm_out) { *current_bpm_out = s_workout_data.current_workout->current_bpm; } if (current_hr_zone_out) { *current_hr_zone_out = s_workout_data.current_workout->current_hr_zone; } } } prv_unlock(); return rv; } #if UNITTEST bool workout_service_get_avg_hr(in...
52, 256}, { -384, 312, 96}, { -512, 344, 96}, { -520, 232, 200}, { -712, 104, 200}, { -792, 176, 128}, { -1104, 200, 208}, { -1112, 176, -8}, { -1464, -96, 240}, { -1416, 480, 248}, { -1448, 584, 128}, { -1096, 616, 160}, { -584, 816, -136}, { 0, 504, 192}, { -48,...
{ -552, 360, 48}, { -568, 232, 128}, { -672, 256, 112}, { -864, 328, 96}, { -1064, 288, 88}, { -1352, 232, 88}, { -1440, 352, 40}, { -1160, 520, -128}, { -1048, 232, -56}, { -768, 160, -120}, { -520, 208, -192}, { -328, 232, -128}, // 92 seconds { -360, 280, -112}...
{ -384, 360, -144}, { -424, 320, -96}, { -504, 288, 16}, { -704, 416, -64}, { -888, 480, -48}, { -1176, 592, -152}, { -1184, 504, -72}, { -1640, 736, -248}, { -1400, 600, -208}, { -1072, 392, -112}, { -1160, 464, -112}, { -912, 384, 80}, { -568, 424, -40}, { -496...
* 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 "clar.h" #include "drivers/hrm.h" #include "os/tick.h" #include "services/common/hrm/hrm_manager.h" #include "services/comm...
{ if (s_num_cb_events_1 >= ARRAY_LENGTH(s_cb_events_1)) { return; } s_cb_events_1[s_num_cb_events_1++] = *event; }
static PebbleHRMEvent s_cb_events_2[16]; static int s_num_cb_events_2 = 0; static void prv_fake_hrm_2_cb(PebbleHRMEvent *event, void *context) { if (s_num_cb_events_2 >= ARRAY_LENGTH(s_cb_events_2)) { return; } s_cb_events_2[s_num_cb_events_2++] = *event; } static void prv_put_battery_state_change_event(bo...
ottom_left.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offse...
graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersRight)
{ } static bool prv_read_register(uint8_t register_address, uint8_t *result) { return i2c_read_register(I2C_DEVICE_MAX14690, MAX14690_ADDR, register_address, result); } static bool prv_write_register(uint8_t register_address, uint8_t value) { return i2c_write_register(I2C_DEVICE_MAX14690, MAX14690_ADDR, registe...
if (!prv_read_register(PmicRegisters_STATUSA, &val)) { // NOTE: When running on QEMU, i2c reads return false. For now, just assume a failed // i2c read means we are charging return true; }
SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating } KeyForSMPairingItrData *itr_data = (KeyForSMPairingItrData*) context; BTBondingID key; BtPersistB...
{ prv_update_bondings(key, BtPersistBondingTypeBLE); }
es! delay_us(100); s_flash_state.deep_sleep = false; } } void handle_sleep_when_idle_begin(void) { if (s_flash_state.sleep_when_idle) { flash_deep_sleep_exit(); } } void flash_power_down_for_stop_mode(void) { if (s_flash_state.sleep_when_idle) { if (s_flash_state.enabled) { enable_flash_...
(PowerSystemFlashRead)
; enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_wait_for_write(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_READ); flash_send_24b_address(start_addr); // There is delay associated with setting up the stm32 dma, using FreeRTOS // sempahores, handling ISRs, etc. Thus ...
bool resume, const Uuid* uuid) { // validate size parameter if (item_size == 0 || (buffered && item_size > DLS_SESSION_MAX_BUFFERED_ITEM_SIZE) || (!buffered && item_size > DLS_ENDPOINT_MAX_PAYLOAD)) { PBL_LOG(LOG_LEVEL_ERROR, "invalid logging_session item size, %d", item_size); return (N...
{ PBL_ASSERTN(logging_session != NULL); if (uuid_is_system(&logging_session->app_uuid)) { PBL_LOG(LOG_LEVEL_WARNING, "Finishing the system data logging session at %p", logging_session); } bool is_active = dls_lock_session(logging_session); if (!is_active) { PBL_LOG(LOG_LEVEL_WARNING, "Tried to close ...
// ---------------------------------------------------------------------------------------- static bool prv_write_session_to_flash(DataLoggingSession* session, void *data) { dls_storage_write_session(session); return true; } static void prv_write_all_sessions_to_flash(void *data) { dls_list_for_each_session(p...
-------------------------------------------------------- typedef bool (*AlarmOperationCallback)(AlarmId id, AlarmConfig *config, void *context); static void prv_alarm_operation(AlarmId id, AlarmOperationCallback callback, void *context) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return; } ...
{ SettingsFile file; if (!prv_file_open_and_lock(&file)) { return false; } AlarmConfig config; bool rv = prv_alarm_get_config(&file, id, &config); if (!rv) { goto cleanup; } memcpy(scheduled_days, &config.scheduled_days, DAYS_PER_WEEK); cleanup: prv_file_close_and_unlock(&file); return rv;...
// ---------------------------------------------------------------------------------------------- void alarm_set_enabled(AlarmId id, bool enable) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return; } AlarmConfig config; bool rv = prv_alarm_get_config(&file, id, &config); if (!rv) { ...
cess = true; mutex_lock_recursive(s_accel_manager_mutex); if (samples > state->num_samples) { PBL_LOG(LOG_LEVEL_ERROR, "Consuming more samples than exist %d vs %d!", (int)samples, (int)state->num_samples); success = false; } else if (samples != state->num_samples) { PBL_LOG(LOG_LEVEL_DEBU...
{ PebbleEvent e = { .type = PEBBLE_ACCEL_DOUBLE_TAP_EVENT, .accel_tap = { .axis = axis, .direction = direction, }, }; event_put(&e); }
static void prv_handle_accel_driver_work_cb(void *data) { // The accel manager is responsible for handling locking mutex_lock_recursive(s_accel_manager_mutex); AccelOffloadCallback cb = data; cb(); mutex_unlock_recursive(s_accel_manager_mutex); } void accel_offload_work_from_isr(AccelOffloadCallback cb, bo...
uid_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->se...
while (cursor < end) { const BLEAdElement *elem = (const BLEAdElement *) cursor; if (elem->header.length == 0) { // We've hit a padding zero. We should be done, or this packet is corrupt. return; } if (cursor + elem->header.length + 1 /* +1 length byte */ > end) { return; // corrupte...
no_number(void) { uint8_t pp_msg[] = {0x04, 0x1a, 0xd4, 0x77, 0x08, 0x00, 0x06, 0x42, 0x6F, 0x62, 0x62, 0x79, 0x00}; // "Bobby" phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg)); fake_system_task_callbacks_invoke_pending(); prv_assert_last_event(PhoneEv...
fake_system_task_callbacks_invoke_pending()
/* * 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(ctx.dest_bitmap.info.format, GBitmapFormat8BitCircular)
; memset(ctx.dest_bitmap.addr, GColorRedARGB8, FRAMEBUFFER_SIZE_BYTES); GRect radial_container_rect = ctx.dest_bitmap.bounds; radial_container_rect = grect_inset(radial_container_rect, GEdgeInsets(-10)); const uint16_t inset_thickness = radial_container_rect.size.w / 4; graphics_context_set_fill_color(&ctx,...
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 "pin_window.h" #include "timelin...
animation_schedule(animation)
; pin_window->pop_animation = animation; } void timeline_pin_window_init(TimelinePinWindow *pin_window, TimelineItem *item, time_t current_day) { if (pin_window->pop_animation) { animation_unschedule(pin_window->pop_animation); } Window *window = &pin_window->window; windo...
/* * 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_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(2, -10, 28, 20), 4); }
iphs, DISABLE); RCC_AHB3PeriphResetCmd(ahb3_periphs, ENABLE); RCC_AHB3PeriphResetCmd(ahb3_periphs, DISABLE); RCC_APB1PeriphResetCmd(apb1_periphs, ENABLE); RCC_APB1PeriphResetCmd(apb1_periphs, DISABLE); RCC_APB2PeriphResetCmd(apb2_periphs, ENABLE); RCC_APB2PeriphResetCmd(apb2_periphs, DISABLE); // The Cor...
if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)) { dbgserial_putstr("Failed to start firmware, strike two."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); } else { dbgserial_putstr("Failed to start firmware, strike one."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); }
return false; } static bool check_force_boot_recovery(void) { if (boot_bit_test(BOOT_BIT_FORCE_PRF)) { boot_bit_clear(BOOT_BIT_FORCE_PRF); return true; } if (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)) { dbgserial_putstr("Hold down UP + BACK for 5 secs. to force-boot PR...
/* * 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 *window = app_window_stack_get_top_window(); if (e->app_focus.in_focus) { if (window) { // Do not call 'appear' handler on window displacing modal window window_set_on_screen(window, true, false); window_render(window, app_state_get_graphics_context()); } click_manager_reset(a...
static void prv_app_button_down_handler(PebbleEvent *e, void *context) { WindowStack *app_window_stack = app_state_get_window_stack(); if (window_stack_is_animating(app_window_stack)) { return; } sys_analytics_inc(ANALYTICS_APP_METRIC_BUTTONS_PRESSED_COUNT, AnalyticsClient_App); if (e->button.button_i...
n; return; } state->position = endptr; state->filter_state = target_time - state->vars->current_time; state->time_was_until = true; } static void prv_filter_time_since(TemplateStringState *state) { prv_filter_time_until(state); if (state->error->status != TemplateStringErrorStatus_Success) { return...
if (state.error->status != TemplateStringErrorStatus_Success) { break; }
prv_append_char(&state, *state.position); state.position++; } else { // Template state.position++; prv_template_eval(&state); if (state.error->status != TemplateStringErrorStatus_Success) { break; } state.time_was_until = false; state.filter_state = 0; ...
_tasks.h" #include "stubs_print.h" #include "stubs_resources.h" #include "stubs_serial.h" #include "stubs_syscalls.h" #include "stubs_ui_window.h" #include "stubs_unobstructed_area.h" // Tests //////////////////////////////////// ///////////////////////////////// /// Generic matrix tests ////////////////////////////...
GTransformNumberFromNumber(2)
, GTransformNumberFromNumber(5)); t_c = GTransformFromNumbers(1, 0, 0, 1, 2, 5); cl_assert(gtransform_is_equal(&t, &t_c)); cl_assert(gtransform_is_only_translation(&t)); cl_assert(gtransform_is_only_translation(&t_c)); t_c = GTransformTranslationFromNumber(2, 5); cl_assert(gtransform_is_equal(&t, &t_c)); ...
_c)); GVectorPrecise vectorP = GVectorPreciseFromGVector(GVector(2, 5)); GVectorPrecise vectorP_c = GVectorPrecise((2 % GVECTOR_PRECISE_MAX) << GVECTOR_PRECISE_PRECISION, (5 % GVECTOR_PRECISE_MAX) << GVECTOR_PRECISE_PRECISION); cl_assert(gvectorprecise_equal(&vectorP,...
gtransform_concat(&t_new, &t1, &t2)
; cl_assert(gtransform_is_equal(&t_new, &t_c)); } void test_graphics_gtransform_${BIT_DEPTH_NAME}__scale(void) { GTransform t_new; GTransform t1; GTransform t2; GTransform t_c; // matrix to compare against // Test scaling t1 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t2 = GTransformFromNumbers(1, 2, 3...
80, 168}, { -1136, 616, 120}, { -1688, 576, 200}, { -2192, 512, 256}, { -2296, 312, 376}, { -2040, 216, 344}, { -1944, 256, 296}, { -1752, 288, 280}, { -1568, 248, 256}, { -1232, 192, 272}, { -1008, 96, 272}, { -1000, -240, 312}, { -536, -624, -712}, { -856, -464, -22...
{ -1032, 480, -16}, { -912, 416, 120}, { -1160, 552, 96}, { -1176, 584, 48}, { -1168, 472, 96}, { -1496, 496, -8}, { -1808, 456, 56}, { -1840, 392, 24}, { -1656, 408, 64}, { -1632, 344, 104}, { -1440, 136, 80}, { -1320, 184, 200}, // 52 seconds { -1152, 88, 152}, ...
{ -1624, 272, 232}, { -1560, 208, 264}, { -1512, 184, 248}, { -1256, 144, 168}, { -1128, 136, 336}, { -952, 176, 192}, { -888, 0, 176}, { -768, -272, 144}, { -968, -48, 8}, { -1168, 96, 72}, { -1296, 496, -200}, { -1352, 488, -144}, { -1560, -16, 200}, { -1656, 8...
nd = 1446343200, // Sun, 01 Nov 2015 02:00 .tm_gmtoff = -5 * SECONDS_PER_HOUR, }; time_util_update_timezone(&tz_info); prv_set_current_time(oct_31); cl_assert_equal_i(clock_to_timestamp(SATURDAY, 0, 15), mktime(&nov_7)); } void test_clock__today(void) { struct tm may_30 = { .tm_sec = 0, .tm_min =...
(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("IN 1 H", time_buf); // June 10th 2015, 13:00:01 (T-00:59:59) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR) + 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 H", time_buf); // June 10th 2015, 13:00:59 (T-00:59:0...
_system_session(); if (!session) { return false; } mutex_lock(s_endpoint_data.mutex); if (logging_session->comm.state != DataLoggingSessionCommStateIdle) { mutex_unlock(s_endpoint_data.mutex); // logging_session is waiting for an ack, we'll send next time around // don't return a failure, this ...
{ PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Received NACK for id: %"PRIu8, session_id); DataLoggingSession *logging_session = dls_list_find_by_session_id(session_id); if (!logging_session) { PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_WARNING, "Received nack for non-existent session id: %"PRIu8, ...
//! System task callback executed which reopens the next session in the list built up by report_cmd_system_task_cb static void prv_reopen_next_session_system_task_cb(void* data) { DataLoggingReopenEntry *entry = (DataLoggingReopenEntry *)data; if (!entry) { s_endpoint_data.report_in_progress = false; retu...
layer_set_hidden(&s_notification_window_data.action_button_layer, false)
; // Render the window window_render(window, fake_graphics_context_get_context()); } //! @note This must be a multiple of 8 so that we are word-aligned when using a 1-bit bitmap. #define GRID_CELL_PADDING 8 static void prv_prepare_canvas_and_render_notification_windows(unsigned int num_down_scrolls) { // Initi...
/* * 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...
("21.", 3, true, 21 * 3)
; } void test_ams_util__float_string_parse_comma_decimal_separator(void) { // "1.23456" * 3 is approx 3.7036800000000003, round up to 4 assert_float_parse("1,23456", 3, true, 4); } void test_ams_util__float_string_parse_period_decimal_separator(void) { // "1.23456" * 3 is approx 3.7036800000000003, round up to ...
RGUMENT); rv = pfs_write(1000000, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_write(0, NULL, 0); cl_assert(rv == E_INVALID_ARGUMENT); uint8_t buf[10]; int fd = pfs_open("newfile", OP_FLAG_WRITE | OP_FLAG_READ, FILE_TYPE_STATIC, sizeof(buf)); for (int i = 0; i < sizeof(buf); i++) { ...
cl_assert(rv == E_INVALID_ARGUMENT)
; rv = pfs_close(1000000); cl_assert(rv == E_INVALID_ARGUMENT); int fd = pfs_open("file", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); rv = pfs_close(fd); cl_assert(rv == S_SUCCESS); rv = pfs_close(fd); // should not be able to double close an fd cl_assert(rv == E_INVALID_ARGUMENT); } voi...
nack_then_outbox_sent(void) { // Sending ack on timeout, but reject the send prv_set_remote_receive_handler(prv_nack_sent_callback); prv_send_test_data(); prv_process_sent_data(); cl_assert_equal_b(app_message_is_accepting_outbound(), false); prv_call_outbox_sent(AppOutboxStatusSuccess); cl_assert_equal...
MIN(i, 100)
, s_sys_psleep_last_millis); } } // Test INBOUND (phone->watch): //////////////////////////////////// static void check_in_accepting_again(void) { cl_assert(app_message_is_accepting_inbound() == true); } void test_app_message__receive_happy_case(void) { prv_set_remote_receive_handler(prv_receive_ack_nack_callba...
dicators_buffer->buffer; ContentIndicator **content_indicators = (ContentIndicator**)buffer->data; cl_assert_equal_p(content_indicators[index], content_indicator); } void helper_check_configs_for_equality(ContentIndicatorConfig a, ContentIndicatorConfig b) { cl_assert_equal_p(a.layer, b.layer); cl_assert_equal...
content_indicator_configure_direction(&content_indicator, ContentIndicatorDirectionUp, &dummy_config)
); // Using the same dummy configuration (which has the same layer) to configure a different // direction should fail cl_assert(!content_indicator_configure_direction(&content_indicator, ContentIndicatorDirectionDown, ...
// 94 seconds { 672, -16, -664}, { 672, 24, -664}, { 680, 0, -656}, { 680, 16, -672}, { 680, 16, -664}, { 672, 8, -656}, { 680, 8, -648}, { 688, 16, -648}, { 680, 0, -640}, { 680, 0, -648}, { 672, 8, -664}, { 672, 40, -696}, { 656, 24, -704}, { 656, 40, -672}...
{ 672, 0, -672}, { 680, -8, -680}, { 688, -8, -664}, { 672, -16, -648}, { 680, -8, -656}, { 688, -16, -640}, { 696, 32, -632}, // 100 seconds { 680, 0, -656}, { 672, 0, -656}, { 680, 56, -712}, { 656, -8, -696}, { 672, 16, -680}, { 688, 8, -680}, { 680, -32, -...
{ 720, -48, -616}, { 720, -48, -584}, { 720, -40, -600}, { 728, -48, -592}, { 712, -24, -600}, { 712, -48, -592}, { 704, -48, -616}, { 696, 16, -664}, { 704, 40, -704}, { 704, 16, -688}, { 696, 8, -624}, { 704, -32, -616}, { 712, -48, -600}, // 103 seconds { ...
, 984, 456}, { 432, 728, 368}, { 536, 760, 568}, { 544, 672, 632}, { 552, 512, 568}, { 456, 536, 544}, { 440, 456, 568}, { 400, 304, 640}, { 384, 416, 688}, { 280, 528, 784}, { 200, 592, 848}, { 240, 552, 936}, // 8 seconds { 376, 640, 1000}, { 552, 712, 1376}, ...
{ 1720, 464, -80}, { 1504, 480, -72}, { 1048, 384, -56}, { 1176, 336, -32}, { 1248, 288, 8}, { 1168, 208, 80}, { 992, 192, 104}, { 896, 240, 96}, { 872, 192, 104}, { 888, 192, 96}, { 856, 200, 88}, { 832, 120, 40}, { 816, 80, -16}, { 912, 104, 0}, { 1032, 168,...
{ 888, 256, -8}, // 16 seconds { 880, 208, 8}, { 872, 192, 40}, { 808, 192, 16}, { 728, 128, 16}, { 728, 96, 16}, { 904, 128, -56}, { 1024, 88, -104}, { 1528, 104, -8}, { 1592, 328, -400}, { 1248, 328, -432}, { 1400, 400, -424}, { 1424, 488, -288}, { 1192, 28...
/* * 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...
{ assert_buffer_not_touched(decoded_length); }
} static void assert_output_equal(const void * restrict expected, size_t length) { cl_assert(memcmp(out, expected, length) == 0); } void test_cobs_decode__initialize(void) { memset(&ctx, 0xdd, sizeof(ctx)); memset(out, 0xcc, sizeof(out)); } void test_cobs_decode__simple(void) { const char vector[] = { 0x06...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(line_buffer, LINE_BUFFER_LENGTH, "%04x ", offset)
; buffer_offset += 6; // Print the hex bytes const unsigned int num_line_bytes = ((length - offset) > 16) ? 16 : (length - offset); for (unsigned int i = 0; i < num_line_bytes; ++i) { if (i == 8) { line_buffer[buffer_offset++] = ' '; } snprintf(line_buffer + buffer_offset, LI...
************/ void test_app_cache__add_remove_evict(void) { // add all three cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app1.id, app1.size)); cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app2.id, app2.size)); cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app3.id, app3.size)); // remove 2 cl_a...
app_cache_entry_exists(app3.id)
); } #define APP_CACHE_FILE_NAME "appcache" #define APP_CACHE_MAX_SIZE 4000 typedef struct PACKED { time_t install_date; time_t last_launch; uint32_t total_size; uint16_t launch_count; } AppCacheEntry; void test_app_cache__corrupt_key(void) { // add three cache entries cl_assert_equal_i(S_SUCCESS...