prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
GTextOverflowModeTrailingEllipsis); layer_add_child(window_layer, text_layer_get_layer(&data->info_text)); } static void prv_kcc_window_unload(Window *window) { SystemCertificationData *data = (SystemCertificationData *) window_get_user_data(window); prv_deinit_status_bar(&data...
(prv_shutdown_cb, 0)
; } break; case SystemMenuItemFactoryReset: settings_factory_reset_window_push(); break; default: WTF; } settings_menu_reload_data(SettingsMenuItemSystem); } static uint16_t prv_num_rows_cb(SettingsCallbacks *context) { return SystemMenuItem_Count; } static Window *prv_init...
License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific ...
(listeners)
; JS_UNUSED_VAL = jerry_set_property_by_index(listeners, num_entries, listener); } static bool prv_remove_listener(jerry_value_t event_listeners, uint32_t idx, jerry_value_t listener, void *data) { ListenerQueryData *query_data = data; if (query_data->listener == listener) { /...
der the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the Lice...
list_remove((ListNode *)node, (ListNode **)notification_list, NULL)
; } static NotificationNode *prv_add_notification(NotificationsData *data, Uuid *id) { NotificationNode *node = prv_notification_list_add_notification_by_id(&data->notification_list, id); return node; } static void prv_remove_notification(Not...
al_len); cl_assert_equal_i(result, S_SUCCESS); int val_i = atoi((char*)val + 1); cl_assert_equal_i(key_i, val_i); return true; } void test_settings_file__each(void) { printf("\nTesting if we can use each...\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_each", 4096)); uint...
(settings_file_open(&file, "test_file_reallocate_larger", k_larger_size))
; int new_fd_size = pfs_get_file_size(file.iter.fd); cl_assert(new_fd_size > orig_fd_size); verify(&file, key, key_len, val, val_len); } // Test that we can start searching beginning at the record we previously found in a recent // call into settings file. This makes sure we don't start searching at the beginni...
/* * 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...
trigger_fault(RebootReasonCode_Assert, lr)
; } NORETURN passert_failed_hashed_no_message(void) { passert_failed_hashed_no_message_with_lr((uint32_t)__builtin_return_address(0)); } NORETURN passert_failed_no_message_with_lr(const char* filename, int line_number, uint32_t lr) { handle_passert_failed(filename, line_number, lr, "ASSERTN", NULL); } NORETURN p...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_create_window_and_render(0)
last event. event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, true); cl_assert_equal_i(window1->on_screen, true); window_stack_remove(window1, true); cl_assert_equal_i(window1->on_screen, false); cl_assert_equ...
(app_stack, window1, true)
; cl_assert_equal_i(window_stack_count(app_stack), 1); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to the kernel to push a modal window stub_pebble_tasks_set_current(PebbleTask_KernelMain); window_stack_push(modal_stack, window2, true...
ive_variable, .protocol = hton16(app_protocol), .length = hton16(packet_size), }; memcpy(&packet->i.information[0], information, info_length); pulse_link_send(packet, packet_size); } static void prv_process_ack(uint8_t ack_number) { if ((ack_number - 1) % MODULUS == s_send_variable) { pulse2_reliab...
(LOG_LEVEL_DEBUG, "Received Information packet response; this is " "not permitted by the protocol (Information packets can only be " "commands). Discarding.")
; return; } prv_process_ack(packet->s.ack_number); if (packet->s.kind != SupervisoryKind_ReceiveReady && packet->s.kind != SupervisoryKind_Reject) { PBL_LOG(LOG_LEVEL_DEBUG, "Received a command packet of type %" PRIu8 " which is not supported by this implementation.", (uint...
prv_render_bg_color(GContext *ctx, GRect *bounds, GColor color) { graphics_context_set_fill_color(ctx, color); graphics_fill_rect(ctx, bounds); } static void prv_render_metric_label(GContext *ctx, GRect *box, WorkoutMetricType metric_type, WorkoutActiveWindow *active_window, vo...
PBL_IF_RECT_ELSE(1, 46)
; rect.size.w += (rl_margin * 2); GTextNode *text_node = prv_create_text_node(active_window, metric_type, prefer_larger_font, layer); graphics_text_node_draw(text_node, ctx, &rect, NULL, NULL); graphics_text_node_destroy(text_node); } static void prv_static_layer_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_send_request(ctx)
; } } static void start(PollRemoteContext *ctx) { ctx->counted_minutes = 0; } static void set_intervals(PollRemoteContext *ctx, const uint8_t min_interval_minutes, const uint8_t max_interval_minutes) { ctx->min_interval_minutes = min_interval_minutes; ctx->max_interval_minutes = max_interval_minutes; } void...
nt = 0; } static void prv_click_config_provider(void *context) { return; } static void prv_window_appear(Window *window) { cl_check(window); cl_assert_equal_i(window->on_screen, true); s_appear_count++; cl_check(s_appear_count >= 1); } static void prv_window_disappear(Window *window) { cl_check(window); ...
app_window_stack_push(window2, true)
; cl_assert_equal_i(app_window_stack_count(), 2); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window2->on_screen, true); app_window_stack_pop(true); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_i(window2->on_screen, false); app_window_stack_pop(true); cl_assert_e...
raw_image_get_value_for_bitdepth(test2, 0, 1, 1, 4)
== 3); cl_assert(raw_image_get_value_for_bitdepth(test2, 1, 1, 2, 4) == 12); cl_assert(raw_image_get_value_for_bitdepth(test2, 0, 1, 1, 8) == 48); cl_assert(raw_image_get_value_for_bitdepth(test2, 3, 0, 4, 8) == 3); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_handle_dev_name_response((const HcProtocol_GapDeviceNameResponseHeader *)msg->payload)
; break; default: PBL_LOG(LOG_LEVEL_INFO, "HcGap: unhandled message id: %d\n", msg->command_id); break; } } void hc_endpoint_gap_service_set_dev_name(const char *name) { hc_protocol_enqueue_with_payload(HcEndpointID_GapService, HcMessageID_GapService_SetName, ...
animation_destroy(a); #endif } // -------------------------------------------------------------------------------------- // Test a simple sequence animation void test_animation__simple_sequence(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 500; const int play_count_b...
(&s_stopped_handler_calls, a)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b)...
ile_get() call will not return an error if we ask // for less than the value size int stored_len = settings_file_get_len(file, &key, sizeof(key)); if (stored_len != sizeof(state->activity_sessions)) { PBL_LOG(LOG_LEVEL_WARNING, "Stored activities not found or incompatible"); return; } // Read in the ...
{ rv = true; break; }
} } mutex_unlock_recursive(state->mutex); return rv; } // ------------------------------------------------------------------------------------------------ DEFINE_SYSCALL(bool, sys_activity_sessions_is_session_type_ongoing, ActivitySessionType type) { return activity_sessions_is_session_type_ongoing(type);...
ocolCapabilities *capabilities) { PebbleProtocolCapabilities diff = {}; prv_lock(); { // If we were passed a null pointer, we'll just clear the cached capability bits if (capabilities) { diff.flags = s_cached_system_capabilities.flags ^ capabilities->flags; s_cached_system_capabilities = *cap...
prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN, " Name: %s", data->ble_data.name)
; SMPairingInfo info = {}; bt_persistent_storage_assign_sm_pairing_info(&info, &data->ble_data.pairing_info); bluetooth_persistent_storage_debug_dump_ble_pairing_info(&display_buf[0], &info); // does this info match the key stored in shared resources SMPairingInfo sprf_info = {}; bool requires...
--------------------- static bool prv_parse_sleep_samples_file(SleepSampleDiscoveryState *state) { // Init for next set of samples state->test_entry = (SleepFileTestEntry) { .samples = state->samples, .version = 1, .total = {-1, -1, -1}, .deep = {-1, -1, -1}, .start_at = {-1, -1, -1}, .end_a...
(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.min)
; } else if (strcmp(token, "TEST_IN_SLEEP_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.max); } else if (strcmp(token, "TEST_IN_DEEP_SLEEP") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_deep_sleep.value); } else if (strcmp(...
/* * 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...
assert_app_file_name_make(0x5abc, "woop")
; } void test_app_file__name_make_hex_2(void) { assert_app_file_name_make(0x12345, "looks_like_decimal"); } void test_app_file__name_make_negative(void) { assert_app_file_name_make(-42, "builtin_app"); } void test_app_file__name_make_pseudo_directory(void) { assert_app_file_name_make(76, "not/really/a/path");;...
_id, .uuid = db_entry->uuid, .color = prv_valid_color_from_uuid(db_entry->app_face_bg_color, (Uuid *)&db_entry->uuid), .sdk_version = db_entry->sdk_version, }; strncpy(entry->name, db_entry->name, APP_NAME_SIZE_BYTES); return true; } static bool prv_app_install_entry_from_resource_registry_entry(con...
{ *uuid_out = UUID_INVALID; return false; }
} bool app_install_is_watchface(AppInstallId app_id) { AppInstallEntry entry; if (!app_install_get_entry_for_install_id(app_id, &entry)) { return false; } return app_install_entry_is_watchface(&entry); } static const PebbleProcessMd *prv_get_md_for_reg_entry(const AppRegistryEntry *reg_entry) { switch ...
/* * 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, "time to read %lu bytes: predicted %lu, actual %lu", num_bytes, predicted_time, time)
; window_stack_remove(&number_window.window, false); app_window_stack_push(&number_window.window, true); } #define NUM_BYTES 1000 static void handle_init(void) { number_window_init(&number_window, "Num Writes", (NumberWindowCallbacks) { .selected = (NumberWindowCallback) do_timed_read, }, NULL); number_...
rue); EXECUTE_SCRIPT("_rocky.test();"); cl_assert_equal_i(1, s_test_func_imp_call_count); rocky_add_function(prototype, "method", method_func_imp); EXECUTE_SCRIPT("var y = new _rocky.test(); y.method();"); cl_assert_equal_i(1, s_method_func_imp_call_count); } void test_rocky_api_util__error_print(void) { ...
(getHours)
I callback static void ble_scan_handler(BTDevice device, int8_t rssi, const BLEAdData *ad_data) { const BTDeviceAddress address = bt_device_get_address(device); APP_LOG(APP_LOG_LEVEL_INFO, "Got Advertisement from: " BT_DEVICE_ADDRESS_FMT, BT_DEVI...
{ snprintf(title, sizeof(title), "%s %s", result->local_name, hrm_str); }
else { const BTDeviceAddress address = bt_device_get_address(result->device); snprintf(title, sizeof(title), BT_DEVICE_ADDRESS_FMT " %s", BT_DEVICE_ADDRESS_XPLODE(address), hrm_str); } // Build the subtitle string: char subtitle[UUID_STRING_BUFFER_LENGTH]; if (result->has_services) { ...
" #include "apps/system_apps/timeline/timeline.h" #include "kernel/pbl_malloc.h" #include "kernel/pebble_tasks.h" #include "kernel/ui/kernel_ui.h" #include "kernel/ui/modals/modal_manager.h" #include "process_state/app_state/app_state.h" #include "services/normal/timeline/actions_endpoint.h" #include "services/normal/t...
property_animation_get_animation(item_layer->animation)
; if (is_first_scroll) { animation_set_duration(animation, interpolate_moook_duration()); animation_set_custom_interpolation(animation, interpolate_moook); } else { animation_set_curve(animation, AnimationCurveEaseOut); } animation_schedule(animation); } //! Maybe make this part of the style and sm...
ms_64) + k_b_x10000; // Multiply by height to get stride_len, then by steps to get distance, then factor out our // constant multiplier at the very end to minimize rounding errors. uint32_t distance_mm = ROUND(stride_len_component * height_mm_64 * steps, k_x10000); // Return distance in mm ACTIV...
{ // midpoint of 5000 and -161000 calories_per_day -= 78000; }
// Scale by the requested number of minutes uint32_t resting_calories = ROUND(calories_per_day * elapsed_minutes, MINUTES_PER_DAY); ACTIVITY_LOG_DEBUG("resting_calories: %"PRIu32"", resting_calories); return resting_calories; }
le_tasks_set_current(PebbleTask_App); window_stack_push(app_stack, window1, true); cl_assert_equal_i(window_stack_count(app_stack), 1); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to the kernel to push a modal window stub_pebble_tasks...
cl_assert_equal_i(event.app_focus.in_focus, false)
; cl_assert_equal_i(window_stack_count(app_stack), 1); // Pop the modal window off the stack window_stack_remove(window2, true); cl_assert_equal_i(window_stack_count(modal_stack), 0); cl_assert_equal_i(window2->on_screen, false); // Switch to app happens via the compositor compositor_transition(NULL);...
et_impl_data(recognizer, &s_dummy_impl); prv_store_recognizer_idx(recognizer, &s_recognizers_handled); if ((s_idx_to_change >= 0) && (*idx == s_idx_to_change)) { recognizer_transition_state(recognizer, s_next_state); s_idx_to_change = -1; s_next_state = RecognizerStateCount; } } static void prv_reset...
prv_compare_recognizers_processed((int[]) {4, 0, 3}, 3, &s_recognizers_handled)
; cl_assert_equal_p(manager.active_layer, &layer_c); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[3]->state, Recog...
- DOT_SIZE) / 2, .origin.y = layer_frame.origin.y + (layer_frame.size.h - DOT_SIZE) / 2, .size = { DOT_SIZE, DOT_SIZE }, }; GRect icon_to = { .origin.x = layer_frame.origin.x + (layer_frame.size.w - size.w) / 2, .origin.y = layer_frame.origin.y + (layer_frame.size.h - size.h) / 2, .siz...
(s_phone_ui_data->caller_id_text_buf, '\n')
!= NULL); int16_t test_width = s_phone_ui_data->caller_id_text_layer.layer.bounds.size.w + fudge_some_pixels; GSize text_size = graphics_text_layout_get_max_used_size( kernel_ui_get_graphics_context(), s_phone_ui_data->caller_id_text_buf, font, GRect(0, 0, test_width...
(end, expected_end)
; free(command_list); } typedef struct { GDrawCommandProcessor processor; GColor stroke_color; } SetStrokeColorProcessor; static void prv_set_stroke_color(GDrawCommandProcessor *processor, GDrawCommand *processed_command, const size_t processed_...
n_start__, .length = (uint32_t)__debug_region_length, }, }; static uint16_t prv_timer_get_ticks(void) { return hw_timer0_get_on(); } static uint16_t prv_timer_delta(uint16_t start_ticks, uint16_t end_ticks) { // The timer is configured to repeatedly count down from 65535, resetting at 0 back to 65535. // ...
{ if (rx_mode) { // Has a byte arrived? if (!hw_spi_get_interrupt_status(s_spi->bus_id)) { continue; } hw_spi_clear_interrupt(s_spi->bus_id); buffer[rx_index++] = hw_spi_fifo_read8(s_spi->bus_id); if (rx_index == sizeof(core_dump_connect_ping)) { ...
Static_assert(sizeof(SmartstrapServiceId) == sizeof(uint16_t), "SmartstrapServiceId MUST be two bytes in length!"); _Static_assert(sizeof(SmartstrapAttributeId) == sizeof(uint16_t), "SmartstrapAttributeId MUST be two bytes in length!"); typedef struct { ListNode list_node; //! The Ser...
if ((txn == AttributeTransactionBeginWrite) && (attr->state == SmartstrapAttributeStateIdle)) { prv_set_attribute_state(attr, SmartstrapAttributeStateWritePending); return true; } else if ((txn == AttributeTransactionEndWrite) && (attr->state == SmartstrapAttributeStateWritePending))...
return false; } //! Note; This should only be called from the consumer task static void prv_cancel_transaction(SmartstrapAttributeInternal *attr) { PBL_ASSERT_TASK(CONSUMER_TASK); if (attr->state == SmartstrapAttributeStateWritePending) { prv_set_attribute_state(attr, SmartstrapAttributeStateIdle); } } ...
iter_state.current.end == ' '); cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 3); line_reset(&line, utf8_bounds.start); cl_assert(line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 3); cl_assert(line.origin.x == 0); ...
cl_assert(false == line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 2); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == 'l'); }
void test_line_layout__test_walk_lines_down(void) { // Allocate mutable types Iterator line_iter = ITERATOR_EMPTY; LineIterState line_iter_state = { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "\n\n\0"); cl_assert(success); s_ctx.te...
express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <pebble.h> static Window *window; static TextLayer *result_layer; static struct tm good_data = { .tm_sec = 49, .tm_min = 4, .tm_hour = 11, .tm_mday = 5, .tm_mon = 4, ...
(buf, buf_size, "%R", &good_data)
; if (r == 0 || strncmp(buf, "11:04", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"R\": %s", buf); } r = strftime(buf, buf_size, "%S", &good_data); if (r == 0 || strncmp(buf, "49", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"S\": %s", buf); } r = strftime(buf, buf_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(TEST_GATT_CONNECTION_ID)
; fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_SUCCESS, TEST_GATT_CONNECTION_ID); prv_assert_event(device, BTErrnoOK); } // Tests /////////////////////////////////////////////////////////// void test_gatt_client_discovery__initialize(void) { fake_...
, 6), 10); graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 7), 10); graphics_draw_vertical_line_dotted(&ctx, GPoint(24, 7), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_no_clip"))); // Even cols of different lengths setup_test_aa_sw(&ctx, fb, OR...
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_no_clip")
)); // Even cols of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(4, 0)...
ayer_add_child(&parent, &child_b); cl_assert(parent.first_child == &child_a); cl_assert(child_a.next_sibling == &child_b); cl_assert(child_a.parent == &parent); cl_assert(child_b.parent == &parent); layer_add_child(&parent, &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_b.next_sibling ==...
(child_a.next_sibling == NULL)
; } void test_layer__traverse(void) { Layer *stack[5]; uint8_t current_stack = 0; Layer *a = layer_create(GRectZero); Layer *aa = layer_create(GRectZero); Layer *aaa = layer_create(GRectZero); Layer *aaaa = layer_create(GRectZero); Layer *ab = layer_create(GRectZero); Layer *b = layer_create(GRectZero...
e_LowPower1); } } int accel_peek(AccelDriverSample *data) { prv_read_curr_accel_data(data); return 0; } //////////////////////////////////////////////////////////////////////////////// // FIFO Support //////////////////////////////////////////////////////////////////////////////// static void prv_program_fifo_...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Disabling FIFO"); prv_set_fifo_mode(BMA255FifoMode_Bypass); }
prv_set_accel_power_mode(BMA255PowerMode_Normal); prv_set_accel_power_mode(BMA255PowerMode_LowPower1); const bool enable_int = (num_samples != 0); prv_configure_fifo_interrupts(enable_int, use_fifo); s_fifo_is_enabled = use_fifo; } /////////////////////////////////////////////////////////////////////////...
64 * 1024, 4 * 64 * 1024); cl_assert_equal_i(s_command_list_index, 2); cl_assert_equal_i(s_command_list[0].addr, 64 * 1024); cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand); cl_assert_equal_i(s_command_list[1].addr, 2 * 64 * 1024); cl_assert_equal_i(s_command_list[1].type, SectorEraseCommand)...
(s_command_list[1].type, SubsectorEraseCommand)
; cl_assert_equal_i(s_command_list[2].addr, 40 * 1024); cl_assert_equal_i(s_command_list[2].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[3].addr, 44 * 1024); cl_assert_equal_i(s_command_list[3].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[4].addr, 48 * 1024); cl_assert...
} else if (strcmp(token, "TEST_IN_SLEEP") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.value); } else if (strcmp(token, "TEST_IN_SLEEP_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.min); } else if (strcmp(token, "TEST_IN_...
{ char *line = fgets(line_buf, sizeof(line_buf), state->common.file); if (!line) { // EOF break; } // printf("\nGot line: %s", line); // Find first token char *token = strtok(line, " \t\n"); if (!token) { continue; } // If this is a pre-processor directive, skip i...
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.max); } else if (strcmp(token, "TEST_LEN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.value); } else if (strcmp(token, "TEST_LEN_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d"...
equal_i(GColorBlackARGB8, fun(GColorWhite).argb); // // expectation as derived from Appfaces_all.psd cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xff0000)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0x00aaff)).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xaa0055)).ar...
(lookup_table_out[0], GColorBlack)
); cl_assert(gcolor_equal(lookup_table_out[1], GColorDarkGray)); cl_assert(gcolor_equal(lookup_table_out[2], GColorLightGray)); cl_assert(gcolor_equal(lookup_table_out[3], GColorWhite)); // Setting the tint color to blue should result in a gradient from blue to yellow tint_color = GColorBlue; gcolor_tint_l...
/* * 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...
(DISP_COLS, DISP_ROWS)
; GRangeVertical r = {.origin_y = 10, .size_h = 10}; GRangeHorizontal expected = (GRangeHorizontal){.origin_x = 0, .size_w = DISP_COLS}; cl_assert_equal_rangehorizontal(expected, perimeter_for_display_rect(&p, &ctx_size, r, 0)); expected = (GRangeHorizontal){.origin_x = 5, .size_w = DISP_COLS - 10}; cl_asser...
riginal_value[sizeof(ORIGINAL_VALUE)]; int original_value_length = sizeof(ORIGINAL_VALUE) - 1; memcpy(original_value, ORIGINAL_VALUE, sizeof(ORIGINAL_VALUE)); set_and_verify(&file_original, key, key_len, original_value, original_value_length); #define NEW_VALUE "new_value" uint8_t new_value[sizeof(NEW_VALUE)]...
(info->key_len + 1)
; uint8_t *val = malloc(info->val_len + 1); info->get_key(file, key, info->key_len); info->get_val(file, val, info->val_len); key[info->key_len] = '\0'; val[info->val_len] = '\0'; printf("Read key of %s %d and val of %s %d\n", key, info->key_len, val, info->val_len); int key_i = atoi((char*)key + 1); 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...
LOCK_AND_GET_STORE(store)
; settings_file_get(store, &key, sizeof(key), &value, sizeof(value)); return value; } DEFINE_SYSCALL(int32_t, persist_read_int, const uint32_t key) { int32_t value = 0; LOCK_AND_GET_STORE(store); settings_file_get(store, &key, sizeof(key), &value, sizeof(value)); return value; } DEFINE_SYSCALL(int, persis...
92, 496, 176}, { -1184, 288, 272}, { -1136, 144, 328}, { -1016, 168, 296}, { -984, 192, 336}, { -1096, 184, 504}, { -1120, 472, 992}, { -912, 312, 360}, { -1040, 552, 304}, { -904, 592, 336}, { -1080, 664, 368}, { -1536, 528, 448}, { -1968, 320, 472}, { -2080, 184, 46...
{ 416, 536, 424}, { 496, 792, 592}, { 496, 688, 632}, { 664, 1096, 808}, { 536, 1000, 808}, { 440, 872, 624}, { 448, 720, 624}, { 424, 696, 696}, { 304, 688, 512}, { 272, 552, 320}, { 264, 400, 240}, { 288, 312, 280}, { 288, 312, 304}, { 320, 344, 408}, { 392,...
{ -1104, 184, 456}, { -1088, 56, 400}, { -1272, -32, 456}, { -1208, 8, 864}, { -1176, -8, 800}, // 89 seconds { -904, 232, 512}, { -840, 432, 464}, { -896, 504, 344}, { -1664, 576, 544}, { -2176, 320, 424}, { -2096, 208, 480}, { -1808, 96, 392}, { -1576, 104, 224...
nOpen); } void test_rocky_api_app_message__awaiting_reset_complete_loc_init__rcv_chunk(void) { prv_init_and_goto_awaiting_reset_complete_local_initiated(); RCV_DUMMY_CHUNK(); // https://pebbletechnology.atlassian.net/browse/PBL-42466 // TODO: assert that chunk is NACK'd // Chunk is ignored, state isn't ch...
prv_postmessageconnected_postmessagedisconnected_negotiate_to_open_session()
; ASSERT_JS_GLOBAL_EQUALS_I("c", 1); ASSERT_JS_GLOBAL_EQUALS_I("d", 1); // Get a ResetComplete (unexpected message), should trigger initiating (local) ResetRequest: RCV_RESET_COMPLETE(); ASSERT_JS_GLOBAL_EQUALS_I("d", 2); } void test_rocky_api_app_message__postmessageconnected_and_postmessagedisconnected_st...
a spawn out of b and c Animation *c = prv_create_test_animation(); Animation *spawn = animation_spawn_create(c, b, NULL); cl_assert(spawn == NULL); // We should be able to create one out of c and d Animation *d = prv_create_test_animation(); spawn = animation_spawn_create(c, d, NULL); cl_assert(spawn !=...
animation_get_elapsed(h, &elapsed_ms)
); cl_assert_equal_i(elapsed_ms, duration / 2); cl_must_pass(animation_get_progress(h, &progress)); cl_assert_equal_i(progress, 32768); // Rounding occurs within, this is close to MAX / 2 animation_destroy(h); #endif } void test_animation__completed(void) { #ifdef TEST_INCLUDE_BASIC const int duration_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...
{ spi_ll_slave_acquire(ICE40LP->spi_port); spi_ll_slave_scs_assert(ICE40LP->spi_port); power_tracking_start(PowerSystemMcuSpi6); }
void display_spi_end_transaction(void) { spi_ll_slave_scs_deassert(ICE40LP->spi_port); spi_ll_slave_release(ICE40LP->spi_port); power_tracking_stop(PowerSystemMcuSpi6); } // Temporary code to support prv_do_display_update() logic that attempts to use the // bootloader error display void display_spi_configure_d...
void outside_x_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(15, 15)); } void outside_nx_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx,...
framebuffer_is_empty("outside_nx_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)
); } void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__clear(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 10, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_b...
active_window); } heart_node->node.offset = heart_node_offset; graphics_text_node_container_add_child(container, &heart_node->node); break; } case WorkoutMetricType_Steps: { const size_t buffer_size = sizeof("000000"); GTextNodeText *number_text_node = he...
(metric_type, (char *)number_text_node->text, buffer_size, i18n_owner, active_window->workout_data)
; #if PBL_RECT GTextNodeText *divider_text_node = health_util_create_text_node_with_text( "/", units_font, TEXT_COLOR, container); divider_text_node->node.offset.y = units_offset_y; /// MI/KM units string const char *units_string = active_window->workout_control...
/* * 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_send_buffer_destroy_count; }
void fake_session_send_buffer_init(void) { s_send_buffer_create_count = 0; s_send_buffer_destroy_count = 0; s_send_buffer_create_simulate_oom = false; } void fake_session_send_buffer_set_simulate_oom(bool enabled) { s_send_buffer_create_simulate_oom = enabled; } SendBuffer *fake_session_send_buffer_get_buff...
/* * 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...
{ BTErrno rv; if (resp_required) { HcProtocolMessage *resp = hc_protocol_enqueue_with_payload_and_expect(HcEndpointID_Gatt, cmd_id, data, data_len); rv = (resp != NULL) ? resp->payload[0] : BTErrnoPairingTimeOut; kernel_free(resp);...
BTErrno hc_endpoint_gatt_read(const BTDeviceInternal *addr, uint16_t att_handle, void *context) { HcGattReadData data = { .hdr.addr = *addr, .context_ref = (uintptr_t)context, .att_handle = att_handle, }; return prv_enqueue_and_get_rv(HcMessageID_Gatt_Read, (uint8_t *)&data, sizeof(data), true); } ...
GPIO_OType_PP, GPIO_Speed_2MHz); gpio_output_set(&dev->reset_gpio, false); } // Must call quad_enable first, all commands are QSPI qspi_indirect_write_no_addr_1line(dev->qspi, dev->state->part->instructions.enter_quad_mode); // Reset the flash to stop any program's or erase in progress from before reboot...
(dev->qspi, instruction, addr, dummy_cycles, length, is_ddr)
/* * 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_free(info->image_data); }
info->image_data = (uint8_t *) kernel_malloc(available_size); memcpy(info->image_data, image_data, available_size); info->icon.addr = info->image_data; info->icon.bounds = bounds; info->icon.row_size_bytes = row_size_bytes; info->icon.info_flags = info_flags; do_callbacks(app_type); } #endif static void...
horeGive(s_pb_semaphore); // (re)start timer for next event PBL_ASSERTN(new_timer_start(s_pb_state.timer_id, PUT_TIMEOUT_MS, prv_timer_callback, &s_pb_state, 0 /*flags*/)); prv_mark_pb_jobs_complete(num_put_jobs); // At this point we have updated the outstanding jobs. Check to s...
if (s_pb_state.current_command != PutBytesIdle) { PBL_LOG(LOG_LEVEL_ERROR, "Called put_bytes_expect while put_bytes is not idle"); xSemaphoreGive(s_pb_semaphore); return; }
e I2C module at this point if (i2c_hal_is_busy(bus)) { prv_bus_reset(bus); if (!prv_wait_for_not_busy(bus)) { // Bus did not recover after reset PBL_LOG(LOG_LEVEL_ERROR, "I2C bus did not recover after reset (%s)", bus->name); return false; } } // Take binary semaphore so that next ...
{ return i2c_write_register_block(slave, register_address, 1, &value); }
bool i2c_write_register_block(I2CSlavePort *slave, uint8_t register_address_start, uint32_t write_size, const uint8_t* buffer) { PBL_ASSERTN(slave); PBL_ASSERTN(buffer); // Do transfer locks the bus bool result = prv_do_transfer(slave->bus, Write, slave->address, register_address...
NULL) { ++count; switch (tuple->key) { case SOME_DATA_KEY: cl_assert(tuple->length == sizeof(SOME_DATA)); cl_assert(memcmp(tuple->value->data, SOME_DATA, sizeof(SOME_DATA)) == 0); data_found = true; break; case SOME_STRING_KEY: cl_assert(tuple->length == strle...
cl_assert(new_tuple->length == strlen(NEW_STRING) + 1)
; cl_assert(strcmp(new_tuple->value->cstring, NEW_STRING) == 0); cl_assert(old_tuple->type == TUPLE_CSTRING); cl_assert(old_tuple->length == strlen(SOME_STRING) + 1); cl_assert(strcmp(old_tuple->value->cstring, SOME_STRING) == 0); break; case SOME_DATA_KEY: is_data_updated = true...
rams, Line* line, GRect cursor, const Codepoint codepoint) { (void) ctx; PBL_ASSERT(cursor.origin.x >= line->origin.x, "Text cursor x=<%u> ahead of line origin x=<%u>", cursor.origin.x, line->origin.x); const int glyph_width_px = prv_codepoint_get_horizontal_advance(&...
{ while ((current_codepoint == NEWLINE_CODEPOINT || current_codepoint == SPACE_CODEPOINT)) { // Newlines should not adjust the width if (current_codepoint == NEWLINE_CODEPOINT) { next_glyph_width_px = 0; } else { next_glyph_width_px = prv_codepoint_get_horizontal_advance(&ctx->font...
if (line->suffix_codepoint) { GRect cursor = { .origin = line->origin, .size.w = next_glyph_width_px, .size.h = fonts_get_font_height(text_box_params->font) }; cursor.origin.x += walked_width_px; if (char_visitor_cb) { char_visitor_cb(ctx, text_box_params, line, cursor, line-...
from the container height // because it exactly matches the vertical spacing we want between the title and subtitle container_rect.size.h += fcc_number_subtitle_height; } grect_align(&container_rect, cell_layer_bounds, GAlignCenter, true /* clip */); // Draw the FCC title in the top left of the container...
(item->draw_cell_fn)
; cd->menu_items = app_realloc(cd->menu_items, sizeof(*cd->menu_items) * ++cd->menu_count); PBL_ASSERTN(cd->menu_items); cd->menu_items[cd->menu_count - 1] = *item; } static void prv_append_regulatory_compliance_mark(SystemCertificationData *cd, ...
cense for the specific language governing permissions and * limitations under the License. */ #include <stdint.h> #include "board/board.h" #include "drivers/button.h" #include "drivers/dbgserial.h" #include "drivers/display.h" #include "drivers/flash.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #...
(noreturn)
/* * 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_start(args, format)
; int len = vsnprintf(line_buffer, sizeof(line_buffer), format, args); hw_uart_write_buffer(CONFIG_LOG_UART, line_buffer, MIN((int)sizeof(line_buffer), (unsigned int)len)); va_end(args); return 0; } static void prv_lock(void) { OS_ENTER_CRITICAL_SECTION(); } static void prv_unlock(voi...
ntext, &GRect(20, 80, 40, 10), 4, GCornersAll); ASSERT_CALLED(prv_fill_rect_non_aa(&context, &GRect(20, 80, 40, 10), 4, GCornersAll, GColorBlack)); } void test_graphics_context_${BIT_DEPTH_NAME}__fill_antialiased(void) { // Fill shape, antialiased (Stroke width/color N/A) setup_test(&context, true, 5, GColorBla...
ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)))
; ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE...
GPoint(50, 50)
, 10); ASSERT_CALLED(graphics_circle_draw_1px_non_aa(&context, GPoint(50, 50), 10)); setup_test(&context, false, 1, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); ASSERT_CALLED(prv_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); } void test_graphics_con...
r, &data->window); } static void prv_handle_from_inc(unsigned index, void *context) { TimeRangeSelectionWindowData *data = context; date_time_handle_time_change(&data->from, index, 1); } static void prv_handle_from_dec(unsigned index, void *context) { TimeRangeSelectionWindowData *data = context; date_time_ha...
selection_layer_set_active_bg_color(to_selection_layer, color)
; selection_layer_set_inactive_bg_color(to_selection_layer, GColorDarkGray); selection_layer_set_callbacks(to_selection_layer, time_range_selection_window, (SelectionLayerCallbacks) { .get_cell_text = prv_handle_to_get_text, .complete = prv_handle_to_complete, .increment = prv_handle_to_inc, ....
tbeat->data + analytics_metric_offset(metric); } static uint8_t *prv_heartbeat_get_array_location(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, uint32_t index) { prv_verify_kinds_match(heartbeat, metric); if (!analytics_metric_is_array(metric)) { PBL_CROAK("Attempt to use array value for inte...
analytics_heartbeat_kind_data_size(kind)
; AnalyticsHeartbeat *heartbeat = kernel_malloc_check(size); heartbeat->kind = kind; analytics_heartbeat_clear(heartbeat); return heartbeat; } AnalyticsHeartbeat *analytics_heartbeat_device_create() { AnalyticsHeartbeat *hb = analytics_heartbeat_create(ANALYTICS_HEARTBEAT_KIND_DEVICE); analytics_heartbeat_...
01, // Attribute 1 ID - Title 0x04, 0x00, // Attribute 1 Length // Attribute text: 'L', 'i', 'k', 'e', 0x07, // Attribute 2 ID - ANCS UID 0x01, 0x00, // Attribute 2 Length // Attribute text: "Test" 0x01 }; static uint8_...
(attribute_get_string(&list2, AttributeIdSubtitle, ""), "Subtitle")
; cl_assert_equal_s(attribute_get_string(&list2, AttributeIdBody, ""), "Body"); // check that the pointers have moved cl_assert(attribute_get_string(&list2, AttributeIdTitle, "") != attribute_get_string(&list, AttributeIdTitle, "")); cl_assert(attribute_get_string(&list2, AttributeIdSubtitle, "") != at...
viceState s_qemu_uart_state; static UARTDevice QEMU_UART_DEVICE = { .state = &s_qemu_uart_state, // GPIO? Where we're going, we don't need GPIO. (connected to QEMU) .periph = USART2, .irq_channel = USART2_IRQn, .irq_priority = 13, .rcc_apb_periph = RCC_APB1Periph_USART2 }; UARTDevice * const QEMU_UART = &QE...
(VOLTAGE_MONITOR_ALS)
; voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY); }
d_light_sleep_min(uint32_t minutes) { // Light sleep produces minute statistics with step:0, variance:17-22, with // one minute of high variance (511) every 3-10 minutes. for (uint32_t minute = 0; minute < minutes; minute++) { if ((minute % 10) == 0) { activity_test_feed_samples(s_walk_30_steps, 10 * S...
prv_feed_deep_sleep_min(20)
; // Capture steps before sleep activity_get_metric(ActivityMetricSleepState, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "sleep state: %d", (int)value); // See how many steps we took during sleep. The light sleep simulator ends up providing about // 12 steps every 10 minutes, so without the "no steps during sleep...
ealth_event = { .type = HealthEventHeartRateUpdate, .data.heart_rate_update = { .current_bpm = median_hr, .is_filtered = true, } } }; event_put(&event); } } // ------------------------------------------------------------------------------------------ // Calc...
(state->hr.metrics.current_hr_zone)
; } // ------------------------------------------------------------------------------------------ // Called periodically from the minute handler to update the median HR and time spent in HR zones static void prv_update_hr_derived_metrics(void) { ActivityState *state = activity_private_state(); mutex_lock_recursive...
& S29VSStatusBit_EraseStatus) != 0) return E_ERROR; return S_SUCCESS; } status_t flash_impl_erase_subsector_begin(FlashAddress subsector_addr) { return flash_impl_erase_sector_begin(subsector_addr); } status_t flash_impl_erase_sector_begin(FlashAddress sector_addr) { status_t result = E_UNKNOWN; // FIXME: We...
prv_read_status_register(sector_addr)
; if ((sr & S29VSStatusBit_DeviceReady) != 0 && (sr & S29VSStatusBit_EraseSuspended) != 0) { prv_issue_command(sector_addr, S29VSCommand_EraseResume); status = S_SUCCESS; } else { // Device busy or no suspended erase to resume. status = E_INVALID_OPERATION; } flash_impl_release(); return...
{ s_activity_reward_state.active_minutes++; }
else { s_activity_reward_state.active_minutes = 0; } if (activity_metrics_prv_steps_per_minute() > s_sleep_summary_settings.summary.sleep.trigger_notif_activity) { s_sleep_pin_state.active_minutes++; } // Check activity insights if (activity_prefs_activity_insights_are_enabled()) { prv_do...
/* * 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...
{ // Show the minimum stub bar if progress just began bar_height = minimum_stub_height; }
return bar_height; } static void prv_setup_day_bar_box(int weekday, GRect *box, int16_t bar_height) { const int w = 23; // normal bar width; #if PBL_RECT // The center bars are slightly wider than the other bars // Note that Thursday is the center bar, not Wednesday since drawing begins with Monday // ...
h axis saw a big enough delta in response to the self test mode. // NOTE! For some reason, applying a "positive" force makes the number go lower and applying // a "negative" force makes the number go higher. And then, for some reason, we abs() it when // calculating a delta to hide the fact that it's backwards. T...
if (BMI160SampleRate_400_HZ == sample_rate) { acc_odr = BMI160AccODR_400_HZ; } else if (BMI160SampleRate_800_HZ == sample_rate) { acc_odr = BMI160AccODR_800_HZ; } else { // any interval < min supported must saturate to 1600Hz acc_odr = BMI160AccODR_1600_HZ; }
return acc_odr; } static BMI160SampleRate prv_get_supported_sample_rate(uint32_t interval_us) { BMI160SampleRate sample_rate; if (BMI160SampleRate_12p5_HZ <= interval_us) { sample_rate = BMI160SampleRate_12p5_HZ; } else if (BMI160SampleRate_25_HZ <= interval_us) { sample_rate = BMI160SampleRate_25_HZ...
0, 168, 16}, { 1800, 48, -8}, { 1664, 80, -112}, { 1488, 80, -152}, { 1304, 96, -208}, { 1160, 0, -296}, { 1152, -176, -496}, { 904, -480, -320}, { 800, -560, -240}, { 904, -368, -296}, // 45 seconds { 888, -168, -504}, { 1032, -112, -304}, { 1336, -56, -376}, { 1...
{ 480, 488, -168}, { 976, 680, 48}, { 992, 696, -80}, { 1088, 528, -144}, { 1496, 528, -72}, { 1736, 440, 8}, { 1640, 312, -56}, { 1648, 192, -16}, { 1480, 88, -104}, { 1272, 32, -144}, { 1096, -56, -152}, { 984, -72, -208}, { 968, -80, -232}, { 888, -56, -288}, ...
{ 1288, 128, -176}, { 1120, 24, -144}, { 1000, -16, -168}, { 1048, 8, -224}, { 1120, 32, -264}, { 1040, -56, -376}, // 53 seconds { 976, -80, -376}, { 1168, -112, -200}, { 1312, -56, -352}, { 1192, -16, -304}, { 1256, 48, -312}, { 1248, 64, -368}, { 1192, 184, -3...
/* * 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_get_object_getter_result(date, "getFullYear")
// Stubs for fake_crc.c #include "services/normal/filesystem/pfs.h" int pfs_read(int fd, void *buf, size_t size) { return 0; } int pfs_seek(int fd, int offset, FSeekType seek_type) { return 0; } // Test Code! void test_spalding_mfg_info__initialize(void) { fake_spi_flash_init(FLASH_REGION_MFG_INFO_BEGIN, ...
(mfg_info_get_disp_offsets().y, 1)
; cl_assert_equal_i(mfg_info_get_watch_color(), 3); cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); // Make sure we have space for the model. mfg_info_set_model("test_model"); cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2); cl_a...
s format doesn't match GBITMAP_NATIVE_FORMAT (see comment for mocked // graphics_capture_frame_buffer() above) bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) { PBL_ASSERTN(ctx); ctx->lock = false; framebuffer_dirty_all(ctx->parent_framebuffer); return true; } void test_simple_dialog__initia...
(dialog, GColorJaegerGreen)
; dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); prv_push_and_render_simple_dialog(dialog); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_simple_dialog__alarm_deleted(void) { SimpleDialog *simple_dialog = simple_dialog_create("Alarm Deleted"); Dialog *dialog = simple_dialog_get_di...
/* * 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...
periph_config_enable(dev->periph, dev->rcc_apb_periph)
; // configure GPIO const GPIOOType_TypeDef otype = is_open_drain ? GPIO_OType_OD : GPIO_OType_PP; if (dev->tx_gpio.gpio) { gpio_af_init(&dev->tx_gpio, otype, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); } if (dev->rx_gpio.gpio) { // half-duplex should only define a TX pin PBL_ASSERTN(!dev->half_duplex);...
true, SW = 11 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw4_no_clip.${BIT_DEPTH_NAME}.pbi"))
sert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat4BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat8Bi...
cl_assert(NULL != bmp)
; cl_assert(p == gbitmap_get_palette(bmp)); cl_assert(NULL == gbitmap_create_blank_with_palette(s10, GBitmapFormat8BitCircular, p, true)); cl_assert(NULL == gbitmap_create_blank_with_palette(s180, GBitmapFormat8BitCircular, p, true)); #endif } void test_gbitmap_formats__display_framebuffer_bytes(void) { #ifdef ...
above the object unless othersize noted #define CARD_BOTTOM_PADDING 18 // The y-position of a layout frame when its banner is peeking #define BANNER_PEEK_STATIC_Y (DISP_ROWS - STATUS_BAR_LAYER_HEIGHT) #define BOTTOM_BANNER_CIRCLE_RADIUS 8 static void prv_card_render(NotificationLayout *layout, GContext *ctx, bool ren...
JUMBOJI_TABLE(EMOJI_ENTRY)
; static bool prv_each_emoji_codepoint(int index, Codepoint codepoint, void *context) { Codepoint *emoji_codepoint = context; if (codepoint_is_end_of_word(codepoint) || codepoint_is_formatting_indicator(codepoint) || codepoint_is_skin_tone_modifier(codepoint) || codepoint_is_special(codepoint) ||...
dls_endpoint_print_message((uint8_t *)&msg, 0); comm_session_send_data(session, ENDPOINT_ID_DATA_LOGGING, (uint8_t *)&msg, sizeof(DataLoggingCloseSessionMessage), COMM_SESSION_DEFAULT_TIMEOUT); } bool dls_endpoint_send_data(DataLoggingSession *logging_session, cons...
(session_id)
N_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersTop); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_top.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1...
(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_topright.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerBottomLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_bottomleft.${BIT_DEPTH_NAME}.pbi")); set...
lock(); } static void prv_bt_le_gateway_response_latency_watchdog_cb(void *data) { // offload handling onto KernelBG so we don't stall the timer thread // trying to get the bt lock system_task_add_callback(prv_bt_le_gateway_response_latency_watchdog_handler, data); } static bool prv_find_source(ListNode *found_...
kernel_free(curr_request)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(text_heap_info, GColorBlack)
void*)0, .minute = 0, .hour = 1, .mday = 20, .month = 11, .may_be_instant = true, }; // 2015 Dec 21, 01:00:00 GMT const time_t advance = 1450659600 - s_2015_dec19_123456_gmt; prv_basic_test(&s_timezone_gmt, &test_cron, s_2015_dec19_123456_gmt, advance, advance, 1); } void test_cron__dst_r...
((uintptr_t)new_job.cb_data, 2)
; cl_assert_equal_i(cron_service_get_job_count(), 6); fake_rtc_increment_time(SECONDS_PER_DAY * 60); cron_service_wakeup(); cl_assert_equal_i(cron_service_get_job_count(), 0); } void test_cron__offset_negative_seconds_one_wday(void) { CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)...
ff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* bytes 3136 - 3152 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3152 - 3168 */ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, ...
(resource_bank, no_litter_res_id)
; uint8_t image_buf[image_size]; // read the last byte, and make sure it returns a successful 1 byte return value cl_assert_equal_i( resource_load_byte_range_system(resource_bank, no_litter_res_id, image_size - 1, image_buf, 1), 1); return; } void test_resource__read_past_last_byte_resource(void) { cha...
928, -32, -40}, { 1112, -136, -80}, { 1456, -288, 176}, { 1392, 48, 72}, { 1344, 208, -176}, { 1256, 200, -120}, { 1008, 152, 136}, // 44 seconds { 1016, 200, 64}, { 1104, 264, 184}, { 1048, 456, 104}, { 904, 480, 48}, { 896, 472, -80}, { 912, 400, -88}, { 1152, 4...
{ 928, 368, 320}, { 904, 392, 128}, { 856, 376, 88}, { 872, 496, -72}, { 928, 456, -56}, { 1168, 552, -112}, { 1376, 408, 104}, { 1784, 408, 168}, { 1352, 344, 160}, { 1288, 216, 152}, { 1336, 64, 248}, { 1400, 80, 224}, { 1136, 8, 288}, { 920, 16, 232}, // 50...
{ 768, -16, 168}, { 720, -24, 120}, { 680, -48, 72}, { 744, -96, 48}, { 856, -80, -32}, { 1208, -288, 88}, { 1600, -216, 288}, { 1536, 112, 152}, { 1576, 448, -160}, { 1288, 368, 48}, { 1032, 200, 208}, { 1032, 272, 192}, { 960, 304, 248}, { 896, 392, 152}, {...
t = xQueueReceive(s_from_worker_event_queue, event, 0); } // If there was nothing in the queue, return false. We are misusing the queue set by pulling events out // from the s_kernel_event_queue queue before it's activated so likely, the activated queue was // s_kernel_event_queue. if (!result) {...
{ xQueueSend(s_system_event_queue_set, &s_kernel_event_queue, 0); }
int num_client_task_events_enqueued = uxQueueMessagesWaiting(preserve_queue); for (int i = 0; i < num_client_task_events_enqueued; ++i) { xQueueSend(s_system_event_queue_set, &preserve_queue, 0); } } QueueHandle_t event_kernel_to_kernel_event_queue(void) { return s_from_kernel_event_queue; } BaseType_t...
/* * 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...
{ PebbleMutex *mutex = mutex_create(); mutex_lock(mutex); mutex_unlock(mutex); cl_assert_equal_b(fake_mutex_all_unlocked(), true); }
void test_fake_mutex__leave_unlocked(void) { PebbleMutex *mutex = mutex_create(); mutex_lock(mutex); cl_assert_equal_b(fake_mutex_all_unlocked(), false); } void test_fake_mutex__double_lock(void) { fake_mutex_set_should_assert(false); PebbleMutex *mutex = mutex_create(); mutex_lock(mutex); mutex_lock(...
urces_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info)); cl_assert_equal_i(horiz_advance, text_resources_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info)); } void test_text_resources__horiz_advance_multiple(void) { uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18; cl_assert(text_resource...
(horiz_advance != 0)
af_init(&dev->tx_gpio, otype, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); } if (dev->rx_gpio.gpio) { // half-duplex should only define a TX pin PBL_ASSERTN(!dev->half_duplex); gpio_af_init(&dev->rx_gpio, otype, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); } // configure the UART peripheral control registers // ...
while (!uart_is_tx_ready(dev)) continue;
dev->periph->DR = data; } uint8_t uart_read_byte(UARTDevice *dev) { // read the data regardless since it will clear interrupt flags return dev->periph->DR; } UARTRXErrorFlags uart_has_errored_out(UARTDevice *dev) { uint16_t errors = dev->periph->SR; UARTRXErrorFlags flags = { .parity_error = (errors &...
size_t value_length, uint16_t value_offset, BLEGATTError error) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; Uuid descriptor_uuid = ble_descriptor_get_uuid(descriptor); uuid_to_string(&descriptor_uuid, uu...
uuid_equal(&hrm_uuid, &characteristic_uuid)
) { ble_client_subscribe(characteristics[c], BLESubscriptionNotifications); } // BLEDescriptor descriptors[8]; // uint8_t num_descriptors = // ble_characteristic_get_descriptors(characteristics[c], descriptors, 8); // for (unsigned int d = 0; d < num_descriptors; ++d) { // ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memcpy(&desired_address_out->addr, &s_local_addr_desired_policy.pinned_address.octets, sizeof(desired_address_out->addr))
/* * 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...
(with_neither, string_strip_leading_whitespace(with_both))
== 0); } void test_string__strip_trailing_whitespace(void) { char string_out[100]; const char *with_whitespace = "hello, world "; const char *without_whitespace = "hello, world"; string_strip_trailing_whitespace(with_whitespace, string_out); cl_assert(strcmp(without_whitespace, string_out) == 0); cons...
g, data->resource_id_80); dialog_show_status_bar_layer(dialog, true); actionable_dialog_set_action_bar_type(actionable_dialog, DialogActionBarConfirm, NULL); actionable_dialog_set_click_config_provider(actionable_dialog, prv_confirm_config_provider); app_actionable_dialog_push(actionable_dialog); } ////...
dialog_set_icon(dialog, data->resource_id_25)
; dialog_show_status_bar_layer(dialog, true); expandable_dialog_set_header(expandable_dialog, "Header"); app_expandable_dialog_push(expandable_dialog); } //////////////////////////////// // Expandable Dialog with multi line header static void prv_show_expandable_dialog_long_header(DialogsData *data) { Expand...
One opaque top window removes Transparent and Unfocused modal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_manager_get_properties(), ModalProperty_Exists | ModalProperty_CompositorTransitions | ModalProperty_RenderRequested); cl_assert_equal_i(windows[2][0]->on_scr...
cl_assert_equal_i(windows[3][1]->is_click_configured, true)
; cl_assert_equal_i(windows[2][1]->on_screen, true); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_i(windows[1][0]->on_screen, true); cl_assert_equal_i(windows[1][0]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][1]); for (ModalPri...
cl_assert_equal_s("Fri, 12:00 PM", time_buf); // June 11th 2015, 23:59:59 (T-12:00:01) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) - 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Fri, 12:00 PM", time_buf); // June 12th 2015, 00:00:00...
(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("1 MIN AGO", time_buf); // June 9th 2015, 12:05:00 (T+00:05:00) rtc_set_time(event_time + (5 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("5 MIN AGO", time_buf); // June 9th 2015, 12:10:00 (T+00:10...
EN_COLOR_DEPTH_BITS == 1 ASSERT_CALLED(prv_fill_rect_non_aa(&context, &GRect(10, 20, 40, 10), 0, GCornerNone, GColorBlack)); #else ASSERT_CALLED(prv_fill_rect_aa(&context, &GRect(10, 20, 40, 10), 0, GCornerNone, GColorBlack)); #endif setup_test(&context, true, 5, GColorBlack, GColorBlack, false); graphics_fill...
GPoint(45, 10)
)); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); ASSERT_NO_CHANGE(graphics_fill_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_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...
for (int i = 0; i < NUM_ACTION_BAR_LEGACY2_ITEMS; i++) { action_bar_legacy2_set_highlighted(action_bar, i, false); }
} } static void action_bar_legacy2_update_proc(ActionBarLayerLegacy2 *action_bar, GContext* ctx) { const GColor bg_color = get_native_color(action_bar->background_color); graphics_context_set_fill_color(ctx, bg_color); const uint8_t radius = 3; const uint8_t margin = 1; graphics_fill_round_rect(ctx, &acti...
name_out, name, BT_DEVICE_NAME_BUFFER_SIZE); name_out[BT_DEVICE_NAME_BUFFER_SIZE - 1] = 0; } return true; } bool bt_persistent_storage_get_ble_pairing_by_addr(const BTDeviceInternal *device, SMIdentityResolvingKey *IRK_out, ...
if (link_key_out) { *link_key_out = link_key; }
nt16_t val_len = resp->value_length; if (val_len) { // Only create ReadResponseData node if length is not 0 ReadResponseData *read_response = kernel_malloc(sizeof(ReadResponseData) + val_len); if (!read_response) { *gatt_value_length = 0; return BLEGATTErrorLocalInsufficientResources; } ...
(obj_ref, &connection)
; if (!att_handle) { ret_val = BTErrnoInvalidParameter; goto unlock; } GattClientEventContext *data = prv_create_event_context(client); if (!data) { ret_val = BTErrnoNotEnoughResources; goto unlock; } // Zero'd out and added to list in `prv_create_event_context` dat...