28
28
29
29
pid_mapping = {}
30
30
vid_mapping = {
31
- 0x239A : ( "Adafruit" , "M0" ) ,
32
- 0x303A : ( "Espressif" , "S2" ) ,
31
+ 0x239A : "Adafruit" ,
32
+ 0x303A : "Espressif" ,
33
33
}
34
34
35
35
@@ -84,7 +84,6 @@ class CharaChorder(Device):
84
84
85
85
bootloader_mode : bool
86
86
connection : Serial
87
- chipset : Literal ["M0" , "S2" ]
88
87
vendor : Literal ["Adafruit" , "Espressif" ]
89
88
90
89
def __init__ (self , product_id : int , vendor_id : int , port : str ):
@@ -97,7 +96,7 @@ def __init__(self, product_id: int, vendor_id: int, port: str):
97
96
raise UnknownProduct (product_id )
98
97
99
98
if vendor_id in vid_mapping :
100
- self .vendor , self . chipset = vid_mapping [vendor_id ]
99
+ self .vendor = vid_mapping [vendor_id ]
101
100
else :
102
101
raise UnknownVendor (vendor_id )
103
102
@@ -688,6 +687,35 @@ class CharaChorderOne(CharaChorder):
688
687
connected to the system.
689
688
"""
690
689
690
+ chipset : Literal ["M0" ]
691
+
692
+ def __init__ (self , product_id : int , vendor_id : int , port : str ):
693
+ super ().__init__ (product_id , vendor_id , port )
694
+ self .chipset = "M0"
695
+
696
+
697
+ @allowed_product_ids (
698
+ 0x8253 , # S3
699
+ 0x8254 , # S3 - UF2 Bootloader
700
+ )
701
+ class CharaChorderTwo (CharaChorder ):
702
+ """
703
+ Represents a CharaChorderOne device.
704
+
705
+ This class inherits from `charachorder.CharaChorder`.
706
+
707
+ Normally, you wouldn't instantiate this class directly instead use
708
+ `CharaChorderTwo.list_devices()` to get a list of CharaChorderTwo devices
709
+ connected to the system.
710
+ """
711
+
712
+ chipset : Literal ["S3" ]
713
+
714
+ def __init__ (self , product_id : int , vendor_id : int , port : str ):
715
+ super ().__init__ (product_id , vendor_id , port )
716
+ self .bootloader_mode = self .product_id == 0x8254
717
+ self .chipset = "S3"
718
+
691
719
692
720
@allowed_product_ids (
693
721
0x801C , # M0
@@ -705,9 +733,12 @@ class CharaChorderLite(CharaChorder):
705
733
connected to the system.
706
734
"""
707
735
736
+ chipset : Literal ["M0" , "S2" ]
737
+
708
738
def __init__ (self , product_id : int , vendor_id : int , port : str ):
709
739
super ().__init__ (product_id , vendor_id , port )
710
740
self .bootloader_mode = self .product_id == 0x812F
741
+ self .chipset = "M0" if self .product_id == 0x801C else "S2"
711
742
712
743
def is_gui_ctrl_swapped (self ) -> bool :
713
744
return bool (self .get_parameter (0x13 ))
@@ -766,9 +797,12 @@ class CharaChorderX(CharaChorder):
766
797
connected to the system.
767
798
"""
768
799
800
+ chipset : Literal ["S2" ]
801
+
769
802
def __init__ (self , product_id : int , vendor_id : int , port : str ):
770
803
super ().__init__ (product_id , vendor_id , port )
771
804
self .bootloader_mode = self .product_id in (0x818C , 0x818E )
805
+ self .chipset = "S2"
772
806
773
807
774
808
@allowed_product_ids (
@@ -789,6 +823,9 @@ class CharaChorderEngine(CharaChorder):
789
823
devices connected to the system.
790
824
"""
791
825
826
+ chipset : Literal ["S2" ]
827
+
792
828
def __init__ (self , product_id : int , vendor_id : int , port : str ):
793
829
super ().__init__ (product_id , vendor_id , port )
794
830
self .bootloader_mode = self .product_id == 0x818A
831
+ self .chipset = "S2"
0 commit comments