mirror of https://github.com/arendst/Tasmota.git
Prep ESP32S2
This commit is contained in:
parent
5caaf60c68
commit
91cec3cb46
|
@ -32,18 +32,19 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define boolean bool
|
#define boolean bool
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARDUINO
|
#ifdef ARDUINO
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <time.h> /* struct tm */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Define this if you want library to be verbose
|
// Define this if you want library to be verbose
|
||||||
//#define TI_DEBUG
|
//#define TI_DEBUG
|
||||||
|
|
||||||
// I prefix debug macro to be sure to use specific for THIS library
|
// I prefix debug macro to be sure to use specific for THIS library
|
||||||
// debugging, this should not interfere with main sketch or other
|
// debugging, this should not interfere with main sketch or other
|
||||||
// libraries
|
// libraries
|
||||||
#ifdef TI_DEBUG
|
#ifdef TI_DEBUG
|
||||||
// Tasmota build
|
// Tasmota build
|
||||||
|
@ -82,16 +83,16 @@
|
||||||
|
|
||||||
// Linked list structure containing all values received
|
// Linked list structure containing all values received
|
||||||
typedef struct _ValueList ValueList;
|
typedef struct _ValueList ValueList;
|
||||||
struct _ValueList
|
struct _ValueList
|
||||||
{
|
{
|
||||||
ValueList *next; // next element
|
ValueList *next; // next element
|
||||||
//#ifdef USE_TELEINFO_STANDARD
|
//#ifdef USE_TELEINFO_STANDARD
|
||||||
time_t ts; // TimeStamp of data if any
|
time_t ts; // TimeStamp of data if any
|
||||||
//#endif
|
//#endif
|
||||||
uint8_t checksum;// checksum
|
uint8_t checksum;// checksum
|
||||||
uint8_t flags; // specific flags
|
uint8_t flags; // specific flags
|
||||||
char * name; // LABEL of value name
|
char * name; // LABEL of value name
|
||||||
char * value; // value
|
char * value; // value
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -118,9 +119,9 @@ enum _State_e {
|
||||||
#define TINFO_FLAGS_UPDATED 0x08
|
#define TINFO_FLAGS_UPDATED 0x08
|
||||||
#define TINFO_FLAGS_ALERT 0x80 /* This will generate an alert */
|
#define TINFO_FLAGS_ALERT 0x80 /* This will generate an alert */
|
||||||
|
|
||||||
// Local buffer for one line of teleinfo
|
// Local buffer for one line of teleinfo
|
||||||
// maximum size, I think it should be enought
|
// maximum size, I think it should be enought
|
||||||
#ifdef USE_TELEINFO_STANDARD
|
#ifdef USE_TELEINFO_STANDARD
|
||||||
// Linky and standard mode may have longer lines
|
// Linky and standard mode may have longer lines
|
||||||
#define TINFO_BUFSIZE 128
|
#define TINFO_BUFSIZE 128
|
||||||
#else
|
#else
|
||||||
|
@ -129,10 +130,10 @@ enum _State_e {
|
||||||
|
|
||||||
// Teleinfo start and end of frame characters
|
// Teleinfo start and end of frame characters
|
||||||
#define TINFO_STX 0x02
|
#define TINFO_STX 0x02
|
||||||
#define TINFO_ETX 0x03
|
#define TINFO_ETX 0x03
|
||||||
#define TINFO_HT 0x09
|
#define TINFO_HT 0x09
|
||||||
#define TINFO_SGR '\n' // start of group
|
#define TINFO_SGR '\n' // start of group
|
||||||
#define TINFO_EGR '\r' // End of group
|
#define TINFO_EGR '\r' // End of group
|
||||||
|
|
||||||
typedef void (*_fn_ADPS) (uint8_t);
|
typedef void (*_fn_ADPS) (uint8_t);
|
||||||
typedef void (*_fn_data) (ValueList *, uint8_t);
|
typedef void (*_fn_data) (ValueList *, uint8_t);
|
||||||
|
@ -145,10 +146,10 @@ class TInfo
|
||||||
TInfo();
|
TInfo();
|
||||||
void init(_Mode_e mode = TINFO_MODE_HISTORIQUE);
|
void init(_Mode_e mode = TINFO_MODE_HISTORIQUE);
|
||||||
_State_e process (char c);
|
_State_e process (char c);
|
||||||
void attachADPS(void (*_fn_ADPS)(uint8_t phase));
|
void attachADPS(void (*_fn_ADPS)(uint8_t phase));
|
||||||
void attachData(void (*_fn_data)(ValueList * valueslist, uint8_t state));
|
void attachData(void (*_fn_data)(ValueList * valueslist, uint8_t state));
|
||||||
void attachNewFrame(void (*_fn_new_frame)(ValueList * valueslist));
|
void attachNewFrame(void (*_fn_new_frame)(ValueList * valueslist));
|
||||||
void attachUpdatedFrame(void (*_fn_updated_frame)(ValueList * valueslist));
|
void attachUpdatedFrame(void (*_fn_updated_frame)(ValueList * valueslist));
|
||||||
ValueList * addCustomValue(char * name, char * value, uint8_t * flags);
|
ValueList * addCustomValue(char * name, char * value, uint8_t * flags);
|
||||||
ValueList * getList(void);
|
ValueList * getList(void);
|
||||||
uint8_t valuesDump(void);
|
uint8_t valuesDump(void);
|
||||||
|
|
Loading…
Reference in New Issue