OpenBIC
OpenSource Bridge-IC
|
#include <stdio.h>
#include <string.h>
#include "ina238.h"
#include "sensor.h"
#include "hal_i2c.h"
#include <logging/log.h>
Macros | |
#define | I2C_RETRY 5 |
#define | MSB_MASK BIT(15) |
#define | ADCRANGE_SET_TO_1 BIT(4) |
#define | SHUNT_CAL_MAX_VAL 0x7FFF |
#define | INTERNAL_FIXED_VALUE 819200000 |
#define | ADCRANGE_1S_1 0x10 |
#define | MAX_CURRENT_LSB 0x80 |
#define | ADCRANGE_0_CONVERSION_FACTOR 0.000005 |
#define | ADCRANGE_1_CONVERSION_FACTOR 0.00000125 |
#define | VBUS_CONVERSION_FACTOR 0.000003125 |
#define | DIETEMP_CONVERSION_FACTOR 0.125 |
Functions | |
LOG_MODULE_REGISTER (dev_ina238) | |
uint8_t | ina238_read (sensor_cfg *cfg, int *reading) |
uint8_t | ina238_init (sensor_cfg *cfg) |
#define ADCRANGE_0_CONVERSION_FACTOR 0.000005 |
#define ADCRANGE_1_CONVERSION_FACTOR 0.00000125 |
#define ADCRANGE_1S_1 0x10 |
#define ADCRANGE_SET_TO_1 BIT(4) |
#define DIETEMP_CONVERSION_FACTOR 0.125 |
#define I2C_RETRY 5 |
#define INTERNAL_FIXED_VALUE 819200000 |
#define MAX_CURRENT_LSB 0x80 |
#define MSB_MASK BIT(15) |
#define SHUNT_CAL_MAX_VAL 0x7FFF |
#define VBUS_CONVERSION_FACTOR 0.000003125 |
uint8_t ina238_init | ( | sensor_cfg * | cfg | ) |
uint8_t ina238_read | ( | sensor_cfg * | cfg, |
int * | reading | ||
) |
LOG_MODULE_REGISTER | ( | dev_ina238 | ) |