prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
i_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r1_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 2); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r2_aa_sw1_no_cl...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax2_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"))
; #endif } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_radius_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = false, SW = 1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ...
/* * 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_events)
/* * 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 (service->subscribers[subscription->task]) { // already subscribed ? PBL_LOG(LOG_LEVEL_DEBUG, "already subscribed"); return; }
if (service->add_subscriber_callback != NULL) { service->add_subscriber_callback(subscription->task); } service->subscribers[subscription->task] = subscription->event_queue; ++service->num_subscribers; } void event_service_subscribe_from_kernel_main(PebbleSubscriptionEvent *subscription) { PBL_ASSERT_...
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}}; char name_in[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 1"; uint8_t platform_bits_in = 0x11; BTBondingID id = bt_persistent_storage_store_bt_classic_pairing(&addr_in, &link_key_in, name_...
cl_assert(ret)
; ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!ret); // Delete the pairing. bt_persistent_storage_delete_bt_classic_pairing_by_id(id_2); // There should be no active gateway now ret = bt_persistent_storage_get_active_gateway(&id_out, &type_out); cl_assert(!ret); ret = bt_pe...
/* * 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_SetPrescaler(IWDG_Prescaler_64)
; // ~8 seconds IWDG_SetReload(0xfff); IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable); DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP, ENABLE); } void watchdog_start(void) { IWDG_Enable(); watchdog_feed(); } // This behaves differently from the bootloader and the firmware. void watchdog_feed(void) { IWDG_Reloa...
ontext_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 32, 24)); layer_set_update_proc(&layer, &corners_all_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_corners_all.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback);...
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 6, GCornersAll)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r6_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 7, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_orig...
static void prv_set_connection_responsiveness( Transport *transport, BtConsumer consumer, ResponseTimeState state, uint16_t max_period_secs, ResponsivenessGrantedHandler granted_handler) { if (granted_handler) { launcher_task_add_callback(prv_granted_kernel_main_cb, granted_handler); } } static CommSe...
{ size_t packet_length = sizeof(PulsePPCallbackPacket) + data_length; PulsePPCallbackPacket *cb_data = kernel_malloc_check(packet_length); cb_data->packet_length = sizeof(PulsePPPacket) + data_length; cb_data->packet.opcode = opcode; if (data) { memcpy(&cb_data->packet.data[0], data, data_length); } ...
void pulse_pp_transport_open_handler(void) { return; } void pulse_pp_transport_closed_handler(void) { prv_pulse_pp_transport_set_connected(false); } void pulse_pp_transport_handle_received_data(void *data, size_t length) { PulsePPPacket *packet = data; switch (packet->opcode) { case PULSE_PP_OPCODE_DAT...
unt; static uint32_t analytics_write_bytes_count; void analytics_external_collect_system_flash_statistics(void) { // TODO: Add support back to tintin } void analytics_external_collect_app_flash_read_stats(void) { analytics_set(ANALYTICS_APP_METRIC_FLASH_READ_COUNT, analytics_read_count, AnalyticsClient_App); an...
(FLASH_TX_DMA_STREAM, ENABLE)
; xSemaphoreTake(s_flash_state.dma_semaphore, portMAX_DELAY); stop_mode_enable(InhibitorFlash); xSemaphoreGive(s_flash_state.dma_semaphore); } void DMA2_Stream0_IRQHandler(void) { if (DMA_GetITStatus(FLASH_DMA_STREAM, DMA_IT_TCIF3)) { DMA_ClearITPendingBit(FLASH_DMA_STREAM, DMA_IT_TCIF3); NVIC_DisableI...
0, -128}, // 2 seconds { -264, 552, -128}, { -360, 400, -216}, { -544, 232, -248}, { -832, 88, -208}, { -1488, 32, -120}, { -1864, 504, -208}, { -1744, 552, -48}, { -1424, 808, -264}, { -1288, 288, -8}, { -1176, 280, -176}, { -1016, 168, -272}, { -936, 232, -184}, ...
{ -1568, 784, -96}, { -2000, 576, -16}, { -1920, 352, -32}, { -1744, 456, 88}, { -1712, 408, 144}, { -1560, 336, 128}, { -1320, 296, 128}, { -1000, 192, 112}, { -944, 160, 224}, { -680, -464, 56}, { -192, -672, -128}, { -1016, -152, 40}, { -1240, 80, -360}, { -144...
{ -712, -144, -72}, { -688, -304, 112}, // 10 seconds { -1144, -224, -8}, { -1424, -144, -240}, { -1592, -256, -232}, { -1648, -256, -216}, { -1552, -72, -152}, { -1400, 40, -144}, { -1216, 200, -144}, { -1048, 152, 8}, { -1024, 264, 24}, { -992, 288, -40}, { -10...
cense. */ #include "pin_window.h" #include "timeline_model.h" #include "applib/ui/action_button.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/modals/modal_manager.h" #include "services/normal/timeline/timeline.h" #include <stdint.h> void tim...
(pin_window->pop_animation)
; } Window *window = &pin_window->window; window_init(window, WINDOW_NAME("Pin")); window_set_user_data(window, pin_window); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_pin_window_load, .unload = prv_pin_window_unload, }); TimelineItemLayer *layer = &pin_window->item_detai...
; jerry_value_t v = jerry_create_number(cases[i].input); JERRY_ARGS_MAKE(v); ROCKY_ARGS_ASSIGN(ROCKY_ARG(output)); cl_assert_equal_i(output, cases[i].expected_output); ASSERT_JS_ERROR(error_value, NULL); jerry_release_value(v); } } void test_rocky_api_util_args__numbers(void) { uint8_t u8; ...
if (!c->expected_error_msg) { cl_assert_equal_i(u8, (uint8_t)c->u8); cl_assert_equal_i(u16, (uint16_t)c->u16); cl_assert_equal_i(u32, (uint32_t)c->u32); cl_assert_equal_i(u64, (uint64_t)c->u64); cl_assert_equal_i(s8, (int8_t)c->s8); cl_assert_equal_i(s16, (int16_t)c->s16); cl_a...
JERRY_ARGS_RELEASE(); } } void test_rocky_api_util_args__number_type_mismatch(void) { jerry_value_t mismatch_args[] = { jerry_create_null(), jerry_create_string((const jerry_char_t *)"one"), jerry_create_string((const jerry_char_t *)"1"), jerry_create_array(1), jerry_create_boolean(true), ...
if (config->font_key) { return config->font_key; }
const LayoutContentSize content_size = config->style; return (content_size == LayoutContentSize_Auto) ? system_theme_get_font_key(config->style_font) : system_theme_get_font_key_for_size(ToPreferredContentSize(content_size), config->style_font); } static void prv_set_text_node_text_parameters_from_con...
_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 4 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RE...
setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pebble_task_get_current()
) { case PebbleTask_App: case PebbleTask_Worker: return true; default: return false; } } void app_heap_analytics_log_native_heap_oom_fault(size_t requested_size, Heap *heap) { if (!prv_is_current_task_app_or_worker()) { return; } const uint32_t total_size = heap_size(heap); unsign...
ased(sector * SECTOR_SIZE_BYTES + addr)) { return false; } } return true; } static void prv_handle_ping_request(const void *payload, uint32_t length) { // echo it back prv_send_frame(OPCODE_PING, payload, length); } static void prv_handle_disconnect_request(const void *payload, uint32_t length) { ...
{ response.complete = 1; }
elay_b = 200; const int delay_seq = 150; int duration_total = duration_a + duration_b + delay_a + delay_b + delay_seq; // Create 2 test animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); animation_set_delay(a, delay_a); Animation *b = prv_create_test_animation...
animation_set_duration(a, duration_a)
; animation_set_delay(a, delay_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_delay(b, delay_b); // Create a spawn Animation *spawn = animation_spawn_create(a, b, NULL); cl_assert(spawn != NULL); animation_set_delay(spawn, delay_spawn); prv_clea...
text_layer_set_text_color(&data->direction_layer, GColorBlack)
; text_layer_set_background_color(&data->direction_layer, GColorWhite); text_layer_set_text_color(&data->word_wrap_layer, GColorBlack); text_layer_set_background_color(&data->word_wrap_layer, GColorWhite); if (data->select_index == SelectIndexDirection) { text_layer_set_text_color(&data->direction_layer, G...
fake_app_timer_init()
; rocky_runtime_context_init(); jerry_init(JERRY_INIT_EMPTY); s_tick_timer_service_subscribe = (MockCallRecordings){0}; s_log_internal__expected = NULL; } void test_rocky_api_tickservice__cleanup(void) { jerry_cleanup(); rocky_runtime_context_deinit(); } static const RockyGlobalAPI *s_api[] = { &TICKSER...
/* * 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...
(GROUP_TYPE, num_attributes, num_actions, attributes_per_actions, required_size_for_strings)
; } void attributes_actions_init(AttributeList *attr_list, TimelineItemActionGroup *action_group, uint8_t **buffer, uint8_t num_attributes, uint8_t num_actions, const uint8_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...
SECTION(".pbl_fw_version")
= { .version_timestamp = GIT_TIMESTAMP, .version_tag = GIT_TAG, .version_short = GIT_REVISION, .is_recovery_firmware = FIRMWARE_METADATA_IS_RECOVERY_FIRMWARE, .is_ble_firmware = true, .reserved = 0, .hw_platform = FIRMWARE_METADATA_HW_PLATFORM, .metadata_version = FW_METADATA_CURRENT_STRUCT_VERSION, };...
color(ctx, AVG_LINE_COLOR); graphics_fill_rect(ctx, &(GRect) {{ offset_x, offset_y - AVG_LINE_HEIGHT / 2 }, { width, AVG_LINE_HEIGHT }}); } static void prv_draw_avg_lines(HealthGraphCard *graph_card, GContext *ctx) { const GRect *bounds = &graph_card->layer.bounds; const int w...
(graph_card->selection - Monday, DAYS_PER_WEEK)
- positive_modulo(graph_card->current_day - Monday, DAYS_PER_WEEK) - DAYS_PER_WEEK) * SECONDS_PER_DAY) + graph_card->data_timestamp; const int pos = clock_get_month_named_abbrev_date(buffer, buffer_size, selection_time); strncat(buffer, i18n_get(": ", graph_card), buffer_size - pos - 1); ...
.attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { .header = { // [2] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb3}, .parent_id =...
timeline_model_get_iter_state(-1)
->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_mo...
ce_bg_color = {0}, .template_id = 0, .icon_resource_id = 0, }; static const Uuid tictoc_uuid = { 0x8f, 0x3c, 0x86, 0x86, 0x31, 0xa1, 0x4f, 0x5f, 0x91, 0xf5, 0x01, 0x60, 0x0c, 0x9b, 0xdc, 0x59 }; static const Uuid music_uuid = {0x1f, 0x03, 0x29, 0x3d, 0x47, 0xaf, 0x4f, 0x28, ...
(&music_uuid, &uuid_entry)
(); ble_hrm_push_reminder_popup(); analytics_event_ble_hrm(BleHrmEventSubtype_SharingTimeoutPopupPresented); PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing timeout fired!"); } //! @note executes on timer task static void prv_reminder_popup_timer_cb(void *unused) { prv_execute_on_kernel_main(prv_push_reminder_popup...
prv_update_is_sharing(connection, prev_is_sharing)
; if (is_subscribed) { const HrmSharingPermission current_permission = prv_get_permission_by_device(&connection->device); switch (current_permission) { case HrmSharingPermission_Unknown: prv_request_sharing_permission(connection); break; case HrmSharingPermission_Granted: ...
nvalid("Not a valid event"); } if (!jerry_value_is_function(argv[1])) { return rocky_error_argument_invalid("Not a valid handler"); } *func = argv[1]; return jerry_create_undefined(); } JERRY_FUNCTION(prv_add_event_listener) { char event_name[32]; jerry_value_t func; // out parameter &func will not...
{ EventHandlersCallArgs * const args = data; rocky_util_call_user_function_and_log_uncaught_error(listener, args->this_arg, args->args_p, args->args_count); return true; }
"util/math.h" #include "util/size.h" #include "clar.h" #include <stdio.h> static GContext s_ctx; // Fakes ///////////////////// #include "fake_content_indicator.h" #include "fake_spi_flash.h" #include "../../fixtures/load_test_resources.h" GContext *graphics_context_get_current_context(void) { return &s_ctx; } ...
{ // Do nothing }
// From action_menu_layer.c, needed to scroll the action menu layer to the point of interest void prv_set_selected_index(ActionMenuLayer *aml, int selected_index, bool animated); typedef enum { ActionMenuLayerLongLabelScrollingAnimationState_Top, ActionMenuLayerLongLabelScrollingAnimationState_Middle, ActionMe...
ttributes, &buffer_size_cursor, end); // Allocate buffers both for the Attribute structs as well as the data they'll hold Attribute attribute_buffer[num_attributes]; char attribute_data_buffer[buffer_size]; // Setup the arguments for the `attribute_deserialize_list` function char *attribute_data_buffer_poin...
{ Attribute app_glance_subtitle_attributes[] = { { .id = AttributeIdSubtitleTemplateString, .cstring = "This is a really really really really really really really really really " "really really really really really really really really really really " ...
'r', 'e', 'a', 'l', 'l', 'y', ' ', 'r', 'e', 'a', 'l', 'l', 'y', ' ', 'r', 'e', 'a', 'l', 'l', 'y', ' ', 'r', 'e', 'a', 'l', 'l', 'y', ' ', 'r', 'e', 'a', 'l', 'l', 'y', ' ', 'l', 'o', 'n', 'g', ' ', 's', 'u', 'b', 't', 'i', 't', 'l', 'e', '!', }; const size_t app_glance_subtitl...
rom fullscreen to thin // - After completion // - Bounce back timeline pin layouts // - Speed lines (if launching into a deep pin) // animate the peek layer to the right GRect *start = &data->peek_layer.layer.frame; GRect stop = { { was_mini_peek ? 0 : start->size.w , 0 }, start->size }; An...
{ TimelineAppData *data = context; event_service_client_unsubscribe(&data->focus_event_info); prv_intro_timer_callback(data); }
static void prv_peek_did_focus_handler(PebbleEvent *e, void *context) { TimelineAppData *data = context; event_service_client_unsubscribe(&data->focus_event_info); #if ANIMATION_DOT peek_layer_play(&data->peek_layer); #elif ANIMATION_SLIDE prv_play_peek_in(data); #endif if (data->state == TimelineAppState...
); } static void clear_reset_loop_detection_bits(void) { boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE); } static void uptime_callback(void* data) { PBL_LOG_VERBOSE("Uptime reached 15 minutes, set stable bit."); ...
bt_driver_init()
; services_init(); // The RTC needs be calibrated after the mfg registry service has been initialized so we can // load the measured frequency. rtc_calibrate_frequency(mfg_info_get_rtc_freq()); clear_reset_loop_detection_bits(); task_watchdog_mask_set(PebbleTask_KernelMain); stop_mode_enable(Inhibito...
(void) { // Process Command uint8_t *resp_ptr = process_blob_db_command(s_insert_cmd_size_value_wrong, sizeof(s_insert_cmd_size_value_wrong)); // Check Response cl_assert(0 < *(uint16_t*)resp_ptr); resp_ptr += sizeof(uint16_t); cl_assert(BLOB_DB_INVALID_DATA == *resp_ptr); resp_ptr += sizeof(uint8_t); ...
(token, *(uint16_t*)resp_ptr)
percent; graphics_context_set_fill_color(ctx, GColorDarkCandyAppleRed); graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, 15, 0, TRIG_MAX_ANGLE); graphics_context_set_stroke_color(ctx, GColorJaegerGreen); graphics_context_set_fill_color(ctx, GColorJaegerGreen); graphics_fill_radial(ctx, bounds, GOv...
steps_update_text(data)
Weekend) { if (is_weekend) { which_stats = &stats.weekend; } else { which_stats = &stats.weekday; } } else if (scope == HealthServiceTimeScopeWeekly) { which_stats = &stats.weekly; } else { APP_LOG(APP_LOG_LEVEL_ERROR, "Unsupported scope: %d", (int) scope); result = 0; } // ...
{ value = ROUND(value, num_samples); }
} if (num_samples == 0) { // Error case: no samples value = 0; } return value; } // --------------------------------------------------------------------------------------------- // Init a metric alert info structure static void prv_init_metric_alert(HealthServiceState *state, HealthMetric metric, ...
/* * 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...
(obj_type)
; const size_t read_buffer_size = 2048; uint8_t *read_buffer = kernel_zalloc(read_buffer_size); bool success = false; if (!read_buffer) { // If we can't alloc 2kB put bytes is likely going to fail anyway so just fallback to default // impl return success; } uint32_t curr_read_address = layou...
minute data and verified in the test_health__heart_rate_scope_once() cl_assert_equal_i(result, exp_value); } } } } // -------------------------------------------------------------------------------------- // Test calls to compute heart rate stats with scope once. This ends up being implemented usi...
(&event, NULL)
; } // Should not get any metric alerts because none registered cl_assert_equal_i(s_metric_alert_count, 0); // Create an alert for heart rate 65 HealthMetricAlert *alert = health_service_register_metric_alert(HealthMetricHeartRateBPM, 65); for (int i = 60; i < 70; i++) { s_sys_activity_get_metric_valu...
/* * 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 (!sys_app_inbox_service_register(buffer, buffer_size, message_handler, dropped_handler)) { applib_free(buffer); return NULL; }
return (AppInbox *) buffer; } uint32_t app_inbox_destroy_and_deregister(AppInbox *app_inbox) { uint8_t *buffer = (uint8_t *)app_inbox; uint32_t num_messages_lost = sys_app_inbox_service_unregister(buffer); applib_free(buffer); return num_messages_lost; } void app_inbox_consume(AppInboxConsumerInfo *consume...
(rv == E_RANGE); rv = pfs_seek(fd, len + 1, FSeekSet); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, -1, FSeekSet); cl_assert(rv == E_RANGE); } void test_pfs__read(void) { const int rd_len = 10; int rv = pfs_read(-1, NULL, rd_len); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_read(0, NULL, rd_len); ...
(pfs_write(fd, bigbuf, large_file_size) == large_file_size)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
health_hr_summary_card_get_bg_color(card_layer)
); window_set_on_screen(&window, true, true); window_render(&window, &s_ctx); } // Tests ////////////////////// void test_health_hr_summary_card__render_no_data(void) { prv_create_card_and_render(&(HealthData) {}); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_hr_summary_car...
/* * 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...
{ AppData *app_data = app_malloc_check(sizeof(AppData)); app_state_set_user_data(app_data); window_init(&app_data->window, WINDOW_NAME("test_mpu")); window_set_user_data(&app_data->window, app_data); window_set_window_handlers(&app_data->window, &(WindowHandlers) { .load = prv_window_load }); const b...
static void prv_main(void) { prv_handle_init(); app_event_loop(); } const PebbleProcessMd* test_mpu_cache_get_info() { static const PebbleProcessMdSystem s_test_mpu_info = { .common.main_func = prv_main, .name = "Test MPU cache" }; return (const PebbleProcessMd*) &s_test_mpu_info; }
.h" #include "services/normal/activity/health_util.h" #include "services/normal/activity/workout_service.h" #include "system/logging.h" #include <stdio.h> #define BACKGROUND_COLOR PBL_IF_COLOR_ELSE(GColorYellow, GColorWhite) #define TEXT_COLOR (gcolor_legible_over(BACKGROUND_COLOR)) typedef struct WorkoutSummaryWind...
(&summary_window->window)
; i18n_free_all(summary_window); app_free(summary_window); } } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Public API WorkoutSummaryWindow *workout_summary_window_create(ActivitySessionType activity_type, ...
/* * 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...
connection_service_state_init(worker_state_get_connection_service_state())
; tick_timer_service_state_init(worker_state_get_tick_timer_service_state()); #if CAPABILITY_HAS_HEALTH_TRACKING health_service_state_init(worker_state_get_health_service_state()); #endif } void worker_state_deinit(void) { #if CAPABILITY_HAS_HEALTH_TRACKING health_service_state_deinit(worker_state_get_health_s...
onnection) { bool val; prv_lock(); { val = connection->is_gateway; } prv_unlock(); return val; } static bool prv_get_flag(const Connection *connection, ConnectionFlag flag) { bool val; prv_lock(); { uint32_t bit = (1 << flag); val = ((connection->flags & bit) == bit); } prv_unlock(); ...
{ connection->last_pairing_result = result; }
} prv_unlock(); } void connection_set_ppogatt_wa_state(Connection *connection, PPoGATTWorkAroundState *state) { prv_lock(); { connection->ppogatt_wa_state = state; } prv_unlock(); } void connection_set_conn_params(Connection *connection, const BleConnectionParams *params) { prv_lock(); { if (...
return NULL; } bool memory_layout_is_buffer_in_region(const MpuRegion *region, const void *buf, size_t length) { return true; } // We can't include all of stubs_process_manager because it conflicts with fake_app_manager.h bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent* e) { return true; } ...
free (random_buf)
; return (random_crc); } // ---------------------------------------------------------------------------------------- static void prv_log_consume_random(DataLoggingSessionRef logging_session, int item_size, int num_items) { uint32_t random_crc = prv_log_random_data(logging_session...
/* * 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_SetReload(0xfff)
; IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable); DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP, ENABLE); } void watchdog_start(void) { IWDG_Enable(); watchdog_feed(); } // This behaves differently from the bootloader and the firmware. void watchdog_feed(void) { IWDG_ReloadCounter(); } bool watchdog_check_rese...
egend; bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &test_bmp, upper_legend_rect, GPointZero, GCompOpAssign, GColorWhite); test_bmp.addr = test_blend_colors; bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &test_bmp, upper_rect, GPointZero, GCompOpTint, upper_tint_color); // Lower row with destination c...
(0, 0, src_bitmap->bounds.size.w, src_bitmap->bounds.size.h*2 + 4)
; bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit( &dest_bitmap, src_bitmap, dest_rect, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_wrap_y-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Test src_origin_offset, shouldn't see any red in dest_bitma...
/* * 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...
(&BOARD_CONFIG_DISPLAY.cs, true)
; // setup time > 3us // this produces a setup time of ~7us for (volatile int i = 0; i < 32; i++); } static void prv_disable_chip_select(void) { // delay while last byte is emitted by the SPI peripheral (~7us) for (volatile int i = 0; i < 48; i++); gpio_output_set(&BOARD_CONFIG_DISPLAY.cs, false); // hol...
_pairing_service_send_ios_app_termination_detected(); } } else if (evt->handle == s_pps_ctx.att_hdl.gatt_mtu_cccd) { connection_set_subscribed_to_gatt_mtu_notifications(connection, is_subscribed); value_handle = s_pps_ctx.att_hdl.gatt_mtu; } else if (evt->handle == s_pps_ctx.att_hdl.conn_params_cccd) { ...
{ return ATT_ERROR_UNLIKELY; }
att_error_t rv; if (evt->length == 0) { rv = ATT_ERROR_INVALID_VALUE_LENGTH; goto finally; } const PebblePairingServiceConnParamsWrite *conn_params = (const PebblePairingServiceConnParamsWrite *)evt->value; const size_t length = (evt->length - offsetof(PebblePairingServiceConnParamsWrite, ...
d.h" #include "drivers/dma.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/spi.h" #include "drivers/spi_dma.h" #include "kernel/util/delay.h" #include "kernel/util/stop.h" #include "system/passert.h" #include "util/units.h" #define STM32F2_COMPATIBLE #define STM32F4_COMPATIBLE #define...
{ s_dma_transfer_complete_cb(&should_context_switch); }
return should_context_switch; } void dialog_spi_send_and_receive_dma(const void *tx_buffer, void *rx_buffer, size_t size, DialogSpiDmaTransferCompletedCallback done_isr_callback) { PBL_ASSERTN(tx_buffer || rx_buffer); // FIXME: PBL-32864: Ugh, can't do this from ISR // per...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(*state->position)
FFSET_RECT_CLIP_XY, true, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_C...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if 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...
(__bss_start, 0, __bss_end - __bss_start)
; #if MICRO_FAMILY_STM32F7 // Clear the DTCM bss section memset(__dtcm_bss_start, 0, __dtcm_bss_end - __dtcm_bss_start); #endif SystemInit(); icache_enable(); dcache_enable(); main(); // Main shouldn't return while (true) {} }
---------------------------------------------------------------------------- // Reset the data we're tracking for workers that crash static void prv_reset_last_worker_crashed_data(void) { // No need to reset s_last_worker_crash_timestamp because we always check the install id before // we check the timestamp s_la...
{ worker_manager_put_launch_worker_event(closing_worker_install_id); }
buted 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 "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/voltage_monitor.h" #include ...
(ADC1, DISABLE)
; ADC_TempSensorVrefintCmd(DISABLE); periph_config_disable(ADC1, RCC_APB2Periph_ADC1); mutex_unlock(s_adc_mutex); }
const GTextAlignment alignment, TextLayout* const layout) { PBL_ASSERTN(layout); bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, text); if (!success) { layout->max_used_size = GSizeZero; PBL_LOG(LOG_LEVEL_DEBUG, "Invalid UT...
(LOG_LEVEL_DEBUG, "Invalid UTF8")
; return; } GRect global_box = grect_to_global_coordinates(box, ctx); GRect temp_box = global_box; grect_clip(&temp_box, &ctx->draw_state.clip_box); if (temp_box.size.h <= 0) { // the text is not ever going to make it on screen. Bail early. return; } if (layout) { layout->box.origin = ...
if (!prv_should_animate_casssette()) { animation_set_play_count(sequence, 0); } return sequence; } static void prv_trigger_track_change_animation(MusicAppData *data) { // Animation structure: // - Master animation // - Cassette animation // - Move to left // - Move in from right // ...
{ action_bar_layer_set_icon_animated(&data->action_bar, BUTTON_ID_SELECT, &data->icon_play, animated); }
ntal_line_dotted(&ctx, GPoint(0, 9), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 13), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17), 21); graphics_draw_horiz...
graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_b...
OnCommunication visibility (given in seconds) static int32_t VISIBILITY_ON_ACTIVITY_TIMEOUT_SECONDS = (5 * SECONDS_PER_MINUTE); static bool prv_app_install_entry_from_app_db_entry(AppInstallId id, AppDBEntry *db_entry, AppInstallEntry *install_entry); static AppInst...
{ return (entry->has_worker); }
bool app_install_entry_is_hidden(const AppInstallEntry *entry) { switch (entry->visibility) { case ProcessVisibilityHidden: return true; case ProcessVisibilityShownOnCommunication: // make icon hidden (return true) if app has not recently communicated return !app_install_is_prioritized(ent...
sourceId; const uint8_t *resource_get_builtin_bytes(ResAppNum app_num, uint32_t resource_id, uint32_t *num_bytes_out) { return NULL; } // setup and teardown void test_gdraw_command_sequence__initialize(void) { } void test_gdraw_command_sequence__cleanup(void) { } size_t prv_create_test_sequence(GDrawComman...
(sequence, 15)
; cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(sequence, 1));; cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 44)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 45)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame...
that was previously aquired in pmic_enable_battery_measure. prv_mon_config_unlock(); return result; } uint16_t pmic_get_vsys(void) { prv_mon_config_lock(); const PmicMonConfig *mon_config = &MON_CONFIG[PMIC_MON_CONFIG_VSYS_INDEX]; prv_set_mon_config(mon_config); ADCVoltageMonitorReading reading = batter...
(s_debounce_usb_conn_timer, USB_CONN_DEBOUNCE_MS, prv_debounce_callback, NULL, 0 /*flags*/)
; } static void pmic_interrupt_handler(bool *should_context_switch) { system_task_add_callback_from_isr(prv_handle_pmic_interrupt, NULL, should_context_switch); } /* Private Function Implementations */ static bool prv_is_alive(void) { uint8_t val; prv_read_register(0x00, &val); if (val == 0x01) { PBL_LO...
, percent); } static const PropertyAnimationImplementation s_progress_bar_impl = { .base = { .update = (AnimationUpdateImplementation) property_animation_update_int16, }, .accessors = { .setter = { .int16 = prv_set_percent, }, }, }; // animate the progress bar in by growing it from the left (or just s...
{ animation_unschedule((Animation *)data->mic_window.progress_anim); loading_layer_pause(&data->mic_window.progress_bar); layer_set_hidden((Layer *)&data->mic_window.progress_bar, true); }
static void prv_voice_confirm_cb(void *context) { prv_exit_and_send_result_event((VoiceUiData *)context, DictationSessionStatusSuccess); } // Initiates transitions triggered by animations finishing static void prv_handle_stop_transition(VoiceUiData *data) { // Transition to next state switch (data->state) { ...
}, { -1360, 488, -152}, { -1128, 384, -128}, { -1088, 512, -248}, { -776, 424, -264}, { -472, 280, -152}, { -416, 432, -224}, { -456, 432, -208}, { -504, 384, -120}, { -616, 464, -152}, { -608, 488, -128}, { -696, 488, -136}, { -912, 568, -112}, // 76 seconds { -1...
// 81 seconds { -1152, 400, -8}, { -1128, 488, -88}, { -832, 448, -336}, { -424, 536, -376}, { -288, 480, -304}, { -272, 336, -160}, { -432, 360, -104}, { -568, 440, -104}, { -824, 480, -112}, { -960, 480, -40}, { -1344, 560, -136}, { -1296, 384, 8}, { -1504, 576,...
{ -1072, 504, -192}, { -1744, 656, -344}, { -1472, 560, -352}, { -1488, 368, -192}, { -1448, 232, -80}, { -856, 272, -8}, { -384, 216, 40}, { -432, 320, 48}, { -512, 432, 88}, { -440, 448, 176}, // 84 seconds { -288, 192, 128}, { -304, 280, 48}, { -328, 208, 16},...
ing_for_custom(schedule_2, alarm_day_text_2); cl_assert_equal_s(alarm_day_text_2, "Mon,Tue,Wed,Thu,Fri,Sat,Sun"); bool schedule_3[7] = {false, true, false, false, false, false, false}; char alarm_day_text_3[32] = {0}; alarm_get_string_for_custom(schedule_3, alarm_day_text_3); cl_assert_equal_s(alarm_day_text...
alarm_delete(1)
; } void test_alarm__snooze_delay(void) { int delay; delay = alarm_get_snooze_delay(); cl_assert_equal_i(delay, 10); alarm_set_snooze_delay(15); delay = alarm_get_snooze_delay(); cl_assert_equal_i(delay, 15); } void test_alarm__set_snooze_alarm() { alarm_set_snooze_alarm(); cl_assert_equal_i(s_snooze...
c.h" #include "mfg/mfg_info.h" #include "mfg/mfg_serials.h" #include "process_state/app_state/app_state.h" #include "services/common/hrm/hrm_manager.h" #include "system/passert.h" #define BPM_STRING_LEN 10 typedef enum { AppMessageKey_Status = 1, AppMessageKey_HeartRate = 10, AppMessageKey_Confidence = 11, A...
(app_data->out_iter, AppMessageKey_HRMSoftwareVersionMinor, hrm_info.sw_version_minor)
; dict_write_uint8(app_data->out_iter, AppMessageKey_HRMApplicationID, hrm_info.application_id); dict_write_uint8(app_data->out_iter, AppMessageKey_HRMHardwareRevision, hrm_info.hw_revision); } #endif char serial_number_buffer[MFG_SERIAL_NUMBER_SIZE + 1]; mfg_inf...
n a file. static status_t find_free_page(uint16_t *free_page, bool use_gc_allocator, bool use_page) { // if we are allocating a file from the garbage collection region, // we don't need to search for free pages since we know what ones to use if (use_gc_allocator) { uint16_t next_page = (*free_page == INV...
mutex_unlock_recursive(s_pfs_mutex)
; // TODO: might be nice to only sleep here if we had to perform GC as part // of finding a free page if ((pages_to_find % 4) == 0) { psleep(2); } pages_to_find--; uint32_t elapsed_ticks = rtc_get_ticks() - start_ticks; if (max_elapsed_ticks != 0 && (elapsed_ticks > max_elapsed_ticks)...
&s_started_handler_calls, NULL), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 0); // Execute to the start of B and C prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL),...
(&s_stopped_handler_calls, b0)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b1), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b2), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b3), 0); // Let it finish completely prv_advance_to_ms_with_timers(start_m...
ctionMenu *action_menu, const ActionMenuItem *item, void *context) { AlarmDetailData *data = (AlarmDetailData *) context; alarm_delete(data->alarm_id); if (data->alarm_editor_callback) { data->alarm_editor_callback(DELETED, data->alarm_...
i18n_noop("10 minutes")
, i18n_noop("15 minutes"), i18n_noop("30 minutes"), i18n_noop("1 hour") }; unsigned current_snooze_delay = alarm_get_snooze_delay(); for (int i = 0; i < NUM_SNOOZE_MENU_ITEMS; i++) { snooze_level->items[i] = (ActionMenuItem) { .label = i18n_get(snooze_delay_strs[i], data), .perform_ac...
int top_bottom_inset = (frame.size.h - LAUNCHER_MENU_LAYER_CELL_ROUND_FOCUSED_CELL_HEIGHT - (2 * LAUNCHER_MENU_LAYER_CELL_ROUND_UNFOCUSED_CELL_HEIGHT)) / 2; const GEdgeInsets menu_layer_frame_insets = GEdgeInsets(top_bottom_inset, 0); menu_layer_frame = grect_inset(menu_layer_frame, menu_layer_frame...
menu_layer_set_click_config_onto_window(&launcher_menu_layer->menu_layer, window)
; } void launcher_menu_layer_reload_data(LauncherMenuLayer *launcher_menu_layer) { if (!launcher_menu_layer) { return; } menu_layer_reload_data(&launcher_menu_layer->menu_layer); } void launcher_menu_layer_set_selection_state(LauncherMenuLayer *launcher_menu_layer, ...
WS][DISP_LINE_BYTES]) { // Need to convert offsets to bytes for the horizontal dimensions x_offset = prv_round_to_byte(x_offset); width = prv_round_to_byte(width); for (unsigned i = 0; i < height; i++) { memcpy(buffer[i + y_offset] + x_offset, bitmap + i * width, width); } } static void prv_display_buff...
prv_enable_display_spi_clock()
; prv_display_start(); prv_disable_display_spi_clock(); }
; case MusicCommandSkipBackward: return AMSRemoteCommandIDSkipBackward; case MusicCommandLike: return AMSRemoteCommandIDLike; case MusicCommandDislike: return AMSRemoteCommandIDDislike; case MusicCommandBookmark: return AMSRemoteCommandIDBookmark; default: return AMSRem...
{ return id; }
(USART2, uart_irq_handler, QEMU_UART)
; #endif static UARTDeviceState s_dbg_uart_state; static UARTDevice DBG_UART_DEVICE = { .state = &s_dbg_uart_state, .tx_gpio = { .gpio = GPIOD, .gpio_pin = GPIO_Pin_8, .gpio_pin_source = GPIO_PinSource8, .gpio_af = GPIO_AF_USART3 }, .rx_gpio = { .gpio = GPIOD, .gpio_pin = GPIO_Pin_9, ...
/* * 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...
(system_flash_erase(FLASH_BASE + 12345, 1, NULL, NULL))
the entry if (uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) { // if this is the current timer event, cancel it if (wakeup_id == s_wakeup_state.current_wakeup_id && new_timer_scheduled(s_current_timer_id, NULL)) { new_timer_stop(s_current_timer_id); } // Deletes the en...
wakeup_popup_window(missed_events.missed_apps_count, missed_events.missed_app_ids)
; } // Setup a timer for the next wakeup event; will return if wakeup is not enabled prv_wakeup_timer_next_pending(); } void wakeup_handle_clock_change(void) { // Offload the rewrite of the wakeup file to KernelBG as it may take a while // // TODO: The flash burden of this routine could also be reduced by...
18n_ctx_noop("TmplStringPlur", "")}, /// Singular suffix for days with abbreviated units { i18n_ctx_noop("TmplStringSing", " d"), /// Plural suffix for days with abbreviated units i18n_ctx_noop("TmplStringPlur", " d")}, /// Singular suffix for days with full units { i18n_ctx_noop("TmplStringSing", " day")...
prv_do_conversion(state, value, 365 * SECONDS_PER_DAY, 100, s_year_strings, add_units, zero_pad, modulus)
; break; #endif #if SUPPORT_MONTH case 'm': // month // NOTE: This number of seconds to divide by is a hack! See PBL-39903 prv_do_conversion(state, value, 30 * SECONDS_PER_DAY, 12, s_month_strings, add_units, zero_pad, modulus); break; #endif case 'd': // day ...
torage, compression or reset watch? goto reset_storage; } s_write_offset += result; prv_file_close(fd); return; reset_storage: mutex_unlock_recursive(s_notif_storage_mutex); notification_storage_reset_and_init(); } // Finds the next match in the notification storage file from the current position //...
PBL_LOG(LOG_LEVEL_ERROR, "Could not retrieve notification with id %s and size %u", uuid_string, header.payload_length)
; rv = false; } } prv_file_close(fd); return rv; } //! @return is_advanced static bool prv_iter_next(NotificationIterState *iter_state) { int result = pfs_read(iter_state->fd, (uint8_t *)&iter_state->header, sizeof(iter_state->header)); // Restore flags & status iter_state->header.common.flag...
44}, { 1288, 272, -264}, { 1144, 384, -280}, { 968, 432, -272}, { 1048, 416, -208}, { 1128, 312, -112}, { 1128, 280, -56}, { 944, 256, -64}, { 792, 208, -32}, { 744, 184, -24}, { 768, 208, -24}, { 880, 224, 8}, { 960, 152, 72}, { 1088, 160, 24}, { 1112, 160, -16},...
{ 664, 240, -104}, { 648, 192, -120}, { 728, 232, -96}, // 56 seconds { 824, 272, -192}, { 1056, 296, -224}, { 1232, 352, -312}, { 1112, 344, -320}, { 1072, 344, -272}, { 1272, 392, -296}, { 1048, 400, -256}, { 1008, 368, -168}, { 1120, 352, -128}, { 1256, 336, -3...
{ 1120, 448, -168}, { 1360, 416, -40}, { 1336, 280, 128}, { 1176, 248, 88}, { 960, 224, 0}, { 800, 224, -56}, { 784, 168, 0}, { 816, 120, 24}, { 808, 216, 8}, { 896, 168, 48}, // 59 seconds { 1000, 248, 16}, { 968, 168, -48}, { 1144, 136, -32}, { 1168, 136, -...
s; } bool pmic_set_charger_state(bool enable) { // Defaults to ON // LSB is enable bit uint8_t register_value; if (!prv_read_register(PmicRegisters_CHG_CNTL_A, &register_value)) { return false; } if (enable) { register_value |= 0x01; } else { register_value &= ~0x01; } bool result = prv_...
PBL_LOG(LOG_LEVEL_DEBUG, "Error: read max14690 whomai byte 0x%x, expecting 0x%x", val, 0x01)
// Now, reschedule it prv_advance_by_ms_no_timers(10); prv_clear_handler_histories(); animation_schedule(h); max_loops = 20; start_ms = prv_now_ms(); while (s_stopped_handler_calls.num_calls == 0) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("%"PRIu64": frame at: %d, %d, %d %...
prv_now_ms()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert_equal_p(NULL, comm_session_send_buffer_begin_write(NULL, ENDPOINT_ID, 1, TIMEOUT_MS)); }
void test_session_send_buffer__begin_write_with_more_than_max_payload(void) { s_valid_session = &s_session; size_t max_length = comm_session_send_buffer_get_max_payload_length(&s_session); SendBuffer *write_sb = comm_session_send_buffer_begin_write(&s_session, ENDPOINT_ID, ...
out.h" static bool s_prefs_24h_style; #define TIMEZONE_FIXTURE_PATH "timezones" // Setup ///////////////////////// void test_clock__initialize(void) { // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, f...
rtc_get_time()
le LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * di...
memcmp(s_settings_file.keys[key_crc8], key, key_len)
e(); } const bool is_modal_unfocused = (update.properties & ModalProperty_Unfocused); const bool was_modal_unfocused = (last_properties & ModalProperty_Unfocused); if (was_modal_unfocused && !is_modal_unfocused) { // We now have a modal window focused when we didn't have one before, start the transition. ...
(window, true /* new on screen */, true /* call handlers */)
; } // Setting on-screen can configure the click, but if this is a window below a transparent // window that just disappeared, it was already on screen and may need its click configured. const bool is_focused = (iter->current_idx == iter->first_focus_idx); if (!window->is_click_configured && is_focused) { ...
he current page the offset is on FilePageCache *pg_cache; uint8_t pg_cache_len; } File; // The backing information tracked using the handle returned to callers #define FD_STATUS_IN_USE 0x0 // A caller is using this fd #define FD_STATUS_UNREFERENCED 0x1 // Valid data, no one using #define FD_STATUS_FR...
(buffer, size, offset)
; prv_invalidate_page_flags_cache(offset, size); } else { PBL_LOG(LOG_LEVEL_ERROR, "FS write out of bounds 0x%x", (int)offset); } } // Erases all pages for the sector which begins at 'start_page' static void prv_flash_erase_sector(uint16_t start_page) { uint32_t offset = PFS_PAGE_SIZE * start_page; if ...
); for (int i = 0; i < ActivationDelayInsightTypeCount; i++) { time_t trigger_time_t = time_util_get_midnight_of(activation_time); trigger_time_t += (ACTIVATION_DELAY_INSIGHTS[i].day_lag * SECONDS_PER_DAY); struct tm trigger_time; gmtime_r(&trigger_time_t, &trigger_time); trigger_time_t += time_u...
activity_get_metric(ActivityMetricSleepStateSeconds, 1, &sleep_state_seconds)
; if (sleep_state_seconds < s_sleep_reward_settings.reward.sleep.trigger_after_wakeup_seconds) { INSIGHTS_LOG_DEBUG("Not triggering sleep reward - haven't been awake long enough: %"PRId32, sleep_state_seconds); return; } // All criteria have been met, show reward prv_push_reward(...
nel_free(callback_node); mutex_unlock_recursive(s_pfs_mutex); } // IMPORTANT: This call assumes that the caller has already grabbed s_pfs_mutex static void prv_invoke_watch_file_callbacks(const char* file_name, uint8_t event) { PFSFileChangedCallbackNode *callback_node = (PFSFileChan...
prv_page_to_flash_offset(pg)
+ file_namelen_offset); char file_name[file_hdr.file_namelen + 1]; prv_flash_read((uint8_t *)file_name, file_hdr.file_namelen, prv_page_to_flash_offset(pg) + FILE_NAME_OFFSET); file_name[file_hdr.file_namelen] = 0; if (callback && !callback(file_name)) { // Don't include ...
for busy bit to clear static bool wait_for_busy_clear(uint8_t bus_idx) { unsigned int attempts = I2C_TIMEOUT_ATTEMPTS_MAX; while((i2c_buses[bus_idx].i2c->SR2 & I2C_SR2_BUSY) != 0) { --attempts; if (!attempts) { return false; } } return true; } //! Abort the transfer //! Should only be calle...
wait_for_busy_clear(bus_idx)
alse); graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(50, 40), GPoint(70, 35)); } void across_nx_layer_up...
(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_inside_origin_layer"))
); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&l...
bigger, but today //! there is no way to communicate the maximum allowable chunk size, it's been hard-coded in the //! clients (i.e. mobile app, libpebble, ...) so it would require a protocol change / extension //! to increase this. We could experiment with increasing this in the future for slightly faster //! object ...
{ PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs; PutBytesJob *job; prv_lock_pb_job_state(); { PBL_ASSERTN(put_jobs->num_ops_pending != put_jobs->num_allocated_pb_jobs); uint8_t write_idx = (put_jobs->read_idx + put_jobs->num_ops_pending) % put_jobs->num_allocated_pb_jobs; job ...
//! Frees up 'num_jobs' in the put_jobs array static void prv_mark_pb_jobs_complete(size_t num_jobs) { prv_lock_pb_job_state(); { PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs; PBL_ASSERTN(num_jobs <= put_jobs->num_ops_pending); put_jobs->num_ops_pending -= num_jobs; put_jobs->read_i...
ve_alarm(fd, alarm->id); return; } CronJob cron; time_t execute_time = prv_build_cron(&alarm->config, &cron); prv_timeline_add_alarm(fd, alarm, &cron, rtc_get_time()); if (s_next_alarm_time == 0 || execute_time < s_next_alarm_time) { // This alarm is sooner than the previous one! prv_assign_alar...
{ PBL_LOG(LOG_LEVEL_INFO, "Snooze timeout"); system_task_add_callback(prv_snooze_kernel_bg_callback, NULL); }
// ---------------------------------------------------------------------------------------------- T_STATIC void prv_timer_kernel_bg_callback(void *data) { AlarmId id = (intptr_t) data; if (id == ALARM_INVALID_ID) { return; } // We allocate some larger variables on the heap to reduce stack usage AlarmCo...
attribute++] = (Attribute) { .id = AttributeIdTimestamp, .uint32 = pin->header.timestamp, }; timeline_invoke_action(pin, action, &response_attributes); kernel_free(response_attributes.attributes); break; } case TimelineItemActionTypeResponse: { data->response.attri...
prv_invoke_local_action(action, pin)
; return NULL; case TimelineItemActionTypeAncsResponse: case TimelineItemActionTypeAncsGeneric: case TimelineItemActionTypeAncsNegative: case TimelineItemActionTypeAncsPositive: case TimelineItemActionTypeAncsDelete: case TimelineItemActionTypeAncsDial: case TimelineItemActionTypeGener...
// Update call time immediately prv_update_call_time(NULL); } static void prv_stop_call_duration_timer(void) { evented_timer_cancel(s_phone_ui_data->call_duration_timer); s_phone_ui_data->call_duration_timer = EVENTED_TIMER_INVALID_ID; } static void prv_set_status_text(CallStatus status) { if (status == ACC...
prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL)
t_imp, TransportDestinationSystem); Uuid legacy_app_uuid = { 0xff, 0xc5, 0x24, 0x01, 0x4d, 0xbe, 0x40, 0x8b, 0xb7, 0x3a, 0x0e, 0x80, 0xef, 0x09, 0xaf, 0x74}; // Legacy transport (iAP) isn't aware of the app UUID, so don't set anything: Transport *legacy_tr...
cl_assert_equal_i(fake_system_task_count_callbacks(), 0)
; comm_session_send_next(session); comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(fake_system_task_count_callbacks(), 0); cl_assert_equal_i(s_send_next_count, 0); } static bool prv_schedule_send_next(CommSession *se...
mers.h" #include <FreeRTOS.h> #include <semphr.h> #include <bluetooth/bluetooth_types.h> #include <bluetooth/gap_le_connect.h> #include <bluetooth/gatt_service_types.h> #include <bluetooth/hci_types.h> #include <bluetooth/init.h> #include <bluetooth/mtu.h> #include <bluetooth/sm_types.h> #include <util/uuid.h> #def...
(evt->conn_idx, &event.mtu)
onsumed_length; size_t length; uint8_t data[]; } TestSendJob; static size_t prv_get_length(const TestSendJob *sb) { return (sb->length - sb->consumed_length); } static const uint8_t *prv_get_read_pointer(const TestSendJob *sb) { return (sb->data + sb->consumed_length); } static size_t prv_send_job_impl_get_l...
cl_assert_equal_m(data_out, TEST_DATA, sizeof(data_out))
; } void test_session_send_queue__copy_less_than_head_job_with_offset_shorter_than_job(void) { int num_jobs = 3; prv_add_jobs(num_jobs); uint8_t data_out[1]; memset(data_out, 0, sizeof(data_out)); int offset = 1; cl_assert_equal_i(sizeof(data_out), comm_session_send_queue_copy(s_valid_...
/* * 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...
(contacts_db_insert((uint8_t *)&uuid, UUID_SIZE, (uint8_t *)&serialized_contact, sizeof(serialized_contact)), 0)
; cl_assert(contacts_db_get_len((uint8_t *)&uuid, UUID_SIZE) > 0); Contact *contact = contacts_get_contact_by_uuid(&uuid); cl_assert(contact); cl_assert_equal_m(&contact->id, &uuid, UUID_SIZE); cl_assert_equal_i(contact->flags, 0); cl_assert_equal_i(contact->attr_list.num_attributes, 1); cl_assert_equal_...
nt_display_update, 0); cl_assert_equal_i(s_count_animation_create, 0); // Now the app has rendered something and we should actually update the display. compositor_app_render_ready(); cl_assert_equal_i(s_count_display_update, 1); } void test_compositor__app_not_ready_modal_push_pop(void) { // If a modal wind...
cl_assert_equal_i(s_count_animation_schedule, 2)
; cl_assert_equal_i(s_count_animation_destroy, 1); // The app framebuffer should still be locked while we're animating away cl_assert_equal_i(s_render_pending, true); // Finish the animation s_animation_implementation->teardown((Animation*) (uintptr_t) s_count_animation_create); // App should be free to re...
recognizers[4], &layer_b.recognizer_list); cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {0, 1}, 2, &s_recognizers_handled); // Recognizers attached to children of active layer will not be evaluated manager.active_layer = &layer_...
(prv_fail_recognizer(r1, &ctx))
; cl_assert_equal_i(r1->state, RecognizerState_Failed); cl_assert(!ctx.recognizers_active); // Make sure that we don't try to fail a recognizer twice (causing an assert) cl_assert(prv_fail_recognizer(r1, &ctx)); cl_assert_equal_i(r1->state, RecognizerState_Failed); r1->state = RecognizerState_Possible; ...
* SECONDS_PER_MINUTE); ActivitySession run_activity = { .start_utc = utc_sec - time_elapsed, .length_min = time_elapsed, .type = ActivitySessionType_Run, .ongoing = true, }; activity_sessions_prv_add_activity_session(&run_activity); // Run session active, ensure that asking if a run is ongoing...
{ // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // No sessions active, ensure that asking for run,walk,sleep retu...
.length_min = time_elapsed, .type = ActivitySessionType_Sleep, .ongoing = true, }; activity_sessions_prv_add_activity_session(&sleep_activity); // Flip the switch to say we are in light sleep. activity_private_state()->sleep_data.cur_state = ActivitySleepStateLightSleep; // Run,Walk,Sleep sessi...
* (progress.raw_value - top.y.raw_value) / (bottom.y.raw_value - top.y.raw_value); } static void prv_swap_precise_points(GPointPrecise *p0, GPointPrecise *p1) { GPointPrecise tmp = *p0; *p0 = *p1; *p1 = tmp; } static void prv_draw_scanline_collision_points(GContext *ctx, int16_t y, ...
normalize_angle(angle_start)
; int32_t angle_end_normalized = normalize_angle(angle_end); int8_t starting_quadrant_normalized = (angle_start_normalized / QUADRANT_ANGLE) % 4; int8_t ending_quadrant_normalized = (angle_end_normalized / QUADRANT_ANGLE) % 4; if (starting_quadrant_normalized == ending_quadrant_normalized) { // Both indic...
cl_assert_equal_b(app_glance_service_get_current_slice(&UUID_INVALID, &slice_out), false)
; // Requesting the current slice with a NULL slice_out argument should return false cl_assert_equal_b(app_glance_service_get_current_slice(&APP_GLANCE_TEST_UUID, NULL), false); // Insert a glance const AppGlance glance = (AppGlance) { .num_slices = 1, .slices = { { .expiration_time = 14...
/* * 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(db_id == s_blobdb_id)
; return test_db_mark_synced(key, key_len); }
get_elapsed(spawn, &position); cl_assert_equal_i(position, (680 - 310)); // Run to the completion of B, start of C prv_advance_to_ms_with_timers(start_ms + 730 + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entr...
prv_clear_handler_histories()
; uint64_t start_ms = prv_now_ms(); const AnimationHandlers handlers = { .stopped = prv_stopped_unschedule_all_handler, }; void *context = NULL; Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); animation_set_delay(a, delay_a); animation_set_handlers(a, handlers,...