prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_BYTES) == 0) { prompt_send_response_fmt(status, sizeof(status), "Validated: 0x%lx", addr); flash_erase_sector_blocking(addr); flash_erase_sector_blocking(addr); // exercise already erased check } flash_write_bytes(&buf[0], addr, sizeof(buf)); flash_expect_program_failure(fal...
{ char buf[80]; prompt_send_response_fmt(buf, sizeof(buf), "Connected to " BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(conn->device.address)); }
start_of_today + (9 * SECONDS_PER_HOUR), HealthServiceTimeScopeDailyWeekdayOrWeekend); cl_assert_equal_i(value, exp_value); // --- // Compute weekday HealthMetricActiveSeconds from midnight to 9am. This should use the da...
(123, result)
; const ActivityMetric IN_METRIC = ActivityMetricHeartRateFilteredBPM; cl_assert_equal_i(s_sys_activity_get_metric_values.in.metric, IN_METRIC); cl_assert_equal_i(s_sys_activity_get_metric_values.in.history_len, 1); // This is the equivalent to `peek_value` with HeartRateBPM. Make sure it is equal. result = ...
TES_PER_DAY / ACTIVITY_NUM_METRIC_AVERAGES; int num_chunks = minute_of_day / minutes_per_step_avg; ActivityScalarStore total_steps_avg = 0; for (int i = 0; i < ACTIVITY_NUM_METRIC_AVERAGES && i < num_chunks; ++i) { if (averages->average[i] != ACTIVITY_METRIC_AVERAGES_UNKNOWN) { total_steps_avg += averag...
attribute_list_destroy_list(&dismiss_action_attr_list)
; attribute_list_destroy_list(&open_pin_action_attr_list); attribute_list_destroy_list(&response_action_attr_list); return item; } // ------------------------------------------------------------------------------------------------ // Creates a notification to notify the user of a new pin with a response action ...
g from ISR variant PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_system_task_starved_callback, .data = NULL, }, }; event_put_isr(&event); } prv_log_failed_message(&reason); // Re-write the reason including th...
task_watchdog_enable_interrupt()
; } void task_watchdog_bit_set(PebbleTask task) { task_watchdog_disable_interrupt(); s_watchdog_bits |= (1 << task); task_watchdog_enable_interrupt(); } bool task_watchdog_mask_get(PebbleTask task) { task_watchdog_disable_interrupt(); bool result = (s_watchdog_mask & (1 << task)); task_watchdog_enable_int...
layer_right_icon.h" #include "applib/app.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "system/logging.h" #include "system/passert.h" #include <stdio.h> #define NUM_MENU_SECTIONS 1 #define NUM_MENU_ITEMS 4 ...
app_event_loop()
; handle_deinit(); } const PebbleProcessMd* menu_layer_right_icon_app_get_info() { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, .name = "MenuLayer Right Icon Demo" }; return (const PebbleProcessMd*) &s_app_info; }
/* * 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...
while (fake_system_task_count_callbacks()) { fake_system_task_callbacks_invoke_pending(); }
} BlobDBToken blob_db_endpoint_send_writeback(BlobDBId db_id, time_t last_updated, const void *key, int key_len, const void *val, ...
(const PebbleCommSessionEvent) { .is_open = is_open, .is_system = true }; music_endpoint_handle_mobile_app_event(&app_event); } static void prv_receive_pp_data(const uint8_t *data, uint16_t length) { fake_event_clear_last(); music_protocol_msg_callback(NULL, data, length); } static void prv_receive_a...
(data_length, 1)
; cl_assert_equal_i(data[0], 0x08); // MusicEndpointCmdIDGetAllInfo s_now_playing_requested = true; } static bool s_next_track_command_sent; static void prv_assert_next_track_command_sent_cb(uint16_t endpoint_id, const uint8_t* data, unsigned int data_length) { ...
/* * 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...
ALIAS("Default_Handler")
void BusFault_Handler(void); ALIAS("Default_Handler") void UsageFault_Handler(void); ALIAS("Default_Handler") void SVC_Handler(void); ALIAS("Default_Handler") void DebugMon_Handler(void); ALIAS("Default_Handler") void PendSV_Handler(void); ALIAS("Default_Handler") void SysTick_Handler(void); // External Interrupts #d...
/* * 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...
(timer->id != TASK_TIMER_INVALID_ID)
; manager->idle_timers = list_insert_before(manager->idle_timers, &timer->list_node); mutex_unlock(manager->mutex); return timer->id; } // -------------------------------------------------------------------------------- // Schedule a timer to run. bool task_timer_start(TaskTimerManager *manager, TaskTimerID t...
run it to the end // We will then create a sequence out of 'a' + 'b' and verify that if we advance that 'b' runs // correctly. void test_animation__sequence_of_already_completed(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 500; const int delay_b = 20; const int dela...
(a, delay_a)
on the screen size. Whether there can be a secondary // depends on whether the remaining screen space after fat permits. .primary_secondary_peek_margin_h = -5, .thin_can_have_secondary = true, }; static const TimelineLayoutStyle * const s_styles[NumPreferredContentSizes] = { [PreferredContentSizeSmall] = &s_st...
( config->mode, config->attributes, timeline_layout_impl->card_icon_size, timeline_layout_impl->default_icon)
; timeline_layout_init_with_icon_id(layout, config, timeline_layout_impl, icon_resource); } void timeline_layout_deinit(TimelineLayout *timeline_layout) { if (timeline_layout->metric_icon_layers) { for (unsigned int i = 0; i < timeline_layout->num_metric_icon_layers; i++) { kino_layer_destroy(timeline_la...
debugging // entirely unless we explicitly want it. See PBL-10174 disable_mcu_debugging(); #else // Turn on MCU debugging at boot. This consumes some power so we'll turn it off after a short // time has passed (see prv_low_power_debug_config_callback) to allow us to connect after a // reset but not passively ...
rtc_init_timers()
; rtc_alarm_init(); power_tracking_init(); } static void clear_reset_loop_detection_bits(void) { boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE); } static void uptime_callback(void* data) { PBL_LOG_VERBOSE("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...
( rcc_clocks.PCLK1_Frequency, hal->bus_mode, hal->clock_speed, hal->rise_time_ns, hal->fall_time_ns)
; PBL_ASSERT(timingr != I2C_TIMINGR_INVALID_VALUE, "Could not calculate TIMINGR values!"); hal->i2c->TIMINGR = timingr; // I2C only used as a master; disable slave address acknowledgement hal->i2c->OAR1 = 0; hal->i2c->OAR2 = 0; // Enable i2c Peripheral; clear any configured interrupt bits; use analog filt...
timeline_layout.h" #include "applib/fonts/fonts.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/text.h" #include "apps/system_apps/timeline/peek_layer.h" #include "font_resource_keys.auto.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/kernel_ui.h" #include "resource/resource_ids.auto.h" #includ...
{ return (layout->info.item->header.type == TimelineItemTypeReminder); }
static void prv_reminder_timestamp_update(const LayoutLayer *layout_ref, const LayoutNodeTextDynamicConfig *config, char *buffer, bool render) { const NotificationLayout *layout = (NotificationLayout *)layout_ref; const int max_re...
eOther_RTCWakeup) { return RTC_WKUP_IRQn; } WTF; } static void prv_configure_nvic_channel(IRQn_Type irqn) { NVIC_SetPriority(irqn, EXTI_PRIORITY); NVIC_EnableIRQ(irqn); } static void prv_check_nvic_channel(IRQn_Type irqn) { // Make sure we haven't already set up the channel in question. if (irqn == EX...
{ NVIC_ClearPendingIRQ(EXTI3_IRQn); prv_handle_exti(3); }
bounds_out) { *bounds_out = layer->bounds; } static Window s_app_window_stack_get_top_window; Window *app_window_stack_get_top_window() { return &s_app_window_stack_get_top_window; } GContext s_context; // mocks static MockCallRecordings s_graphics_context_set_fill_color; void graphics_context_set_fill_color(GCo...
cl_assert_parsed_color("", NULL)
; cl_assert_parsed_color("#00zz10", NULL); cl_assert_parsed_color("#123456789", NULL); // different lengths cl_assert_parsed_color("#f00", &GColorRed); cl_assert_parsed_color("#FF0000", &GColorRed); cl_assert_parsed_color("#F00f", &GColorRed); cl_assert_parsed_color("#FF0000FF", &GColorRed); // discar...
return list_idx; } list_idx++; cur_node = (AlarmNode* )list_get_next((ListNode*) cur_node); } return 0; } static void prv_update_menu_layer(AlarmsAppData* data, AlarmId select_alarm) { MenuIndex selected_menu_index = {0, prv_get_list_idx_of_alarm_id(data, select_alarm)}; menu_layer_reload...
{ GRect box; uint32_t new_bitmap_resource = RESOURCE_ID_PLUS_ICON_BLACK; if (!data->can_schedule_alarm) { // alarm limit reached if (menu_cell_layer_is_highlighted(cell_layer)) { if (data->show_limit_reached_text) { // Trying to add a new alarm when list is already full c...
/* * 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 (fd < 0) { return 0xFFFFFFFF; } uint32_t crc = pfs_crc_calculate_file(fd, RESOURCE_STORE_METADATA_BYTES + entry_offset, num_bytes); pfs_close(fd); return crc; }
static uint32_t prv_file_common_read(int fd, uint32_t offset, void *data, size_t num_bytes) { if (fd < 0) { return 0; } int bytes_read = 0; if (pfs_seek(fd, offset, FSeekSet) >= 0) { bytes_read = pfs_read(fd, data, num_bytes); // prevent invalid resource API return values if (bytes_read < 0...
up if the mobile changes the // UTC time on us. state->hr.last_sample_ts = now_uptime; // Save the BPM, quality, and update time (UTC) of the last reading for activity_get_metric() state->hr.metrics.current_bpm = hrm_event->bpm.bpm; state->hr.metrics.current_quality = hrm_event->bpm.quality; st...
if (!activity_prefs_tracking_is_enabled() && pebble_task_get_current() == PebbleTask_App) { health_tracking_ui_app_show_disabled(); }
// Update derived metrics prv_update_real_time_derived_metrics(); ActivityMetricInfo m_info; activity_metrics_prv_get_metric_info(metric, &m_info); if (history_len == 0) { goto unlock; } // Clip history length history_len = MIN(history_len, ACTIVITY_HISTORY_DAYS); if (!m_i...
imer->private_count = reg_timer->private_reset_count; // Release the mutex while we execute the callback reg_timer->is_executing = true; mutex_unlock(s_callback_list_semaphore); reg_timer->cb(reg_timer->cb_data); mutex_lock(s_callback_list_semaphore); reg_timer->is_executing = false...
(s_callback_list_semaphore)
; cb->private_reset_count = minutes; cb->private_count = minutes; if (!list_find(&s_minutes_callbacks, prv_callback_registered_filter, &cb->list_node)) { // better not be registered as a minute callback already PBL_ASSERTN(!list_find(&s_seconds_callbacks, prv_callback_registered_filter, &cb->list_node))...
/* * 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...
(&data->text_layer, GColorBlack)
erry_set_property_by_index(const jerry_value_t obj_val, uint32_t index, const jerry_value_t value_to_set) { if (jerry_value_has_error_flag(value_to_set) || !jerry_value_is_object(obj_val)) { return TYPE_ERROR_ARG; } retu...
__jerryRefs.setError(error_ref, true)
; return error_ref; } return __jerryRefs.ref(rv); }, func_obj_val, this_val, args_p, args_count); } jerry_value_t jerry_construct_object(const jerry_value_t func_obj_val, const jerry_value_t args_p[], jerry_size_t a...
"gpath_filled_bottom_clipped.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gp...
test_graphics_context_init(&ctx, fb)
; s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2); graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_bottom_clipped_aa.${BIT_DEPTH_NAME}.pbi")); prv_reset();...
health_util_create_text_node(buffer_size, number_font, TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, (char *)number_text_node->text, buffer_size, i18n_owner, active_window->workout_data...
(timeout_ms, prv_hr_measuring_timer_callback, active_window)
rawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerNone}, .full_quadrants = GCornersAll, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerNone} })); cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(360), TO_TRIG(370)), ((EllipsisDrawConfig){ .start_quadrant ...
(TO_TRIG(270), TO_TRIG(360 + 180))
, ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(270),GCornerTopLeft}, .full_quadrants = (GCornersTop | GCornerBottomRight), .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCornerBottomLeft} })); // ## Section with regular angles // Within same quadrant cl_assert_e...
bool has_privileged_access) { return NULL; } static bool resource_storage_file_find_resource(ResourceStoreEntry *entry, ResAppNum app_num, uint32_t resource_id) { if (app_num != SYSTEM_APP) { return false; } for (unsigned int i = 0; i < ...
(LOG_LEVEL_WARNING, "Could not open resource pfs file <%s>, fd: %d", filename, fd)
k_midnight || timestamp_midnight >= next_week_midnight) { switch (style) { case FullStyleLower12h: case FullStyleCapital12h: if (with_fulltime) { time_fmt = i18n_noop("%b %e, %l:%M %p"); } else { time_fmt = i18n_noop("%B %e"); } break; case FullS...
i18n_noop("%m/%d")
lls, 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), 2); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_ca...
(start_ms + 2 * (duration_total + 4 * MIN_FRAME_INTERVAL_MS))
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 3); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 2); 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), 2...
(ctx, cell_layer, title, -cell_layer->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]; prv_draw_row(ctx, cell_layer, title, -cell_layer->frame.origin.y/4 + cell_layer->bounds.size.w); } static int16_t prv_get_separator_height...
-1056, 416, 24}, { -1016, 568, 176}, { -1456, 432, -32}, { -1024, 104, -216}, { -968, 352, -248}, { -1408, 496, -184}, { -1728, 368, -88}, { -1768, 152, 8}, { -1648, -24, 128}, { -1440, -144, 104}, { -1312, -64, 40}, { -1216, 16, 32}, { -1144, 48, 24}, { -1240, 32, 40...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-02 15:59:18 local AccelRawData *activity_sample_walk_200_pbl_25480_12(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25480_12 //> TE...
ote: it's fine if this returns null, since the parent functions will check for a null pointer TimelineItem *item = timeline_item_create_with_attributes(config->notif_time, 0, TimelineItemTypeNotification, ...
[PercentTier_BelowAverage] = { .num_variants = 4, .variants = { i18n_noop("You walked %d steps today which is %d%% below your typical. " "Try to be more active tomorrow–you can do it!"), i18n_noop("You walked %d steps which is %d%% below your typical. " ...
if ((tier == PercentTier_BelowAverage || tier == PercentTier_Fail) && above_fail_threshold) { // we don't want to show a negative insights if you've walked 10000 or more steps tier = PercentTier_OnAverage; } // Enough to fit any filled out format string above and i18n variants const int max_notif_leng...
/* * 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 false; }
// check version number if (score->version > VIBE_SCORE_VERSION) { return false; } // check if attr_list_size is correct if (score->attr_list_size != (data_size - (sizeof(VibeScore) - sizeof(GenericAttributeList)))) { return false; } // check exact file size to contain all flexible-sized data ...
ed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "rocky_api_util.h" #include "rocky_api_errors.h" #include "applib/a...
{ parent = jerry_get_global_object(); // it's safe to release the global object here already, it will never be destroyed jerry_release_value(parent); }
{ const struct lc_time_T *time_locale = time_locale_get(); size_t left = maxsize; const int year = prv_full_year(t->tm_year); const int hour_12h = (t->tm_hour % 12 == 0) ? 12 : (t->tm_hour % 12); // Only use i18n if we're in the kernel, or the app locale is the system locale. const bool use_i18n = !locale ...
{ intfmt = "%0*d"; }
else { intfmt = "%*d"; } width = MAX(width, cpyint_len); length = snprintf(NULL, 0, intfmt, width, cpyint_val); if (left <= length) { goto _out_of_size; } sprintf(dest_str, intfmt, width, cpyint_val); dest_str += length; ...
animation_set_duration(animation1, BAR_TO_TRANS_MS)
; animation_set_curve(animation1, AnimationCurveEaseIn); prop_anim = property_animation_create_layer_bounds((Layer *)&data->progress_layer, &mid, &end); Animation *animation2 = property_animation_get_animation(prop_anim); animation_set_duration(animation2, TRANS_TO_DOT_MS); animation_set_curve(animation2, A...
iance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either e...
(remote->name, other->name, sizeof(remote->name))
; } } static void add_remote(SettingsBluetoothData* data, StoredRemote* remote) { const bool ascending = false; data->remote_list_head = list_sorted_add(data->remote_list_head, &remote->list_node, (Comparator) remote_comparator, ascending); } static StoredRemote* stored_remote_create(void) { StoredRemot...
/* * 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_ble_bonding_change_add_count++; }
else if (op == BtPersistBondingOpDidChange) { s_ble_bonding_change_update_count++; } else if (op == BtPersistBondingOpWillDelete) { s_ble_bonding_change_delete_count++; } return; } void analytics_set(AnalyticsMetric metric, int64_t val, AnalyticsClient client) { if (metric == ANALYTICS_DEVICE_METRIC_B...
le_task_get_handle_for_task(PebbleTask_App), tskIDLE_PRIORITY | portPRIVILEGE_BIT); } static void prv_system_task_starved_callback(void *data) { if (system_task_is_ready_to_run() || (system_task_get_current_callback() != NULL)) { // check if system task is ready to go or is already running a callback. ...
TIM_TimeBaseStructInit(&tim_config)
; // Clock frequency to run the timer at uint32_t prescaler = timer_clock / TIMER_CLOCK_HZ; // period & prescaler values are 16 bits, check for configuration errors PBL_ASSERTN(TIME_PERIOD <= UINT16_MAX && prescaler <= UINT16_MAX); tim_config.TIM_Period = TIME_PERIOD; tim_config.TIM_Prescaler = prescaler...
= 0x7f)) { // Backspace if (s_dbgserial_prompt_context.write_index != 0) { s_dbgserial_prompt_context.write_index--; dbgserial_putchar(0x8); // move cursor back one character dbgserial_putchar(0x20); // replace that character with a space, advancing the cursor dbgserial_putchar(0x8); // move...
pulse_send_message(PROMPT_RESP_ACK, NULL)
r is visible if (node == NULL) { layer_set_hidden((Layer *) &data->menu_layer, true); layer_set_hidden((Layer *) &data->text_layer, false); } else { layer_set_hidden((Layer *) &data->menu_layer, false); layer_set_hidden((Layer *) &data->text_layer, true); } } static void prv_handle_notification_r...
(&window->layer, text_layer_get_layer(text_layer))
; #if PBL_ROUND GColor bg_color = GColorClear; GColor fg_color = GColorBlack; StatusBarLayer *status_bar = &data->status_bar_layer; status_bar_layer_init(status_bar); status_bar_layer_set_colors(status_bar, bg_color, fg_color); layer_add_child(&window->layer, &status_bar->layer); #endif menu_layer_set_...
e called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); s_test_alg_state.orientation = 0x11; // Not flat prv_advance_time_hr(ACTIVITY_DEFAULT_HR_PERIOD_SEC, 100 /*bpm*/, HRMQualit...
prv_advance_time_hr(8 /*sec*/, 120 /*hr*/, HRMQuality_Worst, true /*force_continuous*/)
-672}, { 112, 24, -816}, { 112, 32, -896}, { 64, 80, -1048}, { -40, 120, -1272}, // 10 seconds { -80, 48, -1160}, { -312, 16, -1120}, { -232, 280, -1224}, { -392, 184, -1168}, { -416, 152, -912}, { -312, 80, -808}, { -216, 48, -560}, { -48, -48, -368}, { -16, -136...
{ -1424, 456, -224}, { -1336, 600, -304}, { -1184, 576, -176}, { -1168, 496, -128}, { -864, 368, -56}, { -544, 400, -152}, { -480, 408, -160}, { -472, 328, -32}, { -480, 272, 24}, { -512, 312, 48}, { -536, 360, 48}, { -544, 376, 104}, { -712, 384, 104}, { -840, 44...
{ -600, 304, 0}, { -480, 344, -64}, { -448, 360, -56}, { -512, 304, 56}, // 18 seconds { -560, 304, 40}, { -520, 336, 48}, { -520, 360, 56}, { -704, 416, -24}, { -920, 440, -48}, { -1056, 472, -152}, { -1248, 368, -80}, { -1296, 536, -256}, { -920, 520, -360}, ...
_mask_for_vline_applying_test(ctx); cl_assert(graphics_context_mask_use(ctx, mask)); for (int16_t x = 0; x < num_src_colors; x++) { GColor src_color = (GColor) { .argb = (uint8_t)x }; for (int dest_color_index = 0; dest_color_index < num_dest_colors; dest_color_index++) { for (int mask_value_index =...
grect_get_max_x(&ctx->draw_state.clip_box)
integer += ctx->draw_state.drawing_box.origin.x; x2.integer += ctx->draw_state.drawing_box.origin.x; y += ctx->draw_state.drawing_box.origin.y; // round edges: x1.raw_value += (FIXED_S16_3_ONE.raw_value / 2); x2.raw_value += (FIXED_S16_3_ONE.raw_value / 2); if (x2.fraction > (opacity << 1)) { ...
(ctx, y, x1, x2, left_aa_offset, right_aa_offset, min_valid_x, max_valid_x, color)
; } void graphics_private_draw_horizontal_line_delta_aa(GContext *ctx, int16_t y, Fixed_S16_3 x1, Fixed_S16_3 x2, Fixed_S16_3 delta1, Fixed_S16_3 delta2) { // apply draw box and clipping x1.integer += ctx->draw_...
snprintf(dstbuf, 256, "%.1dzero%.1d", 0, 1); cl_assert_equal_s(dstbuf, "0zero1"); // Variable length character output snprintf(dstbuf, 256, "There are %*d lights", 3, 4); cl_assert_equal_s(dstbuf, "There are 4 lights"); // Left-align, Variable length character output snprintf(dstbuf, 256, "There are ...
(dstbuf, "-1698898192,-1698898192")
; } void test_sprintf__percent_u(void) { char dstbuf[256]; // Simple %u snprintf(dstbuf, 256, "There are %u lights, %u", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, 4294967292"); // Alternate form snprintf(dstbuf, 256, "There are %#u lights, %#u", 4, -4); cl_assert_equal_s(dstbuf, "There are...
/* * 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 false; }
frame = prv_next_frame(frame); } return (end == (uint8_t *) frame); } static uint32_t prv_get_single_play_duration(GDrawCommandSequence *sequence) { uint32_t total = 0; GDrawCommandFrame *frame = sequence->frames; for (uint32_t i = 0; i < sequence->num_frames; i++) { total += gdraw_command_frame_ge...
define DST_YEARS_OFFSET 1 time_t dst_start_stamps[DST_YEARS_RANGE]; time_t dst_end_stamps[DST_YEARS_RANGE]; for (int i = 0; i < DST_YEARS_RANGE; i++) { const int year = current_tm.tm_year + (i - DST_YEARS_OFFSET); dst_start_stamps[i] = prv_clock_dstrule_to_timestamp(false, tz_info, &dst_rule_begi...
.gmt_offset_delta = new_gmt_offset - orig_gmt_offset, .dst_changed = false, } }; event_put(&e); }
static void prv_handle_set_utc_and_timezone_msg(TimezoneCBData *tz_data) { tz_data->utc_time = ntohl(tz_data->utc_time); tz_data->utc_offset_min = ntohs(tz_data->utc_offset_min); const char *region_name = tz_data->region_name; if (tz_data->region_name_len == 0) { region_name = "[N/A]"; } PBL_LOG(LOG_...
*data_source = data; prv_send_callback_to_app(data_source, install_id, APP_ICON_NAME_UPDATED); } //! Must be run from the app task static void prv_do_app_db_cleared(AppMenuDataSource *source) { AppMenuNode *iter = source->list; while (iter) { AppMenuNode *temp = (AppMenuNode *)list_get_next((ListNode *)iter)...
{ AppMenuNode *node = source->list; while (node != NULL) { if (node->install_id == install_id) { return node; } else { node = (AppMenuNode*)list_get_next((ListNode*)node); } } return NULL; }
//! @return True if there was app with install_id was found and removed from the list. static bool remove_app_with_install_id(const AppInstallId install_id, AppMenuDataSource *source) { if (source->is_list_loaded == false) { return false; } AppMenuNode *node = prv_find_node_with_install_id(install_id, sour...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ assert_decode_char_succeeds(c); }
assert_decode_completed(254); const unsigned char *iter = out; for (int c = 0x01; c <= 0xfe; ++c) { cl_assert_equal_i(*iter++, c); } } void test_cobs_decode__empty_data(void) { decode_start(100); assert_decode_char_succeeds(0x01); assert_decode_completed(0); assert_buffer_not_touched(0); } void t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(false /* run filesystem check */)
; pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Reset data prv_set_data(&s_data, 0, 0, 0, 0); prv_set_unobstructed_area_height(0); s_clock_is_24h_...
s what is used for fill circle. Restore the fill color afterwards. GColor backup_fill_color = ctx->draw_state.fill_color; ctx->draw_state.fill_color = ctx->draw_state.stroke_color; graphics_fill_circle(ctx, p, ctx->draw_state.stroke_width / 2); ctx->draw_state.fill_color = backup_fill_color; return;...
{ // Radius cannot be smaller than 1 PBL_ASSERTN(radius > 0); prv_fill_oval_quadrant(ctx, p, radius, radius, 0, 0, quadrant); }
#endif // PBL_COLOR // Returns x for f(x) = g(x) with f(x)=y and a line g(x) that goes through two given points a,b static int16_t prv_intersection_between_horizontal_and_line(Fixed_S16_3 progress, GPointPrecise top, GPointPrecise bottom) { if (bottom.y.ra...
_context.h" #include "stubs_logging.h" #include "stubs_process_manager.h" #include "stubs_passert.h" // Stubs /////////////////////// bool gbitmap_init_with_png_data(GBitmap *bitmap, const uint8_t *data, size_t data_size) { return false; } bool gbitmap_png_data_is_png(const uint8_t *data, size_t data_size) { retu...
(gbitmap_init_with_resource_system(&bitmap, 0, 0))
; s_fake_bitmap_data.info.format = GBitmapFormat1Bit; s_fake_bitmap_data.width = 65; cl_assert(!gbitmap_init_with_resource_system(&bitmap, 0, 0)); s_fake_bitmap_data.info.format = GBitmapFormat1Bit; s_fake_bitmap_data.width = 63; cl_assert(gbitmap_init_with_resource_system(&bitmap, 0, 0)); }
ol is_cursor_at_active_registry(uint32_t cursor) { uint8_t header[REGISTRY_HEADER_SIZE_BYTES]; flash_read_bytes(header, cursor, REGISTRY_HEADER_SIZE_BYTES); return memcmp(header, s_active_header, REGISTRY_HEADER_SIZE_BYTES) == 0; } static uint32_t get_next_cursor_position(uint32_t old_address, Registry* registry...
for (int i = 0; i < r->value_length; i++) { PBL_LOG_VERBOSE("%#.2hx, ",r->value[i]); }
PBL_LOG_VERBOSE("\n"); } static bool record_compare(Record* r, const char* key, const uint8_t key_length, const uint8_t* uuid) { if ((r->key_length == key_length) && (memcmp(r->uuid, uuid, UUID_SIZE_BYTES) == 0) && (memcmp(r->key, key, r->key_length) == 0)) { return true; } return false; } st...
menu_item, void *context) { prv_mute_notification(action_menu_item, MuteBitfield_Weekdays); } static void prv_mute_notification_weekends(ActionMenu *action_menu, const ActionMenuItem *action_menu_item, ...
((uint8_t *)app_id, strlen(app_id))
; char *display_name = ""; if (notif_prefs) { display_name = (char *)attribute_get_string(&notif_prefs->attr_list, AttributeIdAppName, ""); } const char *mute_label = i18n_noop("Mute %s"); static char mute_label_buf[32]; snprintf(mute_label_buf, sizeof(mute_label_buf), i18n_ge...
t is available num_records = num_minutes * 2; start = start_utc - SECONDS_PER_DAY; activity_algorithm_get_minute_history(retrieve, &num_records, &start); cl_assert_equal_i(num_records, num_minutes); cl_assert_equal_i(start, start_utc); for (int i = 0; i < num_minutes; i++) { prv_assert_minute_data(&retr...
activity_algorithm_handle_accel(samples, s_sample_rate, timestamp)
; // Fetch the last whole minute plus this partial minute time_t start = oldest_to_fetch; uint32_t num_records = 2; HealthMinuteData received_records[num_records]; activity_algorithm_get_minute_history(received_records, &num_records, &start); cl_assert_equal_i(num_records, 2); cl_assert_equal_i(start, ol...
s = time_end - time_start; range->seconds_first_day = (range->num_days == 1) ? total_seconds : seconds_first_day; range->seconds_last_day = (range->num_days == 1) ? total_seconds : seconds_last_day; range->seconds_total_last_day = (range->last_day_idx == 0) ? (now - midnight_before_end) : SECONDS_PER...
ROUND(result, time_range.num_days)
; } break; case HealthAggregationMax: result = INT32_MIN; for (uint32_t i = 0; i < time_range.num_days; i++) { result = MAX(result, daily_history.totals[i + time_range.last_day_idx]); } break; case HealthAggregationMin: result = INT32_MAX; for (uint32_t ...
s_count_compositor_init_func_a = 0; s_count_compositor_init_func_b = 0; s_app_window_render_count = 0; s_modal_manager_render_count = 0; s_display_update_in_progress = false; s_render_pending = false; compositor_init(); } void test_compositor__cleanup(void) { } void test_compositor__simple(void) { ...
(s_count_display_update, 0)
on 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS ...
jerry_set_object_field(jerry_get_global_object(), "ctx", ctx)
/* * 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...
(0xec5baa37)
/* * 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...
(".rocky_bss")
static const RockyGlobalAPI *const *s_global_apis; #define API_REFS_FOREACH(var_name) \ for (RockyGlobalAPI const *const *var_name = s_global_apis; *var_name != NULL; var_name++) static jerry_value_t prv_get_or_create_listener_array(const char *event_name) { JS_VAR rocky = rocky_get_rocky_singleton(); JS_VAR ...
current app is forcing the light on and off, don't muck with it. static bool s_user_controlled_state; //! For temporary disabling backlight (ie: low power mode) static bool s_backlight_allowed = false; //! Mutex to guard all the above state. We have a pattern of taking the lock in the public functions and assuming //...
{ return false; }
} void light_init(void) { s_light_state = LIGHT_STATE_OFF; s_current_brightness = BACKLIGHT_BRIGHTNESS_OFF; s_timer_id = new_timer_create(); s_num_buttons_down = 0; s_user_controlled_state = false; s_mutex = mutex_create(); } void light_button_pressed(void) { mutex_lock(s_mutex); s_num_buttons_down+...
/* * 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...
framebuffer_init(s_fb, &(GSize) {DISP_COLS, DISP_ROWS})
; test_graphics_context_init(&s_ctx, s_fb); read_pbi("no_litter_crop.png.pbi", &test_image); } void test_graphics_draw_bitmap__cleanup(void) { free(s_fb); free(test_image.addr); } // Layout Test Support //////////////////////////////////// #define TEST_LAYER_SIZE (GSize(64, 110)) #define TEST_LAYER_OFFSET_OR...
att_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], (const uint8_t *) &meta_invalid_uuid, sizeof(meta_invalid_uuid), BLEGATTErrorSuccess); // No client created: cl_assert_eq...
ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], (const uint8_t *) &s_meta_v0_system, sizeof(s_meta_v0_system), BLEGATTErrorSuccess)
; // Expect subscribe request was made: fake_gatt_client_subscriptions_assert_subscribe(s_characteristics[0][PPoGATTCharacteristicData], BLESubscriptionNotifications, GAPLEClientKernel); // Simulate getting the sub...
/* * 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...
{ switch (result) { case APP_MSG_OK: return "APP_MSG_OK"; case APP_MSG_SEND_TIMEOUT: return "APP_MSG_SEND_TIMEOUT"; case APP_MSG_SEND_REJECTED: return "APP_MSG_SEND_REJECTED"; case APP_MSG_NOT_CONNECTED: return "APP_MSG_NOT_CONNECTED"; case APP_MSG_APP_NOT_RUNNING: return "APP_MSG_APP_NOT_RUNNING"...
ons(&e, &r); free(r.allocated_buffer); const size_t block_size = file_size / 4; int erase_count = block_size / notif_size + (((block_size % notif_size) > 0) ? 1 : 0); int j; for (j = 0; j < erase_count; j++) { e.header.id = uuids[j]; e.header.timestamp = timestamp + j; cl_assert_equal_b(notificat...
(uuid_equal(&u, &e2.header.id))
; cl_assert(notification_storage_find_ancs_notification_id(84, &u)); cl_assert(uuid_equal(&u, &e3.header.id)); // Add a new notification with the same ANCS UID as an existing notification to make sure we // return the new notification instead of the old one TimelineItem e4 = e3; uuid_generate(&e4.header.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...
(icon_layer)
/* * 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...
boot_bit_test(BOOT_BIT_NEW_PRF_AVAILABLE)
) { return; } boot_bit_clear(BOOT_BIT_NEW_PRF_AVAILABLE); #ifndef RECOVERY_FW prv_do_update(); #endif }
include "util/iterator.h" #include "utf8_test_data.h" #include "applib/graphics/utf8.h" #include "clar.h" #include <stdarg.h> #include <stdio.h> #include <stdlib.h> // Stubs /////////////////////////////////////////////////////////// #include "stubs_logging.h" #include "stubs_passert.h" ////////////////////////////...
cl_assert_equal_p(context, &s_context)
; s_each_count++; return true; } void test_utf8_iterator__each_codepoint(void) { void *context = &s_context; const char *str = "\xc3\xb0" "a"; s_each_count = 0; cl_assert_equal_b(utf8_each_codepoint(str, prv_each_codepoint, context), true); cl_assert_equal_i(s_each_count, 2); } static bool prv_each_code...
allStorageResources, .visibility = process_metadata_flags_visibility(app_header->flags), // PebbleTask_App because the flag parsing function needs it, and we can assume all // applications registered with the manager are applications, not workers. .process_type = process_metadata_flags_process_type(app_...
PBL_LOG(LOG_LEVEL_WARNING, "Stored app with resource id %d not found in resources", reg_entry->bin_resource_id)
; return NULL; } // Convert to PebbleProcessMd. Set the correct icon_id from the passed in argument app_header.icon_resource_id = reg_entry->icon_resource_id; // freed in process_manager.c PebbleProcessMdResource *md = kernel_malloc_check(sizeof(PebbleProcessMdResource)); pr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ char *dest = (char*)s1; const char *src = (const char*)s2; while (n--) { *dest++ = *src++; } return s1; }
void *memmove(void * restrict s1, const void * restrict s2, size_t n) { char *dest = (char*)s1; const char *src = (const char*)s2; if (dest <= src) { while (n--) { *dest++ = *src++; } } else { while (n--) { dest[n] = src[n]; } } return s1; }
eady be in a //! state where it's safe to exit, so the caller must call process_manager_make_process_safe_to_kill() first and only //! call this method if process_manager_make_process_safe_to_kill() returns true; void process_manager_process_cleanup(PebbleTask task) { PBL_ASSERT_TASK(PebbleTask_KernelMain); Proces...
(task, &event)
; } // ---------------------------------------------------------------------------------------------- void *process_manager_address_to_offset(PebbleTask task, void *system_address) { ProcessContext *context = prv_get_context_for_task(task); if (system_address >= context->load_start && system_address < contex...
/* * 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...
TIM_ITConfig(TIM4, TIM_IT_Update, ENABLE)
; TIM_Cmd(TIM4, ENABLE); // Prevent us from entering stop mode (and disabling the clock timer) stop_mode_disable(InhibitorButton); } __enable_irq(); } static void prv_button_interrupt_handler(bool *should_context_switch) { prv_enable_button_timer(); } static void clear_stuck_button(ButtonId button_...
assert_result_invalid(app_smartstrap_attribute_read(NULL)); // destroy test attribute app_smartstrap_attribute_destroy(attr); } void test_app_smartstrap__check_ids(void) { // craete an attribute SmartstrapAttribute *attr = app_smartstrap_attribute_create(0x1111, 0x2222, 100); cl_assert(attr != NULL); // ...
smartstrap_attribute_send_pending()
wait for a session ready response via the // voice_handle_session_setup_result call or a session setup timeout occurs (timer callback // prv_session_setup_timeout) VoiceSessionId voice_start_dictation(VoiceEndpointSessionType session_type) { mutex_lock(s_lock); if (s_state != SessionState_Idle) { mutex_unlock...
(event_type, VoiceStatusErrorGeneric, NULL)
; goto done; } if (session_type >= VoiceEndpointSessionTypeCount) { PBL_LOG(LOG_LEVEL_WARNING, "Session setup result for invalid session type received"); goto done; } if (result != VoiceEndpointResultSuccess) { prv_cancel_session(); VoiceStatus status = prv_get_status_from_result(result); ...
kino_layer_set_reel(&s_phone_ui_data->icon_layer, icon_reel, true)
; kino_layer_play(&s_phone_ui_data->icon_layer); s_phone_ui_data->current_icon = new_image; s_phone_ui_data->current_icon_id = resource; #else kino_layer_set_reel(&s_phone_ui_data->icon_layer, new_image, true); s_phone_ui_data->current_icon = new_image; s_phone_ui_data->current_icon_id = resource; #endif } ...
tery charge state, and when to automatically dismiss the status // modal window. #define MAX_TRANSITIONS 6 typedef void (*EntryFunc)(void *); typedef void (*ExitFunc)(void); typedef enum BatteryUIStateID { BatteryInvalid, BatteryGood, BatteryWarning, BatteryLowPower, BatteryCritical, BatteryCharging, B...
get_strength_for_intensity(VibeIntensityMedium)
); #else app_manager_launch_new_app(&(AppLaunchConfig) { .md = prf_low_power_app_get_info(), }); #endif } static void prv_exit_low_power(void) { #ifndef RECOVERY_FW modal_manager_set_min_priority(ModalPriorityMin); watchface_launch_default(NULL); vibe_intensity_set(vibe_intensity_get()); #else app_mana...
8}, { -152, 432, -960}, { -144, 480, -904}, { -176, 432, -968}, { -152, 600, -1008}, { -192, 424, -904}, { -176, 488, -952}, { -136, 392, -936}, { -176, 520, -904}, { -168, 448, -864}, { -112, 512, -960}, // 114 seconds { -192, 432, -856}, { -144, 440, -1000}, { -...
{ -104, 552, -880}, { -120, 504, -888}, // 119 seconds { -144, 432, -904}, { -104, 464, -1048}, { -192, 568, -904}, { -128, 536, -896}, { -160, 448, -872}, { -96, 536, -920}, { -184, 464, -832}, { -96, 496, -976}, { -216, 424, -808}, { -96, 544, -880}, { -152, 432...
riginal_index; #else return original_index; #endif } static void select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, SettingsWatchfacesData *data) { const AppMenuNode* app_node = app_menu_data_source_get_node_at_index(&data->data_source, cell_index->row); // NOTE: The default watchface is not se...
menu_layer_set_callbacks(menu_layer, data, &(MenuLayerCallbacks) { #if PBL_ROUND .get_cell_height = (MenuLayerGetCellHeightCallback) get_cell_height_callback, #endif .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback) get_num_rows_callback, .draw_row = (MenuLayerDrawRowCallback) draw_row_callback, ...
; menu_layer_set_highlight_colors(&data->menu_layer, PBL_IF_COLOR_ELSE(GColorJazzberryJam, GColorBlack), GColorWhite); menu_layer_set_click_config_onto_window(menu_layer, window); layer_add_child(&window->layer, menu_layer_get_layer(menu_layer));...
tate_Idle, SPITransportState_StatusExchange, SPITransportState_WaitingForReceiving, SPITransportState_Receiving, SPITransportState_WaitingForReceiving_Footer, SPITransportState_Receiving_Footer, SPITransportState_WaitingForSending, SPITransportState_Sending, SPITransportState_WaitingForSending_Footer, ...
(InhibitorBluetoothWatchdog)
; } prv_unlock(); } static void prv_trigger_core_dump_from_isr(void) { bool should_context_switch; s_spi_transport.state = SPITransportState_CoreDump; prv_give_semamphore_from_isr(&should_context_switch); } #if !defined(DIALOG_TIMER_IRQ_HANDLER) #error "DIALOG_TIMER_IRQ_HANDLER must be defined in the board_...
/* * 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...
{ jerry_cleanup(); rocky_runtime_context_deinit(); }
void test_rocky_api_console__functions_exist(void) { rocky_global_init(s_api); EXECUTE_SCRIPT( "var c = typeof console;\n" "var cl = typeof console.log;\n" "var cw = typeof console.warn;\n" "var ce = typeof console.error;\n" ); ASSERT_JS_GLOBAL_EQUALS_S("c", "object"); ASSERT_JS_GLOBAL_EQU...
/* * 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_init(dev, true /* is_open_drain */, UARTCR1Flags_Duplex)
; } void uart_init_tx_only(UARTDevice *dev) { prv_init(dev, false /* !is_open_drain */, UARTCR1Flags_TE); } void uart_init_rx_only(UARTDevice *dev) { prv_init(dev, false /* !is_open_drain */, UARTCR1Flags_RE); } void uart_deinit(UARTDevice *dev) { dev->periph->CR1 &= ~USART_CR1_UE; periph_config_disable(dev-...
interpolate_moook_duration()); } animation_set_auto_destroy(animation, false); } animation_schedule(animation); } else { prv_scroll_layer_set_content_offset_internal(scroll_layer, offset); } } void scroll_layer_set_content_size(ScrollLayer *scroll_layer, GSize size) { GRect bounds = scro...
(&scroll_layer->shadow_sublayer)
; } void scroll_layer_set_paging(ScrollLayer *scroll_layer, bool paging_enabled) { PBL_ASSERTN(scroll_layer); if (paging_enabled) { // Deinit shadow_sublayer to enable paging if (!prv_scroll_layer_is_paging_enabled(scroll_layer)) { layer_deinit(&scroll_layer->shadow_sublayer); } // paging an...
ivities_string, NULL, NULL); } static uint16_t prv_get_num_rows_cb(OptionMenu *option_menu, void *context) { SettingsActivityTrackerData *data = context; const uint16_t count = prv_num_rows(data); return count + 1; } static void prv_draw_row_cb(OptionMenu *option_menu, GContext *ctx, const Layer *cell_layer, ...
("Background App")
, .init = prv_init, }; return &s_module_info; }
L, NULL), false); // Store a classic pairing BTDeviceAddress addr = { .octets = { 0x11, 0x22, 0x33, 0x44, 0x55,}, }; char device_name_classic[BT_DEVICE_NAME_BUFFER_SIZE] = "CLASSIC"; SM128BitKey link_key = { .data = { 0x55, }, }; shared_prf_storage_store_bt_classic_pairing_data(&addr, device_name...
(shared_prf_storage_get_root_key(SMRootKeyTypeIdentity, NULL), false)
; SM128BitKey keys[2]; for (int i = 0; i < sizeof(keys); ++i) { ((uint8_t *) keys)[i] = i; } shared_prf_storage_set_root_keys(keys); SM128BitKey keys_out[2]; for (SMRootKeyType key_type = 0; key_type < SMRootKeyTypeNum; ++key_type) { cl_assert_equal_b(shared_prf_storage_get_root_key(key_type, &ke...
AULT_SCROLL_HEIGHT; int32_t offset = 0; for (offset = 0; offset < content_size.h - scroll_bounds.size.h; offset += scroll_height) { // scroll offset for scroll down is negative, so invert offset.y cl_assert_equal_i(offset, -((int32_t)scroll_layer_get_content_offset(scroll_layer).y)); scroll_layer_sc...
(scroll_layer, ScrollDirectionDown, false)
; cl_assert_equal_i(page_height * pages, -scroll_layer_get_content_offset(scroll_layer).y); }
/* * 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_fb, &(GSize) {DISP_COLS, DISP_ROWS})
; framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */); pfs_init(false /* run filesystem check */); pfs_format(true /* write erase headers *...
(session_ref != NULL)
; // ------------------ // Encode the first set of measurements uint32_t values_per_samples = input.msrmt.num_types; bool success; for (unsigned i = 0; i < input.msrmt.num_samples; i++) { rtc_set_time(input.msrmt.time_utc + input.msrmt.offset_sec[i]); success = protobuf_log_session_add_measurements(s...
t_time + (j * SECONDS_PER_MINUTE)) % 255); } // Advance another minute. rtc_set_time(utc_sec + (i * SECONDS_PER_MINUTE)); } } // --------------------------------------------------------------------------------------- // Return the index of the step averages slot that contains the given minute static ui...
prv_feed_cannned_accel_data(180, 100, ActivitySleepStateAwake)
; prv_feed_cannned_accel_data(180, 0, ActivitySleepStateRestfulSleep); prv_feed_cannned_accel_data(180, 0, ActivitySleepStateLightSleep); // Wait long enough for our recompute sleep logic to run. prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * ACTIVITY_SESSION_UPDATE_MIN, 0, Acti...
er_set_background_color(msg_text_layer, GColorBlack); text_layer_set_text_color(msg_text_layer, GColorWhite); text_layer_set_font(msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); layer_add_child(&window->layer, &msg_text_layer->layer); msg_text_layer = &data->msg_text_layer[1]; text_layer_ini...
system_task_add_callback(run_test, NULL)
; } } static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler)up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler)down_click_handler); window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler)select_click_handler); } static v...
applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "launc...
(weather_type)
; if (weather_glance->icon_resource_id != new_weather_icon_resource_id) { kino_reel_destroy(weather_glance->icon); weather_glance->icon = kino_reel_create_with_resource(new_weather_icon_resource_id); weather_glance->icon_resource_id = new_weather_icon_resource_id; } // Zero out the glance's title buf...
pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // SW = 5 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_C...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_clip_rect_nudge.${BIT_DEPTH_NAME}.pbi")
); } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__clipping_rect_aa(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, true, 1); graphics_context_set_stroke_color(&ctx, GColorBlack); // Draw rectangles around boundaries of clippin...
")", entry->key, (int32_t)rv); } settings_file_close(&file); } } mutex_unlock(s_mutex); return (rv == S_SUCCESS); } // ------------------------------------------------------------------------------------ // Convenience function used to update the state AND set the backing for a pref. This is // ...
prefs_private_write_backing(event->key, event->key_len, entry->value, entry->value_len)
t least a little bit larger than the // max_used_space allows us to avoid thrashing. Without it, if // max_space_total == max_used_space, then if the file is full, changing a // single value would force the whole file to be rewritten- every single // time! It's probably worth it to "waste" a bit of flash space ...
{ hdr->flags &= ~flags; }
static void clear_flag(SettingsRecordHeader *hdr, uint8_t flags) { hdr->flags |= flags; } static bool flag_is_set(SettingsRecordHeader *hdr, uint8_t flags) { return (hdr->flags & flags) == 0; } // Records have 4 possible states: // - EOF marker: Header is all 1s // - partially_written: Some bits in the header hav...
G_TOP, BOD_STATUS_REG, BOD_VDD_LOW, 0x0); REG_SETF(CRG_TOP, FORCE_SLEEP_REG, FORCE_BLE_SLEEP, 0x0); // GUESS REG_SETF(CRG_TOP, FORCE_SLEEP_REG, FORCE_FTDF_SLEEP, 0x0); // GUESS REG_SETF(CRG_TOP, LDOS_DISABLE_REG, LDOS_DISABLE, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_REG, OSC16_HOLD_AMP_REG, 0x0); // GUESS...
REG_SETF(QSPIC, QSPIC_STATUSCMD_REG, QSPIC_RSTAT_RX_MD, 0x0)
; REG_SETF(QSPIC, QSPIC_STATUSCMD_REG, QSPIC_RSTAT_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_STATUSCMD_REG, QSPIC_RSTAT_INST, 0x0); REG_SETF(QSPIC, QSPIC_CHCKERASE_REG, QSPIC_CHCKERASE, 0x0); REG_SETF(QSPIC, QSPIC_GP_REG, QSPIC_PADS_SLEW, 0x0); REG_SETF(QSPIC, QSPIC_GP_REG, QSPIC_PADS_DRV, 0x0); REG_SETF(QSPIC,...
lock if (fd != GC_FD_HANDLE_ID) { FileDesc *file_desc = &PFS_FD(fd); uint8_t curr_status = file_desc->fd_status; file_desc->fd_status = FD_STATUS_IN_USE; mutex_unlock_recursive(s_pfs_mutex); pfs_prepare_for_file_creation(start_size, 0 /* no timeout */); mutex_lock_recursive(s_pfs_mutex); ...
file_found_or_added_to_pfs(fd, GC_FILE_NAME, file->op_flags, FILE_TYPE_STATIC, space_needed)
; PBL_ASSERTN(!create || res >= 0); // we are toast if we cannot create the file return (res >= 0) ? fd : res; } static status_t copy_or_recover_gc_data(int fd, GCData *gcdata, bool do_copy) { ////// // // GC File Format // // GCData // Page 0 Header | Data Len | Data // ... // Page N Header | Dat...
prv_handle_sending_footer_complete_isr); } static void prv_handle_int_waiting_for_sending(void) { s_spi_transport.state = SPITransportState_Sending; dialog_spi_send_and_receive_dma(s_spi_transport.tx_read_ptr, NULL, s_spi_transport.bytes_sendable_count, ...
prv_watchdog_start()
ke width is zero and the // fill is transparent GColor color = gdraw_command_get_fill_color(command); color.a = 0; gdraw_command_set_fill_color(command, color); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8); cl_assert_equal_i(s_fill_color.argb, GColorClearARGB...
(sizeof(GDrawCommand) + (sizeof(GPoint) * 3 ))
; *command = (GDrawCommand){ .type = GDrawCommandTypePrecisePath, .hidden = false, .stroke_color = GColorRed, .stroke_width = 1, .fill_color = GColorBlue, .path_open = false, .num_points = 3, }; GPointPrecise points[] = { { .x.raw_value = 8, .y.raw_value = 17 }, { .x.raw_value...
); peek_layer_set_frame(peek_layer, &frame); peek_layer_set_background_color(peek_layer, GColorClear); layer_add_child(&window->layer, &peek_layer->layer); } static void prv_timeline_window_load(Window *window) { TimelineLayer *timeline_layer = &s_app_data->timeline_layer; TimelineScrollDirection scroll_dire...
(layer_in, (AnimationHandlers) { .stopped = prv_back_from_card_stopped, }, data)
; data->current_animation = layer_in; animation_schedule(layer_in); // animate the card layout timeline_pin_window_pop(&data->pin_window); return layer_in; } ///////////////////////////////////// // App boilerplate ///////////////////////////////////// static bool NOINLINE prv_setup_timeline_app(void) { ...
art_of_today(); value = health_service_sum_averaged(HealthMetricStepCount, start_of_today, start_of_today + (9 * SECONDS_PER_HOUR), HealthServiceTimeScopeDaily); cl_assert_equal_i(value, exp_value); } void test_heal...
rtc_get_time()
; const time_t yeserday_utc = now - SECONDS_PER_DAY; struct tm local_tm; localtime_r(&now, &local_tm); DayInWeek todays_day_in_week = local_tm.tm_wday; localtime_r(&yeserday_utc, &local_tm); DayInWeek yesterday_day_in_week = local_tm.tm_wday; bool yesterday_was_weekend = (yesterday_day_in_week == Sunday...
tings has to be at the beginning. The app_menu_data_source module enforces it static const AppInstallId app_default_order[] = {APP_ID_SETTINGS, APP_ID_MUSIC, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, AP...
prv_shuffle(watchface_order, num_entries)
; prv_test_new_order_with_filter_callback(watchface_order, num_entries, watchface_filter_callback); } } void test_app_menu_data_source__last_app_not_in_order_file(void) { // settings has to be at the beginning. The app_menu_data_source module enforces it AppInstall...