1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-14 14:33:07 +01:00

intermediate: add iic task

This commit is contained in:
andreas
2023-10-26 11:55:57 +02:00
parent 30facdbf4d
commit 8266fba42a
3 changed files with 88 additions and 2 deletions

27
lib/iictask/GwIicTask.cpp Normal file
View File

@@ -0,0 +1,27 @@
//#ifdef _GWIIC
#include "GwIicTask.h"
#include "GwHardware.h"
#include <Wire.h>
void runIicTask(GwApi *api){
GwLog *logger=api->getLogger();
#ifndef _GWIIC
LOG_DEBUG(GwLog::LOG,"no iic defined, iic task stopped");
vTaskDelete(NULL);
return;
#endif
#ifndef GWIIC_SDA
#define GWIIC_SDA -1
#endif
#ifndef GWIIC_SCL
#define GWIIC_SCL -1
#endif
LOG_DEBUG(GwLog::LOG,"iic task started");
bool rt=Wire.begin(GWIIC_SDA,GWIIC_SCL);
if (! rt){
LOG_DEBUG(GwLog::ERROR,"unable to initialize IIC");
vTaskDelete(NULL);
return;
}
vTaskDelete(NULL);
}
//#endif

5
lib/iictask/GwIicTask.h Normal file
View File

@@ -0,0 +1,5 @@
#ifndef _GWIICTASK
#define _GWIICTASK
#include "GwApi.h"
DECLARE_USERTASK(runIicTask)
#endif