From 3ac49be7fd8856ee7b3ef79db88706ff127b3d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Tue, 10 Nov 2015 12:28:36 +0100 Subject: [PATCH] add key and use AVR crypto lib. payload format changed --- arduino_nano/main.c | 53 +++++++++++++++++++++++++-------------------- arduino_nano/main.h | 8 ++++++- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/arduino_nano/main.c b/arduino_nano/main.c index c8b14fa..36c3ca0 100644 --- a/arduino_nano/main.c +++ b/arduino_nano/main.c @@ -35,6 +35,11 @@ #include "usart.h" // basic USART functions #include "nrf24.h" // nRF24L01 functions +// AES encryption functions +#include "aes_types.h" +#include "aes128_enc.h" +#include "aes_keyschedule.h" + /* variables */ bool query_pzem004 = false; // flag to query the PZEM-004 power meter volatile uint8_t timer_seconds = 0; // how many seconds have passed @@ -86,6 +91,8 @@ void io_init(void) int main(void) { io_init(); // initialize IOs + uint8_t nrf24_payload[1+4*4] = {0}; // measurement values to be sent: ID byte + encrypted 4x4 float values (voltage, current, power, energy) + nrf24_payload[0] = conf.id; // set ID //printf(PSTR("welcome to the spar counter power meter monitor\n")); @@ -99,7 +106,18 @@ int main(void) for (uint8_t i=0; i