2828from micropython import const
2929
3030try :
31- from typing import Optional
31+ from typing import Optional , Literal
3232 import circuitpython_typing
3333 import busio
3434except ImportError :
@@ -112,12 +112,12 @@ def version(self) -> str:
112112 return str (self ._buffer [:readlen ], "ascii" )
113113
114114 @property
115- def baudrate (self ) -> int :
115+ def baudrate (self ) -> Literal [ 9600 , 19200 , 38400 , 57600 , 115200 ] :
116116 """Return the currently configured baud rate."""
117117 return self ._uart .baudrate
118118
119119 @baudrate .setter
120- def baudrate (self , baud : int ) -> None :
120+ def baudrate (self , baud : Literal [ 9600 , 19200 , 38400 , 57600 , 115200 ] ) -> None :
121121 """Set the baudrate to 9600, 19200, 38400, 57600, or 115200."""
122122 divider = None
123123 if baud == 9600 :
@@ -184,7 +184,7 @@ def resume_video(self) -> bool:
184184 """
185185 return self ._run_command (_FBUF_CTRL , bytes ([0x1 , _RESUMEFRAME ]), 5 )
186186
187- def read_picture_into (self , buf : bytearray ) -> int :
187+ def read_picture_into (self , buf : circuitpython_typing . WriteableBuffer ) -> int :
188188 """Read the next bytes of frame/picture data into the provided buffer.
189189 Returns the number of bytes written to the buffer (might be less than
190190 the size of the buffer). Buffer MUST be a multiple of 4 and 100 or
@@ -252,7 +252,7 @@ def _run_command(
252252 return True
253253
254254 def _read_response (
255- self , result : circuitpython_typing .ReadableBuffer , numbytes : int
255+ self , result : circuitpython_typing .WriteableBuffer , numbytes : int
256256 ) -> Optional [int ]:
257257 return self ._uart .readinto (memoryview (result )[0 :numbytes ])
258258
@@ -265,7 +265,7 @@ def _verify_response(self, cmd: int) -> bool:
265265 )
266266
267267 def _send_command (
268- self , cmd : int , args : Optional [circuitpython_typing .WriteableBuffer ] = None
268+ self , cmd : int , args : Optional [circuitpython_typing .ReadableBuffer ] = None
269269 ) -> None :
270270 self ._command_header [0 ] = 0x56
271271 self ._command_header [1 ] = _SERIAL
0 commit comments