Hospital Analyser  1.0
Classes | Macros | Enumerations | Functions
MCP3425.h File Reference
#include "stm32l4xx_hal.h"
Include dependency graph for MCP3425.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MCP3425_ConfigTypeDef
 ADC configuration structure definition. More...
 

Macros

#define MCP3425_I2C_ADDRESS   (0b11010000)
 
#define MCP3425_I2C_TIMEOUT   (3200U)
 

Enumerations

enum  MCP3425_GainTypeDef { MCP3425_Gain8 = 8, MCP3425_Gain4 = 4, MCP3425_Gain2 = 2, MCP3425_Gain1 = 1 }
 
enum  MCP3425_ResolutionTypeDef { MCP3425_Resolution16 = 0, MCP3425_Resolution14 = 1, MCP3425_Resolution12 = 2 }
 
enum  MCP3425_Conversion_ModeTypeDef { MCP3425_Continuous = 0, MCP3425_OneShot = 1 }
 
enum  MCP3425_StatusTypeDef { MCP3425_Status_OK = 0, MCP3425_Status_ERROR = 1, MCP3425_Status_NO_CONFIG = 2 }
 

Functions

MCP3425_StatusTypeDef MCP3425_SetConfiguration (I2C_HandleTypeDef *hi2c, MCP3425_GainTypeDef gain, MCP3425_ResolutionTypeDef resolution)
 MCP3425_SetConfiguration Sets up ADC according to configuration. More...
 
MCP3425_StatusTypeDef MCP3425_GetRawValue (I2C_HandleTypeDef *hi2c, int16_t *value)
 MCP3425_GetRawValue Reads raw value from ADC. More...
 
MCP3425_StatusTypeDef MCP3425_GetVoltageFromRawValue (uint16_t rawValue, float *voltage)
 MCP3425_GetVoltageFromRawValue Converts raw value to voltage according to current configuration. More...
 
MCP3425_StatusTypeDef MCP3425_GetVoltageValue (I2C_HandleTypeDef *hi2c, float *voltage)
 MCP3425_GetVoltageValue Gets voltage value directly from ADC (overloaded function) More...
 

Macro Definition Documentation

#define MCP3425_I2C_ADDRESS   (0b11010000)

I2C device address

#define MCP3425_I2C_TIMEOUT   (3200U)

I2C Comunication timeout

Function Documentation

MCP3425_StatusTypeDef MCP3425_GetRawValue ( I2C_HandleTypeDef *  hi2c,
int16_t *  value 
)

MCP3425_GetRawValue Reads raw value from ADC.

Parameters
hi2cPointer to I2C handle
valuePointer where raw value will be saved
Returns
Function success (error) status
MCP3425_StatusTypeDef MCP3425_GetVoltageFromRawValue ( uint16_t  rawValue,
float *  voltage 
)

MCP3425_GetVoltageFromRawValue Converts raw value to voltage according to current configuration.

Parameters
rawValueCurrent raw value from ADC
voltagePointer where converted value will be stored
Returns
Function success (error) status
MCP3425_StatusTypeDef MCP3425_GetVoltageValue ( I2C_HandleTypeDef *  hi2c,
float *  voltage 
)

MCP3425_GetVoltageValue Gets voltage value directly from ADC (overloaded function)

Parameters
hi2cPointer to I2C handle
voltagePointer where voltage value will be stored
Returns
Function success (error) status
MCP3425_StatusTypeDef MCP3425_SetConfiguration ( I2C_HandleTypeDef *  hi2c,
MCP3425_GainTypeDef  gain,
MCP3425_ResolutionTypeDef  resolution 
)

MCP3425_SetConfiguration Sets up ADC according to configuration.

Parameters
hi2cPointer to I2C handle
gainGain to set up
resolutionResolution to set up
Returns
Function success (error) status