pyb
— functions related to the board¶
The pyb
module contains specific functions related to the board.
Miscellaneous functions¶
-
pyb.
info
([dump_alloc_table])¶ Print out lots of information about the board.
-
pyb.
mount
(device, mountpoint, *, readonly=False, mkfs=False)¶ Mount a block device and make it available as part of the filesystem.
device
must be an object that provides the block protocol:readblocks(self, blocknum, buf)
writeblocks(self, blocknum, buf)
(optional)count(self)
sync(self)
(optional)
readblocks
andwriteblocks
should copy data betweenbuf
and the block device, starting from block numberblocknum
on the device.buf
will be a bytearray with length a multiple of 512. Ifwriteblocks
is not defined then the device is mounted read-only. The return value of these two functions is ignored.count
should return the number of blocks available on the device.sync
, if implemented, should sync the data on the device.The parameter
mountpoint
is the location in the root of the filesystem to mount the device. It must begin with a forward-slash.If
readonly
isTrue
, then the device is mounted read-only, otherwise it is mounted read-write.If
mkfs
isTrue
, then a new filesystem is created if one does not already exist.To unmount a device, pass
None
as the device and the mount location asmountpoint
.
-
pyb.
repl_uart
(uart)¶ Get or set the UART object where the REPL is repeated on.
-
pyb.
rng
()¶ Return a 30-bit hardware generated random number.
-
pyb.
sync
()¶ Sync all file systems.
-
pyb.
unique_id
()¶ Returns a string of 12 bytes (96 bits), which is the unique ID of the MCU.
Classes¶
- class ADC – analog to digital conversion
- class CAN – controller area network communication bus
- class DAC – digital to analog conversion
- class ExtInt – configure I/O pins to interrupt on external events
- class I2C – a two-wire serial protocol
- class LED – LED object
- class Pin – control I/O pins
- class PinAF – Pin Alternate Functions
- class RTC – real time clock
- class Servo – 3-wire hobby servo driver
- class SPI – a master-driven serial protocol
- class Timer – control internal timers
- class TimerChannel — setup a channel for a timer
- class UART – duplex serial communication bus
- class USB_VCP – USB virtual comm port