LCOV - code coverage report
Current view: top level - zephyr/dt-bindings/sensor - ina230.h Hit Total Coverage
Test: new.info Lines: 1 36 2.8 %
Date: 2024-12-22 00:14:23

          Line data    Source code
       1           0 : /*
       2             :  * Copyright 2021 The Chromium OS Authors
       3             :  * Copyright (c) 2021 Grinn
       4             :  *
       5             :  * SPDX-License-Identifier: Apache-2.0
       6             :  */
       7             : #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_INA230_H_
       8             : #define ZEPHYR_INCLUDE_DT_BINDINGS_INA230_H_
       9             : 
      10             : #include <zephyr/dt-bindings/dt-util.h>
      11             : 
      12             : /* Mask/Enable bits that asserts the ALERT pin */
      13           0 : #define INA230_SHUNT_VOLTAGE_OVER    BIT(15)
      14           0 : #define INA230_SHUNT_VOLTAGE_UNDER   BIT(14)
      15           0 : #define INA230_BUS_VOLTAGE_OVER      BIT(13)
      16           0 : #define INA230_BUS_VOLTAGE_UNDER     BIT(12)
      17           0 : #define INA230_OVER_LIMIT_POWER      BIT(11)
      18           0 : #define INA230_CONVERSION_READY      BIT(10)
      19           0 : #define INA230_ALERT_FUNCTION_FLAG   BIT(4)
      20           0 : #define INA230_CONVERSION_READY_FLAG BIT(3)
      21           0 : #define INA230_MATH_OVERFLOW_FLAG    BIT(2)
      22           0 : #define INA230_ALERT_POLARITY        BIT(1)
      23           0 : #define INA230_ALERT_LATCH_ENABLE    BIT(0)
      24             : 
      25             : /* Operating Mode */
      26           0 : #define INA230_OPER_MODE_POWER_DOWN             0x00
      27           0 : #define INA230_OPER_MODE_SHUNT_VOLTAGE_TRIG     0x01
      28           0 : #define INA230_OPER_MODE_BUS_VOLTAGE_TRIG       0x02
      29           0 : #define INA230_OPER_MODE_SHUNT_BUS_VOLTAGE_TRIG 0x03
      30           0 : #define INA230_OPER_MODE_SHUNT_VOLTAGE_CONT     0x05
      31           0 : #define INA230_OPER_MODE_BUS_VOLTAGE_CONT       0x06
      32           0 : #define INA230_OPER_MODE_SHUNT_BUS_VOLTAGE_CONT 0x07
      33             : 
      34             : /* Conversion time for bus and shunt in micro-seconds */
      35           0 : #define INA230_CONV_TIME_140  0x00
      36           0 : #define INA230_CONV_TIME_204  0x01
      37           0 : #define INA230_CONV_TIME_332  0x02
      38           0 : #define INA230_CONV_TIME_588  0x03
      39           0 : #define INA230_CONV_TIME_1100 0x04
      40           0 : #define INA230_CONV_TIME_2116 0x05
      41           0 : #define INA230_CONV_TIME_4156 0x06
      42           0 : #define INA230_CONV_TIME_8244 0x07
      43             : 
      44             : /* Averaging Mode */
      45           0 : #define INA230_AVG_MODE_1    0x00
      46           0 : #define INA230_AVG_MODE_4    0x01
      47           0 : #define INA230_AVG_MODE_16   0x02
      48           0 : #define INA230_AVG_MODE_64   0x03
      49           0 : #define INA230_AVG_MODE_128  0x04
      50           0 : #define INA230_AVG_MODE_256  0x05
      51           0 : #define INA230_AVG_MODE_512  0x06
      52           0 : #define INA230_AVG_MODE_1024 0x07
      53             : 
      54             : /**
      55             :  * @brief Macro for creating the INA230 configuration value
      56             :  *
      57             :  * @param mode  Operating mode.
      58             :  * @param svct  Conversion time for shunt voltage.
      59             :  * @param bvct  Conversion time for bus voltage.
      60             :  * @param avg   Averaging mode.
      61             :  */
      62             : #define INA230_CONFIG(mode, \
      63             :                       svct, \
      64             :                       bvct, \
      65           1 :                       avg)  \
      66             :         (((avg) << 9) | ((bvct) << 6) | ((svct) << 3) | (mode))
      67             : 
      68             : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_INA230_H_ */

Generated by: LCOV version 1.14