no-OS
Classes | Macros | Functions
max11205.h File Reference

Implementation of max11205.h. More...

#include <stdint.h>
#include <stdbool.h>
#include "no_os_gpio.h"
#include "no_os_irq.h"
#include "no_os_spi.h"
#include "no_os_util.h"
Include dependency graph for max11205.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  max11205_dev
 
struct  max11205_init_param
 

Macros

#define MAX11205_VREF_MAX_MV   3600
 
#define MAX11205_DATA_SIZE_BYTES   2
 
#define MAX11205_SCALE   NO_OS_GENMASK(14,0)
 

Functions

int max11205_init (struct max11205_dev **device, struct max11205_init_param init_param)
 Initializes the communication peripheral. More...
 
int max11205_get_data_raw (struct max11205_dev *dev, bool *new_data_avail, int16_t *data_raw)
 Get the converted data. More...
 
int max11205_get_data_mv (struct max11205_dev *dev, int16_t raw_data, int32_t *data_mv)
 Get the converted data. More...
 
int max11205_remove (struct max11205_dev *dev)
 Free memory allocated by max11205_init(). More...
 

Detailed Description

Implementation of max11205.h.

Author
RBolboac (ramon.nosp@m.a.bo.nosp@m.lboac.nosp@m.a@an.nosp@m.alog..nosp@m.com)

Copyright 2022(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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Macro Definition Documentation

◆ MAX11205_DATA_SIZE_BYTES

#define MAX11205_DATA_SIZE_BYTES   2

◆ MAX11205_SCALE

#define MAX11205_SCALE   NO_OS_GENMASK(14,0)

◆ MAX11205_VREF_MAX_MV

#define MAX11205_VREF_MAX_MV   3600

Function Documentation

◆ max11205_get_data_mv()

int max11205_get_data_mv ( struct max11205_dev dev,
int16_t  raw_data,
int32_t *  data_mv 
)

Get the converted data.

Parameters
dev- Device handler.
raw_data- ADC raw data to be converted to millivolts.
data_mv- Pointer to adc value measured in millivolts.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ max11205_get_data_raw()

int max11205_get_data_raw ( struct max11205_dev dev,
bool new_data_avail,
int16_t *  data_raw 
)

Get the converted data.

Parameters
dev- Device handler.
new_data_avail- True if data has been updated since last read, false if same data is read again.
data_raw- Pointer to raw adc value.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ max11205_init()

int max11205_init ( struct max11205_dev **  device,
struct max11205_init_param  init_param 
)

Initializes the communication peripheral.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ max11205_remove()

int max11205_remove ( struct max11205_dev dev)

Free memory allocated by max11205_init().

Parameters
dev- Device handler.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function: