Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Documentation/components/drivers/special/sensors/ina260.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
======
INA260
======

.. tags:: experimental

I2C driver for the Texas Instruments INA260 current/voltage/power monitor.

.. warning::
This driver only supports polling mode.

Driver Interface
================

The driver registers a character device. Each ``read`` returns one or more
``struct ina260_s`` samples:

.. code-block:: c

#include <nuttx/sensors/ina260.h>

struct ina260_s
{
uint32_t voltage; /* Bus voltage in millivolts */
int32_t current; /* Current in milliamperes (signed) */
uint32_t power; /* Power in milliwatts */
};

Registration
============

Register the driver from board-level code:

.. code-block:: c

#include <nuttx/sensors/ina260.h>

#if defined(CONFIG_SENSORS_INA260)
/* Register INA260 on I2C1 with address 0x40 and default configuration */

ret = ina260_register("/dev/ina260-0", i2c1, 0x40, 0);
if (ret < 0) {
syslog(LOG_ERR, "Failed to register INA260: %d\n", ret);
}

The last argument to ``ina260_register`` is the configuration. Please refer to
the datasheet for more details on the configuration options (table 5).

A software reset is issued during registration before applying the
configuration.

Example
=======

Please refer to ina260 from nuttx-apps for example code.
4 changes: 4 additions & 0 deletions drivers/sensors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ if(CONFIG_SENSORS)
list(APPEND SRCS ina226.c)
endif()

if(CONFIG_SENSORS_INA260)
list(APPEND SRCS ina260.c)
endif()

if(CONFIG_SENSORS_INA3221)
list(APPEND SRCS ina3221.c)
endif()
Expand Down
13 changes: 13 additions & 0 deletions drivers/sensors/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,19 @@ config INA226_I2C_FREQUENCY
default 400000
depends on SENSORS_INA226

config SENSORS_INA260
bool "INA260 current, voltage, and power monitor"
default n
select I2C
---help---
Enable driver support for the Texas Instruments INA260 current,
voltage, and power monitor with integrated shunt resistor.

config INA260_I2C_FREQUENCY
int "INA260 I2C frequency"
default 400000
depends on SENSORS_INA260

config SENSORS_INA3221
bool "INA3221 current and voltage monitor"
default n
Expand Down
4 changes: 4 additions & 0 deletions drivers/sensors/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ ifeq ($(CONFIG_SENSORS_INA226),y)
CSRCS += ina226.c
endif

ifeq ($(CONFIG_SENSORS_INA260),y)
CSRCS += ina260.c
endif

ifeq ($(CONFIG_SENSORS_INA3221),y)
CSRCS += ina3221.c
endif
Expand Down
Loading
Loading