prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
alled "framebuffer_send". This profiler timer measures the amount of time we spend waiting for a display DMA to complete. op_1 can be computed from the app's update period - op_2_time */ static void prv_pop_all_windows_cb(void *cb_data) { // Print profiler stats which include the time spent copying the app frame...
(&data->background_layer, &s_fps_background_bitmap)
; layer_add_child(&window->layer, &data->background_layer.layer); bitmap_layer_init(&data->topleft_layer, &GRect(0, 0, navbar_width, navbar_width)); bitmap_layer_set_background_color_2bit(&data->topleft_layer, GColor2White); bitmap_layer_set_bitmap(&data->topleft_layer, &s_fps_topleft_bitmap); // PBL_LOG(LOG...
essage 1 and 2 are consumed now: cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data + 1, BUFFER_SIZE - 1)); cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // One callback event scheduled: assert_...
(true, app_inbox_service_end(AppInboxServiceTagUnitTest))
; // Begin another one: cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, 1, s_writer)); // Expect to return 2, because two messages are being dropped, the successful one that was not // yet processed and the currently written one: ...
/* * 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...
( structured_glance, prv_notifications_glance_subtitle_dynamic_text_node_update)
; } static void prv_destructor(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceNotifications *notifications_glance = launcher_app_glance_structured_get_data(structured_glance); if (notifications_glance) { event_service_client_unsubscribe(&notifications_glance->notification_event_info);...
le the top-level animation_unschedule(seq); // Keep going, nothing new should happen except the stop handler for a (which we started) prv_advance_to_ms_with_timers(start_ms + 5 * (duration_total + 3 * MIN_FRAME_INTERVAL_MS)); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 3); cl_a...
prv_count_handler_entries(&s_stopped_handler_calls, a)
, 2); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b)...
timers) list or the idle timers //! (manager->idle_timers) ListNode list_node; //! The tick value when this timer will expire (in ticks). If the timer isn't currently //! running (scheduled) this value will be zero. RtcTicks expire_time; RtcTicks period_ticks; TaskTimerID id; //<! ID assigne...
list_contains(manager->running_timers, &timer->list_node)
); list_remove(&timer->list_node, &manager->running_timers /* &head */, NULL /* &tail */); } else { PBL_ASSERTN(list_contains(manager->idle_timers, &timer->list_node)); list_remove(&timer->list_node, &manager->idle_timers /* &head */, NULL /* &tail */); } // Set timer variables timer->cb = cb; ti...
ions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/graphics/bitblt_private.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "util/math.h" #include "util.h" #include "clar.h" #include <stdio.h> ...
(background_33_66)
; free(fb); }
/* * 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...
{ // Enable the device clocks periph_config_acquire_lock(); periph_config_enable(this->filter, this->rcc_apb_periph); periph_config_release_lock(); }
static void prv_disable_clocks(MicDevice *this) { // Disable DFSDM clock periph_config_acquire_lock(); periph_config_disable(this->filter, this->rcc_apb_periph); periph_config_release_lock(); } //! Configure GPIOs for DFSDM use static void prv_enable_gpio(MicDevice *this, GPIOPuPd_TypeDef data_pupd) { gpio...
void prv_update_now_playing(MusicAppData *data) { layer_set_hidden((Layer *)&data->track_pos_bar, !music_is_progress_reporting_supported()); char artist_buffer[MUSIC_BUFFER_LENGTH]; char title_buffer[MUSIC_BUFFER_LENGTH]; music_get_now_playing(title_buffer, artist_buffer, NULL); if (music_needs_user_to_star...
prv_title_rect()
; const GRect time_rect = prv_time_rect(); const GRect cassette_rect = prv_cassette_rect(); const GRect track_rect = prv_track_rect(); prv_configure_music_text_layer(&data->artist_text_layer, data->artist_buffer, &artist_rect, ARTIST_BOUNDS_OFFSET, ...
te this run and start a new one if (data->run_size >= ACTIVITY_RAW_SAMPLE_MAX_RUN_SIZE) { ACTIVITY_RAW_SAMPLE_SET_RUN_SIZE(data->prev_sample, data->run_size); data->record.entries[data->record.num_entries++] = data->prev_sample; data->run_size = 0; } } else { ...
{ activity_algorithm_get_steps(&s_activity_state.step_data.steps); // Are we logging raw accel samples? if (s_activity_state.sample_collection_enabled) { prv_collect_raw_samples(data, num_samples, false /*finish*/); } // See if we have a stepping rate update from the algorithm. If so, accumu...
mutex_unlock_recursive(s_activity_state.mutex); if (s_activity_state.step_data.steps != prev_steps) { // Post a steps changed event PebbleEvent e = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventMovementUpdate, .data.movement_update = { .s...
GColor actual_color = src_color; if (compositing_mode == GCompOpTint) { actual_color = tint_color; actual_color.a = src_color.a; } else if (compositing_mode == GCompOpTintLuminance) { actual_color = gcolor_perform_lookup_using_color_luminance_and_multiply_alpha(...
if (set) { dest[dest_x] = GColorWhite.argb; }
} break; case GCompOpAnd: for (int i = src_start_idx; i < src_end_idx; ++i, ++dest_x) { const uint32_t bit = (1 << i); const bool set = src & bit; if (!set) { dest[dest_x] = GColorBlack.argb; } } br...
rowse/PBL-20406 #include "applib/ui/vibes.h" #endif #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/kernel_ui.h" #include "kernel/ui/modals/modal_manager.h" #include "process_state/app_state/app_state.h" #include "process_management/app_manager.h" #include "resource/resource_ids.auto.h...
{ window_stack_push(prv_get_window_stack(), window, true /* animated */); }
static void prv_window_pop(Window *window) { window_stack_remove(window, true); } static void prv_teardown(VoiceUiData *data) { // The state is only set to StateExiting in this function, so check that teardown has not already // been performed before carrying on if (data->state == StateExiting) { return;...
(contents->message, response, response_length)
; } #if PULSE_EVERYWHERE pulse_reliable_send(contents, total_size); #else pulse_best_effort_send(contents, total_size); #endif } static void prv_pulse_done_command(void) { pulse_send_message(PROMPT_RESP_DONE, NULL); s_executing_command = ExecutingCommandNone; } #if PULSE_EVERYWHERE void pulse2_prompt_packe...
(animation, &data->spinner_anim_impl)
; animation_schedule(animation); } } Window* spinner_ui_window_get(GColor spinner_color) { SpinnerUIData *data = kernel_malloc_check(sizeof(SpinnerUIData)); *data = (SpinnerUIData){}; data->spinner_color = spinner_color; data->should_cancel_animation = false; Window* window = &data->window; window...
lock(); return connection; } void connection_destroy(Connection *connection) { ble_task_assert_is_executing_on_ble_task(); prv_lock(); { if (connection_is_valid(connection)) { list_remove((ListNode *)connection, (ListNode **)&s_connections, NULL); ListNode *tmp = (ListNode *) connection->gatt_...
prv_unlock()
on_update(GContext *ctx, DotTransitionAnimationConfiguration config, uint32_t distance_normalized) { PBL_IF_RECT_ELSE(prv_collapse_animation_update_rect, prv_collapse_animation_update_round)(ctx, config, distance_no...
(animation, TIMELINE_DOT_COLOR, TIMELINE_DOT_COLOR, TIMELINE_FUTURE_COLOR, CompositorTransitionDirectionDown, STATIC_DOT_ANIMATION_DURATION_MS, false)
; } static void prv_dot_transition_from_app_fetch_animation_init(Animation *animation) { prv_configure_dot_transition_animation(animation, GColorWhite, GColorWhite, GColorLightGray, CompositorTransitionDirectionNone, ...
T, 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_OF_ORIGIN_RECT_NXNY, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bi...
(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_BIG)
e = (PFSFileChangedCallbackNode) { .callback = callback, .event_flags = event_flags, .data = data }; // find out if we already have a string for this particular filename ListNode *find_str = list_find(s_head_callback_node_list, watch_list_find_str, (char *)filename); if (find_str == NULL) { nod...
mutex_lock_recursive(s_pfs_mutex)
; uint16_t page = 0; int fd; status_t rv = get_avail_fd(name, &fd, false); if (rv >= FDAlreadyLoaded) { // the file is in the cache if (rv == FDBusy) { PBL_CROAK("Cannot delete %s, it is currently in use", PFS_FD(fd).file.name); } page = PFS_FD(fd).file.start_page; mark_fd_...
/* * 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...
interval_timer_get(&timer, &average_ms)
BTErrno status) { const BTDeviceAddress address = bt_device_get_address(device); char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; for (unsigned int i = 0; i < num_services; ++i) { Uuid service_uuid = ble_service_get_uuid(services[i]); uuid_to_string(&service_uuid, uuid_buf...
(service_change_handler)
ing is enabled PutBytesPendingJobs pb_pending_jobs; //! Storage for the Pebble Protocol ReceiverImplementation: struct { //! Backing storage for the received Put Bytes message. This buffer points to one of the buffers //! allocated within `pb_pending_jobs` uint8_t *buffer; //! The length in byte...
(LOG_LEVEL_DEBUG, "Not enough buffer room to pre-ack PB packet")
; } } static void prv_deinit_put_job_queue(void) { PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs; for (int i = 0; i < MAX_BATCHED_PB_PUT_OPS; i++) { kernel_free(put_jobs->job[i].buffer); put_jobs->job[i].buffer = NULL; } } static bool prv_init_put_job_queue_if_necessary(void) { PutByte...
ed. This is an extremely small window, but // could be resolved by checking on reboot to see if both versions exist. // If both exist, the orig is valid. Iff tmp exists, the tmp file is valid update_curr_state(f->start_page, TMP_STATE_OFFSET, TMP_STATE_DONE); f->is_tmp = false; } // Note: We don't ...
mutex_unlock_recursive(s_pfs_mutex); return (PFSFileListEntry *)head; }
Config miso = { .gpio = bus->spi_miso.gpio, .gpio_pin = bus->spi_miso.gpio_pin }; gpio_analog_init(&miso); } bus->state->initialized = false; } void prv_spi_bus_init(const SPIBus *bus, bool is_bidirectional) { if (bus->state->initialized) { return; } // copy the speed over to the transient state sin...
(slave->rx_dma)
; } if (slave->tx_dma) { dma_request_init(slave->tx_dma); } } static void prv_spi_acquire_helper(const SPISlavePort *slave) { spi_ll_slave_acquire(slave); spi_ll_slave_scs_assert(slave); } static void prv_spi_release_helper(const SPISlavePort *slave) { spi_ll_slave_scs_deassert(slave); spi_ll_slave_...
/* * 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...
("HEART RATE")
; } } static const char* prv_get_label_for_metric(WorkoutMetricType metric_type, WorkoutActiveWindow *active_window) { switch (metric_type) { case WorkoutMetricType_Hr: { int bpm = active_window->workout_controller->get_metric_value(WorkoutMetricType_Hr, ...
ent_indicator_config); #endif // Wait to add the menu layer until after we might have added the content indicators because // the indicator arrows only get positioned properly if their layers overlap with the menu layer's // edges layer_add_child(container_layer, menu_layer_get_layer(menu_layer)); launcher_...
if (enabled) { const MenuIndex selected_index = menu_layer_get_selected_index(&launcher_menu_layer->menu_layer); prv_play_glance_for_row(launcher_menu_layer, selected_index.row); } else { launcher_app_glance_service_rewind_current_glance(&launcher_menu_layer->glance_service); }
p_custom_day_picker_window(AlarmEditorData *data) { window_init(&data->custom_day_picker_window, WINDOW_NAME("Alarm Custom Day Picker")); window_set_user_data(&data->custom_day_picker_window, data); data->custom_day_picker_window.window_handlers.unload = prv_custom_day_picker_window_unload; GRect bounds = data...
if (data->creating_alarm) { app_window_stack_push(&data->day_picker_window, true); } else { alarm_set_time(data->alarm_id, data->alarm_hour, data->alarm_minute); app_window_stack_remove(&time_picker_window->window, true); }
(data->dictation_timeout); } static void prv_cancel_dictation(VoiceUiData *data) { if ((data->state != StateStart) && (data->state != StateFinished) && (data->state != StateExiting) && (data->state != StateError)) { VOICE_LOG("Cancel dictation session"); sys_voice_cancel_dictation(data->session_id); ...
(&data->mic_window.text_layer, "")
; layer_set_hidden((Layer *)&data->mic_window.text_layer, true); } static void prv_show_mic_text(VoiceUiData *data, const char *msg) { layer_set_hidden((Layer *)&data->mic_window.text_layer, false); sys_i18n_get_with_buffer(msg, data->mic_window.text_buffer, sizeof(data->mic_window.text_buffer)); text_layer_se...
, }; EXPECT_OUTBOX_MESSAGE_PENDING(TupletBytes(PostMessageKeyUnsupportedError, (const uint8_t *) &expected_error, sizeof(expected_error))); // Immediately go back to AwaitingResetRequest: cl_assert_equal_i(rocky_api_app_mes...
("isCalled", true)
; // TODO: assert: // - flushed recv chunk reassembly buffer } //////////////////////////////////////////////////////////////////////////////// // postmessageconnected / postmessagedisconnected //////////////////////////////////////////////////////////////////////////////// static void prv_postmessageconnected_p...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_timeout_values[i] == timeout_ms) { return i; }
} return 0; } static void prv_timeout_menu_select(OptionMenu *option_menu, int selection, void *context) { backlight_set_timeout_ms(s_timeout_values[selection]); app_window_stack_remove(&option_menu->window, true /* animated */); } static void prv_timeout_menu_push(SettingsDisplayData *data) { int index = ...
rumbs_width, }; } static Animation* prv_create_content_in_animation(ActionMenuData *data, const ActionMenuLevel *level) { // animate the ease in of the new level const GRect window_frame = data->action_menu.window.layer.frame; const GEdgeInsets insets = prv_action_menu_insets(&data->action_menu.window); ...
(action_menu_layer, &GRectZero)
/* * 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_get_user_data(window)
gdraw_command_image_attract_to_square(img, t); gdraw_command_image_draw(&ctx, img, GPoint(48, 96)); char fn[20]; snprintf(fn, sizeof(fn), "tos_%06d.png", t); tests_write_gbitmap_to_pbi(&ctx.dest_bitmap, fn); free(img); t += dt; } } int16_t prv_int_scale_and_translate_to( int16_t value, in...
GRect(144 - s * 3 / 4, s / 4, s / 2, s / 2)
; GRect to = GRect(s / 2, s, 2 * s, 2 * s); GDrawCommandImage *img = weather_app_resource_create_cloud(); GPointIndexLookup *index_lookup = gdraw_command_list_create_index_lookup_by_distance( gdraw_command_image_get_command_list(img), GPoint(s / 2, s)); free(img); Fixed_S32_16 f = Fixed_S32_16(FIXED_S3...
/* * 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...
{ register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = task_heap_get_for_current_task(); void *mem = heap_malloc(heap, bytes, saved_lr); if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); } return mem; }
#if defined(MALLOC_INSTRUMENTATION) void task_free_with_pc(void *ptr, uintptr_t client_pc) { heap_free(task_heap_get_for_current_task(), ptr, client_pc); } #endif void task_free(void* ptr) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; heap_free(task_heap_get_for_current_task(), ptr, 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...
printf("Started\n")
; } static void clar_print_shutdown(int test_count, int suite_count, int error_count) { (void)test_count; (void)suite_count; (void)error_count; printf("\n\n"); clar_report_errors(); } static void clar_print_error(int num, const struct clar_error *error) { printf(" %d) Failure:\n", num); printf("%s::%s (%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...
{ comm_session_set_responsiveness(state->session, BtConsumerPpScreenshot, ResponseTimeMax, 0); compositor_unfreeze(); s_screenshot_in_progress = false; }
static void prv_request_fast_connection(CommSession *session) { comm_session_set_responsiveness(session, BtConsumerPpScreenshot, ResponseTimeMin, MIN_LATENCY_MODE_TIMEOUT_SCREENSHOT_SECS); } static uint32_t prv_framebuffer_next_chunk(FrameBufferState *restrict state, ...
nclude "kernel/pbl_malloc.h" #include "popups/phone_ui.h" #include "services/common/analytics/analytics.h" #include "services/common/comm_session/session.h" #include "services/common/phone_pp.h" #include "services/common/system_task.h" #include "services/normal/notifications/alerts.h" #include "services/normal/notifica...
analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_PHONE_CALL_TIME)
; } static void prv_handle_incoming_call(const PebblePhoneEvent *event) { // Only 1 call at a time is supported if (s_call_in_progress) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring incoming call. A call is already in progress"); return; } // If we're not on iOS9+, we need to be connected to the mobile app sinc...
animation_private_current_interpolate_override() ?: interpolate_int64_linear; return interpolate(normalized, from, to); } int16_t interpolate_int16(int32_t normalized, int16_t from, int16_t to) { const int64_t interpolated = interpolate_int64(normalized, from, to); return (int16_t)CLIP(interpolated, INT16_...
interpolate_int64_linear(mid_normalized, from + (direction * frames_in[num_frames_in - 1]), to + (direction_out * frames_out[0]))
; } else { return to + (frames_out ? (direction_out * frames_out[frame_idx - (num_frames_in + num_frames_mid)]) : 0); } } int64_t interpolate_moook_in(int32_t normalized, int64_t from, int64_t to, int32_t num_frames_to) { return prv_interpolate_moook(normalized, from, to, s_del...
D_MAX); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_cal...
(&s_stopped_handler_calls, b)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); // Everything should have been freed cl_assert_equal_i(prv_count_animations(), 0); #endif } // ---------------------------------------------...
dler of a window, we pop it. void test_window_stack__pop_during_window_load(void) { Window *window = window_create(); window_set_window_handlers(window, &(WindowHandlers){ .load = prv_pop_window_load, .unload = prv_window_unload }); WindowStack *stack = app_state_get_window_stack(); // Switch to the...
cl_assert_equal_i(prv_get_load_unload_count(), 1)
; cl_assert_equal_i(prv_get_appear_disappear_count(), 1); window_stack_remove(window, true); cl_assert_equal_i(window_stack_count(stack), 0); cl_assert_equal_i(prv_get_load_unload_count(), 0); cl_assert_equal_i(prv_get_appear_disappear_count(), 0); // FIXME: PBL-25460 // cl_assert_equal_b(animation_is_...
// These are used to optimize the rectangles that are drawn such that only three rectangles // are drawn always int16_t top_rect_origin_x = rect->origin.x; int16_t top_rect_size_w = rect->size.w; int16_t bottom_rect_origin_x = rect->origin.x; int16_t bottom_rect_size_w = rect->size.w; // Fil...
GRect(rect->origin.x, rect->origin.y + 1, 1, rect->size.h - 2)
); // left graphics_fill_rect(ctx, &GRect(rect->origin.x + rect->size.w - 1, rect->origin.y + 1, 1, rect->size.h - 2)); // right ctx->draw_state.fill_color = fill_color; } #if PBL_COLOR T_STATIC void prv_draw_rect_aa_stroked(GContext *ctx, const GRect *rect, uint8_t stroke_width) {...
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitma...
E_TYPE_STATIC, 0); if (fd < 0) { return false; } pfs_close(fd); return true; } static void prv_create_file_for_id(AppInstallId id) { char buffer[30]; itoa_int(id, buffer, 10); int fd = pfs_open(buffer, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); pfs_close(fd); } void test_app_cache__delete_binaries_for...
("@00000001/res", 1024)
; prv_file_create("@ffffffff/res", 1024); // re-initialize the app-cache (which should purge the above 3 files) app_cache_init(); // let's see if the three files we should have deleted are indeed gone cl_assert(pfs_open("@00000000/res", OP_FLAG_READ, FILE_TYPE_STATIC, 0) < 0); cl_assert(pfs_open("@00000001/...
efine CMSIS_COMPATIBLE #include <mcu.h> #include <inttypes.h> #include <stdarg.h> #include <stdio.h> #include <string.h> #if PULSE_EVERYWHERE #define PROF_LOG(buf, sz, fmt, ...) \ do { \ snprintf(buf, sz, fmt, ## __VA_ARGS__); \ PBL_LOG(LOG_LEVEL_DEBUG, "%s", buf); ...
(buf, sizeof(buf), "%-24s %-8s %-11s %-15s %-8s %-7s", "Name", "Count", "Cycles", "Time (us)", "Avg (us)", "% CPU")
; while (sorted != NULL) { ProfilerNode *node = (ProfilerNode *)sorted; uint32_t percent = (((int64_t)node->total) * 100) / total; PROF_LOG(buf, sizeof(buf), "%-24s %-8"PRIu32" %-11"PRIu32" %-15"PRIu32" %-8"PRIu32 " %-7"PRIu32, node->module_name, node->count, node->total, node...
uint8_t length, void *cb_data) { struct ManufacturerSpecificCtx *ctx = (struct ManufacturerSpecificCtx *) cb_data; const uint8_t copied_size = MIN(ctx->size, length); memcpy(ctx->buffer, data, copied_size); ctx->co...
{ return false; }
ph_USART6 | RCC_APB2Periph_SDMMC2 | RCC_APB2Periph_ADC | RCC_APB2Periph_SDMMC1 | RCC_APB2Periph_SPI1 | RCC_APB2Periph_SPI4 | RCC_APB2Periph_SYSCFG | RCC_APB2Periph_TIM9 | RCC_APB2Periph_TIM10 | RCC_APB2Periph_TIM11 | RCC_APB2Periph_SPI5 | RCC_APB2Periph_SPI6 | RCC_APB2Periph_SAI1 | RCC_APB2Periph_SAI2 |...
("Watchdog caused a reset")
; } if (boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { dbgserial_putstr("Software failure caused a reset"); } // Clean up after the last failure. boot_bit_clear(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); // We have a "three strikes" algorithm: if the watch fails three times, return true // to tell t...
xt_state; } // This determines whether a transition is valid and whether the transition should be deferred // until an animation completes. If a transition skips states, this will return the first // intermediate state to enter (or in the case of a deferred transition, which case to spoof so // that the corr...
prv_hide_mic_text(data)
; prv_show_unfold_animation(data, true /* is_reverse */); break; case StateWaitForResponse: // pulse the microphone dot prv_hide_unfold_animation(data); prv_show_mic_dot_pulse(data); prv_show_progress_bar(data, true /* animated */); break; case StateStopWaitForRespons...
-37298 Support subscribing to different data rates uint32_t update_interval_b_s = 1; sys_hrm_manager_set_update_interval(session_ref, update_interval_b_s, expire_b_s); cl_assert(prv_get_subscriber_state_from_ref(session_ref) == state); cl_assert(state->update_interval_s == update_interval_b_s); cl_assert(stat...
fake_system_task_callbacks_invoke_pending()
; } // Should be disabled relatively quickly since we don't need another reading for another 600 // seconds cl_assert(num_updates <= HRM_CHECK_SENSOR_DISABLE_COUNT); // The timer should be set to fire just before we need another update uint32_t timeout_ms = stub_new_timer_timeout(prv_get_timer_id()); cl...
(&window->layer, &text_layer->layer)
; } static void push_detail_window(AppData *data, MenuIndex *index, bool is_long_click) { sniprintf(data->detail_text_buffer, 50, "SELECTION:\n\nSection %i, Row %i\nLong click: %c", index->section, index->row, is_long_click ? 'Y' : 'N'); Window *detail_window = &data->detail_window; window_init(detail_window, W...
tic status_t prv_insert_serialized_item(const uint8_t *key, int key_len, const uint8_t *val, int val_len, bool mark_synced) { CommonTimelineItemHeader *hdr = (CommonTimelineItemHeader *)val; if (hdr->layout == LayoutIdNotification || hdr->layout == LayoutIdReminder) { ...
pin_db_get_len((uint8_t *)id, UUID_SIZE)
; if (size <= 0) { return E_DOES_NOT_EXIST; } uint8_t *read_buf = task_malloc_check(size); status_t status = pin_db_read((uint8_t *)id, UUID_SIZE, read_buf, size); if (status != S_SUCCESS) { goto cleanup; } SerializedTimelineItemHeader *header = (SerializedTimelineItemHeader *)read_buf; uint8_t...
cular display #define SCROLL_PX PBL_IF_RECT_ELSE(48, LAYOUT_HEIGHT) // Max pixel scroll for repeating scrolls (button is held) #define REPEATING_SCROLL_PX 24 // Scroll animation speed // Same as the normal moook duration, but one frame shorter #define SCROLL_MS PBL_IF_RECT_ELSE(200, interpolate_moook_duration() - \ ...
if (swap_layer->callbacks.layout_did_appear_handler) { swap_layer->callbacks.layout_did_appear_handler(swap_layer, layout, rel_change, swap_layer->context); }
} static void prv_update_colors(SwapLayer *swap_layer, GColor bg_color, bool status_bar_filled) { if (swap_layer->callbacks.update_colors_handler) { swap_layer->callbacks.update_colors_handler(swap_layer, bg_color, status_bar_filled, ...
resource/technical/document/errata_sheet/DM00068628.pdf // Configure the PWR peripheral to put us in low-power STOP mode when // the processor enters deepsleep. #if defined(MICRO_FAMILY_STM32F7) uint32_t temp = PWR->CR1; temp &= ~PWR_CR1_PDDS; temp |= PWR_CR1_LPDS; PWR->CR1 = temp; #else uint32_t temp = ...
(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_BUTTON_TIME, InhibitorButton, now_ticks)
; prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_BLUETOOTH_TIME, InhibitorBluetooth, now_ticks); prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_DISPLAY_TIME, InhibitorDisplay, now_ticks); prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_BACKLIGHT_TIME, InhibitorBacklight, now_ticks); prv_collect(ANALYTICS_DEVICE_...
/* * 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...
{ HcAdvertEnableData *data = (HcAdvertEnableData *)msg->payload; // One slot is 625us: const uint16_t min_slots = data->min_interval_ms * 8 / 5; const uint16_t max_slots = data->max_interval_ms * 8 / 5; // PBL_LOG(LOG_LEVEL_DEBUG, "Advert; Setting min/max interval (ms) to %"PRIu16" / %"PRIu16, // da...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_draw_vertical_lines(ctx, ARRAY_LENGTH(s_lower_heights), s_lower_offsets_y, s_lower_heights, LINE_WIDTH, LINE_SPACING, offset)
zeof(*addr)); own_address_t own_addr = { .addr_type = PRIVATE_STATIC_ADDRESS }; memcpy(&own_addr.addr, addr, sizeof(own_addr.addr)); e = ble_gap_address_set(&own_addr, 0); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_address_set: %u", e); } #endif e = ble_gap_mtu_size_set(ATT_MAX_...
{ goto no_event; }
if (ble_service_handle_event(hdr)) { goto handled; } switch (hdr->evt_code) { // GAP Events: case BLE_EVT_GAP_CONNECTED: handle_evt_gap_connected((ble_evt_gap_connected_t *) hdr); break; case BLE_EVT_GAP_DISCONNECTED: prv_handle_evt_ga...
{ 24, 496, -872}, { 24, 496, -872}, { 24, 496, -864}, { 16, 496, -864}, { 24, 504, -880}, // 35 seconds { 24, 504, -872}, { 16, 496, -872}, { 16, 504, -872}, { 24, 504, -880}, { 24, 496, -872}, { 24, 496, -880}, { 16, 496, -880}, { 24, 504, -872}, { 16, 504, ...
{ 16, 504, -872}, { 16, 504, -864}, { 16, 504, -864}, { 16, 504, -880}, { 16, 504, -872}, { 16, 504, -872}, { 8, 504, -872}, { 16, 504, -864}, { 16, 504, -864}, // 41 seconds { 16, 496, -872}, { 16, 504, -864}, { 16, 512, -864}, { 16, 496, -872}, { 16, 504, -8...
{ 16, 504, -864}, { 16, 504, -872}, { 16, 504, -880}, { 16, 480, -880}, { 24, 504, -872}, { 16, 504, -872}, { 16, 496, -872}, { 16, 504, -872}, { 8, 504, -872}, { 16, 496, -872}, { 16, 504, -872}, { 16, 496, -872}, { 16, 496, -872}, { 16, 504, -872}, { 16, 50...
T_JS_GLOBAL_EQUALS_I("w", 2); } void test_rocky_api_graphics__line_styles_check_bounds(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.lineWidth = -1;", "TypeError: Argument at index 0 is invalid: Value out of bounds for native type" ); EXECUTE_SCRIPT_EXPECT_ERROR( ...
prv_global_init_and_set_ctx()
; // we do this in C and not JS as color binding is not linked in this unit-test // what we want to test though is that the text color is taken from fill color EXECUTE_SCRIPT( "ctx.textAlign = 'left';\n" "ctx.fillText('some text', 100, 100);\n" ); cl_assert_equal_i(1, s_graphics_draw_text.call_coun...
/* * 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 (flash_base == CORE_DUMP_FLASH_INVALID_ADDR || image_hdr.magic != CORE_DUMP_MAGIC) { return GET_BYTES_DOESNT_EXIST; }
status_t err = core_dump_size(flash_base, size); if (err != S_SUCCESS) { return GET_BYTES_CORRUPTED; } else { data->core_dump_base = flash_base; return GET_BYTES_OK; } } bool gb_storage_coredump_read_next_chunk(GetBytesStorage *storage, uint8_t *buffer, uint32_t len) { GBCoredumpData *data = st...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pwm->timer.init(pwm->timer.peripheral, &tim_oc_init)
; pwm->timer.preload(pwm->timer.peripheral, TIM_OCPreload_Enable); TIM_ARRPreloadConfig(pwm->timer.peripheral, ENABLE); } periph_config_disable(pwm->timer.peripheral, pwm->timer.config_clock); } void pwm_set_duty_cycle(const PwmConfig *pwm, uint32_t duty_cycle) { if (IS_LPTIM(pwm->timer.peripheral)) { ...
e governing permissions and * limitations under the License. */ #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/voltage_monitor.h" #include "kernel/util/delay.h" #include "os/mutex.h" #include "system/passert.h" #define STM32F2_COMPATIBLE #define STM32F4_COMPATIBLE #define STM32F7_COM...
periph_config_disable(device->adc, device->clock_ctrl)
; } mutex_unlock(s_adc_mutex); }
sleepDuration"; int32_t average_sleep_val = 654321; cl_assert_equal_i(health_db_insert((uint8_t *)average_sleep_key, strlen(average_sleep_key), (uint8_t *)&average_sleep_val, sizeof(average_sleep_val)), S_SUCCESS); cl_assert(health_db_get_monthly_average_v...
cl_assert_equal_i(s_metric_updated_count, 0)
; }
const uint8_t *buf_end) { SerializedActionHeader *serialized_action = (SerializedActionHeader *)*cursor; *cursor += sizeof(SerializedActionHeader); action->id = serialized_action->id; action->type = serialized_action->type; action->attr_list.num_attributes = serial...
attribute_list_get_serialized_size((AttributeList *)&addr_list->addresses[i].attr_list)
; } return size; } size_t attribute_group_get_serialized_payload_size(AttributeGroupType type, AttributeList *attr_list, void *group_ptr) { size_t size = 0; if (attr_list) { size += attribute_list_get_ser...
/* * 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...
(layout, &s_ctx.dest_bitmap.bounds)
; weather_app_layout_set_data(layout, forecast); window_set_user_data(window, layout); Layer *window_root_layer = window_get_root_layer(window); layer_add_child(window_root_layer, &layout->root_layer); window_set_on_screen(window, true, true); } static void prv_create_layout_for_forecast_and_render(const We...
t)((float)-0.125 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 7); test_num = (int32_t)((float)-0 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == 0); cl_ass...
(-2, Fixed_S16_3_rounded_int(Fixed_S16_3(-12)))
//////////////////////// // Awaiting Reset Complete Local Initiated //////////////////////////////////////////////////////////////////////////////// static void prv_send_reset_request(void) { prv_control_message_queue_add(PostMessageKeyResetRequest, NULL, 0); } static void prv_awaiting_reset_complete_local_initiate...
{ // TODO: document this in statechart prv_send_unsupported_protocol_error_and_enter_await_reset_req(PostMessageErrorMalformedResetComplete); return; }
const PostMessageResetCompletePayload *rc = (const PostMessageResetCompletePayload *) tuple->value[0].data; // Check overlap in supported versions if (!prv_is_version_supported(rc)) { prv_send_unsupported_protocol_error_and_enter_await_reset_req(PostMessageErrorUnsupportedVersion); retu...
const int16_t expand = 8; kino_reel_scale_segmented_set_deflate_effect(kino_reel, expand); layer_set_hidden((Layer *)&peek_layer->kino_layer, true); peek_layer->show_dot = prv_is_dot_size(icon_from.size); if (peek_layer->show_dot) { kino_reel_unfold_set_start_as_dot(kino_reel, peek_layer->dot_diameter / ...
(kino_reel, peek_layer->dot_diameter / 2)
; } kino_layer_set_reel(&peek_layer->kino_layer, kino_reel, true); kino_layer_set_callbacks(&peek_layer->kino_layer, (KinoLayerCallbacks) { .did_stop = prv_scale_to_did_stop, }, peek_layer); peek_layer->hidden_fields_timer = evented_timer_register(PEEK_LAYER_SCALE_DURATION, ...
ders */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); }...
{ s_hrm_is_present = false; s_workout_data = (WorkoutData) { .steps = 0, .duration_s = 84, .distance_m = 0, .avg_pace = health_util_get_pace(84, 0), .bpm = 92, .hr_zone = 0, }; WorkoutActiveWindow *active_window = workout_active_create_for_activity_type( ActivitySessionType_Open,...
void test_workout_active__workout_render_hr_zone_1(void) { s_workout_data = (WorkoutData) { .steps = 567, .duration_s = 789, .distance_m = 234, .avg_pace = health_util_get_pace(789, 234), .bpm = 148, .hr_zone = 1, }; WorkoutActiveWindow *active_window = workout_active_create_for_activit...
em(WindowStackItem *item) { return (WindowStackItem *)list_get_next(&item->list_node); } static WindowStackItem *prv_find_window_stack_item_for_window(WindowStack *window_stack, Window *window) { if (!window_stack) { // Window can't be on a NULL win...
animation_schedule(context->animation)
; // TODO: PBL-17645 cleanup container view in animation.stopped } static void prv_next_inserter(WindowStackItem *stack_item) { WindowStack *window_stack = stack_item->window->parent_window_stack; WindowStackItem *prev_item = (WindowStackItem *)window_stack->list_head; // Insert after the found previous item: ...
r_suites} }; static size_t _clar_suite_count = ${clar_suite_count}; static size_t _clar_callback_count = ${clar_callback_count}; /* Core test functions */ static void clar_report_errors(void) { int i = 1; struct clar_error *error, *next; error = _clar.errors; while (error != NULL) { next = error->next; ...
if (!has_colon || argument[-1] == ':') { for (j = 0; j < (int)_clar_suite_count; ++j) if (strncmp(argument, _clar_suites[j].name, len) == 0) clar_run_suite(&_clar_suites[j]); } else { for (j = 0; j < (int)_clar_suite_count; ++j) if (strcmp(argument, _clar_suit...
if (_clar.active_suite == NULL) { clar_print_onabort("No suite matching '%s' found.\n", argument); exit(-1); } break; } // Run a particular test only. This code was added on top of base clar. case 't': { int offset = (argument[2] == '=') ? 3 : 2; char *test_na...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (int i = 0; i < NUM_GOTHIC_CODEPOINTS; i++) { uint32_t decoded_codepoint = utf8_peek_codepoint(valid_gothic_codepoints_utf8, NULL); uint32_t actual_codepoint = s_valid_gothic_codepoints[i]; cl_assert_equal_i(decoded_codepoint, actual_codepoint); valid_gothic_codepoints_utf8 = utf8_get_next(valid_got...
} void test_utf8__emoji_codepoints(void) { cl_assert(utf8_is_valid_string("\xF0\x9F\x98\x84")); cl_assert(utf8_is_valid_string("😃")); } void test_utf8__copy_single_byte_char(void) { utf8_t dest[5]; memset(dest, 0, 5); size_t copied = utf8_copy_character(dest, (utf8_t *)"hello", 5); cl_assert_equal_i(co...
{ 664, 96, -160}, { 632, 112, -160}, { 672, 152, -144}, { 856, 176, -184}, { 1056, 232, -232}, { 1400, 248, -176}, // 69 seconds { 1456, 296, -248}, { 1200, 224, -440}, { 1312, -72, -64}, { 1192, -136, -88}, { 912, 88, -336}, { 656, 88, -272}, { 560, 80, -312}, ...
{ 1224, 328, -64}, { 976, 296, -72}, { 800, 320, -104}, { 728, 288, -80}, { 712, 200, -56}, { 704, 208, -80}, { 808, 240, -104}, { 976, 264, -152}, { 1088, 176, -88}, { 1176, 88, -128}, { 1192, 144, -208}, { 1104, 208, -344}, { 1256, 184, -264}, { 1160, 160, -168}...
s[1].uint8, 1); timeline_item_destroy(item); } static Attribute action1_attributes[] = { {.id = AttributeIdTitle, .cstring = "Dismiss"}, }; static Attribute action2_attributes[] = { {.id = AttributeIdTitle, .cstring = "Like"}, {.id = AttributeIdAncsAction, .int8 = 1} }; static Attribute attributes[] = { ...
("", string_list_get_at(list, 2))
; 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...
th/pairability.h" #include "services/common/regular_timer.h" #include "services/common/system_task.h" #include "services/normal/bluetooth/ble_hrm.h" #include "os/mutex.h" #include <bluetooth/init.h> #include <string.h> static bool s_comm_initialized = false; static bool s_comm_airplane_mode_on = false; static bool s...
(s_comm_state_change_mutex)
; } void bt_ctl_set_enabled(bool enabled) { if (!s_comm_initialized) { PBL_LOG(LOG_LEVEL_ERROR, "Error: Bluetooth isn't initialized yet"); return; } mutex_lock(s_comm_state_change_mutex); s_comm_enabled = enabled; mutex_unlock(s_comm_state_change_mutex); prv_comm_state_change(NULL); } void bt_ctl_...
ing privilege elevation. // The memory_region.c functions are not used for this check as this function // is in a hot code-path and needs to execute as quickly as possible. // All syscall functions are lumped together in one place in the firmware // image to reduce the attack surface. Don't allow privilege to...
(ANALYTICS_DEVICE_METRIC_CPU_RUNNING_TIME, ms_running, AnalyticsClient_System)
; s_last_ticks = now_ticks; s_analytics_device_sleep_cpu_cycles = 0; s_analytics_device_stop_ticks = 0; } void analytics_external_collect_app_cpu_stats(void) { static uint32_t s_last_ticks = 0; uint32_t sleep_ms = mcu_cycles_to_milliseconds(s_analytics_app_sleep_cpu_cycles); uint32_t now_ticks = rtc_get...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (uint32_t index = 0; index < size_full; index++) { s_gfx_rotated_bitmap_pixels[index] = (index % 2) ? 0xf0 : 0xcc; }
#if SCREEN_COLOR_DEPTH_BITS == 1 uint32_t size_64 = (64*64)/8; #else uint32_t size_64 = (64*64); #endif uint8_t *s_gfx_rotated_bitmap_64_pixels = s_gfx_rotated_bitmap_64_bitmap->addr; for (uint32_t index = 0; index < size_64; index++) { s_gfx_rotated_bitmap_64_pixels[index] = (index % 2) ? 0xf0 : 0xcc; ...
m, [PreferredContentSizeLarge] = &s_style_large, [PreferredContentSizeExtraLarge] = &s_style_large, }; static GPath s_page_break_arrow_path = { .num_points = 3, .points = (GPoint[]) {{-ARROW_SIZE_PX, 0}, {ARROW_SIZE_PX, 0}, {0, ARROW_SIZE_PX}} }; static void prv_init_icon(TimelineLayout *layout, const GRect *...
{ kino_layer_destroy(timeline_layout->metric_icon_layers[i]); }
task_free(timeline_layout->metric_icon_layers); timeline_layout->num_metric_icon_layers = 0; timeline_layout->metric_icon_layers = NULL; } animation_unschedule(timeline_layout->transition_animation); timeline_layout_deinit_view(timeline_layout); prv_deinit_icon(timeline_layout); layer_deinit(&tim...
nt) { 0, 0 }, (GSize) { 7 * HORIZ_ADVANCE_PX + 1, FONT_HEIGHT - 1 } }, .font = (GFont) { 0 }, .overflow_mode = GTextOverflowModeWordWrap, .alignment = GTextAlignmentLeft, .max_used_size = (GSize) { 0, 0 } }; if (!process_manager_compiled_with_legacy2_sdk()) { graphics_text_layout_set_line_spaci...
(&gcontext, fb, GContextInitializationMode_App)
; framebuffer_clear(fb); GFont font = (GFont) { 0 }; GRect box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 20 * HORIZ_ADVANCE_PX + 1, 13 } }; TextLayoutExtended layout = (TextLayoutExtended) { .hash = 0, .box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 20 * HORIZ_ADVANCE_PX + 1, 13 } }, .font = (GFont) {...
nt8_t *val_out = malloc(val_len_out); cl_must_pass(settings_file_get(&file_new, key, key_len, val_out, val_len_out)); if (val_len_out == original_value_length) { printf("original! %d\n", original_value_length); cl_assert_equal_m(original_value, val_out, val_len_out); free(val_out); retu...
settings_file_each(&file, prv_each_cb, counts)
; for (int i = 0; i < 255; i++) { cl_assert_equal_i(counts[i], 1); } task_free(counts); } static const uint8_t STOPPING_NUM = 117; static bool prv_each_cb_quit_early(SettingsFile *file, SettingsRecordInfo *info, void *context) { uint8_t *key = malloc(info->key_len + 1); uint8_t *v...
/* * 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...
(0, erased_sector)
; cl_assert(flash_locked); } void test_system_flash__erase_one_byte(void) { cl_assert(system_flash_erase(FLASH_BASE, 1, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_one_byte_in_middle_of_sector(void) { cl_assert(system_flash_era...
(rtc_get_time())
; cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); } // // These tests only make sense if the insights are enabled // // Now we shouldn't see another notification for the next 6 days // for (int i = 0; i < 6; ++i) { // rtc_set_time(rtc_get_time() + SECONDS_PER_DAY); // ...
onvert_to_string_and_apply(const jerry_value_t val, void (*apply)(const jerry_value_t, const RockyArgBinding *), const RockyArgBinding *binding) { jerry_value_t str_val; ...
jerry_value_is_number(argv[0])
|| jerry_value_is_string(argv[0])) { return true; } *type_error_out = (RockyArgTypeCheckError) { .expected_type_name = COLOR_TYPES, .arg_offset = 0, }; return false; } static void prv_init_arg_assign_imp(RockyArgType arg_type, RockyArgAssignImp *imp_out) { // Defaults: imp_out->expected_num_ar...
/* * 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...
{ // Convert 16-bit PCM representation to 8-bit PCM representation uint8_t b = d[i + 1] ^ 0x80; buf[buf_idx++] = b; prv_put_byte_hdlc(b); }
_heap.h" #include "stubs_mutex.h" #include "stubs_resources.h" #include "stubs_serial.h" #include "stubs_syscalls.h" #include "stubs_unobstructed_area.h" // Fakes #include "fake_new_timer.h" #include "fake_pebble_tasks.h" #include "fake_pbl_malloc.h" #include "fake_rtc.h" #include "fake_events.h" #define TEST_INCLUDE...
if (new_ms == target_ms - 1) { new_ticks++; } else if (new_ms == target_ms + 1) { new_ticks--; }
new_ms = (new_ticks * 1000 + RTC_TICKS_HZ / 2) / RTC_TICKS_HZ; cl_assert(new_ms == target_ms); fake_rtc_set_ticks(new_ticks); } // -------------------------------------------------------------------------------------- // Fire the timer used by the animation service. Before doing so, advance the time to when //...
ive signed // No signed conversion occurs, so this is a no-op snprintf(dstbuf, 256, "There are %+X lights, the absolute value of %+X", 16, -4); cl_assert_equal_s(dstbuf, "There are 10 lights, the absolute value of FFFFFFFC"); // Minimum digits output snprintf(dstbuf, 256, "There are %.3X lights, %.3X", 16, -...
(dstbuf, 256, "You know Bagu? %-25.19s", "Then I can let you cross")
; cl_assert_equal_s(dstbuf, "You know Bagu? Then I can let you "); } void test_sprintf__percent_p(void) { // %p is almost entirely implementation defined. // Because of this, we are testing against newlib's output. // Newlib just treats it as %#x char dstbuf[256]; snprintf(dstbuf, 256, "What's a coo...
on it for cleanup complete_cb(false /* success */, cb_data); } } static void prv_push_dismiss_first_use_dialog(ActionMenu *action_menu) { if (alerts_preferences_check_and_set_first_use_complete(FirstUseSourceDismiss)) { return; } const char* tutorial_msg = i18n_get("Quickly dismiss all notifications b...
if (canned_responses_count) { // responses as provided by the action template_level = prv_create_level(canned_responses_count, parent_level); for (size_t i = 0; i < canned_responses_count; i++) { const char *label = string_list_get_at(responses_list, i); action_menu_level_add_action(template_lev...
e since that represents how framebuffer discards it in display. // Also needed for unit tests since PNG tests interpret alpha color.a = 3; line[point.x] = color.argb; } } #endif #if PBL_BW static inline void set_pixel_raw_2bit(GContext* ctx, GPoint point) { if (!grect_contains_point(&ctx->dest_bitmap.b...
if (!WITHIN(y, clip_box->origin.y, grect_get_max_y(clip_box) - 1)) { return; }
const int16_t min_valid_x = clip_box->origin.x; if (x1.integer < min_valid_x) { x1 = (Fixed_S16_3){.integer = min_valid_x, .fraction = 0}; } const int16_t max_valid_x = grect_get_max_x(clip_box) - 1; if (x2.integer > max_valid_x) { x2 = (Fixed_S16_3){.integer = max_valid_x}; } // last pixel wi...
e(DialogsData *data) { SimpleDialog *simple_dialog = simple_dialog_create("Simple Vibe Dialog"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_set_text(dialog, "A Simple Dialog For Flow Testing!\nHello!"); dialog_set_background_color(dialog, GColorLavenderIndigo); dialog_set_icon(dialog, da...
{ ExpandableDialog *expandable_dialog = context; Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog); dialog_set_background_color(dialog, GColorRed); }
static void prv_show_expandable_dialog(DialogsData *data) { ExpandableDialog *expandable_dialog = expandable_dialog_create("Expandable Dialog"); Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog); dialog_set_text(dialog, data->lorem_ipsum); dialog_set_background_color(dialog, GColorLightGray); ...
alog.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/system_icons.h" #include "popups/ble_hrm/ble_hrm_stop_sharing_popup.h" #include "resource/resource_ids.auto.h" #include "services/common/analytics/analytics.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/i18n/i1...
(ble_hrm_stop_sharing_popup_create())
; } #endif // CAPABILITY_HAS_BUILTIN_HRM void settings_remote_menu_push(struct SettingsBluetoothData *bt_data, StoredRemote *stored_remote) { SettingsRemoteData *data = app_malloc_check(sizeof(SettingsRemoteData)); PBL_LOG(LOG_LEVEL_DEBUG, "NAME: %s", stored_remote->name); *data = (SettingsRemoteData){}; dat...
Y_LENGTH(sessions); activity_algorithm_post_process_sleep_sessions(session_entries, sessions); cl_assert_equal_i(sessions[0].type, ActivitySessionType_Sleep); } { // Create two 2 hour sessions, they should both be considered as separate naps ActivitySession sessions[] = { { .start_utc = s...
activity_algorithm_metrics_changed_notification()
; uint16_t steps_awake_60m; uint16_t steps_awake_100m; uint16_t steps_awake_120m; // Call the minute handler, which should zero out steps that occur while sleeping prv_feed_minute_data(60, &minute_data[0], false /*simulate_bg_delays*/); activity_algorithm_get_steps(&steps_awake_60m); prv_feed_minute_dat...
/* * 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...
{ prompt_send_response("Couldn't allocate semaphore for window stack"); return; }
// FIXME: Dumping the app window stack from another task without a // lock exposes us to the possibility of catching the window stack in // an inconsistent state. It's been like this for years without issue // but we could just be really lucky. Switch to the app task to dump // the window stack? launcher_t...
uteIdShortTitle, NULL) ?: attribute_get_string(attributes, layout->impl->attributes.primary_id, ""); primary_node->line_spacing_delta = style->primary_line_spacing_delta; int num_primary_lines = is_fat ? 2 : 1; if (is_peek) { if (!has_secondary) { num_primary_lines = 2; const i...
graphics_text_node_container_add_child(&vertical_icon_node->container, &icon_node->node)
; graphics_text_node_container_add_child(&horizontal_node->container, &horizontal_icon_node->container.node); return &horizontal_node->container.node; } return &vertical_node->container.node; } static void prv_get_pin_view_bounds(TimelineLayout *layout, GRect *bo...
_addr_handle_adverts_stopped(void); // Accesses to these statics must be protected by prv_lock() calls static AdvertState s_adv_state = AdvertState_Off; static AdvertState s_desired_host_adv_state = AdvertState_Off; static struct { bool needs_updating; BLEAdData ad_data; uint8_t data_buffer[2 * GAP_LE_AD_REPORT...
{ rv = BLE_ERROR_ALREADY_DONE; goto unlock; }
/* * 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...
(5, 40, window->layer.bounds.size.w - 5, window->layer.bounds.size.h - 40)
); text_layer_set_font(status, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(status, GTextAlignmentCenter); layer_add_child(&window->layer, &status->layer); app_window_stack_push(window, true /* Animated */); s_timer = evented_timer_register(100, true /* repeating */, prv_up...
GPoint offset = { .y = bounds->size.h - new_height }; #if PBL_ROUND // do paging on round display offset.y = ROUND_TO_MOD_CEIL(offset.y, scroll_layer->layer.frame.size.h); #endif scroll_layer_set_content_size(scroll_layer, (GSize) { scroll_layer->layer.frame.size.w, new_he...
if (transcription_dialog->callback) { if (transcription_dialog->callback_context) { transcription_dialog->callback(transcription_dialog->callback_context); } else { transcription_dialog->callback(transcription_dialog); } }
transcription_dialog->pop_timer = app_timer_register(POP_WINDOW_DELAY, prv_transcription_dialog_select_cb, transcription_dialog); } void transcription_dialog_update_text(TranscriptionDialog *transcription_dialog, char *buffer, uint16_t buffer_len) { Dialog *dialog = ex...
/* * 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...
GRect(0, 0, 100, 100)
}; // Tests //////////////////////////////////// // setup and teardown void test_bitblt_palette_1bit__initialize(void) { // Set dest bitmap to white memset(s_dest_data, 0b11111111, sizeof(s_dest_data)); } void test_bitblt_palette_1bit__cleanup(void) { } // Test images reside in "tests/fw/graphics/test_images/...
4, 112, -112}, { 1264, 80, -120}, { 960, 24, -144}, { 1008, -48, -144}, { 968, -56, -80}, { 1048, -8, -192}, { 1296, -24, -232}, { 1440, 0, -224}, { 1176, 48, -216}, { 920, 120, -280}, { 936, 160, -208}, { 1080, 216, -120}, { 1240, 336, -152}, { 1272, 520, -216}, ...
{ 832, 88, -240}, { 888, 128, -232}, { 1112, 200, -200}, { 1312, 240, -216}, { 1392, 280, -240}, { 1696, 336, -232}, { 1320, 544, -432}, { 1312, 528, -360}, { 968, 472, -440}, { 1192, 376, -376}, { 1256, 344, -280}, // 21 seconds { 1432, 320, -208}, { 1320, 104, -...
{ 1216, 112, -128}, { 1184, 120, -112}, { 1104, 104, -96}, { 1096, 72, -88}, { 1200, 56, -104}, { 992, -16, -120}, { 1112, -80, -96}, { 976, -48, -72}, { 1208, 40, -192}, { 1312, 0, -224}, { 1384, 16, -256}, { 1168, 8, -208}, { 1016, 88, -256}, { 1008, 112, -240}...
p0 : p1; Fixed_S16_3 progress_line = (Fixed_S16_3){.raw_value = (y * FIXED_S16_3_ONE.raw_value - FIXED_S16_3_ONE.raw_value / 2)}; prv_calc_cap_prepared(bottom_point_tmp.y, bottom_point_tmp.x, radius, progress_line, &l...
{ if (x > tm_p1.x.integer) { // We're crossing far_top point, time to swap... tm_p0 = far_top; tm_p1 = far_right; } if (x > bm_p1.x.integer) { // We're crossing far_bottom point, time to swap... bm_p0 = far_bottom; bm_p1 = far_right; } // S...
prv_calc_cap_vert(&p1, radius, x, &top_margin, &bottom_margin); // Finally draw line if (top_margin.raw_value <= bottom_margin.raw_value) { graphics_private_draw_vertical_line(ctx, x, top_margin, bottom_margin); } } // Blending of last line if (fraction_for_right != 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...
(&build_id_bytes_left)
; byte_stream_to_hex_string(buffer, buffer_bytes_left, build_id, build_id_bytes_left, false); } int pbl_log_get_bin_format(char* buffer, int buffer_len, const uint8_t log_level, const char* src_filename_path, int src_line_number, const char* fmt, ...) { va_list fmt_args; va_start(fmt_args, fmt); int ...
atoi(level)
; if (log_level < 0) { log_level = 0; } else if (log_level > 255) { log_level = 255; } hc_endpoint_logging_set_level(log_level); prompt_send_response_fmt(buffer, 32, "Ble Log level set to: %i", log_level); } extern bool hc_endpoint_logging_get_level(uint8_t *level); void command_ble_logging_get_level...
nsor.h" #include "drivers/vibe.h" #include "drivers/voltage_monitor.h" #include "drivers/watchdog.h" #include "resource/resource.h" #include "resource/system_resource.h" #include "kernel/util/stop.h" #include "kernel/util/task_init.h" #include "kernel/util/sleep.h" #include "kernel/events.h" #include "kernel/kernel_h...
pulse_early_init()
; print_splash_screen(); rtc_init(); #if BOOTLOADER_TEST_STAGE2 #define BLTEST_LOG(x...) pbl_log(LOG_LEVEL_ALWAYS, __FILE__, __LINE__, x) BLTEST_LOG("BOOTLOADER TEST STAGE 2"); boot_bit_set(BOOT_BIT_FW_STABLE); BLTEST_LOG("STAGE 2 -- Checking test boot bits"); if (boot_bit_test(BOOT_BIT_BOOTLOADER_TEST_A...
files are Creative Commons 0 (ie. Public Domain) from // http://opengameart.org/content/game-character-blue-flappy-bird-sprite-sheets // http://opengameart.org/content/pixel-puncher-sprites // http://opengameart.org/content/spike-man-monster // http://opengameart.org/content/platformer-baddies // http://opengameart.org...
(resource_id != UINT32_MAX)
; GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id); cl_assert(bitmap_sequence); GBitmap *bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(bitmap_sequence), GBitmapFormat8Bit); cl_assert(bitmap); // first frame always shows ...
EAdvertisingJobRef s_unscheduled_job; static bool s_unscheduled_completed; static void unscheduled_callback(GAPLEAdvertisingJobRef job, bool completed, void *cb_data) { s_unscheduled_job = job; ++s_unscheduled_cb_count; s_unscheduled_completed = c...
gap_le_is_advertising_enabled()
); // Unschedule callback should have been called once: cl_assert_equal_i(s_unscheduled_cb_count, 1); cl_assert_equal_p(s_unscheduled_job, job); cl_assert_equal_b(s_unscheduled_completed, false); // Expect no advertisement timer cl_assert_equal_i(regular_timer_seconds_count(), 0); free(ad); } void tes...