|
5 | 5 | #include <ModemInterface.h>
|
6 | 6 |
|
7 | 7 | #if defined(ARDUINO_PORTENTA_C33)
|
8 |
| - #define ON_PIN 32 // P708 (32) is the ON pin |
9 |
| - |
| 8 | + // On the C33 the Serial1 object is already defined, but it does not have hardware flow control |
| 9 | + // mbed allows us to define a UART object with software flow control on given pins |
10 | 10 | // P602/P110/P603/P604 -> Serial1
|
11 |
| - UART Serial1_FC(UART1_TX_PIN, UART1_RX_PIN, 61, 62); |
| 11 | + UART Serial1_FC(UART1_TX_PIN, UART1_RX_PIN, PORTENTA_C33_CTS_PIN, PORTENTA_C33_RTS_PIN); |
12 | 12 |
|
13 | 13 | #ifdef DUMP_AT_COMMANDS
|
14 | 14 | StreamDebugger debugger(Serial1_FC, Serial);
|
15 |
| - __attribute__ ((init_priority (101))) ModemInterface modem(debugger, ON_PIN); |
| 15 | + |
| 16 | + // we need to make sure that the Modem object is initialised before anything else in the sketch to avoid issues with the TinyGSM library |
| 17 | + // the init_priority attribute is used to set the priority of the constructor, the lower the number the higher the priority (101 to 65535) |
| 18 | + // for more information see https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html |
| 19 | + __attribute__ ((init_priority (101))) ModemInterface modem(debugger, PORTENTA_C33_MODEM_ON_PIN); |
16 | 20 | #else
|
17 |
| - __attribute__ ((init_priority (101))) ModemInterface modem(Serial1_FC, ON_PIN); |
| 21 | + __attribute__ ((init_priority (101))) ModemInterface modem(Serial1_FC, PORTENTA_C33_MODEM_ON_PIN); |
18 | 22 | #endif
|
19 | 23 |
|
20 | 24 | #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(CORE_CM4)
|
21 | 25 | #include "pinDefinitions.h"
|
22 |
| - #define ON_PIN PG_3 // PG3 is the ON pin |
23 | 26 |
|
24 | 27 | // P602/P110/P603/P604 -> Serial1
|
25 | 28 | #ifdef DUMP_AT_COMMANDS
|
26 | 29 | StreamDebugger debugger(Serial1, Serial);
|
27 |
| - __attribute__ ((init_priority (101))) ModemInterface modem(debugger, PinNameToIndex(ON_PIN)); |
| 30 | + __attribute__ ((init_priority (101))) ModemInterface modem(debugger, PinNameToIndex(PORTENTA_H7_MODEM_ON_PIN)); |
28 | 31 | #else
|
29 |
| - __attribute__ ((init_priority (101))) ModemInterface modem(Serial1, PinNameToIndex(ON_PIN)); |
| 32 | + __attribute__ ((init_priority (101))) ModemInterface modem(Serial1, PinNameToIndex(PORTENTA_H7_MODEM_ON_PIN)); |
30 | 33 | #endif
|
31 | 34 |
|
32 | 35 | #endif
|
0 commit comments