Go to the documentation of this file.
43 #define ADM1177_ADDRESS 0x5A
46 #define ADM1177_CMD_V_CONT NO_OS_BIT(0)
47 #define ADM1177_CMD_V_ONCE NO_OS_BIT(1)
48 #define ADM1177_CMD_I_CONT NO_OS_BIT(2)
49 #define ADM1177_CMD_I_ONCE NO_OS_BIT(3)
50 #define ADM1177_CMD_VRANGE NO_OS_BIT(4)
51 #define ADM1177_CMD_STATUS_RD NO_OS_BIT(6)
54 #define ADM1177_REG_ALERT_EN (NO_OS_BIT(7) | 0x1)
55 #define ADM1177_REG_ALERT_TH (NO_OS_BIT(7) | 0x2)
56 #define ADM1177_REG_CONTROL (NO_OS_BIT(7) | 0x3)
59 #define ADM1177_EN_ADC_OC1_MASK NO_OS_BIT(0)
60 #define ADM1177_EN_ADC_OC4_MASK NO_OS_BIT(1)
61 #define ADM1177_EN_HS_ALERT_MASK NO_OS_BIT(2)
62 #define ADM1177_EN_OFF_ALERT_MASK NO_OS_BIT(3)
63 #define ADM1177_CLEAR_MASK NO_OS_BIT(4)
66 #define ADM1177_SWOFF_MASK NO_OS_BIT(0)
69 #define ADM1177_ADC_OC_MASK NO_OS_BIT(0)
70 #define ADM1177_ADC_ALERT_MASK NO_OS_BIT(1)
71 #define ADM1177_HS_OC_MASK NO_OS_BIT(2)
72 #define ADM1177_HS_ALERT_MASK NO_OS_BIT(3)
73 #define ADM1177_OFF_STATUS_MASK NO_OS_BIT(4)
74 #define ADM1177_OFF_ALERT_MASK NO_OS_BIT(5)
77 #define ADM1177_EXT_CMD_MASK NO_OS_BIT(7)
79 #define ADM1177_I_FULLSCALE 105840
80 #define ADM1177_RESOLUTION 4096
81 #define ADM1177_V_FULLSCALE_0 26350
82 #define ADM1177_V_FULLSCALE_1 6650
83 #define ADM1177_R_SENSE 25
117 uint8_t reg_address);
127 uint16_t* conv_voltage,
128 uint16_t* conv_current);
133 uint64_t *voltage_uv);
int adm1177_set_vrange(struct adm1177_dev *device, uint8_t vrange)
Sets the vrange off the ADM1177.
Definition: adm1177.c:100
#define ADM1177_V_FULLSCALE_0
Definition: adm1177.h:81
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:116
Header file for iio_trigger.
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:52
int adm1177_remove(struct adm1177_dev *device)
Free the resources allocated by adm1177_init().
Definition: adm1177.c:79
adm1177_vrange
Definition: adm1177.h:92
adm1177_last_command
Definition: adm1177.h:85
int adm1177_remove(struct adm1177_dev *device)
Free the resources allocated by adm1177_init().
Definition: adm1177.c:79
@ ADM1177_STATUS_EN
Definition: adm1177.h:89
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:113
int adm1177_to_microvolts(struct adm1177_dev *device, uint16_t raw_sample, uint64_t *voltage_uv)
Converts the raw sample from the Readback into uV.
Definition: adm1177.c:295
int adm1177_read_status(struct adm1177_dev *device, uint8_t *status_byte)
Reads the status byte from the ADC if requested and transmits it through the status_byte pointer.
Definition: adm1177.c:173
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:127
struct no_os_i2c_init_param i2c_init
Definition: adm1177.h:104
@ ADM1177_VRANGE_HIGH
Definition: adm1177.h:94
Header file of Delay functions.
enum adm1177_last_command last_command
Definition: adm1177.h:99
int adm1177_read_status(struct adm1177_dev *device, uint8_t *status_byte)
Reads the status byte from the ADC if requested and transmits it through the status_byte pointer.
Definition: adm1177.c:173
Definition: ad9361_util.h:69
int adm1177_write(struct adm1177_dev *device, uint8_t cmd, uint8_t reg_address)
In the write command byte operation, the master device sends a command byte to the slave device.
Definition: adm1177.c:139
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
struct no_os_i2c_desc * i2c_desc
Definition: adm1177.h:98
int adm1177_read_conv(struct adm1177_dev *device, uint16_t *conv_voltage, uint16_t *conv_current)
Gets the voltage/current readback from the ADM1177s I2C ADC, if the device is initialized right and t...
Definition: adm1177.c:206
struct iio_trigger adc_iio_timer_trig_desc
Definition: iio_adc_demo_trig.c:61
int adm1177_to_microampers(uint16_t raw_sample, uint64_t *current_ua)
Converts the raw sample from the Readback into uA.
Definition: adm1177.c:324
int iio_sw_trig_handler(void *trig, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
Handles the write request for trigger_now attribute.
Definition: iio_trigger.c:208
int adm1177_init(struct adm1177_dev **device, struct adm1177_init_param *init_param)
Initializes I2C.
Definition: adm1177.c:50
#define ADM1177_R_SENSE
Definition: adm1177.h:83
int adm1177_to_microvolts(struct adm1177_dev *device, uint16_t raw_sample, uint64_t *voltage_uv)
Converts the raw sample from the Readback into uV.
Definition: adm1177.c:295
const char * name
Definition: iio_types.h:131
#define MILLIVOLT_PER_VOLT
Definition: no_os_units.h:58
#define ADM1177_CMD_I_CONT
Definition: adm1177.h:48
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:110
int adm1177_to_microampers(uint16_t raw_sample, uint64_t *current_ua)
Converts the raw sample from the Readback into uA.
Definition: adm1177.c:324
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
@ ADM1177_VRANGE_LOW
Definition: adm1177.h:93
int adm1177_read_conv(struct adm1177_dev *device, uint16_t *conv_voltage, uint16_t *conv_current)
Gets the voltage/current readback from the ADM1177s I2C ADC, if the device is initialized right and t...
Definition: adm1177.c:206
enum adm1177_vrange vrange
Definition: adm1177.h:100
@ ADM1177_VOLTAGE_EN
Definition: adm1177.h:86
#define ADM1177_V_FULLSCALE_1
Definition: adm1177.h:82
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
#define ADM1177_CMD_V_CONT
Definition: adm1177.h:46
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:190
Header file of I2C Interface.
#define ADM1177_RESOLUTION
Definition: adm1177.h:80
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
#define ADM1177_CMD_V_ONCE
Definition: adm1177.h:47
#define ADM1177_CMD_VRANGE
Definition: adm1177.h:50
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
#define NULL
Definition: wrapper.h:64
Definition: iio_types.h:231
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
#define ADM1177_CMD_I_ONCE
Definition: adm1177.h:49
Header file of ADC Demo iio.
@ ADM1177_VOLTAGE_AND_CURRENT_EN
Definition: adm1177.h:88
#define ADM1177_EXT_CMD_MASK
Definition: adm1177.h:77
int adm1177_write(struct adm1177_dev *device, uint8_t cmd, uint8_t reg_address)
In the write command byte operation, the master device sends a command byte to the slave device.
Definition: adm1177.c:139
@ ADM1177_CURRENT_EN
Definition: adm1177.h:87
struct iio_trigger adc_iio_sw_trig_desc
Definition: iio_adc_demo_trig.c:55
bool is_synchronous
Definition: iio_types.h:234
int adm1177_set_vrange(struct adm1177_dev *device, uint8_t vrange)
Sets the vrange off the ADM1177.
Definition: adm1177.c:100
Header file of utility functions.
int adm1177_init(struct adm1177_dev **device, struct adm1177_init_param *init_param)
Initializes I2C.
Definition: adm1177.c:50
#define ADM1177_I_FULLSCALE
Definition: adm1177.h:79
#define MICROVOLT_PER_VOLT
Definition: no_os_units.h:59
#define MILLIAMPER_PER_AMPER
Definition: no_os_units.h:62
Definition: adm1177.h:103