aboutsummaryrefslogtreecommitdiff
path: root/arduino_nano/main.h
blob: 1c832f95814384c666d55ff19a77f4869900f1c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
/* Copyright (c) 2015 King Kévin <kingkevin@cuvoodoo.info> */
/* the spark counter transmits electricity measurements over radio
 * the electricity measurements (voltage, current, power, energy) are query everry second from a peacefair PZEM-004 power meter
 * they are then transmitted using an nRF2L01+ transceiver
 */
 
/* spark counter configuration */
struct configuration {
	uint8_t id; // the identity of the node
	uint8_t rx_addr[5]; // nRF24 receiving address
	uint8_t tx_addr[5]; // nRF24 transmit address
	uint8_t channel; // nRF24 channel
	uint8_t request_period; // how many seconds between power meter requests
	uint8_t key[16]; // the AES 128 bits key
	uint8_t iv[16]; // the initialisation vector for CBC encryption
};
struct configuration conf = {1,{1,'h','o','m','e'},{0,'h','o','m','e'},42,5,
	{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff},
	{0xff,0xee,0xdd,0xcc,0xbb,0xaa,0x99,0x88,0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x00}
};