|
31 | 31 | """
|
32 | 32 | import time
|
33 | 33 | import random
|
34 |
| -import digitalio |
35 | 34 | from micropython import const
|
36 | 35 |
|
37 | 36 |
|
@@ -245,12 +244,11 @@ def __init__(
|
245 | 244 | # Device support SPI mode 0 (polarity & phase = 0) up to a max of 10mhz.
|
246 | 245 | # Set Default Baudrate to 5MHz to avoid problems
|
247 | 246 | self._device = spidev.SPIDevice(spi, cs, baudrate=baudrate, polarity=0, phase=0)
|
248 |
| - # Setup reset as a digital input (default state for reset line according |
249 |
| - # to the datasheet). This line is pulled low as an output quickly to |
250 |
| - # trigger a reset. Note that reset MUST be done like this and set as |
251 |
| - # a high impedence input or else the chip cannot change modes (trust me!). |
| 247 | + # Setup reset as a digital output - initially High |
| 248 | + # This line is pulled low as an output quickly to trigger a reset. |
252 | 249 | self._reset = reset
|
253 |
| - self._reset.switch_to_input(pull=digitalio.Pull.UP) |
| 250 | + # initialize Reset High |
| 251 | + self._reset.switch_to_output(value=True) |
254 | 252 | self.reset()
|
255 | 253 | # No device type check! Catch an error from the very first request and
|
256 | 254 | # throw a nicer message to indicate possible wiring problems.
|
@@ -385,9 +383,9 @@ def _write_u8(self, address, val):
|
385 | 383 | def reset(self):
|
386 | 384 | """Perform a reset of the chip."""
|
387 | 385 | # See section 7.2.2 of the datasheet for reset description.
|
388 |
| - self._reset.switch_to_output(value=False) |
| 386 | + self._reset.value = False # Set Reset Low |
389 | 387 | time.sleep(0.0001) # 100 us
|
390 |
| - self._reset.switch_to_input(pull=digitalio.Pull.UP) |
| 388 | + self._reset.value = True # set Reset High |
391 | 389 | time.sleep(0.005) # 5 ms
|
392 | 390 |
|
393 | 391 | def idle(self):
|
|
0 commit comments