Attempt to fix Dali core 3 compilation (#22214)

This commit is contained in:
Theo Arends 2024-09-29 17:11:13 +02:00
parent 19d3984d6e
commit 5d4230d39b
1 changed files with 18 additions and 6 deletions

View File

@ -78,7 +78,8 @@ struct DALI {
* @param None
* @retval None
*/
void IRAM_ATTR DALI_Tick_Handler(void)
void IRAM_ATTR DALI_Tick_Handler(void);
void DALI_Tick_Handler(void)
{
if (getDaliFlag() == DALI_RECEIVING_DATA)
{
@ -97,7 +98,8 @@ void IRAM_ATTR DALI_Tick_Handler(void)
*/
void enableDaliRxInterrupt() {
Dali->flag = DALI_NO_ACTION;
timerAlarmDisable(Dali->timer);
// timerAlarmDisable(Dali->timer);
timerStop(Dali->timer);
attachInterrupt(Pin(GPIO_DALI_RX), receiveDaliData, FALLING);
}
@ -107,7 +109,8 @@ void enableDaliRxInterrupt() {
* @retval None
*/
void disableRxInterrupt() {
timerAlarmEnable(Dali->timer);
// timerAlarmEnable(Dali->timer);
timerStart(Dali->timer);
detachInterrupt(Pin(GPIO_DALI_RX));
}
@ -383,9 +386,18 @@ void DaliPreInit() {
AddLog(LOG_LEVEL_INFO, PSTR("DLI: Memory allocation error"));
return;
}
Dali->timer = timerBegin(DALI_TIMER, 13, true);
timerAttachInterrupt(Dali->timer, &DALI_Tick_Handler, true);
timerAlarmWrite(Dali->timer, 641, true);
// Dali->timer = timerBegin(DALI_TIMER, 13, true);
Dali->timer = timerBegin(12307692); // 160MHz????? / 13
if (nullptr == Dali->timer) {
AddLog(LOG_LEVEL_INFO, PSTR("DLI: Bad timer init"));
free(Dali);
Dali = nullptr;
return;
}
// timerAttachInterrupt(Dali->timer, &DALI_Tick_Handler, true);
timerAttachInterrupt(Dali->timer, &DALI_Tick_Handler);
// timerAlarmWrite(Dali->timer, 641, true);
timerAlarm(Dali->timer, 641, true, 0);
attachInterrupt(Pin(GPIO_DALI_RX), receiveDaliData, FALLING);
enableDaliRxInterrupt();