Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Dali.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#ifndef DALI_H
#define DALI_H

#include <arduino.h>
#include "DaliBus.h"
#include "DaliCommands.h"

Expand Down
27 changes: 22 additions & 5 deletions src/DaliBus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@

#include "DaliBus.h"

#include "TimerInterrupt_Generic.h"

#ifdef DALI_TIMER
#if defined(ARDUINO_ARCH_RP2040)
RPI_PICO_Timer timer2(DALI_TIMER);
// Check for MBED-based core vs Philhower core
#if defined(ARDUINO_ARCH_MBED)
MBED_RPI_PICO_Timer timer2(DALI_TIMER);
#else
RPI_PICO_Timer timer2(DALI_TIMER);
#endif
void __isr __time_critical_func(DaliBus_wrapper_pinchangeISR)() { DaliBus.pinchangeISR(); }
#elif defined(ARDUINO_ARCH_ESP32)
ESP32Timer timer2(DALI_TIMER);
Expand Down Expand Up @@ -61,10 +68,20 @@ void DaliBusClass::begin(byte tx_pin, byte rx_pin, bool active_low) {

#ifdef DALI_TIMER
#if defined(ARDUINO_ARCH_RP2040)
timer2.attachInterrupt(2398, [](repeating_timer *t) -> bool {
DaliBus.timerISR();
return true;
});
#if defined(ARDUINO_ARCH_MBED) // Arduino MBED core
int ret = timer2.attachInterrupt(2398, [](unsigned int) {
timer2.restartTimer();
DaliBus.timerISR();
});
if (ret < 0) {
Serial.println("Failed to attach timer interrupt");
}
#else // Philhower core
timer2.attachInterrupt(2398, [](repeating_timer *t) -> bool {
DaliBus.timerISR();
return true;
});
#endif
#elif defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
timer2.attachInterrupt(2398, +[](void * timer) -> bool {
DaliBus.timerISR();
Expand Down
2 changes: 0 additions & 2 deletions src/DaliBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

#include "Arduino.h"

#include "TimerInterrupt_Generic.h"

#ifndef DALI_NO_TIMER
#ifndef DALI_TIMER
#warning DALI_TIMER not set; default will be set (0)
Expand Down