prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
#include "stubs_sys_exit.h" size_t heap_bytes_free(void) { return 123456; } static bool s_clock_is_24h_style; bool clock_is_24h_style() { return s_clock_is_24h_style; } void test_rocky_api_datetime__initialize(void) { // Mon Jul 25 2005 20:04:05 GMT-03:00 s_time = 1122332645; s_gmt_off = -3 * 60 * 60; ...
("s", "08 PM")
; EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "8:04:05 PM"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: undefined, minute: undefined, second: undefined});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "8:04:05 PM"); s_clock_is_24...
2, 552, -840}, { -152, 552, -856}, { -152, 544, -832}, { -176, 544, -824}, { -176, 552, -816}, { -152, 552, -832}, { -160, 544, -832}, { -160, 544, -848}, { -160, 544, -832}, { -160, 568, -824}, { -168, 504, -832}, { -152, 552, -840}, // 256 seconds { -160, 552, -824}...
{ -192, 408, -968}, { -216, 448, -976}, { -200, 336, -928}, // 261 seconds { -208, 400, -928}, { -200, 376, -912}, { -216, 392, -912}, { -208, 400, -928}, { -216, 384, -920}, { -216, 392, -912}, { -224, 432, -912}, { -224, 432, -888}, { -224, 416, -880}, { -216, 4...
{ -184, 616, -784}, { -184, 624, -776}, { -192, 600, -776}, { -184, 600, -768}, { -184, 592, -792}, { -184, 592, -784}, { -184, 608, -784}, { -184, 600, -776}, { -184, 608, -784}, { -184, 600, -784}, { -184, 608, -776}, { -184, 600, -784}, { -184, 600, -776}, { -...
/* * 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 ((uint64_t)ticks * 1000) / configTICK_RATE_HZ; }
mware_update_is_in_progress(void) { return false; } void battery_force_charge_enable(bool is_charging) { } bool stop_mode_is_allowed(void) { return s_stop_mode_allowed; } static void periodic_timer_trigger(int count) { TimerID timer_id = battery_state_get_periodic_timer_id(); cl_assert(timer_id != TIMER_INVA...
battery_get_charge_state()
.charge_percent, high_percent); // Then, when the voltage drops, the percentage should begin to decline - but should not reach the low value yet fake_battery_set_millivolts(low_mv); periodic_timer_trigger(1); int delta = high_percent - battery_get_charge_state().charge_percent; cl_assert(delta >= 0); cl_as...
/* * 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_assert_sane_segment(segment); return (size_t)((uintptr_t)segment->end - (uintptr_t)segment->start); }
void memory_segment_align(MemorySegment *segment) { segment->start = prv_align(segment->start); prv_assert_sane_segment(segment); } void * memory_segment_split(MemorySegment * restrict parent, MemorySegment * restrict child, size_t size) { prv_assert_sane_segment(parent); char *ch...
{ 464, 352, -792}, { 496, 288, -784}, { 456, 208, -848}, { 456, 240, -840}, { 488, 184, -808}, { 496, 248, -824}, { 480, 208, -784}, { 464, 248, -856}, { 464, 152, -832}, { 472, 160, -840}, { 464, 160, -840}, { 464, 184, -856}, { 472, 176, -824}, { 488, 232, -848}...
{ 360, 312, -792}, { 384, 480, -776}, { 376, 512, -768}, { 368, 416, -776}, { 368, 440, -784}, { 368, 472, -768}, // 136 seconds { 360, 432, -768}, { 368, 456, -768}, { 368, 448, -776}, { 376, 456, -768}, { 376, 488, -768}, { 384, 440, -768}, { 376, 424, -776}, ...
{ 384, 504, -752}, { 400, 544, -736}, { 384, 456, -752}, { 376, 440, -752}, { 400, 496, -744}, { 392, 512, -736}, { 384, 456, -752}, { 384, 504, -744}, { 400, 480, -744}, { 392, 544, -664}, { 384, 488, -744}, { 384, 464, -744}, { 400, 512, -728}, { 400, 496, -736...
CAPABILITY_HAS_MAGNETOMETER ecompass_handle_battery_state_change_event(e->battery_state.new_state); #endif return; case PEBBLE_RENDER_READY_EVENT: compositor_app_render_ready(); return; case PEBBLE_ACCEL_SHAKE_EVENT: analytics_inc(ANALYTICS_DEVICE_METRIC_ACCEL_SHAKE_COUNT, Analyt...
(comm_session_event)
; put_bytes_handle_comm_session_event(comm_session_event); #ifndef RECOVERY_FW if (comm_session_event->is_system) { // tell the phone which app is running const Uuid *running_uuid = &app_manager_get_current_app_md()->uuid; if (running_uuid != NULL) { app_run_state_send_upda...
p session it is in finally ends). if (activity_sessions_prv_is_sleep_activity(session->type)) { if (state->sleep_data.cur_state != ActivitySleepStateAwake) { continue; } } // Log this event activity_sessions_prv_send_activity_session_to_data_logging(session); *params->exit_utc =...
if (state->sleep_sessions_modified) { // Post-process the sleep activities. This is where we relabel sleep sessions as nap // sessions, depending on time and length heuristics. activity_algorithm_post_process_sleep_sessions(state->activity_sessions_count, s...
// Update sleep metrics // For today's metrics, we include sleep sessions that end between // ACTIVITY_LAST_SLEEP_MINUTE_OF_DAY the previous day and ACTIVITY_LAST_SLEEP_MINUTE_OF_DAY // today. activity_algorithm_get_activity_sessions() insures that we only get sessions // that end after ACTIVITY_LAST_SLEEP_...
on_init(parent); parent->implementation = &s_complex_implementation; return prv_complex_init(parent_h, animation_array, array_len, type); } // ------------------------------------------------------------------------------------------- static Animation *prv_animation_clone(AnimationState ...
{ if (!process_manager_compiled_with_legacy2_sdk()) { applib_free(state->aux); } }
// ------------------------------------------------------------------------------------------- // Return true if the animation globals were instantiated using the legacy 2.x animation // manager bool animation_private_using_legacy_2(AnimationState *state) { if (state == NULL) { state = prv_animation_state_get(...
igin = GPoint(-layer->bounds.size.w, 0); Animation *animation = (Animation *)property_animation_create_bounds_origin(layer, NULL, &to_origin); animation_set_handlers(animation, (AnimationHandlers) { .stopped = prv_move_timeline_layer_...
{ TimelineAppData *data = context; if (!finished || !prv_set_state(data, TimelineAppStateStationary)) { return; } data->current_animation = NULL; prv_update_timeline_layer(data); Animation *move_animation = timeline_layer_create_up_down_animation( &data->timeline_layer, TIMELINE_UP_DOWN_ANIMATIO...
static void prv_hide_day_sep(void *context) { TimelineAppData *data = context; data->day_separator_timer_id = EVENTED_TIMER_INVALID_ID; if (!prv_set_state(data, TimelineAppStateHideDaySeparator)) { return; } animation_unschedule(data->current_animation); Animation *day_sep_hide = timeline_layer_crea...
/* * 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...
(&aes_setup)
; hw_aes_hash_start(); hw_aes_hash_disable(true /* wait_until_inactive */); return true; }
llipsis(TO_TRIG(0), TO_TRIG(360)), ((EllipsisDrawConfig){ .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(20), TO_TRIG(380))...
(TO_TRIG(90), TO_TRIG(360))
, ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90),GCornerBottomRight}, .full_quadrants = (GCornersBottom | GCornerTopLeft), .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight} })); cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(180), TO_TRIG(360...
/* * 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...
alerts_should_notify_for_type(AlertPhoneCall)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(APP_REGISTRY_FIXTURE_PATH)
+ strlen(name) + 3]; sprintf(res_path, "%s/%s/%s", CLAR_FIXTURE_PATH, APP_REGISTRY_FIXTURE_PATH, name); // Check that file exists and fits in buffer struct stat st; cl_assert(stat(res_path, &st) == 0); FILE *file = fopen(res_path, "r"); cl_assert(file); uint8_t buf[st.st_size]; // copy file to fake f...
rame of the right "round flip" compositor // transition animation and then clips a full-screen red rectangle to the resulting mask static void prv_right_flip_first_quarter_frame_clipping(GContext *ctx) { // The 1/4 progress frame is ANIMATION_NORMALIZED_MAX * 3/4 because the right flip animation is // actually pla...
(bitmap, 50, false)
; cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_right"))); graphics_private_move_pixels_horizontally(bitmap, -100, false); cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_left"))); graphics_private_move_pixels_horizontally(bitmap, 400, false); cl_check(gbitmap_pbi...
lude "stubs_logging.h" #include "stubs_passert.h" /////////////////////////////////////////////////////////// // Tests void test_utf8_iterator__decode_test_string_empty(void) { bool success = false; utf8_get_bounds(&success, ""); cl_assert(success); } //! Decode ASCII char void test_utf8_iterator__decode_test_...
(utf8_each_codepoint(str, prv_each_codepoint, context), true)
; cl_assert_equal_i(s_each_count, 2); } static bool prv_each_codepoint_break(int index, Codepoint codepoint, void *context) { static int s_index = 0; static Codepoint s_codes[] = { 'a', 'b', 'c', 'd', 'e' }; cl_assert_equal_i(s_index++, index); cl_assert_equal_i(s_codes[index], codepoint); cl_assert_equal_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(gcolor_equal(get_bitmap_color(test_image_color, 30, 30), GColorScreaminGreen))
; #endif } void test_graphics_draw_rotated_bitmap__origin_bw_assign(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // No Clip, Angle 0 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_bw, ...
/* * 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...
((ListNode *)entry, (ListNode **)entries, NULL)
; kernel_free(entry->key); kernel_free(entry->val); kernel_free(entry); } status_t ram_storage_insert(RamStorage *storage, const uint8_t *key, int key_len, const uint8_t *val, int val_len) { // delete entry if it already exists RamStorageEntry *entry = prv_get_entry(storage->entries, key, key_len); if ...
internal guard != NULL gdraw_command_image_draw(ctx, image, GPoint(0, 0)); cl_assert_equal_i(s_path_num_points, 2); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); prv_reset(); gdraw_command_image_draw(ctx,...
(gdraw_command_get_data_size(gdraw_command_list_get_command(command_list, 2)), prv_get_list_max_command_size(command_list))
ular_buffer_consume(&buffer, 4)); // Get the rest of the wrapped read cl_assert(circular_buffer_read(&buffer, 2, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 2); cl_assert(memcmp(out_buffer, (uint8_t*) "9a", 2) == 0); cl_assert(circular_buffer_consume(&buffer, 2)); // Consume one without read...
cl_assert_equal_i(contiguous_num_bytes_left, 1)
; memcpy(data_out, "7", 1); circular_buffer_write_finish(&buffer, 1); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 0); cl_assert_equal_i(circular_buffer_get_read_space_remaining(&buffer), 8); contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out); cl_assert_...
unds->size.h), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } static void prv_draw_crosshair(Layer *layer, GContext *ctx) { AppData *data = app_state_get_user_data(); const GRect *bounds = &data->window.layer.bounds; const int mid_pixel_minus_one = (bounds->origin.x + bounds->siz...
mfg_info_get_disp_offsets()
.y) { app_window_stack_pop_all(true); return; } app_data->is_saving = true; layer_mark_dirty(&app_data->window.layer); app_data->exit_timer = app_timer_register(200, prv_save_offsets_callback, NULL); } static void prv_config_provider(void *data) { window_single_click_subscribe(BUTTON_ID_SELECT, prv...
istributed 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 "applib/graphics/framebuffer.h" #include "applib/graphics/graphics.h" #include "applib/graphi...
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign)
; graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_assign_corner_45.Xbit.pbi")); // Top-left center rotation point, Angle 45 setup_t...
(steps - entry->exp_steps)
; float weighted_error = (float)error * entry->weight; printf("\nRESULTS: exp_steps: %d, act_steps: %d, ref_steps: %d, error: %d, weighted_error: %f", entry->exp_steps, (int)steps, (int)ref_steps, (int)error, weighted_error); printf("\n min: (steps, vmc, orientation)"); for (int j = 0...
ode overflow = (has_secondary && !is_peek) ? GTextOverflowModeTrailingEllipsis : GTextOverflowModeFill; if (PBL_IF_ROUND_ELSE(!is_thin, true)) { // Move the hour and title closer together const int hour_title_margin = is_fat ? style->fat_time_margin_h : style->thin_time_margin_h; if (time_text_node)...
(num_horizontal_icon_nodes)
; GTextNodeVertical *vertical_icon_node = graphics_text_node_create_vertical(num_vertical_icon_nodes); graphics_text_node_container_add_child(&horizontal_icon_node->container, &vertical_icon_node->container.node); horizontal_icon_node->horizontal_alignment ...
aw_text_single_line_ellipsis_clip_across_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_x); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_x.${...
(&layer, &draw_text_single_line_wordwrap_clip_outside_x)
; layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_x.${BIT_DEPTH_NAME}.pbi")); } #define RECT_TEXT_0_0 GRect(0, 0, 140, 1000) #define RECT_TEXT_2_0 GRect(2, 0, 140, 1000) void test_graphics_draw_text_${BIT_DEPTH_NAME}__clipping_letters(void) ...
B1PeriphResetCmd(bus->hal->clock_ctrl, ENABLE); RCC_APB1PeriphResetCmd(bus->hal->clock_ctrl, DISABLE); } void i2c_hal_init(I2CBus *bus) { NVIC_SetPriority(bus->hal->ev_irq_channel, I2C_IRQ_PRIORITY); NVIC_SetPriority(bus->hal->er_irq_channel, I2C_IRQ_PRIORITY); NVIC_EnableIRQ(bus->hal->ev_irq_channel); NVIC_...
{ I2CTransfer *transfer = &bus->state->transfer; if (transfer->type == I2CTransferType_SendRegisterAddress) { transfer->state = I2CTransferState_WriteRegAddress; } else { if (transfer->direction == I2CTransferDirection_Read) { transfer->state = I2CTransferState_ReadData; } else { transfer...
static void prv_enable_interrupts(I2CBus *bus) { bus->hal->i2c->CR1 |= I2C_CR1_ERRIE | // Enable error interrupt I2C_CR1_NACKIE | // Enable NACK interrupt I2C_CR1_TCIE | // Enable transfer complete interrupt I2C_CR1_TXIE; // Enable transmit in...
/* * 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...
(text_heap_info, s_text_buf)
; layer_add_child(window_layer, text_layer_get_layer(text_heap_info)); } static void deinit(void) { // Don't free anything } int main(void) { init(); app_event_loop(); deinit(); }
TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, }; // Init mutable types word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start); // Tests cl_assert(word_iter_state.current.start == word_iter_state.current.end); cl_assert(!iter_next(&wo...
cl_assert(*word_iter_state.current.start == '\n')
; cl_assert(*word_iter_state.current.end == '\0'); cl_assert(!iter_next(&word_iter)); }
/* * 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...
(AHB2PERIPH_BASE < AHB3_BASE, "Clock mapping assumptions don't hold")
; // Note: this works only with peripheral (<...>Typedef_t *) defines, not with RCC defines static ClockCmd prv_get_clock_cmd(uintptr_t periph_addr) { PBL_ASSERTN(periph_addr >= APB1PERIPH_BASE); if (periph_addr < APB2PERIPH_BASE) { return RCC_APB1PeriphClockCmd; } else if (periph_addr < AHB1PERIPH_BASE) { ...
egion_erase_optimal_range(region.begin, region.begin, region.end, region.end); PBL_LOG(LOG_LEVEL_INFO, ">>>> Checking '%s' is erased", region.name); check_region_erased(region); PBL_LOG(LOG_LEVEL_INFO, ">>>> Checking '%s' can write", region.name); check_region_write(region, false, true); PBL_LOG(LOG_LEVEL_INF...
(root_layer, simple_menu_layer_get_layer(&data->menu_layer))
; } static void push_window(FlashDiagAppData *data) { Window *window = &data->window; window_init(window, WINDOW_NAME("Flash Diagnostic")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_st...
(root_level, responses_level, label); } else { action_menu_level_add_action(root_level, label, prv_action_menu_cb, action); } } ActionMenuLevel *timeline_actions_create_action_menu_root_level(uint8_t num_items, uint8_t separator_index, ...
prv_set_action_result(timeline_action_menu, data)
; action_menu_freeze(action_menu); // We only show the first use tutorial if this was called from an action menu prv_push_dismiss_first_use_dialog(action_menu); } for (int i = 0; i < num_notifications; i++) { TimelineItem item; if (notif_list[i].type == NotificationReminder) { if (remin...
#include "semphr.h" #define STM32F4_COMPATIBLE #define STM32F7_COMPATIBLE #include <mcu.h> #include <stdbool.h> #include <stdint.h> #include <string.h> //! The default baudrate for the accessory UART. #define DEFAULT_BAUD AccessoryBaud115200 //! How long each interval should be in milliseconds. #define ACCESSORY_ST...
{ if (mcu_state_is_isr()) { // assume we're in an ISR for the UART and don't need to worry about being blocked return; } mutex_unlock_recursive(s_blocked_lock); }
static void prv_enable_dma(void) { PBL_ASSERTN(!s_dma_enabled); s_dma_enabled = true; uart_start_rx_dma(ACCESSORY_UART, s_rx_buffer, sizeof(s_rx_buffer)); } static void prv_disable_dma(void) { if (!s_dma_enabled) { return; } s_dma_enabled = false; uart_stop_rx_dma(ACCESSORY_UART); } //! The interv...
/* * 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_m(data, &s_test_data[data_idx].item, sizeof(TestCacheItem))
; cl_assert(data == &s_cache_buffer[cache_idx]); } void test_keyed_circular_cache__push(void) { prv_push(0); prv_test_backing_data(0, 0); prv_test_backing_data_empty(1); prv_test_backing_data_empty(2); prv_push(1); prv_test_backing_data(0, 0); prv_test_backing_data(1, 1); prv_test_backing_data_empty...
elay_a + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); 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, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_ca...
prv_count_handler_entries(&s_stopped_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); // Start B prv_advance_to_ms_with_timers(start_ms + delay_spawn + MAX(delay_a, delay_b) + 2 * MIN_FRAME_INTERVAL_MS);...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(mfg_info_get_rtc_freq(), 4)
ector_addr, S29VSCommand_BufferToFlash); // Check the status register to make sure that the write has started. status_t result = E_UNKNOWN; const uint8_t sr = prv_read_status_register(sector_addr); if ((sr & S29VSStatusBit_DeviceReady) == 0) { // Program or erase operation in progress. Is it in the current...
{ const uint32_t MAX_FREQ = MHZ_TO_HZ(108); // max frequency of the flash 108MHZ const uint32_t TAVDP_MIN = 60; // min addr setup time in tenths of ns const uint32_t TADVO_MIN = 40; // min addr hold time in tenths const uint32_t SETUP_STEP = MHZ_TO_HZ(16); // for data setup equation ...
.FMC_DataSetupTime = (h_clock / SETUP_STEP) + 1, // Time between chip selects // not on the datasheet, picked a random safe number // FIXME: at high bus frequencies, more than one cycle may be needed .FMC_BusTurnAroundDuration = 1, // TODO: actually ok? See back-to-back Read/Write Cycle .FMC_...
/* * 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 year + TM_YEAR_ORIGIN; }
/* * 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; }
/* * 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...
{ memcpy(framebuffer_get_line(f, y), buffer, FRAMEBUFFER_WORDS_PER_ROW); bitset8_set(f->dirty_lines, y); f->is_dirty = true; }
void framebuffer_set_lines(FrameBuffer* f, uint8_t y, const uint8_t num_lines, const uint32_t* buffer) { uint32_t* line = framebuffer_get_line(f, y); memcpy(line, buffer, num_lines * FRAMEBUFFER_WORDS_PER_ROW); const GRect dirty_rect = GRect(0, y, DISP_COLS, num_lines); framebuffer_mark_dirty_rect(f, dirty_re...
ep; // Sleep session active, ensure that asking if a Sleep is ongoing returns true cl_assert_equal_b(true, activity_sessions_is_session_type_ongoing(ActivitySessionType_Sleep)); cl_assert_equal_i(HealthActivitySleep, health_service_peek_current_activities()); // Delete session activity_sessions_prv_delete_a...
(prv_is_hr_elevated(), false)
t_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 0); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r0_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, tr...
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2))
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1); cl_check(gbitm...
.max_data_size = max_data_size, .transport = transport, }; // Start a new encoding const bool success = prv_session_encode_start(session); if (!success) { PBL_LOG(LOG_LEVEL_ERROR, "Error encoding msg"); prv_session_free(session); session = NULL; } return session; } // -----------------...
PROTOBUF_LOG_DEBUG("Session: 0x%x - Adding event with type: %d", (int)session_ref, event->type)
; bool success = prv_log_struct(session, pebble_pipeline_Payload_events_tag, pebble_pipeline_Event_fields, event); return success; } bool protobuf_log_session_flush(ProtobufLogRef session_ref) { PBL_ASSERTN(session_...
yer->number.text_layer); const GSize title_size = text_layer_get_content_size(ctx, &peek_layer->title.text_layer); const GSize subtitle_size = text_layer_get_content_size(ctx, &peek_layer->subtitle.text_layer); GPoint cursor = { (layer_bounds.size.w - subtitle_size.w) / 2, -(subtitle_size.h +...
(&peek_layer->kino_layer)
; text_layer_deinit(&peek_layer->title.text_layer); text_layer_deinit(&peek_layer->number.text_layer); text_layer_deinit(&peek_layer->subtitle.text_layer); layer_deinit(&peek_layer->layer); } void peek_layer_set_frame(PeekLayer *peek_layer, const GRect *frame) { layer_set_frame(&peek_layer->layer, frame); ...
/* * 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 binary + 'A'; }
6}, { -104, 688, 32}, { -80, 592, -24}, { 0, 344, 56}, { 104, 392, 24}, { 176, 520, 80}, { 216, 576, 64}, { 432, 816, -40}, { 184, 968, 200}, { 184, 1168, 256}, { 56, 1928, 200}, { 0, 1264, 112}, { 152, 1048, 64}, { 88, 984, 104}, { 40, 832, -16}, { -8, 608, -...
{ -32, 136, -144}, { -32, 96, -128}, { -120, 144, -128}, { -344, 536, -136}, { -704, 1112, -304}, { -936, 984, -384}, { -1256, 608, -288}, // 42 seconds { -1872, 616, -216}, { -1976, 632, -416}, { -1776, 688, -312}, { -1224, 688, -352}, { -904, -80, -224}, { -728,...
_init(&ctx, fb); // SW = 1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, OR...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"))
activities", num_activities_found); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_minute_data(int index, void *context) { HealthAPITestAppData *data = context; const uint32_t k_size = 1000; HealthMinuteData *minute_data = malloc(k_size...
health_service_sum_averaged(metric, day_start, day_start + SECONDS_PER_DAY, HealthServiceTimeScopeDailyWeekdayOrWeekend)
; snprintf(temp, sizeof(temp), "\nwday/end: %d", (int)avg); prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); // Weekly avg avg = health_service_sum_averaged(metric, day_start, day_start + SECONDS_PER_DAY, HealthServiceTimeScopeWeekly...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
system_reset()
; (void)data; } NORETURN system_hard_reset(void) { // Don't do anything fancy here. We may be in a context where nothing works, not even // interrupts. Just reset us. NVIC_SystemReset(); __builtin_unreachable(); }
ow.icon_layer, icon_reel, true); kino_layer_set_callbacks(&data->mic_window.icon_layer, (KinoLayerCallbacks) { .did_stop = prv_kino_reel_stopped_handler, }, data); layer_add_child(root_layer, (Layer *)&data->mic_window.icon_layer); layer_set_hidden((Layer *)&data->mic_window.icon_layer, true); }...
{ voice_window->show_confirmation_dialog = enabled; }
void voice_window_set_error_enabled(VoiceWindow *voice_window, bool enabled) { voice_window->show_error_dialog = enabled; } void voice_window_lose_focus(VoiceWindow *voice_window) { if (app_window_stack_get_top_window() == &voice_window->mic_window.window) { prv_mic_window_disappear(&voice_window->mic_window...
assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_fire_watchdog_timeouts(&device, GATT_CLIENT_DISCOVERY_MAX_RETRY); } void test_gatt_client_discovery__watchdog_retry_counter_not_affecting_successive_process(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start disco...
prv_connected_dummy_device(1)
okie); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__install_message_cookie_mismatch(void) { prv_receive_init_put_and_commit_fw_object(); prv_receive_install(~s_last_response_cookie); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__install_message_prf_boot_bit_set(voi...
cl_assert_equal_i(event.put_bytes.type, PebblePutBytesEventTypeInitTimeout)
; cl_assert_equal_i(event.put_bytes.object_type, ObjectUnknown); cl_assert_equal_i(event.put_bytes.total_size, 0); cl_assert_equal_i(event.put_bytes.progress_percent, 0); cl_assert_equal_b(event.put_bytes.failed, true); } /////////////////////////////////////////////////////////////////////////////////////////...
ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPoint(30, 30), DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_set_center_45.Xbit.pbi")); // Test ...
framebuffer_clear(fb)
te->test_entry.num_samples > 0) { return true; } else { return false; } } // --------------------------------------------------------------------------------------- static bool prv_parse_sleep_samples_file(SleepSampleDiscoveryState *state) { // Init for next set of samples state->test_entry = (SleepFi...
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.min); } else if (strcmp(token, "TEST_END_AT_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.max); } else if (strcmp(token, "TEST_CUR_STATE_ELAPSED") == 0) { sscanf(token + strlen(token...
} else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at); } else if (strcmp(token, "TEST_WEIGHT") == 0) { sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight); } else if (strcmp(token, "TE...
at the time the sample // was collected to the actual system time static uint64_t prv_get_sample_time_us(uint8_t sensor_time[3]) { uint64_t curr_time_us = prv_get_curr_system_time_ms() * 1000; uint32_t time_since_data_collection_us = prv_get_time_since_sample(sensor_time); BMI160_DBG("%"PRIu32" us delay since sa...
bmi160_read_reg(BMI160_REG_INT_LATCH)
); BMI160_DBG("Err reg = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_ERR)); BMI160_DBG("INT_MAP[0] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_0)); BMI160_DBG("INT_MAP[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_1)); BMI160_DBG("INT_EN[0] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_EN_0)); BMI160_DBG("IN...
t_timer = NULL; } static void prv_play_pause_long_click_start_handler(ClickRecognizerRef recognizer, void *context) { prv_toggle_playing(); prv_set_action_bar_state(context, ActionBarStateLongPress); prv_do_haptic_feedback_vibe(context); } static void prv_play_pause_long_click_end_handler(ClickRecognizerRef rec...
("START PLAYBACK\nON YOUR PHONE", window)
, fonts_get_system_font(config->no_music_font_key), GColorBlack, GColorClear, GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(&window->window.layer, &window->bitmap_layer.layer); layer_add...
/* * 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 GAP_DISC_MODE_LIM_DISCOVERABLE; }
else { return GAP_DISC_MODE_NON_DISCOVERABLE; } } ble_error_t advert_set_interval(uint16_t min_slots, uint16_t max_slots) { // No need to lock / take here, this API just sets a couple vars in ble_mgr_dev_params, // while holding the ble_mgr_dev_params lock. ble_error_t rv = ble_gap_adv_intv_set(min_slots,...
{BATTERY_SILHOUETTE_ICON_WIDTH - 1, 0}, {BATTERY_SILHOUETTE_ICON_WIDTH - 1, 1}, {BATTERY_SILHOUETTE_ICON_WIDTH + 1, 2}, {BATTERY_SILHOUETTE_ICON_WIDTH + 1, BATTERY_SILHOUETTE_ICON_HEIGHT - 3}, {BATTERY_SILHOUETTE_ICON_WIDTH - 1, BATTERY_SILHOUETTE_ICON_HEIGHT - 3}, {BATTERY_SILHOUETTE_...
launcher_app_glance_structured_create_subtitle_text_node( structured_glance, prv_battery_percent_dynamic_text_node_update)
; // Achieves the design spec'd 6 px horizontal spacing b/w the percent text and battery icon battery_percent_text_node->margin.w = 4; GTextNode *vertically_centered_battery_percent_text_node = prv_wrap_text_node_in_vertically_centered_container(battery_percent_text_node); graphics_text_node_con...
GAPLEClient client, HandleAndConnectionGetter handle_getter, PebbleBLEGATTClientEventType subtype) { BTErrno ret_val = BTErrnoOK; bt_lock(); { GAPLEConnection *connection; const uint16_t att_handle = handle_getter(obj_ref, &connection); if (!att_handle) { ret...
(cccd, (const uint8_t *) value, sizeof(*value), GAPLEClientKernel, gatt_client_descriptor_get_handle_and_connection, PebbleBLEGATTClientEventTypeCharacteristicSubscribe)
; } static bool prv_deinit_ctx_list(ListNode *node, void *unused) { kernel_free(node); return true; } void gatt_client_op_cleanup(GAPLEClient client) { bt_lock(); { // Free all memory associated with outstanding operations list_foreach(&s_client_event_ctxs[client]->node, prv_deinit_ctx_list, NULL); ...
/* * 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(kino_reel_get_elapsed(test_reel), 20)
; } void test_kino_player__create_finite_animation_finite_reel_foward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; Animation *animation = (Animation *)kino_player_create_play_animation(test_p...
StringList *values, int values_buf_size, int32_t avg_hr, int32_t *hr_zone_time_s) { const size_t hr_buf_size = 8; char hr_str[hr_buf_size]; if (avg_hr) { snprintf(hr_str, hr_buf_size, "%"PRIi32"", avg_hr); string_list_add_string(headings, headings_buf_size, ...
prv_add_active_calories_metric_info(headings, headings_buf_size, values, values_buf_size, session)
; prv_add_hr_metric_info(headings, headings_buf_size, values, values_buf_size, avg_hr, hr_zone_time_s); } else if (session->type == ActivitySessionType_Open) { type = ActivityInsightType_ActivitySessionOpen; icon = TIMELINE_RESOURCE_HEART; prv_add_metric_duration_info(headi...
55Axis axis) { uint8_t axis_bits; switch (axis) { case BMA255Axis_X: axis_bits = 0x01; break; case BMA255Axis_Y: axis_bits = 0x02; break; case BMA255Axis_Z: axis_bits = 0x03; break; default: WTF; } // g-range should be 4g for self-test bma255_set_sca...
(buf, 64, "(0x12) Low_Power: 0x%"PRIx8, lp)
}, { 160, 640, -760}, { 232, 1048, -960}, { 296, 904, -880}, { 280, 704, -848}, { 176, 528, -808}, { 56, 376, -688}, { 24, 336, -600}, { -8, 368, -576}, { -16, 432, -624}, { -32, 448, -688}, { -96, 376, -704}, { -136, 440, -792}, { -136, 512, -848}, // 92 seconds ...
{ 760, 304, -72}, { 824, 280, -72}, { 904, 264, -40}, { 1040, 232, -40}, { 1024, 168, -56}, { 1216, 152, -144}, { 1352, 88, -88}, { 1104, 112, -240}, { 1328, 200, -288}, { 1320, 200, -184}, { 1048, 248, -184}, { 880, 392, -280}, { 760, 424, -256}, { 696, 392, -232...
{ 1240, 216, -208}, { 1064, 400, -392}, { 824, 400, -344}, { 688, 472, -280}, { 712, 456, -304}, { 768, 504, -376}, { 808, 488, -432}, { 840, 528, -496}, // 100 seconds { 896, 544, -552}, { 968, 552, -416}, { 1352, 608, -264}, { 1296, 648, -264}, { 1328, 616, -23...
/* * 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 (alarm_a->info.hour == alarm_b->info.hour && alarm_a->info.minute > alarm_b->info.minute) { return true; }
_sequence_create(over_animation, settle_animation, NULL); animation_schedule(selection_layer->next_cell_animation); #else selection_layer->selected_cell_idx++; layer_mark_dirty(&selection_layer->layer); #endif } /////////////////////////////////////////////////////////////////////////////////////////////////// ...
animation_unschedule(selection_layer->next_cell_animation)
; animation_unschedule(selection_layer->value_change_animation); } void selection_layer_destroy(SelectionLayer* selection_layer) { if (selection_layer) { selection_layer_deinit(selection_layer); applib_free(selection_layer); } } void selection_layer_set_cell_width(SelectionLayer *selection_layer, unsign...
/* * 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_push(0); prv_test_backing_data(0, 0); prv_test_backing_data_empty(1); prv_test_backing_data_empty(2); prv_push(1); prv_test_backing_data(0, 0); prv_test_backing_data(1, 1); prv_test_backing_data_empty(2); prv_push(2); prv_test_backing_data(0, 0); prv_test_backing_data(1, 1); prv_test_bac...
void test_circular_cache__get(void) { prv_test_get_miss(0); prv_test_get_miss(1); prv_test_get_miss(2); prv_test_get_miss(3); prv_push(0); prv_test_get_hit(0, 0); prv_test_get_miss(1); prv_test_get_miss(2); prv_test_get_miss(3); prv_push(1); prv_test_get_hit(0, 0); prv_test_get_hit(1, 1); ...
_OUT_ANIMATION_DURATION); #if !defined(PLATFORM_TINTIN) // animate the dots Animation *crumbs_anim = crumbs_layer_get_animation(&data->crumbs_layer); animation_set_duration(crumbs_anim, IN_OUT_ANIMATION_DURATION); // combine the two Animation *spawn_anim = animation_spawn_create(content_in, crumbs_anim, NULL...
layer_add_child(window_get_root_layer(window), (Layer *)crumbs_layer)
; // Click config window_set_click_config_provider_with_context(window, prv_click_config_provider, data); // Init the view model data->view_model = (ActionMenuViewModel) { .cur_level = data->config.root_level, .menu_insets = prv_action_menu_insets(window), .num_dots = 1, }; prv_view_model_did_ch...
ills a full circle // here (on rect) it's just a small vertical stripe on the left frame.size.w = crumbs_layer_width(); #endif crumbs_layer_init(&data->crumbs_layer, &frame, data->config.colors.background, data->config.colors.foreground); // Add them to the tree layer_add_child(window_get_...
prv_action_window_push(window_stack, &data->action_menu, true /* animated */)
; return &data->action_menu; } ActionMenu *app_action_menu_open(ActionMenuConfig *config) { return action_menu_open(app_state_get_window_stack(), config); }
--------------------------------- // Set to not sleeping s_kalg_sleep_start_utc = 0; s_kalg_sleep_m = 0; activity_algorithm_metrics_changed_notification(); uint16_t steps_awake_60m; uint16_t steps_awake_100m; uint16_t steps_awake_120m; // Call the minute handler, which should zero out steps that occur...
if (i < 100) { cl_assert_equal_i(retrieve[i].steps, 0); } else { cl_assert_equal_i(retrieve[i].steps, minute_data[i].base.steps); }
cl_assert_equal_i(retrieve[i].orientation, minute_data[i].base.orientation); cl_assert_equal_i(retrieve[i].vmc, minute_data[i].base.vmc); cl_assert_equal_i(retrieve[i].light, ambient_light_level_to_enum( minute_data[i].base.light * ALG_RAW_LIGHT_SENSOR_DIVIDE_BY)); cl_assert_equal_i(retrieve[i].h...
r (int i = 0; i < num_sec; i++) { fake_rtc_set_ticks(rtc_get_ticks() + configTICK_RATE_HZ); rtc_set_time(rtc_get_time() + 1); if ((s_hrm_manager_update_interval == 1) || force_continuous) { PebbleHRMEvent hrm_event = { .event_type = HRMEvent_BPM, .bpm.bpm = bpm, .bpm.quality =...
activity_metrics_prv_get_median_hr_bpm(&median, &total_weight)
; cl_assert_equal_i(median, 0); cl_assert_equal_i(total_weight, 0); // Our previous median should be since we have no data (valid data) activity_get_metric(ActivityMetricHeartRateFilteredBPM, 1, &last_median); activity_get_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, &last_update_utc); cl_asser...
/* * 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...
{ memset(f->buffer, 0xff, framebuffer_get_size_bytes(f)); framebuffer_dirty_all(f); f->is_dirty = true; }
void framebuffer_mark_dirty_rect(FrameBuffer *f, GRect rect) { if (!f->is_dirty) { f->dirty_rect = rect; } else { f->dirty_rect = grect_union(&f->dirty_rect, &rect); } const GRect clip_rect = (GRect) { GPointZero, f->size }; grect_clip(&f->dirty_rect, &clip_rect); f->is_dirty = true; }
on; } static Animation* prv_create_slide_settle_animation(SelectionLayer *selection_layer) { Animation *animation = animation_create(); animation_set_curve(animation, AnimationCurveEaseOut); animation_set_duration(animation, SLIDE_SETTLE_DURATION_MS); AnimationHandlers anim_handler = { .stopped = prv_slide...
prv_selection_config()
->font_key), .active_background_color = DEFAULT_ACTIVE_COLOR, .inactive_background_color = DEFAULT_INACTIVE_COLOR, .is_active = true, }; for (unsigned i = 0; i < num_cells; i++) { selection_layer->cell_widths[i] = 0; } layer_create_with_data(*frame, sizeof(selection_layer)); layer_set_frame(&...
f, 0x00, }, }, .identity = (BTDeviceInternal) { .address = (BTDeviceAddress) { .octets = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, }, }, .is_classic = false, .is_random_address = false, }, .is_remote_identity_info_valid = true, }; const char *devic...
(name_2, name_out)
; cl_assert_equal_i(platform_bits_2, platform_bits_out); // Update first pairing (with the same data) BTBondingID id_X = bt_persistent_storage_store_bt_classic_pairing(&addr_1, &link_key_1, name_1, &platform_bits_1); cl_assert_equal_i(id_1, id_X); c...
ate) { return; } const PebbleProcessMd* system_app_state_machine_get_default_app(void) { return launcher_menu_app_get_app_info(); } void launcher_cancel_force_quit(void) { } void light_reset_user_controlled(void) { } void mpu_set_task_configurable_regions(MemoryRegion_t *task_params, const MpuRegion **region_pt...
app_manager_get_task_context()
->safe_to_kill = false; } void test_app_manager__start_third_party(void) { test_app_manager__start_first(); app_manager_launch_new_app(&(AppLaunchConfig) { .md = &s_third_party_app.common, }); // We've sent the deinit event to the first app, but it's going to continue running. cl_assert_equal_i(s_last_...
how heart rate sharing status!"); # endif // CAPABILITY_HAS_BUILTIN_HRM menu_cell_basic_draw(ctx, cell_layer, remote_name, connected_string, NULL); } #endif // PBL_ROUND static void draw_stored_remote_item(GContext *ctx, const Layer *cell_layer, uint16_t device_index, SettingsB...
("Now Discoverable", data)
/* * 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 (remaining) { int written = flash_impl_write_page_begin(buffer, start_addr, remaining); CD_ASSERTN(PASSED(written)); status_t status; while ((status = flash_impl_get_write_status()) == E_BUSY) { delay_us(10); } CD_ASSERTN(PASSED(status)); buffer += written; start_addr += writ...
return buffer_size; } void cd_flash_read_bytes(void* buffer_ptr, uint32_t start_addr, uint32_t buffer_size) { flash_impl_read_sync(buffer_ptr, start_addr, buffer_size); }
ask_count_callbacks(), 1); comm_session_send_next(session); cl_assert_equal_i(fake_system_task_count_callbacks(), 1); comm_session_send_next(session); cl_assert_equal_i(fake_system_task_count_callbacks(), 1); comm_session_send_next(session); cl_assert_equal_i(fake_system_task_count_callbacks(), 1); comm_s...
(invalid_session)
signed int vibe_interval_ms = vibe_score_get_duration_ms(s_phone_ui_data->vibe_score) + vibe_score_get_repeat_delay_ms(s_phone_ui_data->vibe_score); vibe_repeat_interval_sec = DIVIDE_CEIL(vibe_interval_ms, MS_PER_SECOND); #else vibe_repeat_interval_sec = 2; #endif prv_ring(NULL); regular_timer_add_multise...
("Call Ended", s_phone_ui_data->call_status_text_buf, CALL_STATUS_BUFFER_LENGTH)
; } else { i18n_get_with_buffer("Call Declined", s_phone_ui_data->call_status_text_buf, CALL_STATUS_BUFFER_LENGTH); } } text_layer_set_text(&s_phone_ui_data->call_status_text_layer, s_phone_ui_data->call_status_text_buf); prv_show_call_status(); } /...
; if (*end) { prompt_send_response("Invalid color"); return; } mfg_info_set_watch_color(color); const WatchInfoColor written_color = mfg_info_get_watch_color(); if (written_color == color) { prompt_send_response("OK"); } else { prompt_send_response("ERROR"); } } void command_disp_offse...
BLTEST_LOG("STAGE 1 -- Copying STAGE 2 to PRF")
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kino_reel_scale_segmented_set_delay_by_distance(new_reel, GPoint(0, icon_to.size.h / 2))
; prv_change_reel(card_timeline_layout, new_reel); kino_layer_play_section(&card_timeline_layout->icon_layer, duration / 2, duration); kino_layer_set_callbacks(&card_timeline_layout->icon_layer, (KinoLayerCallbacks) { .did_stop = prv_pin_to_card_second_half_stopped, }, card_timeline_layout); } static voi...
{ -360, 848, 296}, { -368, 856, 304}, { -376, 848, 304}, { -384, 864, 312}, { -392, 880, 312}, { -384, 880, 320}, { -368, 864, 312}, { -368, 872, 304}, { -360, 864, 320}, { -360, 856, 320}, { -368, 864, 336}, { -368, 872, 336}, { -360, 872, 328}, { -360, 832, 328}...
{ -320, 880, -80}, { -312, 896, -72}, { -312, 928, -88}, { -312, 896, -120}, { -336, 904, -96}, { -328, 928, -128}, { -352, 912, -24}, // 176 seconds { -336, 928, -48}, { -328, 928, -56}, { -320, 944, -48}, { -312, 912, -32}, { -296, 928, -80}, { -312, 944, -24},...
/* * 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 (font_key && PRIVILEGE_WAS_ELEVATED) { if (!memory_layout_is_cstring_in_region(memory_layout_get_app_region(), font_key, 100) && !memory_layout_is_cstring_in_region(memory_layout_get_microflash_region(), font_key, 100)) { PBL_LOG(LOG_LEVEL_ERROR, "Pointer %p not in app or microflash region", fo...
DEFINE_SYSCALL(void, sys_font_reload_font, FontInfo *fontinfo) { if (PRIVILEGE_WAS_ELEVATED) { if (!memory_layout_is_pointer_in_region(memory_layout_get_readonly_bss_region(), fontinfo)) { syscall_failed(); } } text_resources_init_font(fontinfo->base.app_num, fontinfo->base.resource_id, fon...
/* * 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...
has_max_interval_passed(ctx)
) { prv_send_request(ctx); } } static void start(PollRemoteContext *ctx) { ctx->counted_minutes = 0; } static void set_intervals(PollRemoteContext *ctx, const uint8_t min_interval_minutes, const uint8_t max_interval_minutes) { ctx->min_interval_minutes = min_interval_minutes; ctx->max_interval_minutes = ...
nt32_t progress, uint32_t total, void *ctx) { display_firmware_update_progress(progress/2 + total/2, total); } static bool write_new_firmware( uint32_t firmware_start_address, uint32_t firmware_length) { dbgserial_putstr("write_new_firmware"); return system_flash_write( FIRMWARE_BASE, (void *)(FMC_BANK...
dbgserial_putstr("Loading recovery firmware")
; UpdateFirmwareResult result = update_fw(FLASH_REGION_SAFE_FIRMWARE_BEGIN); bool recovery_fw_ok = true; switch (result) { case UPDATE_FW_SUCCESS: boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); boot_bit_set(BOOT_BIT_RECOVERY_START_IN_...
= &text_node.node; s_data.max_used_size = TEST_TEXT_SIZE; GSize size; graphics_text_node_get_size(&text_node.node, ctx, &TEST_TEXT_BOX, NULL, &size); cl_assert(size.w > 0); cl_assert(size.h > 0); cl_assert_equal_i(size.w, TEST_TEXT_SIZE.w); cl_assert_equal_i(size.h, TEST_TEXT_SIZE.h); } static int s_nu...
graphics_text_node_container_add_child(&vertical_a->container, &horizontal_a->container.node)
); cl_assert(graphics_text_node_container_add_child(&vertical_a->container, &custom_a->node)); cl_assert(!graphics_text_node_container_add_child(&vertical_a->container, &text_c.node)); cl_assert_equal_i(vertical_a->container.num_nodes, 2); graphics_text_node_destroy(&vertical_a->container.node); task_free((...
/* * 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...
(TEST_FILE_A_NAME, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(s_test_file_a))
; pfs_write(fd, (uint8_t *)s_test_file_a, sizeof(s_test_file_a)); pfs_close(fd); memset(s_test_file_b, 0, sizeof(s_test_file_b)); fd = pfs_open(TEST_FILE_B_NAME, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(s_test_file_b)); pfs_close(fd); fd = pfs_open(TEST_FILE_C_NAME, OP_FLAG_WRITE, FILE_TYPE_STATIC, ...
art_page = free_region_start }; PBL_LOG(LOG_LEVEL_DEBUG, "New Erase Region: %d", s_gc_block.gc_start_page); return (true); } return (false); } return (true); // gc block must be valid to get here } static bool watch_list_find_str(ListNode *node, void *data) { PFSFileChangedCallbackNod...
(s_pfs_mutex)
; return (res); } status_t pfs_close_and_remove(int fd) { mutex_lock_recursive(s_pfs_mutex); status_t res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; } else { File *f = &PFS_FD(fd).file; char file_name[f->namelen + 1]; file_name[f->namelen] = '\0'; memcpy(file_name, f->na...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (data->timer) { app_timer_cancel(data->timer); const bool animated = true; app_window_stack_pop_all(animated); }
app_free(data); } static void prv_window_load(Window *window) { SplashScreenData *data = window_get_user_data(window); Layer *window_root_layer = &window->layer; KinoLayer *logo_layer = &data->logo_layer; kino_layer_init(logo_layer, &window_root_layer->bounds); kino_layer_set_reel_with_resource(logo_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...
(prv_is_session_task())
/* * 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...
ADC_ClearFlag(ADC1, ADC_FLAG_EOC)
; return false; } } return true; } void voltage_monitor_read(const VoltageMonitorDevice *device, VoltageReading *reading_out) { PBL_ASSERTN(device->adc == ADC1); mutex_lock(s_adc_mutex); periph_config_enable(ADC1, RCC_APB2Periph_ADC1); ADC_TempSensorVrefintCmd(ENABLE); ADC_CommonInitTypeDef A...
PI_BaudRatePrescaler = SPI_BaudRatePrescaler_2; spi_cfg.SPI_FirstBit = SPI_FirstBit_MSB; spi_cfg.SPI_CRCPolynomial = 7; SPI_Init(FLASH_CONFIG.spi, &spi_cfg); SPI_Cmd(FLASH_CONFIG.spi, ENABLE); gpio_release(FLASH_CONFIG.spi_gpio); } static void prv_flash_start_cmd(void) { gpio_use(FLASH_CONFIG.spi_gpio); ...
prv_flash_end_cmd()
; prv_disable_flash_spi_clock(); }
al_s("IN 1 MIN", time_buf); // June 9th 2015, 15:58:00 (T-00:02:00) rtc_set_time(event_time - (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_tim...
rtc_set_time(event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR))
; clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Tue, 4:00 PM", time_buf); // June 16th 2015, 17:00:00 (T+7DAY+01:00:00) rtc_set_time(event_time + (7 * SECONDS_PER_DAY) + (1 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time,...
ent->characteristics.meta == characteristics[i] || client->characteristics.data == characteristics[i]) { client_removed = true; prv_delete_client(client, true, DeleteReason_ServiceRemoved); break; } } client = next; } // PBL-42768 - In the logs in t...
{ bool is_data = false; PPoGATTClient *client = prv_find_client_with_characteristic(characteristic, &is_data); if (!client) { PBL_LOG(LOG_LEVEL_DEBUG, "Got notification/read for unknown client"); goto unlock; } if (is_data) { prv_handle_data_notification(client, value, value_length...
unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- static PPoGATTPacket * prv_lazily_allocate_packet_if_needed(const PPoGATTClient *client, PPoGATTPacket **heap_packet_in_out) { PP...
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 "jerry-api.h" #include "rocky_api_graphics.h" #include "rocky_api_graphics_path2d.h" #include "rocky_api_graphics_text.h" #inclu...
layer_mark_dirty(&top_window->layer)
84, -232}, { 984, 1240, -288}, { 592, 1280, -296}, { 936, 1248, -176}, { 984, 856, -104}, { 1184, 888, -112}, { 1440, 728, -104}, { 1576, 592, -88}, { 1408, 432, -128}, { 1336, 360, -144}, { 1352, 360, -128}, { 1416, 320, -80}, { 1464, 264, -96}, { 1304, 248, -72}, ...
{ 904, -168, -152}, { 632, -320, -40}, { 1056, 72, -304}, { 1264, 40, -192}, { 1272, 384, -304}, { 1136, 176, -280}, { 1112, 368, -312}, { 1288, 512, -248}, { 1456, 632, -400}, { 1464, 864, -352}, { 1120, 976, -568}, { 808, 984, -664}, // 50 seconds { 696, 768, -5...
{ 1496, 736, -120}, { 1384, 480, -64}, { 1192, 384, -104}, { 1216, 336, -136}, { 1376, 368, -136}, { 1600, 328, -64}, { 1520, 240, -48}, { 1264, 248, -96}, { 880, -152, -96}, { 544, -232, -248}, { 648, -408, 72}, { 928, -112, -176}, { 1064, 128, -256}, { 1328, 42...
mutex_unlock(s_flash_lock); } // Returns 0 if the erase has completed, or a non-zero expected duration (in // ms) if not. If the erase has not finished (non-zero has been returned), the // caller is responsible for calling the prv_flash_erase_poll() method until // the erase completes. static uint32_t prv_flash_erase_...
(LOG_LEVEL_DEBUG, "Erase of 0x%"PRIx32" failed (attempt %d)." " Trying again...", saved_ctx.address, saved_ctx.retries)
; return prv_flash_erase_start( saved_ctx.address, saved_ctx.on_complete_cb, saved_ctx.cb_context, saved_ctx.is_subsector, saved_ctx.retries + 1); } else { // Only run the callback with no locks held so that the callback won't // deadlock if it kicks off another sector erase. saved_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...
dbgserial_putstr("")
; reset_due_to_software_failure(); } //! Assert function called by the STM peripheral library's //! 'assert_param' method. See stm32f2xx_conf.h for more information. void assert_failed(uint8_t* file, uint32_t line) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; prv_handle_passert_failed((const ...
re as follows: // R0-R12 = Unknown // MSP = VECTOR_TABLE[0] (main stack pointer) // PSP = Unknown (process stack pointer) // LR = 0xFFFFFFFF // PC = VECTOR_TABLE[1] // PRIMASK = 0x0 // FAULTMASK = 0x0 // BASEPRI = 0x0 // CONTROL = 0x0 // // Attempt to put the pr...
(BUTTON_ID_DOWN)
); } static bool prv_check_force_boot_recovery(void) { if (boot_bit_test(BOOT_BIT_FORCE_PRF)) { boot_bit_clear(BOOT_BIT_FORCE_PRF); return true; } if (prv_prf_button_combination_is_pressed()) { dbgserial_putstr("Hold down UP + BACK + SELECT for 5 secs. to force-boot PRF"); for (int i = 0; i < 50...
/* * 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 (!is_finished) { TimelineLayer *layer = (TimelineLayer *)context; prv_rel_bar_reset_offsets(&layer->relbar_layer, RelationshipBarOffsetTypeBoth); }
} #define REL_BAR_VERT_MARGIN 14 static int prv_get_line_length(TimelineLayer *timeline_layer, GRect *first_icon_frame_out, GRect *second_icon_frame_out) { GRect first_icon_frame; GRect second_icon_frame; timeline_layer_get_icon_frame(timeline_layer, TIMELINE_LAYER_FIRST_VISIBLE_L...
_enqueue((const uint8_t *)message, message->message_length); if (status != HostTransportEnqueueStatus_RetryLater) { success = (status == HostTransportEnqueueStatus_Success); goto done; } TickType_t remaining_ticks = prv_remaining_ticks(TIMEOUT_TICKS, start_ticks); bool is_timeout; if ...
milliseconds_to_ticks(HC_PROTOCOL_DEFAULT_CTL_ENDPOINT_RESPONSE_TIMEOUT_MS)
. //! The writer can set it to anything they want, mostly for debugging purposes. void *writer; bool write_failed; bool has_pending_event; uint32_t num_failed; uint32_t num_success; struct { //! The size of `storage`. size_t size; //! The positive offset relative relative to write_index, up...
app_inbox_service_register(storage, storage_size, message_handler, dropped_handler, service_tag)
; } DEFINE_SYSCALL(uint32_t, sys_app_inbox_service_unregister, uint8_t *storage) { // No check is needed on the value of `storage `, we're not going to derefence it. return app_inbox_service_unregister_by_storage(storage); } static bool prv_get_consumer_info(AppInboxServiceTag tag, AppInboxConsumerInfo *info_in_o...