3
3
4
4
#include " utility/MAX31865/MAX31865.h"
5
5
#include " utility/THERMOCOUPLE/MAX31855.h"
6
+ #ifdef CORE_CM7
6
7
#include < ArduinoRS485.h>
8
+ #endif
7
9
#include " utility/QEI/QEI.h"
8
10
#include " utility/ioexpander/ArduinoIOExpander.h"
9
11
#include " utility/RTC/PCF8563T.h"
@@ -31,9 +33,9 @@ class RTDClass {
31
33
32
34
/* *
33
35
* Select the input channel to be read (3 channels available)
34
- *
36
+ *
35
37
* @param channel (0-2)
36
- */
38
+ */
37
39
void selectChannel (int channel) {
38
40
39
41
#ifdef TRY_REV2_RECOGNITION
@@ -64,17 +66,17 @@ class RTDClass {
64
66
/* *
65
67
* Enable the CS of the Thermocouple to digital converter
66
68
* Disable the CS for the RTD to digital converter
67
- */
69
+ */
68
70
void enableTC () {
69
71
rtd_th = 0 ;
70
72
digitalWrite (PI_0, LOW);
71
73
digitalWrite (PA_6, HIGH);
72
74
}
73
75
74
76
/* *
75
- * Enable the CS of the RDT to digital converter.
77
+ * Enable the CS of the RDT to digital converter.
76
78
* Disable the CS of the Thermocouple to digital converter
77
- */
79
+ */
78
80
void enableRTD () {
79
81
rtd_th = 1 ;
80
82
digitalWrite (PI_0, HIGH);
@@ -83,9 +85,9 @@ class RTDClass {
83
85
}
84
86
85
87
/* *
86
- * Disable Chip select for both RTD and thermocouple digital converters.
87
- *
88
- */
88
+ * Disable Chip select for both RTD and thermocouple digital converters.
89
+ *
90
+ */
89
91
void disableCS () {
90
92
digitalWrite (PI_0, HIGH);
91
93
digitalWrite (PA_6, HIGH);
@@ -102,9 +104,11 @@ class RTDClass {
102
104
extern RTDClass temp_probes;
103
105
104
106
/* *
105
- * The COMMClass is used to initialize the CAN and RS485 LEDs and
106
- * establish the power mode of the CAN bus.
107
+ * The COMMClass is used to initialize the CAN and RS485 LEDs and
108
+ * establish the power mode of the CAN bus.
107
109
*/
110
+
111
+ #ifdef CORE_CM7
108
112
class COMMClass {
109
113
public:
110
114
// to be tested: check if can be made a big pin initialization
@@ -130,7 +134,7 @@ class COMMClass {
130
134
}
131
135
132
136
/* *
133
- * Set the CAN transceiver in Normal mode. In this mode, the transceiver
137
+ * Set the CAN transceiver in Normal mode. In this mode, the transceiver
134
138
* can transmit and receive data via the bus lines CANH and CANL.
135
139
*/
136
140
void enableCAN () {
@@ -170,7 +174,11 @@ class COMMClass {
170
174
private:
171
175
mbed::DigitalOut can_disable = mbed::DigitalOut(PA_13, 0 );
172
176
};
173
-
177
+ #elif defined(CORE_CM4)
178
+ class COMMClass {
179
+ public:
180
+ };
181
+ #endif
174
182
extern COMMClass comm_protocols;
175
183
176
184
#define ch0_in1 ch_in[0 ]
@@ -188,7 +196,7 @@ extern COMMClass comm_protocols;
188
196
189
197
/* *
190
198
* The AnalogInClass is used to set the resistor configuration for the right type of analog sensor
191
- * i.e. NTC sensors, 4-10mA or 0-10V.
199
+ * i.e. NTC sensors, 4-10mA or 0-10V.
192
200
*/
193
201
class AnalogInClass {
194
202
public:
@@ -218,7 +226,7 @@ class AnalogInClass {
218
226
219
227
/* *
220
228
* Configure the input resistor dividers to have a ratio of 0.28.
221
- * Maximum input voltage is 10V.
229
+ * Maximum input voltage is 10V.
222
230
*/
223
231
void set0_10V () {
224
232
ch0_in1 = 1 ;
@@ -238,8 +246,8 @@ class AnalogInClass {
238
246
}
239
247
240
248
/* *
241
- * Enable a 120 ohm resistor to GND to convert the 4-20mA sensor currents to voltage.
242
- * Note: 24V are available from the carrier to power the 4-20mA sensors.
249
+ * Enable a 120 ohm resistor to GND to convert the 4-20mA sensor currents to voltage.
250
+ * Note: 24V are available from the carrier to power the 4-20mA sensors.
243
251
*/
244
252
void set4_20mA () {
245
253
ch0_in1 = 1 ;
@@ -259,8 +267,8 @@ class AnalogInClass {
259
267
}
260
268
261
269
/* *
262
- * Enable a 100K resistor in series with the reference voltage.
263
- * The voltage sampled is the voltage division between the 100k resistor and the input resistor (NTC/PTC)
270
+ * Enable a 100K resistor in series with the reference voltage.
271
+ * The voltage sampled is the voltage division between the 100k resistor and the input resistor (NTC/PTC)
264
272
*/
265
273
void setNTC () {
266
274
ch0_in1 = 0 ;
@@ -290,10 +298,10 @@ class AnalogInClass {
290
298
}
291
299
}
292
300
293
- mbed::DigitalOut ch_in[12 ] = {
301
+ mbed::DigitalOut ch_in[12 ] = {
294
302
mbed::DigitalOut (PD_4), mbed::DigitalOut (PD_5), mbed::DigitalOut (PE_3), mbed::DigitalOut (PG_3),
295
303
mbed::DigitalOut (PD_7), mbed::DigitalOut (PH_6), mbed::DigitalOut (PJ_7), mbed::DigitalOut (PH_15),
296
- mbed::DigitalOut (PH_10), mbed::DigitalOut (PA_4), mbed::DigitalOut (PA_8), mbed::DigitalOut (PC_6)
304
+ mbed::DigitalOut (PH_10), mbed::DigitalOut (PA_4), mbed::DigitalOut (PA_8), mbed::DigitalOut (PC_6)
297
305
};
298
306
299
307
private:
@@ -376,8 +384,8 @@ class AnalogOutClass {
376
384
extern AnalogOutClass analog_out;
377
385
378
386
379
- /*
380
- TODO: writeme
387
+ /*
388
+ TODO: writeme
381
389
Use QEI library for mbed since it implements index pin
382
390
*/
383
391
/* *
@@ -410,7 +418,7 @@ class EncoderClass {
410
418
411
419
extern EncoderClass encoders;
412
420
413
- /*
421
+ /*
414
422
using gpio expander class https://www.i2cdevlib.com/devices/tca6424a#source
415
423
Ask Giampaolo for proper porting
416
424
Expander interrupt is PI_5
@@ -421,32 +429,32 @@ extern EncoderClass encoders;
421
429
422
430
423
431
/* *
424
- * The ProgrammableDIOClass is used to initialize the IOExpanders and configure the
432
+ * The ProgrammableDIOClass is used to initialize the IOExpanders and configure the
425
433
* thermal shutdown mode of the high side switches.
426
434
*/
427
435
class ProgrammableDIOClass : public ArduinoIOExpanderClass {
428
436
public:
429
437
430
438
/* *
431
- * Test connection with the IOExpander and set all the pins to the default mode.
439
+ * Test connection with the IOExpander and set all the pins to the default mode.
432
440
* @return true if OK, false if fault
433
441
*/
434
442
bool init () {
435
443
return begin (IO_ADD);
436
444
}
437
445
438
446
/* *
439
- * Configures the thermal shutdown of the high-side switches (TPS4H160) to operate in latch mode.
440
- * The output latches off when thermal shutdown occurs.
447
+ * Configures the thermal shutdown of the high-side switches (TPS4H160) to operate in latch mode.
448
+ * The output latches off when thermal shutdown occurs.
441
449
*/
442
450
void setLatch () {
443
451
prog_latch_retry = 0 ;
444
452
}
445
453
446
454
/* *
447
- * Configures the thermal shutdown of the high-side switches (TPS4H160) to operate in auto-retry mode.
448
- * The output automatically recovers when TJ < T(SD) – T(hys), but the current is limited to ICL(TSD)
449
- * to avoid repetitive thermal shutdown.
455
+ * Configures the thermal shutdown of the high-side switches (TPS4H160) to operate in auto-retry mode.
456
+ * The output automatically recovers when TJ < T(SD) – T(hys), but the current is limited to ICL(TSD)
457
+ * to avoid repetitive thermal shutdown.
450
458
*/
451
459
void setRetry () {
452
460
prog_latch_retry = 1 ;
@@ -466,7 +474,7 @@ class DigitalOutputsClass {
466
474
public:
467
475
468
476
/* *
469
- * Set all digital outputs at the same time.
477
+ * Set all digital outputs at the same time.
470
478
* @param val 8 bit integer to set all 8 channels. e.g:
471
479
* Set all to HIGH -> val = 255 (0b11111111)
472
480
* Set all to LOW -> val = 0 (0b00000000)
@@ -488,17 +496,17 @@ class DigitalOutputsClass {
488
496
}
489
497
490
498
/* *
491
- * Configures the thermal shutdown of the high-side switches (TPS4H160) to operate in latch mode.
492
- * The output latches off when thermal shutdown occurs.
499
+ * Configures the thermal shutdown of the high-side switches (TPS4H160) to operate in latch mode.
500
+ * The output latches off when thermal shutdown occurs.
493
501
*/
494
502
void setLatch () {
495
503
dig_out_latch_retry = 0 ;
496
504
}
497
505
498
506
/* *
499
- * Configures the thermal shutdown of the high-side switches (TPS4H160) to operate in auto-retry mode.
500
- * The output automatically recovers when TJ < T(SD) – T(hys), but the current is limited to ICL(TSD)
501
- * to avoid repetitive thermal shutdown.
507
+ * Configures the thermal shutdown of the high-side switches (TPS4H160) to operate in auto-retry mode.
508
+ * The output automatically recovers when TJ < T(SD) – T(hys), but the current is limited to ICL(TSD)
509
+ * to avoid repetitive thermal shutdown.
502
510
*/
503
511
void setRetry () {
504
512
dig_out_latch_retry = 1 ;
@@ -519,7 +527,7 @@ extern DigitalOutputsClass digital_outputs;
519
527
class ProgrammableDINClass : public ArduinoIOExpanderClass {
520
528
public:
521
529
/* *
522
- * Test connection with the IOExpander and set all the pins to the default mode.
530
+ * Test connection with the IOExpander and set all the pins to the default mode.
523
531
* @return true if OK, false if fault
524
532
*/
525
533
bool init () {
@@ -530,9 +538,9 @@ class ProgrammableDINClass : public ArduinoIOExpanderClass {
530
538
extern ProgrammableDINClass digital_inputs;
531
539
532
540
/* *
533
- * The RtcControllerClass is a wrapper for the PCF8563TClass() that is used to
541
+ * The RtcControllerClass is a wrapper for the PCF8563TClass() that is used to
534
542
* set and get the time to/from the PCF8563T RTC.
535
- *
543
+ *
536
544
*/
537
545
class RtcControllerClass : public PCF8563TClass {
538
546
public:
@@ -546,31 +554,31 @@ extern RtcControllerClass rtc_controller;
546
554
547
555
/* *
548
556
* The USB Class is used to enable/disable the power of the USBA (Host) and configure
549
- * the callbacks for the different host types (i.e. Keyboard, mouse, storage device etc).
557
+ * the callbacks for the different host types (i.e. Keyboard, mouse, storage device etc).
550
558
*/
551
559
class USBClass {
552
560
public:
553
561
USBClass ()
554
562
: _power{PB_14, 0 }
555
563
, _usbflag{PB_15}
556
564
{};
557
-
565
+
558
566
/* *
559
- * Enable power to USBA VBUS.
567
+ * Enable power to USBA VBUS.
560
568
*/
561
569
void powerEnable () {
562
570
_power = 0 ;
563
571
}
564
572
565
573
/* *
566
- * Disable power to USBA VBUS.
574
+ * Disable power to USBA VBUS.
567
575
*/
568
576
void powerDisable () {
569
577
_power = 1 ;
570
578
}
571
579
572
580
/* *
573
- * Flag to indicate overcurrent, overtemperature, or reverse−voltage conditions on the USBA VBUS.
581
+ * Flag to indicate overcurrent, overtemperature, or reverse−voltage conditions on the USBA VBUS.
574
582
* Active−low open−drain output.
575
583
* @return true if OK, false if fault
576
584
*/
0 commit comments