36 lines
1.6 KiB
C
36 lines
1.6 KiB
C
/* 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 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
|
|
};
|
|
|
|
/* spark counter default configuration stored in EEPROM
|
|
* it's corresponds to the configuration structure
|
|
* there is an additional CRC8 iButton/1Wire/Dallas/Maxim checksum
|
|
* the variable order is reversed (avr-gcc behaviour?)
|
|
*/
|
|
uint8_t EEMEM eeprom_crc = 0xf6; // CRC8-ibutton checksum
|
|
struct configuration EEMEM eeprom_default_conf = {{1,'h','o','m','e'},{0,'h','o','m','e'},42,5};
|