Implementation of max9611 Family Driver. More...
#include <stdint.h>
#include <stdlib.h>
#include "no_os_i2c.h"
#include "no_os_util.h"
#include "no_os_error.h"
#include "no_os_delay.h"
#include "no_os_alloc.h"
#include "max9611.h"
Functions | |
int | max9611_addr_gen (struct max9611_init_param *device_ip, enum max9611_addr_lvls a0, enum max9611_addr_lvls a1) |
Generates slave address based on A1 and A0 pin values. | |
int | max9611_init (struct max9611_dev **device, struct max9611_init_param init_param) |
Initializes the communication peripheral and checks if the device is present. | |
int | max9611_remove (struct max9611_dev *dev) |
Free the resources allocated by max538x_init(). | |
int | max9611_read (struct max9611_dev *dev, uint8_t addr, uint8_t bytes, uint8_t *read_data) |
Reads data from device register (I2C) | |
int | max9611_write (struct max9611_dev *dev, uint8_t addr, uint8_t bytes, uint8_t *write_data) |
Writes data to device register (I2C) | |
int | max9611_reg_update (struct max9611_dev *dev, uint8_t addr, int update_mask, int update_val) |
Update selected I2C register contents. | |
int | max9611_set_mode (struct max9611_dev *dev, enum max9611_mode_conf mode) |
Configures MAX9611 operating mode. | |
int | max9611_get_mode (struct max9611_dev *dev, enum max9611_mode_conf *mode) |
Get the MAX9611 operating mode. | |
int | max9611_set_mux (struct max9611_dev *dev, enum max9611_mux_conf mux) |
Configures the internal MUX settings. | |
int | max9611_get_mux (struct max9611_dev *dev, enum max9611_mux_conf *mux) |
Get the internal MUX settings. | |
int | max9611_shutdown (struct max9611_dev *dev, bool is_shdn) |
Device shutdown or power up. | |
int | max9611_set_lr (struct max9611_dev *dev, bool is_normal) |
Configure LR bit operation. | |
int | max9611_get_lr (struct max9611_dev *dev, bool *lr) |
Get LR bit value. | |
int | max9611_set_delay (struct max9611_dev *dev, enum max9611_delay_time dtime) |
Configures MAX9611 delay time. | |
int | max9611_get_delay (struct max9611_dev *dev, enum max9611_delay_time *dtime) |
Get MAX9611 configured delay time. | |
int | max9611_set_retry (struct max9611_dev *dev, enum max9611_retry_time rtime) |
Configures MAX9611 retry time. | |
int | max9611_get_retry (struct max9611_dev *dev, enum max9611_retry_time *rtime) |
Get MAX9611 configured retry time. | |
int | max9611_get_raw (struct max9611_dev *dev, uint16_t *raw) |
Receive data from ADC (single value only). | |
Implementation of max9611 Family Driver.
Copyright 2023(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
int max9611_addr_gen | ( | struct max9611_init_param * | device_ip, |
enum max9611_addr_lvls | a0, | ||
enum max9611_addr_lvls | a1 ) |
Generates slave address based on A1 and A0 pin values.
device_ip | - init param structure |
a0 | - A0 logic level |
a1 | - A1 logic level |
int max9611_get_delay | ( | struct max9611_dev * | dev, |
enum max9611_delay_time * | dtime ) |
Get MAX9611 configured delay time.
dev | - The device structure. |
dtime | - Pointer to store delay time read |
int max9611_get_lr | ( | struct max9611_dev * | dev, |
bool * | lr ) |
Get LR bit value.
dev | - The device structure. |
lr | - Pointer to store LR bit value |
int max9611_get_mode | ( | struct max9611_dev * | dev, |
enum max9611_mode_conf * | mode ) |
Get the MAX9611 operating mode.
dev | - The device structure. |
mode | - Pointer to store the obtained mode |
int max9611_get_mux | ( | struct max9611_dev * | dev, |
enum max9611_mux_conf * | mux ) |
Get the internal MUX settings.
dev | - The device structure. |
mux | - Pointer to store the obtained mux config |
int max9611_get_raw | ( | struct max9611_dev * | dev, |
uint16_t * | raw ) |
Receive data from ADC (single value only).
dev | - The device structure. |
raw | - Pointer to store the raw 12-bit ADC reading |
int max9611_get_retry | ( | struct max9611_dev * | dev, |
enum max9611_retry_time * | rtime ) |
Get MAX9611 configured retry time.
dev | - The device structure. |
rtime | - Pointer to store retry time read |
int max9611_init | ( | struct max9611_dev ** | device, |
struct max9611_init_param | init_param ) |
Initializes the communication peripheral and checks if the device is present.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int max9611_read | ( | struct max9611_dev * | dev, |
uint8_t | addr, | ||
uint8_t | bytes, | ||
uint8_t * | read_data ) |
Reads data from device register (I2C)
dev | - The device structure. |
addr | - Starting / selected register address. |
bytes | - Number of bytes to read from starting register address |
read_data | - Read data buffer |
int max9611_reg_update | ( | struct max9611_dev * | dev, |
uint8_t | addr, | ||
int | update_mask, | ||
int | update_val ) |
Update selected I2C register contents.
dev | - The device structure. |
addr | - Starting / selected register address. |
update_mask | - Mask to update to selected register bit/s |
update_val | - Value used to update on selected register |
int max9611_remove | ( | struct max9611_dev * | dev | ) |
Free the resources allocated by max538x_init().
dev | - The device structure. |
int max9611_set_delay | ( | struct max9611_dev * | dev, |
enum max9611_delay_time | dtime ) |
Configures MAX9611 delay time.
dev | - The device structure. |
dtime | - Delay option |
int max9611_set_lr | ( | struct max9611_dev * | dev, |
bool | is_normal ) |
Configure LR bit operation.
dev | - The device structure. |
is_normal | - Set true for normal operation. False otherwise (refer to LR bit in data sheet) |
int max9611_set_mode | ( | struct max9611_dev * | dev, |
enum max9611_mode_conf | mode ) |
Configures MAX9611 operating mode.
dev | - The device structure. |
mode | - MODE configuration |
int max9611_set_mux | ( | struct max9611_dev * | dev, |
enum max9611_mux_conf | mux ) |
Configures the internal MUX settings.
dev | - The device structure. |
mux | - MUX configuration |
int max9611_set_retry | ( | struct max9611_dev * | dev, |
enum max9611_retry_time | rtime ) |
Configures MAX9611 retry time.
dev | - The device structure. |
rtime | - Retry time option |
int max9611_shutdown | ( | struct max9611_dev * | dev, |
bool | is_shdn ) |
Device shutdown or power up.
dev | - The device structure. |
is_shdn | - Set to true to shutdown device, false otherwise |
int max9611_write | ( | struct max9611_dev * | dev, |
uint8_t | addr, | ||
uint8_t | bytes, | ||
uint8_t * | write_data ) |
Writes data to device register (I2C)
dev | - The device structure. |
addr | - Starting / selected register address. |
bytes | - Number of bytes to write from starting register address |
write_data | - Write data buffer |