File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1313#include < pinDefinitions.h>
1414#include < mbed.h>
1515
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+
1623namespace machinecontrol {
1724
1825/* *
@@ -28,6 +35,26 @@ class RTDClass {
2835 * @param channel (0-2)
2936 */
3037 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+
3158 for (int i=0 ; i<3 ; i++) {
3259 ch_sel[i] = (i == channel ? 1 : 0 );
3360 }
You can’t perform that action at this time.
0 commit comments