2020-08-03 00:35:43 -04:00
|
|
|
"""Types for the C-level protocols"""
|
|
|
|
|
|
|
|
from typing import Union
|
|
|
|
|
2020-11-27 23:27:15 -05:00
|
|
|
import alarm
|
|
|
|
import alarm.pin
|
|
|
|
import alarm.time
|
2020-08-03 00:35:43 -04:00
|
|
|
import array
|
|
|
|
import audiocore
|
|
|
|
import audiomixer
|
|
|
|
import audiomp3
|
|
|
|
import rgbmatrix
|
2021-07-20 18:23:56 -04:00
|
|
|
import ulab.numpy
|
2020-08-03 00:35:43 -04:00
|
|
|
|
|
|
|
ReadableBuffer = Union[
|
2021-07-20 18:23:56 -04:00
|
|
|
bytes, bytearray, memoryview, array.array, ulab.numpy.ndarray, rgbmatrix.RGBMatrix
|
2020-08-03 00:35:43 -04:00
|
|
|
]
|
|
|
|
"""Classes that implement the readable buffer protocol
|
|
|
|
|
|
|
|
- `bytes`
|
|
|
|
- `bytearray`
|
|
|
|
- `memoryview`
|
|
|
|
- `array.array`
|
2021-07-20 18:23:56 -04:00
|
|
|
- `ulab.numpy.ndarray`
|
2020-08-03 00:35:43 -04:00
|
|
|
- `rgbmatrix.RGBMatrix`
|
|
|
|
"""
|
|
|
|
|
|
|
|
WriteableBuffer = Union[
|
2021-07-20 18:23:56 -04:00
|
|
|
bytearray, memoryview, array.array, ulab.numpy.ndarray, rgbmatrix.RGBMatrix
|
2020-08-03 00:35:43 -04:00
|
|
|
]
|
|
|
|
"""Classes that implement the writeable buffer protocol
|
|
|
|
|
|
|
|
- `bytearray`
|
|
|
|
- `memoryview`
|
|
|
|
- `array.array`
|
2021-07-20 18:23:56 -04:00
|
|
|
- `ulab.numpy.ndarray`
|
2020-08-03 00:35:43 -04:00
|
|
|
- `rgbmatrix.RGBMatrix`
|
|
|
|
"""
|
|
|
|
|
|
|
|
AudioSample = Union[
|
2021-03-19 18:22:00 -04:00
|
|
|
audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer, audiomp3.MP3Decoder, synthio.MidiTrack
|
2020-08-03 00:35:43 -04:00
|
|
|
]
|
|
|
|
"""Classes that implement the audiosample protocol
|
|
|
|
|
|
|
|
- `audiocore.WaveFile`
|
|
|
|
- `audiocore.RawSample`
|
|
|
|
- `audiomixer.Mixer`
|
|
|
|
- `audiomp3.MP3Decoder`
|
2021-03-19 18:22:00 -04:00
|
|
|
- `synthio.MidiTrack`
|
2020-08-03 00:35:43 -04:00
|
|
|
|
|
|
|
You can play these back with `audioio.AudioOut`, `audiobusio.I2SOut` or `audiopwmio.PWMAudioOut`.
|
|
|
|
"""
|
|
|
|
|
|
|
|
FrameBuffer = Union[rgbmatrix.RGBMatrix]
|
|
|
|
"""Classes that implement the framebuffer protocol
|
|
|
|
|
|
|
|
- `rgbmatrix.RGBMatrix`
|
|
|
|
"""
|
2020-10-15 19:59:29 -04:00
|
|
|
|
|
|
|
Alarm = Union[
|
2020-11-26 22:06:37 -05:00
|
|
|
alarm.pin.PinAlarm, alarm.time.TimeAlarm
|
2020-10-15 19:59:29 -04:00
|
|
|
]
|
2020-11-21 23:29:52 -05:00
|
|
|
"""Classes that implement alarms for sleeping and asynchronous notification.
|
2020-10-15 19:59:29 -04:00
|
|
|
|
2020-11-21 23:29:52 -05:00
|
|
|
- `alarm.pin.PinAlarm`
|
2020-11-26 22:06:37 -05:00
|
|
|
- `alarm.time.TimeAlarm`
|
2020-10-15 19:59:29 -04:00
|
|
|
|
2020-11-27 23:27:15 -05:00
|
|
|
You can use these alarms to wake up from light or deep sleep.
|
2020-10-15 19:59:29 -04:00
|
|
|
"""
|