prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <string.h> #include "clar.h" #include "drivers/system_flash.h" #define KiB *1024 // Se...
cl_assert(flash_locked)
; cl_assert_(countdown <= 0, "Callback not called enough times"); } void malloc_flash_data(uint32_t size) { flash_data_length = size; flash_written_data = malloc(size * sizeof(uint8_t)); cl_assert(flash_written_data); flash_written_flag = malloc(size * sizeof(bool)); cl_assert(flash_written_flag); } void...
/* * 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...
(dest, "Katharine")
; } void test_phone_formatting__name_multiple(void) { char dest[NAME_LENGTH]; phone_format_caller_name("Katharine Claire Berry", dest, NAME_LENGTH); cl_assert_equal_s(dest, "Katharine C. B."); } void test_phone_formatting__name_double_space(void) { char dest[NAME_LENGTH]; phone_format_caller_name("Katharin...
(state->manager_state, num_samples); PBL_ASSERTN(success); return num_samples; } // --------------------------------------------------------------------------------------------- // Called by sys_accel_manager when we have data available for this subscriber static void prv_do_data_handle(void *context) { AccelSe...
{ AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_shake_subscribe(session, handler); }
// ---------------------------------------------------------------------------------------------- void accel_tap_service_unsubscribe(void) { AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_shake_unsubscribe(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...
kernel_malloc(chunk_size)
; if (!*buffer) { PBL_LOG(LOG_LEVEL_WARNING, "Insufficient memory for a large CRC buffer, going slow"); chunk_size = 128; *buffer = kernel_malloc_check(chunk_size); } return chunk_size; } uint32_t flash_crc32(uint32_t flash_addr, uint32_t num_bytes) { void *buffer; unsigned int chunk_size = prv_...
/* * 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 walk_100_temp_95861_1 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { 136, 48, -1008}, { 5...
{ 256, 480, -800}, { 184, 408, -704}, { 168, 392, -728}, { 136, 232, -728}, { 8, 288, -784}, { -24, 280, -968}, { 0, 312, -1072}, { -16, 304, -1040}, { -40, 384, -1120}, { -88, 400, -1040}, { -88, 408, -1136}, { -64, 568, -1368}, { 120, 536, -1128}, { 48, 392, -8...
/* * 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...
{ sports_app_data->current_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM);; }
} static void prv_sync_error_callback(DictionaryResult dict_error, AppMessageResult app_message_error, void *context) { PBL_LOG(LOG_LEVEL_DEBUG, "Sports error! dict: %u, app msg: %u", dict_error, app_message_error); } static void prv_update_scrollable_metrics(SportsAppData...
iptions[c] == BLESubscriptionNone) { // Client unsubscribed in the mean-time. Confirmation should already have been sent. continue; } if (has_error) { // Subscribe failed. Record that the client is not subscribed and release buffer: subscription->subscriptions[c] = BLESubscri...
(LOG_LEVEL_ERROR, "Couldn't copy the number of requested byes (%u vs %u)", header.value_length, copied_length)
; } *characteristic_ref_out = header.characteristic; *value_length_in_out = copied_length; } else { PBL_LOG(LOG_LEVEL_ERROR, "Client didn't provide buffer that was big enough (%u vs %u)", *value_length_in_out, header.value_length); *characteristic_ref_out = ...
{ GAPLEConnection *connection = gap_le_connection_by_addr(&event->dev_address); if (!connection) { goto unlock; } connection->gatt_connection_id = event->connection_id; connection->gatt_mtu = event->mtu; BLE_LOG_DEBUG("GATT Connection for " BT_DEVICE_ADDRESS_FMT, BT_DEVIC...
unlock: bt_unlock(); } void bt_driver_cb_gatt_handle_disconnect(const GattDeviceDisconnectionEvent *event) { bt_lock(); { GAPLEConnection *connection = gap_le_connection_by_addr(&event->dev_address); if (!connection) { goto unlock; } connection->gatt_connection_id = 0; connection->gatt...
0x0}, { 0, 0x25, 2097, 0x0}, { 0, 0x25, 1897, 0x0}, { 0, 0x25, 1713, 0x0}, { 0, 0x36, 4947, 0x0}, { 0, 0x25, 2295, 0x0}, // 720: Local time: 11:05:00 AM { 8, 0x35, 3147, 0x0}, { 11, 0x67, 2486, 0x0}, { 22, 0x66, 4699, 0x0}, { 0, 0x74, 1135, 0x0}, { 15, 0x66, 1971, 0x0}, {...
{ 0, 0x65, 4632, 0x0}, { 0, 0x45, 2974, 0x0}, { 25, 0x52, 5406, 0x0}, { 56, 0x51, 5298, 0x0}, { 0, 0x64, 4123, 0x0}, { 12, 0x62, 2163, 0x0}, { 6, 0x61, 6879, 0x0}, { 0, 0x8b, 1679, 0x0}, { 6, 0x75, 1511, 0x0}, { 0, 0x74, 2231, 0x0}, { 0, 0x74, 772, 0x0}, { 0, 0x73, 85, 0x...
{ 25, 0x34, 2601, 0x0}, { 41, 0x64, 4857, 0x0}, { 0, 0x73, 1613, 0x0}, // 885: Local time: 01:50:00 PM { 0, 0x73, 1284, 0x0}, { 0, 0x73, 571, 0x0}, { 0, 0x74, 2752, 0x0}, { 0, 0x83, 941, 0x0}, { 0, 0x47, 1950, 0x0}, { 0, 0x76, 1348, 0x0}, { 18, 0x61, 4306, 0x0}, { 0, 0x4...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
while (true) { psleep(100); }
} // ================================================================================= static void long_timer_callback(void* data) { int idx = (int)data; PBL_ASSERTN(idx >= 0 && idx < NUM_MAX_TIMERS); PBL_LOG(LOG_LEVEL_DEBUG, "STT long running callback %d executed", idx); s_app_data->fired_time[idx] = rtc_ge...
// KernelBG not getting scheduled quickly enough. PBL_ASSERTN(!mbuf_get_next(&s_header_mbuf)); mbuf_append(&s_header_mbuf, context); mbuf_iterator_init(&s_read_consumer.mbuf_iter, &s_header_mbuf); smartstrap_fsm_state_set(SmartstrapStateReadInProgress); } result = false; } if (!r...
mbuf_iterator_is_finished(&s_send_info.mbuf_iter)
) { // The write was not successful, so return an error return SmartstrapResultBusy; } } return SmartstrapResultOk; } void smartstrap_cancel_send(void) { // Enter a critical region to prevent anybody else changing the state. portENTER_CRITICAL(); SmartstrapState state = smartstrap_fsm_state_...
Ack'd. uint16_t payload_size = prv_get_payload_size_for_sn(client, client->out.next_data_sn); if (payload_size == 0) { PBL_ASSERTN(read_space >= offset); payload_size = read_space - offset; if (payload_size == 0) { // No data to send return NULL; } // Cap to the size that the GATT ...
bt_lock_assert_held(true)
; PPoGATTClient *client = (PPoGATTClient *) transport; if (!prv_is_client_valid(client)) { // Client became invalid in the mean time return; } prv_send_next_packets(client); } // ------------------------------------------------------------------------------------------------- void ppogatt_close(struct...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(!app_state_get_unobstructed_area_state()->handlers.change)
; cl_assert(!app_state_get_unobstructed_area_state()->handlers.did_change); // Subscribing should use the event service UnobstructedAreaHandlers handlers = { .will_change = prv_will_change, .change = prv_change, .did_change = prv_did_change, }; app_unobstructed_area_service_subscribe(handlers, s_...
/* * 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...
(lr_str, "???", sizeof(lr_str))
; } char pc_str[16]; if (crash_info->pc_known) { sniprintf(pc_str, sizeof(pc_str), "%p", (void*) crash_info->pc); } else { strncpy(pc_str, "???", sizeof(pc_str)); } char buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&crash_info->app_uuid, buffer); char *process_string = (crash_info->task ...
RECT_TEXT_0_0 GRect(0, 0, 140, 1000) #define RECT_TEXT_2_0 GRect(2, 0, 140, 1000) void test_graphics_draw_text_${BIT_DEPTH_NAME}__clipping_letters(void) { GContext ctx; prv_setup_resources(); uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18_BOLD; cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &...
("draw_text_null_h", fb, GColorWhite)
); // Test negative text bounds size - ensure nothing is rendered setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG, GTextOverflowModeTrailingEllipsis, GTextAlignmen...
yer->previous = NULL; // let the client know we have moved to another layer prv_announce_layout_did_appear(swap_layer, swap_layer->current, +1); // refresh the layer down below in case we have jumped around in our data model prv_refresh_next_layer(swap_layer); } static Animation *prv_create_swap_down_animati...
prv_scroll_to_top(swap_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...
if (conn_idx != BLE_CONN_IDX_INVALID) { Connection *conn = connection_by_idx(conn_idx); if (conn) { connection_set_gateway(conn, false); } }
PBL_LOG(LOG_LEVEL_DEBUG, "Removed pairing for "BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(info->identity.address)); } void bonding_sync_handle_pairing_completed(Connection *connection, uint16_t conn_idx) { BleBonding bonding = {}; SMPairingInfo *info = &bonding.pairing_info; bool success = fal...
_equal_i(num_records, num_minutes); cl_assert_equal_i(start, start_utc); for (int i = 0; i < num_minutes; i++) { prv_assert_minute_data(&retrieve[i], &minute_data[i]); } // Retrieve, trying to start from a lot farther back, it should return the UTC of the first // record available. Also ask for more than...
rtc_get_time()
- SECONDS_PER_MINUTE; fake_rtc_increment_time(30); // 30 seconds s_alg_next_steps = exp_steps; AccelRawData samples[100] = { }; uint64_t timestamp = 0; // Calling activity_algorithm_handle_accel() on our stub algorithm registers the new steps // counts for this minute activity_algorithm_handle_accel(samp...
LKIO_CMD_DOMAIN_STAT (6) #define BULKIO_CMD_DOMAIN_ERASE (7) #define BULKIO_RESP_DOMAIN_OPEN (128) #define BULKIO_RESP_DOMAIN_CLOSE (129) #define BULKIO_RESP_DOMAIN_READ (130) #define BULKIO_RESP_DOMAIN_WRITE (131) #define BULKIO_RESP_DOMAIN_CRC (132) #define BULKIO_RESP_DOMAIN_STAT (133) #define BULKIO_RESP_DOMAIN_ER...
(resp->bad_command, cmd, command_len)
; pulse_reliable_send(resp, response_len); } static int prv_get_fresh_fd(PulseBulkIODomainHandler *domain_handler, PulseTransferFD **fd) { for (int i=0; i < MAX_PULSE_FDS; ++i) { if (s_transfer_fds[i].impl == NULL) { s_transfer_fds[i] = (PulseTransferFD) { .impl = domain_handler, .domain_...
er.id, &s_items[3].header.id)); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); } void test_timeline__all_day_past(void) { prv_insert_all_day_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; TimelineItem ear...
timeline_init(&head)
ributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "animated_demo.h" #include "applib/app.h" #include "process_st...
{ window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler)click_handler); window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler)click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler)click_handler); (void)window; }
static void handle_init(void) { AnimatedDemoData *data = (AnimatedDemoData*) app_malloc_check(sizeof(AnimatedDemoData)); data->toggle = false; app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("Animated Demo")); window_set_user_data(window, data); window_set...
*window = app_window_stack_get_top_window(); // only force render if we're not fullscreen if (!window->is_fullscreen) { // a little logic to only force update when the minute changes ApplibInternalEventsInfo *events_info = app_state_get_applib_internal_events_info(); struct tm currtime; sys_...
(&events_info->will_focus_event)
; event_service_client_subscribe(&events_info->button_down_event); event_service_client_subscribe(&events_info->button_up_event); prv_legacy2_status_bar_timer_subscribe(); // a no-op on sdk3+ applications event_loop_upkeep(); // Event loop: while (1) { PebbleEvent event; sys_get_pebble_event(&eve...
esting_calories, uint32_t active_calories, uint32_t distance_mm, bool shutting_down, KAlgActivitySessionCallback sessions_cb, void *context) { } time_t kalg_activity_last_processed_time(KAlgState *state, KAlgActivityType activity) { return rtc_get_time(); } //...
(samples, s_sample_rate, timestamp)
; // Are we simulating delays in KernelBG processing? int delay = 0; if (simulate_bg_delays) { delay = (((i / ALG_MINUTES_PER_FILE_RECORD) + 1) % 30); rtc_set_time(rtc_get_time() + delay); } s_alg_next_vmc = minute_data[i].base.vmc; s_alg_next_orientation = minute_data[i].base.orien...
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "jerry-api.h" #include "rocky_api_graphics.h" #include "rocky_api_graphics_path2d.h" #include "rocky_api_graphics_text.h" #include "rock...
(&top_window->layer)
arator; } ActionMenuSeparatorConfig; static const ActionMenuSeparatorConfig s_separator_configs[NumPreferredContentSizes] = { [PreferredContentSizeSmall] = { .separator = {100, 1}, }, [PreferredContentSizeMedium] = { .separator = {100, 1}, }, [PreferredContentSizeLarge] = { .separator = {162, 2},...
fonts_get_font_height(aml->layout_cache.font)
; const int16_t cell_padding = prv_get_cell_padding(aml); const int num_visible_rows = MIN(prv_get_num_rows(&aml->menu_layer, 0, aml), SHORT_ITEM_MAX_ROWS_SPALDING); menu_layer_frame.size.h = (font_height * num_visible_rows) + (cell_padding ...
rn false; } *history = s_total_step_count; return true; } static bool s_abandoned_workout_notification_sent; void workout_utils_send_abandoned_workout_notification() { s_abandoned_workout_notification_sent = true; } // --------------------------------------------------------------------------------------- sta...
(&steps, &duration_s, &distance_m, &bpm, &hr_zone)
); cl_assert_equal_i(bpm, 180); cl_assert_equal_i(hr_zone, 3); cl_assert_equal_i(duration_s, 10 * SECONDS_PER_MINUTE + 10); cl_assert(workout_service_stop_workout()); cl_assert(!workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &b...
("FAILURE: buffer_dma != buffer_pol")
; success = false; } if (memcmp(buffer_dma, buffer_mmap, size) != 0) { prompt_send_response("FAILURE: buffer_dma != buffer_mmap"); success = false; } const int buf_size = 64; char buf[buf_size]; prompt_send_response_fmt(buf, buf_size, "Size: %d DMA: %"PRIu32 " POL: %"PRIu32 " MMP: %"PRIu32, ...
ename_buf), 2, PebbleTask_App); load_fixture_on_pfs(APP2_APP_FIXTURE_NAME, filename_buf); resource_storage_get_file_name(filename_buf, sizeof(filename_buf), 2); load_fixture_on_pfs(APP2_RESOURCES_FIXTURE_NAME, filename_buf); } void test_app_install_manager__cleanup(void) { } /******...
cl_assert_equal_b(false, app_install_has_worker(music_id))
; cl_assert_equal_b(false, app_install_has_worker(sports_id)); cl_assert_equal_b(true, app_install_has_worker(bg_counter_id)); cl_assert_equal_b(false, app_install_has_worker(menu_layer_id)); cl_assert_equal_b(false, app_install_has_worker(CRAZY_ID)); } void test_app_install_manager__is_hidden(void) { cl_a...
/* * 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...
(&frame->command_list, 2)
if (key_len > SETTINGS_KEY_MAX_LEN) { return E_RANGE; }
// Find an existing record, if any, and mark it as synced settings_raw_iter_resume(&file->iter); if (search_forward(&file->iter, key, key_len)) { set_flag(&file->iter.hdr, SETTINGS_FLAG_SYNCED); settings_raw_iter_write_header(&file->iter, &file->iter.hdr); return S_SUCCESS; } return E_DOES_NOT_...
false}; char alarm_day_text_7[32] = {0}; alarm_get_string_for_custom(schedule_7, alarm_day_text_7); cl_assert_equal_s(alarm_day_text_7, "Fridays"); bool schedule_8[7] = {false, false, false, false, false, false, true}; char alarm_day_text_8[32] = {0}; alarm_get_string_for_custom(schedule_8, alarm_day_text...
cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "EVERY DAY")
; cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKDAYS, all_caps), "WEEKDAYS"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKENDS, all_caps), "WEEKENDS"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_JUST_ONCE, all_caps), "ONCE"); cl_assert_equal_s(alarm_get_string_for_kind(AL...
12}, { 80, 552, 384}, { 24, 552, 424}, { -40, 624, 384}, { 8, 712, 352}, { -32, 712, 368}, { -64, 728, 328}, { -64, 800, 344}, { -56, 864, 368}, { -96, 968, 464}, { -64, 1096, 568}, { -56, 1296, 920}, { 72, 1296, 816}, { 24, 928, 424}, { -120, 576, 352}, { -10...
{ -32, 496, 376}, { -128, 632, 384}, { -128, 776, 376}, { -120, 744, 360}, { -144, 824, 264}, // 24 seconds { -152, 816, 248}, { -152, 880, 264}, { -176, 1024, 360}, { -144, 1120, 520}, { -136, 1192, 776}, { -112, 1320, 728}, { 16, 1032, 464}, { -56, 608, 312}, ...
http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing p...
_Static_assert(offsetof(Window, layer) == 0, "")
(TIM7, TIM_IT_Update)
; NVIC_InitStructure.NVIC_IRQChannel = TIM7_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0b; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); // Set up a timer that runs at 1Hz and activates once every secon...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ALIAS("Default_Handler")
void BusFault_Handler(void); ALIAS("Default_Handler") void UsageFault_Handler(void); ALIAS("Default_Handler") void SVC_Handler(void); ALIAS("Default_Handler") void DebugMon_Handler(void); ALIAS("Default_Handler") void PendSV_Handler(void); ALIAS("Default_Handler") void SysTick_Handler(void); // External Interrupts #d...
License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "calendar.h" #include "event.h" #include "peek.h" #include "drivers/rtc.h" #inc...
for (unsigned int i = 0; i < TimelineEventServiceCount; i++) { TimelineEventState *state = &s_states[i]; if (state->impl) { state->filter_header = &filter_headers[i]; state->filter_header->common.id = UUID_INVALID; if (state->impl->will_update) { state->impl->will_update(&state->contex...
// Filter TimelineItem item = {}; const status_t rv = pin_db_next_item_header(&item, prv_item_header_filter); uint32_t timeout_ms = 0; if ((rv != S_SUCCESS) && (rv != S_NO_MORE_ITEMS)) { // A failure occurred. Call the update functions with a NULL item PBL_LOG(LOG_LEVEL_ERROR, "Failed to find next e...
ls void *s_kalg_state; // ================================================================================== // Assertion utilities // Assert that a particular activity session is present in the sessions list static void prv_assert_activity_present(KAlgTestActivitySession *sessions, int num_sessions, ...
{ s_stat_rows = stats; }
} // --------------------------------------------------------------------------------------- // Set a specific column in the last row by name static void prv_stats_set_last_row_value(const char* name, uint32_t value) { if (s_stat_rows == NULL) { return; } StatsRow *stats = (StatsRow *)list_get_tail(&s_stat...
/* * 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", "00:04:05")
; } void test_rocky_api_datetime__locale(void) { rocky_global_init(s_api); EXECUTE_SCRIPT( "var d = new Date();\n" "d.toLocaleTimeString(undefined);\n" ); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleTimeString('en-us');", "TypeError: Unsupported locale" ); EXECUTE_SCRIPT( "var d = new Dat...
No LE", data) : i18n_get("LE Only", data); } const char *connected_string = connected ? i18n_get("Connected", data) : PBL_IF_RECT_ELSE("", NULL); // Add ellipsis if the name might have been cut off by the mobile const char ellipsis[] = UTF8_ELLIPSIS_STRING; const size_t max_...
(FONT_KEY_GOTHIC_18)
; GRect box = cell_layer->bounds; box.origin.x = 15; box.origin.y = menu_cell_basic_cell_height() + (int16_t)9; box.size.w -= 30; box.size.h = 83; if (bt_ctl_is_airplane_mode_on()) { graphics_draw_text(ctx, i18n_get("Disable Airplane Mode to connect.", data), f...
/* * 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...
{ BLEHRMSharingPermission *p = prv_find_permission_by_device(device); if (!p) { p = kernel_zalloc_check(sizeof(*p)); p->device = *device; s_permissions_head = (BLEHRMSharingPermission *)list_prepend((ListNode *)s_permissions_head, (ListNod...
i18n_noop("Way to keep it active!"), i18n_noop("You got the moves!"), i18n_noop("Gettin' your step on?"), }, }; return prv_get_variant(&s_walking_intros, VARIANT_RANDOM); } case ActivitySessionType_Run: { static const InsightCopyVariants s_running_intros = {...
health_util_format_distance(distance_str, distance_buf_size, session->step_data.distance_meters)
; snprintf(distance_str + offset, distance_buf_size - offset, " %s", prv_get_distance_unit(headings)); string_list_add_string(headings, headings_buf_size, i18n_get("Distance", headings), headings_buf_size); string_list_add_string(values, values_buf_size, distance_str, values_...
) { // TODO: PBL-23119 Write non-aa function // TODO: PBL-24777 Write new 1px functions (with support for ellipsis) // prv_circle_quadrant_part_1px_aa(ctx, center, radius, config.start_quadrant.angle_start, // config.start_quadrant.angle_end); // // prv_circle_quadrant_part_1px_aa...
(ctx, p, radius, stroke_width, quadrant, false)
; } void graphics_circle_quadrant_draw(GContext* ctx, GPoint p, uint16_t radius, GCornerMask quadrant) { uint8_t stroke_width = ctx->draw_state.stroke_width; #if PBL_COLOR if (ctx->draw_state.antialiased) { if (stroke_width > 1) { // Antialiased and Stroke Width > 1 graphics_circle_quadrant_draw_st...
, GTextAlignmentCenter, 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); ...
cl_check(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_cont...
free(command); } void test_gdraw_command__draw_precise_path(void) { GDrawCommand *command = malloc(sizeof(GDrawCommand) + (sizeof(GPoint) * 3 )); *command = (GDrawCommand){ .type = GDrawCommandTypePrecisePath, .hidden = false, .stroke_color = GColorRed, .stroke_width = 1, .fill_color = GColo...
(prv_compare_points(&center, s_stroke_points, s_path_num_points))
; cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // set stroke color to be transparent and restore fill - fill should be drawn, but no outline // should be drawn gdraw_command_set_fill_color(command, GColorRed); color = gdraw_command_get_stroke_color(command); color.a = 0; gdraw_command_set_strok...
nst uint8_t mask_pixel_value = (uint8_t)((x % hline_applying_test_column_width) / num_pixels_per_mask_value); for (int16_t y = 0; y < mask_size.h; y++) { test_graphics_context_mask_set_value_for_coordinate(ctx, mask, mask_pixel_value, ...
for (int16_t x = 0; x < num_src_colors; x++) { GColor src_color = (GColor) { .argb = (uint8_t)x }; for (int dest_color_index = 0; dest_color_index < num_dest_colors; dest_color_index++) { for (int mask_value_index = 0; mask_value_index < num_mask_values; mask_value_index++) { int16_t y1 = (int16_t...
graphics_context_mask_destroy(ctx, mask); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Tests //////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////// // RECORDING HORIZONT...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
jerry_create_number(layer->bounds.size.h)
; jerry_set_object_field(canvas, ROCKY_CANVAS_CLIENTWIDTH, client_width); jerry_set_object_field(canvas, ROCKY_CANVAS_CLIENTHEIGHT, client_height); } { GRect uo_rect; layer_get_unobstructed_bounds(layer, &uo_rect); JS_VAR unobstructed_left = jerry_create_number(uo_rect.origin.x); JS_VAR uno...
tream = &DMA1_STREAM1_DEVICE, .channel = 4, .irq_priority = 0, // no interrupts .priority = DMARequestPriority_High, .type = DMARequestType_PeripheralToMemory, .data_size = DMARequestDataSize_Byte, }; static DMARequestState s_sharp_spi_tx_dma_request_state; static DMARequest SHARP_SPI_TX_DMA_REQUEST = { .s...
IRQ_MAP(I2C2_ER, i2c_hal_error_irq_handler, &I2C_2V5_BUS)
nclude "system/die.h" #include "system/reboot_reason.h" #include "system/reset.h" #include "util/attributes.h" #include "util/bitset.h" #include "util/size.h" #include "util/string.h" #define CMSIS_COMPATIBLE #include <mcu.h> #include <inttypes.h> #include <stdarg.h> #include <stdio.h> #include "kernel/pebble_tasks....
{ PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, " MMFARVALID = yes 0x%"PRIx32, SCB->MMFAR); }
pairing_info; memset(&sm_pairing_info, 0xaa, sizeof(sm_pairing_info)); sm_pairing_info.is_local_encryption_info_valid = true; sm_pairing_info.is_remote_signing_info_valid = true; sm_pairing_info.is_remote_identity_info_valid = true; shared_prf_storage_store_ble_pairing_data(&sm_pairing_info, PAIRING_NAME, ...
cl_assert_equal_b(shared_prf_storage_get_root_key(SMRootKeyTypeEncryption, NULL), false)
; SM128BitKey keys[2]; for (int i = 0; i < sizeof(keys); ++i) { ((uint8_t *) keys)[i] = i; } shared_prf_storage_set_root_keys(keys); SM128BitKey keys_out[2]; for (SMRootKeyType key_type = 0; key_type < SMRootKeyTypeNum; ++key_type) { cl_assert_equal_b(shared_prf_storage_get_root_key(key_type, &ke...
ayer *menu_layer, void *callback_context, MenuLayerCallbacks callbacks) { menu_layer_set_callbacks(menu_layer, callback_context, &callbacks); } void menu_layer_set_click_config_onto_window(MenuLayer *menu_layer, struct Window *window) { // Delegate this directly to the scroll...
animation_unschedule(scroll_animation)
; } if (change_ongoing_animation && animated && !process_manager_compiled_with_legacy2_sdk()) { prv_setup_selection_animation(menu_layer, up); } else { if (change_ongoing_animation) { prv_cancel_selection_animation(menu_layer); } // Move selection inverter layer: const int16_t w = menu_l...
p_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 5); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offse...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 3); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and r...
ActivityType_Sleep: activity = ActivitySessionType_Sleep; break; case KAlgActivityTypeCount: WTF; break; } PBL_ASSERTN(activity != ActivitySessionTypeCount); ActivitySession session = { .type = activity, .start_utc = start_utc, .length_min = len_sec / SECONDS_PER_MINUTE, ...
{ return false; }
// Note: stroke width == 2 is rounded down to stroke width of 1 prv_draw_round_rect_aa(ctx, rect, radius); return; } } #endif if (ctx->draw_state.stroke_width > 1) { // Non-Antialiased and Stroke Width > 1 prv_draw_round_rect_stroked(ctx, rect, radius, ctx->draw_state.s...
PBL_ASSERTN(ctx)
; if (ctx->lock) { return; } ctx->draw_state.tint_color = gcolor_closest_opaque(color); } void graphics_context_set_compositing_mode(GContext* ctx, GCompOp mode) { PBL_ASSERTN(ctx); if (ctx->lock) { return; } ctx->draw_state.compositing_mode = mode; } void graphics_context_set_antialiased(GCont...
config->status_colors.foreground); option_menu_set_highlight_colors(option_menu, config->highlight_colors.background, config->highlight_colors.foreground); option_menu_set_icons_enabled(option_menu, config->icons_enabled); } void option_menu_init(OptionMenu *o...
graphics_draw_text(ctx, title, title_font, text_frame, overflow_mode, text_alignment, NULL)
; } }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(true == text_layer_calc_text_flow_paging_values(&text_layer, &origin, &page))
; // text_layer's absolute coordinate as cl_assert_equal_gpoint(origin, GPoint(40, 60)); // text_layer's absolute coordinate as there's no container cl_assert_equal_gpoint(page.origin, GPoint(40, 60)); cl_assert_equal_gsize(page.size, GSize(30, TEXT_LAYER_FLOW_DEFAULT_PAGING_HEIGHT)); scroll_layer_is_inst...
/* * 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, "no readers")
; return false; } // If this is bigger than the queue would allow, error if (length >= buffer->buffer_size) { return false; } // Make sure there's room, deleting bytes from slackers if requested SharedCircularBufferClient *slacker; uint32_t max_data = prv_get_max_data_length(buffer, &slacker); ...
/* * 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_get_root_layer(window)
; GRect bounds = window_layer->bounds; // Parameters outer_size = 49; inner_size = 0; angle_start = TRIG_MAX_ANGLE / 4; angle_end = TRIG_MAX_ANGLE; prv_setup_data(bounds); } static void prv_test_radial(Layer *layer, GContext* ctx) { GColor color = { .argb = (uint8_t) rand() }; graphics_context_set_...
/* * 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...
(list, AttributeIdIconLarge, card_res ?: timeline_res)
; } #define ARRAY_RAND(arr) arr[rand() % ARRAY_LENGTH(arr)] static void prv_add_notification(int32_t delta_time_s) { const time_t now = rtc_get_time(); AttributeList list = {}; TimelineResourceId icon_resources[] = { TIMELINE_RESOURCE_NOTIFICATION_FACEBOOK_MESSENGER, TIMELINE_RESOURCE_NOTIFICATION...
PITestAppData *data) { if (!data->sleep_card.text_layer) { return; } int32_t sleep_total_sec = health_service_sum_today(HealthMetricSleepSeconds); int32_t sleep_deep_sec = health_service_sum_today(HealthMetricSleepRestfulSeconds); // This updates s_data->bed_time_utc and s_data->awake_time_utc prv_debu...
(BUTTON_ID_UP, steps_up_click_handler)
= (AccelData) { .x = data[i].x, .y = data[i].y, .z = data[i].z }; samples_in_minute++; if (chunk_size == KALG_SAMPLE_HZ) { steps = ref_accel_data_handler(accel_buf, chunk_size); chunk_size = 0; } if (samples_in_minute >= KALG_SAMPLE_HZ * SECONDS_PER_MINUTE) { ref_...
if (strcmp(token, "TEST_EXPECTED") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.exp_steps); } else if (strcmp(token, "TEST_EXPECTED_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.exp_steps_min); } else if (strcmp(token, "TEST_EXPECTED_MAX") == ...
} // If this is a "static AccelRawData samples[] = {" line, skip it if (strcmp(token, "static") == 0) { continue; } // Grab a sample if (strcmp(token, "{") == 0) { PBL_ASSERTN(state->test_entry.name[0] != 0); int x, y, z; sscanf(token + strlen(token) + 1, "%d, %d, %d",...
lorBlack); layer_add_child(&window->layer, status_bar_layer_get_layer(status_layer)); #if PBL_RECT GRect status_layer_bounds = window->layer.bounds; status_layer_bounds.size.w -= ACTION_BAR_WIDTH; layer_set_frame(&status_layer->layer, &status_layer_bounds); #endif ActionBarLayer *action_bar = &active_window...
app_zalloc_check(sizeof(WorkoutActiveWindow))
; active_window->layout = WorkoutLayout_TwoStaticAndScrollable; active_window->top_metric = top_metric; active_window->middle_metric = middle_metric; prv_add_scrollable_metrics(active_window, num_scrollable_metrics, scrollable_metrics); prv_create_window_common(active_window, workout_data, workout_controlle...
/* * 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_message_outbox_send()
; if (result == APP_MSG_OK) { app_data->ready_to_send = false; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error sending message: %s", prv_translate_error(result)); } } static void prv_send_status_and_version(void) { AppData *app_data = app_state_get_user_data(); PBL_LOG(LOG_LEVEL_DEBUG, "Sending status and v...
OUT_SEC) { state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; PBL_LOG(LOG_LEVEL_WARNING, "Resetting receive state - max packet time expired"); } state->callback_pending = false; uint16_t bytes_avail = shared_circular_buffer_get_read_space_remaining(&state->isr_buffer, &state->isr_...
(LOG_LEVEL_WARNING, "Invalid footer signature")
; } state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; } } break; } // switch() } // while (!exit && bytes_avail) // Return pointer if we got a complete message if (got_msg) { *msg_bytes= state->msg_buffer_bytes; *protocol = state->hdr.protocol; retu...
my_cycles) { uint32_t ccr = QUADSPI->CCR; ccr &= QSPI_CCR_CLEAR_MASK; ccr |= modes_bitset; ccr |= (dummy_cycles << 18); QUADSPI->CCR = ccr; } static bool prv_dma_irq_handler(DMARequest *request, void *context) { QSPIPort *dev = context; QSPI_DMACmd(DISABLE); signed portBASE_TYPE was_higher_priority_ta...
(dev->state->dma_semaphore, portMAX_DELAY)
; stop_mode_enable(InhibitorFlash); } if (trailing_bytes > 0) { prv_read_bytes((void *)last_address_aligned, trailing_bytes); } } static void prv_indirect_write(QSPIPort *dev, uint8_t instruction, uint32_t addr, const void *buffer, uint32_t length) { if (length) { PB...
yer l; menu_layer_init(&l, &GRect(10, 10, DISP_COLS, DISP_ROWS)); menu_layer_set_center_focused(&l, true); menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks) { .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, .selection_will_change = prv_skip_odd_rows, }); menu_layer_reload_data(&...
layer->update_proc(layer, &ctx)
; cl_assert_equal_i(2, prv_num_sublayers(layer)); } void test_menu_layer__center_focused_updates_height_on_reload(void) { MenuLayer l; const int height = DISP_ROWS; menu_layer_init(&l, &GRect(10, 10, height, DISP_COLS)); menu_layer_set_center_focused(&l, true); s_num_rows = 3; menu_layer_set_callbacks(&l...
data. static void prv_update_median_hr_bpm(ActivityState *state) { const ActivityHRSupport *hr = &state->hr; const uint16_t num_hr_samples = hr->num_samples; if (num_hr_samples > 0) { int32_t median, total_weight; // Stats requires an int32_t array and we need one for both the samples and the weights ...
{ ActivityState *state = activity_private_state(); mutex_lock_recursive(state->mutex); { // Update the median HR / HR weight for the minute prv_update_median_hr_bpm(state); // Update our current HR zone (based on the median which is calculated above) prv_update_current_hr_zone(state); } mutex...
sTop); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quads_top.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCornersBottom); cl_check(gbitmap_pbi_...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_clear.8bit.pbi")
); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } // Draws circles in a grid pattern while increasing the stroke width for each circle static void prv_draw_circles(GContext *ctx) { GPoint pt = CENTER_OF_ORIGIN_RECT; for (int sw = 0; sw <= 10; sw++) { c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ble_gap_channel_map_get(&channel_map_uint)
; const bool success = (e == BLE_STATUS_OK); LEChannelMap channel_map = {}; if (success) { memcpy(&channel_map, &channel_map_uint, sizeof(channel_map)); } else { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_channel_map_get err: %x", e); } HcAnalyticsCollectBleParameters data = { .success = success, ....
althAPITestAppData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(window); GRect root_bounds = layer_get_bounds(window_layer); data->results_card.text_layer = text_layer_create(root_bounds); text_layer_set_text_alignment(data->results_card.text_layer, GTextAlignmentCenter); ...
text_layer_set_background_color(data->hr_card.text_layer, GColorClear)
; text_layer_set_font(data->hr_card.text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); text_layer_set_text_color(data->hr_card.text_layer, GColorWhite); layer_add_child(window_layer, text_layer_get_layer(data->hr_card.text_layer)); // Update UI prv_hr_update_text(data); // ...
work around system_task_add_callback extern void wakeup_dispatcher_system_task(void *data); void test_wakeup__out_of_order_schedule(void) { const time_t start_time = sys_get_time(); sys_wakeup_cancel_all_for_app(); // Schedule a wakeup for 10 windows into the future time_t late_event = start_time + WAKEUP_EVE...
wakeup_get_current()
; cl_assert_equal_i(stub_new_timer_timeout(gap_timer) / 1000, WAKEUP_CATCHUP_WINDOW); rtc_set_time(third_event); // manually move time forward to after third event stub_new_timer_fire(wakeup_get_current()); wakeup_dispatcher_system_task((void *)(uintptr_t)third_wakeup_id); // Catchup should be finished, gap...
ine case StateRecording: // vibe briefly, enable clicking to end the transcription, unfold the mic from a dot // and show text #if (0) // https://pebbletechnology.atlassian.net/browse/PBL-20406 prv_short_vibe(); #endif prv_enable_select_click(data); prv_stop_fly_dot(data); prv_hi...
((Layer *)loading_layer, true)
; StatusBarLayer *status_bar = &data->mic_window.status_bar; status_bar_layer_init(status_bar); const GColor status_bg_color = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite); status_bar_layer_set_colors(status_bar, status_bg_color, GColorBlack); layer_add_child(root_layer, (Layer *) status_bar); KinoReel...
time_t start_utc; uint16_t len_m; } KAlgTestSleepSession; KAlgTestSleepSession s_captured_sleep_sessions[MAX_CAPTURED_SESSIONS]; int s_num_captured_sleep_sessions; void prv_sleep_session_callback(void *context, KAlgActivityType activity_type, time_t start_utc, uint32_t len_sec, bool...
if (deep_exit_utc == 0 || session_exit_utc > deep_exit_utc) { deep_exit_utc = session_exit_utc; } } }
// Fill in the rest of the sleep data metrics if (enter_utc != 0) { results->start_at.value = (enter_utc - test_start_utc) / SECONDS_PER_MINUTE; } if (exit_utc != 0) { results->end_at.value = (exit_utc - test_start_utc) / SECONDS_PER_MINUTE; } // Figure out our current state if (exit_utc >= la...
/* * 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 (curr_request->req_state == state) { if (curr_request->timeout > timeout) { timeout = curr_request->timeout; responsible_consumer = curr_request->consumer; } }
curr_request = (ConnectionStateRequest *)list_get_next(&curr_request->list_node); } if (consumer_out) { *consumer_out = responsible_consumer; } if (secs_to_wait) { uint32_t curr_ticks = rtc_get_ticks(); if (curr_ticks < timeout) { uint16_t wait_time = (timeout - curr_ticks) / RTC_TICKS...
IN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true,...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")
); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_sw11_no_clip.${BIT_DEPTH_NAME}...
int16_t final_y, AnimationProgress progress) { PebbleEvent event = { .type = PEBBLE_UNOBSTRUCTED_AREA_EVENT, .unobstructed_area = { .type = type, .current_y = current_y, .final_y = final_y, .progress = progress, }, }; event_put(&event); } static void prv_clip_area(GRect *are...
PBL_ASSERTN(state)
; state->handlers = (UnobstructedAreaHandlers) {}; } void unobstructed_area_service_get_area(UnobstructedAreaState *state, GRect *area_out) { if (state && area_out) { *area_out = state->area; } } void app_unobstructed_area_service_subscribe(UnobstructedAreaHandlers handlers, void *context) { unobstructed_...
bbleTaskBitset task_mask_none = ~0; PebbleTaskBitset task_mask = task_mask_none; const bool has_error = (error != BLEGATTErrorSuccess); const BLESubscription type = has_error ? BLESubscriptionNone : prv_prevailing_subscription_type(subscription); for (GAPLEClient c = 0; c < GAPLE...
(*value_length_in_out >= header.value_length)
) { const uint16_t copied_length = circular_buffer_copy_offset(s_circular_buffer[client], sizeof(header), /* skip header */ value_out, header.value_length); if (UNL...
e. // // Decoding is done by expanding the bit patterns into a buffer until we have at least 8 bits of // pixels to write. PBL_ASSERTN(g); PBL_ASSERTN(src > (uint8_t *)g->data); uint8_t *dst = (uint8_t *)g->data; unsigned total_pixels_decoded = 0; unsigned num_rle_units = g->header.num_rle_units; ...
// Load the glyph data at the end of the buffer target = &((uint8_t *)g->data)[CACHE_GLYPH_SIZE - glyph_size_bytes]; } else { target = (uint8_t *)g->data; } SYS_PROFILER_NODE_START(text_render_flash); size_t num_bytes_loaded = sys_resource_load_range(font_res->app_num, font_res->resour...
static const GlyphData *prv_get_glyph_metadata_from_spi(Codepoint codepoint, FontCache *font_cache, const FontResource *font_res, bool need_bitmap) { ...
- 1) / BACKLIGHT_SCALE_GRANULARITY); } static int prv_intensity_get_selection_index() { const uint8_t intensity = prv_get_scaled_brightness(); // FIXME: PBL-22272 ... We will return idx 0 if someone has an old value for // one of the intensity options for (int i = 0; i < (int)ARRAY_LENGTH(s_inten...
app_state_get_window_stack()
); break; #endif default: WTF; } settings_menu_reload_data(SettingsMenuItemDisplay); settings_menu_mark_dirty(SettingsMenuItemDisplay); } static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx, const Layer *cell_layer, uint16_t row, bool selected) { Se...
ons under the License. */ #include "app_storage.h" #include <inttypes.h> #include <stdio.h> #include <string.h> #include "util/uuid.h" #include "drivers/flash.h" #include "flash_region/flash_region.h" #include "process_management/pebble_process_info.h" #include "resource/resource_storage.h" #include "services/norma...
((ResAppNum)id, 0, NULL)
ctured_glance); PBL_ASSERTN(weather_glance); WeatherLocationForecast *forecast = weather_service_create_default_forecast(); // Update the icon for the forecast's weather type const WeatherType weather_type = NULL_SAFE_FIELD_ACCESS(forecast, current_weather_type, ...
(structured_glance)
// 48 seconds { 520, 192, -120}, { 672, 208, -144}, { 896, 272, -232}, { 1152, 280, -280}, { 1024, 296, -312}, { 1032, 248, -264}, { 1360, 328, -224}, { 1192, 312, -208}, { 1136, 272, -152}, { 1224, 280, -64}, { 1224, 240, -24}, { 1136, 176, 0}, { 816, 96, 16}, ...
{ 1192, 216, -88}, { 920, 240, -136}, { 648, 216, -152}, { 512, 152, -120}, { 488, 152, -128}, { 608, 200, -152}, { 768, 200, -208}, { 1048, 232, -256}, // 54 seconds { 1072, 240, -312}, { 1056, 224, -304}, { 1248, 248, -200}, { 1288, 280, -240}, { 1024, 240, -152...
{ 1096, 288, -280}, { 1168, 296, -264}, { 1360, 328, -208}, { 1192, 328, -224}, { 1064, 288, -152}, { 1216, 264, -80}, { 1192, 264, 16}, { 1056, 248, -8}, { 872, 184, -16}, { 680, 128, -16}, { 632, 96, -16}, { 640, 104, -24}, { 696, 120, -40}, { 856, 96, -56}, ...
/* * 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...
(sizeof s_boot_fpga < 1<<16, "FPGA bitstream too big")
; BootFPGAHeader fpga_header = { (uint16_t)sizeof s_boot_fpga, (uint16_t)~sizeof s_boot_fpga }; _Static_assert( (BOOT_FPGA_FLASH_ADDR + sizeof fpga_header + sizeof s_boot_fpga) < FLASH_REGION_MFG_INFO_END, "FPGA bitstream will overflow FLASH_REGION_MFG_INFO!"); ...
TRL_2_REG, DCDC_TIMEOUT_IRQ_RES, 0x8); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TUNE, 0x0); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_LSSUP_TRIM, 0x5); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_HSGND_TRIM, 0x5); REG_SETF(DCDC, DCDC_V14_0_REG, DCDC_V14_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_V14_0_REG, DCDC_V14_VOLTAGE, 0x...
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18P_TIMEOUT_IRQ_CLEAR, 0x0)
/* * 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...
(line, 0xffffffff, FRAMEBUFFER_SIZE_BYTES)
; bitset8_set(f->dirty_lines, y); f->is_dirty = true; } void framebuffer_mark_dirty_rect(FrameBuffer* f, GRect rect) { const uint16_t y_start = rect.origin.y; const uint16_t y_end = y_start + rect.size.h; for (uint16_t y = y_start; y < y_end; ++y) { bitset8_update(f->dirty_lines, y, is_dirty); } f-...
graphics_draw_line(ctx, data->line_p0, data->line_p1); } else if (shape == SQUARE) { graphics_draw_rect(ctx, &data->square); } else if (shape == RECTANGLE) { graphics_draw_rect(ctx, &data->rect); } else if (shape == RECTANGLE_ROUND) { graphics_draw_round_rect(ctx, &data->rectr, data->r...
(&s_triangle_path)
; data->triangle_offset = GPoint(10, 80); gpath_move_to(data->triangle, data->triangle_offset); data->triangle_velocity_x = 1; data->triangle_velocity_y = 1; // Open bucket data->bucket = gpath_create(&s_bucket_path); data->bucket_offset = GPoint(20, 30); gpath_move_to(data->bucket, data->bucket_offset...
0xFFFFFFFF; } return entry->impl->get_crc(entry, num_bytes, entry_offset); } T_STATIC uint32_t prv_get_store_length(ResourceStoreEntry *entry, ResourceManifest *manifest) { // Get the resource entry for the last entry ResTableEntry res_entry = {0}; if (!prv_read_res_table_entry(&res_entry, entry, manifest->...
{ entry.impl->clear(&entry); }
} static bool prv_get_manifest_by_id(ResAppNum app_num, uint32_t resource_id, ResourceManifest *manifest) { ResourceStoreEntry entry; prv_get_store_entry(app_num, resource_id, &entry); if (!entry.impl) { return false; } prv_get_manifest(&entry, manifest); return true...
applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #include "process_management/sdk_shims.h" #include "process_state/app_state/app_state.h" #include "system/logging.h" typedef struct AppState { Window window; ScrollLayer scroll_layer; TextLayer text_layer_1; TextLayer te...
WINDOW_NAME("Text Flow")
} } // A full filesystem is bad for wear leveling since the same sectors will // wind up getting written repeatedly. We should really be enforcing this // within pfs_open but for now we will just let external callers use this // routine before allocating large files uint32_t tot_capacity = (pfs_get_size()...
{ prompt_send_response("malloc error"); goto cleanup; }
memset(bytes, 0x00, num_bytes); if ((num_bytes = pfs_read(fd, bytes, num_bytes)) < 0) { prompt_send_response_fmt(buf, sizeof(buf), "rd err: %d", num_bytes); goto cleanup; } PBL_HEXDUMP_D_SERIAL(LOG_LEVEL_DEBUG, bytes, num_bytes); prompt_send_response("DONE"); cleanup: kernel_free(bytes); } void...
tem = { .attr_list.num_attributes = ARRAY_LENGTH(attributes), .attr_list.attributes = attributes, .action_group.num_actions = ARRAY_LENGTH(actions), .action_group.actions = actions, }; uint8_t *buffer = malloc(sizeof(s_payload_complete)); timeline_item_serialize_payload(&item, buffer, sizeof(s_pa...
cl_assert_equal_p(timeline_item_find_action_with_id(NULL, 0), NULL)
== NOTIF_FALLBACK_ICON) || (timeline_res_id == TIMELINE_RESOURCE_NOTIFICATION_GENERIC); *loaded_list = (LoadedNotificationNode*) list_prepend((ListNode*) *loaded_list, (ListNode*)loaded_node); return loaded_node; } static void prv_loaded_notification_list_deinit(LoadedNotif...
{ if (gcolor_equal(color, GColorBlack)) { return GColorWhite; } else if (gcolor_equal(color, GColorWhite)) { return GColorBlack; } return color; }
static void prv_invert_pdc_colors(GDrawCommandProcessor *processor, GDrawCommand *processed_command, size_t processed_command_max_size, const GDrawCommandList* list, const GDrawComma...
ils.h" #include "applib/app.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/ui.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "popups/health_tracking_ui.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "services/common...
workout_utils_get_detection_text_for_activity(data->ongoing_session.type)
; workout_dialog_set_text(workout_dialog, dialog_text); char text_buffer[32]; const uint32_t length_s = rtc_get_time() - data->ongoing_session.start_utc; health_util_format_hours_minutes_seconds( text_buffer, sizeof(text_buffer), length_s, true, workout_dialog); workout_dialog_set_subtext(workout_dia...
{ // Device got disconnected in the mean time return 0; } const uint16_t num_bytes_overhead = 3 /* ATT header */ + sizeof(PPoGATTPacket); return (mtu - num_bytes_overhead); } // ------------------------------------------------------------------------------------------------- static void prv_enter_awaiti...
if (++s_disconnect_counter > PPOGATT_DISCONNECT_COUNT_MAX) { // only log this the first couple of times it happens if (s_disconnect_counter < (PPOGATT_DISCONNECT_COUNT_MAX + 3)) { PBL_LOG(LOG_LEVEL_ERROR, "Not disconnecting because max disconnects reached..."); } return; } else { ...
r; } static void prv_stroke_circle_quadrant_full_override_aa(GContext* ctx, GPoint p, uint16_t radius, uint8_t stroke_width, GCornerMask quadrant, bool anti_aliased) { #if PBL_COLOR // Force antialiasing s...
PBL_ASSERTN(ctx)
fact that // this is the only consumer of DMA2. periph_config_disable(DMA2, RCC_AHB1Periph_DMA2); } static void setup_dma_read(uint8_t *buffer, int size) { DMA_InitTypeDef dma_config; DMA_DeInit(FLASH_DMA_STREAM); DMA_DeInit(FLASH_TX_DMA_STREAM); /* RX DMA config */ DMA_StructInit(&dma_config); dma_c...
{ return addr & ~(SECTOR_SIZE_BYTES - 1); }
// This simply issues a command to read a specific register static uint8_t prv_flash_get_register(uint8_t command) { flash_start_cmd(); flash_send_and_receive_byte(command); uint8_t reg = flash_read_next_byte(); flash_end_cmd(); return reg; } // This will read the flag status register and check it for the ...
mmand(void *cmd, size_t length, const char *message) { uint8_t *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); resp[0] = BULKIO_RESP_MALFORMED_CMD; size_t message_len = strlen(message) + 1; memcpy(resp + 1, message, message_len); size_t response_len = sizeof(...
{ prv_respond_malformed_command(cmd, length, "Invalid domain data"); }
else { prv_respond_internal_error(cmd, length, ret); } return; } OpenResponse *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); resp->opcode = BULKIO_RESP_DOMAIN_OPEN; resp->fd = fd; pulse_reliable_send(resp, sizeof(*resp)); } static void prv_handle_close(Command *cmd, size_t length...
; graphics_context_set_text_color(&context, color); cl_assert_equal_i(context.draw_state.text_color.argb, GColorClear.argb); // Text Color - 2-bit graphics_context_set_text_color_2bit(&context, GColor2White); cl_assert(gcolor_equal(context.draw_state.text_color, GColorWhite)); #if PBL_COLOR // Antialiased...
(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, 2))
; } void test_graphics_context_${BIT_DEPTH_NAME}__draw_stroke_width_even(void) { // Stroke width even > 2, non-antialiased setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context,...
4}, { -152, 1056, 128}, { -312, 792, 128}, { -168, 632, 136}, { 40, 600, 48}, { 136, 560, 56}, { 192, 576, 80}, { 232, 744, 128}, { 360, 800, 80}, { 344, 1096, 216}, { 440, 1256, 344}, { 448, 1520, 184}, { 736, 1152, 264}, { 712, 1344, 24}, { 744, 992, 64}, { ...
{ -160, 1024, 464}, { -288, 784, 656}, { -328, 680, 592}, { -256, 536, 456}, { -176, 360, 392}, { -96, 304, 320}, { -112, 272, 376}, { -104, 384, 400}, // 104 seconds { -88, 504, 640}, { -112, 760, 656}, { -192, 896, 920}, { -280, 1136, 1024}, { -344, 1424, 1200},...
{ -1296, 432, 80}, { -952, 488, -120}, { -1192, 512, -104}, { -1376, 480, -40}, { -1216, 176, -48}, { -976, -24, -72}, { -1000, 96, -48}, { -1112, 104, -8}, { -1168, 112, 24}, { -1256, 152, 8}, { -1264, 16, 80}, { -1120, -16, -40}, { -1232, 0, -32}, { -1080, 72, ...
CLIP_NXNY, false, 2); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3); graphics_dr...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* bytes 3360 - 3372 */ }; extern uint32_t prv_get_data_section_length(ResourceStoreEntry *entry, ResourceManifest *manifest); extern uint32_t prv_get_store_length(ResourceStoreEntry *entry, ResourceManifest *manifest); void test_resource__initialize(void) ...
(s_watch_res_callback_called_count == 0)
; } static uint32_t prv_mock_resource_storage_app_read(ResourceStoreEntry *entry, uint32_t offset, void *data, size_t num_bytes) { ResTableEntry res_entry = { .resource_id = 0, .offset = 0, .length = 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...
{ uint32_t sum = legacy_defective_checksum_memory("12345", 5); cl_assert_equal_i(sum, 0xec5baa37); }