I2C_Drivers (ARM) 1.1
SMFSW collection of HAL I2C Drivers for ARM
Loading...
Searching...
No Matches
MCP9808.h File Reference

MCP9808 Driver. More...

#include "sarmfsw.h"
#include "I2C_component.h"
#include "I2C_peripheral.h"
#include "MCP9808_proc.h"
#include "MCP9808_ex.h"
Include dependency graph for MCP9808.h:
This graph shows which files directly or indirectly include this file:

Data Structures

union  uMCP9808_REG__CFG
 Union for CFG of MCP9808. More...
 
union  uMCP9808_REG__TEMP_LIM
 Union for Temperature Limit registers of MCP9808. More...
 
union  uMCP9808_REG__TEMP_AMB
 Union for Ambient temperature register of MCP9808. More...
 

Macros

#define I2C_MCP9808_NB   1U
 Number of MCP9808 peripherals.
 
#define MCP9808_ADDR   0x18U
 MCP9808 address.
 
#define MCP9808_BASE_ADDR   MCP9808_ADDR
 MCP9808 Base address.
 

Enumerations

enum  MCP9808_reg {
  MCP9808__RFU = 0U , MCP9808__CONFIGURATION , MCP9808__ALERT_UPPER , MCP9808__ALERT_LOWER ,
  MCP9808__CRITICAL_TEMP_TRIP , MCP9808__TEMPERATURE , MCP9808__MANUFACTURER_ID , MCP9808__DEVICE_ID ,
  MCP9808__RESOLUTION
}
 Register map enum of MCP9808. More...
 
enum  MCP9808_res { MCP9808__RES_0_5 = 0U , MCP9808__RES_0_25 , MCP9808__RES_0_125 , MCP9808__RES_0_0625 }
 Resolution enum of MCP9808. More...
 
enum  MCP9808_hyst { MCP9808__HYST_0 = 0U , MCP9808__HYST_1_5 , MCP9808__HYST_3_0 , MCP9808__HYST_6_0 }
 Resolution enum of MCP9808. More...
 

Functions

FctERR MCP9808_Init (const uint8_t idx, I2C_HandleTypeDef *const hi2c, const uint16_t devAddress)
 Initialization of the MCP9808 peripheral.
 
FctERR MCP9808_Init_Single (void)
 Initialization for MCP9808 peripheral.
 
FctERR MCP9808_Write (I2C_slave_t *const pSlave, const uint16_t *data, const uint16_t addr, const uint16_t nb)
 I2C Write function for MCP9808.
 
FctERR MCP9808_Read (I2C_slave_t *const pSlave, uint16_t *data, const uint16_t addr, const uint16_t nb)
 I2C Read function for MCP9808.
 

Detailed Description

MCP9808 Driver.

Author
SMFSW

MCP9808: +/-0.5C Maximum Accuracy Digital Temperature Sensor

Macro Definition Documentation

◆ I2C_MCP9808_NB

#define I2C_MCP9808_NB   1U

Number of MCP9808 peripherals.

Note
Define I2C_MCP9808_NB to enable multiple peripherals of this type

◆ MCP9808_ADDR

#define MCP9808_ADDR   0x18U

MCP9808 address.

◆ MCP9808_BASE_ADDR

#define MCP9808_BASE_ADDR   MCP9808_ADDR

MCP9808 Base address.

Note
Define MCP9808_BASE_ADDR to change default device base address

Enumeration Type Documentation

◆ MCP9808_hyst

Resolution enum of MCP9808.

Enumerator
MCP9808__HYST_0 

Hysteresis +0.0 Celsius degrees.

MCP9808__HYST_1_5 

Hysteresis +1.5 Celsius degrees.

MCP9808__HYST_3_0 

Hysteresis +3.0 Celsius degrees.

MCP9808__HYST_6_0 

Hysteresis +6.0 Celsius degrees.

◆ MCP9808_reg

Register map enum of MCP9808.

Enumerator
MCP9808__RFU 

RFU, Reserved for Future Use (Read-Only register)

MCP9808__CONFIGURATION 

Configuration register (CONFIG)

MCP9808__ALERT_UPPER 

Alert Temperature Upper Boundary Trip register (T UPPER)

MCP9808__ALERT_LOWER 

Alert Temperature Lower Boundary Trip register (T LOWER)

MCP9808__CRITICAL_TEMP_TRIP 

Critical Temperature Trip register (T CRIT)

MCP9808__TEMPERATURE 

Temperature register (T A)

MCP9808__MANUFACTURER_ID 

Manufacturer ID register.

MCP9808__DEVICE_ID 

Device ID/Revision register.

MCP9808__RESOLUTION 

Resolution register.

◆ MCP9808_res

Resolution enum of MCP9808.

Enumerator
MCP9808__RES_0_5 

Resolution +0.5 Celsius degrees.

MCP9808__RES_0_25 

Resolution +0.25 Celsius degrees.

MCP9808__RES_0_125 

Resolution +0.125 Celsius degrees.

MCP9808__RES_0_0625 

Resolution +0.0625 Celsius degrees.

Function Documentation

◆ MCP9808_Init()

FctERR MCP9808_Init ( const uint8_t idx,
I2C_HandleTypeDef *const hi2c,
const uint16_t devAddress )

Initialization of the MCP9808 peripheral.

Parameters
[in]idx- MCP9808 index
[in]hi2c- pointer to MCP9808 I2C instance
[in]devAddress- MCP9808 device address
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MCP9808_Init_Single()

FctERR MCP9808_Init_Single ( void )

Initialization for MCP9808 peripheral.

Warning
In case multiple devices (defined by I2C_MCP9808_NB > 1), you shall use MCP9808_Init instead
Returns
FctERR - error code
Here is the call graph for this function:

◆ MCP9808_Read()

FctERR MCP9808_Read ( I2C_slave_t *const pSlave,
uint16_t * data,
const uint16_t addr,
const uint16_t nb )

I2C Read function for MCP9808.

Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in,out]data- pointer to read to (16b type pointer)
[in]addr- Address to read from
[in]nb- Number of bytes to read
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MCP9808_Write()

FctERR MCP9808_Write ( I2C_slave_t *const pSlave,
const uint16_t * data,
const uint16_t addr,
const uint16_t nb )

I2C Write function for MCP9808.

Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in]data- pointer to write from (16b type pointer)
[in]addr- Address to write to
[in]nb- Number of bytes to write
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function: