@@ -6,130 +6,182 @@ const COMMON_SAMPLING_RATE = 250;
66
77// Type definition for the board configuration
88interface BoardConfig {
9- chords_id : string ;
10- device_name : string ;
11- field_pid : number ;
12- adc_resolution : number ;
13- channel_count : number ;
14- sampling_rate : number ;
15- serial_timeout : number ;
16- baud_Rate : number ;
9+ chords_id : string ;
10+ device_name : string ;
11+ field_pid : number ;
12+ adc_resolution : number ;
13+ channel_count : number ;
14+ sampling_rate : number ;
15+ serial_timeout : number ;
16+ baud_Rate : number ;
1717}
1818
1919// Shared configurations
2020const createBoardConfig = ( {
21- chords_id,
22- device_name,
23- field_pid,
24- adc_resolution,
25- channel_count,
26- sampling_rate = COMMON_SAMPLING_RATE ,
27- serial_timeout = COMMON_TIMEOUT ,
28- baud_Rate = COMMON_BAUD_RATE , // Default value for baud_Rate
29- } : Partial < BoardConfig > & { chords_id : string ; device_name : string ; field_pid : number ; adc_resolution : number ; channel_count : number } ) => {
30- // Validate required parameters
31- if ( ! chords_id || ! device_name || ! field_pid || ! adc_resolution || ! channel_count ) {
32- throw new Error ( 'Missing required board configuration parameters' ) ;
33- }
34-
35- // Validate numeric parameters
36- if ( adc_resolution <= 0 || channel_count <= 0 || sampling_rate <= 0 || serial_timeout <= 0 || baud_Rate <= 0 ) {
37- throw new Error ( 'Invalid numeric parameters in board configuration' ) ;
38- }
39-
40- return {
4121 chords_id,
4222 device_name,
4323 field_pid,
4424 adc_resolution,
4525 channel_count,
46- sampling_rate,
47- serial_timeout,
48- baud_Rate,
49- } ;
26+ sampling_rate = COMMON_SAMPLING_RATE ,
27+ serial_timeout = COMMON_TIMEOUT ,
28+ baud_Rate = COMMON_BAUD_RATE , // Default value for baud_Rate
29+ } : Partial < BoardConfig > & { chords_id : string ; device_name : string ; field_pid : number ; adc_resolution : number ; channel_count : number } ) => {
30+ // Validate required parameters
31+ if ( ! chords_id || ! device_name || ! field_pid || ! adc_resolution || ! channel_count ) {
32+ throw new Error ( 'Missing required board configuration parameters' ) ;
33+ }
34+
35+ // Validate numeric parameters
36+ if ( adc_resolution <= 0 || channel_count <= 0 || sampling_rate <= 0 || serial_timeout <= 0 || baud_Rate <= 0 ) {
37+ throw new Error ( 'Invalid numeric parameters in board configuration' ) ;
38+ }
39+
40+ return {
41+ chords_id,
42+ device_name,
43+ field_pid,
44+ adc_resolution,
45+ channel_count,
46+ sampling_rate,
47+ serial_timeout,
48+ baud_Rate,
49+ } ;
5050} ;
5151
5252export const BoardsList : ReadonlyArray < BoardConfig > = Object . freeze ( [
53- createBoardConfig ( {
54- chords_id : "UNO-R3" ,
55- device_name : "Arduino UNO R3" ,
56- field_pid : 67 ,
57- adc_resolution : 10 ,
58- channel_count : 6 ,
59- } ) ,
60- createBoardConfig ( {
61- chords_id : "NANO-CLONE" ,
62- device_name : "Arduino Nano Clone" ,
63- field_pid : 29987 ,
64- adc_resolution : 10 ,
65- channel_count : 8 ,
66- baud_Rate : 115200 ,
67- } ) ,
68- createBoardConfig ( {
69- chords_id : "NANO-CLONE" ,
70- device_name : "Arduino Nano Clone" ,
71- field_pid : 32832 ,
72- adc_resolution : 10 ,
73- channel_count : 8 ,
74- baud_Rate : 115200 ,
75- } ) ,
76- createBoardConfig ( {
77- chords_id : "GENUINO-UNO" ,
78- device_name : "Genuino UNO" ,
79- field_pid : 579 ,
80- adc_resolution : 10 ,
81- channel_count : 6 ,
82- } ) ,
83- createBoardConfig ( {
84- chords_id : "UNO-R4" ,
85- device_name : "Arduino UNO R4 Minima" ,
86- field_pid : 105 ,
87- adc_resolution : 14 ,
88- channel_count : 6 ,
89- sampling_rate : 500 ,
90- serial_timeout : HIGH_SPEED_TIMEOUT ,
91- } ) ,
92- createBoardConfig ( {
93- chords_id : "UNO-R4" ,
94- device_name : "Arduino UNO R4 Wifi" ,
95- field_pid : 4098 ,
96- adc_resolution : 14 ,
97- channel_count : 6 ,
98- sampling_rate : 500 ,
99- serial_timeout : HIGH_SPEED_TIMEOUT ,
100- } ) ,
101- createBoardConfig ( {
102- chords_id : "UNO-CLONE" ,
103- device_name : "Maker UNO / UNO Clone" ,
104- field_pid : 29987 ,
105- adc_resolution : 10 ,
106- channel_count : 6 ,
107- baud_Rate : 115200 ,
108- } ) ,
109- createBoardConfig ( {
110- chords_id : "UNO-CLONE" ,
111- device_name : "Maker UNO / UNO Clone" ,
112- field_pid : 32832 ,
113- adc_resolution : 10 ,
114- channel_count : 6 ,
115- baud_Rate : 115200 ,
116- } ) ,
117- createBoardConfig ( {
118- chords_id : "RPI-PICO-RP2040" ,
119- device_name : "Raspberry Pi Pico" ,
120- field_pid : 192 ,
121- adc_resolution : 12 ,
122- channel_count : 3 ,
123- sampling_rate : 500 ,
124- serial_timeout : HIGH_SPEED_TIMEOUT ,
125- } ) ,
126- createBoardConfig ( {
127- chords_id : "GIGA-R1" ,
128- device_name : "Arduino GIGA R1" ,
129- field_pid : 614 ,
130- adc_resolution : 16 ,
131- channel_count : 6 ,
132- sampling_rate : 500 ,
133- serial_timeout : HIGH_SPEED_TIMEOUT ,
134- } ) ,
53+ createBoardConfig ( {
54+ chords_id : "UNO-R3" ,
55+ device_name : "Arduino UNO R3" ,
56+ field_pid : 67 ,
57+ adc_resolution : 10 ,
58+ channel_count : 6 ,
59+ baud_Rate : 115200 ,
60+ } ) ,
61+ createBoardConfig ( {
62+ chords_id : "MEGA-2560-R3" ,
63+ device_name : "Arduino MEGA 2560 R3" ,
64+ field_pid : 66 ,
65+ adc_resolution : 10 ,
66+ channel_count : 16 ,
67+ baud_Rate : 115200 ,
68+ } ) ,
69+ createBoardConfig ( {
70+ chords_id : "MEGA-2560-CLONE" ,
71+ device_name : "MEGA 2560 CLONE" ,
72+ field_pid : 29987 ,
73+ adc_resolution : 10 ,
74+ channel_count : 16 ,
75+ baud_Rate : 115200 ,
76+ } ) ,
77+ createBoardConfig ( {
78+ chords_id : "MEGA-2560-CLONE" ,
79+ device_name : "MEGA 2560 CLONE" ,
80+ field_pid : 32832 ,
81+ adc_resolution : 10 ,
82+ channel_count : 16 ,
83+ baud_Rate : 115200 ,
84+ } ) ,
85+ createBoardConfig ( {
86+ chords_id : "NANO-CLONE" ,
87+ device_name : "Arduino Nano Clone" ,
88+ field_pid : 29987 ,
89+ adc_resolution : 10 ,
90+ channel_count : 8 ,
91+ baud_Rate : 115200 ,
92+ } ) ,
93+ createBoardConfig ( {
94+ chords_id : "NANO-CLONE" ,
95+ device_name : "Arduino Nano Clone" ,
96+ field_pid : 32832 ,
97+ adc_resolution : 10 ,
98+ channel_count : 8 ,
99+ baud_Rate : 115200 ,
100+ } ) ,
101+ createBoardConfig ( {
102+ chords_id : "NANO-CLASSIC" ,
103+ device_name : "Arduino NANO Classic" ,
104+ field_pid : 24577 ,
105+ adc_resolution : 10 ,
106+ channel_count : 8 ,
107+ baud_Rate : 115200 ,
108+ } ) ,
109+ createBoardConfig ( {
110+ chords_id : "GENUINO-UNO" ,
111+ device_name : "Genuino UNO" ,
112+ field_pid : 579 ,
113+ adc_resolution : 10 ,
114+ channel_count : 6 ,
115+ baud_Rate : 115200 ,
116+ } ) ,
117+ createBoardConfig ( {
118+ chords_id : "UNO-R4" ,
119+ device_name : "Arduino UNO R4 Minima" ,
120+ field_pid : 105 ,
121+ adc_resolution : 14 ,
122+ channel_count : 6 ,
123+ sampling_rate : 500 ,
124+ serial_timeout : HIGH_SPEED_TIMEOUT ,
125+ } ) ,
126+ createBoardConfig ( {
127+ chords_id : "UNO-R4" ,
128+ device_name : "Arduino UNO R4 Wifi" ,
129+ field_pid : 4098 ,
130+ adc_resolution : 14 ,
131+ channel_count : 6 ,
132+ sampling_rate : 500 ,
133+ serial_timeout : HIGH_SPEED_TIMEOUT ,
134+ } ) ,
135+ createBoardConfig ( {
136+ chords_id : "UNO-CLONE" ,
137+ device_name : "Maker UNO / UNO Clone" ,
138+ field_pid : 29987 ,
139+ adc_resolution : 10 ,
140+ channel_count : 6 ,
141+ baud_Rate : 115200 ,
142+ } ) ,
143+ createBoardConfig ( {
144+ chords_id : "UNO-CLONE" ,
145+ device_name : "Maker UNO / UNO Clone" ,
146+ field_pid : 32832 ,
147+ adc_resolution : 10 ,
148+ channel_count : 6 ,
149+ baud_Rate : 115200 ,
150+ } ) ,
151+ createBoardConfig ( {
152+ chords_id : "RPI-PICO-RP2040" ,
153+ device_name : "Raspberry Pi Pico" ,
154+ field_pid : 192 ,
155+ adc_resolution : 12 ,
156+ channel_count : 3 ,
157+ sampling_rate : 500 ,
158+ serial_timeout : HIGH_SPEED_TIMEOUT ,
159+ } ) ,
160+ createBoardConfig ( {
161+ chords_id : "GIGA-R1" ,
162+ device_name : "Arduino GIGA R1" ,
163+ field_pid : 614 ,
164+ adc_resolution : 16 ,
165+ channel_count : 6 ,
166+ sampling_rate : 500 ,
167+ serial_timeout : HIGH_SPEED_TIMEOUT ,
168+ } ) ,
169+ createBoardConfig ( {
170+ chords_id : "STM32G4-CORE-BOARD" ,
171+ device_name : "STM32G4 Core Board" ,
172+ field_pid : 22336 ,
173+ adc_resolution : 12 ,
174+ channel_count : 16 ,
175+ sampling_rate : 500 ,
176+ serial_timeout : HIGH_SPEED_TIMEOUT ,
177+ } ) ,
178+ createBoardConfig ( {
179+ chords_id : "STM32F4-BLACK-PILL" ,
180+ device_name : "STM32F4 Black Pill" ,
181+ field_pid : 22336 ,
182+ adc_resolution : 12 ,
183+ channel_count : 8 ,
184+ sampling_rate : 500 ,
185+ serial_timeout : HIGH_SPEED_TIMEOUT ,
186+ } ) ,
135187] ) ;
0 commit comments