OpenBIC
OpenSource Bridge-IC
ina238.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef __INA238__
18#define __INA238__
19
20#include <stdint.h>
21#include "sensor.h"
22
23typedef struct _ina238_init_arg {
24 bool is_init;
25 // user defined
26 double r_shunt; /* Shunt resistor value. Unit: Ohm. */
27 uint8_t adc_range; /* IN+ and IN–, 0:±163.84 mV, 1:±40.96 mV */
28 uint8_t alert_latch; /*alert_latch, 0:Disable, 1:Enable */
29 double i_max; /* Expected maximum current */
30 // calculated data don't set
31 double cur_lsb;
33
52};
53
55 /* IN+ and IN–, 0:±163.84 mV, 1:±40.96 mV */
58};
59
63};
64#endif
INA238_ALERT_LATCH
Definition: ina238.h:60
@ INA238_ALERT_LATCH_DISABLE
Definition: ina238.h:61
@ INA238_ALERT_LATCH_ENABLE
Definition: ina238.h:62
struct _ina238_init_arg ina238_init_arg
INA238_OFFSET
Definition: ina238.h:34
@ INA238_CUR_OFFSET
Definition: ina238.h:41
@ INA238_SUVL_OFFSET
Definition: ina238.h:45
@ INA238_SOVL_OFFSET
Definition: ina238.h:44
@ INA238_TEMP_LIMIT_OFFSET
Definition: ina238.h:48
@ INA238_BOVL_OFFSET
Definition: ina238.h:46
@ INA238_BUVL_OFFSET
Definition: ina238.h:47
@ INA238_CFG_OFFSET
Definition: ina238.h:35
@ INA238_DIETEMP_OFFSET
Definition: ina238.h:40
@ INA238_ADC_CFG_OFFSET
Definition: ina238.h:36
@ INA238_SHUNT_CAL_OFFSET
Definition: ina238.h:37
@ INA238_VSHUNT_OFFSET
Definition: ina238.h:38
@ INA238_PWR_OFFSET
Definition: ina238.h:42
@ INA238_DIAG_ALRT_OFFSET
Definition: ina238.h:43
@ INA238_MANUFACTURER_ID_OFFSET
Definition: ina238.h:50
@ INA238_PWR_LIMIT_OFFSET
Definition: ina238.h:49
@ INA238_DEVICE_ID_OFFSET
Definition: ina238.h:51
@ INA238_VBUS_OFFSET
Definition: ina238.h:39
INA238_ADC_RANGE
Definition: ina238.h:54
@ INA238_ADC_RANGE_PN_40
Definition: ina238.h:57
@ INA238_ADC_RANGE_PN_163
Definition: ina238.h:56
Definition: ina238.h:23
bool is_init
Definition: ina238.h:24
double i_max
Definition: ina238.h:29
uint8_t adc_range
Definition: ina238.h:27
double r_shunt
Definition: ina238.h:26
uint8_t alert_latch
Definition: ina238.h:28
double cur_lsb
Definition: ina238.h:31