prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
// ------------------------------------------------------------------------------------------- bool prv_animation_is_scheduled(AnimationState* state, AnimationPrivate *animation) { return (animation->abs_start_time_ms != 0); } // ------------------------------------------------------------------------------------...
list_insert_before(state->unscheduled_head, &animation->list_node)
line_dotted(&ctx, GPoint(132, 76), 5); // T facing right - lined up graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(10, 96), 5); // T facing right - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 90), 10); graphics...
(ctx, GPoint(22, 15), GPoint(15, 22))
; // bottom right corner graphics_draw_line(ctx, GPoint(10, 18), GPoint(10, 22)); // bottom graphics_draw_line(ctx, GPoint(5, 22), GPoint(-2, 15)); // bottom left corner } void test_graphics_draw_line__clipping_rect(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, C...
GTransformNumberOne.raw_value) / TRIG_MAX_RATIO) }; cl_assert(num.raw_value == num2.raw_value); } void test_graphics_gtransform_${BIT_DEPTH_NAME}__types_precise(void) { GPointPrecise pointP = GPointPreciseFromGPoint(GPoint(2, 5)); GPointPrecise pointP_c = GPointPrecise((2 % GPOINT_PRECISE_MAX) << GPOIN...
(1, 2, 3, 4, 5, 6)
; t_c = GTransformFromNumbers(1, 2, 3, 4, 5, 6); gtransform_concat(&t_new, &t1, &t2); cl_assert(gtransform_is_equal(&t_new, &t_c)); // Test pointer re-use gtransform_concat(&t1, &t1, &t2); cl_assert(gtransform_is_equal(&t1, &t_c)); // Test concatenation of two non-identity matrices t1 = GTransfor...
cl_assert_equal_i(l.flow_data.paging.origin_on_screen.x, 1); cl_assert_equal_i(l.flow_data.paging.origin_on_screen.y, 2); cl_assert_equal_i(l.flow_data.paging.page_on_screen.origin_y, 4); cl_assert_equal_i(l.flow_data.paging.page_on_screen.size_h, 6); } void test_text_layout__disable_text_flow(void) { TextLayo...
((void*)&layout, FONT_LINE_DELTA - 1)
; cl_assert_equal_i(graphics_text_layout_get_line_spacing_delta((void*)&layout), (FONT_LINE_DELTA - 1)); cl_assert_equal_i(layout.max_used_size.h, 3 * (FONT_HEIGHT + FONT_LINE_DELTA)); cl_assert_equal_i(layout.hash, 0); } graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper 123", font, box, GTe...
test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_nx_offset_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc...
(&ctx, GPoint(0, 5), 0)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1); graphics_draw_horizontal_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);...
); } r = strftime(buf, buf_size, "%U", &good_data); if (r == 0 || strncmp(buf, "18", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"U\": %s", buf); } r = strftime(buf, buf_size, "%V", &good_data); if (r == 0 || strncmp(buf, "19", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error ...
window_set_window_handlers(window, (WindowHandlers) { .load = window_load, .unload = window_unload, })
; const bool animated = true; window_stack_push(window, animated); } static void deinit(void) { window_destroy(window); } int main(void) { init(); app_event_loop(); deinit(); }
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM", .lengths = { #if PLATFORM_ROBERT [TestStringFont_Gothic18] = 204, ...
dialog_push(new_dialog, stack)
; } #endif static char s_text_test_str[1024]; static void prv_perftest_test_main(void *data) { profiler_init(); GFont font = fonts_get_system_font(s_perftest_text_arguments.font_key); int text_index; int font_index; if (strcmp(s_perftest_text_arguments.string_type, "best") == 0) { text_index = TestStri...
not complete", curr_pg); unlink_flash_file(curr_pg); } } update_last_written_page(); } static void prv_handle_sector_erase(uint16_t start_page, bool update_erase_count) { if (!update_erase_count) { prv_flash_erase_sector(start_page); return; } uint16_t max_erase = 0; uint16_t last_writt...
(&callback_node->list_node)
; } } status_t pfs_close(int fd) { mutex_lock_recursive(s_pfs_mutex); int res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; goto cleanup; } File *f = &PFS_FD(fd).file; if (f->is_tmp) { // TODO: For safety, could disallow this op if user has orig file hdl open pfs_remove(f-...
/* * 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...
(value == 1000)
; } static bool dls_log_called = false; static int64_t expected_value = 254307546; void test_analytics__minimal_logging_test(void) { analytics_set(ANALYTICS_DEVICE_METRIC_BATTERY_CHARGE_TIME, expected_value, AnalyticsClient_System); // After calling analytics_logging_system_task_cb, the analytics...
imitations under the License. */ #include "recovery_first_use_app.h" #include "getting_started_button_combo.h" #include "apps/core_apps/spinner_ui_window.h" #include "applib/fonts/fonts.h" #include "comm/ble/gap_le_connection.h" #include "comm/ble/gap_le_device_name.h" #include "comm/ble/gap_le_connect.h" #include ...
{ RecoveryFUAppData *data = app_state_get_user_data(); getting_started_button_combo_button_pressed(&data->button_combo_state, click_recognizer_get_button_id(recognizer)); }
static void prv_raw_up_handler(ClickRecognizerRef recognizer, void *context) { RecoveryFUAppData *data = app_state_get_user_data(); getting_started_button_combo_button_released(&data->button_combo_state, click_recognizer_get_button_id(recognizer)); } static void pr...
click_handler); } static void prv_end_workout(void *context) { WorkoutActiveWindow *active_window = context; WorkoutDialog *workout_dialog = &active_window->end_workout_dialog; workout_dialog_init(workout_dialog, "Workout End"); Dialog *dialog = workout_dialog_get_dialog(workout_dialog); dialog_show_statu...
{ app_timer_cancel(active_window->update_timer); app_timer_cancel(active_window->hr_measuring_timer); gbitmap_destroy(active_window->action_bar_start); gbitmap_destroy(active_window->action_bar_pause); gbitmap_destroy(active_window->action_bar_stop); gbitmap_destroy(active_window->action_bar_mor...
} //////////////////////////////////////////////////////////////////////////////////////////////////// //! Common Setup static void prv_create_window_common(WorkoutActiveWindow *active_window, void *workout_data, WorkoutController *workout_cont...
S, 0x5); REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_V18P_CUR_LIM_RET, 0xA); REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_VDD_RET_CYCLES, 0x5); REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_VDD_CUR_LIM_RET, 0x6); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_RET_CYCLES, 0x5); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_CUR_LIM_RET, 0xA); REG_...
REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_IO2_OEN, 0x0)
; REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_CLK_MD, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_AUTO_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_DMY_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_ADR_TX_MD, 0x0); REG_SETF(QSP...
SMPairingInfo prf_pairing_info; char device_name[BT_DEVICE_NAME_BUFFER_SIZE]; bool requires_address_pinning; uint8_t flags; if (!shared_prf_storage_get_ble_pairing_data(&prf_pairing_info, device_name, &requires_address_pinning, ...
if (!bt_ctl_is_bluetooth_running()) { return; }
bt_local_addr_handle_bonding_change(bonding, op); gap_le_connection_handle_bonding_change(bonding, op); gap_le_connect_handle_bonding_change(bonding, op); kernel_le_client_handle_bonding_change(bonding, op); prv_call_common_bonding_change_handlers(bonding, op); } typedef struct { SMPairingInfo pairing_inf...
cursor, payload_end, buffer, buf_end); } // ----------------------------------------------------------------------------- static int prv_get_serialized_action_group_size(TimelineI...
{ buffer += attribute_list_serialize(attr_list, buffer, buf_end); }
ion *action, void *context) { ChainingWindowCBData *cb_data = context; ActionResultData *data = applib_zalloc(sizeof(ActionResultData)); if (!data) { return; } data->chaining_data.action_chaining_window = chaining_window; data->chaining_data.notif = timeline_item_copy(cb_data->item); data->standalon...
(data, success)
; return; } char uuid_string[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&action_result->id, uuid_string); PBL_LOG(LOG_LEVEL_INFO, "Received action result: Item ID - %s; type - %" PRIu8, uuid_string, (uint8_t)action_result->type); // Each action result can only service one response event even...
_first_scroll) { animation_set_duration(animation, interpolate_moook_duration()); animation_set_custom_interpolation(animation, interpolate_moook); } else { animation_set_curve(animation, AnimationCurveEaseOut); } animation_schedule(animation); } //! Maybe make this part of the style and smaller for ...
(BUTTON_ID_SELECT, context)
; window_set_click_context(BUTTON_ID_BACK, context); if (pebble_task_get_current() == PebbleTask_App) { // only override the back button when we're in the app window_single_click_subscribe(BUTTON_ID_BACK, prv_handle_back_click); } } void timeline_item_layer_set_click_config_onto_window(TimelineItemLayer...
0, variance:17-22, with // one minute of high variance (511) every 25-35 minutes. for (uint32_t minute = 0; minute < minutes; minute++) { if ((minute % 30) == 0) { activity_test_feed_samples(s_walk_30_steps, 2 * SAMPLES_PER_SECOND); prv_feed_idle_movement_sec(58); } else { prv_feed_idle_m...
{ PBL_LOG(LOG_LEVEL_ERROR, "too many steps during sleep: test FAILED"); passed = false; }
// Walk long enough to overlap with a periodic sleep recomputation prv_feed_steps_min(2 * ACTIVITY_SESSION_UPDATE_MIN); // Check sleep totals int32_t total_sleep, deep_sleep; activity_get_metric(ActivityMetricSleepTotalSeconds, 1, &total_sleep); total_sleep -= before_total; activity_get_metric(Activity...
ate getting confirmation from remote: prv_confirm_cccd_write(BLEGATTErrorSuccess); fake_event_clear_last(); BLECharacteristic handle_out = ~0; uint8_t out[1]; uint16_t value_length = sizeof(out); bool has_more = true; const uint16_t next_length = gatt_client_subscriptions_consume_notification(&ha...
cl_assert_equal_i(e, BTErrnoOK)
; e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoOK); prv_pend_events_to_kernel_and_app(); gatt_client_subscriptions_cleanup_by_connection(s_connection, false /* should_unsubscribe */...
/* * 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 (!pin_config->active_high) { asserted = !asserted; } gpio_use(pin_config->gpio); GPIO_WriteBit(pin_config->gpio, pin_config->gpio_pin, asserted? Bit_SET : Bit_RESET); gpio_release(pin_config->gpio); }
void gpio_af_init(const AfConfig *af_config, GPIOOType_TypeDef otype, GPIOSpeed_TypeDef speed, GPIOPuPd_TypeDef pupd) { GPIO_InitTypeDef init = { .GPIO_Pin = af_config->gpio_pin, .GPIO_Mode = GPIO_Mode_AF, .GPIO_Speed = speed, .GPIO_OType = otype, .GPIO_PuPd = pupd }; gpio...
cl_assert(uint8_found)
; cl_assert(uint16_found); cl_assert(uint32_found); cl_assert(int8_found); cl_assert(int16_found); cl_assert(int32_found); cl_assert(null_cstring_found); cl_assert(empty_cstring_found); } void test_dict__out_of_storage(void) { uint8_t buffer[1]; DictionaryIterator iter; DictionaryResult result; r...
return 0; } void app_manager_put_launch_app_event(const AppLaunchEventConfig *config) { app_run_state_send_update(&app_manager_get_current_app_md()->uuid, RUNNING); } void process_manager_put_kill_process_event(PebbleTask task, bool gracefully) { app_run_state_send_update(&app_manager_get_current_app_md()->uui...
cl_assert_equal_i(s_launcher_deprecated_messages, 0)
; cl_assert_equal_i(s_app_run_state_messages, msg_count); } app_run_state_protocol_msg_callback(NULL, (uint8_t*)&msg, sizeof(msg)); cl_assert_equal_i(s_launcher_deprecated_messages, 1); }
(put_bytes_get_semaphore())
; fake_queue_set_yield_callback(put_bytes_get_semaphore(), NULL); assert_nack_count(1); } static void prv_hold_lock_before_write(void) { // Take and hold for a long time: xSemaphoreTake(put_bytes_get_semaphore(), portMAX_DELAY); fake_queue_set_yield_callback(put_bytes_get_semaphore(), prv_taking_too_long_yi...
)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); const GContextInitializationMode context_init_mode = GContextInitializationMode_System; graphics_context_init(&s_ctx, fb, context_init_mode); framebuffer_clear(fb); // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_fo...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE_X(details2)))
; #endif } void test_timeline_layouts__weather(void) { const TimelineLayoutTestConfig config = (TimelineLayoutTestConfig) { .layout_id = LayoutIdWeather, .title = "The Greatest Sunrise Ever", .subtitle = "90°/60°", .location_name = "Redwood City", .body = "A clear sky. Low around 60F.", .icon...
/* * 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...
(FLASH_CONFIG.spi_gpio, &gpio_cfg)
; // Configure SCS to be controlled in software; pull up to high when inactive gpio_cfg.GPIO_Mode = GPIO_Mode_OUT; gpio_cfg.GPIO_Pin = (1 << FLASH_CONFIG.scs_pin); gpio_cfg.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(FLASH_CONFIG.spi_gpio, &gpio_cfg); // Set up a SPI bus on SPI1 SPI_InitTypeDef spi_cfg; SPI_I...
return DICT_INVALID_ARGS; } if (iter->cursor == iter->dictionary->head) { // Reset implicitly if the cursor is at the head, so writing again after // calling dict_write_end() won't screw up the count and will just work: iter->dictionary->count = 0; } Tuple * const next_cursor = cursor_after_tuple_w...
get_safe_cursor(iter)
; } Tuple * dict_read_first(DictionaryIterator *iter) { if (iter == NULL || iter->dictionary == 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...
er(int16_t *p) { return *p; } // -------------------------------------------------------------------------------------- static void prv_gpoint_setter(GPoint *p, GPoint value) { *p = value; } static GPoint prv_gpoint_getter(GPoint *p) { return *p; } // ----------------------------------------------------------...
cl_assert(subject == &layer)
; property_animation_destroy(clone_h); prv_clear_handler_histories(); animation_schedule(h); int max_loops = 20; uint64_t start_ms = prv_now_ms(); uint64_t time_ms; while (s_stopped_handler_calls.num_calls == 0) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("%"PRIu64": fra...
_current_buffer(); content_indicator_init_buffer(buffer); } void test_health_sleep_detail_card__cleanup(void) { } // Helpers ////////////////////// // static void prv_create_card_and_render(HealthData *health_data) { // Window *window = health_sleep_detail_card_create(health_data); // window_set_on_screen(wind...
(&card->scroll_layer)
; offset.y -= scroll_layer_get_content_size(&card->scroll_layer).h; scroll_layer_set_content_offset(&card->scroll_layer, offset, false); #endif window_render(&card->window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_manager_launch_new_app(&(AppLaunchConfig) { .md = panic_app_get_app_info(), })
; } }
T_BONDING_ID_INVALID); // Delete the Pairing bt_persistent_storage_delete_bt_classic_pairing_by_id(id); // Try to read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(!...
bt_persistent_storage_has_active_bt_classic_gateway_bonding()
; cl_assert(ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!ret); // Store another BT Classic pairing BTDeviceAddress addr_2 = {.octets = {0x22, 0x12, 0x13, 0x14, 0x15, 0x16}}; SM128BitKey link_key_2 = { .data = { 0x22, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, ...
rnersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_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, 3, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_...
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 6, GCornersAll)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r6_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix left corners PBL-15915 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, 7, GCornersAll); cl_check(gbitmap_...
/* * 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...
emx_app_init()
; app_main(); emx_app_deinit(); return 0; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&ctx.dest_bitmap, GRect(OFFSET_X, OFFSET_Y + i, STRIPE_WIDTH, STRIPE_HEIGHT), (GColor){.argb = color | alpha})
mitations under the License. */ #include "clar.h" #include "util/uuid.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/blob_db/pin_db.h" #include "services/normal/timeline/attribute.h" #include "services/normal/timeline/item.h" #include "services/normal/timeline/timeline.h" // Fixture //////...
timeline_item_create_with_attributes(0, 0, TimelineItemTypePin, LayoutIdTest, &list, NULL)
rBlack); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_comptint_black_cross_black_corners-expect.8bit.pbi")); memset(dest_data, GColorBlack.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorLightGray); cl_check(gbitmap_pbi_eq(&dest_...
get_gbitmap_from_pbi("test_bitblt__1bit_to_8bit_dest_origin_offset_clip.1bit.pbi")
; uint8_t dest_data[100*100]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 100, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { { 0, 0 }, { 100, 100 } } }; memset(dest_data, GColorBlack.argb, sizeof(dest_data)); GRect dest_rect = GRec...
app_cache__initialize(void) { rtc_set_time(1478397600); fake_spi_flash_init(0, 0x1000000); fake_event_init(); pfs_init(false); app_cache_init(); app_cache_flush(); } void test_app_cache__cleanup(void) { fake_system_task_callbacks_cleanup(); s_test_id_ql_up = 0; s_test_id_ql_down = 0; s_test_id_wat...
app_cache_app_launched(j)
); } // increment time so everything won't happen in the same second time_t now = rtc_get_time(); rtc_set_time(now + 2); } // ensure the one that is evicted is INVALID_ID cl_assert_equal_i(DESIRED_EVICT_ID, app_cache_get_next_eviction()); } void test_app_cache__clear(void) { // add all three ...
er *)timeline_layout, &from); return timeline_layout_create_up_down_animation(timeline_layout, &from, &to, &icon_from, &icon_to, duration, interpolate); } static Animation *prv_create_end_of_timeline_animation( TimelineLayer *layer, int to_index, uint32_t duratio...
peek_layer_set_fields(&timeline_layer->day_separator, "", friendly_date, month_and_day)
; peek_layer_play(&timeline_layer->day_separator); } void timeline_layer_unfold_day_sep(TimelineLayer *timeline_layer) { const bool slide = false; prv_show_day_sep(timeline_layer, slide); } void timeline_layer_slide_day_sep(TimelineLayer *timeline_layer) { const bool slide = true; prv_show_day_sep(timeline_...
/* * 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...
{ index += DEBUG_DB_NUM_FILES; }
return index; } static uint32_t get_file_address(int file_index) { return FLASH_REGION_DEBUG_DB_BEGIN + (file_index * FILE_SIZE_BYTES); } static uint32_t get_current_file_address(void) { return get_file_address(generation_to_index(0)); } //! Get next FILE_ID_BIT_WIDTH bit value static uint8_t get_next_file_id...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_free_flags[i] = false; }
} void test_circular_cache__cleanup(void) { } // tests void test_circular_cache__push(void) { circular_cache_set_item_destructor(&s_test_cache, prv_destructor); circular_cache_push(&s_test_cache, &s_test_item[0]); cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[0], sizeof(TestCacheItem)); cl_assert_equal...
/* * 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(BITS_BETWEEN(0, 0), erased_sector)
; cl_assert(flash_locked); } void test_system_flash__erase_some_sectors_from_beginning(void) { cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_assert(system_fl...
PP_EVENTS); s_kernel_event_queue = xQueueCreate(MAX_KERNEL_EVENTS, sizeof(PebbleEvent)); PBL_ASSERTN(s_kernel_event_queue != NULL); s_from_app_event_queue = xQueueCreate(MAX_FROM_APP_EVENTS , sizeof(PebbleEvent)); PBL_ASSERTN(s_from_app_event_queue != NULL); s_from_worker_event_queue = xQueueCreate(MAX_FRO...
prv_event_put(s_from_kernel_event_queue, "from_kernel", saved_lr, event)
; } else { return prv_event_put(s_kernel_event_queue, "kernel", saved_lr, event); } } bool event_put_isr(PebbleEvent* event) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return prv_event_put_isr(s_kernel_event_queue, "kernel", saved_lr, event); } void event_put_from_process(PebbleTask ...
(ResponseTimeMin, MIN_LATENCY_MODE_TIMEOUT_PUT_BYTES_SECS)
; prv_finalize_pb_job(); if (prv_receiver_contains_put_request()) { // The PutRequest handler has no reliance on the receiver struct so mark processing as done prv_receiver_reset(); system_task_add_callback(prv_process_put_requests_system_task_cb, NULL); } else { system_task_add_callback(prv_proc...
ineAppData *data = context; if (!finished || !prv_set_state(data, TimelineAppStateDaySeparator)) { return; } // Pins will reappear after the day separator completes hiding in `prv_hide_day_sep_stopped` timeline_layer_set_layouts_hidden(&data->timeline_layer, true); prv_set_day_sep_timer(data); } static...
{ if (prv_pin_in_card(data, id)) { // remove the pin window if we just removed the pin app_window_stack_remove((Window *)&data->pin_window, false); prv_set_state(data, TimelineAppStateStationary); } timeline_model_remove(id); prv_update_timeline_layer(data); }
else if (type == BlobDBEventTypeInsert) { for (int i = 0; i < TIMELINE_NUM_VISIBLE_ITEMS; i++) { if (timeline_model_get_iter_state(i)->node && uuid_equal(&timeline_model_get_iter_state(i)->pin.header.id, id)) { prv_refresh_pin(data, i); } } prv_update_timeline_layer(data); }...
1PeriphClockCmd } static void disable_button_timer(void) { if (prv_check_timer_enabled()) { TIM_Cmd(TIM4, DISABLE); TIM_ITConfig(TIM4, TIM_IT_Update, DISABLE); periph_config_disable(TIM4, RCC_APB1Periph_TIM4); // Allow us to enter stop mode stop_mode_enable(InhibitorButton); } } static void p...
clear_stuck_button(i)
; } PebbleEvent e = { .type = (is_pressed) ? PEBBLE_BUTTON_DOWN_EVENT : PEBBLE_BUTTON_UP_EVENT, .button.button_id = i }; should_context_switch = event_put_isr(&e); } } #if !defined(MANUFACTURING_FW) // Now that s_debounced_button_state is updated, check to see if the us...
window_destroy(window1); window_destroy(window2); } void test_window_stack__pop_all(void) { WindowStack *stack = modal_manager_get_window_stack(ModalPriorityGeneric); Window *windows[3]; for (uint8_t idx = 0; idx < 3; idx++) { windows[idx] = window_create(); } window_stack_push(stack, windows[0], tr...
(window_stacks[idx], windows[idx], false)
; cl_assert_equal_i(window_stack_count(window_stacks[idx]), 1); cl_assert_equal_i(windows[idx]->on_screen, true); // All windows below the current priority should now not be on the screen // as the modal has subverted them. ModalPriority sub_idx = idx; do { sub_idx--; if (sub_idx =...
if (!prv_run_test_step(BTLETestStep_BTStart, data)) { failed = true; goto cleanup; }
switch (data->current_test) { case BTLETestType_TX: if (!prv_run_test_step(BTLETestStep_BTLETransmitStart, data)) { failed = true; goto cleanup; } break; case BTLETestType_RX: data->rx_test_received_packets = 0; if (!prv_run_test_step(BTLETestStep_BTLEReceiverSt...
lip) % 32) ? 1 : 0); // Handle clipping at the top of the character. We need to skip a number of bits in our source data. const unsigned int bits_to_skip = glyph_metrics.size.w * (clipped_glyph_target.origin.y - glyph_target.origin.y); if (bits_to_skip) { glyph_block += bits_to_skip / 32; src = *glyph_bl...
{ // Blend (i.e. for transparency) if GCompOpSet dest_color = gcolor_alpha_blend(ctx->draw_state.text_color, (GColor) {.argb = dest_addr[bitindex]}); }
else { dest_color = ctx->draw_state.text_color; dest_color.a = 3; } dest_addr[bitindex] = dest_color.argb; } } } #else if (gcolor_equal(ctx->draw_state.text_color, GColorBlack)) { *(dest_block) &= ~(mask & src); } else { ...
m *prv_create_day_1_insight(time_t notif_time) { if (activity_prefs_get_health_app_opened_version() != 0) { // The user already knows about the Health app return NULL; } AttributeList notif_attr_list = {0}; const char *body = i18n_get("Wanna know more about you? " "Track y...
(&notif_attr_list)
; attribute_list_destroy_list(&dismiss_action_attr_list); attribute_list_destroy_list(&open_app_action_attr_list); return item; } // ------------------------------------------------------------------------------------------------ static TimelineItem *prv_create_day_10_insight(time_t notif_time) { AttributeLis...
/* * 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_stack_is_animating(stack)
) { return false; } WindowTransitioningContext *transition_ctx = &stack->transition_context; return prv_window_is_render_scheduled(transition_ctx->window_from) || prv_window_is_render_scheduled(transition_ctx->window_to); } void app_request_render(void) { Window *window = app_window_stack_get_top...
, 1, &exp_active_kcalories); cl_assert(exp_active_kcalories > 0); // If we init again, we should start out with the same metrics because we // would have retrieved them from settings prv_activity_init_and_set_enabled(true); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, ((const uint32_t [ACTIVIT...
(gender, ACTIVITY_DEFAULT_GENDER)
test_gbitmap_sequence__color_8bit_coin_round(void) { #if PLATFORM_SPALDING uint32_t resource_id = sys_resource_load_file_as_resource( TEST_IMAGES_PATH, "test_gbitmap_sequence__color_8bit_coin.apng"); cl_assert(resource_id != UINT32_MAX); GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resou...
gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL)
; cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(1))); status = gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(2))); status = gbitmap_sequence_update_bitmap_next_frame(bi...
------------------- // Test creating a spawn where where some children are already scheduled and some have // already completed. // // Here's a graph of what we are doing // // 0 10 310 320 330 500 680 730 850 950 1080 1300 // | | | | | | | | |...
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, d), 1)
t entered after we grabbed the mutex but before we issued the // new_timer_delete(), in which case we would have been blocked at the beginning // of this method trying to grab the mutex while the timer was deleted. // To handle this, we check here to see if the EventedTimer got deleted on us and // ret...
PBL_ASSERT(timer->target_task == pebble_task_get_current(), "%u vs %u", timer->target_task, pebble_task_get_current())
; // This will detect if the timer callback has already executed on the timer task. // If the timer is still in our timer's list but is expired, // it means the event posted by the timer task has not yet arrived at the // client's task. if (timer->expired) { mutex_unlock(s_mutex); return false; } ...
eset_request); static void prv_send_reset_request(void); static void prv_session_open__after_exit(void); static void prv_object_queue_pop_head_and_emit_error_event_and_own_json_buffer(void); static void prv_start_session_closed_object_queue_timer(void); static void prv_stop_session_closed_object_queue_timer(void); sta...
{ PBL_ASSERTN(s_state.out.object_queue); DictionaryIterator *it = NULL; app_message_outbox_begin(&it); if (!it) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to outbox_begin"); return; } size_t bytes_remaining; size_t payload_size; prv_calc_current_chunk_size(&bytes_remaining, &payload_size); Outgoing...
it->cursor = (Tuple *)((uint8_t *)it->cursor + sizeof(Tuple) + tuple_data_length); PBL_ASSERTN(s_state.out.msg_type == OutboxMsgTypeNone); s_state.out.msg_type = OutboxMsgTypeChunk; DBG("Sending Chunk (%"PRIu32" bytes remaining)", (uint32_t) bytes_remaining); PBL_ASSERTN(APP_MSG_OK == app_message_outbox_se...
e.next; } // Setup the subsampling numerator and denominators state = (AccelSubscriberState *)s_data_subscribers; while (state) { uint16_t new_num, new_den; if ((highest_rate % state->sampling_rate) == 0) { new_num = 1; new_den = highest_rate / state->sampling_rate; } else { PBL_A...
if (s_accel_samples_per_update == 0) { // If we are not in FIFO mode, can peek result = (accel_peek(accel_data)); accel_data->timestamp = prv_get_timestamp(); } else if (s_accel_samples_per_update == 1) { // Else, if the FIFO is 1 deep, we can ask the accel driver for the cached reading fro...
} mutex_unlock_recursive(s_mutex); return result; } static bool prv_call_data_callback(AccelSubscriberState *state) { switch (state->task) { case PebbleTask_App: case PebbleTask_Worker: case PebbleTask_KernelMain: { PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callba...
t_rate_total_weight_x100_out) { ActivityState *state = activity_private_state(); if (median_out) { *median_out = state->hr.metrics.previous_median_bpm; } if (heart_rate_total_weight_x100_out) { *heart_rate_total_weight_x100_out = state->hr.metrics.previous_median_total_weight_x100; } } // ----------...
{ uint32_t elapsed_minutes = time_util_get_minute_of_day(utc_now); uint32_t cur_day_resting_calories = activity_private_compute_resting_calories(elapsed_minutes); new_history.values[i] = ROUND(cur_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL); }
else { new_history.values[i] = ROUND(full_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL); } } } // Copy values from old history into correct slot in new history for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { int new_index = i + old_age; if (new_ind...
/* * 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...
(without_newlines, string_strip_leading_whitespace(with_newlines))
== 0); const char *with_both = "\n\n \n \nalbuquerque is a lovely town, not!\n"; const char *with_neither = "albuquerque is a lovely town, not!\n"; cl_assert(strcmp(with_neither, string_strip_leading_whitespace(with_both)) == 0); } void test_string__strip_trailing_whitespace(void) { char string_out[100]; ...
inalizeRequest FlashFinalizeResponse; // they are currently the same typedef struct { bool is_free; bool is_valid; HdlcStreamingContext hdlc_ctx; uint32_t index; union { struct PACKED { ImagingHeader header; uint8_t payload[MAX_DATA_LENGTH]; uint32_t checksum; } frame; uint8_t d...
prv_stop(NULL)
; } static void prv_handle_reset_request(const void *payload, uint32_t length) { if (length) { // should be 0 PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } PBL_LOG(LOG_LEVEL_WARNING, "Got reset request"); prv_send_frame(OPCODE_RESET, NULL, 0); prv_stop(NULL); system...
entry->key, (uint32_t)val_len); // Call the update handler bool success = entry->handler(value, val_len); PBL_ASSERT(success, "Failure to store new value for %s in settings file", key); // Update the backing store if (success) { prv_set_pref_backing(entry, value, val_len); } } // ----------------...
prv_pref_set(PREF_KEY_UNITS_DISTANCE, &uint_new_unit, sizeof(uint_new_unit))
psleep(10); if (!dls_lock_session(logging_session)) { // Someone snuck in and marked it inactive on us goto exit; } } if (timeout <= 0) { PBL_LOG(LOG_LEVEL_ERROR, "Timed out waiting for logging_session to write"); } dls_unlock_session(logging_session, true /*inactivate*/); exit: dls_...
{ return (logging_session->tag); }
uint8_t dls_test_get_session_id(DataLoggingSession *logging_session) { return (logging_session->comm.session_id); }
er(), 1); // Let's do it again, but move the valid page to index NUM_PAGES - 1 so we force a wrap around fake_spi_flash_erase(); shared_prf_storage_set_valid_page_number(SPRF_NUM_PAGES - 1); shared_prf_storage_set_getting_started_complete(GETTING_STARTED_COMPLETE); flash_write_bytes((uint8_t *)&new_crc, ...
cl_assert_equal_b(rv, false)
; shared_prf_storage_store_ble_pairing_data(&PAIRING_INFO, DEVICE_NAME, true /* requires_address_pinning */, true /* auto_accept_re_pairing */); // It should detect the fields were already blank in the current page so the index...
(ctx, cell_layer, title, -frame.origin.y/4); } static void prv_draw_row_2(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callback_context) { const char *title = prv_row_texts[cell_index->row]; GRect frame = layer_get_frame(cell_layer); GRect bounds = layer_get_bounds(cell_layer); prv_...
(data->window)
; free(data); } int main(void) { AppData *data = malloc(sizeof(AppData)); memset(data, 0, sizeof(AppData)); Window *window = window_create(); data->window = window; window_set_user_data(window, data); window_set_fullscreen(window, true); Layer *root_layer = window_get_root_layer(window); layer_set_u...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
check_atan2(-78, 268)
/* * 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, data)
; 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) { FSResourceAppData *data = (FSResourceAppData*) app_malloc_check(sizeof(FSRes...
N_RECT_CLIP_XY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r8_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1); graphics_draw_circle(&ctx, CENTER_...
(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 1)
; graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_BIG); ...
the License. */ #include "weather_data_shared.h" #include "clar_asserts.h" #include "drivers/rtc.h" #include "kernel/pbl_malloc.h" #include "services/normal/blob_db/watch_app_prefs_db.h" #include "services/normal/blob_db/weather_db.h" #include "services/normal/weather/weather_service_private.h" #define WEATHER_PR...
(location)
+ strlen(phrase) + sizeof(uint16_t) * 2; // One for each string const size_t entry_size = sizeof(WeatherDBEntry) + data_size; WeatherDBEntry *entry = task_zalloc_check(entry_size); *entry = *base_entry; entry->pstring16s.data_size = data_size; entry->last_update_time_utc = rtc_ge...
; } if (!recognizer->handling_touch_event) { recognizer_manager_handle_state_change(recognizer->manager, recognizer); } } //////////////////////////////////////////////////////////////////////////////////////////////////// // Private interface void recognizer_handle_touch_event(Recognizer *recognizer, const...
{ if (!recognizer) { return; } recognizer->subscriber.filter = filter_cb; }
void recognizer_set_on_destroy(Recognizer *recognizer, RecognizerOnDestroyCb on_destroy_cb) { if (!recognizer) { return; } recognizer->subscriber.on_destroy = on_destroy_cb; } void recognizer_destroy(Recognizer *recognizer) { if (!recognizer || recognizer->is_owned) { return; } if (recognizer->su...
= false, .locked_check = 0xff, .protection_enabled_mask = (1 << 7), }, .reset_latency_ms = 13, .suspend_to_read_latency_us = 20, .standby_to_low_power_latency_us = 10, .low_power_to_standby_latency_us = 30, .supports_fast_read_ddr = false, .qspi_id_value = 0x3725c2, .name = "MX25U64", }; //! ...
qspi_flash_set_lower_power_mode(QSPI_FLASH, true)
n_count); PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - STRESS TEST 1"); return FLASH_TEST_SUCCESS; } /***********************************************************/ /******************* Perf Data Test Functions **************/ /***********************************************************/ #define COUNTER_START \ uint32_t _s...
{ PBL_LOG(LOG_LEVEL_DEBUG, ">>>>>FAIL FLASH TEST CASE %d, Status: %d<<<<<", test_case_num, status); }
onl(cookie), .payload_size = htonl(payload_size), }; memcpy(&put_msg->payload[0], payload, payload_size); prv_receive_data(s_session, buffer, sizeof(buffer)); } static void prv_receive_commit(uint32_t cookie, uint32_t crc) { CommitRequest commit_msg = (CommitRequest) { .cmd = CmdCommit, .cookie = h...
fake_transport_create(TransportDestinationSystem, NULL, prv_system_msg_sent_callback)
; s_session = fake_transport_set_connected(transport, true /* connected */); cl_assert_equal_p(comm_session_get_system_session(), s_session); prv_process_and_reset_test_counters(); s_last_response_cookie = 0; s_boot_bits_orred = 0; s_do_before_write = NULL; // Common for most tests: s_firmware_update_...
/* * 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 display_update_in_progress(); }
eof(key)); uint8_t val[4] = {0x11, 0x22, 0x33, 0x44}; int val_len = sizeof(val); set_and_verify(&file, key, key_len, val, val_len); // setting a byte to all 0s should work settings_file_set_byte(&file, key, key_len, 2, 0x00); val[2] &= 0x00; verify(&file, key, key_len, val, val_len); // setting all 1...
settings_raw_iter_prv_get_num_record_searches()
; cl_assert_equal_i(NUM_RECORDS - 1, after_count - before_count); }
oid graphics_context_move_draw_box(GContext* ctx, GPoint offset) { s_offset = offset; } void graphics_line_draw_precise_stroked(GContext* ctx, GPointPrecise p0, GPointPrecise p1) { s_precise_lines = realloc(s_precise_lines, (s_num_precise_lines + 1) * sizeof(*s_precise_lines)); s_precise_lines[s_num_preci...
cl_assert_equal_i(s_path_num_points, 2)
; cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // set stroke color to be transparent and restore fi...
/* * 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 (data->size > 1) data->size--;
break; case OP_MOVE_P1_X: data->p1.x--; break; case OP_MOVE_P1_Y: data->p1.y--; break; case OP_MOVE_P2_X: data->p2.x--; break; case OP_MOVE_P2_Y: data->p2.y--; break; default: PBL_LOG(LOG_LEVEL_ERROR, "Invalid operation type: %d", data->op...
/* * 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...
kino_player_set_reel(player, NULL, false)
; KinoReel *new_reel = kino_reel_create_with_resource(resource_id); kino_player_set_reel(player, new_reel, true); } void kino_player_set_reel_with_resource_system(KinoPlayer *player, ResAppNum app_num, uint32_t resource_id) { kino_player_set_reel(player, NULL, false...
BMA255_FIFO_MAX_FRAMES]; const uint64_t timestamp_us = prv_get_curr_system_time_ms() * 1000; const uint32_t sampling_interval_us = accel_get_sampling_interval(); uint8_t fifo_status = bma255_read_register(BMA255Register_FIFO_STATUS); BMA255_DBG("Drain %"PRIu8" samples", num_samples_available); const uint8_t...
(s_operating_states)
; i++) { if (s_operating_states[i].using_interrupts) { enable_interrupts = true; break; } } if (enable_interrupts) { exti_enable(BOARD_CONFIG_ACCEL.accel_ints[0]); exti_enable(BOARD_CONFIG_ACCEL.accel_ints[1]); } else { exti_disable(BOARD_CONFIG_ACCEL.accel_ints[0]); exti_disa...
memcmp(buf, bufcmp, sizeof(buf))
== 0); cl_assert_equal_i(pfs_close(fd), S_SUCCESS); } } void test_pfs__garbage_collection_when_full(void) { char file_name[10]; int num = 0; int fd; while (1) { snprintf(file_name, sizeof(file_name), "file%d", num++); fd = pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(file_name)); ...
sys_hrm_manager_get_app_subscription(app_id)
== session_ref); // We should be able to get info on it AppInstallId ret_app_id; uint32_t ret_update_interval_s; uint16_t ret_expire_s; HRMFeature ret_features; cl_assert(sys_hrm_manager_get_subscription_info(session_ref, &ret_app_id, &ret_update_interval_s, &ret_expire_s, &ret_features)); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ graphics_context_set_fill_color(&ctx, GColorFromHEX(0x55aaff)); graphics_fill_rect(&ctx, &ctx.dest_bitmap.bounds); GDrawCommandImage *img = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(img, t); gdraw_command_image_draw(&ctx, img, GPoint(48, 96)); char fn[20]; sn...
} int16_t prv_int_scale_and_translate_to( int16_t value, int16_t size, int16_t from_range, int16_t to_range, int16_t from_min, int16_t to_min, int32_t normalized, InterpolateInt64Function interpolate); int64_t prv_default_interpolate(int32_t normalized, int64_t from, int64_t to); void test_gdraw_command_tra...
cent - battery_get_charge_state().charge_percent; cl_assert(delta >= 0); cl_assert(delta < high_percent - low_percent); // But, it should approach that value over time int last_delta = delta; while(battery_get_charge_state().charge_percent > low_percent) { periodic_timer_trigger(1); delta = high_perc...
periodic_timer_trigger(1)
; cl_assert(s_in_low_power); cl_assert_equal_i(s_power_state, PowerStateLowPower); // lpm -> critical fake_battery_set_millivolts(critical_mv); periodic_timer_trigger(20); cl_assert(battery_monitor_critical_lockout()); cl_assert(s_in_low_power); cl_assert_equal_i(s_power_state, PowerStateCritical); ...
/* * 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...
{ // same assumption as in mfg_info_get_pcba_serialnumber pcba_serial_number[MFG_PCBA_SERIAL_NUMBER_SIZE] = '\0'; }
char *end; int color = strtol(color_num, &end, 10); if (*end) { prompt_send_response("Invalid color"); return; } mfg_info_set_watch_color(color); const WatchInfoColor written_color = mfg_info_get_watch_color(); if (written_color == color) { prompt_send_response("OK"); } else { prompt_...
(BOOT_BIT_NEW_FW_AVAILABLE)
; } else { BLTEST_LOG("STAGE 1 -- Copying STAGE 2 to PRF"); flash_prf_set_protection(false); prv_bootloader_test_copy(FLASH_REGION_SAFE_FIRMWARE_BEGIN, FLASH_REGION_SAFE_FIRMWARE_END); BLTEST_LOG("STAGE 1 -- Marking PRF boot bit"); boot_bit_set(BOOT_BIT_FORCE_PRF); } BLTEST_LOG("STAGE 1 -- R...
; } static Attribute action1_attributes[] = { {.id = AttributeIdTitle, .cstring = "Dismiss"}, }; static Attribute action2_attributes[] = { {.id = AttributeIdTitle, .cstring = "Like"}, {.id = AttributeIdAncsAction, .int8 = 1} }; static Attribute attributes[] = { {.id = AttributeIdTitle, .cstring = "Test Not...
cl_assert_equal_s("", string_list_get_at(list, 3))
; // 2 strings (last is not terminated and will fall through) will return 2 strings // when deserializing, the deserializer puts a \0 at the end // this case demonstrates the problem with incorrectly initialized data list->serialized_byte_length = 3; list->data[0] = 'a'; list->data[1] = '\0'; list->data[...
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 <stdbool.h> #include <stdint.h> #include "drivers/flash.h" #include "drivers/gpio.h" #include "drivers/pe...
SPI_I2S_SendData(FLASH_CONFIG.spi, byte)
; // Wait for the response byte to be received while (SPI_I2S_GetFlagStatus(FLASH_CONFIG.spi, SPI_I2S_FLAG_RXNE) == RESET) {} // Return the byte return SPI_I2S_ReceiveData(FLASH_CONFIG.spi); } static void prv_flash_send_24b_address(uint32_t start_addr) { // Ensure the high bits are not set. prv_flash_send...
test_session__get_app_session_multiple(void) { Transport *system_transport = (Transport *) TransportID1; CommSession *system_session = comm_session_open(system_transport, &s_transport_imp, TransportDestinationSystem); Uuid legacy_app_uuid = { 0xff, 0xc5, 0x24,...
(transport, &s_transport_imp, TransportDestinationSystem)
////////////////////////////////////////////////////// jerry_size_t jerry_get_utf8_string_size(const jerry_value_t value) { if (!jerry_value_is_string(value)) { return 0; } return (jerry_size_t)EM_ASM_INT({ return Module.lengthBytesUTF8(__jerryRefs.get($0)); }, value); } jerry_size_t jerry_string_t...
{ return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref($0); }, value); }
jerry_value_t jerry_create_number_infinity(bool negative) { if (negative) { return JERRY_CREATE_VALUE(-Infinity); } else { return JERRY_CREATE_VALUE(Infinity); } } jerry_value_t jerry_create_number_nan(void) { return JERRY_CREATE_VALUE(NaN); } jerry_value_t jerry_create_null(void) { return JERRY_C...
4, -976}, { 16, -64, -976}, { 16, -48, -968}, { 8, -48, -968}, { 16, -56, -992}, // 5 seconds { 8, -64, -984}, { 16, -56, -968}, { 16, -56, -960}, { 16, -48, -976}, { 8, -48, -976}, { 16, -56, -976}, { 24, -64, -976}, { 24, -56, -968}, { 16, -64, -976}, { 16, ...
{ 608, 736, -328}, { 584, 736, -336}, { 552, 728, -328}, { 504, 736, -352}, { 464, 728, -360}, { 432, 752, -352}, { 472, 776, -376}, { 456, 808, -392}, // 11 seconds { 456, 800, -416}, { 416, 768, -432}, { 376, 752, -448}, { 344, 736, -432}, { 336, 760, -424}, ...
{ 352, 744, -728}, { 344, 568, -648}, { 280, 592, -640}, { 184, 464, -584}, { 96, 504, -672}, { 16, 560, -672}, { 88, 456, -688}, { 120, 368, -736}, { 120, 248, -696}, { 200, 248, -744}, { 336, 168, -752}, { 448, 200, -760}, { 544, 80, -656}, { 624, 136, -672}, ...
uage governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/ui/layer.h" #include "applib/ui/window.h" #include "applib/ui/recognizer/recognizer.h" #include "applib/ui/recognizer/recognizer_impl.h" #include "applib/ui/recognizer/recognizer_list.h" #include "applib/ui/recogni...
recognizer_get_impl_data(recognizer, &s_dummy_impl)
; if (idx) { RecognizerHandled *rec = malloc(sizeof(RecognizerHandled)); cl_assert(rec); *rec = (RecognizerHandled){ .idx = *idx }; *list = list_get_head(list_append(*list, &rec->node)); } } static bool prv_handle_dummy_touch_event(Recognizer *recognizer, void *unused) { prv_store_recognizer_idx(...
GPIO_InitStructure.GPIO_Pin = BOARD_CONFIG_POWER.chg_stat.gpio_pin; GPIO_Init(BOARD_CONFIG_POWER.chg_stat.gpio, &GPIO_InitStructure); if (board_has_chg_fast() || board_has_chg_en()) { // Initialize PD2 as the sensor enable GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode...
(info, 3599, 1373)
; } extern void command_sim_battery_connection(const char *bool_str) { bool value = atoi(bool_str); PebbleEvent event = { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .battery_connection = { .is_connected = value, } }; event_put(&event); } void battery_set_charge_enable(bool charging_enabled) {...
bt_driver_start_unmodulated_tx(data->channel); wait_for_result = false; } else { bt_driver_le_transmitter_test(data->channel, data->payload_length, data->payload_type); wait_for_result = true; } break; case BTLETestStep_BTLEReceiverStart: bt_driver_le_receiver_test...
(&data->status_window, true)
; } } static bool prv_test_is_running(AppData *data) { return (data->current_test_step != BTLETestStep_None); } //-------------------------------------------------------------------------------- // Number Windows //-------------------------------------------------------------------------------- // Number window 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...
i18n_free_all((void *)0xdeadbeef)
; cl_assert(prv_list_find_string("Music", __FILE__) == NULL); // this should be a no-op i18n_free("Music", __FILE__); } void test_i18n__locale(void) { cl_assert(strcmp(i18n_get_locale(), "fr_FR") == 0); cl_assert_equal_i(i18n_get_version(), 24); } void test_i18n__get_with_buffer(void) { const uint32_t LEN...
circle1_location, radius_of_spinner_circles); graphics_draw_circle(ctx, circle1_location, radius_of_spinner_circles); graphics_fill_circle(ctx, circle2_location, radius_of_spinner_circles); graphics_draw_circle(ctx, circle2_location, radius_of_spinner_circles); } static void prv_anim_impl(struct Animation *anim...
{ SpinnerUIData *data = kernel_malloc_check(sizeof(SpinnerUIData)); *data = (SpinnerUIData){}; data->spinner_color = spinner_color; data->should_cancel_animation = false; Window* window = &data->window; window_init(window, WINDOW_NAME("Spinner UI Window")); window_set_user_data(window, data); window_s...
ize)); PBL_ASSERTN(memory_segment_split(&worker_segment, NULL, stack_guard_size)); // No (accessible) memory segments can be placed between the top of WORKER_RAM // and the end of stack. Stacks always grow towards lower memory addresses, so // we want a stack overflow to touch the stack guard region before it b...
worker_manager_put_launch_worker_event(default_id)
; } } } // ------------------------------------------------------------------------------------------------ void worker_manager_handle_remove_current_worker(void) { s_worker_crash_relaunches_disabled = true; worker_manager_close_current_worker(true); } // -----------------------------------------------------...
e_timeout.h" #include "services/normal/notifications/do_not_disturb.h" #include "services/normal/notifications/alerts_private.h" #include "applib/ui/kino/kino_layer.h" #include "system/passert.h" #include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <string.h> typedef struct LauncherMenuData { Windo...
{ if (app_install_entry_is_watchface(entry) || app_install_entry_is_hidden((entry))) { return false; // Skip watchfaces and hidden apps } return true; }
static void prv_data_changed(void *context) { LauncherMenuData *data = context; menu_layer_reload_data(&data->menu_layer); } ////////////// // MenuLayer callbacks static void select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, LauncherMenuData *data) { AppMenuNode *node =...
window, and there is another unfocusable window below // Test: Multiple unfocusable top windows result in Unfocusable modal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_manager_get_properties(), ModalProperty_Exists | ModalProperty_CompositorTransitions | ModalPrope...
window_stack_remove(window2, false)
; modal_manager_event_loop_upkeep(); cl_assert_equal_i(window2->on_screen, false); cl_assert_equal_i(window1->on_screen, true); window_stack_remove(window1, true); cl_assert_equal_i(window1->on_screen, false); window_destroy(window1); window_destroy(window2); } // Description: // This test ensures t...
ASSERTN(s_kernel_event_queue != NULL); s_from_app_event_queue = xQueueCreate(MAX_FROM_APP_EVENTS , sizeof(PebbleEvent)); PBL_ASSERTN(s_from_app_event_queue != NULL); s_from_worker_event_queue = xQueueCreate(MAX_FROM_WORKER_EVENTS , sizeof(PebbleEvent)); PBL_ASSERTN(s_from_worker_event_queue != NULL); s_fro...
(s_kernel_event_queue, "kernel", saved_lr, event)
; } } bool event_put_isr(PebbleEvent* event) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return prv_event_put_isr(s_kernel_event_queue, "kernel", saved_lr, event); } void event_put_from_process(PebbleTask task, PebbleEvent* event) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr ...
/* * 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...
i18n_noop("Turn Off Motion Backlight?")
ash_base = (void*)FIRMWARE_OLDWORLD_BASE; if (firmware_is_new_world(NULL)) { dbgserial_putstr("New World firmware system_flash_base"); system_flash_base = (void*)FIRMWARE_NEWWORLD_BASE; } else { dbgserial_putstr("Old World firmware system_flash_base"); } uint32_t calculated_crc = crc_calculate_byte...
(BOOT_BIT_NEW_FW_AVAILABLE)
lue, end_value); #endif } // -------------------------------------------------------------------------------------- // Test a basic uint32_t property animation void test_animation__property_uint32(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h; uint32_t value; uint32_t start_value, end_value, mid_...
(test_value, set_value)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_ASSERTN(!gsize_equal(&f->size, &GSizeZero)); memset(f->buffer, 0xff, framebuffer_get_size_bytes(f)); framebuffer_dirty_all(f); }
void framebuffer_mark_dirty_rect(FrameBuffer *f, GRect rect) { PBL_ASSERTN(!gsize_equal(&f->size, &GSizeZero)); if (!f->is_dirty) { f->dirty_rect = rect; } else { f->dirty_rect = grect_union(&f->dirty_rect, &rect); } const GRect clip_rect = (GRect) { GPointZero, f->size }; grect_clip(&f->dirty_re...
1, s_graphics_line_draw_precise_stroked.call_count); cl_assert_equal_i(1, s_graphics_draw_arc_precise.call_count); MockCallRecording *lc = &s_graphics_draw_arc_precise.last_call; cl_assert_equal_point_precise(PP(59.5, 79.5), lc->draw_arc.center); cl_assert_equal_i(20 * 8, lc->draw_arc.radius.raw_value); cl_a...
(rv, "RangeError: Out of memory: can't create more path steps")