sink struct
This commit is contained in:
parent
9caa23814f
commit
4bf1152175
@ -2,9 +2,6 @@
|
||||
#define _CONFIG_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <spi.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <sha256.h>
|
||||
|
||||
#define CONFIG_MAGIC 0xdead0006
|
||||
|
22
cube/User/Inc/sinkStruct.h
Normal file
22
cube/User/Inc/sinkStruct.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef _SINKSTRUCT_H_
|
||||
#define _SINKSTRUCT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sha256.h>
|
||||
#include <config.h>
|
||||
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
uint64_t timestamp;
|
||||
uint32_t frequency;
|
||||
} t_event;
|
||||
|
||||
#define SECONDS_PER_MINUTE 60
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
char deviceId[sizeof(((t_configBlock*)0)->deviceId)];
|
||||
char location[sizeof(((t_configBlock*)0)->location)];
|
||||
uint8_t hash[SHA256_BLOCK_SIZE];
|
||||
uint8_t done;
|
||||
t_event events[SECONDS_PER_MINUTE];
|
||||
} t_minuteStruct;
|
||||
|
||||
#endif // _SINKSTRUCT_H_
|
@ -10,9 +10,11 @@
|
||||
#include <wizHelper.h>
|
||||
#include <config.h>
|
||||
#include <socket.h>
|
||||
|
||||
#include <sinkStruct.h>
|
||||
#include <sha256.h>
|
||||
|
||||
|
||||
|
||||
const uint32_t COUNTER_FREQUENCY = 1.0e6;
|
||||
|
||||
// 100: 2 digits behind decimal point
|
||||
@ -24,20 +26,6 @@ volatile static uint32_t mainsCntCnt = 0;
|
||||
|
||||
static t_seconds *seconds;
|
||||
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
uint64_t timestamp;
|
||||
uint32_t frequency;
|
||||
} t_event;
|
||||
|
||||
|
||||
#define SECONDS_PER_MINUTE 60
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
char deviceId[sizeof(((t_configBlock*)0)->deviceId)];
|
||||
char location[sizeof(((t_configBlock*)0)->location)];
|
||||
uint8_t hash[SHA256_BLOCK_SIZE];
|
||||
uint8_t done;
|
||||
t_event events[SECONDS_PER_MINUTE];
|
||||
} t_minuteStruct;
|
||||
|
||||
typedef union {
|
||||
t_minuteStruct s;
|
||||
|
Loading…
x
Reference in New Issue
Block a user