2 Commits

Author SHA1 Message Date
kenji 5b3a5beb32 remove device CDC debug 2025-08-17 17:18:27 -04:00
kenji 8a8ec23d87 add diagram and video to README 2025-08-15 09:07:30 -04:00
8 changed files with 20 additions and 13 deletions
+1 -1
View File
@@ -1 +1 @@
/build/**/*
/*/**/*
+2 -2
View File
@@ -15,7 +15,7 @@ target_sources(${PROJECT} PRIVATE
bt_device.c
hid_report.c
main.c
usb_descriptors.c
#usb_descriptors.c
usb_device.c
usb_host.c
)
@@ -38,7 +38,7 @@ target_link_libraries(${PROJECT} PRIVATE
pico_pio_usb
pico_stdlib
tinyusb_board
tinyusb_device
#tinyusb_device
tinyusb_host
tinyusb_pico_pio_usb
)
+5
View File
@@ -4,14 +4,19 @@ This project uses a Raspberry Pi Pico W as a Bluetooth Low Energy adapter for
a wired USB HID input peripheral, allowing it to connect to a host device
over BLE using HID over GATT Profile.
## Setup
[YouTube Video](https://youtu.be/YuHbTrccshw)
### Hardware
You will need the following hardware to make the device:
- Raspberry Pi Pico W
- USB extension cable
![Wiring of USB connectors to Raspberry Pi Pico W](diagram.png)
You will need to cut the USB extension in half and connect the wires from the
female end to the Raspberry Pi Pico W. The default configuration is to attach
the USB's green wire to pin 1/GP0 and USB's white wire to pin 2/GP1. You will
-3
View File
@@ -45,9 +45,6 @@ const uint8_t adv_data_len = sizeof(adv_data);
static void bt_hid_setup(void);
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
//extern uint8_t desc_hid_report[];
//extern uint16_t desc_hid_report_len;
// start BTstack
void btstack_main(void){
bt_hid_setup();
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 511 KiB

+3 -3
View File
@@ -27,7 +27,7 @@ int main(void) {
usb_host_init();
// init and run usb device
usb_device_init();
//usb_device_init();
while (true) {
switch ( get_host_state() ) {
@@ -64,8 +64,8 @@ int main(void) {
break;
}
tuh_task(); // tinyusb host task
tud_task(); // tinyusb device task
tud_cdc_write_flush();
//tud_task(); // tinyusb device task
//tud_cdc_write_flush();
}
return 0;
+2 -1
View File
@@ -39,7 +39,8 @@
#endif
// Enable device stack
#define CFG_TUD_ENABLED 1
//#define CFG_TUD_ENABLED 1
#define CFG_TUD_ENABLED 0
// Enable host stack
#define CFG_TUH_ENABLED 1
+7 -3
View File
@@ -44,18 +44,22 @@ uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_t
// print message to CDC in raw hex
void cdc_print_hex(uint8_t const* msg, uint16_t msg_len) {
char tempbuf[8];
(void) msg;
(void) msg_len;
/*char tempbuf[8];
size_t count;
for (int i=0; i<msg_len; i++) {
count=sprintf(tempbuf, "%02X ", msg[i]);
tud_cdc_write(tempbuf, count);
}
tud_cdc_write_str("\n");
tud_cdc_write_str("\n");*/
}
// print text message to CDC
void cdc_print_str(char const* msg, uint16_t msg_len) {
tud_cdc_write(msg, msg_len);
(void) msg;
(void) msg_len;
//tud_cdc_write(msg, msg_len);
}
void cdc_print_msg(char const* msg) {