-
Notifications
You must be signed in to change notification settings - Fork 30
/
boot-cdc-only.py
39 lines (32 loc) · 1.03 KB
/
boot-cdc-only.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# boot.py -- run on boot-up
#
# This is some common initialization that I like to keep around.
import pyb
import micropython
import sys
#pyb.main('main.py') # main script to run after this one
before_mode = pyb.usb_mode()
pyb.usb_mode('CDC') # act as a serial only
after_mode = pyb.usb_mode()
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
def bl():
pyb.bootloader()
def pins():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print('{:10s} {:s}'.format(pin_name, str(pin)))
def af():
for pin_name in dir(pyb.Pin.board):
pin = pyb.Pin(pin_name)
print('{:10s} {:s}'.format(pin_name, str(pin.af_list())))
def init():
if False:
uart = pyb.UART(6,115200)
pyb.repl_uart(uart)
print("REPL is also on UART 6 (Y1=Tx Y2=Rx)")
if False:
bufsize = 100
print("Setting alloc_emergency_exception_buf to", bufsize)
micropython.alloc_emergency_exception_buf(bufsize)
init()