prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
animation_stopped(Animation *animation, bool finished, AnimatedDemoData *data) { text_layer_set_text(&data->text_layer, finished ? "Hi, I'm a TextLayer!" : "Just Stopped."); (void)animation; } AnimationProgress animation_bounce(AnimationProgress linear_distance) { // An awful linear "bounce-like" animation if...
app_event_loop()
; handle_deinit(); } const PebbleProcessMd* animated_demo_get_app_info() { static const PebbleProcessMdSystem animated_demo_app_info = { .common.main_func = s_main, .name = "Animation Demo" }; return (const PebbleProcessMd*) &animated_demo_app_info; }
bbleEvent e = { .type = PEBBLE_APP_LAUNCH_EVENT, .launch_app = { .id = config->id, .data = data }, }; event_put(&e); } // --------------------------------------------------------------------------------------------- bool app_manager_launch_new_app(const AppLaunchConfig *config) { // Note...
{ // If we get here, the app exit reason didn't override the destination app ID if (!s_next_app.md) { destination_app_id = system_app_state_machine_get_last_registered_app(); } else { // If we get here, s_next_app is already setup and so we can call prv_app_switch() directly // and return ...
app_manager_set_minimum_run_level(ProcessAppRunLevelNormal); process_manager_launch_process(&(ProcessLaunchConfig) { .id = destination_app_id, .common.transition = shell_get_close_compositor_animation(current_app_id, destination_app_id), .forcefully = !gracefully, }); } // -------------------------...
.opaque.opaque_64 = 0x1122334455667788, }, .csrk = { .data = { 0xcc, 0xdd, 0xee, 0xff, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x22, 0x33, }, }, .is_local_encryption_info_valid = true, .is_remote_encryption_info_valid = true, .is_remote_ide...
(shared_prf_storage_get_bt_classic_pairing_data(NULL, NULL, NULL, NULL), false)
; // Store a classic pairing BTDeviceAddress addr = { .octets = { 0x11, 0x22, 0x33, 0x44, 0x55,}, }; char device_name_classic[BT_DEVICE_NAME_BUFFER_SIZE] = "CLASSIC"; SM128BitKey link_key = { .data = { 0x55, }, }; shared_prf_storage_store_bt_classic_pairing_data(&addr, device_name_classic, &link_...
id); BLE_LOG_DEBUG("> EventFlags: <%d>", nsnotification->event_flags); BLE_LOG_DEBUG("> CategoryID: <%d>", nsnotification->category_id); BLE_LOG_DEBUG("> CategoryCount: <%d>", nsnotification->category_count); BLE_LOG_DEBUG("> NotificationUID: <%"PRIu32">", nsnotification->uid); BLE_HEXDUMP((uint8_t *)nsnotifi...
if (s_ancs_client->state == ANCSClientStateAliveCheck) { // We got a response so cancel the response wait timer and setup another check. prv_ancs_is_alive(); }
// We asked for a non-existent notification, go to the next one prv_reset_and_next(); return; } if (error != BLEGATTErrorSuccess) { PBL_LOG(LOG_LEVEL_ERROR, "Control point error response: %d", error); prv_reset_due_to_bt_error(); return; } BLE_LOG_DEBUG("Got ACK for Control Point wri...
_stop(void) { bt_driver_stop_unmodulated_tx(); } void command_btle_test_le_tx_start( char *tx_channel, char *tx_packet_length, char *packet_payload_type) { bt_driver_le_transmitter_test( atoi(tx_channel), atoi(tx_packet_length), atoi(packet_payload_type)); } void command_btle_test_rx_start(char *rx_chan...
GPoint(0, DISP_ROWS/5)
, GPoint(DISP_COLS, DISP_ROWS)); profiler_stop(); uint32_t total_time = profiler_get_total_duration(false); uint32_t us = profiler_get_total_duration(true); char buf[80]; prompt_send_response_fmt(buf, sizeof(buf), "%s, %s, %"PRIu32", %"PRIu32, do_aa, widt...
/* * 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...
voltage_monitor_read(VOLTAGE_MONITOR_BATTERY, &info)
; return (ADCVoltageMonitorReading) { .vref_total = info.vref_total, .vmon_total = info.vmon_total, }; } bool battery_charge_controller_thinks_we_are_charging(void) { if (s_charging_forced_disable) { return false; } return battery_charge_controller_thinks_we_are_charging_impl(); } bool battery_...
->conn_idx, }, }; // Store the current local address with the connection. It's possible the local address will // cycle while being connected. If we're going to pair and the device wants to use address // pinning, we need to make sure to pin the current address and not a newly generated one. const BTDevi...
connection_by_idx(evt->conn_idx)
); } static void prv_handle_evt_gap_sec_level_changed(const ble_evt_gap_sec_level_changed_t *evt) { PBL_LOG(LOG_LEVEL_INFO, "Security level changed to: %u", evt->level); Connection *conn = connection_by_idx(evt->conn_idx); if (conn == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "No connection for idx=%d", evt->conn_idx...
/* * 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...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME pbl_29288 //> TEST_VERSION 2 //> TEST_TOTAL 0 //> TEST_TOTAL_MIN 0 //> TEST_TOTAL_MAX 0 //> TEST_DEEP -1 //> TEST_DEEP_MIN -1 //> TEST_DEEP_MAX -1 //> TEST_START_AT -1 //> TEST_START_AT_MIN -1 //> TEST_START_AT_M...
{ 0, 0x83, 0, 153}, // 30: Local time: 08:12:00 PM { 0, 0x83, 0, 153}, { 0, 0x82, 1, 153}, { 0, 0x82, 43, 153}, { 0, 0x82, 0, 153}, { 0, 0x72, 432, 152}, { 8, 0x73, 1410, 153}, { 0, 0x73, 516, 158}, { 0, 0x41, 3838, 150}, { 12, 0x32, 4333, 152}, { 36, 0x42, 8837, 159}, ...
/* * 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...
{ va_list args; va_start(args, fmt); vprintf(fmt, args); va_end(args); }
e_dotted(&ctx, GPoint(14, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS + 1 ); cl...
(&ctx, GPoint(101, 33), 5)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(97, 37), 10); // T facing left - lined up graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 70), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 76), 5); // T facing right - even vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoin...
the .update function of the current CompositorTransition. static void prv_animation_update(Animation *animation, const AnimationProgress distance_normalized); //! Call this function whenever a transition completes to change the state to one of the stable //! states (CompositorState_App or CompositorState_Modal). stat...
((bezel_width > 0) && (bezel_height > 0))
; uint8_t *dst = (uint8_t *)s_framebuffer.buffer; uint8_t *app_buffer = (uint8_t *)app_framebuffer->buffer; // Set all the black pixels from the start, which is the sum of the following: // - app_offset_y * DISP_COLS - the top part of the bezel // - bezel_width - the left bezel for the first row o...
//! How frequently we save the time state to the backup registers in ticks. #define SAVE_TIME_FREQUENCY (30 * RTC_TICKS_HZ) static void check_and_handle_rollover(RtcIntervalTicks rtc_ticks) { bool save_needed = false; const RtcIntervalTicks last_ticks = s_last_ticks; s_last_ticks = rtc_ticks; if (rtc_ticks ...
{ if (RTC_GetITStatus(RTC_IT_ALRA) != RESET) { RTC_AlarmCmd(RTC_Alarm_A, DISABLE); RTC_ClearITPendingBit(RTC_IT_ALRA); EXTI_ClearITPendingBit(EXTI_Line17); } }
, true /* app */); // Nothing to be read after "consuming" it: has_notification = gatt_client_subscriptions_get_notification_header(GAPLEClientApp, NULL); cl_assert_equal_b(has_notification, false); } void test_gatt_client_subscriptions__zero_length_notification(void) { // Subscribe app: BLECharacteristic c...
cl_assert_equal_i(e, BTErrnoOK)
; // Simulate getting confirmation from remote: prv_confirm_cccd_write(BLEGATTErrorSuccess); fake_event_clear_last(); // We had a bug at some point where the header size was not taken into account correctly, take // a value that won't fit by 1 byte, so this bug does not happen again: const size_t too_big ...
/* * 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...
(attr_text, ATTRIBUTE_TITLE_MAX_LEN)
her_service_private.h" #include "system/logging.h" #include "system/status_codes.h" #include "util/units.h" #include "util/uuid.h" static struct { SettingsFile settings_file; PebbleRecursiveMutex *mutex; // We cache the reminder app prefs because they're read in reminder_app_get_info() which needs to // be fas...
strlen(system_key)
/* * 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_DEBUG, ">> Reading Addr 0x%"PRIx32" value is 0x%"PRIx16, read_addr, read_buffer); }
if (read_buffer != expected_val) { switch (err_code) { case FLASH_TEST_ERR_ERASE: PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully erase the sector"); break; case FLASH_TEST_ERR_DATA_WRITE: PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully write the data"); b...
onnection *connection, ATTHandleRange *range); extern void gatt_client_discovery_discover_range(GAPLEConnection *connection, ATTHandleRange *hdl_range); //////////////////////////////////////////////////////...
if (event->status_code != HciStatusCode_Success) { PBL_LOG(LOG_LEVEL_ERROR, "Service Changed indication confirmation failure (timed out?) %"PRIu32, (uint32_t)event->status_code); }
} void gatt_service_changed_server_cleanup_by_connection(GAPLEConnection *connection) { if (connection->gatt_service_changed_indication_timer != TIMER_INVALID_ID) { new_timer_delete(connection->gatt_service_changed_indication_timer); connection->gatt_service_changed_indication_timer = TIMER_INVALID_ID; } ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
endpoint_private_read_token_db_id(data, &response.token, &db_id)
; status_t rv = blob_db_sync_db(db_id); switch (rv) { case S_SUCCESS: case S_NO_ACTION_REQUIRED: response.result = BLOB_DB_SUCCESS; break; case E_INVALID_ARGUMENT: response.result = BLOB_DB_INVALID_DATABASE_ID; break; case E_BUSY: response.result = BLOB_DB_TRY_LATER; ...
/* * 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...
lru_cache_put(&s_cache, 1, &input)
; lru_cache_flush(&s_cache); uint32_t *output = lru_cache_get(&s_cache, 1); cl_assert(output == NULL); } void test_lru_cache__evict(void) { for (int i = 0; i <= CACHE_BUFFER_SIZE / (sizeof(CacheEntry) + sizeof(uint32_t)); ++i) { uint32_t input = i; lru_cache_put(&s_cache, i, &input); } uint32_t *ou...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_dispatcher.job_queue, &event, portMAX_DELAY)
; while (s_dispatcher.task) { // Trigger context switches & give low priority tasks a chance to run until // the dispatcher thread wakes and exits psleep(2); } }
/* * 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...
{ int index; uint8_t id; debug_db_determine_current_index((uint8_t []) { 255, 255, 255, 255 }, &index, &id); cl_assert_equal_i(index, 0); cl_assert_equal_i(id, 0); debug_db_determine_current_index((uint8_t []) { 0, 255, 255, 255 }, &index, &id); cl_assert_equal_i(index, 1); cl_assert_equal_i(id, 1); ...
ontal_non_aa(ctx, y, x1_rounded, x2_rounded); } // This function will replicate source column in given area T_STATIC void prv_replicate_column_row_raw(GBitmap *framebuffer, int16_t src_x, int16_t dst_x1, int16_t dst_x2) { const GRect column_to_replicate = (GRect) { .ori...
{ if (delta_bits) { const int rshift = delta_bits; const int lshift = 8 - rshift; for (int i = 0; i < bytes - 1; i++) { buf[i] = (buf[i] >> rshift) | (buf[i+1] << lshift); } if (patch_garbage) { buf[bytes - 1] >>= rshift; ...
n ? kino_reel_get_size(icon) : GSizeZero; const bool show_action_bar = !workout_dialog->hide_action_bar; const GRect *bounds = &window_root_layer->bounds; const uint16_t icon_single_line_text_offset_px = 9; const uint16_t small_icon_offset = (icon_size.h < 60) ? 7 : 0; const uint16_t left_margin_px = PBL_IF...
(text_layer, &GRect(x, y, w, h), dialog->buffer, dialog_text_font, dialog->text_color, GColorClear, text_alignment, GTextOverflowModeWordWrap)
; #if PBL_ROUND text_layer_enable_screen_text_flow_and_paging(text_layer, TEXT_FLOW_INSET_PX); #endif text_layer_set_line_spacing_delta(text_layer, text_layer_line_spacing_delta); layer_add_child(&window->layer, &text_layer->layer); if (workout_dialog->subtext_buffer) { y = subtext_top_margin_px; Tex...
e_addr | test_addr) and start of test space flash_erase_sector_blocking(test_addr); flash_erase_sector_blocking(special_case_addr); // Verify erase took place status = prv_read_verify_byte(test_addr, 0xFF, FLASH_TEST_ERR_ERASE, 0, true); VERIFY_TEST_STATUS(status); // Verify erase took place status = pr...
if (bit_offset >= base_addr) { test_addr2 = bit_offset; } else { test_addr2 = base_addr + bit_offset; } if (test_addr2 >= FLASH_TEST_ADDR_END) { break; } status = prv_read_verify_byte(test_addr2, data_pattern, FLASH_TEST_ERR_STUCK_AT_LOW, bitpos2, ...
if (stuck_at_low) { return FLASH_TEST_ERR_STUCK_AT_LOW; } PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - ADDR TEST 2: Check for address bits stuck at low or shorted"); return FLASH_TEST_SUCCESS; } /***********************************************************/ /******************* Stress Test Functions **************...
draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT_XY, END_ON_ORIGIN_RECT_XY, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_offset_layer_non_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 10); graphics_line_draw_prec...
(&ctx.dest_bitmap, "draw_stroke_precise_close_points_around_1px_non_aa.${BIT_DEPTH_NAME}.pbi")
/* * 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...
mutex_create()
; } void voltage_monitor_device_init(VoltageMonitorDevice *device) { gpio_analog_init(&device->input); } // It takes ~12µs to get our ADC readings. From time to time, we're busy // processing elsewhere for upwards of 25µs and end up getting overrun issues. // In the case that overrun occurs, clean the flag and retu...
assert_equal_i(s_num_timeline_removes, 0); // Begin light sleep s_sleep_state = ActivitySleepStateLightSleep; s_sleep_state_seconds = SMART_ALARM_MAX_LIGHT_SLEEP_S - 15 * SECONDS_PER_MINUTE; // Smart alarms are first triggered by cron at T-30min prv_set_time(s_current_day, 10, 0); cron_service_wakeup(); ...
cl_assert_equal_i(s_num_timeline_removes, 1)
; cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); }
(missed_events.missed_apps_count, missed_events.missed_app_ids)
; } } static bool prv_compiled_without_utc_support(void) { static const Version first_utc_version = { // See list of changes in pebble_process_info.h. Apps compiled prior to this version will // get local time returned from the time() call. 0x5, 0x2f }; Version app_sdk_version = process_metada...
extAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_outside_y(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 40, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } v...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_nx.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_x); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_x.${BIT_DEPTH_NAME}.pbi")); // Word Wrap tests test_graphics_con...
down UP + BACK + SELECT for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!prv_prf_button_combination_is_pressed()) { // stop waiting if not held down any longer return false; } delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_...
(0xdeadbeef)
; delay_us(200000); display_boot_splash(); delay_us(1000000); } #endif if (is_button_stuck()) { sad_watch(ERROR_STUCK_BUTTON); } if (is_flash_broken()) { sad_watch(ERROR_BAD_SPI_FLASH); } boot_bit_dump(); // If the recovery firmware crashed at start-up, the watch is now a // $15...
atus_bar_layer(dialog, true); app_simple_dialog_push(simple_dialog); } ////////////////////// // Confirmation Dialog static void prv_confirm_click_handler(ClickRecognizerRef recognizer, void *context) { app_window_stack_pop(true); } static void prv_confirm_config_provider(void *context) { window_single_click_...
(dialog, GColorLightGray)
; dialog_set_icon(dialog, data->resource_id_25); dialog_show_status_bar_layer(dialog, true); expandable_dialog_set_select_action(expandable_dialog, RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_my_select_click_handler); app_expandable_dialog_push(expandable_dialog); } //////////////////////////////// // Expand...
0,"30","07"},{1185408000,"30","07"},{1185494400,"30","07"}, {1185580800,"30","07"},{1185667200,"30","07"},{1185753600,"31","07"},{1185840000,"31","07"},{1185926400,"31","07"},{1186012800,"31","07"},{1186099200,"31","07"}, {1186185600,"31","07"},{1186272000,"31","07"},{1186358400,"32","07"},{1186444800,"32","07"},{1...
{ gmtime_r(&s_iso8601_data[i].stamp, &wrk); printf("%d: %ld(%d,%d,%d,%d), ", i, s_iso8601_data[i].stamp, wrk.tm_yday,wrk.tm_year,wrk.tm_mon,wrk.tm_mday); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%V", &wrk); cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_V); printf("%s, ", tmbuf); tmb...
} #endif #if EXTENSION_SU void test_strftime__full_percent_z(void) { char tmbuf[512]; struct tm jan_2_2015__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 2015 - 1900, .tm_mon = 0, .tm_mday = 2, // 2015/01/02 .tm_wday = 5, .tm_yday = 1, // Friday, 2nd day of the year ...
2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the L...
timeline_item_destroy(item2)
; } void test_timeline_api__item_attributes(void) { AttributeList list = {0}; attribute_list_add_cstring(&list, AttributeIdTitle, "title"); attribute_list_add_cstring(&list, AttributeIdSubtitle, "subtitle"); TimelineItem *item = timeline_item_create_with_attributes(0, 0, TimelineItemTypePin, LayoutIdTest, ...
l_assert_equal_s("Tue, 16:00", 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, MAX_RELATIVE_HRS); cl_assert_equal_s("Jun 9, 16:00", time_buf); } void test_clock__m...
(timestamp, 0 /* hours_in_the_future */)
; cl_assert_equal_s(morning, daypart_string); // (8am today) time before 12pm is this morning daypart_string = clock_get_relative_daypart_string(timestamp, 4 /* hours_in_the_future */); cl_assert_equal_s(morning, daypart_string); // (9am today) time before 12pm is this morning daypart_string = clock_get_r...
_INCREMENT_SIZE) + 1) * NOTIFICATION_STORAGE_MINIMUM_INCREMENT_SIZE; // Free up space size in blocks size_t size_available = 0; NotificationIterState iter_state = { .fd = fd, }; Iterator iter; iter_init(&iter, (IteratorCallback)&prv_iter_next, NULL, &iter_state); while (iter_next(&iter)) { u...
prv_file_open(OP_FLAG_WRITE | OP_FLAG_READ)
; if (fd < 0) { return; } size_t size_needed = header.payload_length + sizeof(SerializedTimelineItemHeader); if (size_needed > (NOTIFICATION_STORAGE_FILE_SIZE - s_write_offset)) { if (!prv_compress(size_needed, &fd)) { // Notification storage compression failed. Clear notifications storage g...
V1, two features were added to allow for enhanced throughput: // 1) Negotiable RX/TX in-flight windows - This let's the phone put more data out over the // air and not block waiting for an Ack // 2) Coalesced ACKing - Since 1) makes the window size larger, it's beneficial ...
(client, client->out.next_data_sn)
; } static void prv_set_payload_size_for_sn(PPoGATTClient *client, uint32_t sn, uint16_t payload_size) { client->out.payload_sizes[sn] = payload_size; } static void prv_clear_payload_sizes_up_to(PPoGATTClient *client, uint32_t sn_end_excl) { for (uint32_t sn = client->out...
de)); *node = (NotificationQueueNode) { .op = NotificationQueueOpGetAttributes, .uid = uid, .properties = properties, }; prv_notif_queue_push_common(node); } static void prv_notif_queue_pop(void) { NotificationQueueNode *temp = s_ancs_client->queue; if (temp) { list_remove((ListNode *)s_ancs...
prv_set_state(ANCSClientStateAliveCheck)
; //! Sends an ANCS attribute fetch (to the Control Point). The notification UID is invalid, ANCS //! will reply with 0xA2 (invalid param) const GetNotificationAttributesMsg dummy_cmd = { .command_id = CommandIDGetNotificationAttributes, .notification_uid = INVALID_NOTIFICATION_UID, }; p...
oc.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "system/passert.h" #include "system/logging.h" #include "util/list.h" #include <btutil/bt_device.h> #include <btutil/sm_util.h> //! About this module //! ----------------- //! - Book-keeping of connection-related state for GAP and GA...
kernel_free(connection->irk)
/* * 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 sys_process_get_launch_button(); }
= gbitmap_sequence_create_with_resource(resource_id); cl_assert(bitmap_sequence); GBitmap *bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(bitmap_sequence), GBitmapFormat8Bit); cl_assert(bitmap); // first frame always shows at the beginning (0 ms) status = gbi...
{ #if PLATFORM_SPALDING uint32_t resource_id = sys_resource_load_file_as_resource( TEST_IMAGES_PATH, "test_gbitmap_sequence__color_8bit_coin.apng"); cl_assert(resource_id != UINT32_MAX); GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id); cl_assert(bitmap_sequence); ...
e_flash_get_unused_bank()->end, 0, }; return &resource_layout; } else { return &layouts[object_type - 1]; } } bool pb_storage_raw_get_status(PutBytesObjectType obj_type, PbInstallStatus *status) { const MemoryLayout *layout = prv_get_layout_for_type(obj_type); const size_t read_buffer_si...
{ const MemoryLayout *layout = storage->impl_data; const uint32_t flash_address = layout->start_address + offset; flash_write_bytes(buffer, flash_address, length); }
uint32_t pb_storage_raw_calculate_crc(PutBytesStorage *storage, PutBytesCrcType crc_type) { const MemoryLayout *layout = storage->impl_data; const unsigned int start_address = layout->start_address + layout->start_offset; const unsigned int length = storage->current_offset - layout->start_offset; if (crc_typ...
day); if (show_new != show_old) { return (show_old ? 1 : 0) - (show_new ? 1 : 0); } else { return prv_time_comparator(old_node, new_node); } } static void prv_set_node_from_header(CommonTimelineItemHeader *header, TimelineNode *node_out) { prv_set_nodes(&(TimelineNode *) { node_out }, header, 1 /* num_...
timeline_item_free_allocated_buffer(&timeline_iter_state->pin)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_sector_addresses[i] <= address && address < s_sector_addresses[i+1]) { return i; }
} return ARRAY_LENGTH(s_sector_addresses)-1; } bool system_flash_erase( uint32_t address, size_t length, SystemFlashProgressCb progress_callback, void *progress_context) { if (length == 0) { // Nothing to do return true; } int first_sector = prv_get_sector_num_for_address(address); int la...
orWhite); graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, data->stroke_width); graphics_draw_circle(ctx, center, data->size); */ graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, data->stroke_width); graphics_draw_line...
layer_add_child(window_layer, data->canvas_layer)
this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDIT...
NULL_SAFE_FIELD_ACCESS(forecast, current_weather_type, WeatherType_Unknown)
; const uint32_t new_weather_icon_resource_id = prv_get_weather_icon_resource_id_for_type(weather_type); if (weather_glance->icon_resource_id != new_weather_icon_resource_id) { kino_reel_destroy(weather_glance->icon); weather_glance->icon = kino_reel_create_with_resource(new_weather_icon_resource_id);...
l_assert_equal_i(s_last_hr_event.data.heart_rate_update.current_bpm, 120); cl_assert_equal_i(s_last_hr_event.data.heart_rate_update.quality, HRMQuality_Excellent); // Should not fire off an event. Bad HR reading prv_advance_time_hr(1 /*sec*/, 20 /*hr*/, HRMQuality_Excellent, true /*force_continuous*/); cl_asse...
cl_assert_equal_i(metric_values[1], 60)
; activity_stop_tracking(); fake_system_task_callbacks_invoke_pending(); activity_metrics_prv_set_metric(ActivityMetricStepCount, Thursday, 5555); activity_get_metric(ActivityMetricStepCount, 1, metric_values); cl_assert_equal_i(metric_values[0], 4444); } // Test that we report the that a run session is on...
->storage.read_offset, FSeekSet)) { consumed_bytes = -1; // error goto exit; } if (!prv_pfs_write(logging_session->storage.fd, &chunk_hdr, sizeof(chunk_hdr))) { consumed_bytes = -1; // error goto exit; } if (logging_session->storage.n...
(LOG_LEVEL_INFO, "Restored session %"PRIu8 " num_bytes:%"PRIu32", read_offset:%"PRIu32", write_offset:%"PRIu32, session->comm.session_id, session->storage.num_bytes, session->storage.read_offset, session->storage.write_offset)
; // Insert this session into our list dls_list_insert_session(session); head = (PFSFileListEntry *)head->list_node.next; if (head) { // This operation can take awhile and tends to starve out other threads while it's on going. // It typically takes 100-200ms to restore a session, so if you...
c->CR1 &= ~(I2C_CR1_TXIE | I2C_CR1_RXIE | I2C_CR1_TCIE | I2C_CR1_NACKIE | I2C_CR1_ERRIE); } void i2c_hal_abort_transfer(I2CBus *bus) { // Disable all interrupts on the bus prv_disable_all_interrupts(bus); // G...
{ i2c->ICR |= I2C_ICR_NACKCF; i2c_handle_transfer_event(bus, I2CTransferEvent_NackReceived); return; }
6, 424, 136}, { 800, 384, 152}, { 904, 376, 184}, { 1128, 424, 152}, { 1408, 616, 248}, { 1888, 760, 288}, { 1376, 440, 104}, { 1024, 280, 96}, { 1352, 224, 192}, { 1576, 88, 280}, { 1376, 80, 240}, // 107 seconds { 1136, -8, 272}, { 952, -24, 200}, { 872, -16, 16...
{ 832, 872, 328}, { 728, 840, 328}, { 672, 816, 272}, { 640, 880, 248}, { 704, 888, 264}, { 904, 1040, 272}, { 952, 976, 328}, { 1248, 1016, 520}, { 1424, 1280, 472}, { 1264, 944, 544}, { 1080, 560, 424}, { 848, 336, 176}, { 712, 280, -16}, { 544, 288, 40}, { ...
/* * 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...
("@00000001/abc")
RESENT(&walk_activity); // The expected resting calories int minutes_today = 17 * MINUTES_PER_HOUR + 3 + wait_min; const int exp_resting_kcalories_now = ROUND(s_exp_full_day_resting_kcalories * minutes_today, MINUTES_PER_DAY); exp_resting_kcalories[0] = exp_resting...
cl_assert_equal_i(actual_resting_kcalories[i], exp_resting_kcalories[i])
; } } } // --------------------------------------------------------------------------------------- // Test that we correctly initialize the setting upon startup based on the stored settings file void test_activity__settings(void) { // Should start out with defaults uint16_t height_mm; uint16_t weight_dag;...
ext_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); layer_add_child(&window->layer, &msg_text_layer->layer); msg_text_layer = &data->msg_text_layer[2]; text_layer_init(msg_text_layer, &GRect(0, 64, window->layer.bounds.size.w, 40)); if (data->test_case >= FLASH_TEST_CASE_RUN_SWITCH_MODE_ASYNC) { te...
window_set_user_data(test_window, data)
; window_set_click_config_provider(test_window, click_config_provider); const bool animated = true; app_window_stack_push(test_window, animated); } static void flash_test_window_load(Window *window) { struct FlashTestData *data = (struct FlashTestData*) window_get_user_data(window); // Configure menu items...
text) { Tuple *tuple = dict_find(it, PostMessageKeyChunk); if (tuple) { if (!prv_handle_chunk_received(tuple)) { PBL_LOG(LOG_LEVEL_ERROR, "Resetting because bad Chunk!"); prv_session_open__exit_and_initiate_reset(); } } else if (dict_find(it, PostMessageKeyResetRequest)) { prv_awaiting_res...
(true /* should_send_reset_request */)
if (turn_sensor_on && !hrm_is_enabled(HRM)) { // Turn on the sensor now HRM_LOG("Turning on HR sensor"); s_manager_state.accel_state = sys_accel_manager_data_subscribe( ACCEL_SAMPLING_25HZ, prv_handle_accel_data, NULL, PebbleTask_NewTimers); accel_manager_set_jitterfree_sampling_ra...
if (free_space < sizeof(PebbleHRMEvent)) { circular_buffer_consume(&s_manager_state.system_task_event_buffer, sizeof(PebbleHRMEvent)); ++s_manager_state.dropped_events; }
circular_buffer_write(&s_manager_state.system_task_event_buffer, (const uint8_t *)event, sizeof(PebbleHRMEvent)); } static void prv_populate_hrm_event(PebbleHRMEvent *event, HRMFeature feature, const HRMData *data) { switch (feature) { case HRMFeature_BPM: *event = (PebbleHRMEven...
PBL_ASSERT(state->test_entry.name[0] == 0, "Unexpected start of new samples"); token = strtok(NULL, "("); // Copy starting from token + 1 to skip the '*' at the front strncpy(state->test_entry.name, token + 1, sizeof(state->test_entry.name)); printf("\nParsing function samples: %s", state->te...
strcmp(token, "TEST_TOTAL_MAX")
== 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.max); } else if (strcmp(token, "TEST_DEEP") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.deep.value); } else if (strcmp(token, "TEST_DEEP_MIN") == 0) { sscanf(token + strlen(token) + ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (int i = 0; i < NUM_BUTTONS; ++i) { button_state |= (button_is_pressed(i) ? 0x01 : 0x00) << i; }
return button_state; } void button_init(void) { periph_config_acquire_lock(); periph_config_enable(RCC_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG); initialize_button_common(); for (int i = 0; i < NUM_BUTTONS; ++i) { initialize_button(&BOARD_CONFIG_BUTTON.buttons[i]); } periph_config_disable(RCC_AP...
b/ui/animation_private.h" #include "drivers/display/display.h" #include "kernel/event_loop.h" #include "kernel/kernel_applib_state.h" #include "kernel/ui/kernel_ui.h" #include "kernel/ui/modals/modal_manager.h" #include "mcu/cache.h" #include "popups/timeline/peek.h" #include "process_management/app_manager.h" #include...
(&dest_bitmap, &src_bitmap, GPoint(x_range_begin.integer, y), GCompOpAssign, GColorWhite)
/* * 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...
graphics_context_set_stroke_color(ctx, GColorBlack)
; graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(-25, 35), GPoint(15, 40)); } void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_stroke_width(ctx, 1...
rt_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment)); } void test_ppogatt__receive_ack_for_all_packets_in_flight(void) { test_ppogatt__open_session_when_found_pebble_app(); uint8_t sn = 0; Transport *transport = ppogatt_cli...
regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS)
; } fake_comm_session_process_send_next(); // The data should *NOT* get concatenated in a single packet, even though it might fit. The // fragmentation should be the same as the previous transmission pass, because there is a race // condition where there are Ack(s) in flight for the "original" data packets....
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_pending_did_write.attribute == attribute)
RECT_ODD, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_even_clip"))); // Clipping on odd boundaries - no offset ...
(&ctx, fb)
l prv_remove_event_listener_from_list(const char *event_name, jerry_value_t listener) { ListenerQueryData data = { .listener = listener, }; prv_iterate_event_listeners(event_name, prv_remove_listener, &data); return data.found; } // implementation of .on(event_name, handler) and stores them in a new prope...
rocky_add_function(rocky, ROCKY_ON, prv_add_event_listener)
; prv_copy_property(rocky, ROCKY_ON, ROCKY_ADD_EVENT_LISTENER); rocky_add_function(rocky, ROCKY_OFF, prv_remove_event_listener); prv_copy_property(rocky, ROCKY_OFF, ROCKY_REMOVE_EVENT_LISTENER); JS_UNUSED_VAL = rocky_add_constructor(ROCKY_EVENT_CONSTRUCTOR, prv_event_constructor); API_REFS_FOREACH(api_ref) ...
static int16_t prv_get_cell_height_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { const bool is_selected = menu_layer_is_index_selected(menu_layer, cell_index); OptionMenu *option_menu = context; if (option_menu->callbacks.get_cell_height) { ...
menu_layer_set_callbacks(&option_menu->menu_layer, option_menu, &(MenuLayerCallbacks) { .get_cell_height = prv_get_cell_height_callback, .get_num_rows = prv_get_num_rows_callback, .draw_row = prv_draw_row_callback, .select_click = prv_select_callback })
; menu_layer_set_click_config_onto_window(&option_menu->menu_layer, window); if (option_menu->choice != OPTION_MENU_CHOICE_NONE) { menu_layer_set_selected_index(&option_menu->menu_layer, MenuIndex(0, option_menu->choice), MenuRowAlignCenter, false); } layer_add_child(window...
celData = 15, AppMessageKey_SerialNumber = 16, AppMessageKey_Model = 17, AppMessageKey_HRMProtocolVersionMajor = 18, AppMessageKey_HRMProtocolVersionMinor = 19, AppMessageKey_HRMSoftwareVersionMajor = 20, AppMessageKey_HRMSoftwareVersionMinor = 21, AppMessageKey_HRMApplicationID = 22, AppMessageKey_HRMH...
(serial_number_buffer, sizeof(serial_number_buffer))
; dict_write_data(app_data->out_iter, AppMessageKey_SerialNumber, (uint8_t*) serial_number_buffer, sizeof(serial_number_buffer)); #if IS_BIGBOARD WatchInfoColor watch_color = WATCH_INFO_MODEL_UNKNOWN; #else WatchInfoColor watch_color = mfg_info_get_watch_color(); #endif // IS_BIGBOARD dict_wr...
PNG_NAME); cl_assert(resource_id != UINT32_MAX); GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id); cl_assert(bitmap_sequence); GBitmap *bitmap = gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(bitmap_sequence), GBitmapFormat8B...
gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL)
raphics_text_layout_get_max_used_size(&gcontext, "JR\n\nWhop", font, box, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, (void*)&layout); cl_assert_equal_i(layout.box.size.w, box.size.w); cl_assert_equal_i(layout.max_used_size.w, 2 * HORIZ_ADVANCE_PX); // only the JR, since Whop is not being layed out c...
(layout.max_used_size.w, 1 * HORIZ_ADVANCE_PX)
/* * 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...
spi_slave_burst_read_write_scatter(BMI160_SPI, sg_info, ARRAY_LENGTH(sg_info))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_click_config_provider_with_context(window, prv_click_config_provider, data)
; const bool animated = true; app_window_stack_push(window, animated); } static void prv_deinit(void) { MorphSquareDemoData *data = app_state_get_user_data(); app_free(data); } /////////////////////////// // App boilerplate /////////////////////////// static void s_main(void) { prv_init(); app_event_loo...
no // additional locking is needed #define LOG_LOCKED(logged_lr, new_lr) \ if (logged_lr == 0) { \ logged_lr = new_lr; \ } #define LOG_UNLOCKED(logged_lr, nest_count) \ if (nest_count == 1) { \ logged_lr = 0; \ } static PebbleMutexCommo...
(handle->common.lr, myLR)
; return (true); } return (false); } bool mutex_is_owned_recursive(PebbleRecursiveMutex * handle) { LightMutexHandle_t mutex = handle->common.freertos_mutex; void* holder = xLightMutexGetHolder(mutex); void* current = xTaskGetCurrentTaskHandle(); return (holder == current); } void mutex_unlock_recurs...
{ 80, 640, -864}, { -16, 632, -872}, { -128, 704, -784}, { -216, 752, -760}, { -264, 848, -744}, { -296, 760, -632}, { -272, 600, -520}, { -272, 536, -320}, { -56, 680, -112}, { 72, 952, 80}, { 168, 960, 344}, { 208, 960, 456}, { 136, 1024, 384}, { 48, 968, 328}, ...
// 97 seconds { 32, 584, -824}, { 32, 576, -832}, { 24, 568, -832}, { 8, 544, -824}, { 32, 568, -856}, { 8, 560, -840}, { 24, 544, -824}, { 24, 568, -800}, { 32, 600, -816}, { 32, 576, -832}, { 24, 536, -832}, { 32, 552, -840}, { 16, 600, -824}, { 16, 584, -77...
{ 16, 600, -800}, { 16, 592, -800}, { 8, 584, -800}, { 24, 552, -824}, { 24, 544, -840}, // 100 seconds { 16, 600, -808}, { 16, 600, -800}, { 24, 584, -816}, { 16, 584, -800}, { 16, 600, -816}, { 16, 584, -800}, { 16, 592, -808}, { 16, 592, -808}, { 16, 592, ...
gnizer *recognizer, void *context); void test_recognizer_manager__dispatch_touch_event(void) { bool handled = false; s_test_impl_data.handled = &handled; NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, NULL); // Copied from recognizer_manager.c TouchEvent t; struct ProcessTouchCtx { Reco...
window_get_recognizer_list(&window)
); recognizer_add_to_list(recognizers[1], &layer_a.recognizer_list); recognizer_add_to_list(recognizers[2], &layer_b.recognizer_list); recognizer_add_to_list(recognizers[3], &layer_c.recognizer_list); prv_set_all_states(recognizers, k_rec_count, RecognizerState_Started); // Layer C's recognizers reset when ...
(&file_record->hdr, sample_utc, true /*to_file*/)
; } // Put in this minute file_record->samples[sample_idx].v5_fields = data->base; file_record->samples[sample_idx].heart_rate_bpm = data->heart_rate_bpm; file_record->hdr.num_samples = sample_idx + 1; if (was_sleeping) { // Zero out if we were sleeping in this minute file_record->samples[sample_i...
TransportDestinationSystem); Uuid legacy_app_uuid = { 0xff, 0xc5, 0x24, 0x01, 0x4d, 0xbe, 0x40, 0x8b, 0xb7, 0x3a, 0x0e, 0x80, 0xef, 0x09, 0xaf, 0x74}; // Legacy transport (iAP) isn't aware of the app UUID, so don't set anything: Transport *legacy_transport = (Transport *) TransportID2; CommSess...
comm_session_send_next(session)
; comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(fake_system_task_count_callbacks(), 0); cl_assert_equal_i(s_send_next_count, 0); } static bool prv_schedule_send_next(CommSession *session) { return true; } static b...
ffer_clear(FrameBuffer* f) { } void framebuffer_dirty_all(FrameBuffer *fb) { } GBitmap framebuffer_get_as_bitmap(FrameBuffer *fb, const GSize *size) { return (GBitmap) { }; } void framebuffer_set_line(FrameBuffer* f, uint8_t y, const uint8_t* buffer) { } GDrawState graphics_context_get_drawing_state(GContext* ctx...
cl_assert_equal_i(s_count_animation_schedule, 2)
); cl_assert(test_image_bw != NULL); test_image_color = get_gbitmap_from_pbi("test_rotated_bitmap_redstar.Xbit.pbi"); cl_assert(test_image_color != NULL); } void test_graphics_draw_rotated_bitmap__cleanup(void) { free(fb); if (test_image_bw) { if (test_image_bw->addr) { free(test_image_bw->addr); ...
(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_set_corner_45.Xbit.pbi")
); // Top-left center rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPoint(27, 40), DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,...
pStateLightSleep; s_sleep_state_seconds = SMART_ALARM_MAX_LIGHT_SLEEP_S - 15 * SECONDS_PER_MINUTE; // Smart alarms are first triggered by cron at T-30min prv_set_time(s_current_day, 10, 0); cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 0); // ...
rtc_get_time()
); }
ph->HISR & DMA_HISR_HTIF7; break; default: WTF; } prv_clear_all_interrupt_flags(this); } // Controller clock control //////////////////////////////////////////////////////////////////////////////// static void prv_use_controller(DMAController *this) { const int old_refcount = atomic_fetch_add(&...
(this->stream->controller->periph == DMA2)
; break; default: WTF; } this->stream->state->initialized = true; prv_set_constant_config(this); this->state->initialized = true; } // Transfer APIs //////////////////////////////////////////////////////////////////////////////// static void prv_validate_memory(DMARequest *this, void *dst, c...
toLocaleTimeString(undefined, " "{hour: undefined, minute: undefined, second: undefined});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05"); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleTimeString(undefined, {minute: 'numeric', hour: '2-digit'})", "TypeError: Unsupported options" ); } void te...
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'short'});")
; ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'long'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Monday"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "7"); EXECUTE_SCRIPT("s = d.toLocaleDateString(...
teps: %"PRId32, steps); if (steps >= 27 && steps <= 33) { passed = true; } prv_test_end(context, passed); } // ------------------------------------------------------------------------------- static void prv_test_30_min_walk(void *context) { bool passed = false; activity_prefs_activity_insights_set_ena...
(LOG_LEVEL_DEBUG, "entry minute: %d", (int)(value / SECONDS_PER_MINUTE))
; activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "exit minute: %d", (int)(value / SECONDS_PER_MINUTE)); activity_get_metric(ActivityMetricSleepState, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "sleep state: %d", (int)value); activity_get_metric(ActivityMetricSleepState...
tup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); #endif } // -------------------------------------------------------------------------------------- // Test a sequence animation with...
prv_count_handler_entries(&s_setup_handler_calls, b)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, inner_seq), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_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...
st_locked_sectors(void) { // write 0's to the entire flash static uint8_t buf[2048] = { 0 }; char status[80]; __disable_irq(); for (int i = 0; i < 2; i++) { for (uint32_t addr = 0; addr < BOARD_NOR_FLASH_SIZE; addr += sizeof(buf)) { if (addr >= FLASH_REGION_SAFE_FIRMWARE_BEGIN && addr <...
{ char name[10]; for (int i = 0; i < 100; i++) { snprintf(name, sizeof(name), "litter%d", i); int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 300); if (i % 5 == 0) { pfs_close_and_remove(fd); } else { pfs_close(fd); } } }
#endif #endif static GAPLEConnection *prv_get_le_connection_and_print_info(void) { GAPLEConnection *conn = gap_le_connection_any(); if (!conn) { prompt_send_response("No device connected"); } else { char buf[80]; prompt_send_response_fmt(buf, sizeof(buf), "Connected to " BT_DEVICE_ADDRESS_FMT, ...
steps_total, steps_average, &percentage); const bool above_fail_threshold = steps_total >= ACTIVITY_SUMMARY_PIN_CONFIG.insight_settings->summary.activity.max_fail_steps; if ((tier == PercentTier_BelowAverage || tier == PercentTier_Fail) && above_fail_thr...
("Goooood morning! You slept for %dH %dM which is %d%% below your typical. " "Go crush your day and then get back in bed 😉")
, }, }, [PercentTier_Fail] = { .num_variants = 3, .variants = { i18n_noop("You slept for %dH %dM which is %d%% below your typical. " "Sleep is vital for all your great ideas–how 'bout getting more tonight?"), i18n_noop("You only slept for %dH %dM which is %d%%...
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, GCornersRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIG...
(ctx, &box, radius, GCornersAll)
; // Top right corner of clipping box box.origin.x = CLIP_RECT_CLIP_BOX.size.w - BOX_SIZE; box.origin.x += nudge; graphics_fill_round_rect(ctx, &box, radius, GCornersAll); // Bottom right corner of clipping box box.origin.y = CLIP_RECT_CLIP_BOX.size.h - BOX_SIZE; box.origin.y += nudge; graphics_fill_r...
oy_pstring16(short_phrase); *size_out = entry_size; return entry; } static void prv_initialize_entries(void) { for (int idx = 0; idx < WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; idx++) { WeatherDBEntry *entry = prv_create_entry(&s_entry_bases[idx], s_entry_na...
{ return weather_shared_data_get_index_of_key(key) != -1; }
status_t weather_db_insert_stale(const uint8_t *key, int key_len, const uint8_t *val, int val_len); size_t weather_shared_data_insert_stale_entry(WeatherDBKey *key) { const WeatherDBEntry stale_entry = { .version = WEATHER_DB_CURRENT_VERSION - 1, .is_current_location = true, .current_temp = 68, .cu...
itialize region that is to be written uint16_t data_buffer = 0x0; uint8_t bitpos = 0; uint16_t read_buffer = 0x0; // Ensure within test data region and aligned to sector boundary uint32_t addr_region = (FLASH_TEST_ADDR_START + SECTOR_SIZE_BYTES) & SECTOR_ADDR_MASK; // Loop on each data bit - erase the sec...
flash_erase_sector_blocking(test_addr)
a); } static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx, const Layer *cell_layer, uint16_t row, bool selected) { SettingsVibePatternsData *data = (SettingsVibePatternsData *)context; const char *title = NULL; const char *subtitle = NULL; VibeClient client = Vib...
(client, current_vibe_score)
; alerts_preferences_set_vibe_score_for_client(client, new_vibe_score); settings_menu_mark_dirty(SettingsMenuItemVibrations); VibeScore *score = vibe_client_get_score(client); if (!score) { return; } vibe_score_do_vibe(score); vibe_score_destroy(score); } static uint16_t prv_num_rows_cb(SettingsCallb...
_indicator_create(), NULL); } void test_content_indicator__init_should_add_to_buffer(void) { ContentIndicator content_indicator; for (size_t i = 0; i < CONTENT_INDICATOR_BUFFER_SIZE; i++) { content_indicator_init(&content_indicator); helper_check_buffer_for_content_indicator(i, &content_indicator); } ...
content_indicator_set_content_available(&content_indicator, direction, true)
"pulse.h" #include <stdbool.h> #include <stdint.h> #include <string.h> #include "console/cobs.h" #include "console/console_internal.h" #include "console/dbgserial.h" #include "console/pulse_internal.h" #include "console/pulse_llc.h" #include "console/pulse_protocol_impl.h" #include "kernel/pbl_malloc.h" #include "os...
{ prv_handlers_notify_state_changed(PulseLinkState_Closed); pulse_llc_send_link_closed_msg(); for (unsigned int i = 0; i < ARRAY_LENGTH(s_receive_buffers); ++i) { kernel_free(s_receive_buffers[i]); } s_current_receive_buffer = NULL; new_timer_delete(s_keepalive_timer); s_keepalive_timer = TIMER_INVAL...
void pulse_prepare_to_crash(void) { } static void prv_process_received_frame(void *frame_ptr) { IncomingPulseFrame *frame = frame_ptr; uint32_t fcs; // Comply with strict aliasing rules. The memcpy is optimized away. memcpy(&fcs, &frame->data[frame->length - sizeof(fcs)], sizeof(fcs)); uint32_t crc = legac...
tent_indicator_set_content_available(&content_indicator, direction, false); cl_assert_equal_p(dummy_config.layer->update_proc, direction_data->original_update_proc); cl_assert_equal_p(direction_data->original_update_proc, s_content_indicator_dummy_layer_update_proc); } void test_content_indicat...
(dummy_config.layer->update_proc, prv_content_indicator_update_proc)
; // Direction data should be emptied and layer's update proc should return to original when NULL // config is passed cl_assert(content_indicator_configure_direction(&content_indicator, direction, NULL)); cl_assert_equal_p(dummy_config.layer->update_proc, s_content_indicator_dummy_layer_update_proc); cl_asse...
ue_length = sizeof(out); bool has_more = true; const uint16_t next_length = gatt_client_subscriptions_consume_notification(&handle_out, out, &value_length, GAPLEClientApp, &has_more); cl_assert_equal_i(handle_out, BLE_CHARACTERISTIC_INVALID); cl...
(gatt_client_get_event_pending_state(GAPLEClientKernel), true)
; fake_event_clear_last(); // fake pend an event to the app gatt_client_subscriptions_reschedule(GAPLEClientApp); cl_assert_equal_b(gatt_client_get_event_pending_state(GAPLEClientApp), true); fake_event_clear_last(); } static void prv_assert_no_pending_events_to_kernel_and_app(void) { cl_assert_equal_b(ga...
/* * 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...
graphics_context_set_antialiased(ctx, false)
; graphics_draw_circle(ctx, GPoint(14, 28), 12); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, -14), 12); } void test_graphics_draw_circle_${BIT_DEPTH_NA...
void prv_draw_background_rect(ActionBarLayer *action_bar, GContext *ctx, GColor bg_color) { graphics_fill_rect(ctx, &action_bar->layer.bounds); } void prv_draw_background_round(ActionBarLayer *action_bar, GContext *ctx, GColor bg_color) { const uint32_t action_bar_circle_diameter = DISP_ROWS * 19 / 9; GRect acti...
{ action_bar->animation[i] = ActionBarLayerIconPressAnimationMoveLeft; }
} ActionBarLayer* action_bar_layer_create(void) { ActionBarLayer* layer = applib_type_malloc(ActionBarLayer); if (layer) { action_bar_layer_init(layer); } return layer; } void action_bar_layer_deinit(ActionBarLayer *action_bar_layer) { if (action_bar_layer->redraw_timer) { app_timer_cancel(action_b...
uint32_t word_mask = dcache_alignment_mask_minimum(QSPI_DMA_READ_WORD_SIZE); const uintptr_t buffer_address = (uintptr_t)buffer; const uintptr_t last_address = buffer_address + length; const uintptr_t last_address_aligned = last_address & (~word_mask); const uintptr_t start_address_aligned = ((buffer_address...
prv_set_comm_config(modes_bitset, 0)
; uint32_t loops = 0; while (QSPI_GetFlagStatus(QSPI_FLAG_SM) == RESET) { if ((timeout_us != QSPI_NO_TIMEOUT) && (++loops > timeout_us)) { PBL_LOG(LOG_LEVEL_ERROR, "Timeout waiting for a bit!?!?"); return false; } delay_us(1); } // stop polling mode QSPI_AbortRequest(); prv_wait_fo...
glance with two slices app_glance_reload(prv_basic_reload_cb, s_test_state.context); cl_assert_equal_b(s_test_state.reload_callback_was_called, true); // Read the glance back AppGlance glance = {}; cl_assert_equal_i(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, &glance), S_SUCCESS); // Compare the gla...
(app_glance_add_slice(session, slice) & APP_GLANCE_RESULT_INVALID_TEMPLATE_STRING)
; // Check that adding a slice that expires in the past fails slice = (AppGlanceSlice) { .expiration_time = rtc_get_time() - 10, .layout.icon = APP_GLANCE_SLICE_DEFAULT_ICON, .layout.subtitle_template_string = "Test subtitle", }; cl_assert(app_glance_add_slice(session, slice) & APP_GLANCE_RESULT_EX...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((uintptr_t)buffer % 8 == 0)
; rv = jerry_exec_snapshot(buffer, buffer_size, false); } else { PBL_LOG(LOG_LEVEL_INFO, "Not a snapshot, interpreting buffer as JS source code"); rv = jerry_eval((jerry_char_t *) buffer, buffer_size, false); } bool error_occurred = jerry_value_has_error_flag(rv); if (error_occurred) { jerry_va...
/* * 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->state->spi_clock_periph = RCC_APB2Periph_SPI1; bus->state->spi_clock_periph_speed = clocks.PCLK2_Frequency; bus->state->spi_apb = SpiAPB_2; }
else if (bus->spi == SPI2) { bus->state->spi_clock_periph = RCC_APB1Periph_SPI2; bus->state->spi_clock_periph_speed = clocks.PCLK1_Frequency; bus->state->spi_apb = SpiAPB_1; } else if (bus->spi == SPI3) { bus->state->spi_clock_periph = RCC_APB1Periph_SPI3; bus->state->spi_clock_periph_speed = clo...
/* * 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...
(argc, argv, RockyAPIPathStepType_LineTo)
; } JERRY_FUNCTION(prv_stroke) { GContext *const ctx = rocky_api_graphics_get_gcontext(); GPoint p = {0}; GPointPrecise pp = {.x = {0}, .y = {0}}; bool moved_already = false; #define ASSIGN_P(new_p) do { \ moved_already = true; \ p = GPointFromGPointPrecise(new_p); \ pp = new_p; \ } while (0)...
upported options"); } return 0; } struct tm tm; prv_tm_from_js_date(this_val, &tm); const char *strftime_format = prv_strftime_format(format, is_24h_style); const size_t str_len = strftime(buffer, buffer_len, strftime_format, &tm); const bool strip_leading_char = buffer[0] == '0' && prv_strip_lea...
jerry_get_object_field(date_constructor, "prototype")
; JS_VAR locale_time_string = jerry_create_external_function(prv_to_locale_time_string); jerry_set_object_field(date_prototype, ROCKY_DATE_TOLOCALETIMESTRING, locale_time_string); JS_VAR locale_date_string = jerry_create_external_function(prv_to_locale_date_string); jerry_set_object_field(date_prototype, ROCKY_...
se PEBBLE_BT_STATE_EVENT: settings_glance->glance_state.is_airplane_mode_enabled = bt_ctl_is_airplane_mode_on(); break; case PEBBLE_DO_NOT_DISTURB_EVENT: settings_glance->glance_state.is_quiet_time_enabled = do_not_disturb_is_active(); break; #if CAPABILITY_HAS_BUILTIN_HRM case PEBBLE_BL...
(&settings_glance->hrm_sharing_event_info, PEBBLE_BLE_HRM_SHARING_STATE_UPDATED_EVENT, structured_glance)
; #endif return &structured_glance->glance; }
CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "flash_region/flash_region.h" #include "syscall/syscall.h" #include "services/normal/wakeup.h" #include "services/common/event_service.h" #include "se...
(wakeup_entry_v1.notify_if_missed)
; uuid_equal(&wakeup_entry_v1.uuid, &app_uuid); close_settings_file(&file); // Migrate the timezone and check that the new entry is correct and the second version // of a Wakeup Entry wakeup_init(); WakeupEntryV2 wakeup_entry_v2; open_settings_file(&file); cl_must_pass(settings_file_exists(&file, (...