summaryrefslogtreecommitdiff
path: root/shared-bindings/_typing/__init__.pyi
blob: 9a6e963ea5606891dd9647197ebbf9580380a1b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""Types for the C-level protocols"""

from typing import Union

import alarm
import alarm.pin
import alarm.time
import array
import audiocore
import audiomixer
import audiomp3
import rgbmatrix
import ulab

ReadableBuffer = Union[
    bytes, bytearray, memoryview, array.array, ulab.ndarray, rgbmatrix.RGBMatrix
]
"""Classes that implement the readable buffer protocol

  - `bytes`
  - `bytearray`
  - `memoryview`
  - `array.array`
  - `ulab.ndarray`
  - `rgbmatrix.RGBMatrix`
"""

WriteableBuffer = Union[
    bytearray, memoryview, array.array, ulab.ndarray, rgbmatrix.RGBMatrix
]
"""Classes that implement the writeable buffer protocol

  - `bytearray`
  - `memoryview`
  - `array.array`
  - `ulab.ndarray`
  - `rgbmatrix.RGBMatrix`
"""

AudioSample = Union[
    audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer, audiomp3.MP3Decoder
]
"""Classes that implement the audiosample protocol

  - `audiocore.WaveFile`
  - `audiocore.RawSample`
  - `audiomixer.Mixer`
  - `audiomp3.MP3Decoder`

  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`
"""

Alarm = Union[
    alarm.pin.PinAlarm, alarm.time.TimeAlarm
]
"""Classes that implement alarms for sleeping and asynchronous notification.

  - `alarm.pin.PinAlarm`
  - `alarm.time.TimeAlarm`

  You can use these alarms to wake up from light or deep sleep.
"""