mirror of
https://github.com/lowobservable/coax.git
synced 2026-03-09 20:48:27 +00:00
Implement RESET
This commit is contained in:
@@ -239,9 +239,11 @@ def read_multiple(interface, **kwargs):
|
||||
return _execute_read_command(interface, command_word, 32,
|
||||
validate_response_length=False, **kwargs)
|
||||
|
||||
def reset(interface):
|
||||
def reset(interface, **kwargs):
|
||||
"""Execute a RESET command."""
|
||||
raise NotImplementedError
|
||||
command_word = _pack_command_word(Command.RESET)
|
||||
|
||||
_execute_write_command(interface, command_word, **kwargs)
|
||||
|
||||
def load_control_register(interface, control, **kwargs):
|
||||
"""Execute a LOAD_CONTROL_REGISTER command."""
|
||||
|
||||
28
pycoax/examples/11_reset.py
Executable file
28
pycoax/examples/11_reset.py
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import time
|
||||
from serial import Serial
|
||||
|
||||
sys.path.append('..')
|
||||
|
||||
from coax import Interface1, reset
|
||||
|
||||
print('Opening serial port...')
|
||||
|
||||
with Serial('/dev/ttyUSB0', 115200) as serial:
|
||||
print('Sleeping to allow interface time to wake up...')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
interface = Interface1(serial)
|
||||
|
||||
print('Resetting interface...')
|
||||
|
||||
version = interface.reset()
|
||||
|
||||
print(f'Firmware version is {version}')
|
||||
|
||||
print('RESET...')
|
||||
|
||||
reset(interface)
|
||||
Reference in New Issue
Block a user