preparations for upgrade to arduino-espressif v2.x

This commit is contained in:
cyberman54 2022-02-21 10:45:27 +01:00
parent b63f466905
commit 7f6cea2e02
4 changed files with 13 additions and 7 deletions

View File

@ -95,7 +95,7 @@ void start_boot_menu(void) {
// setup watchdog, based on esp32 timer2 interrupt // setup watchdog, based on esp32 timer2 interrupt
wdTimer = timerBegin(0, 80, true); // timer 0, div 80, countup wdTimer = timerBegin(0, 80, true); // timer 0, div 80, countup
timerAttachInterrupt(wdTimer, &watchdog, true); // callback for device reset timerAttachInterrupt(wdTimer, &watchdog, false); // callback for device reset
timerAlarmWrite(wdTimer, BOOTDELAY * 1000000, false); // set time in us timerAlarmWrite(wdTimer, BOOTDELAY * 1000000, false); // set time in us
timerAlarmEnable(wdTimer); // enable watchdog timerAlarmEnable(wdTimer); // enable watchdog

View File

@ -7,9 +7,12 @@ static const char TAG[] = __FILE__;
SemaphoreHandle_t I2Caccess; SemaphoreHandle_t I2Caccess;
void i2c_init(void) { Wire.begin(MY_DISPLAY_SDA, MY_DISPLAY_SCL, 100000); } void i2c_init(void) {
Wire.setPins(MY_DISPLAY_SDA, MY_DISPLAY_SCL);
Wire.begin();
}
void i2c_deinit(void) { Wire.~TwoWire(); } void i2c_deinit(void) { Wire.end(); }
void i2c_scan(void) { void i2c_scan(void) {

View File

@ -1,5 +1,8 @@
// COUNTRY AND PROJECT SPECIFIC DEFINITIONS FOR LMIC STACK // COUNTRY AND PROJECT SPECIFIC DEFINITIONS FOR LMIC STACK
// workaround for arduino-espressif32 v2.0.0 (see isse #714 @ MCCI_LMIC)
#define hal_init LMICHAL_init
// COUNTRY SETTINGS // COUNTRY SETTINGS
// --> please check with you local regulations for ISM band frequency use! // --> please check with you local regulations for ISM band frequency use!

View File

@ -450,7 +450,7 @@ void setup() {
// https://techtutorialsx.com/2017/10/07/esp32-arduino-timer-interrupts/ // https://techtutorialsx.com/2017/10/07/esp32-arduino-timer-interrupts/
// prescaler 80 -> divides 80 MHz CPU freq to 1 MHz, timer 0, count up // prescaler 80 -> divides 80 MHz CPU freq to 1 MHz, timer 0, count up
displayIRQ = timerBegin(0, 80, true); displayIRQ = timerBegin(0, 80, true);
timerAttachInterrupt(displayIRQ, &DisplayIRQ, true); timerAttachInterrupt(displayIRQ, &DisplayIRQ, false);
timerAlarmWrite(displayIRQ, DISPLAYREFRESH_MS * 1000, true); timerAlarmWrite(displayIRQ, DISPLAYREFRESH_MS * 1000, true);
timerAlarmEnable(displayIRQ); timerAlarmEnable(displayIRQ);
#endif #endif
@ -460,7 +460,7 @@ void setup() {
// https://techtutorialsx.com/2017/10/07/esp32-arduino-timer-interrupts/ // https://techtutorialsx.com/2017/10/07/esp32-arduino-timer-interrupts/
// prescaler 80 -> divides 80 MHz CPU freq to 1 MHz, timer 3, count up // prescaler 80 -> divides 80 MHz CPU freq to 1 MHz, timer 3, count up
matrixDisplayIRQ = timerBegin(3, 80, true); matrixDisplayIRQ = timerBegin(3, 80, true);
timerAttachInterrupt(matrixDisplayIRQ, &MatrixDisplayIRQ, true); timerAttachInterrupt(matrixDisplayIRQ, &MatrixDisplayIRQ, false);
timerAlarmWrite(matrixDisplayIRQ, MATRIX_DISPLAY_SCAN_US, true); timerAlarmWrite(matrixDisplayIRQ, MATRIX_DISPLAY_SCAN_US, true);
timerAlarmEnable(matrixDisplayIRQ); timerAlarmEnable(matrixDisplayIRQ);
#endif #endif
@ -480,14 +480,14 @@ void setup() {
cyclicTimer.attach(HOMECYCLE, setCyclicIRQ); cyclicTimer.attach(HOMECYCLE, setCyclicIRQ);
// only if we have a timesource we do timesync // only if we have a timesource we do timesync
#if ((TIME_SYNC_LORAWAN) || (TIME_SYNC_LORASERVER) || (HAS_GPS) || (HAS_RTC)) #if ((HAS_LORA_TIME) || (HAS_GPS) || (HAS_RTC))
#if (defined HAS_IF482 || defined HAS_DCF77) #if (defined HAS_IF482 || defined HAS_DCF77)
ESP_LOGI(TAG, "Starting Clock Controller..."); ESP_LOGI(TAG, "Starting Clock Controller...");
clock_init(); clock_init();
#endif #endif
#if (TIME_SYNC_LORASERVER) || (TIME_SYNC_LORAWAN) #if (HAS_LORA_TIME)
timesync_init(); // create loraserver time sync task timesync_init(); // create loraserver time sync task
#endif #endif