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 4
4
if you need to use several at once the ScienceLab class provides a convenient
5
5
collection.
6
6
"""
7
+ import time
7
8
from typing import Iterable , List
8
9
9
10
import pslab .protocol as CP
@@ -126,6 +127,17 @@ def reset(self):
126
127
self .send_byte (CP .COMMON )
127
128
self .send_byte (CP .RESTORE_STANDALONE )
128
129
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
+
129
141
def rgb_led (self , colors : List , output : str = "RGB" , order : str = "GRB" ):
130
142
"""Set shade of a WS2812B RGB LED.
131
143
You can’t perform that action at this time.
0 commit comments