File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 13
13
#include < pinDefinitions.h>
14
14
#include < mbed.h>
15
15
16
+ #if __has_include("portenta_info.h")
17
+ #include " portenta_info.h"
18
+ #define TRY_REV2_RECOGNITION
19
+ uint8_t * boardInfo ();
20
+ #define PMC_R2_SKU (24 << 8 | 3 )
21
+ #endif
22
+
16
23
namespace machinecontrol {
17
24
18
25
/* *
@@ -28,6 +35,26 @@ class RTDClass {
28
35
* @param channel (0-2)
29
36
*/
30
37
void selectChannel (int channel) {
38
+
39
+ #ifdef TRY_REV2_RECOGNITION
40
+ // check if OTP data is present AND the board is mounted on a r2 carrier
41
+ auto info = (PortentaBoardInfo*)boardInfo ();
42
+ if (info->magic == 0xB5 && info->carrier == PMC_R2_SKU) {
43
+ // reverse channels 0 and 2
44
+ switch (channel) {
45
+ case 0 :
46
+ channel = 2 ;
47
+ break ;
48
+ case 2 :
49
+ channel = 0 ;
50
+ break ;
51
+ default :
52
+ break ;
53
+ }
54
+ }
55
+ #endif
56
+ #undef TRY_REV2_RECOGNITION
57
+
31
58
for (int i=0 ; i<3 ; i++) {
32
59
ch_sel[i] = (i == channel ? 1 : 0 );
33
60
}
You can’t perform that action at this time.
0 commit comments