prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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_ctx, fb)
; framebuffer_clear(fb); load_system_resources_fixture(); } void test_selection_windows__cleanup(void) { free(fb); if (s_dest_bitmap) { gbitmap_destroy(s_dest_bitmap); } s_dest_bitmap = NULL; } // Helpers ////////////////////// #define GRID_CELL_PADDING 5 typedef void (*RenderCallback)(GContext *c...
in future, store frames and config values as well if (transition->create_animation) { context->animation = transition->create_animation(context); } // If we haven't set an animation, either because create_animation() was NULL or it returned // NULL, use g_window_transition_none_implementation if (!contex...
(window_from, window, transition_insert)
; } PBL_LOG(LOG_LEVEL_DEBUG, "(+) %s=%p <%s>", is_app_window ? "window" : "modal window", window, window_get_debug_name(window)); } static Window *prv_remove_item(WindowStackItem *pop_item, const WindowTransitionImplementation *transition) { PBL_ASSERTN(pop_item->window); ...
timers /* &head */, NULL /* &tail */); manager->idle_timers = list_insert_before(manager->idle_timers, &timer->list_node); } // Clear the repeating flag so that if they call this method from a callback it won't get // rescheduled. timer->repeating = false; timer->expire_time = 0; mutex_unlock(manager-...
{ // The next timer hasn't expired yet. Update ticks_to_wait = next_expiry_time - current_time; }
} else { // No timers running ticks_to_wait = portMAX_DELAY; } mutex_unlock(manager->mutex); if (ticks_to_wait) { return ticks_to_wait; } // Run the timer callback now manager->current_cb = next_timer->cb_data; next_timer->cb(next_timer->cb_data); manager->curre...
power, false); gpio_release(BOARD_CONFIG.mic_config.mic_gpio_power.gpio); } } static void prv_i2s_gpio_init(void) { // Enable the SPI clock periph_config_acquire_lock(); // [AS] TODO: If I2S is moved to SPI1, this RCC function needs to be abstracted to board.h PBL_ASSERTN(BOARD_CONFIG.mic_config.spi_cl...
(&s_pdm_filter)
; periph_config_disable(CRC, RCC_AHB1Periph_CRC); //Enable I2S PLL RCC_PLLI2SCmd(ENABLE); while (RCC_GetFlagStatus(RCC_FLAG_PLLI2SRDY) == RESET) {} // Enable I2S clock periph_config_acquire_lock(); periph_config_enable(BOARD_CONFIG.mic_config.spi, BOARD_CONFIG.mic_config.spi_clock_ctrl); periph_config...
s_inbox_for_tag(AppInboxServiceTag tag); extern bool app_inbox_service_has_inbox_for_storage(uint8_t *storage); extern bool app_inbox_service_is_being_written_for_tag(AppInboxServiceTag tag); extern size_t app_inbox_service_num_failed_for_tag(AppInboxServiceTag tag); extern size_t app_inbox_service_num_success_for_tag(...
cl_assert(false)
; } void test_alt_dropped_handler(uint32_t num_dropped_messages) { cl_assert(false); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Tests void test_app_inbox__initialize(void) { fake_kernel_malloc_init(); fake_kernel_malloc_enable_stats(true); stub_p...
yer *layer, const GRect *frame) { *layer = (Layer){}; layer->frame = *frame; layer->bounds = (GRect){{0, 0}, frame->size}; layer->clips = true; } Layer* layer_create(GRect frame) { Layer* layer = applib_type_malloc(Layer); if (layer) { layer_init(layer, &frame); } return layer; } Layer* layer_crea...
{ stack = app_state_get_layer_tree_stack(); }
else { stack = kernel_applib_get_layer_tree_stack(); } stack[0] = node; while (node) { bool descend = false; if (node->hidden) { goto node_hidden_do_not_descend; } // prepare draw_state for the current layer // it will not be stored and restored but recalculated from the root /...
return false; } static bool check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool check_for_fw_start_failure() { // Add more failure conditions here. if (!watchdog_check_reset_flag() && !boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { // We're ...
("\\__ \\| || || / /")
; dbgserial_putstr("<___/|_||_||_\\_\\"); dbgserial_putstr(""); // PMIC requires I2C i2c_init(); dbgserial_putstr("i2c inited"); pmic_init(); dbgserial_putstr("pmic inited"); boot_bit_init(); dbgserial_putstr("boot bit"); boot_version_write(); // Write the bootloader version to serial-out...
ffer = (uint8_t*)upng_get_buffer(upng); uint32_t bpp = upng_get_bpp(upng); uint16_t palette_size = 0; if (!gbitmap_png_is_format_supported(upng)) { APP_LOG(APP_LOG_LEVEL_ERROR, PNG_FORMAT_ERROR); goto cleanup; } // Create a color palette in GColor8 format from RGB24 + ALPHA8 PNG Palettes (or Graysca...
( rgb_palette[i].r, rgb_palette[i].g, rgb_palette[i].b, // RGB (i < alpha_palette_entries) ? alpha_palette[i] : UINT8_MAX)
; // Conditional A value } // Return the converted palette and number of entries *palette_out = palette; return palette_entries; } uint16_t gbitmap_png_load_palette(upng_t *upng, GColor8 **palette_out) { if (upng) { upng_format png_format = upng_get_format(upng); // Create a color palette in RGBA8 f...
04, -480}, { -232, 632, -416}, { -240, 720, -456}, { -232, 640, -560}, { -176, 656, -552}, { -304, 784, -384}, { -320, 952, -320}, { -264, 1072, -280}, { -248, 920, -248}, { -248, 976, -184}, { -208, 808, -112}, { -224, 912, -144}, { -184, 864, -136}, { -216, 800, -13...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-05 20:46:28 local AccelRawData *activity_sample_non_walk_pbl_25664_14(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME non_walk_pbl_25664_14 //> TE...
- (2 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 2 MIN", time_buf); // June 10th 2015, 04:00:00 (T+12:00:00) rtc_set_time(event_time + (12 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(tim...
(event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR))
/* * 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...
(size, GBITMAP_NATIVE_FORMAT)
; memset(s_pixels->addr, 0xff, size.h * s_pixels->row_size_bytes); s_context.dest_bitmap = *s_pixels; s_context.draw_state.clip_box = (GRect){.size = size}; s_context.draw_state.drawing_box = s_context.draw_state.clip_box; s_app_state_get_graphics_context = &s_context; } void test_rocky_api_graphics_renderin...
current_rtc_ticks, time_t_to_string(time), time); //itoa(time, buffer, sizeof(buffer)); //dbgserial_putstr(buffer); //dbgserial_putstr("Done"); } static void save_rtc_time_state(RtcIntervalTicks current_rtc_ticks) { // Floor it to the latest second const RtcIntervalTicks current_rtc_ticks_at_second = (curre...
(RTC_IT_ALRA, DISABLE)
; RTC_AlarmCmd(RTC_Alarm_A, DISABLE); RTC_ClearITPendingBit(RTC_IT_ALRA); exti_configure_other(ExtiLineOther_RTCAlarm, ExtiTrigger_Rising); exti_enable_other(ExtiLineOther_RTCAlarm); s_tick_alarm_initialized = true; } void rtc_alarm_set(RtcTicks num_ticks) { PBL_ASSERTN(s_tick_alarm_initialized); RTC...
lude "services/common/analytics/analytics.h" #include "system/logging.h" #include "system/reboot_reason.h" static void log_reboot_reason_cb(void *reason) { AnalyticsEventCrash *crash_report = (AnalyticsEventCrash *)reason; analytics_event_crash(crash_report->crash_code, crash_report->link_register); kernel_free(...
(LOG_LEVEL_INFO, "Stuck callback: 0x%" PRIx32, reason.watchdog.stuck_task_callback)
; } } break; case RebootReasonCode_StackOverflow: show_reset_alert = true; PebbleTask task = (PebbleTask) reason.data8[0]; DEBUG_LOG(LOG_LEVEL_INFO, "%s%sStackOverflow: Task #%d (%s)", restarted_safely_string, rebooted_due_to, task, pebble_task_get_name(task)); break; cas...
} if (it->should_continue == false) { return; } } // for() sections } static void prv_menu_layer_walk_upward_from_iterator(MenuIterator *it) { it->should_continue = true; for (;;) { // sections for (;;) { // rows // Previous row if (it->cursor.index.row == 0) { // Reache...
prv_draw_background(menu_layer, ctx, &menu_layer->scroll_layer.layer, false)
; } MenuRenderIterator *render_iter = applib_type_malloc(MenuRenderIterator); PBL_ASSERTN(render_iter); if (menu_layer->center_focused) { // in this mode, the selected row is always the best candidate for the cache menu_layer->cache.cursor = menu_layer->selection; } *render_iter = (MenuRenderIter...
/* * 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 (iter > iter_end) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid music message"); return NULL; }
return iter; } static void prv_update_now_playing_info(CommSession *session, const uint8_t* msg, size_t length) { // Read all the lengths from the message so we know how to break it up. const uint8_t* read_iter = msg; const char* artist_ptr; size_t artist_length; read_iter = prv_read_ptr_and_length_from_...
al.h" #include "stubs_system_reset.h" #include "stubs_task_watchdog.h" #include "stubs_app_state.h" #include "stubs_worker_state.h" // Overrides ////////////////////////////////////////////////////////// void sys_get_time_ms(time_t *t, uint16_t *out_ms) {} time_t sys_time_utc_to_local(time_t t) { return t; } int l...
cl_assert_equal_s(str, fp_msg)
; pbl_snprintf(str, STR_SIZE, "abc %jd%s", 42, "b"); cl_assert_equal_s(str, "abc 42b"); //---------------------------------------------------- pbl_snprintf(str, STR_SIZE, "abc %A%s", "a", 1.0, "b"); cl_assert_equal_s(str, fp_msg); pbl_snprintf(str, STR_SIZE, "abc %zd%s", 42, "b"); cl_assert_equal_s(str, ...
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 express or implied. * See the License for the specific language governing permissions an...
{ if (out_len) { *out_len = TINTIN_BUILD_ID.data_length; } return &TINTIN_BUILD_ID.data[TINTIN_BUILD_ID.name_length]; }
prv_find_property_animation(property_animation_h)
; if (!property_animation) { return; } GTransform result; result.a = interpolate_fixed32( distance_normalized, property_animation->values.from.gtransform.a, property_animation->values.to.gtransform.a); result.b = interpolate_fixed32( distance_normalized, property_animation->...
nse. * 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 express or implied. ...
(animation2, AnimationCurveLinear)
; animation_set_handlers(animation2, (AnimationHandlers) { .stopped = prv_animation_stopped_success, }, data); Animation *animation = animation_sequence_create(animation1, animation2, NULL); data->result_animation = animation; animation_schedule(animation); #else // Don't animate to a dot on old platf...
layer_set_update_proc(&layer, &outside_y_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_y_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_...
License. */ #include "clar.h" #include "services/normal/activity/activity.h" #include "services/normal/activity/activity_private.h" #include "services/normal/activity/activity_calculators.h" #include "util/units.h" #include <stdint.h> // Fakes static uint8_t s_age_years; uint8_t activity_prefs_get_age_years(void...
activity_private_compute_distance_mm(steps, time_ms)
/ MM_PER_METER; cl_assert_within(fast_run_distance_m, 6500, 7000); cl_assert_gt(fast_run_distance_m, normal_run_distance_m); // Run for 3.5 hours. This is a reasonable marathon time const int long_run_time = 3 * MINUTES_PER_HOUR + 30; steps = running_cadence_spm * long_run_time; time_ms = long_run_time * ...
ET, 0x0); // GUESS REG_SETF(CRG_TOP, AON_SPARE_REG, EN_BUSSYS_RET, 0x0); // GUESS // QSPIC REG_SETF(QSPIC, QSPIC_CTRLBUS_REG, QSPIC_DIS_CS, 0x0); REG_SETF(QSPIC, QSPIC_CTRLBUS_REG, QSPIC_EN_CS, 0x0); REG_SETF(QSPIC, QSPIC_CTRLBUS_REG, QSPIC_SET_QUAD, 0x0); REG_SETF(QSPIC, QSPIC_CTRLBUS_REG, QSPIC_SET_DUAL...
(GPREG, PLL_SYS_CTRL1_REG, PLL_R_DIV, 0x1)
; REG_SETF(GPREG, PLL_SYS_CTRL1_REG, LDO_PLL_VREF_HOLD, 0x0); REG_SETF(GPREG, PLL_SYS_CTRL1_REG, LDO_PLL_ENABLE, 0x0); REG_SETF(GPREG, PLL_SYS_CTRL1_REG, PLL_EN, 0x0); REG_SETF(GPREG, PLL_SYS_CTRL2_REG, PLL_SEL_MIN_CUR_INT, 0x0); REG_SETF(GPREG, PLL_SYS_CTRL2_REG, PLL_DEL_SEL, 0x2); REG_SETF(GPREG, PLL_SYS...
-400, 880, 224}, { -392, 872, 224}, { -400, 872, 232}, { -400, 872, 224}, { -392, 864, 232}, { -392, 872, 232}, { -400, 856, 232}, { -416, 848, 232}, { -416, 856, 248}, { -408, 872, 240}, { -400, 864, 248}, { -384, 864, 248}, { -400, 840, 248}, { -408, 864, 240}, ...
{ -376, 888, 240}, { -376, 904, 264}, { -376, 896, 264}, { -376, 888, 256}, { -368, 864, 248}, { -368, 856, 264}, { -376, 856, 264}, { -360, 864, 272}, { -368, 888, 272}, // 168 seconds { -376, 872, 256}, { -376, 848, 272}, { -392, 864, 288}, { -392, 880, 264}, ...
{ -344, 896, 184}, { -344, 864, 184}, { -360, 888, 192}, { -360, 888, 208}, { -376, 880, 216}, { -376, 888, 232}, { -384, 880, 240}, { -384, 888, 232}, { -384, 888, 232}, { -384, 880, 240}, { -376, 880, 232}, { -368, 880, 232}, { -376, 896, 224}, { -376, 856, 200...
== true); // Timer will go off at 00:00 on Saturday. (0.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND); rtc_set_time(s_saturday_00_00); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == true); // Timer will go off ...
do_not_disturb_toggle_manually_enabled(ManualDNDFirstUseSourceActionMenu)
; enabled = do_not_disturb_is_manually_enabled(); cl_assert(enabled == false); active = do_not_disturb_is_active(); cl_assert(active == false); }
animation_get_elapsed(b, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a + duration_a + delay_b)); // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started...
(prv_count_handler_entries(&s_started_handler_calls, a), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);...
024); cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand); cl_assert_equal_i(s_command_list[1].addr, 2 * 64 * 1024); cl_assert_equal_i(s_command_list[1].type, SectorEraseCommand); } void test_flash_region__erase_optimal_range_subsectors(void) { // Offer a less than full sector range but erase the fu...
(s_command_list[2].type, SubsectorEraseCommand)
; cl_assert_equal_i(s_command_list[3].addr, 44 * 1024); cl_assert_equal_i(s_command_list[3].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[4].addr, 48 * 1024); cl_assert_equal_i(s_command_list[4].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[5].addr, 52 * 1024); cl_assert...
Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed un...
alerts_should_notify_for_type(AlertReminder)
z_dotted_line_even_offset_odd_rows_no_clip"))); // Test to make sure drawing on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1)
; for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_checkerboard_no_clip"))); // Clipping on even boundaries - no offset se...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(num.raw_value == test_num)
; cl_assert((FIXED_S16_3_ONE.raw_value == test_num)); cl_assert(memcmp(&num, &test_num, sizeof(Fixed_S16_3)) == 0); num = (Fixed_S16_3){ .raw_value = (int16_t)((float)3.5 * (1 << FIXED_S16_3_PRECISION)) }; test_num = (int16_t)((float)3.5 * (1 << FIXED_S16_3_PRECISION)); cl_assert(memcmp(&num, &test_num, size...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ rot_bitmap_set_compositing_mode(&pair->white_layer, GCompOpOr); rot_bitmap_set_compositing_mode(&pair->black_layer, GCompOpClear); }
void rotbmp_pair_layer_init(RotBmpPairLayer *pair, GBitmap *white, GBitmap *black) { if (white->bounds.size.w != black->bounds.size.w && white->bounds.size.h != black->bounds.size.h) { PBL_LOG(LOG_LEVEL_ERROR, "rotbmp_pair inited with unmatching bitmaps"); return; } rot_bitmap_layer_init(&pair->w...
BUTTON_REGISTER, updated_button_counter_register); } } __enable_irq(); } void debounced_button_init(void) { button_init(); #if defined(BOARD_SNOWY_BB2) || defined(BOARD_SPALDING_BB2) // Snowy BB2s have a capacitor that results in a really slow rise time (~0.4ms). Sleep for // at least 1 ms to prevent f...
TIM_ClearITPendingBit(TIM4, TIM_IT_Update)
; portEND_SWITCHING_ISR(should_context_switch); } // Serial commands /////////////////////////////////////////////////////////// void command_put_raw_button_event(const char* button_index, const char* is_button_down_event) { PebbleEvent e; int is_down = atoi(is_button_down_event); int button = atoi(button_ind...
= app_state_get_ble_app_state(); prv_consume_notifications(e, ble_app_state->gatt_characteristic_read_handler); } static void prv_handle_characteristic_read(const PebbleBLEGATTClientEvent *e) { BLEAppState *ble_app_state = app_state_get_ble_app_state(); prv_consume_read_response(e, ble_app_state->gatt_characteri...
(handler, offset)
; } BTErrno ble_client_set_read_handler(BLEClientReadHandler handler) { const off_t offset = offsetof(BLEAppState, gatt_characteristic_read_handler); return prv_set_handler(handler, offset); } BTErrno ble_client_set_write_response_handler(BLEClientWriteHandler handler) { const off_t offset = offsetof(BLEAppStat...
icons[index]; // is_highlighted will cause the icon in the action bar to render normal or inverted: action_bar_legacy2_set_highlighted(action_bar, index, is_highlighted); if (icon == NULL) { return; } else { layer_mark_dirty(&action_bar->layer); } } static void action_bar_legacy2_raw_up_handler(Clic...
{ GColor native_background_color = get_native_color(background_color); if (gcolor_equal(native_background_color, get_native_color(action_bar->background_color))) { return; } action_bar->background_color = get_closest_gcolor2(native_background_color); layer_mark_dirty(&(action_bar->layer)); }
break; case AttributeTypeUint32List: size += Uint32ListSize(attr_list->attributes[i].uint32_list->num_values); break; default: break; } } return size; } size_t attribute_list_serialize(const AttributeList *attr_list, uint8_t *buffer, uint8_t *buf_end) { PBL_...
{ // don't need to deep copy non-strings break; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&pin_window->status_layer)
smit attempts."); prv_bounce_ncp_state(); } } static void prv_start_retransmit_timer(uint8_t sequence_number) { pulse2_reliable_retransmit_timer_start( RETRANSMIT_TIMEOUT_MS, sequence_number); } static void prv_assert_reliable_buffer(void *buf) { PBL_ASSERT(buf == &s_tx_buffer->information[0], ...
{ ppp_control_protocol_lower_layer_is_down(PULSE2_TRAINCP); ppp_control_protocol_lower_layer_is_up(PULSE2_TRAINCP); }
#endif
ive = false; s_low_power_active = false; alerts_set_mask(AlertMaskAllOn); } void test_alerts__cleanup(void) { } // Tests ///////////////////////////////// void test_alerts__enabled(void) { alerts_set_mask(AlertMaskAllOn); cl_assert(alerts_get_mask() == AlertMaskAllOn); // Should allow all notifications to...
(AlertPhoneCall)
); cl_assert(alerts_should_vibrate_for_type(AlertPhoneCall)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(alerts_should_enable_backlight_for_type(AlertPhoneCall)); cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert...
interpolate); const int32_t translate = interpolate(normalized, from_min, to_min); return scale + translate; } GPoint gpoint_scale_to(GPoint point, GSize size, GRect from, GRect to, int32_t normalized, InterpolateInt64Function interpolate) { return GPoint( prv...
( &image->command_list, image->size, from, to, normalized, interpolate, lookup, duration_fraction, is_offset)
(0), GPoint(20, 20)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_bw_0.Xbit.pbi")); // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_bw, ...
(&ctx, &GRect(0, 0, 20, 10))
/* * 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...
MAX(num_bits - 24, 0)
; RCC_ClocksTypeDef clocks; RCC_GetClocksFreq(&clocks); uint32_t prescaler = clocks.PCLK2_Frequency / this->pdm_frequency; // Disable the device before changing the config DFSDM_Cmd(DISABLE); DFSDM_ChannelCmd(this->channel, DISABLE); DFSDM_FilterCmd(this->filter, DISABLE); DFSDM_TransceiverInitTypeDe...
/* * 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; }
void bt_driver_hrm_service_handle_measurement(const BleHrmServiceMeasurement *measurement, const BTDeviceInternal *permitted_devices, size_t num_permitted_devices) { }
_manually_enabled(false); active = do_not_disturb_is_active(); cl_assert(active == false); } void test_do_not_disturb__is_active(void) { // Time 00:00, Manual and Scheduled DND both OFF bool active; // !Manual && !Scheduled && !Smart cl_assert(do_not_disturb_is_manually_enabled() == false); cl_assert(do...
cl_assert(do_not_disturb_is_manually_enabled() == true)
; cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true); active = do_not_disturb_is_active(); cl_assert(active == true); // Both OFF do_not_disturb_set_manually_enabled(false); // turned Manual OFF, scheduled should be overriden cl_assert(do_not_disturb_is_manually_enabled() == false); cl_...
/* * 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->scroll_layer, text_layer_get_layer(&data->text_layer_1))
; text_layer_enable_screen_text_flow_and_paging(&data->text_layer_1, inset); const GSize max_size_1 = text_layer_get_content_size(app_state_get_graphics_context(), &data->text_layer_1); text_layer_set_size(&data->text_layer_1, GSize(scroll_bounds.size.w, max_size_1.h + padding)); // Initialize the second...
ributes_actions_get_required_buffer_size(num_attributes, num_actions, attributes_per_action, string_alloc_size); PebbleSysNotificationActionResult *action_result = ker...
prv_action_result_create_from_serial_data( header, msg->num_attributes, 0, msg->data, length - sizeof(PhoneResponseMsg))
; } else { PhoneActionResponseMsg *msg = (PhoneActionResponseMsg *)data; action_result = prv_action_result_create_from_serial_data( header, msg->num_attributes, msg->num_actions, msg->data, (length - sizeof(PhoneActionResponseMsg))); } if (action_result) { // callee will free memory ...
data.num_samples) { HRMAccelData *d = &hrm->debug->accel_data; dict_write_data(app_data->out_iter, AppMessageKey_AccelData, (uint8_t *)d->data, d->num_samples * sizeof(d->data[0])); } PBL_LOG(LOG_LEVEL_DEBUG, "Sending message - bpm:%u quality:%u current...
(FONT_KEY_GOTHIC_18)
); text_layer_set_text_alignment(quality_tl, GTextAlignmentCenter); text_layer_set_text(quality_tl, "Loading..."); layer_add_child(&window->layer, &quality_tl->layer); const uint32_t inbox_size = 64; const uint32_t outbox_size = 256; AppMessageResult result = app_message_open(inbox_size, outbox_size); if...
umnData *columns, unsigned int num_columns, bool is_legacy2) { gbitmap_destroy(s_dest_bitmap); const unsigned int num_row_heights = ARRAY_LENGTH(s_menu_system_cell_test_row_heights); const unsigned int num_rows = ARRAY_LENGTH(s_menu_system_cell_test_row_data); // Multi...
( MenuCellType_CellLayer, cell_width, s_menu_system_cell_layer_test_column_data, ARRAY_LENGTH(s_menu_system_cell_layer_test_column_data), /* is_legacy2 */ false)
; cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); #endif } void test_menu_layer_system_cells__cell_width_100(void) { const int16_t cell_width = 100; prv_prepare_canvas_and_render_cells( MenuCellType_CellLayer, cell_width, s_menu_system_cell_layer_test_column_data, ARRAY_LENGTH(s_menu_sy...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(music_get_playback_state(), 0x01)
; uint32_t track_position, track_duration; music_get_pos(&track_position, &track_duration); cl_assert_equal_i(track_position, 0xAA); cl_assert_equal_i(music_get_playback_rate_percent(), 0xAA); } else { cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT); } } static void prv_receive_and_assert_volume_...
(&data->day_picker_menu_layer)
); if (!alarm_get_kind(data->alarm_id, &data->alarm_kind)) { data->alarm_kind = ALARM_KIND_JUST_ONCE; } menu_layer_set_selected_index(&data->day_picker_menu_layer, (MenuIndex) { 0, prv_alarm_kind_to_index(data->alarm_kind) }, MenuRowAlignCenter, ...
986, 404, -111}, { 988, 310, 45}, { 844, 187, 75}, { 754, 172, 40}, { 730, 244, 57}, { 782, 300, 32}, { 832, 325, -4}, { 803, 317, -74}, { 863, 321, -86}, { 1162, 361, -71}, { 1345, 414, -57}, { 1161, 410, -56}, { 1310, 510, -50}, { 1414, 577, 0}, { 1260, 446, 77}...
{ 850, 337, -53}, { 966, 373, -39}, { 1154, 410, -53}, { 1236, 450, -4}, { 1258, 606, -4}, { 1102, 432, 136}, { 1169, 443, 62}, { 1139, 424, 104}, { 1106, 429, 141}, { 927, 277, 178}, { 853, 206, 206}, { 865, 159, 231}, { 922, 173, 240}, { 823, 187, 210}, { 84...
{ 901, 168, 212}, { 1145, 159, 255}, { 1114, 193, 186}, { 1181, 250, 112}, { 1568, 297, 146}, { 1046, 356, -93}, { 991, 408, -139}, { 984, 286, 65}, { 928, 217, 97}, { 808, 191, 82}, { 743, 262, 79}, { 762, 311, 61}, { 797, 352, 9}, { 778, 316, -30}, { 837, 3...
ctx, GAlignRight); } if ((data->state == DisplayCalibrationState_Y_Adjust) || (data->state == DisplayCalibrationState_Confirm)) { prv_draw_border_stripe(layer, ctx, GAlignTop); prv_draw_border_stripe(layer, ctx, GAlignBottom); } } static void prv_draw_arrow(Layer *layer, GContext *ctx, GBitmap *arr...
(&data->arrow_right)
; // reinitialize display offset now that values may have changed shell_prefs_display_offset_init(); layer_deinit(&data->layer); i18n_free_all(data); task_free(data); } static void prv_init_arrow_bitmap(GBitmap *bitmap, uint32_t resource_id) { gbitmap_init_with_resource(bitmap, resource_id); // tint c...
312, -48}, { 1032, 304, 88}, { 1616, 456, 8}, { 1376, 432, 168}, { 1184, 296, 200}, { 1080, 208, 200}, { 1000, 216, 184}, { 832, 184, 192}, { 760, 136, 168}, { 848, 112, 176}, { 800, 56, 264}, { 880, 48, 248}, { 968, 40, 280}, { 896, 88, 248}, { 1120, 120, 200}, ...
{ 864, 168, 40}, { 768, 16, 0}, { 752, 80, -16}, { 792, 168, -24}, { 880, 208, -24}, { 864, 208, -8}, { 1016, 216, 8}, { 1080, 224, 40}, { 1184, 248, 96}, { 1144, 312, 80}, { 1080, 352, 96}, { 848, 360, 56}, { 856, 328, 56}, { 928, 288, 112}, { 848, 200, 160},...
{ 1104, 88, 208}, { 792, 160, 32}, { 824, 264, -112}, { 848, 216, -32}, { 888, 200, 64}, { 832, 160, 24}, { 800, 184, -16}, { 856, 248, 8}, { 912, 304, -40}, { 952, 352, -48}, { 1080, 384, -72}, { 1040, 392, -72}, { 1080, 328, 24}, { 1240, 408, 0}, { 1072, 37...
onding = (BleBonding){}; bt_persistent_storage_assign_sm_pairing_info(&bonding->pairing_info, &stored_data->ble_data.pairing_info); bonding->is_gateway = stored_data->ble_data.is_gateway; } static void prv_remove_ble_bonding_from_bt_driver(const BtPersistBondingData *...
{ itr_data->irk_out = stored_data.ble_data.pairing_info.irk; strncpy(itr_data->name_out, stored_data.ble_data.name, BT_DEVICE_NAME_BUFFER_SIZE); itr_data->found = true; return false; // stop iterating }
unt s_data.metric_history[ActivityMetricStepCount][0] = 500; activity_insights_process_minute_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 0); } // --------------------------------------------------------------------------------------- void test_activity_insights__sleep_summary(void) { // Use rea...
activity_insights_process_sleep_data(rtc_get_time())
; cl_assert_equal_i(s_data.pins_added, 0); // Make sure pin is pushed once we have slept some prv_add_sleep_session(0, 7); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 1); } // -------------------------------------------------------------------------------------...
cific language governing permissions and * limitations under the License. */ #include "menu_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...
menu_layer_deinit(&data->menu_layer)
oth_edges_in_same_block) { left_edge_block = (0xffffffff << left_edge_bits_count); right_edge_block = right_edge_bits_count ? (0xffffffff >> (32 - right_edge_bits_count)) : 0; mask = (left_edge_block & right_edge_block); *(block) = (*(block) & ~mask) | (pattern & mask); } else { if (left_edge_bits...
(x, data_row_info.min_x, data_row_info.max_x)
) { graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, color, x, (uint8_t)(FIXED_S16_3_ONE.raw_value - y1.fraction)); } y1.integer++; data_row_info = gbitmap_get_data_row_info(framebuffer, y1.integer); output = (GColor8 *)(data_row_i...
raphCard *graph_card, GContext *ctx) { const GRect *bounds = &graph_card->layer.bounds; graphics_context_set_text_color(ctx, GColorBlack); const int title_height = 60; GRect drawing_box = GRect(0, 0, bounds->size.w, title_height); #if PBL_ROUND // inset the drawing bounds if on round to account for the bezel...
if (wide_bar) { prv_draw_day_bar_wide(ctx, box, &box_inset, bar_color); } else { prv_draw_day_bar_thin(ctx, box, weekday, bar_color); }
// The borders of the boxes caused by the inset need to overlap each other return box->origin.x + box->size.w - bar_inset; } static bool prv_bar_should_be_wide(int draw_weekday, int current_weekday) { // The graph begins on Monday, so all bars from Monday until current (inclusive) should be wide return (posit...
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 IS...
{ // Since we only have one slot, this means we are about to delete what was // already there so handle the deletion if a valid pairing was stored prv_call_ble_bonding_change_handlers(BLE_BONDING_ID, BtPersistBondingOpWillDelete); }
} BtPersistBondingOp pairing_op = is_updating_existing ? BtPersistBondingOpDidChange : BtPersistBondingOpDidAdd; return (prv_bt_persistent_storage_store_ble_pairing(new_pairing_info, is_gateway, requires_address_pinning, ...
gnizers_active; } ctx = { .triggered = r2, .recognizers_active = false }; cl_assert(prv_fail_recognizer(r2, &ctx)); cl_assert_equal_i(r2->state, RecognizerState_Started); cl_assert(!ctx.recognizers_active); ctx.recognizers_active = false; r1->state = RecognizerState_Possible; cl_assert(prv_fail_recogniz...
(recognizers[3]->state, RecognizerState_Failed)
} r = strftime(buf, buf_size, "%I", &good_data); if (r == 0 || strncmp(buf, "11", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"I\": %s", buf); } r = strftime(buf, buf_size, "%j", &good_data); if (r == 0 || strncmp(buf, "125", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error wi...
strftime(buf, buf_size, "%g", &bad_data)
; strftime(buf, buf_size, "%G", &bad_data); strftime(buf, buf_size, "%h", &bad_data); strftime(buf, buf_size, "%H", &bad_data); strftime(buf, buf_size, "%I", &bad_data); strftime(buf, buf_size, "%j", &bad_data); strftime(buf, buf_size, "%m", &bad_data); strftime(buf, buf_size, "%M", &bad_data); ...
(QSPI_DMA_READ_WORD_SIZE)
; QSPI_DMACmd(ENABLE); stop_mode_disable(InhibitorFlash); dma_request_start_direct(dev->dma, (void *)start_address_aligned, (void *)&QUADSPI->DR, dma_size, prv_dma_irq_handler, (void *)dev); xSemaphoreTake(dev->state->dma_semaphore, portMAX_DELAY); stop_mode_enable(Inh...
fUp: default: return ((round_me + multiple / 2) / multiple) * multiple; } } enum { FullStyleLower12h, FullStyleCapital12h, FullStyleLower24h, FullStyleCapital24h, }; static void prv_clock_get_full_relative_time(char *buffer, int buf_size, time_t timestamp, ...
("An hour ago")
; } else { str_fmt = i18n_noop("%lu hours ago"); } snprintf(buffer, buf_size, i18n_get(str_fmt, buffer), num_hrs); } else if (difference >= SECONDS_PER_MINUTE) { const int num_minutes = prv_round(difference, SECONDS_PER_MINUTE, RoundTypeAlwaysDown) / SECONDS_PER_MINUTE; const char ...
// Check for safety, just in case the app has corrupted the buffer in the mean time: if (msg->data + msg->length <= info.end) { info.message_handler(msg->data, msg->length, &info); } else { PBL_LOG(LOG_LEVEL_ERROR, "Corrupted AppInbox message!"); } ++num_message_consumed; } if (info.n...
{ PBL_LOG(LOG_LEVEL_ERROR, "Event queue full"); }
inbox->has_pending_event = is_event_enqueued; } static void prv_mark_failed_if_no_writer(AppInboxNode *inbox) { if (!inbox->writer) { // See PBL-41464 // App message has been reset (closed and opened again) while a message was being received. // Fail it because our state got lost. inbox->write_fai...
p_layer); } } ///////////////////// // Dismiss All ///////////////////// static void prv_handle_dismiss_all_complete(bool succeeded, void *cb_data) { NotificationWindowData *window_data = (NotificationWindowData*) cb_data; window_data->window_frozen = false; if (s_in_use && succeeded) { prv_pop_notificati...
prv_create_anim_frame((Layer *)&data->swap_layer, swap_frame_animation_dy, true /* scroll */)
_handler_entries(&s_stopped_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, c), 1); cl_assert_equal_i(prv_coun...
(a, b, NULL)
; cl_assert(seq != NULL); animation_set_delay(seq, delay_seq); animation_set_play_count(seq, play_count_seq); // Check durations cl_assert_equal_i(animation_get_duration(a, false, false), duration_a); cl_assert_equal_i(animation_get_duration(a, false, true), play_count_a * duration_a); cl_assert_equal_i...
awing on all cols creates checkerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_P...
GPoint(col, 0)
, MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_checkerboard_no_clip"))); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_ODD, false, 1); for (int16_t col = 0; col < MAX_NUM_COL...
/* * 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...
ancs_app_storage_save(&app_data)
; } } ANCSAppData app_data_out = { 0 }; for (unsigned int i = 0; i < ARRAY_LENGTH(collide_pairs); ++i) { for (unsigned int j = 0; j < 2; ++j) { char* name = collide_pairs[i][j]; app_data.bundle_id = name; app_data.display_name = name; ancs_app_storage_load(name, &app_data_out); ...
[] = { // Message Header 0x01, // Pebble protocol message ID: INSERT 0x17, 0x00, // Token TEST_DB_ID, // BlobDBDatabaseId: 0x01 0x01, // Size primary key: 1 byte // Primary Key: byte 0x6b // no value size }; void test_blob_db_e...
(0 < token)
; cmd_ptr += sizeof(uint16_t); // check for a Database entry cl_assert(TEST_DB_ID == *(uint8_t*)cmd_ptr); cmd_ptr += sizeof(uint8_t); // check for a key size cl_assert(TEST_KEY_SIZE == *(uint8_t*)cmd_ptr); cmd_ptr += sizeof(uint8_t); // go past key_bytes cmd_ptr += TEST_KEY_SIZE; cl_assert((cmd_...
// each page write. // TODO: uncomment the lines below to resolve PBL-17503 // if (buffer_size) { // mutex_unlock(s_flash_lock); // mutex_lock(s_flash_lock); // } } stop_mode_enable(InhibitorFlash); mutex_unlock(s_flash_lock); } // Returns 0 if the erase has completed, or a non-zero e...
xSemaphoreGive(s_erase_semphr)
; if (status == E_ERROR && saved_ctx.retries < MAX_ERASE_RETRIES) { // Try issuing the erase again. It might succeed this time around. PBL_LOG(LOG_LEVEL_DEBUG, "Erase of 0x%"PRIx32" failed (attempt %d)." " Trying again...", saved_ctx.address, saved_ctx.retries); return prv_flash_erase_start( ...
t_recognizer_manager__cleanup(void) { prv_clear_recognizers_processed(&s_recognizers_handled); prv_clear_recognizers_processed(&s_recognizers_reset); } static void prv_store_recognizer_idx(Recognizer *recognizer, ListNode **list) { int *idx = recognizer_get_impl_data(recognizer, &s_dummy_impl); if (idx) { ...
prv_compare_recognizers_processed((int[]) {4, 2, 3}, 3, &s_recognizers_handled)
); cl_assert_equal_s(dump[1].name, "Window2"); cl_assert_equal_p(dump[2].addr, window1); cl_assert_equal_s(dump[2].name, "Window1"); kernel_free(dump); } void test_window_stack__pop_all_modals(void) { Window *windows[NumModalPriorities]; WindowStack *window_stacks[NumModalPriorities]; for (ModalPriority...
cl_assert_equal_i(window_stack_count(stack), 0)
; window_stack_push(stack, window1, true); window_stack_push(stack, window2, true); cl_assert_equal_i(window_stack_count(stack), 2); cl_assert_equal_i(prv_get_load_unload_count(), 2); cl_assert_equal_i(prv_get_appear_disappear_count(), 1); window_stack_pop_all(stack, true); cl_assert_equal_i(window_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...
while (true) { persist_write_int(42, value++); }
} static void trigger_loop_log_spam(int index, void *context) { while (true) { APP_LOG(APP_LOG_LEVEL_ERROR, "Crash Demo Looping Log Spam! WarbleGarbleWarbleGarbleWarble"); } } static void accel_data_handler(AccelData *data, uint32_t num_samples) { } static void trigger_to_app_event_flood(int index, void *c...
rmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); // Only 1 pin should be added cl_assert_equal_i(s_num_timeline_adds, 2); // First alarm goes off. Second one should be up s_current_hour = 10; ...
cron_service_wakeup()
; cl_assert_equal_i(s_num_alarms_fired, 3); } void test_alarm__custom_alarm_weekends(void) { AlarmId id1, id2; bool schedule_1[7] = {true, false, false, false, false, false, true}; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 }); prv_as...
animation_set_duration(animation, BUMP_TEXT_DURATION_MS)
; AnimationHandlers anim_handler = { .stopped = prv_bump_text_stopped, }; animation_set_handlers(animation, anim_handler, selection_layer); selection_layer->bump_text_impl = (AnimationImplementation) { .update = prv_bump_text_impl, }; animation_set_implementation(animation, &selection_layer->bump_t...
allow_destroy*/, false /*force_destroy*/, !animation->parent /*teardown*/); } else { blocked_on_children_complete = true; } } return blocked_on_children_complete; } // ------------------------------------------------------------------------------------------- // @param...
{ const int max_args = ANIMATION_MAX_CREATE_VARGS; typedef Animation *AnimationPtr; AnimationPtr animation_array[max_args]; int array_len = 2; // A and B must not be NULL if (!animation_a || !animation_b) { return false; } animation_array[0] = animation_a; animation_array[1] = animation_b; if ...
Test Failed"); app_window_stack_push(&data->status_window, true); } } static bool prv_test_is_running(AppData *data) { return (data->current_test_step != BTLETestStep_None); } //-------------------------------------------------------------------------------- // Number Windows //-------------------------------...
text_layer_set_font(&data->status_text, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD))
; layer_add_child(window_layer, text_layer_get_layer(&data->status_text)); } //-------------------------------------------------------------------------------- // TX/RX Menus & Windows //-------------------------------------------------------------------------------- // The same menu layer is reused for TX / RX, we ...
e->cached_size; ToGValue(&ctx->box.origin)[axis] += size[axis]; ToGValue(&ctx->box.size)[axis] -= size[axis]; return true; } static void prv_draw_text_node_custom(GTextNodeDrawContext *ctx) { GTextNodeCustom *custom_node = (GTextNodeCustom *)ctx->node; custom_node->callback(ctx->gcontext, &ctx->box, ctx->con...
if (parent_ctx) { prv_container(parent_ctx->node)->will_draw_child(parent_ctx, node); prv_init_draw_context(ctx, node, parent_ctx->gcontext, &parent_ctx->box, parent_ctx->config, parent_ctx->render); }
gsize_sub_eq(&ctx->box.size, node->margin); prv_base(node)->will_draw(ctx); ctx->cached = !prv_should_draw_text_node(node, ctx->gcontext, &ctx->box, ctx->render); if (!ctx->cached && node->clip) { ctx->cached_clip_box = ctx->gcontext->draw_state.clip_box; const GRect draw_box = { .origin = gpoi...
ICS_DEVICE_METRIC_ACCEL_PEEK_COUNT, AnalyticsClient_System); PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_Worker || task == PebbleTask_App) { analytics_inc(ANALYTICS_APP_METRIC_ACCEL_PEEK_COUNT, AnalyticsClient_CurrentTask); } mutex_lock_recursive(s_accel_manager_mutex); AccelDriv...
mutex_unlock_recursive(s_accel_manager_mutex)
; return ONLY_SUPPORTED_JITTERFREE_RATE_MILLIHZ; } DEFINE_SYSCALL(int, sys_accel_manager_set_sample_buffer, AccelManagerState *state, AccelRawData *buffer, uint32_t samples_per_update) { if (samples_per_update > ACCEL_MAX_SAMPLES_PER_UPDATE) { return -1; } if (PRIVILEGE_WAS_ELEVATED) { ...
); } static void prv_handle_weather(PebbleEvent *unused_event, void *unused_context) { // Unschedule any ongoing animations that would try to touch the weather data we're about to // update animation_unschedule_all(); size_t forecasts_count_out = 0; WeatherDataListNode *forecasts_list_head = weather_s...
window_set_user_data(window, data)
; const GRect *layout_frame = &window->layer.bounds; WeatherAppLayout *layout = &data->layout; weather_app_layout_init(layout, layout_frame); window_set_user_data(window, layout); // Fetch initial data prv_handle_weather(NULL, NULL); if (data->forecasts_count == 0) { return; } const bool anima...
60, 200, -48}, // 110 seconds { 936, 336, -48}, { 784, 368, -56}, { 736, 344, -40}, { 824, 376, -80}, { 912, 360, -80}, { 1008, 344, -56}, { 1216, 352, -104}, { 1320, 352, -56}, { 1664, 312, 24}, { 1432, 376, 32}, { 1256, 384, -24}, { 1200, 280, 16}, { 1288, 256, ...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-05 15:57:07 local AccelRawData *activity_sample_walk_200_pbl_25661_8(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25661_8 //> TEST...
(AppFetchResultIncompatibleJSFailure); } else { // Set prev_error as a Success. s_fetch_state.prev_error = AppFetchResultSuccess; prv_put_event_simple(AppFetchEventTypeFinish); } app_install_release_md(md); } else { PBL_LOG(LOG_LEVEL_ERROR, "Failed to insert into app ...
kernel_malloc_check(sizeof(AppFetchInstallRequest))
equal_i(s_num_alarms_fired, 3); cl_assert_equal_i(s_num_alarm_events_put, 3); cl_assert_equal_i(s_num_timeline_adds, 27); cl_assert_equal_i(s_num_timeline_removes, 18); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again s_...
rtc_get_time()
); // Second alarm goes off. First one should be up again s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 2); cl_assert_equal_i(s_num_alarm_events_put, 2); cl_assert_equal_i(s_num_timeline_adds, 9); cl_assert_equal_i(s_num_timeline_removes, 5); ...
t that position, don't bother scheduling an animation if (item_layer->scroll_offset_pixels == new_offset) { return; } if (item_layer->animation && animation_is_scheduled(property_animation_get_animation(item_layer->animation))) { // Don't do anything if we're already animating to this position from...
(current_scroll, SCROLL_AMOUNT)
subscription_type) { // Already subscribed return BTErrnoInvalidState; } if (subscription->pending_confirmation[client] && !is_cleaning_up) { // Already a pending subscription in flight... return BTErrnoInvalidState; } previous_prevailing_type = prv_prevailing_subscription_type(...
prv_subscribe(characteristic_ref, subscription_type, client, false /* is_cleaning_up */)
; bt_unlock(); return ret_val; } // ------------------------------------------------------------------------------------------------- bool prv_cleanup_subscriptions_for_client(GAPLEConnection *connection, void *data) { const GAPLEClient client = (const GAPLEClient)(uintptr_t) data; GATTClientSubscriptionNode ...
se 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. */ #undef PBL_LOGS_HASHED #include "applib/app.h" #include "applib/ui/ui.h" #include "kernel/pbl_...
for (int i=0; i<NUM_MAX_TIMERS; i++) { s_app_data->fired_time[i] = 0; if (s_app_data->timer[i] != TIMER_INVALID_ID) { PBL_LOG(LOG_LEVEL_DEBUG, "STT stopping and deleting previous timer %d", i); new_timer_stop(s_app_data->timer[i]); new_timer_delete(s_app_data->timer[i]); s_app_data->time...
if (s_app_data->app_timer != NULL) { app_timer_cancel(s_app_data->app_timer); s_app_data->app_timer = 0; } // Cancel and delete old regular timers if present for (int i=0; i<NUM_MAX_TIMERS; i++) { if (s_app_data->reg_timers[i].cb != NULL) { PBL_LOG(LOG_LEVEL_DEBUG, "STT deleting previous re...
iption_example[23] = 2; // invalidate Word count of the second sentence result = transcription_validate(validate_test, test_size); cl_assert_equal_p(result, false); s_test_transcription_example[23] = 3; // restore word count of the second sentence s_test_transcription_example[26] = 0; // invalidate word len...
{ uint8_t sentence_test[] = { // Sentence #1 0x02, 0x00, // Word count // Word #1 85, // Confidence 0x05, 0x00, // Word length 'H', 'e', 'l', 'l', 'o', // Word #2 74, // Confidence 0x08, 0x00, // Word length 'c', 'o', 'm', 'p', 'u', 't', 'e', 'r', ...
result = transcription_iterate_sentences((TranscriptionSentence *) sentence_test, 0, (TranscriptionSentenceIterateCb)prv_cb_return_false, NULL); cl_assert_equal_p(result, sentence_test); result = transcription_iterate_sentences((TranscriptionSentence *) sentence_test, 2, NULL, NULL); cl_assert_eq...
/* * 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...
(LOG_LEVEL_ALWAYS, "ASSERTION at LR 0x%x", 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...
{ return 0; }
ion. for (sn = 0; sn < s_tx_window_size; ++sn) { prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn /* sn */, s_short_data_fragment, sizeof(s_short_data_fragment) - sn); } } void test_ppogatt__retransmit_timed_out_data_packets_first_but_not_later_ones(void) { t...
ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid)
; // Get a packet in flight: uint8_t sn = 0; cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment) - sn), true); ppo...
IENT_SENSOR_ENABLED, &enabled, sizeof(enabled)); } uint32_t backlight_get_timeout_ms(void) { #if INFINITE_BACKLIGHT return UINT32_MAX; #endif return s_backlight_timeout_ms; } void backlight_set_timeout_ms(uint32_t timeout_ms) { prv_pref_set(PREF_KEY_BACKLIGHT_TIMEOUT_MS, &timeout_ms, sizeof(timeout_ms)); } uin...
{ s_quick_launch_setup_opened = version; prv_pref_set(PREF_KEY_QUICK_LAUNCH_SETUP_OPENED, &s_quick_launch_setup_opened, sizeof(s_quick_launch_setup_opened)); }
ype_ShowWillStart ); // The future item is too far to increase the concurrent count ADD_EVENT( .item = &s_future_item ); CHECK_EVENT( .count = 5, .item_id = s_item3.header.id, .num_concurrent = 2, .timeout_ms = SECONDS_PER_MINUTE * MS_PER_SECOND, .time_type = TimelinePeekTimeType_Sho...
timeline_event_refresh()
; CHECK_NO_EVENTS( .count = 3 ); } void test_timeline_peek_event__first_event_with_past_event(void) { TimelineItem item = DEFINE_EVENT( .id = 0x01, .timestamp = 20 * SECONDS_PER_MINUTE, .duration = 70 ); TimelineItem UNUSED item2 = DEFINE_EVENT( .id = 0x02, .timestamp = -50 * SECONDS_PER_MINUTE, ....
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(attributes_per_action != NULL)
; } const size_t alloc_size = attributes_actions_get_required_buffer_size(num_attributes, num_actions, attributes_per_action, required_size_for_strings); uint8_t *buffe...
pairing_info_out.identity.opaque.opaque_64); cl_assert_equal_i(pairing_info->remote_encryption_info.rand, pairing_info_out.remote_encryption_info.rand); cl_assert_equal_i(pairing_info->remote_encryption_info.ediv, pairing_info_out.remote_encryption_info.ediv)...
(shared_prf_storage_get_bt_classic_pairing_data(NULL, NULL, NULL, NULL), false)
/* * 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...
gcolor_equal(get_bitmap_color(test_image_bw, 8, 24), GColorBlack)
); cl_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 2), GColorClear)); cl_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 10), GColorRed)); cl_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 30), GColorScreaminGreen)); #endif } void test_graphics_draw_rotated_bitmap__origin_bw_as...
ASH_Status return_status; uint8_t *flash_written_data; bool *flash_written_flag; void *source_buffer; uint32_t flash_data_start, flash_data_length; bool callback_called; void test_system_flash__initialize(void) { erased_sector = 0; flash_locked = true; flash_flags_set = false; return_status = FLASH_COMPLETE; ...
{ return_status = FLASH_ERROR_OPERATION; malloc_flash_data(10); flash_data_start = FLASH_BASE; cl_assert(!system_flash_write(FLASH_BASE, "abc", 3, NULL, NULL)); cl_assert(flash_locked); assert_flash_unwritten(0, 10); }
extern void FLASH_Lock(void) { flash_locked = true; } extern void FLASH_Unlock(void) { flash_locked = false; } extern void FLASH_ClearFlag(uint32_t FLASH_FLAG) { flash_flags_set = false; } extern FLASH_Status FLASH_EraseSector(uint32_t sector, uint8_t voltage_range) { // Pretty sure FLASH_Sector_N defines ...
lled from lis3dh_read/accel_write) uint8_t mode; if (!prv_read_register(LIS3DH_FIFO_CTRL_REG, &mode)) { return; } if (mode != MODE_BYPASS) { uint8_t fifo_ctrl_reg = mode & ~MODE_MASK; fifo_ctrl_reg |= (MODE_BYPASS & MODE_MASK); if (!prv_write_register(LIS3DH_FIFO_CTRL_REG, fifo_ctrl_reg)) { ...
(I2C_LIS3DH)
{ 1704, 592, 104}, { 936, 736, 72}, { 896, 400, -80}, { 1032, 128, 272}, { 936, 0, 208}, // 5 seconds { 968, 184, 296}, { 920, 184, 176}, { 784, 160, 160}, { 736, 64, 224}, { 656, 64, 128}, { 640, 0, 96}, { 776, -8, 48}, { 1088, 80, -32}, { 1624, -64, 112}, ...
{ 1408, 16, 384}, { 1128, 8, 304}, { 1008, 72, 120}, { 880, 72, 96}, { 752, 40, 120}, { 648, 0, 112}, { 568, -56, 40}, { 656, -64, -48}, { 944, 16, -80}, { 1656, -88, 176}, { 2000, 128, 288}, // 11 seconds { 1304, 280, -144}, { 1128, 312, -184}, { 1352, 192, 1...
{ 1256, 360, 88}, { 1056, 320, 256}, { 1024, 240, 264}, { 1016, 168, 216}, { 936, 280, 104}, { 888, 384, -32}, { 832, 504, -88}, { 896, 552, -112}, { 1088, 544, -64}, { 1288, 480, 24}, { 1792, 440, 112}, { 1664, 456, 96}, { 1184, 296, 288}, { 1272, 208, 152}, ...
/* * 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...
(tint_color, GColorBlack)
) { *compositing_mode = GCompOpAnd; } else if (gcolor_equal(tint_color, GColorWhite)) { *compositing_mode = GCompOpSet; } } } void bitblt_bitmap_into_bitmap_tiled_1bit_to_1bit(GBitmap* dest_bitmap, const GBitmap* src_bitmap, GRect dest_rect, ...
(TimelineNode *)list_get_tail((ListNode *)head); while (current) { if (prv_show_event(current, timestamp, today_midnight, TimelineIterDirectionPast, show_all_day_events)) { break; } current = (TimelineNode *)current->node.prev; } return current; } static TimelineNode *prv_find_first_futur...
{ nodes[i]->timestamp = midnight; nodes[i]->duration = MINUTES_PER_DAY; nodes[i]->all_day = true; midnight += SECONDS_PER_DAY; }
} static void prv_add_nodes_for_serialized_item(TimelineNode **list_head, CommonTimelineItemHeader *header) { int num_nodes = prv_num_nodes_for_serialized_item(header); TimelineNode *nodes[num_nodes]; // copy UUID to all the nodes for (int i = 0; i < num_nodes; i++) { // each node requires its own mall...
&notif_prefs->action_group); bool rv = false; // Make sure we have a reply action (this properly handles NULL items) const TimelineItemAction *reply_action = timeline_item_find_reply_action(item); if (reply_action) { s_phone_ui_data->call_response_item = item; rv = true; if (reply_action->t...
prv_stop_ringing()
; window_deinit(&s_phone_ui_data->window); timeline_item_destroy(s_phone_ui_data->call_response_item); kernel_free(s_phone_ui_data); s_phone_ui_data = NULL; } static void prv_handle_window_unload(Window *window) { prv_phone_ui_deinit(); } //! Window destroy functions //! Currently only 1 call window can...
g) { .primary_label = "LABEL1", .primary_value = "value1", .secondary_label = "LABEL2", .secondary_value = "value2", .fill_color = GColorWhite, #if PBL_BW .outline_color = GColorBlack, #endif }, .bg_color = BG_COLOR, }; prv_create_card_and_render(&config); cl_check(gbi...
PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack)
, }, .bg_color = BG_COLOR, .daily_avg = 900, .weekly_max = 1300, .num_zones = ARRAY_LENGTH(zones), .zones = zones, }; HealthDetailCard *card = (HealthDetailCard *)prv_create_card_and_render(&config); #if PBL_ROUND menu_layer_set_selected_index(&card->menu_layer, MenuIndex(0, 2), MenuRowA...