prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
sport *s_last_closed_transport; static void prv_close(Transport *transport) { ++s_close_count; s_last_closed_transport = transport; } static int s_reset_count; static void prv_reset(Transport *transport) { ++s_reset_count; } typedef enum { TransportIDNull, TransportID1, TransportID2, TransportID3, N...
cl_assert_equal_b(s_dls_private_handle_disconnect_called, true)
; cl_assert_equal_b(s_comm_session_event_put, true); } void test_session__get_type_app(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_transport_imp, TransportDestinationApp); cl_assert_equal_i(comm_ses...
_conn_params_set(&preferred_params); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_per_pref_conn_params_set: %u", e); } } void ble_task_assert_is_executing_on_ble_task(void) { PBL_ASSERTN(xTaskGetCurrentTaskHandle() == DialogTaskList[DialogTask_Ble]); } static void prv_configure_irk(const BTDr...
prv_handle_conn_param_update_request_response( (const ble_evt_gap_conn_param_update_completed_t *)hdr)
; break; case BLE_EVT_GAP_CONN_PARAM_UPDATE_REQ: prv_handle_conn_param_update_request((const ble_evt_gap_conn_param_update_req_t *)hdr); break; case BLE_EVT_GAP_SEC_LEVEL_CHANGED: prv_handle_evt_gap_sec_level_changed((ble_evt_gap_sec_level_changed_t *)hdr); ...
(sizeof(SerializedTimelineItemHeader) + payload_size)
; timeline_item_serialize_header(item, (SerializedTimelineItemHeader *) buffer); timeline_item_serialize_payload(item, buffer + sizeof(SerializedTimelineItemHeader), payload_size); // only for items without attributes as of right now // Records inserted by the watch are dirty and need to be synced to the p...
prv_count_handler_entries(&s_started_handler_calls, a3), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a3), 1); // None of the b's should finish yet cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b0), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_...
(elapsed_ms, -1 * (delay_seq + delay_a))
; animation_get_elapsed(b, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a + duration_a + delay_b)); // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_star...
} // Configure PMIC's charger settings (different from defaults - // see https://pebbletechnology.atlassian.net/browse/PBL-15134) static bool prv_config_charger(void) { const uint8_t CHARGE_VOLTAGE_4300 = 0b101; const uint8_t CHARGE_VOLTAGE_4200 = 0b011; // [AS] HACK alert! (see PBL-19186) // The MAX14690 sta...
{ rail_control_reg = PmicRegisters_LDO2_CONFIG; ref_count = &s_ldo2_ref_count; }
else if (rail == PmicRail_LDO3) { rail_control_reg = PmicRegisters_LDO3_CONFIG; ref_count = &s_ldo3_ref_count; } else { WTF; } uint8_t register_value; bool success = prv_read_register(rail_control_reg, &register_value); if (!success) { // Failed to read the current register value return...
/* * 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...
(!bt_ctl_is_bluetooth_active())
; if (bt_test_bt_sig_rf_test_mode()) { app_data->test_state = BtTestStateStarted; } else { app_data->test_state = BtTestStateFailed; } break; } case BtTestStateStopping: { PBL_ASSERTN(bt_ctl_is_bluetooth_active()); app_data->test_state = BtTestStateStopped; ...
label; layer_set_frame(&time_selection_window->selection_layer.layer, &GRect(0, top_offset, time_selection_window->window.layer.bounds.size.w, selection_layer_default_cell_height())); } static void prv_vertical_align_text_layer(TimeSelectionWindowData *time_selection_window...
prv_update_range_text_layer(time_selection_window)
; } // FROM selection layer callbacks static char* prv_handle_from_get_text(unsigned index, void *context) { TimeSelectionWindowData *data = context; return date_time_selection_get_text(&data->time_data, index, data->cell_buf); } // Selection layer callbacks static void prv_handle_complete(void *context) { Time...
ms->remote_desired_state, length); break; case PebblePairingServiceConnParamsWriteCmd_EnablePacketLengthExtension: rv = prv_handle_ple_update_request(evt->conn_idx, &conn_params->ple_req, length); break; case PebblePairingServiceConnParamsWriteCmd_InhibitBLESleep: power_inhibit_sleep(); ...
PBL_ASSERTN(ble_gatts_add_characteristic(&uuid, GATT_PROP_READ | GATT_PROP_NOTIFY, ATT_PERM_READ, sizeof(PebblePairingServiceConnectivityStatus), enable_read_cb_flag, NULL, &ctx->att_hdl.conn...
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 "applib/ui/scroll_layer.h" #include "clar.h" // Stubs ////////////////////////...
(scroll_bounds)
; GSize content_size = GSize(180, 2000); scroll_layer_set_content_size(scroll_layer, content_size); int32_t scroll_height = DEFAULT_SCROLL_HEIGHT; int32_t offset = 0; for (offset = 0; offset < content_size.h - scroll_bounds.size.h; offset += scroll_height) { // scroll offset for scroll down is negat...
to_app_update_func( GContext *ctx, Animation *animation, uint32_t distance_normalized) { return true; } static bool s_modal_window_present = false; Window* modal_manager_get_top_window(void) { return (Window*)(uintptr_t)s_modal_window_present; } static int s_modal_manager_render_count; void modal_manager_rend...
compositor_app_render_ready()
; cl_assert_equal_i(s_count_animation_schedule, 1); compositor_transition(&s_transition_b); // We should create a second animation, calling the b's transition init func. The animation // should not be scheduled as we're waiting for the interrupted app to render cl_assert_equal_i(s_count_animation_create, 2)...
26.6.11 for SSR to milliseconds conversion sub_seconds = RTC_GetSubSecond(); // Make sure neither date nor time rolled over since we read them. RTC_GetTime(RTC_Format_BIN, &rtc_time); // we need to read the DR again because reading the RTC_TR or RTC_SSR locks the shadow register // for RTC_DR and ...
(now >= s_alarm_set_time_milliseconds_since_epoch)
{ static const RockyGlobalAPI *apis[] = {NULL}; rocky_global_init(apis); EXECUTE_SCRIPT( "var d = new Date();\n" "var s1 = d.toString();\n" "var f = typeof(d.toLocaleTimeString);\n" "var s2 = d.toLocaleTimeString();\n" "var s3 = d.toLocaleDateString();\n" "var s4 = d.toLocaleString();\n" ...
EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: 'numeric', hour12: false});")
_service_write(AppInboxServiceTagAppMessageReceiver, data, length); } static Receiver *prv_app_message_receiver_prepare(CommSession *session, const PebbleProtocolEndpoint *endpoint, size_t total_payload_size) { analyt...
(rcv, kernel_receiver_finally_cb)
; } static void prv_app_message_receiver_cleanup(Receiver *receiver) { AppMessageReceiver *rcv = (AppMessageReceiver *)receiver; if (rcv->is_writing_to_app_inbox) { // Cancel the write, we don't want to deliver a broken message to the watchapp: app_inbox_service_cancel(AppInboxServiceTagAppMessageReceiver...
day = false, .layout = LayoutIdCalendar, }, .attr_list = { .num_attributes = 1, .attributes = &title_attr, }, }; static TimelineItem item4 = { .header = { .id = {0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, .timestamp = 100*60, ...
(timer_id, TIMER_INVALID_ID)
; cl_assert(!stub_new_timer_is_scheduled(timer_id)); cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 2); cl_assert(prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(5*60, stub_new_timer_timeout...
/* * 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 (!pb_decode(stream, pebble_pipeline_Measurement_fields, &msg)) { return false; }
if (*decoder_info->num_samples < decoder_info->max_num_samples) { decoder_info->offset_sec[(*decoder_info->num_samples)++] = msg.offset_sec; } return true; } typedef struct PLogMeasurementSetDecoderArg { Uuid *uuid; PLogTypesDecoderArg *types_decoder_arg; PLogMeasurementsDecoderArg *measurements_decod...
arge%d", i); int fd = pfs_open(file_large, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0); size_t sz = pfs_get_file_size(fd); cl_assert(sz == large_file_size); uint8_t *b = calloc(sz, 1); cl_assert(pfs_read(fd, b, sz) == sz); for (int j = 0; j < large_file_size / 4; j++) { uint32_t *val = (...
cl_assert(pfs_get_size() == (ftl_get_size() - SECTOR_SIZE_BYTES))
/* * 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(response)
; return true; } bool hc_endpoint_ctl_init_sync(const BTDriverConfig *config) { return prv_send_ctl_cmd(HcMessageID_Ctl_Init, (const uint8_t *)config, sizeof(*config)); } bool hc_endpoint_ctl_shutdown_sync(void) { const bool rv = prv_send_ctl_cmd(HcMessageID_Ctl_Shutdown, NULL, 0); PBL_LOG(LOG_LEVEL_INFO, "Go...
&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_x_offset_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 1), MAX_NUM_COLS); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 3), 148); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 5), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0...
ent)), true); ppogatt_send_next(transport); fake_gatt_client_op_assert_no_write(); // Ack the first one (sn=0): prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], 0 /* sn */); // The last enqueued one should now be sent out: prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData...
(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment) - sn)
; } // Simulate the regular timer firing a bunch of times to expire the timeout for all the packets: for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } fake_comm_session_process_send_next(); // The data should *NOT* get concatenated in ...
er(BMA255Register_FIFO_CONFIG_0, num_samples); prv_set_fifo_mode(BMA255FifoMode_Fifo); } else { 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 boo...
(BMA255Scale_4G)
; psleep(2); // wait for a new sample uint8_t new_data; int16_t before = prv_read_axis(axis, &new_data); before = prv_raw_to_mgs(before); // Positive axis bma255_write_register(BMA255Register_PMU_SELFTEST, axis_bits | SELFTEST_SIGN_POSITIVE); psleep(50); uint8_t new_positive; int16_t positive = 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...
PBL_LOG_VERBOSE("Received an unhandled event (%u)", event->type)
; return false; } } // ------------------------------------------------------------------------------------------------- void worker_event_loop(void) { // Event loop: while (1) { PebbleEvent event; sys_get_pebble_event(&event); if (event.type == PEBBLE_PROCESS_DEINIT_EVENT) { // We're ...
(*GTextNodeGetAxisAlignMethod)(GTextNode *node); typedef struct { GTextNodeDestroyMethod destructor; GTextNodeDrawMethod draw; GTextNodeDrawMethod will_draw; GTextNodeDrawMethod did_draw; bool is_container; } GTextNodeBaseImpl; typedef struct { GTextNodeBaseImpl base; GTextNodeGetAxisAlignMethod get_ax...
{ if (!node) { return; } GTextNodeContainer *container_node = (GTextNodeContainer *)node; prv_container_each(container_node, prv_destroy_container_iter, NULL); prv_destroy_text_node_base(&container_node->node); }
static bool prv_container_add_child(GTextNodeContainer *container_node, GTextNode *child) { if (!container_node || !child) { return false; } const size_t num_nodes = container_node->num_nodes; if (num_nodes >= container_node->max_nodes) { return false; } GTextNode *prev_child = (num_nodes > 0) ? 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...
music_protocol_msg_callback(NULL, data, length)
; } static void prv_receive_and_assert_now_playing(bool expect_is_handled) { uint8_t msg[] = { 0x10, 3, 'o', 'n', 'e', 3, 't', 'w', 'o', 5, 't', 'h', 'r', 'e', 'e', 0xAA, 0x00, 0x00, 0x00, 0xAA, 0x00, 0xAA, 0x00 }; prv_receive_pp_data(msg, sizeof(msg)); PebbleEvent e = fake_event_get_last();...
ize = { 0, 0 }; if (strlen(data->name_text_layer.text)) { content_size = text_layer_get_content_size(app_state_get_graphics_context(), &data->name_text_layer); content_size.w += 4; content_size.h += 4; } // Actually set the frame centered on the screen a...
prv_update_background_image_and_url_text(s_fu_app_data)
; prv_update_name_text(s_fu_app_data); } static void prv_bt_event_handler(PebbleEvent *event, void *context) { if (!s_fu_app_data) { return; } prv_update_name_text(s_fu_app_data); } static void prv_gather_debug_info_event_handler(PebbleEvent *event, void *context) { if (!s_fu_app_data) { return; }...
e_ui_data->current_icon); animation_unschedule(s_phone_ui_data->bg_color_animation); animation_unschedule(s_phone_ui_data->action_bar_animation); animation_unschedule(s_phone_ui_data->call_status_animation); #endif s_phone_ui_data->current_icon = NULL; s_phone_ui_data->current_icon_id = 0; status_bar_laye...
layer_set_frame(&s_phone_ui_data->status_bar.layer, &GRect(0, 0, window->layer.bounds.size.w - PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH, 0), STATUS_BAR_LAYER_HEIGHT))
; status_bar_layer_set_colors(&s_phone_ui_data->status_bar, PBL_IF_COLOR_ELSE(GColorClear, GColorWhite), GColorBlack); layer_add_child(&s_phone_ui_data->core_ui_container, &s_phone_ui_data->status_bar.layer); // Icon kino_layer_init(&s_phone_ui_data->...
ter = s_logging_sessions; while (iter != NULL) { if (iter->comm.session_id > session_id) { break; } if (iter->comm.session_id == session_id) { mutex_unlock_recursive(s_list_mutex); return (iter); } iter = iter->next; } mutex_unlock_recursive(s_list_mutex); return (NULL); }...
(LOG_LEVEL_WARNING, "Could not allocate additional DataLoggingSession objects")
; return NULL; } DataLoggingSession *logging_session = kernel_malloc_check(sizeof(DataLoggingSession)); *logging_session = (DataLoggingSession){ .status = status, .app_uuid = *app_uuid, .tag = tag, .task = pebble_task_get_current(), .item_type = type, .item_size = size, .session_...
time, child_start); } else { if (!child->abs_start_time_ms) { success = prv_schedule_animation(state, now, child, delay); } } } // Set the duration now, after we've possibly adjusted the children delays to compensate // for already scheduled children. animation->du...
prv_get_ms_since_system_start()
; const uint32_t time_normalized_raw = prv_get_time_normalized_raw(animation, now); return prv_get_distance_normalized(animation, time_normalized_raw); } bool animation_get_progress(Animation *animation_h, AnimationProgress *progress_out) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); P...
would be foolish. const uint32_t ahb1_periphs = RCC_AHB1Periph_CRC | RCC_AHB1Periph_DMA1 | RCC_AHB1Periph_DMA2 | RCC_AHB1Periph_DMA2D | RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_OTG_HS; const uint32_t ahb2_periphs = RCC_AHB2Periph_DCMI | RCC_AHB2Periph_CRYP | RCC_AHB2Periph_HASH | RCC_AHB2Periph_RNG ...
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE)
; break; default: PBL_CROAK("reset loop boot bits overrun"); break; } return false; } static bool check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool check_for_fw_start_failure() { // Add more failure conditions here. if (!watchdog_chec...
the device // name) will arrive in one-shot so anytime this routine gets called it // means we have 'added' a new pairing bool is_updating_existing = false; SMPairingInfo existing_pairing_info; if (shared_prf_storage_get_ble_pairing_data(&existing_pairing_info, NULL, NULL, NULL)) { if (sm_is_pairing_info...
{ return BLE_BONDING_ID; }
bool bt_persistent_storage_is_ble_ancs_bonding(BTBondingID bonding) { return bt_persistent_storage_get_ble_pairing_by_id(BLE_BONDING_ID, NULL, NULL, NULL); } bool bt_persistent_storage_has_ble_ancs_bonding(void) { return bt_persistent_storage_get_ble_pairing_by_id(BLE_BONDING_ID, NULL, NULL, NULL); } bool bt_pe...
.h> #include <stdint.h> #include <string.h> //! Modulus for sequence numbers #define MODULUS (128u) #define MAX_RETRANSMITS (10) #define RETRANSMIT_TIMEOUT_MS (200) // Reliable Transport protocol // =========================== //! A buffer for holding a reliable info packet in memory while it is un-ACKed. typedef s...
PBL_LOG(LOG_LEVEL_DEBUG, "Received malformed command packet")
; prv_bounce_ncp_state(); return; } ReliablePacket *packet = raw_packet; if (packet->is_supervisory) { if (packet->s.kind != SupervisoryKind_ReceiveReady && packet->s.kind != SupervisoryKind_Reject) { PBL_LOG(LOG_LEVEL_DEBUG, "Received a command packet of type %" PRIu8 " w...
ce cl_assert_equal_i(2, fake_event_get_count()); prv_assert_event(&device, BTErrnoOK); cl_assert_equal_i(3, fake_gatt_is_service_discovery_start_count()); fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID); gatt_client_discovery_discover_range(connection, &range_alt); // B...
(characteristic_two->descriptors[0].att_handle_offset, expected_characteristic2->descriptors[0].handle - service_handle)
; cl_assert_equal_i(characteristic_two->properties, expected_characteristic2->properties); cl_assert_equal_b(uuid_equal(&characteristic_two->uuid, &expected_characteristic2->uuid), true); } void test_gatt_client_discovery__single_blood_pressure_service(void) { BTDeviceInternal device = prv_connected_dummy_device...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return &s_ctx; }
// Stubs ///////////////////// #include "stubs_analytics.h" #include "stubs_app_install_manager.h" #include "stubs_app_state.h" #include "stubs_app_timer.h" #include "stubs_bootbits.h" #include "stubs_buffer.h" #include "stubs_click.h" #include "stubs_heap.h" #include "stubs_layer.h" #include "stubs_logging.h" #incl...
296, -152}, { 728, 320, -144}, { 728, 280, -88}, { 792, 288, -56}, { 880, 312, -120}, { 1064, 376, -184}, { 1120, 416, -256}, { 992, 432, -248}, { 1176, 416, -248}, { 1064, 432, -280}, { 952, 400, -216}, { 1040, 328, -160}, { 1208, 304, -120}, { 1304, 304, -64}, {...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-05 15:46:25 local AccelRawData *activity_sample_walk_100_pbl_25660_3(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25660_3 //> TEST...
NULL); PBL_ASSERTN(s_activity_state.hr.hrm_session != HRM_INVALID_SESSION_REF); s_activity_state.hr.log_session = protobuf_log_hr_create(NULL); PBL_ASSERTN(s_activity_state.hr.log_session != NULL); #endif // CAPABILITY_HAS_BUILTIN_HRM } // -----------------------------------------------------------------------...
activity_private_settings_close(file)
; pfs_remove(ACTIVITY_SETTINGS_FILE_NAME); file = activity_private_settings_open(); *written_version = ACTIVITY_SETTINGS_CURRENT_VERSION; } return file; } // ----------------------------------------------------------------------------------------- // Called from the prv_minute_system_task_cb(). Determ...
/* * 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_ancs_attr("F")
; calculated = ancs_notifications_util_parse_timestamp(crazy_bad_date); prv_destroy_ancs_attr(crazy_bad_date); cl_assert_equal_i(calculated, 0); ANCSAttribute *zero_length_date = prv_create_ancs_attr(""); calculated = ancs_notifications_util_parse_timestamp(zero_length_date); prv_destroy_ancs_attr(zero_len...
'; layer_mark_dirty((Layer *)&dialog->text_layer); } static void prv_transcription_dialog_unload(void *context) { TranscriptionDialog *transcription_dialog = context; app_timer_cancel(transcription_dialog->pop_timer); prv_stop_text_animation(transcription_dialog); } static void prv_transcription_dialog_load(v...
expandable_dialog_init((ExpandableDialog *)transcription_dialog, "Transcription Dialog")
; expandable_dialog_set_select_action((ExpandableDialog *)transcription_dialog, RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_transcription_dialog_select_handler); Dialog *dialog = expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog); dialog_set_callbacks(dialog, &(DialogCallbacks) { .un...
76}, { 1128, 192, -296}, { 1192, 72, -240}, { 1216, 48, -232}, { 1416, 168, -384}, { 1352, 248, -304}, { 1072, 280, -328}, { 744, 320, -312}, { 576, 344, -192}, { 568, 416, -200}, { 664, 480, -224}, { 800, 584, -336}, { 968, 624, -392}, { 1048, 696, -552}, { 1024,...
{ 552, 320, -264}, { 496, 328, -216}, { 440, 336, -112}, { 576, 376, -152}, { 688, 392, -184}, { 880, 336, -264}, { 1088, 136, -136}, { 1440, 152, -248}, { 1648, 248, -368}, { 1464, 240, -256}, { 1144, 232, -208}, // 77 seconds { 848, 376, -280}, { 680, 440, -248}...
{ 1480, 184, -312}, { 1408, 192, -264}, { 1128, 240, -272}, { 816, 328, -296}, { 704, 384, -288}, { 656, 432, -224}, { 784, 496, -280}, { 888, 560, -288}, { 904, 664, -376}, { 952, 720, -488}, { 944, 752, -496}, { 904, 648, -416}, { 1152, 600, -320}, { 1168, 664,...
->clients, NULL); } // ------------------------------------------------------------------------------------------------- bool shared_circular_buffer_write(SharedCircularBuffer* buffer, const uint8_t* data, uint16_t length, bool advance_slackers) { // If no clients, no need to write if (!buffer->clients) { ...
while (bytes_left) { uint16_t chunk; const uint8_t *read_ptr; shared_circular_buffer_read(buffer, client, bytes_left, &read_ptr, &chunk); memcpy(data, read_ptr, chunk); shared_circular_buffer_consume(buffer, client, chunk); data += chunk; bytes_left -= chunk; }
return (*length_out == length); } // ------------------------------------------------------------------------------------------------- void shared_circular_buffer_add_subsampled_client( SharedCircularBuffer *buffer, SubsampledSharedCircularBufferClient *client, uint16_t subsample_numerator, uint16_t subsa...
/* * 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_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_activity_summary_card__render_current_behind_typical1(void) { HealthData health_data = { .step_data = 170, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,...
/* * 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 (i < data_len) { if (i == data_len - 2) { // if 2 leftover bytes *out++ = prv_encode_char(data[i] >> 2); *out++ = prv_encode_char(((data[i] & 0x03) << 4) | (data[i + 1] >> 4)); *out++ = prv_encode_char((data[i + 1] & 0x0F) << 2); *out++ = '='; } else if (i == data_len - 1) { ...
if (result < out_len) { *out++ = 0; } return result; }
data) { if (s_pulse_task_idle && uxQueueMessagesWaiting(s_pulse_task_queue) == 0) { prv_pulse_task_feed_watchdog(); } } static void prv_pulse_task_main(void *unused) { task_watchdog_mask_set(PebbleTask_PULSE); static RegularTimerInfo idle_watchdog_timer = { .cb = prv_pulse_task_idle_timer_callback }...
(PULSE2_LCP)
; } void pulse_end(void) { ppp_control_protocol_close(PULSE2_LCP, PPPCPCloseWait_WaitForClosed); } void pulse_prepare_to_crash(void) { // We're crashing so it's not safe to use control_protocol APIs. prv_forge_terminate_ack(); } static void prv_assert_tx_buffer(void *buf) { // Ensure the buffer is actually 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...
app_state_get_accel_state()
; } else if (task == PebbleTask_Worker) { return worker_state_get_accel_state(); } else { WTF; } } void accel_service_cleanup_task_session(PebbleTask task) { AccelServiceState *state = accel_service_private_get_session(task); if (state->manager_state) { sys_accel_manager_data_unsubscribe(state->m...
/* * 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_ALWAYS, "Dialog: Rebooted due to watchdog, stuck task mask: 0x%"PRIx32, reason.extra)
; break; case RebootReasonCode_Assert: PBL_LOG(LOG_LEVEL_ALWAYS, "Dialog: Rebooted due to Assert: LR 0x%"PRIx32, reason.extra); break; case RebootReasonCode_HardFault: PBL_LOG(LOG_LEVEL_ALWAYS, "Dialog: Rebooted due to HardFault: LR 0x%"PRIx32, reason.extra); break; case Reboot...
(&frame, end_outer_point, fill_thickness)
; #if PBL_BW // Make sure we draw something if we have any steps if ((start_outer_point.y == end_outer_point.y) && (end_outer_point.x > start_outer_point.x) && (end_outer_point.x - start_outer_point.x < 3)) { end_outer_point.x = start_outer_point.x + 3; end_inner_point.x = start_inner_point.x + 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...
{ *out++ = 0; }
return result; }
le != HealthServiceAccessibilityMaskAvailable) { return 0; } // If we are summing, scale the values for the first and last day of the time range. For // min, max, and avg scaling does not apply. if (aggregation == HealthAggregationSum) { prv_adjust_value_boundaries(daily_history.totals, ARRAY_LENGTH(da...
if (!state->cache) { APP_LOG(APP_LOG_LEVEL_ERROR, "Not enough memory for health cache"); return 0; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(text_layer)
); } } void text_layer_legacy2_init(TextLayerLegacy2 *text_layer, const GRect *frame) { PBL_ASSERTN(text_layer); *text_layer = (TextLayerLegacy2){}; text_layer->layer.frame = *frame; text_layer->layer.bounds = (GRect){{0, 0}, frame->size}; text_layer->layer.update_proc = (LayerUpdateProc)text_layer_legacy2...
_cleanup(void) { } // ams_util_float_string_parse() tests /////////////////////////////////////////////////////////// #define assert_float_parse(in, mul, succeeds, expected_result) \ { \ const char *input = (const char *)in; \ const uint32_t input_length = input ? sizeof(in) : 0; \ const uint32_t multip...
(s_results_count, 1)
; cl_assert_equal_i(count, 1); cl_assert_equal_s(empty_string, s_results[0]); } void test_ams_util__csv_empty_values(void) { const char one_value[] = ","; const uint8_t count = ams_util_csv_parse(one_value, sizeof(one_value), NULL, prv_result_callback); cl_assert_eq...
APP_LOG(APP_LOG_LEVEL_ERROR, "%s", buffer)
; } else { APP_LOG(APP_LOG_LEVEL_ERROR, "no further info."); } } void jerry_set_object_field(jerry_value_t object, const char *field, jerry_value_t value) { JS_VAR prop_name = jerry_create_string((jerry_char_t *)field); JS_UNUSED_VAL = jerry_set_property(object, prop_name, value); } jerry_value_t jerry_ge...
*mask = graphics_context_mask_create(ctx, transparent); cl_assert(mask); const GSize mask_size = ctx->dest_bitmap.bounds.size; for (int16_t x = 0; x < mask_size.w; x++) { const uint8_t mask_pixel_value = (uint8_t)(x / num_pixels_per_mask_value); for (int16_t y = 0; y < mask_size.h; y++) { test_grap...
(ctx, bitmap_size)
; // Fill the canvas so each column (of width hline_applying_test_column_width) is set to one of the // different possible dest_colors for (int16_t y = 0; y < bitmap_size.h; y++) { for (int16_t column_index = 0; column_index < num_dest_colors; column_index++) { const int16_t starting_x = column_index *...
h" #include "kernel/ui/kernel_ui.h" #include "resource/resource_ids.auto.h" #include "system/passert.h" #include <stdlib.h> #include <string.h> #define SCROLL_ANIMATION_DURATION (300) #define POP_WINDOW_DELAY (400) #define CHARACTER_DELAY (20) #define TEXT_OFFSET_VERTICAL (6) static void prv_show_next_character(Tr...
(transcription_dialog->animation)
codepoint, font_res->app_num, font_res->resource_id, bitmap_addr, glyph_size_bytes); if (HAS_FEATURE(font_res->md.version, VERSION_FIELD_FEATURE_RLE4)) { // Load the glyph data at the end of the buffer target = &((uint8_t *)g->data)[CACHE_GLYPH_SIZE - glyph_size_bytes]; } else { t...
(text_render_flash)
; num_bytes_loaded = sys_resource_load_range(font_res->app_num, font_res->resource_id, data->resource_offset, (uint8_t *)&header, sizeof(header)); SYS_PROFILER_NODE_STOP(text_render_flash); // convert to a GlyphHe...
/* * 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...
{ alpha_percent = 50; // FIXME: Currently don't support 66 }
else if (data->alpha == ALPHA_33) { alpha_percent = 25; // FIXME: Currenlty don't support 33 } else if (data->alpha == ALPHA_0) { alpha_percent = 0; } snprintf(data->alpha_text_buffer, sizeof(data->alpha_text_buffer), " a = %d %%", alpha_percent); if (data->property == PROPERTY_ALPHA) { set_text_el...
/* * 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_ASSERTN(data != NULL && string_alloc_size_out != NULL); *string_alloc_size_out = 0; const uint8_t *end = data + size; const uint8_t *cursor = data; int32_t result = attribute_get_buffer_size_for_serialized_attributes(num_attributes, ...
{ -928, 352, 64}, { -1224, 432, 240}, { -1408, 1632, 360}, { -1288, 872, 16}, { -1136, 584, -184}, { -1304, 408, -48}, { -1600, 384, 80}, { -1480, 352, 40}, { -1248, 248, 96}, // 18 seconds { -1216, 232, 80}, { -1352, 112, 128}, { -1360, 56, 96}, { -1376, 120, 120...
{ -1160, 424, -376}, { -1360, 400, -152}, { -1552, 168, 48}, { -1344, 240, 48}, { -1136, 168, 48}, { -1064, 152, 88}, { -1120, 192, 112}, { -1128, 176, 96}, { -1168, 280, 80}, { -1304, -112, 320}, { -888, -352, 200}, { -1152, -304, 128}, { -1376, -152, -144}, { -1...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_circular_buffer, s_reports_buffer, buffer_size)
; s_is_scanning = true; } } } bt_unlock(); return success; } // ----------------------------------------------------------------------------- bool gap_le_stop_scan(void) { bool success = false; bt_lock(); { if (s_is_scanning) { success = bt_driver_stop_le_scan(); kernel_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...
qspi_use(dev->qspi)
; if (dev->reset_gpio.gpio) { gpio_output_init(&dev->reset_gpio, 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 ...
dler_calls, seq), 0); // Complete B prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_coun...
animation_sequence_create(a, b, NULL)
; cl_assert(seq != NULL); // Create a shorter animation to play in parallel Animation *c = prv_create_test_animation(); cl_assert(c != NULL); animation_set_duration(c, duration_c); Animation *complex = animation_spawn_create(seq, c, NULL); cl_assert(complex != NULL); animation_set_handlers(complex, h...
xt gcontext; FrameBuffer *fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) { DISP_COLS, DISP_ROWS }); graphics_context_init(&gcontext, fb, GContextInitializationMode_App); framebuffer_clear(fb); GFont font = (GFont) { 0 }; GRect box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 20 * HORIZ_ADVANC...
(layout.box.size.w == box.size.w)
; cl_assert_equal_i(layout.max_used_size.w, 5 * HORIZ_ADVANCE_PX); // "JR..." cl_assert_equal_i(layout.max_used_size.h, FONT_HEIGHT); graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper", font, box, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, (void*)&layout); cl_assert(layout.box.size.w ...
le System", FLASH_REGION_FILESYSTEM_BEGIN, FLASH_REGION_FILESYSTEM_END }, }; typedef struct { Window window; SimpleMenuLayer menu_layer; SimpleMenuSection menu_section; SimpleMenuItem menu_items[NUM_MENU_ITEMS]; } FlashDiagAppData; typedef struct { Window window; TextLayer *text_layer; int str...
snprintf(status, sizeof(status), "%d / %d %s", iter, tot, failed ? "Failed Out" : "Complete")
; text_layer_set_text(stress_data.text_layer, (char *)status); } static void app_timer_cb(void *data) { static const int num_stress_iters = 1000; struct Region region = s_flash_regions[2]; PBL_LOG(LOG_LEVEL_INFO, ">>>> %s %d", "Test Loop", stress_data.stress_iteration); PBL_LOG(LOG_LEVEL_INFO, "Erasing 0x%l...
; time_t rtc_get_time(void) { return now; } RtcTicks rtc_get_ticks(void) { return 0; } typedef void (*CallbackEventCallback)(void *data); void launcher_task_add_callback(CallbackEventCallback callback, void *data) { callback(data); } void event_put(PebbleEvent* event) { num_events_put++; } // Stubs /////...
cl_assert_equal_m(&item3.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId))
; cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 200 * 1000); now += 200; stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_...
prv_read_res_table_entry(&res_entry, entry, manifest->num_resources - 1)) { return 0; } // Get the full ending offset of the last resource. uint32_t resource_end_offset = res_entry.offset + res_entry.length; // Add the store's metadata size to the end address of the last resource. uint32_t store_length = ...
if (!entry.impl) { return false; }
prv_get_manifest(&entry, manifest); return true; } ResourceVersion resource_storage_get_version(ResAppNum app_num, uint32_t resource_id) { ResourceManifest manifest; if (!prv_get_manifest_by_id(app_num, resource_id, &manifest)) { return (ResourceVersion) {0}; } return manifest.version; } uint32_t res...
assert(recognizer_handle_touch_event(r, &(TouchEvent) {})); // Should not pass null touch events r->state = RecognizerState_Possible; cl_assert_passert(recognizer_handle_touch_event(r, NULL)); } void test_recognizer__handle_touch_events_fail_after(void) { RecognizerEvent rec_event = -1; RecognizerState new_...
cl_assert(list_contains(list.node, &r2->node))
; cl_assert(r1->is_owned); cl_assert(r2->is_owned); recognizer_remove_from_list(r1, &list); cl_assert(!list_contains(list.node, &r1->node)); cl_assert(!r1->is_owned); recognizer_remove_from_list(r1, &list); cl_assert(!r1->is_owned); } static int s_list_idx = 0; static bool prv_list_iterator(Recognizer ...
#include "stubs_applib_resource.h" #include "stubs_app_state.h" #include "stubs_heap.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_logging.h" // Tests //////////////////////////////////// // Reference PNGs reside in "tests/fw/graph...
(bitmap, TEST_PBI_FILE_FMT(8bit))
); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat8Bit); } // Tests 1-bit all black greyscale PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__greyscale_1_bit_black(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(1bitpalette)); cl_assert(gbitmap...
esult; typedef struct ScanResult { struct ScanResult *next; BTDevice device; int8_t rssi; int8_t tx_power_level; char local_name[32]; bool has_services; bool has_heart_rate_service; Uuid first_service_uuid; } ScanResult; static bool s_is_scanning; //---------------------------------------------------...
(ad_data, result->local_name, sizeof(result->local_name))
}, // setting a page height != enables positioning }, }; render_steps(&layout, RenderMoveTextBox, DELTA, 1000, NULL); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_text_flow__avoid_repeat_text_to_avoid_orphans(void) { TextLayoutExtended layout = { .flow_data = { ...
(&disp_180_frame)
; const int32_t radius = grect_shortest_side(disp_180_frame) / 2 - inset; return perimeter_for_circle(vertical_range, center, radius); } void test_graphics_draw_text_flow__draw_text_doom(void) { // text and configuration we see in text_flow demo app cl_assert(text_resources_init_font(0, RESOURCE_ID_GOTHIC_24_...
lic API void launcher_app_glance_service_draw_glance_for_app_node(LauncherAppGlanceService *service, GContext *ctx, const GRect *frame, bool is_highlighted, AppMenuNode *node) { const bool use_glance_c...
(&service->glance_event_info)
; prv_glance_cache_deinit(service); prv_reset_slice_expiration_timer(service); kino_reel_destroy(service->generic_glance_icon); }
_power_active = false; bool low_power_is_active(void) { return s_low_power_active; } static bool s_dnd_active = false; bool do_not_disturb_is_active(void) { return s_dnd_active; } #define NOTIFICATION_VIBE_HOLDOFF_TICKS 3073024 // Just above 3 seconds // Setup ///////////////////////////////// void test_alerts...
(AlertPhoneCall)
); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertPhoneCall)); s_dnd_active = true; alerts_set_dnd_mask(AlertMaskPhoneCalls); alerts_set_mask(AlertMaskAllOn); cl_assert(alerts_should...
capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 H", time_buf); // June 9th 2015, 14:00:00 (T-02:00:00) rtc_set_time(event_time - (2 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_...
("In 2 minutes", time_buf)
{BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 2, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ct...
(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerBottomRight)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_bottomright.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_aa_corners(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rou...
with blending, given values have to be clipped and adjusted // clip_box and draw_box respecively. T_STATIC void prv_blend_horizontal_line_raw(GContext *ctx, int16_t y, int16_t x1, int16_t x2, GColor color) { PBL_ASSERTN(ctx); GBitmap *framebuffer = &ctx->dest_bitmap; ...
if (x1.integer >= clip_box_min_x) { graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, color, x1.integer, (uint8_t)(FIXED_S16_3_ONE.raw_value - x1.fraction)); }
output++; x1.integer++; // or first AA gradient with blending } else { for (int i = 0; i < left_aa_offset; i++) { // To preserve gradient with clipping: if (x1.integer < clip_box_min_x) { output++; x1.integer++; continue; } if (x1.integer > clip_box_max...
circle_offset_aa_r16_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Medium circles setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_no_clip.${...
graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersTop); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quads_top.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL); g...
extern void graphics_circle_quadrant_draw_stroked_aa( GContext* ctx, GPoint p, uint16_t radius, uint8_t stroke_width, GCornerMask quadrant); void test_graphics_draw_circle_${BIT_DEPTH_NAME}__quadrants_aa(void) { #if SCREEN_COLOR_DEPTH_BITS == 8 GContext ctx; test_graphics_context_init(&ctx, fb); set...
ad_cfm: %u", e); } } static void prv_send_notification(uint16_t conn_idx, uint16_t value_handle) { uint8_t data[READ_RESPONSE_BUFFER_SIZE] = {}; size_t length = 0; if (!prv_get_value(conn_idx, value_handle, data, &length)) { PBL_LOG(LOG_LEVEL_ERROR, "Unexpected handle! %u", value_handle); return; } ...
{ return (att_error_t)PebblePairingServiceGATTError_ConnParamsMinSlotsTooLarge; }
rizontal_line_dotted(&ctx, GPoint(0, 6), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_hor...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 4), 0)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 6), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20);...
at there is no event pending any more: inbox->has_pending_event = false; // Reset counters because the info is communicated to app and it's about to consume the data. inbox->num_failed = 0; inbox->num_success = 0; success = true; } unlock: prv_unlock(); return success; } //! @note Executes ...
prv_unlock()
; return num_messages_lost; } void app_inbox_service_unregister_all(void) { prv_lock(); { AppInboxNode *node = s_app_inbox_head; while (node) { AppInboxNode *next = (AppInboxNode *) node->node.next; kernel_free(node); node = next; } s_app_inbox_head = NULL; } prv_unlock(); }...
d) { #if CAPABILITY_HAS_JAVASCRIPT if (app_md->is_rocky_app) { return APP_STACK_ROCKY_SIZE; } #endif return APP_STACK_NORMAL_SIZE; } T_STATIC MemorySegment prv_get_app_ram_segment(void) { return (MemorySegment) { __APP_RAM__, __APP_RAM_end__ }; } T_STATIC size_t prv_get_stack_guard_size(void) { return (...
(res_bank_num, res_version_ptr)
icationMenuItem) { .draw_cell_fn = prv_draw_regulatory_id_cell, .arg1 = "Canada IC", .arg2 = prv_get_canada_ic_id(), }); } if (flags->has_china_cmiit) { prv_append_certification_menu(cd, &(SystemCertificationMenuItem) { .draw_cell_fn = prv_draw_regulatory_id_cell, .ar...
window_get_user_data(window)
; Layer *window_layer = window_get_root_layer(window); const char *title = "South Korea KCC"; prv_init_status_bar(&data->status_layer, &data->kcc_window, title); GRect window_bounds = window_layer->bounds; // Calculate the bounding rect for the certification content and center it in the window GBitmap *b...
+ 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(...
(&s_started_handler_calls, b)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX)...
eRegAddress) { // For writes, we'll reload with the payload once we send the address. Otherwise, we'd need to // send a repeated start, which we don't want to do. const bool reload = bus->state->transfer.direction == I2CTransferDirection_Write; bus->hal->i2c->CR2 = (bus->state->transfer.device_address &...
if ((i2c->ISR & I2C_ISR_ARLO) != 0) { i2c->ICR |= I2C_ICR_ARLOCF; }
return prv_end_transfer_irq(bus, I2CTransferEvent_Error); } void i2c_hal_event_irq_handler(I2CBus *bus) { portEND_SWITCHING_ISR(prv_event_irq_handler(bus)); } void i2c_hal_error_irq_handler(I2CBus *bus) { portEND_SWITCHING_ISR(prv_error_irq_handler(bus)); }
(data->cur_temp_layer, GColorClear)
; text_layer_set_text_color(data->cur_temp_layer, GColorBlack); layer_add_child(window_layer, text_layer_get_layer(data->cur_temp_layer)); // Current temp range data->temp_range_layer = text_layer_create(TEMP_RANGE_RECT); text_layer_set_text_alignment(data->temp_range_layer, GTextAlignmentCenter); text_lay...
/* * 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_get_subtitle_string(quick_launch_get_app(button), data, subtitle_buf, APP_NAME_SIZE_BYTES)
; } } static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx, const Layer *cell_layer, uint16_t row, bool selected) { QuickLaunchData *data = (QuickLaunchData *)context; PBL_ASSERTN(row < NUM_BUTTONS); const ButtonId button = s_button_order[row]; const char *title =...
/* * 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...
RCC_APB2PeriphResetCmd(ICE40LP->spi.rcc_bit, ENABLE)
; RCC_APB2PeriphResetCmd(ICE40LP->spi.rcc_bit, DISABLE); periph_config_enable(ICE40LP->spi.periph, ICE40LP->spi.rcc_bit); // Configure CR1 first: // * TX-only mode (BIDIMODE | BIDIOE) // * software control NSS pin (SSM | SSI) // * master mode (MSTR) // * clock polarity high / 2nd edge (CPOL | CPHA) ...
cable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "switch_work...
task_zalloc_check(DIALOG_MAX_MESSAGE_LEN)
; sniprintf(msg_buffer, DIALOG_MAX_MESSAGE_LEN, fmt, new_entry.name, old_entry.name); confirmation_dialog_set_click_config_provider(confirmation_dialog, prv_click_config_provider); dialog_set_background_color(dialog, GColorCobaltBlue); dialog_set_text_color(dialog, GColorWhite); dialog_set_text(dialog, msg_...
witch Mode"); break; default: text_layer_set_text(msg_text_layer, "Unknown Test"); break; } text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter); text_layer_set_background_color(msg_text_layer, GColorBlack); text_layer_set_text_color(msg_text_layer, GColorWhite); text_lay...
update_test_case_status(data)
; } else if (data->test_case_status == FLASH_TEST_STATUS_INIT) { data->test_case_status = FLASH_TEST_STATUS_RUNNING; update_test_case_status(data); system_task_add_callback(run_test, NULL); } } static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, (ClickHand...
ff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3328 - 3344 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3344 - 3360 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* bytes 3360 - 3372 */ }; ex...
resource_unwatch(cb_handle)
ight 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, ...
{ PBL_LOG(LOG_LEVEL_WARNING, "Version mismatch on insert! Entry version: %" PRIu8 ", WeatherDB version: %u", entry->version, WEATHER_DB_CURRENT_VERSION); return E_INVALID_ARGUMENT; }
status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return rv; } rv = settings_file_set(&s_weather_db.settings_file, key, key_len, val, val_len); prv_close_file_and_unlock_mutex(); return rv; } int weather_db_get_len(const uint8_t *key, int key_len) { status_t rv = prv_lock_mutex...
failure(bool expect_failure); void command_flash_test_locked_sectors(void) { // write 0's to the entire flash static uint8_t buf[2048] = { 0 }; char status[80]; __disable_irq(); for (int i = 0; i < 2; i++) { for (uint32_t addr = 0; addr < BOARD_NOR_FLASH_SIZE; addr += sizeof(buf)) { if (addr >= F...
(name, sizeof(name), "litter%d", i)
; int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 300); if (i % 5 == 0) { pfs_close_and_remove(fd); } else { pfs_close(fd); } } } #endif #endif static GAPLEConnection *prv_get_le_connection_and_print_info(void) { GAPLEConnection *conn = gap_le_connection_any(); if (!conn) { ...
ime() + 10); // Cancel wakeup event sys_wakeup_delete(wakeup_id); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); // Schedule again wakeup_id = sys_wakeup_schedule(sys_get_time() + 10, 0, false); cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + 10); // Cancel all wakeup...
sys_wakeup_query(first_wakeup_id)
, first_event); TimerID first_timer = wakeup_get_current(); // Schedule another a minute away time_t second_event = sys_get_time() + WAKEUP_EVENT_WINDOW * 2; WakeupId second_wakeup_id = sys_wakeup_schedule(second_event, 0, false); cl_assert_equal_i(sys_wakeup_query(second_wakeup_id), second_event); Timer...
/* * 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...
{ snprintf(text_buffer, sizeof(text_buffer), "Crashing in %d seconds", s_counter); text_layer_set_text(text_layer, text_buffer); }
-> Location #define LAYOUT_MAX_HEIGHT 2500 #define CARD_MARGIN PBL_IF_ROUND_ELSE(12, 10) // All paddings relate to padding 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_HE...
clock_get_since_time(buffer, config->buffer_size, layout->info.item->header.timestamp)
; } #if !PLATFORM_TINTIN static const EmojiEntry s_emoji_table[] = 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) |...
frame = &swap_layer->current->layer.frame; // scroll only the banner when it's the first scroll on a notification if (cur_frame->origin.y == 0) { dy = -INITIAL_SCROLL_PX; } else { dy = (is_repeating) ? -REPEATING_SCROLL_PX : -SCROLL_PX; } } break; } ...
prv_update_status_bar_color(swap_layer)
; } static void prv_swap_layer_reset(SwapLayer *swap_layer) { prv_finish_animation(swap_layer); prv_remove_old_layout(swap_layer, swap_layer->previous); swap_layer->previous = NULL; prv_remove_old_layout(swap_layer, swap_layer->current); swap_layer->current = NULL; prv_remove_old_layout(swap_layer, swap...
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...
text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter)
; text_layer_set_background_color(msg_text_layer, GColorBlack); text_layer_set_text_color(msg_text_layer, GColorWhite); text_layer_set_font(msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); layer_add_child(&window->layer, &msg_text_layer->layer); msg_text_layer = &data->msg_text_layer[1]; te...
= {0}; if (!prv_read_res_table_entry(&res_entry, entry, manifest->num_resources - 1)) { return 0; } // Get the full ending offset of the last resource. uint32_t resource_end_offset = res_entry.offset + res_entry.length; // Add the store's metadata size to the end address of the last resource. uint32_t ...
{ ResourceStoreEntry entry; prv_get_store_entry(app_num, resource_id, &entry); if (!entry.impl) { return false; } prv_get_manifest(&entry, manifest); return true; }
ResourceVersion resource_storage_get_version(ResAppNum app_num, uint32_t resource_id) { ResourceManifest manifest; if (!prv_get_manifest_by_id(app_num, resource_id, &manifest)) { return (ResourceVersion) {0}; } return manifest.version; } uint32_t resource_storage_get_num_entries(ResAppNum app_num, uint32...
/* * 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...
(" 765", NULL, 10)
, 765); cl_assert_equal_i(strtol(" 573888", NULL, 10), 573888); cl_assert_equal_i(strtol(" 713713", NULL, 10), 713713); } void test_strtol__suffix(void) { cl_assert_equal_i(strtol("500hurf", NULL, 10), 500); cl_assert_equal_i(strtol("765berserker", NULL, 10), 765); cl_assert_equal_i(st...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, inset_thickness, 0, TRIG_MAX_ANGLE); }
__profiler_stop(); APP_LOG(APP_LOG_LEVEL_INFO, "360 insets"); __profiler_print_stats(); // 180 degrees, filled in __profiler_start(); for (int i = 0; i < ITERATIONS; ++i) { graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, radius, 0, TRIG_MAX_ANGLE / 2); } __profiler_stop(); APP_LOG(APP...
dler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_han...
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 1); // A should end up at max // A should end high distance = prv_last_update_distance(a); cl_assert_equal_i(distance, ANIMATION_NORMALIZED_MAX); // B should start high distance = prv_last_update_distance(b); cl_assert_equal_i(...
// -------------------------------------------------------------------------------------- // Test cloning complex animation void test_animation__complex_clone(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 200; const int duration_c = 500; const int repeat_count = 5; ...
RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1); graphics_draw_circle(...
(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_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quads_bottom.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx,...
eturn; } void framebuffer_clear(FrameBuffer* f) { return; } void launcher_task_add_callback(void (*callback)(void *data), void *data) { callback(data); } void app_idle_timeout_pause(void) { s_app_idle = true; } void app_idle_timeout_resume(void) { s_app_idle = false; } bool app_install_id_from_app_db(AppIn...
cl_assert_equal_i(window->on_screen, true)
; s_load_count++; } static void prv_window_unload(Window *window) { cl_check(window); cl_assert_equal_i(window->on_screen, false); s_unload_count++; window_destroy(window); } static void prv_push_window_load(Window *window) { prv_window_load(window); Window *new_window = window_create(); window_set_wi...
ic_config.i2s_ck.gpio_pin; GPIO_Init(BOARD_CONFIG.mic_config.i2s_ck.gpio, &GPIO_InitStructure); GPIO_PinAFConfig(BOARD_CONFIG.mic_config.i2s_ck.gpio, BOARD_CONFIG.mic_config.i2s_ck.gpio_pin_source, BOARD_CONFIG.mic_config.i2s_ck.gpio_af); // I2S SD GPIO_InitStructure.GPIO_Pin = BOARD_CONFIG.mic_config.i...
mutex_unlock_recursive(s_mic_mutex)
; return success; } void mic_stop(MicDevice *this) { mutex_lock_recursive(s_mic_mutex); if (!s_running) { goto unlock; } // Disable DMA and I2S dma_request_stop(MIC_I2S_RX_DMA); I2S_Cmd(BOARD_CONFIG.mic_config.spi, DISABLE); // Disable I2S clock periph_config_acquire_lock(); periph_config_d...
map, "draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_ny_descender); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_sing...
(&ctx, fb)