File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 44if you need to use several at once the ScienceLab class provides a convenient
55collection.
66"""
7+ import time
78from typing import Iterable , List
89
910import pslab .protocol as CP
@@ -126,6 +127,17 @@ def reset(self):
126127 self .send_byte (CP .COMMON )
127128 self .send_byte (CP .RESTORE_STANDALONE )
128129
130+ def enter_bootloader (self ):
131+ """Reboot and stay in bootloader mode."""
132+ self .reset ()
133+ self .interface .baudrate = 460800
134+ # The PSLab's RGB LED flashes some colors on boot.
135+ boot_lightshow_time = 0.6
136+ # Wait before sending magic number to make sure UART is initialized.
137+ time .sleep (boot_lightshow_time / 2 )
138+ # PIC24 UART RX buffer is four bytes deep; no need to time it perfectly.
139+ self .write (CP .Integer .pack (0xDECAFBAD ))
140+
129141 def rgb_led (self , colors : List , output : str = "RGB" , order : str = "GRB" ):
130142 """Set shade of a WS2812B RGB LED.
131143
You can’t perform that action at this time.
0 commit comments