CuVoodoo STM32F1 firmware template
sensor_sdm120.h
Go to the documentation of this file.
1 /* This program is free software: you can redistribute it and/or modify
2  * it under the terms of the GNU General Public License as published by
3  * the Free Software Foundation, either version 3 of the License, or
4  * (at your option) any later version.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program. If not, see <http://www.gnu.org/licenses/>.
13  *
14  */
21 #pragma once
22 
24 extern volatile bool sensor_sdm120_measurement_received;
25 
28  SENSOR_SDM120_VOLTAGE = 0,
29  SENSOR_SDM120_CURRENT,
30  SENSOR_SDM120_POWER_ACTIVE,
31  SENSOR_SDM120_POWER_APPARENT,
32  SENSOR_SDM120_POWER_REACTIVE,
33  SENSOR_SDM120_POWER_FACTOR,
34  SENSOR_SDM120_FREQUENCY,
35  SENSOR_SDM120_ENERGY_ACTIVE_IMPORT,
36  SENSOR_SDM120_ENERGY_ACTIVE_EXPORT,
37  SENSOR_SDM120_ENERGY_REACTIVE_IMPORT,
38  SENSOR_SDM120_ENERGY_REACTIVE_EXPORT,
39  SENSOR_SDM120_ENERGY_ACTIVE_TOTAL,
40  SENSOR_SDM120_ENERGY_REACTIVE_TOTAL,
41  SENSOR_SDM120_MEASUREMENT_MAX
42 };
43 
46  SENSOR_SDM120_RELAY_PULSE_WIDTH = 0,
47  SENSOR_SDM120_NETWORK_PARITY_STOP,
48  SENSOR_SDM120_METER_ID,
49  SENSOR_SDM120_BAUD_RATE,
50  SENSOR_SDM120_PULSE_1_OUTPUT_MODE,
51  SENSOR_SDM120_TIME_OF_SCROLL_DISPLAY,
52  SENSOR_SDM120_PULSE_1_OUTPUT,
53  SENSOR_SDM120_MEASUREMENT_MODE,
54  SENSOR_SDM120_CONFIGURATION_MAX
55 };
56 
60 void sensor_sdm120_setup(uint32_t baudrate);
sensor_sdm120_configuration_type_t
configuration types for electricity meter in 4xxx holding registers
Definition: sensor_sdm120.h:45
bool sensor_sdm120_configuration_set(uint8_t meter_id, enum sensor_sdm120_configuration_type_t type, float value)
set configuration in electricity meter
enum sensor_pzem_measurement_type_t type
measurement type
Definition: sensor_pzem.h:39
bool sensor_sdm120_configuration_request(uint8_t meter_id, enum sensor_sdm120_configuration_type_t type)
request configuration from electricity meter
sensor_sdm120_measurement_type_t
measurement types offered by electricity meter in 3xxx input registers
Definition: sensor_sdm120.h:27
float sensor_sdm120_measurement_decode(void)
decode received measurement
void sensor_sdm120_setup(uint32_t baudrate)
setup peripherals to communicate with electricity meter
volatile bool sensor_sdm120_measurement_received
a measurement response has been received
Definition: sensor_sdm120.c:64
union sensor_pzem_measurement_t::measurement_t value
measurement value
bool sensor_sdm120_measurement_request(uint8_t meter_id, enum sensor_sdm120_measurement_type_t type)
request measurement from electricity meter