LCOV - code coverage report
Current view: top level - zephyr/drivers/sensor - pzem004t.h Coverage Total Hit
Test: new.info Lines: 0.0 % 3 0
Test Date: 2025-09-05 22:20:39

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2025 Srishtik Bhandarkar
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : #ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_PZEM004T_H_
       8              : #define ZEPHYR_INCLUDE_DRIVERS_SENSOR_PZEM004T_H_
       9              : 
      10              : #include <zephyr/drivers/sensor.h>
      11              : 
      12              : /* PZEM004T specific channels */
      13            0 : enum sensor_channel_pzem004t {
      14              :         /* Energy corresponds to active power accumulated over time.
      15              :          * Units: 1Wh (Watt-hours)
      16              :          */
      17              :         SENSOR_CHAN_PZEM004T_ENERGY = SENSOR_CHAN_PRIV_START,
      18              :         /* Power factor is defined as ratio of real power to apparent power 0.  01 resolution.
      19              :          * Unit: No unit
      20              :          */
      21              :         SENSOR_CHAN_PZEM004T_POWER_FACTOR,
      22              :         /* Alarm status is 0xFF when current active power is greater than power alarm threshold.
      23              :          * 0x00 when current power is less than power alarm threshold.
      24              :          * Unit: No unit
      25              :          */
      26              :         SENSOR_CHAN_PZEM004T_ALARM_STATUS,
      27              :         /* Active Power above which the power alarm threshold is set.
      28              :          * Unit: 1W (Watts)
      29              :          */
      30              :         SENSOR_CHAN_PZEM004T_POWER_ALARM_THRESHOLD,
      31              :         /* Unique Modbus address of each pzem004t device on the modbus. Only use this
      32              :          * to set individual modbus address by connecteing each device individually.
      33              :          */
      34              :         SENSOR_CHAN_PZEM004T_MODBUS_RTU_ADDRESS,
      35              :         /* Channel used to set the Modbus address of pzem004t device for the device instance.
      36              :          * This does not set the modbus address of the device. It is used to set the
      37              :          * modbus address of the device instance only for the driver.
      38              :          */
      39              :         SENSOR_CHAN_PZEM004T_ADDRESS_INST_SET,
      40              :         /* Channel used to reset the Energy counter of the pzem004t sensor. Please enable
      41              :          * the CONFIG_PZEM004T_ENABLE_RESET_ENERGY option in prj.conf in application to
      42              :          * use the channel.
      43              :          */
      44              :         SENSOR_CHAN_PZEM004T_RESET_ENERGY,
      45              : };
      46              : 
      47            0 : enum sensor_attribute_pzem004t {
      48              :         /* Active Power above which the power alarm threshold is set.
      49              :          * Unit: 1W (Watts)
      50              :          */
      51              :         SENSOR_ATTR_PZEM004T_POWER_ALARM_THRESHOLD = SENSOR_ATTR_PRIV_START,
      52              :         /* Unique Modbus address of each pzem004t device on the modbus. Only use this
      53              :          * to set individual modbus address by connecteing each device individually.
      54              :          */
      55              :         SENSOR_ATTR_PZEM004T_MODBUS_RTU_ADDRESS,
      56              :         /* Attribute used to set the Modbus address of pzem004t device for the device instance.
      57              :          * This does not set the modbus address of the device. It is used to set the
      58              :          * modbus address of the device instance only for the driver.
      59              :          */
      60              :         SENSOR_ATTR_PZEM004T_ADDRESS_INST_SET,
      61              :         /* Attribute used to reset the Energy counter of the pzem004t sensor. Please enable
      62              :          * the CONFIG_PZEM004T_ENABLE_RESET_ENERGY option in prj.conf in appplicationtn
      63              :          * use the channel.
      64              :          */
      65              :         SENSOR_ATTR_PZEM004T_RESET_ENERGY,
      66              : };
      67              : 
      68              : #endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_PZEM004T_H_ */
        

Generated by: LCOV version 2.0-1