adafruit_blinka
- Runtime utility objects for re-implementation of CircuitPython API¶
Author(s): cefn
- class adafruit_blinka.ContextManaged¶
An object that automatically deinitializes hardware with a context manager.
- deinit()¶
Free any hardware used by the object.
- class adafruit_blinka.Enum¶
Object supporting CircuitPython-style of static symbols as seen with Direction.OUTPUT, Pull.UP
- classmethod iteritems()¶
Inspects attributes of the class for instances of the class and returns as key,value pairs mirroring dict#iteritems
- class adafruit_blinka.Lockable¶
An object that must be locked to prevent collisions on a microcontroller resource.
- try_lock()¶
Attempt to grab the lock. Return True on success, False if the lock is already taken.
- unlock()¶
Release the lock so others may use the resource.
- adafruit_blinka.patch_system()¶
Patch modules that may be different due to the platform.
Allows useful indirection to test Pin naming logic by switching platform in testing or provide bootstrapping logic for board identification where auto-detection is not feasible (e.g. multiple ESP8266 boards architecturally identical). Once runtime environment is established, can choose various routes to make available and re-export common modules and operations, depending on platform support
analogio
- Analog input and output control¶
See analogio
in CircuitPython for more details.
Not supported by all boards.
Author(s): Carter Nelson, Melissa LeBlanc-Williams
bitbangio
- Bitbanged bus protocols¶
See bitbangio
in CircuitPython for more details.
Author(s): cefn
- class bitbangio.I2C(scl, sda, frequency=400000)¶
Bitbang/Software I2C implementation
- deinit()¶
Deinitialization
- init(scl, sda, frequency)¶
Initialization
- readfrom_into(address, buffer, start=0, end=None)¶
Read from a device at specified address into a buffer
- scan()¶
Scan for attached devices
- writeto(address, buffer, start=0, end=None, stop=True)¶
Write to a device at specified address from a buffer
- class bitbangio.SPI(clock, MOSI=None, MISO=None)¶
Bitbang/Software SPI implementation
- configure(baudrate=100000, polarity=0, phase=0, bits=8)¶
Update the configuration
- readinto(buf)¶
Read from the SPI device into a buffer
- write(buf)¶
Write to the SPI device
- write_readinto(buffer_out, buffer_in)¶
Write to the SPI device and read from the SPI device into a buffer
board
- Define ids for available pins¶
See board
in CircuitPython for more details.
Author(s): cefn
busio
- Bus protocol support like I2C and SPI¶
See busio
in CircuitPython for more details.
Author(s): cefn
- class busio.I2C(scl, sda, frequency=100000)¶
Busio I2C Class for CircuitPython Compatibility. Used for both MicroPython and Linux.
NOTE: Frequency has no effect on Linux systems. The argument is only there for compatibility.
- deinit()¶
Deinitialization
- init(scl, sda, frequency)¶
Initialization
- readfrom_into(address, buffer, *, start=0, end=None)¶
Read from a device at specified address into a buffer
- scan()¶
Scan for attached devices
- writeto(address, buffer, *, start=0, end=None)¶
Write to a device at specified address from a buffer
- writeto_then_readfrom(address, buffer_out, buffer_in, *, out_start=0, out_end=None, in_start=0, in_end=None, stop=False)¶
“Write to a device at specified address from a buffer then read from a device at specified address into a buffer
- class busio.SPI(clock, MOSI=None, MISO=None)¶
Busio SPI Class for CircuitPython Compatibility. Used for both MicroPython and Linux.
- configure(baudrate=100000, polarity=0, phase=0, bits=8)¶
Update the configuration
- deinit()¶
Deinitialization
- property frequency¶
Return the baud rate if implemented
- readinto(buf, start=0, end=None, write_value=0)¶
Read from the SPI device into a buffer
- write(buf, start=0, end=None)¶
Write to the SPI device
- write_readinto(buffer_out, buffer_in, out_start=0, out_end=None, in_start=0, in_end=None)¶
Write to the SPI device and read from the SPI device into a buffer
- class busio.UART(tx, rx, baudrate=9600, bits=8, parity=None, stop=1, timeout=1000, receiver_buffer_size=64, flow=None)¶
Busio UART Class for CircuitPython Compatibility. Used for MicroPython and a few other non-Linux boards.
- class Parity¶
Parity Enumeration
- deinit()¶
Deinitialization
- read(nbytes=None)¶
Read from the UART
- readinto(buf, nbytes=None)¶
Read from the UART into a buffer
- readline()¶
Read a line of characters up to a newline character from the UART
- write(buf)¶
Write to the UART from a buffer
digitalio
- Digital input and output control (GPIO)¶
See digitalio
in CircuitPython for more details.
Author(s): cefn
- class digitalio.DigitalInOut(pin)¶
DigitalInOut CircuitPython compatibility implementation
- deinit()¶
Deinitialize the Digital Pin
- property direction¶
Get or Set the Digital Pin Direction
- property drive_mode¶
The Digital Pin Drive Mode
- property pull¶
The pin pull direction
- switch_to_input(pull=None)¶
Switch the Digital Pin Mode to Input
- switch_to_output(value=False, drive_mode=digitalio.DriveMode.PUSH_PULL)¶
Switch the Digital Pin Mode to Output
- property value¶
The Digital Pin Value
- class digitalio.Direction¶
Direction Enumeration
- class digitalio.DriveMode¶
Drive Mode Enumeration
- class digitalio.Pull¶
PullUp/PullDown Enumeration
keypad
- Support for scanning keys and key matrices¶
See keypad
in CircuitPython for more details.
Author(s): Melissa LeBlanc-Williams
- class keypad.Event(key_number=0, pressed=True)¶
A key transition event.
- property key_number¶
The key number.
- class keypad.EventQueue(max_events)¶
A queue of
Event
objects, filled by akeypad
scanner such asKeys
orKeyMatrix
.You cannot create an instance of
EventQueue
directly. Each scanner creates an instance when it is created.- clear()¶
Clear any queued key transition events. Also sets
overflowed
toFalse
.
- get()¶
Return the next key transition event. Return
None
if no events are pending.Note that the queue size is limited; see
max_events
in the constructor of a scanner such asKeys
orKeyMatrix
. If a new event arrives when the queue is full, the event is discarded, andoverflowed
is set toTrue
.
- get_into(event)¶
Store the next key transition event in the supplied event, if available, and return
True
. If there are no queued events, do not touchevent
and returnFalse
.The advantage of this method over
get()
is that it does not allocate storage. Instead you can reuse an existingEvent
object.Note that the queue size is limited; see
max_events
in the constructor of a scanner such asKeys
orKeyMatrix
.:return
True
if an event was available and stored,False
if not. :rtype: bool
- keypad_eventqueue_record(key_number, current)¶
Record a new event
- class keypad.KeyMatrix(row_pins, column_pins, columns_to_anodes=True, interval=0.02, max_events=64)¶
Manage a 2D matrix of keys with row and column pins.
- deinit()¶
Stop scanning and release the pins.
- property key_count¶
The number of keys that are being scanned. (read-only)
- reset()¶
Reset the internal state of the scanner to assume that all keys are now released. Any key that is already pressed at the time of this call will therefore immediately cause a new key-pressed event to occur.
- class keypad.Keys(pins, *, value_when_pressed, pull=True, interval=0.02, max_events=64)¶
Manage a set of independent keys.
- deinit()¶
Stop scanning and release the pins.
- property key_count¶
The number of keys that are being scanned. (read-only)
- reset()¶
Reset the internal state of the scanner to assume that all keys are now released. Any key that is already pressed at the time of this call will therefore immediately cause a new key-pressed event to occur.
- class keypad.ShiftRegisterKeys(*, clock, data, latch, value_to_latch=True, key_count, value_when_pressed, interval=0.02, max_events=64)¶
Manage a set of keys attached to an incoming shift register.
- deinit()¶
Stop scanning and release the pins.
- property key_count¶
The number of keys that are being scanned. (read-only)
- reset()¶
Reset the internal state of the scanner to assume that all keys are now released. Any key that is already pressed at the time of this call will therefore immediately cause a new key-pressed event to occur.
microcontroller
- Pin references and cpu functionality¶
Author(s): Melissa LeBlanc-Williams
- microcontroller.delay_us(delay)¶
Sleep for delay usecs.
micropython
- MicroPython Specific Decorator Functions¶
Author(s): cefn
- micropython.asm_thumb(f)¶
User is attempting to use an inline assembler
- micropython.const(x)¶
Emulate making a constant
- micropython.native(f)¶
Emulate making a native
- micropython.viper(f)¶
User is attempting to use a viper code emitter
neopixel_write
- NeoPixel precision timed writing support¶
See neopixel_write
in CircuitPython for more details.
Currently supported on Raspberry Pi only.
Author(s): ladyada
- neopixel_write.neopixel_write(gpio, buf)¶
Write buf out on the given DigitalInOut.
onewireio
- 1-wire bus protocol¶
See onewireio
in CircuitPython for more details.
Author(s): cefn
- class onewireio.OneWire(pin)¶
Stub class for OneWire, which is currently not implemented
- deinit()¶
Deinitialize the OneWire bus and release any hardware resources for reuse.
- read_bit()¶
Read in a bit
- reset()¶
Reset the OneWire bus and read presence
- write_bit(value)¶
Write out a bit based on value.
pulseio
- Pulse Width Modulation input and output control¶
See pulseio
in CircuitPython for more details.
Not supported by all boards.
Author(s): Melissa LeBlanc-Williams
pwmio
- Support for PWM based protocols¶
See pwmio
in CircuitPython for more details.
Not supported by all boards.
Author(s): Melissa LeBlanc-Williams
rainbowio
- Provides the colorwheel()
function¶
See rainbowio
in CircuitPython for more details.
Not supported by all boards.
Author(s): Kattni Rembor, Carter Nelson