no-OS
|
Header file 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"
Go to the source code of this file.
Classes | |
struct | max9611_dev |
struct | max9611_init_param |
Macros | |
#define | MAX9611_MUX_MASK NO_OS_GENMASK(2, 0) |
#define | MAX9611_MODE_MASK NO_OS_GENMASK(7, 5) |
#define | MAX9611_RAW_DATA_MASK NO_OS_GENMASK(15, 4) |
#define | MAX9611_SHDN_MASK NO_OS_BIT(3) |
#define | MAX9611_LR_MASK NO_OS_BIT(4) |
#define | MAX9611_DTIME_MASK NO_OS_BIT(3) |
#define | MAX9611_RTIME_MASK NO_OS_BIT(2) |
#define | MAX9611_CSA_MSB 0x00 |
#define | MAX9611_CSA_LSB 0x01 |
#define | MAX9611_RSP_MSB 0x02 |
#define | MAX9611_RSP_LSB 0x03 |
#define | MAX9611_OUT_MSB 0x04 |
#define | MAX9611_OUT_LSB 0x05 |
#define | MAX9611_SET_MSB 0x06 |
#define | MAX9611_SET_LSB 0x07 |
#define | MAX9611_TMP_MSB 0x08 |
#define | MAX9611_TMP_LSB 0x09 |
#define | MAX9611_CTR1 0x0A |
#define | MAX9611_CTR2 0x0B |
#define | MAX9611_OUT_OF_BOUNDS 0x0C |
Enumerations | |
enum | max9611_data { MAX9611_DATA_CSA, MAX9611_DATA_RSP, MAX9611_DATA_OUT, MAX9611_DATA_SET, MAX9611_DATA_TMP } |
enum | max9611_addr_lvls { MAX9611_ZERO_VCC, MAX9611_33_VCC, MAX9611_66_VCC, MAX9611_100_VCC } |
enum | max9611_delay_time { MAX9611_1MS, MAX9611_100US } |
enum | max9611_retry_time { MAX9611_50MS, MAX9611_10MS } |
enum | max9611_mux_conf { MAX9611_CONF_SENSE_1X, MAX9611_CONF_SENSE_4X, MAX9611_CONF_SENSE_8X, MAX9611_CONF_IN_COM_MODE, MAX9611_CONF_OUT_ADC, MAX9611_CONF_SET_ADC, MAX9611_CONF_TEMP, MAX9611_FAST_MODE } |
enum | max9611_mode_conf { MAX9611_NORMAL_MODE = 0x0, MAX9611_OPAMP_MODE = 0x3, MAX9611_COMPARATOR_MODE = 0x7 } |
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. More... | |
int | max9611_init (struct max9611_dev **device, struct max9611_init_param init_param) |
Initializes the communication peripheral and checks if the device is present. More... | |
int | max9611_remove (struct max9611_dev *dev) |
Free the resources allocated by max538x_init(). More... | |
int | max9611_read (struct max9611_dev *dev, uint8_t addr, uint8_t bytes, uint8_t *read_data) |
Reads data from device register (I2C) More... | |
int | max9611_write (struct max9611_dev *dev, uint8_t addr, uint8_t bytes, uint8_t *write_data) |
Writes data to device register (I2C) More... | |
int | max9611_reg_update (struct max9611_dev *dev, uint8_t addr, int update_mask, int update_val) |
Update selected I2C register contents. More... | |
int | max9611_set_mode (struct max9611_dev *dev, enum max9611_mode_conf mode) |
Configures MAX9611 operating mode. More... | |
int | max9611_get_mode (struct max9611_dev *dev, enum max9611_mode_conf *mode) |
Get the MAX9611 operating mode. More... | |
int | max9611_set_mux (struct max9611_dev *dev, enum max9611_mux_conf mux) |
Configures the internal MUX settings. More... | |
int | max9611_get_mux (struct max9611_dev *dev, enum max9611_mux_conf *mux) |
Get the internal MUX settings. More... | |
int | max9611_shutdown (struct max9611_dev *dev, bool is_shdn) |
Device shutdown or power up. More... | |
int | max9611_set_lr (struct max9611_dev *dev, bool is_normal) |
Configure LR bit operation. More... | |
int | max9611_get_lr (struct max9611_dev *dev, bool *lr) |
Get LR bit value. More... | |
int | max9611_set_delay (struct max9611_dev *dev, enum max9611_delay_time dtime) |
Configures MAX9611 delay time. More... | |
int | max9611_get_delay (struct max9611_dev *dev, enum max9611_delay_time *dtime) |
Get MAX9611 configured delay time. More... | |
int | max9611_set_retry (struct max9611_dev *dev, enum max9611_retry_time rtime) |
Configures MAX9611 retry time. More... | |
int | max9611_get_retry (struct max9611_dev *dev, enum max9611_retry_time *rtime) |
Get MAX9611 configured retry time. More... | |
int | max9611_get_raw (struct max9611_dev *dev, uint16_t *raw) |
Receive data from ADC (single value only). More... | |
Header file 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.
#define MAX9611_CSA_LSB 0x01 |
#define MAX9611_CSA_MSB 0x00 |
#define MAX9611_CTR1 0x0A |
#define MAX9611_CTR2 0x0B |
#define MAX9611_DTIME_MASK NO_OS_BIT(3) |
#define MAX9611_LR_MASK NO_OS_BIT(4) |
#define MAX9611_MODE_MASK NO_OS_GENMASK(7, 5) |
#define MAX9611_MUX_MASK NO_OS_GENMASK(2, 0) |
#define MAX9611_OUT_LSB 0x05 |
#define MAX9611_OUT_MSB 0x04 |
#define MAX9611_OUT_OF_BOUNDS 0x0C |
#define MAX9611_RAW_DATA_MASK NO_OS_GENMASK(15, 4) |
#define MAX9611_RSP_LSB 0x03 |
#define MAX9611_RSP_MSB 0x02 |
#define MAX9611_RTIME_MASK NO_OS_BIT(2) |
#define MAX9611_SET_LSB 0x07 |
#define MAX9611_SET_MSB 0x06 |
#define MAX9611_SHDN_MASK NO_OS_BIT(3) |
#define MAX9611_TMP_LSB 0x09 |
#define MAX9611_TMP_MSB 0x08 |
enum max9611_addr_lvls |
enum max9611_data |
enum max9611_delay_time |
enum max9611_mode_conf |
enum max9611_mux_conf |
enum max9611_retry_time |
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 |