32
32
from micropython import const
33
33
34
34
try :
35
- from typing import Tuple , Optional , Union
35
+ from typing import Tuple , Optional
36
36
37
37
# This is only needed for typing
38
38
import busio # pylint: disable=unused-import
@@ -394,10 +394,10 @@ def raw_red(self) -> int:
394
394
"""Raw red (650nm) 16-bit value"""
395
395
return self .read_channel (_AS7262_RED )
396
396
397
- def _virtual_read (self , addr : int ) -> Union [ int , float ] :
397
+ def _virtual_read (self , addr : int ) -> float :
398
398
raise NotImplementedError ("Must be implemented." )
399
399
400
- def _virtual_write (self , addr : int , value : Union [ int , float ] ) -> None :
400
+ def _virtual_write (self , addr : int , value : float ) -> None :
401
401
raise NotImplementedError ("Must be implemented." )
402
402
403
403
@@ -460,7 +460,7 @@ def __write_u8(self, command: int, abyte: int) -> None:
460
460
with self .i2c_device as i2c :
461
461
i2c .write (buf )
462
462
463
- def _virtual_read (self , addr : int ) -> Union [ int , float ] :
463
+ def _virtual_read (self , addr : int ) -> float :
464
464
"""read a virtual register"""
465
465
while True :
466
466
# Read slave I2C status to see if the read buffer is ready.
@@ -480,7 +480,7 @@ def _virtual_read(self, addr: int) -> Union[int, float]:
480
480
data = self ._read_u8 (_AS726X_SLAVE_READ_REG )
481
481
return data
482
482
483
- def _virtual_write (self , addr : int , value : Union [ int , float ] ) -> None :
483
+ def _virtual_write (self , addr : int , value : float ) -> None :
484
484
"""write a virtual register"""
485
485
while True :
486
486
# Read slave I2C status to see if the write buffer is ready.
@@ -559,7 +559,7 @@ def _uart_xfer(self, cmd: Optional[str]) -> str:
559
559
return resp .rstrip (b" OK\n " )
560
560
return None
561
561
562
- def _virtual_read (self , addr : int ) -> Union [ int , float ] :
562
+ def _virtual_read (self , addr : int ) -> float :
563
563
if addr == _AS726X_HW_VERSION :
564
564
# just return what is expected
565
565
return 0x40
@@ -582,7 +582,7 @@ def _virtual_read(self, addr: int) -> Union[int, float]:
582
582
resp = resp .decode ().split ("," )
583
583
return float (resp [_COLOR_REGS_CALIBRATED .index (addr )])
584
584
585
- def _virtual_write (self , addr : int , value : Union [ int , float ] ) -> None :
585
+ def _virtual_write (self , addr : int , value : float ) -> None :
586
586
if addr == _AS726X_CONTROL_SETUP :
587
587
# check for reset
588
588
if (value >> 7 ) & 0x01 :
0 commit comments