summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorHierophect <hierophect@gmail.com>2019-07-26 14:06:27 -0400
committerHierophect <hierophect@gmail.com>2019-07-26 14:06:27 -0400
commit90b1701b6cf5bfdd44e02bff6c6fd7c9061111c0 (patch)
treef42aacea15e1e9c5bbc489effce641bc22fa8655 /supervisor
parent45d1c9f02edddae2fd06ef755ca161595f3d026d (diff)
Add CDC REPL access
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/shared/usb/usb.c13
-rw-r--r--supervisor/supervisor.mk1
2 files changed, 8 insertions, 6 deletions
diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c
index bccdca622..cfb39d4bb 100644
--- a/supervisor/shared/usb/usb.c
+++ b/supervisor/shared/usb/usb.c
@@ -34,14 +34,19 @@
#include "tusb.h"
+#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 8
+
// Serial number as hex characters. This writes directly to the USB
// descriptor.
extern uint16_t usb_serial_number[1 + COMMON_HAL_MCU_PROCESSOR_UID_LENGTH * 2];
void load_serial_number(void) {
// create serial number based on device unique id
- uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH] = {1,2,3,4};
+ uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH];
//common_hal_mcu_processor_get_uid(raw_id);
+ for (int i=0; i<2; i++) {
+ ((uint32_t*) raw_id)[i] = 0;
+ }
static const char nibble_to_hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'};
@@ -60,14 +65,10 @@ bool usb_enabled(void) {
void usb_init(void) {
init_usb_hardware();
- //load_serial_number();
+ load_serial_number();
tusb_init();
- while(1) {
- tud_task();
- }
-
#if MICROPY_KBD_EXCEPTION
// Set Ctrl+C as wanted char, tud_cdc_rx_wanted_cb() callback will be invoked when Ctrl+C is received
// This callback always got invoked regardless of mp_interrupt_char value since we only set it once here
diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk
index 2d50e7a8b..42a55243e 100644
--- a/supervisor/supervisor.mk
+++ b/supervisor/supervisor.mk
@@ -78,6 +78,7 @@ else
shared-module/usb_midi/PortIn.c \
shared-module/usb_midi/PortOut.c \
$(BUILD)/autogen_usb_descriptor.c
+
CFLAGS += -DUSB_AVAILABLE
endif