prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
GAPLEAdvertisingJobTerm) * num_terms); memcpy(job->terms, terms, sizeof(GAPLEAdvertisingJobTerm) * num_terms); memcpy(job->payload.data, payload->data, payload->ad_data_length + payload->scan_resp_data_length); PBL_LOG(LOG_LEVEL_INFO, "Scheduling advertising job: %s", prv_string_for_debug_ta...
regular_timer_pending_deletion(&s_cycle_regular_timer)
); s_gap_le_advert_is_initialized = false; } bt_unlock(); } // ----------------------------------------------------------------------------- void gap_le_advert_handle_connect_as_slave(void) { bt_lock(); { if (!s_gap_le_advert_is_initialized) { goto unlock; } // The link layer state machin...
the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ...
property_animation_get_to_int16(item_layer->animation, &offset)
; if (offset == new_offset) { return; } animation_unschedule(property_animation_get_animation(item_layer->animation)); } if (item_layer->animation) { property_animation_init(item_layer->animation, &implementation, item_layer, NULL, &new_offset); } else { item_layer->animation = property...
worker_segment.end, /* enable_heap_fuzzing */ false); heap_set_lock_impl(worker_heap, (HeapLockImpl) { .lock_function = prv_heap_lock, }); process_heap_set_exception_handlers(worker_heap, app_md); // Init services required for this process before it starts to execute process_manager_proces...
worker_manager_launch_next_worker(closing_worker_install_id)
; return; } // We arrive here if the worker crashed... // If the worker's app is in the foreground, close it if (closing_worker_install_id == app_manager_get_current_app_id()) { app_manager_force_quit_to_launcher(); } else { const time_t current_time = rtc_get_time(); const time_t WORKER_CRA...
, // 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_CLKDivision = 15, // Not used for async NOR .FMC...
prv_switch_flash_mode(&nor_init)
; prv_poll_for_ready(0); flash_impl_release(); return S_SUCCESS; } status_t flash_impl_blank_check_sector(FlashAddress addr) { // FIXME: Blank check operation is only allowed in asynchronous mode. Fall // back to a software blank check in synchronous mode. const FlashAddress base_addr = flash_impl_get_se...
n_bits(void) { uint8_t counter = (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_THREE) << 2) | (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_TWO) << 1) | boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_ONE); switch (++counter) { case 1: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 2: boot_...
if (button_state != prev_button_state) { system_reset(); }
delay_ms(10); } } static void prv_print_reset_reason(void) { dbgserial_print("Reset Register "); dbgserial_print_hex(RCC->CSR); dbgserial_newline(); if (RCC_GetFlagStatus(RCC_FLAG_BORRST) == SET) { dbgserial_putstr("Brown out reset"); } } // SystemInit does this for the firmware, but since the b...
_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; // size value cl_assert(TEST_VALUE_SIZE =...
cl_assert((resp_ptr - s_data) == s_sending_data_length)
; } /************************************************** * Checking for length data mismatch INSERT command * **************************************************/ static const uint8_t s_insert_cmd_size_value_wrong[] = { // Message Header 0x01, // Pebble protocol message ID: INSERT 0x17, 0x00...
mcmp(&num, &test_num, sizeof(Fixed_S16_3)) == 0); num = (Fixed_S16_3){ .raw_value = (int16_t)((float)-2 * (1 << FIXED_S16_3_PRECISION)) }; test_num = (int16_t)((float)-2 * (1 << FIXED_S16_3_PRECISION)); cl_assert(memcmp(&num, &test_num, sizeof(Fixed_S16_3)) == 0); num = (Fixed_S16_3){ .raw_value = (int16_t)((...
(num.fraction == 7)
; test_num = (int16_t)((float)1 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == 1); cl_assert(num.fraction == 0); test_num = (int16_t)((float)1.125 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer...
= { { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = 1, }, { .min_interval_slots = 480, .max_interval_slots = 960, .duration_secs = 1, }, { .min_interval_slots = GAPLE_ADVERTISING_SILENCE_INTERVAL_SLOTS, .max_interval_slots = ...
(s_unscheduled_completed, true)
; } void test_gap_le_advert__job_round_robin_multiple_terms(void) { GAPLEAdvertisingJobTerm advert_terms[2] = { { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = 5, }, { .min_interval_slots = 480, .max_interval_slots = 620, .duration_secs = 5,...
ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "services/common/comm_session/default_kernel_sender.h" #include "services/common/comm_session/session_send_buffer.h" #include "services/c...
comm_session_send_buffer_get_max_payload_length(&s_session)
/* * 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...
{ const uint32_t new_ms = s_time_ms_base + inc; if (new_ms >= 1000) { s_time_base += new_ms / 1000; } s_time_ms_base = new_ms % 1000; }
void fake_rtc_set_ticks(RtcTicks new_ticks) { s_rtc_tick_count = new_ticks; } void fake_rtc_increment_ticks(RtcTicks tick_increment) { s_rtc_tick_count += tick_increment; } void fake_rtc_auto_increment_ticks(RtcTicks auto_increment) { s_rtc_auto_increment = auto_increment; }
value - 1); record_func(ctx, y, x1, x2, src_color); } } cl_assert(graphics_context_mask_record(ctx, NULL)); test_graphics_context_mask_debug(ctx, mask); graphics_context_mask_destroy(ctx, mask); } /////////////////////////////////////// // RECORDING VERTICAL LINE HELPERS // /////////////////////...
(ctx, mask, mask_pixel_value, GPoint(x, y))
; } } return mask; } typedef void (*HorizontalClippingMaskApplyFunc)(GContext *ctx, int16_t y, int16_t x1, int16_t x2, GColor color); static void prv_mask_apply_hline_test_pattern(HorizontalClippingMaskApplyFunc apply_func) { GContext *ctx = s_ctx; prv_pre...
/* * 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...
raw_image_get_value_for_bitdepth(test0, 7, 0, 1, 1)
== 0); cl_assert(raw_image_get_value_for_bitdepth(test0, 0, 0, 1, 2) == 3); cl_assert(raw_image_get_value_for_bitdepth(test0, 0, 0, 1, 4) == 12); cl_assert(raw_image_get_value_for_bitdepth(test0, 0, 0, 1, 8) == 192); cl_assert(raw_image_get_value_for_bitdepth(test0, 0, 0, 1, 1) == 1); cl_assert(raw_image_get...
.rx_dma = &DIALOG_SPI_RX_DMA_REQUEST, .tx_dma = &DIALOG_SPI_TX_DMA_REQUEST }; SPISlavePort * const DIALOG_SPI = &DIALOG_SPI_SLAVE_PORT; // // iCE40LP configuration // static ICE40LPDeviceState s_ice40lp_state; static ICE40LPDevice ICE40LP_DEVICE = { .state = &s_ice40lp_state, .spi_port = &ICE40LP_SPI_SLAVE_P...
voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY)
; qspi_init(QSPI, BOARD_NOR_FLASH_SIZE); }
whitespace(GContext* ctx, Word* word, const TextBoxParams* const text_box_params) { while (word_trim_preceeding_codepoint(ctx, word, SPACE_CODEPOINT, text_box_params)); } //////////////////////////////////////////////////////////// // Walk Line typedef void (*CharVisitorCallback)(GContext* ctx, const TextBoxParams*...
{ GRect cursor = { .origin = line->origin, .size.w = next_glyph_width_px, .size.h = fonts_get_font_height(text_box_params->font) }; cursor.origin.x += walked_width_px; char_visitor_cb(ctx, text_box_params, line, cursor, current_codepoint); walked_width_px += next_glyph_width_px; ...
// Trim trailing whitespace if (last_visited_char) { while ((current_codepoint == NEWLINE_CODEPOINT || current_codepoint == SPACE_CODEPOINT)) { // Newlines should not adjust the width if (current_codepoint == NEWLINE_CODEPOINT) { next_glyph_width_px = 0; } else { next_glyph_w...
; static AppInstallId s_last_worker_crashed_install_id; static time_t s_last_worker_crash_timestamp; static bool s_worker_crash_relaunches_disabled; // --------------------------------------------------------------------------------------------- void worker_manager_init(void) { s_to_worker_event_queue = xQueueCreat...
(&worker_ram)
- stack_guard_size); MemorySegment worker_segment; PBL_ASSERTN(memory_segment_split(&worker_ram, &worker_segment, worker_segment_size)); PBL_ASSERTN(memory_segment_split(&worker_segment, NULL, stack_guard_size)); // No (accessible) memory segments can be placed between the t...
sh_state.enabled) { flash_unlock(); return; } analytics_read_count++; analytics_read_bytes_count += buffer_size; power_tracking_start(PowerSystemFlashRead); enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_wait_for_write(); flash_start_cmd(); flash_send_and_receive_byte(FLA...
flash_write_enable()
; flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_ERASE_SECTOR); flash_send_24b_address(sector_addr); flash_end_cmd(); flash_wait_for_write(); prv_check_protection_flag(); disable_flash_spi_clock(); power_tracking_stop(PowerSystemFlashErase); flash_unlock(); } // It is dangerous to leav...
nc_obj_val, const jerry_value_t this_val, const jerry_value_t args_p[], jerry_size_t args_count) { return (func_obj_p)(func_obj_val, this_val, args_p, args_count); } jerry_value_t je...
__jerryRefs.getNativeHandle($0)
; if (ptr === undefined) { return false; } Module.setValue($1, ptr, '*'); return true; }, obj_val, out_handle_p); } void jerry_set_object_native_handle(const jerry_value_t obj_val, uintptr_t handle_p, jerry_object_free_callback_t freecb_p) { EM_ASM_INT({ ...
ruct GTextNodeTestData { GContext gcontext; GRect clip_box; GTextNode *text_node; GSize max_used_size; } GTextNodeTestData; GTextNodeTestData s_data; #define TEST_TEXT "DUMMY TEXT" #define TEST_FONT ((void *)0xf0a7f0a7) #define TEST_TEXT_SIZE GSize(50, 18) #define TEST_TEXT_BOX GRect(10, 10, 140, 200) void g...
cl_assert_equal_i(size.w, TEST_TEXT_SIZE.w)
; cl_assert_equal_i(size.h, TEST_TEXT_SIZE.h); cl_assert_equal_i(size.w, custom_node.node.cached_size.w); cl_assert_equal_i(size.h, custom_node.node.cached_size.h); cl_assert_equal_i(s_num_draw_custom_calls, 1); graphics_text_node_get_size(&custom_node.node, ctx, &TEST_TEXT_BOX, NULL, &size); cl_assert(siz...
ate_proc(&layer, &clear_layer_update_callback); layer_render_tree(&layer, &ctx); #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_clear"))); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } #define MAX...
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_origin_even_clip"))); // Clipping on odd boundaries - no offset setup_test_aa_sw(&ct...
#define OFFSET_RECT_EVEN GRect(14, 14, MAX_NUM_COLS, MAX_NUM_ROWS) #define OFFSET_RECT_ODD GRect(15, 15, MAX_NUM_COLS, MAX_NUM_ROWS) #define OFFSET_RECT_CLIP_EVEN GRect(10, 10, 60, 60) #define OFFSET_RECT_CLIP_ODD GRect(11, 11, 61, 61) void test_graphics_draw_line___even_offset_horizon...
struct Window *window, ClickConfigProvider click_config_provider, void *context) {} void window_set_click_context(ButtonId button_id, void *context) {} void window_single_repeating_click_subscribe( ButtonId button_id, uint16_t repeat_interval_ms, ClickHandler handler) {} // Internal definitions ////////////////...
scroll_layer_set_content_size(scroll_layer, GSize(180, 2000))
; scroll_layer_scroll(scroll_layer, ScrollDirectionDown, false); // scroll offset for scroll down is negative, so invert offset.y cl_assert_equal_i(page_height, -((int32_t)scroll_layer_get_content_offset(scroll_layer).y)); } void test_scroll_layer__paging_last_pages_content(void) { uint16_t page_height = 86; ...
cense is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "hc_protocol/hc_endpoint_gap_service.h" #include "comm/ble/gap_le_connection.h" #i...
hc_protocol_enqueue_with_payload_and_expect(HcEndpointID_GapService, msg_id, NULL, 0)
; if (response) { HcProtocol_GapServiceGeneratePrivateResolvableAddressResponse *payload = (HcProtocol_GapServiceGeneratePrivateResolvableAddressResponse *) response->payload; *address_out = payload->address; success = true; } kernel_free(response); return success; }
/* * 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...
shared_prf_storage_get_ble_pairing_data(&existing_pairing_info, NULL, NULL, NULL)
) { if (sm_is_pairing_info_equal_identity(new_pairing_info, &existing_pairing_info)) { // Treat re-pairing an existing device as an "update" instead of deletion+addition, // because there is only one bonding ID that gets re-used, a deletion would otherwise cause a // disconnection to happen. See P...
// -------------------------------------------------------------------------------------- // Test a sequence within a sequence where the imbedded one has a play count of 0 void test_animation__nested_sequence_with_0_play_count(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b =...
(a, duration_a)
; Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); // Create a spawn Animation *spawn = animation_sequence_create(a, b, NULL); cl_assert(spawn != NULL); animation_set_play_count(spawn, play_count_spawn); // Check the duration cl_assert_equal_i(animation_get_duration(...
/* * 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...
{ state->handler(&currtime, units_changed); }
} void tick_timer_service_init(void) { TickTimerServiceState *state = prv_get_state(PebbleTask_Unknown); state->handler = NULL; event_service_init(PEBBLE_TICK_EVENT, &tick_timer_add_subscriber, &tick_timer_remove_subscriber); } void tick_timer_service_subscribe(TimeUnits tick_units, TickHandler handler) { Ti...
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 2); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_R...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, tr...
ot_disturb_toggle_push(ActionTogglePrompt prompt, bool set_exit_reason) { do_not_disturb_set_manually_enabled(!do_not_disturb_is_active()); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Helper Functions static void prv_assert_settings_value(const void *key...
cl_assert(active == true)
PEED_PER_FRAME); if (data->point_p0.y < 0 || data->point_p0.y > data->window.layer.bounds.size.h) { data->point_velocity_y = data->point_velocity_y * -1; } } else if (shape == LINE) { // Move the line 2*X per Y data->line_p0.x += (data->line_velocity_x * PIXEL_SPEED_PER_FRAME * 2); ...
{ data->triangle_velocity_x = data->triangle_velocity_x * -1; }
data->triangle_offset.y += (data->triangle_velocity_y * PIXEL_SPEED_PER_FRAME); if (data->triangle_offset.y < 0 || data->triangle_offset.y > data->window.layer.bounds.size.h) { data->triangle_velocity_y = data->triangle_velocity_y * -1; } gpath_move_to(data->triangle, data->t...
otification_dict_uid; prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); } static void prv_send_notification(const uint8_t *ancs_notification_dict) { prv_send_notification_with_event_flags(ancs_notification_dict, 0); } static uint8_t *prv_serialize_timeline_item(TimelineItem...
if (strcmp((const char *)cmd_header->data, "com.tests.NotAnApp") == 0) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_fake_app_info_dict), (uint8_t *)s_fake_app_info_dict); } else { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_app_info_dict), ...
return BTErrnoOK; } // else: notif request uint32_t uid = ((GetNotificationAttributesMsg *)buffer)->notification_uid; s_num_requested_notif_attributes++; if (uid == comple_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_complete_dict), (uint8_t*) s_complete_dict); s_num_ds_notific...
_wakeup(); cl_assert_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 ...
(s_last_timeline_item_added->header.timestamp, 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); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ for (unsigned int i = 0; i < length; i++) { for (unsigned int j = i+1; j < length; j++) { if (values[i] > values[j]) { swap16(&values[i], &values[j]); } } } }
/* * 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...
{ WTF; }
const int name_x = drawing_rect.origin.x + PBL_IF_RECT_ELSE(0, (rl_margin / 2)); const int name_y = PBL_IF_RECT_ELSE(107, 109); GRect name_rect = GRect(name_x, name_y, drawing_rect.size.w, 32); graphics_context_set_text_color(ctx, TEXT_COLOR); graphics_draw_text(ctx, name, font, name_rect, overflow_mode, al...
(RESOURCE_ID_ACTION_BAR_ICON_START)
; summary_window->action_bar_more = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_MORE); action_bar_layer_set_icon(action_bar, BUTTON_ID_UP, summary_window->action_bar_start); action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, summary_window->action_bar_more); workout_summary_update_activi...
ek // Otherwise the selection is last week if either the selection is Sunday // or if the selection is greater than the current day return (((int)graph_card->current_day == graph_card->selection && graph_card->day_data[0] == 0) || ((graph_card->current_day == Sunday) ? false : ((int)graph_car...
(graph_card, ctx)
; prv_draw_avg_lines(graph_card, ctx); prv_draw_info(graph_card, ctx); } HealthGraphCard *health_graph_card_create(const HealthGraphCardConfig *config) { HealthGraphCard *graph_card = app_zalloc_check(sizeof(HealthGraphCard)); if (graph_card) { layer_init(&graph_card->layer, &GRectZero); layer_set_upda...
atic void down_click_handler(ClickRecognizerRef recognizer, void *context) { } // ------------------------------------------------------------------------------- static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); window_single_click_subscribe(...
text_layer_set_font(data->cur_temp_layer, fonts_get_system_font(FONT_KEY_LECO_20_BOLD_NUMBERS))
; text_layer_set_background_color(data->cur_temp_layer, GColorClear); text_layer_set_text_color(data->cur_temp_layer, GColorBlack); layer_add_child(window_layer, text_layer_get_layer(data->cur_temp_layer)); // Current temp range data->temp_range_layer = text_layer_create(TEMP_RANGE_RECT); text_layer_set_te...
call_count, 0); cl_assert_equal_i(s_out_failed_call_count, 1); cl_assert_equal_i(s_failure_result, APP_MSG_SEND_TIMEOUT); // Check the state is reset properly cl_assert_equal_b(app_message_is_accepting_outbound(), true); } void test_app_message__send_rejected(void) { // Sending ack on timeout, but reject th...
prv_send_test_data()
; // Close the AppMessage context app_message_close(); // Make fake remote send the ack if something has been sent (not expected) prv_process_sent_data(); // Test that timer has been invalidated cl_assert_equal_b(!fake_app_timer_is_scheduled(app_message_ack_timer_id()), true); cl_assert_equal_b(s_ack_s...
p data that is passed to the controller is the same // that was given when calling the API: Scan_Response_Data_t scan_resp_data_out; cl_assert_equal_i(gap_le_get_scan_response_data(&scan_resp_data_out), sizeof(scan_resp_data)); cl_assert(memcmp(&scan_resp_data_out, scan_resp_data, ...
assert_ad_data(ad_data)
; // Check that the scan resp data that is passed to the controller is the same // that was given when calling the API: Scan_Response_Data_t scan_resp_data_out; cl_assert_equal_i(gap_le_get_scan_response_data(&scan_resp_data_out), sizeof(scan_resp_data)); cl_assert(memcmp(&scan_resp_data_...
cel_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:%u " "ppg_readings:%u accel_readings %"PRIu32,...
(quality_tl, GTextAlignmentCenter)
TIM_CounterMode_Up; TIM_TimeBaseInit(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, &tim_config); TIM_Cmd(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, DISABLE); TIM_ClearITPendingBit(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update); TIM_ITConfig(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update, ENABLE);...
PBL_LOG(LOG_LEVEL_ERROR, "CRC failed on remote SPI Receive 0x%08" PRIX32 " != 0x%08" PRIX32, crc, s_spi_transport.rx_footer.crc)
; prv_trigger_core_dump_from_isr(); } bool should_give_semaphore = false; if (s_spi_transport.bytes_sendable_count) { prv_watchdog_start(); s_spi_transport.state = SPITransportState_WaitingForSending; } else { // Nothing to send, we're done: s_spi_transport.state = SPITransportState_Idle; ...
/* * 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...
layer_add_child(window_layer, scroll_layer_get_layer(&data->scroll_layer))
; // This binds the scroll layer to the window so that up and down map to scrolling // You may use scroll_layer_set_callbacks to add or override interactivity scroll_layer_set_click_config_onto_window(&data->scroll_layer, window); // Initialize the first text layer text_layer_init(&data->text_layer_1, &GRec...
all_day_items[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id)); cl_assert(!uuid_equal(&first_all_day_event, &state.pin.header.id)); cl_assert(state.node->all_day); cl_assert_equal_i(state.pin.header.timestamp, 1421136000); // back to the first cl_assert(iter_prev(&iterato...
timeline_init(&head)
; cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, 1421183640), 0); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check all day events cl...
session_send_buffer_begin_write(session, ENDPOINT_ID, required_length, COMM_SESSION_DEFAULT_TIMEOUT); if (!sb) { PBL_LOG(LOG_LEVEL_DEBUG, "Failed to get send buffer"); return false; } BluetoothHeader header = { .command = 0x80, .cookie = s_b...
(build_id_string, 64)
; DEBUG_LOG(LOG_LEVEL_INFO, "BUILD ID: %s", build_id_string); debug_reboot_reason_print(mcu_reboot_reason); } void debug_print_last_launched_app(void) { // Get the slot of the last launched app // so we know what was running when we rebooted uint32_t last_launched_app_slot = reboot_get_slot_of_last_launched...
/* * 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...
strtoX_core(nptr, NULL, 10, false, INT_MAX, INT_MIN)
; } long int atol(const char *nptr) { return strtoX_core(nptr, NULL, 10, false, INT_MAX, INT_MIN); }
/* * 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_data.bundle_id, &app_data_out)
; cl_assert_equal_s(app_data.bundle_id, app_data_out.bundle_id); cl_assert_equal_i(app_data.flags, app_data_out.flags); cl_assert_equal_s(app_data.display_name, app_data_out.display_name); ancs_app_destroy_buffer(&app_data_out); } void test_ancs_app_storage__overwrite(void) { ANCSAppData app_data = { ....
)); ble_root_keys_get_and_generate_if_needed(config->root_keys); dis_get_info(&config->dis_info); #if CAPABILITY_HAS_BUILTIN_HRM config->is_hrm_supported_and_enabled = ble_hrm_is_supported_and_enabled(); PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing prefs: is_enabled=%u", config->is_hrm_supported_and_enabl...
(s_comm_state_change_mutex)
; prv_track_quick_airplane_mode_toggles(!enabled); bt_persistent_storage_set_airplane_mode_enabled(enabled); s_comm_airplane_mode_on = enabled; bool should_schedule_eval = false; if (!s_comm_state_change_eval_is_scheduled) { should_schedule_eval = true; s_comm_state_change_eval_is_scheduled = true; ...
n, but don't touch any of // the reserved bits. The reset values in the stm32f412 reference manual are // not to be trusted, so make sure those bits never change. RCC->AHB1ENR &= ~(0x006010ff); RCC->AHB2ENR &= ~(0x000000c0); RCC->AHB3ENR &= ~(0x00000003); RCC->APB1ENR &= ~(0x17e6c9ff); RCC->APB2ENR &= ~(0...
(BOOT_BIT_RESET_LOOP_DETECT_THREE)
; return true; } switch (++counter) { case 1: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 2: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 3: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 4...
/* * 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 (s_bootbits & bit); }
void fake_boot_bit_set(BootBitValue bit) { s_bootbits |= bit; }
!bt_ctl_is_bluetooth_active()); if (bt_test_bt_sig_rf_test_mode()) { app_data->test_state = BtTestStateStarted; } else { app_data->test_state = BtTestStateFailed; } break; } case BtTestStateStopping: { PBL_ASSERTN(bt_ctl_is_bluetooth_active()); app_data->test_...
app_event_loop()
; handle_deinit(); } static const PebbleProcessMdSystem s_mfg_bt_test_info = { .common.main_func = &s_main, .name = "BT Test" }; const PebbleProcessMd* mfg_app_bt_test_get_info() { return (const PebbleProcessMd*) &s_mfg_bt_test_info; }
s_activity_pin_state.removed = true; } else if (uuid_equal(id, &s_sleep_pin_state.uuid)) { s_sleep_pin_state.removed = true; } } } // ------------------------------------------------------------------------------------------------ void activity_insights_init(time_t now_utc) { // Init insight set...
(now_utc, 1234, 800, i)
; // Way below average, but more than 10,000 steps were taken so these should be neutral prv_push_activity_summary_notification(now_utc, 12345, 100000, i); } } time_t midnight = time_util_get_midnight_of(now_utc); int32_t enter_seconds = (23 * SECONDS_PER_HOUR); // 11 pm the day before int32_t...
raphics_api); cl_assert_equal_i(0, s_layer_mark_dirty.call_count); EXECUTE_SCRIPT("_rocky.requestDraw();"); cl_assert_equal_i(1, s_layer_mark_dirty.call_count); cl_assert_equal_p(&s_app_window_stack_get_top_window.layer, s_layer_mark_dirty.last_call.layer); } void test_rocky_api_graphics__provides_draw_event(...
EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, 10, 20, 0, Math.PI);\n" )
; cl_assert_equal_i(1, s_graphics_fill_radial_precise_internal.call_count); MockCallRecording *const lc = &s_graphics_fill_radial_precise_internal.last_call; cl_assert_equal_point_precise(PP(29.5, 39.5), lc->fill_radial_precise.center); cl_assert_equal_i(10*8, lc->fill_radial_precise.radius_inner.raw_value); ...
yer->layer.bounds; scroll_layer->layer.property_changed_proc = scroll_layer_property_changed_proc; layer_init(&scroll_layer->content_sublayer, bounds); layer_add_child(&scroll_layer->layer, &scroll_layer->content_sublayer); prv_setup_shadow_layer(scroll_layer); } ScrollLayer* scroll_layer_create(GRect frame)...
animation_set_curve(animation, AnimationCurveEaseOut)
; } } else { scroll_layer->animation = property_animation_create(&implementation, scroll_layer, NULL, &offset); animation = property_animation_get_animation(scroll_layer->animation); if (scroll_layer_get_paging(scroll_layer)) { ...
= { // Action Attributes 0x01, // Attribute ID - Title 0x07, 0x00, // Attribute Length // Attribute text: 'D', 'i', 's', 'm', 'i', 's', 's', }; static uint8_t attr_list2_serialized[] = { 0x01, // Attribute 1 ID - Title 0x04, 0x00, ...
cl_assert(attribute_list_copy(&list2, &list, buffer, buffer + size_list))
; // check that we haven't modified buffer cl_assert(buffer == buffer_orig); cl_assert_equal_s(attribute_get_string(&list2, AttributeIdTitle, ""), "Title"); cl_assert_equal_s(attribute_get_string(&list2, AttributeIdSubtitle, ""), "Subtitle"); cl_assert_equal_s(attribute_get_string(&list2, AttributeIdBody, "")...
, { -384, 352, -8}, { -392, 312, 16}, // 28 seconds { -504, 320, 0}, { -664, 336, 40}, { -736, 304, 40}, { -928, 320, 40}, { -976, 352, 0}, { -1312, 440, -40}, { -1320, 456, -120}, { -976, 600, -464}, { -936, 456, -280}, { -848, 344, -264}, { -560, 296, -264}, ...
{ -568, 488, -208}, { -664, 504, -224}, { -752, 464, -208}, { -912, 440, -128}, { -1168, 552, -216}, { -1080, 576, -168}, { -992, 648, -224}, { -1056, 720, -288}, { -912, 496, -24}, { -752, 384, -40}, { -576, 424, -96}, { -488, 448, -120}, { -480, 336, -40}, { -52...
{ -1136, 472, -160}, // 36 seconds { -1144, 584, -216}, { -1032, 544, -144}, { -760, 544, -168}, { -840, 576, -264}, { -792, 408, -32}, { -704, 320, 8}, { -584, 384, -48}, { -584, 376, -32}, { -608, 360, -8}, { -680, 328, 16}, { -672, 336, 24}, { -608, 320, 16}, ...
// Restore user count slave->bus->state->user_count++; } bool i2c_bitbang_recovery(I2CSlavePort *slave) { PBL_ASSERTN(slave); static const int MAX_TOGGLE_COUNT = 10; static const int TOGGLE_DELAY = 10; if (slave->bus->state->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted bitbang recovery on ...
{ if ((bus->state->transfer_event == I2CTransferEvent_TransferComplete) || (bus->state->transfer_event == I2CTransferEvent_Error)) { // Track the max transfer duration so we can keep tabs on the MFi chip's nacking behavior if (bus->state->transfer_event == I2CTransferEvent_Error) { ...
_value; int16_t delta_y = rot_end.y.raw_value - rot_start.y.raw_value; Fixed_S16_3 x = (Fixed_S16_3){.raw_value = rot_start.x.raw_value + delta_x * (i * FIXED_S16_3_ONE.raw_value - rot_start.y.raw_value) / delta_y}; Fixed_S16_3 delta = (Fixed_S16_3){.raw_value =...
{ start_is_down = rot_end.y > rot_start.y; found_start_direction = true; }
rot_end = rot_start; } const int16_t clip_min_x = ctx->draw_state.clip_box.origin.x - ctx->draw_state.drawing_box.origin.x; const int16_t clip_max_x = ctx->draw_state.clip_box.size.w + clip_min_x; if (!prv_is_in_range(min_x, max_x, clip_min_x, clip_max_x)) { goto cleanup; } // x-intersect...
er_frame_insets = GEdgeInsets(top_bottom_inset, 0); menu_layer_frame = grect_inset(menu_layer_frame, menu_layer_frame_insets); #endif MenuLayer *menu_layer = &launcher_menu_layer->menu_layer; menu_layer_init(menu_layer, &menu_layer_frame); menu_layer_set_highlight_colors(menu_layer, ...
menu_layer_reload_data(&launcher_menu_layer->menu_layer)
; } void launcher_menu_layer_set_selection_state(LauncherMenuLayer *launcher_menu_layer, const LauncherMenuLayerSelectionState *new_state) { if (!launcher_menu_layer || !launcher_menu_layer->data_source || !new_state) { return; } const bool animated = false; p...
TIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "apps/system_apps/health/health_sleep_detail_card.h" #include "apps/system_apps/health/health_detail_card.h" #include "apps/system_apps/health...
MenuIndex(0, 1)
/* * 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...
(&bus->scl_gpio, GPIO_OType_OD, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL)
; gpio_af_init(&bus->sda_gpio, GPIO_OType_OD, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); } static void prv_bus_pins_cfg_input(I2CBus *bus) { InputConfig in_scl = { .gpio = bus->scl_gpio.gpio, .gpio_pin = bus->scl_gpio.gpio_pin, }; gpio_input_init(&in_scl); InputConfig in_sda = { .gpio = bus->sda_gpio....
------------------------------------------------- static void prv_debug_cmd_push_walk_run(int index, void *context) { activity_insights_test_push_walk_run_sessions(); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_push_day_insights(int index, ...
(data->debug_card.menu_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...
while ((status = flash_impl_get_write_status()) == E_BUSY) { delay_us(10); }
CD_ASSERTN(PASSED(status)); buffer += written; start_addr += written; remaining -= written; } 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); }
(predicate_cond == cond_to_expire + 1))) { // This predicate could expire over time. // If the conditional is equal, add 1 to the wait time, because the equals case stays // valid on the specified value. if (predicate_cond == cond_to_expire + 1) { wait_time++; ...
if (!did_output) { // If no output was generated, it's an error. state->error->status = TemplateStringErrorStatus_CantResolve; }
// format() must be the last filter, and ends the sequence. state->filters_complete = true; } static void prv_filter_time_until(TemplateStringState *state) { char *endptr; time_t target_time = strtol(state->position, &endptr, 10); if (*endptr != ')') { state->error->status = TemplateStringErrorStatus_M...
nt32_t distance_normalized, bool inner) { const GColor replace_color = GColorGreen; const GColor stroke_color = TIMELINE_DOT_COLOR; compositor_transition_pdcs_animation_update( ctx, s_data.animation_sequence, distance_normalized, replace_color, stroke_color, ...
graphics_context_set_fill_color(ctx, TIMELINE_DOT_COLOR)
; graphics_fill_radial_internal(ctx, circle_center, dot_ring_inner_radius, interpolated_dot_ring_outer_radius, 0, TRIG_MAX_ANGLE); // Save a reference to the existing draw implementation const GDrawRawImplementation *saved_draw_implementation = ctx->draw_state.draw_implementation;...
/* * 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)
, 192); } void test_kino_reel__resource_pdcs(void) { // Test loading PDCS Kino Reel uint32_t resource_id = sys_resource_load_file_as_resource( TEST_IMAGES_PATH, "test_kino_reel__resource_pdcs.pdc"); cl_assert(resource_id != UINT32_MAX); KinoReel *kino_reel = kino_reel_create_with_resource(resource_id); ...
} else if (strcmp(token, "TEST_EXPECTED_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.exp_steps_max); } else if (strcmp(token, "TEST_WEIGHT") == 0) { sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight); } else if (strcmp(token, "TEST_NAME") == 0) { ...
{ sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.min); }
0, 0x74, 73, 158, 0}, { 0, 0x73, 211, 158, 0}, { 0, 0x73, 141, 156, 0}, { 15, 0x75, 1371, 151, 0}, { 0, 0x75, 1140, 155, 0}, { 0, 0x73, 414, 156, 0}, { 0, 0x73, 71, 159, 0}, { 0, 0x74, 311, 152, 0}, // 75: Local time: 2015-11-12 09:43:00 PM { 0, 0x74, 229, 155, 0}, { 0, 0x73, 379...
{ 0, 0x74, 125, 155, 0}, { 0, 0x64, 61, 155, 0}, { 0, 0x64, 411, 154, 0}, { 0, 0x64, 5156, 146, 0}, { 16, 0x46, 7166, 219, 0}, { 0, 0x44, 1084, 221, 0}, { 0, 0x42, 642, 219, 0}, { 0, 0x44, 97, 221, 0}, { 0, 0x44, 440, 222, 0}, // 180: Local time: 2015-11-12 11:28:00 PM { 0, 0...
{ 0, 0x74, 0, 142, 0}, { 0, 0x74, 0, 142, 0}, { 0, 0x74, 0, 139, 0}, // 225: Local time: 2015-11-13 12:13:00 AM { 0, 0x74, 0, 143, 0}, { 0, 0x74, 0, 143, 0}, { 0, 0x74, 0, 143, 0}, { 0, 0x74, 0, 145, 0}, { 0, 0x74, 0, 140, 0}, { 0, 0x74, 0, 143, 0}, { 0, 0x74, 0, 143, 0}, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // There is new data present, so perform a write! memcpy(unmodified_data_patch_start, patch, size); prv_perform_write(&data, should_erase); }
prv_cleanup_struct(&data); } typedef struct { size_t size; size_t offset; uint8_t patch[]; } WriteEraseCBData; static void prv_perform_flash_erase_write_cb(void *data_in) { WriteEraseCBData *cb_data = (WriteEraseCBData*) data_in; prv_apply_patch_to_struct(cb_data->patch, cb_data->size, cb_data->offset, ...
itten, sizeof(hdr.last_written), prv_page_to_flash_offset(next_page) + offsetof(PageHeader, last_written)); } //! The wear leveling strategy deployed is as follows: //! Always track the last page which was written. Every time a new page needs //! to be allocated, search for the next page that comes after t...
if (next_page != INVALID_PAGE) { // a free page was found if (use_page) { prv_update_last_written_page(next_page); } *free_page = s_last_page_written = next_page; return (S_SUCCESS); }
return (E_OUT_OF_STORAGE); } //! Note: expects that the caller does _not_ hold the pfs mutex //! Note: If pages are already pre-erased on the FS, this routine will return //! very quickly. If we need to do erases, it will take longer becauses this //! operation can take seconds to complete on certain flash parts...
}; rocky_global_init(apis); s_prv_api_add__result = true; EXECUTE_SCRIPT( "var f1 = function(){};\n" "var f2 = function(){};\n" "_rocky.on('foo', f1)\n" ); cl_assert_equal_i(1, s_prv_api_add__callcount); cl_assert_equal_b(true, rocky_global_has_event_handlers("foo")); // variables f1, f2 ...
{ static const RockyGlobalAPI *apis[] = {NULL}; rocky_global_init(apis); EXECUTE_SCRIPT( "_rocky.Event.prototype.myCustomThing = 'xyz';\n" "var e = new _rocky.Event('myevent');\n" "var t = e.type;\n" "var c = e.myCustomThing;\n" ); ASSERT_JS_GLOBAL_EQUALS_S("t", "myevent"); ASSERT_JS_G...
void test_rocky_api_global__call_event_handlers_async(void) { static const RockyGlobalAPI api = { .init = prv_api_init, .add_handler = prv_api_add, }; static const RockyGlobalAPI *apis[] = { &api, NULL, }; rocky_global_init(apis); s_prv_api_add__result = true; EXECUTE_SCRIPT("var is_cal...
GET_PBI_NAME(1)
)); status = gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(2))); status = gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); cl_assert_equal_b(status, true); cl_check(gbitmap_pb...
grect_align(&text_box, outer_box, align, true); graphics_draw_text(ctx, text, font, text_box, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); return text_box.size.h; } //! box is passed as a pointer to save stack space //! after this call, box will point to the GRect where //...
{ NotificationsData *notifications_data = data; if ((notifications_data->notification_list) && (cell_index->row == 0)) { // Clear All button selected prv_settings_clear_history_window_push(notifications_data); return; } // shift index since the first one is hard coded to Clear int16_t notif_idx...
static uint16_t prv_get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t section_index, void *data) { NotificationsData *notifications_data = data; NotificationNode *node = notifications_data->notification_list; // There's no notifications, don't draw anything ...
ation_set_duration(b, duration_b); Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); // Create a spawn out of b and c Animation *spawn = animation_spawn_create(b, c, NULL); cl_assert(spawn != NULL); // Create a sequence by putting a in front and repeat it 5 times // We ...
(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a0), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a0), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a1), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a1)...
sys_get_time() + ((MAX_WAKEUP_EVENTS_PER_APP + 1) * WAKEUP_EVENT_WINDOW), 0, false); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); } void test_wakeup__gap(void) { WakeupId wakeup_id = 0; sys_wakeup_cancel_all_for_app(); // Schedule 1 event in a minute wakeup_id = sys_wakeup_schedule(sys_...
(fourth_wakeup_id)
, fourth_event); // Jump to the future right before the 3rd event rtc_set_time(sys_get_time() + 170); // Force wakeup to check for current wakeup event wakeup_enable(false); wakeup_enable(true); // fire the first wakeup event, as it is still current stub_new_timer_fire(wakeup_get_current()); wakeup_d...
at again. GRect dest_rect = GRect(0, 0, src_bitmap->bounds.size.w + 2, src_bitmap->bounds.size.h); bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit( &dest_bitmap, src_bitmap, dest_rect, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_wrap_x-expect.8bit.pbi"))...
cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_or-expect.8bit.pbi"))
; memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAnd, GColorWhite); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_and-expect.8bit.pbi")); memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_int...
error->description = strdup(description); _clar.suite_errors++; _clar.total_errors++; if (should_abort) { if (!_clar.trampoline_enabled) { clar_print_onabort( "Fatal error: a cleanup method raised an exception."); clar_report_errors(); exit(-1); } longjmp(_clar.trampoli...
snprint_eq(buf, 4096, "'%p' != '%p'", m1, m2)
; clar__assert(0, file, line, err, buf, should_abort); } for (int offset = 0; offset < n; offset++) { if (m1[offset] == m2[offset]) { continue; } int len = 4096; int off = 0; char buf[len]; off += snprint_eq(buf + off, len - off, "Mismatch at offset %d. Look above for diff.\n", of...
d"); } } qspi_release(QSPI); bool was_busy = false; // write a few bytes to the sector we're going to erase so it's not empty uint8_t dummy_data = 0x55; flash_write_bytes(&dummy_data, FLASH_REGION_FIRMWARE_SCRATCH_BEGIN, sizeof(dummy_data)); profiler_start(); status_t result = flash_impl_erase_se...
for (uint32_t i = 0; i < sizeof(s_test_buffer); ++i) { if (s_test_buffer[i] != SIGNAL_TEST_MAGIC_PATTERN) { success = false; 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...
(written_pcba_serial1, pcba_serial)
ending(); s_acks_received = 0; s_nacks_received = 0; } static void prv_receive_init_and_put_fw_object(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); fake_comm_session_process_send_next(); fake_system_task_callbacks_invoke_pending(); const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc, 0xdd }; prv_r...
(4, ObjectFirmware)
; // Release it: xSemaphoreGive(put_bytes_get_semaphore()); fake_queue_set_yield_callback(put_bytes_get_semaphore(), NULL); assert_nack_count(1); } static void prv_cancel_before_write_second_message(void) { put_bytes_cancel(); } void test_put_bytes__cancel_between_prepare_and_finish(void) { // When the ...
line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizont...
GPoint(0, 14)
, 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 22), MAX_NUM_COLS + 1); cl_check(gbitmap_pbi_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...
kino_player_draw(&kino_layer->player, ctx, reel_bounds.origin)
; } ////////////////////// // Player Callbacks ////////////////////// static void prv_player_frame_did_change(KinoPlayer *player, void *context) { KinoLayer *kino_layer = context; layer_mark_dirty((Layer *)kino_layer); } static void prv_player_did_stop(KinoPlayer *player, bool finished, void *context) { KinoLa...
------------------------------------------------------------------- //! Log when the CC2564x BT chip becomes unresponsive void analytics_event_bt_cc2564x_lockup_error(void) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_BtLockupError, }; ANALYTICS_LOG_DEBUG("CC2564x lockup event"); analytics_...
{ // Format the event specifc info in the blob. The analytics_logging_log_event() method will fill // in the common fields AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_HealthInsightResponse, .health_insight_response = { .time_utc = timestamp, .insight_type = insight_type, .a...
T16_MAX; int16_t max_y = INT16_MIN; int16_t min_y = INT16_MAX; for (uint32_t i = 0; i < path->num_points; ++i) { if (path->points[i].x > max_x) { max_x = path->points[i].x; } if (path->points[i].x < min_x) { min_x = path->points[i].x; } if (path->points[i].y > max_y) { max_y ...
(APP_LOG_LEVEL_ERROR, GPATH_ERROR)
; goto cleanup; } int intersection_up_count; int intersection_down_count; // convert clip coordinates to drawing coordinates const int16_t clip_min_y = ctx->draw_state.clip_box.origin.y - ctx->draw_state.drawing_box.origin.y; const int16_t clip_max_y = ctx->draw_state.clip_box.size.h + clip_min_...
tyle, sizeof(s_is_24h_style))) { s_is_24h_style = is_24h_style; } mutex_unlock(s_mutex); } bool shell_prefs_is_timezone_source_manual(void) { // Force things to automatic return false; } void shell_prefs_set_timezone_source_manual(bool manual) { } int16_t shell_prefs_get_automatic_timezone_id(void) { /...
{ return 0; }
bool activity_prefs_heart_rate_is_enabled(void) { return true; } ActivityInsightSettings *activity_prefs_get_sleep_reward_settings(void) { static ActivityInsightSettings s_settings = { 0 }; return &s_settings; } void activity_prefs_set_activation_delay_insight_fired(ActivationDelayInsightType type) { } bool ...
{ 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, // 480: Local time: 03:54:00 AM { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0}, { 0, 0x63, 0},...
{ 0, 0x12, 0}, { 0, 0x12, 0}, { 0, 0x12, 0}, { 0, 0x12, 0}, { 0, 0x12, 0}, { 0, 0x12, 0}, // 555: Local time: 05:08:00 AM { 0, 0x12, 0}, { 0, 0x12, 0}, { 0, 0x12, 0}, { 0, 0x12, 0}, { 0, 0x12, 0}, { 0, 0x12, 0}, { 0, 0x43, 21}, { 0, 0x64, 0}, { 0, 0x64, 0...
pyright 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 in writin...
cl_assert_equal_i(layout.max_used_size.h, 2 * FONT_HEIGHT)
; // 2 lines - all that will completely fit in the box ("Jr\nWho-") graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper", font, box, GTextOverflowModeWordWrap, GTextAlignmentLeft, (void*)&layout); cl_assert(layout.box.size.w == box.size.w); cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_P...
; BMI160_DBG("INT_EN[0] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_EN_0)); BMI160_DBG("INT_EN[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_EN_1)); } // should be servicing tap/motion interrupts static void bmi160_IRQ1_handler(bool *should_context_switch) { if (!s_accel_outstanding_motion_work) { s_accel_o...
{ s_accel_outstanding_data_work = false; // if the task draining the fifo gets swapped out for a long enough duration, // its possible the fifo watermark interrupt may fire multiple times. Once // the task finishes draining the fifo, the interrupt will be cleared but a // fifo drain callback could have alrea...
static void bmi160_IRQ2_handler(bool *should_context_switch) { if (!s_accel_outstanding_data_work) { s_accel_outstanding_data_work = true; accel_offload_work_from_isr(prv_handle_data, should_context_switch); } else { BMI160_DBG("%s", "We fell behind on data handling"); } } // in order to actually e...
dialog->text_color, GColorClear, text_alignment, GTextOverflowModeWordWrap); if (text_attributes) { text_layer->should_cache_layout = true; text_layer->layout_cache = text_attributes; } layer_add_child(&window->layer, &text_layer->layer); // Act...
{ dialog_push(&actionable_dialog->dialog, window_stack); }
void app_actionable_dialog_push(ActionableDialog *actionable_dialog) { app_dialog_push(&actionable_dialog->dialog); } void actionable_dialog_pop(ActionableDialog *actionable_dialog) { dialog_pop(&actionable_dialog->dialog); } void actionable_dialog_init(ActionableDialog *actionable_dialog, const char *dialog_na...
bool success = prv_wait_system_task(prv_sleep_file_info_system_cb, &context, &context.success, &context.completed, 30 /*timeout_sec*/); if (success) { *num_records = context.num_records; *data_bytes = context.data_bytes; *minutes = context.minutes; } else { *nu...
rtc_get_time()
, .values = { 0, // This ends up overwritten anyway by the current sleep value 1000, 750, 1250, 500, 2000, 3000 } }; prv_write_metric_history(ActivitySettingsKeyStepCountHistory, &step_history); } // ---------------------------------------------------------------...
ght(data->bpm_font)), NULL, NULL); graphics_text_node_destroy(&container->node); } static void prv_render_timstamp(GContext *ctx, Layer *base_layer) { HealthHrSummaryCardData *data = layer_get_data(base_layer); if (data->last_updated <= 0 || data->now_bpm == 0) { return; } const size_t buffer_size = 32...
{ return CARD_BACKGROUND_COLOR; }
bool health_hr_summary_show_select_indicator(Layer *layer) { return true; }
cs.is_hr_elevated; } void test_activity__update_time_in_hr_zones(void) { int32_t zone1_minutes, zone2_minutes, zone3_minutes; activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); activity_metrics_prv_reset_hr_stats(); cl_assert_equal_b(prv_is_hr_elevated(), false); a...
(zone3_minutes, 2)
; // Advance to a new day. The HR zone stats should get reset time_t utc_sec = rtc_get_time(); utc_sec += SECONDS_PER_DAY; rtc_set_time(utc_sec); prv_minute_system_task_cb(NULL); cl_assert_equal_b(prv_is_hr_elevated(), true); // stays elevated activity_get_metric(ActivityMetricHeartRateZone1Minutes, 1, &...
l) { MultiWatchData *data = app_state_get_user_data(); data->clock_model = *model; layer_mark_dirty(window_get_root_layer(&data->window)); } static GPointPrecise prv_gpoint_from_polar(const GPointPrecise *center, uint32_t distance, int32_t angle) { return gpoint_...
GSize(face->bob_radius * 2, face->bob_radius * 2)
}; GRect bob_center_rect = (GRect) { .size = GSize(face->bob_center_radius * 2, face->bob_center_radius * 2) }; grect_align(&bob_rect, bounds, GAlignCenter, false /* clips */); grect_align(&bob_center_rect, bounds, GAlignCenter, false /* clips */); graphics_context_set_fill_color(ctx, face->bob_color...
i")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 7, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r7_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIG...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
; graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ prompt_send_response("Available Commands:"); char buffer[32]; for (unsigned int i = 0; i < NUM_PROMPT_COMMANDS; ++i) { const Command* cmd = &s_prompt_commands[i]; if (cmd->num_params) { prompt_send_response_fmt(buffer, sizeof(buffer), "%s {%u args}", cmd->cmd_str, cm...
typedef struct CommandArgs { unsigned int num_args; const char* args[NUM_SUPPORTED_PARAM_COUNT]; } CommandArgs; static CommandArgs prv_parse_arguments(char* buffer, char* buffer_end) { CommandArgs args; for (int i = 0; i < NUM_SUPPORTED_PARAM_COUNT; ++i) { // Consume leading whitespace while (buffer...
ctx, GPointPrecise *points, size_t num_points, bool open) { s_stroke_points = prv_copy_points((GPoint*)points, num_points, s_offset); s_path_open = open; s_path_stroke_precise_count++; } void graphics_draw_circle(GContext* ctx, GPoint p, uint16_t radius) { s_stroke_poin...
(s_path_num_points, 0)
; cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_path_stroke_count, 0); cl_assert_equal_p(s_stroke_points, NULL); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // set stroke width to non-zero value. stroke should be drawn, but no fill gdraw_co...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // Enable GPIO and UART3 peripheral clocks periph_config_enable(GPIOD, RCC_AHB1Periph_GPIOD); periph_config_enable(DBGSERIAL_UART, RCC_APB1Periph_USART3); DBGSERIAL_UART->CR1 &= ~USART_CR1_UE; AfConfig tx_cfg = { .gpio = GPIOD, .gpio_pin = GPIO_Pin_8, .gpio_pin_source = GPIO_PinSource8, .g...
static void prv_putchar(uint8_t c) { while ((DBGSERIAL_UART->ISR & USART_ISR_TXE) == 0) continue; DBGSERIAL_UART->TDR = c; while ((DBGSERIAL_UART->ISR & USART_ISR_TXE) == 0) continue; } void dbgserial_print(const char* str) { for (; *str && s_message_length < MAX_MESSAGE; ++str) { if (*str == '\n') { ...
max_heart_beats) { data->pulsing_heart_timer = app_timer_register(timer_duration, prv_pulsing_heart_timer_cb, base_layer); } layer_mark_dirty(base_layer); } static void prv_render_progress_bar(GContext *ctx,...
prv_render_hrm_disabled(ctx, base_layer)
; return; } prv_render_bpm(ctx, base_layer); prv_render_timstamp(ctx, base_layer); } static void prv_hr_detail_card_unload_callback(Window *window) { health_hr_detail_card_destroy(window); } //////////////////////////////////////////////////////////////////////////////////////////////////// // API Funct...
min // start at: 9:52pm (offset 27) // end at: 3:11am (offset 346) AlgDlsMinuteData *activity_sample_sleep_5(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME sleep_5 //> TEST_VERSION 2 //> TEST_TOTAL 309 //> TEST_TOTAL_MIN 290 //> TEST_TOTAL_MAX 325 //> TEST_...
{ 0, 0x54, 263, 0x0}, // 90: Local time: 10:55:00 PM { 0, 0x64, 0, 0x0}, { 0, 0x64, 165, 0x0}, { 0, 0x54, 0, 0x0}, { 0, 0x54, 0, 0x0}, { 0, 0x54, 0, 0x0}, { 0, 0x54, 0, 0x0}, { 0, 0x54, 0, 0x0}, { 0, 0x54, 0, 0x0}, { 0, 0x54, 0, 0x0}, { 0, 0x54, 0, 0x0}, { 0, 0x64, 17...
IteratorCb callback, void *data) { PBL_ASSERTN(callback); JS_VAR rocky = rocky_get_rocky_singleton(); JS_VAR all_listeners = jerry_get_object_field(rocky, "_listeners"); JS_VAR event_listeners = jerry_get_object_field(all_listeners, event_name); // printf("event_listene...
if (len == 0 || len == event_name_size) { return rocky_error_argument_invalid("Not a valid event"); }
V0_WINDOW_SIZE; } } static void prv_assert_sent_ack(BLECharacteristic characteristic, uint8_t sn) { const PPoGATTPacket ack = (const PPoGATTPacket) { .sn = sn, .type = PPoGATTPacketTypeAck, }; fake_gatt_client_op_assert_write(characteristic, (const uint8_t *) &ack, sizeof(ack), ...
ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid)
, false); } void test_ppogatt__handles_meta_v1(void) { struct { const PPoGATTMetaV1 *meta; TransportDestination expected_destination; } metas[] = { { .meta = &s_meta_v1_hybrid, .expected_destination = TransportDestinationHybrid, }, { .meta = &s_meta_v1_system_inferred, ....
ation *animation = prv_create_from_vararg(animation_a, animation_b, animation_c, args); va_end(args); return animation; } Animation *WEAK animation_spawn_create_from_array(Animation **animation_array, uint32_t array_len) { return prv_create_from_array(animation_a...
if (animation->handlers.stopped) { animation->handlers.stopped((Animation *)animation, finished, animation->context); }
if (animation->implementation && animation->implementation->teardown) { animation->implementation->teardown((Animation *)animation); } } bool animation_unschedule(Animation *animation_h) { AnimationPrivate *animation = (AnimationPrivate *)animation_h; if (!animation) { return false; } if (animatio...
prv_vibe_history_clear(HISTORY_CLEAR_ALL)
; mutex_unlock(s_vibe_history_mutex); } static void prv_vibe_history_start_event(void) { if (!s_vibe_history_enabled) { return; } VibeHistory *vibe = kernel_malloc(sizeof(VibeHistory)); if (vibe == NULL) { s_vibe_history_enabled = false; return; } list_init((ListNode*)vibe); time_t s; uin...
/* * 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_LOG(LOG_LEVEL_WARNING, "Multiple app launch services!? Will use most recent one."); }