Implementation of MAX31865 Driver. More...
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include "max31865.h"
#include "no_os_spi.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
#include "no_os_delay.h"
Functions | |
int | max31865_init (struct max31865_dev **device, struct max31865_init_param *init_param) |
Device and comm init function. | |
int | max31865_remove (struct max31865_dev *device) |
Remove resources allocated by the init function. | |
int | max31865_reg_update (struct max31865_dev *device, uint8_t reg_addr, uint8_t reg_update, bool or_mask) |
update register contents | |
int | max31865_read (struct max31865_dev *device, uint8_t reg_addr, uint8_t *reg_data) |
Read raw register value. | |
int | max31865_write (struct max31865_dev *device, uint8_t reg_addr, uint8_t reg_data) |
Write raw register value. | |
int | max31865_clear_fault (struct max31865_dev *device) |
Clear all faults in FAULTSTAT. | |
int | max31865_enable_bias (struct max31865_dev *device, bool bias_en) |
Enable the bias voltage on the RTD sensor. | |
int | max31865_auto_convert (struct max31865_dev *device, bool auto_conv_en) |
Option for continuous conversions between 50/60 Hz. | |
int | max31865_enable_50Hz (struct max31865_dev *device, bool filt_en) |
Option for 50Hz or 60Hz noise filters. | |
int | max31865_set_threshold (struct max31865_dev *device, uint16_t lower, uint16_t upper) |
Update the contents of the HIGH and LOW FAULT registers of max31865. | |
int | max31865_get_lower_threshold (struct max31865_dev *device, uint16_t *low_threshold) |
Read the raw 16-bit lower threshold value. | |
int | max31865_get_upper_threshold (struct max31865_dev *device, uint16_t *up_threshold) |
Read the raw 16-bit upper threshold value. | |
int | max31865_set_wires (struct max31865_dev *device, bool is_odd_wire) |
N-wire option for RTD measurement setup. | |
int | max31865_read_rtd (struct max31865_dev *device, uint16_t *rtd_reg) |
Read the raw 16-bit value from the RTD_REG in one shot mode. | |
Implementation of MAX31865 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 max31865_auto_convert | ( | struct max31865_dev * | device, |
bool | auto_conv_en ) |
Option for continuous conversions between 50/60 Hz.
device | MAX31865 descriptor |
auto_conv_en | If true, auto conversion is enabled |
int max31865_clear_fault | ( | struct max31865_dev * | device | ) |
Clear all faults in FAULTSTAT.
device | MAX31865 descriptor |
int max31865_enable_50Hz | ( | struct max31865_dev * | device, |
bool | filt_en ) |
Option for 50Hz or 60Hz noise filters.
device | MAX31865 descriptor |
filt_en | If true, 50Hz noise is filtered, else 60Hz(default) |
int max31865_enable_bias | ( | struct max31865_dev * | device, |
bool | bias_en ) |
Enable the bias voltage on the RTD sensor.
device | MAX31865 descriptor |
bias_en | If true bias is enabled, else disabled |
int max31865_get_lower_threshold | ( | struct max31865_dev * | device, |
uint16_t * | low_threshold ) |
Read the raw 16-bit lower threshold value.
device | MAX31865 descriptor |
low_threshold | pointer to hold the 16-bit lower threshold value |
int max31865_get_upper_threshold | ( | struct max31865_dev * | device, |
uint16_t * | up_threshold ) |
Read the raw 16-bit upper threshold value.
device | MAX31865 descriptor |
up_threshold | pointer to hold the 16-bit upper threshold value |
int max31865_init | ( | struct max31865_dev ** | device, |
struct max31865_init_param * | init_param ) |
Device and comm init function.
device | - MAX31865 descriptor to be initialized |
init_param | - Init parameters for descriptor |
int max31865_read | ( | struct max31865_dev * | device, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data ) |
Read raw register value.
device | - MAX31865 descriptor |
reg_addr | - register value to read from |
reg_data | - pointer for register value read |
int max31865_read_rtd | ( | struct max31865_dev * | device, |
uint16_t * | rtd_reg ) |
Read the raw 16-bit value from the RTD_REG in one shot mode.
device | MAX31865 descriptor |
rtd_reg | pointer to hold the 16-bit raw RTD_REG value |
int max31865_reg_update | ( | struct max31865_dev * | device, |
uint8_t | reg_addr, | ||
uint8_t | reg_update, | ||
bool | or_mask ) |
update register contents
device | - MAX31865 descriptor |
reg_addr | - register value to read from |
reg_update | - mask to update the value of selected register |
or_mask | - set to true for OR, false for AND masking |
int max31865_remove | ( | struct max31865_dev * | device | ) |
Remove resources allocated by the init function.
device | - max31865 descriptor |
int max31865_set_threshold | ( | struct max31865_dev * | device, |
uint16_t | lower, | ||
uint16_t | upper ) |
Update the contents of the HIGH and LOW FAULT registers of max31865.
device | MAX31865 descriptor |
lower | raw lower threshold |
upper | raw upper threshold |
int max31865_set_wires | ( | struct max31865_dev * | device, |
bool | is_odd_wire ) |
N-wire option for RTD measurement setup.
device | MAX31865 descriptor |
is_odd_wire | If true, uses 3-wire setup. Else, uses 2/4-wire setup. |
int max31865_write | ( | struct max31865_dev * | device, |
uint8_t | reg_addr, | ||
uint8_t | reg_data ) |
Write raw register value.
device | - MAX31865 descriptor |
reg_addr | - register value to write to |
reg_data | - data to write in register |