teste de publish
Diff: devices.h
- Revision:
- 19:d52176ff683d
- Parent:
- 17:c046e4b07ded
- Child:
- 24:4d44626e5b78
--- a/devices.h Mon May 07 22:45:07 2018 +0000 +++ b/devices.h Fri May 25 23:45:54 2018 +0000 @@ -7,6 +7,11 @@ #define maxCaractereLeLinha 40 #include <cstdlib> +#define maxAlarms 300 //Parcial de 26 Bytes Total de +#define maxReadings 150 //Parcial de 6 Bytes Total de +#define maxSchedules 200 //Parcial de 8 Bytes Total de +#define maxSchedulesExceptions 50 //Parcial de 12 Bytes Total de + #define enderecoControladoraVirtual 0 enum { @@ -22,6 +27,7 @@ }; typedef struct _alarm{ + //Total de 26 Bytes uint32_t id; //Tempos de confirmação uint32_t seconds; @@ -44,7 +50,8 @@ -typedef struct _reading{ +typedef struct _reading{ + //Total de 6 Bytes uint8_t type; uint8_t addr; uint8_t func; @@ -53,11 +60,13 @@ }reading; typedef struct _scheduleException{ + //Total de 8 Bytes uint32_t id_schedule; uint32_t timestamp; }scheduleException; typedef struct _schedule{ + //Total de 12 Bytes uint32_t id; uint8_t weekday; uint16_t minute; // Minuto do dia em que será executada a ação programada @@ -68,40 +77,31 @@ bool actSent; }schedule; -class device{ - private: - public: - uint8_t execAct(uint32_t); - uint8_t numAlarms; - uint8_t numSchedules; - uint8_t numScheduleExceptions; - uint16_t numReadings; - alarm *alarms; - reading *readings; - schedule *schedules; - scheduleException *scheduleExceptions; - //uint32_t id; - - device(); - - void floatToBin(uint8_t,float *,uint8_t *); - void uint32_t_ToBin(uint8_t,uint32_t *,uint8_t *); - void uint16_t_ToBin(uint8_t,uint16_t *,uint8_t *); - void setAlarm(char *); - void setReading(char *); - void setSchedule(char *); - void setScheduleException(char *); - void verifyAlarms(); - void verifySchedules(); - void writeReadingsToSD(); - void alarmOnOff(uint32_t,bool); -}; + + +extern uint8_t numAlarms; +extern uint8_t numSchedules; +extern uint8_t numScheduleExceptions; +extern uint16_t numReadings; +extern alarm alarms[maxAlarms] __attribute__ ((section("AHBSRAM0"))); +extern reading readings[maxReadings] __attribute__ ((section("AHBSRAM0"))); +extern schedule schedules[maxSchedules] __attribute__ ((section("AHBSRAM0"))); +extern scheduleException scheduleExceptions[maxSchedulesExceptions] __attribute__ ((section("AHBSRAM0"))); +uint8_t execAct(uint32_t); +void floatToBin(uint8_t,float *,uint8_t *); +void uint32_t_ToBin(uint8_t,uint32_t *,uint8_t *); +void uint16_t_ToBin(uint8_t,uint16_t *,uint8_t *); +void setAlarm(char *); +void setReading(char *); +void setSchedule(char *); +void setScheduleException(char *); +void verifyAlarms(); +void verifySchedules(); +void writeReadingsToSD(); +void alarmOnOff(uint32_t,bool); int criaDevices(FILE *); int configuraDevices(FILE *); -//uint8_t resizeArray(uint32_t,uint32_t,char **,uint16_t); void testaTudoDevices(); -void writeReadingsToSD(); -void verifyAlarms(); -void verifySchedules(); + #endif