upytester.pyboard package¶
Subpackages¶
Submodules¶
upytester.pyboard.exceptions module¶
upytester.pyboard.pyboard module¶
-
class
upytester.pyboard.pyboard.
PyBoard
(serial_number, name=None, comport=None, auto_open=True)¶ Bases:
object
The primary interface to a physical device running the upytester firmware.
Can also be used more passively to mount / unmount file-systems, get the device’s mountpoint (a folder name)
-
DEFAULT_BAUDRATE
= 115200¶
-
READ_CHUNKSIZE
= 1¶
-
READ_TIMEOUT
= 0.1¶
-
RESPONSE_TIMEOUT
= 1¶
-
WRITE_TIMEOUT
= 0.1¶
-
close
()¶
-
comport
¶
-
classmethod
connected_serial_numbers
()¶
-
halt
()¶
-
instruction_list
¶
-
is_closed
¶
-
is_open
¶
-
mountpoint_flash
¶ Directory of mounted on-board flash
-
mountpoint_sd
¶ Directory of mounted SD card
-
open
()¶
-
receive
(timeout=None)¶ Receive object from remote.
If
timeout
is set, and nothing is received,None
is returned aftertimeout
.
-
receive_iter
(timeout=None)¶ Generator for each received object.
- Parameters
timeout (
float
) – Maximum time per iteration, if not set, only received objects will be returned.
-
reset
(hard=False)¶ Soft Reset
A soft reset invokes the
machine_reset()
method by using the onboardupytester
library. Obviously this will only work if there is funcitonalupytester
firmware running on the pyboard’s SD card.Hard Reset
A Ctrl+C character
ext
is sent to simulate aKeyboardInterrupt
exception. Then, assuming a REPL has started on the pyboard, these commands are sent:import pyb pyb.hard_reset()
- Parameters
hard (
bool
) – ifTrue
, a hard reset is performed, soft by default
-
send
(obj)¶ Transmit given object encoded as json :param obj: object to json encode and transmit :type obj: anthing serializable
-
sync_to_flash
(source, **kwargs)¶ Just like
PyBoard.sync_to_sd()
but to Flash (instead of the SD card).
-
sync_to_sd
(source, **kwargs)¶ Synchronise files from the given source to the pyboard’s SD card
- Parameters
source (
str
) – Directory containing files to syncronise _to_ pyboardforce (
bool
) – If True, assertion of the pre-existence of placeholder files will be ignored.dryrun (
bool
) – If True, sync will not be performed, but everything else will be done. Use to manually confirm folder sync if you’re concerned about what it’ll do.quiet (
bool
) – If True process will not print anything to stdout
-
unmount_flash
()¶ Unmount on-board flash
-
unmount_sd
()¶ Unmount SD card
-
Module contents¶
-
class
upytester.pyboard.
PyBoard
(serial_number, name=None, comport=None, auto_open=True)¶ Bases:
object
The primary interface to a physical device running the upytester firmware.
Can also be used more passively to mount / unmount file-systems, get the device’s mountpoint (a folder name)
-
DEFAULT_BAUDRATE
= 115200¶
-
READ_CHUNKSIZE
= 1¶
-
READ_TIMEOUT
= 0.1¶
-
RESPONSE_TIMEOUT
= 1¶
-
WRITE_TIMEOUT
= 0.1¶
-
close
()¶
-
comport
¶
-
classmethod
connected_serial_numbers
()¶
-
halt
()¶
-
instruction_list
¶
-
is_closed
¶
-
is_open
¶
-
mountpoint_flash
¶ Directory of mounted on-board flash
-
mountpoint_sd
¶ Directory of mounted SD card
-
open
()¶
-
receive
(timeout=None)¶ Receive object from remote.
If
timeout
is set, and nothing is received,None
is returned aftertimeout
.
-
receive_iter
(timeout=None)¶ Generator for each received object.
- Parameters
timeout (
float
) – Maximum time per iteration, if not set, only received objects will be returned.
-
reset
(hard=False)¶ Soft Reset
A soft reset invokes the
machine_reset()
method by using the onboardupytester
library. Obviously this will only work if there is funcitonalupytester
firmware running on the pyboard’s SD card.Hard Reset
A Ctrl+C character
ext
is sent to simulate aKeyboardInterrupt
exception. Then, assuming a REPL has started on the pyboard, these commands are sent:import pyb pyb.hard_reset()
- Parameters
hard (
bool
) – ifTrue
, a hard reset is performed, soft by default
-
send
(obj)¶ Transmit given object encoded as json :param obj: object to json encode and transmit :type obj: anthing serializable
-
sync_to_flash
(source, **kwargs)¶ Just like
PyBoard.sync_to_sd()
but to Flash (instead of the SD card).
-
sync_to_sd
(source, **kwargs)¶ Synchronise files from the given source to the pyboard’s SD card
- Parameters
source (
str
) – Directory containing files to syncronise _to_ pyboardforce (
bool
) – If True, assertion of the pre-existence of placeholder files will be ignored.dryrun (
bool
) – If True, sync will not be performed, but everything else will be done. Use to manually confirm folder sync if you’re concerned about what it’ll do.quiet (
bool
) – If True process will not print anything to stdout
-
unmount_flash
()¶ Unmount on-board flash
-
unmount_sd
()¶ Unmount SD card
-