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

MCP4725 Driver. More...

#include "sarmfsw.h"
#include "I2C_component.h"
#include "I2C_peripheral.h"
#include "MCP4725_proc.h"
#include "MCP4725_ex.h"
Include dependency graph for MCP4725.h:
This graph shows which files directly or indirectly include this file:

Data Structures

union  uMCP4725_REG__CMD
 Union for CMD of MCP4725. More...
 

Macros

#define I2C_MCP4725_NB   1U
 Number of MCP4725 peripherals.
 
#define MCP4725A0_ADDR   0x60U
 MCP4725 address.
 
#define MCP4725A1_ADDR   0x62U
 MCP4725 with A1 address.
 
#define MCP4725A2_ADDR   0x64U
 MCP4725 with A2 address.
 
#define MCP4725_BASE_ADDR   MCP4725A1_ADDR
 MCP4725 Base address.
 

Enumerations

enum  MCP4725_cmd {
  MCP4725__FAST_MODE = 0U , MCP4725__WRITE_DAC = 2U , MCP4725__WRITE_DAC_EEP , MCP4725__RESERVED_1 ,
  MCP4725__RESERVED_2 , MCP4725__RESERVED_3 , MCP4725__RESERVED_4
}
 Register map enum of MCP4725. More...
 
enum  MCP4725_pd { MCP4725__PWR_NORMAL = 0U , MCP4725__PWR_DOWN_1K , MCP4725__PWR_DOWN_100K , MCP4725__PWR_DOWN_500K }
 Power down enum of MCP4725. More...
 

Functions

FctERR MCP4725_Init (const uint8_t idx, I2C_HandleTypeDef *const hi2c, const uint16_t devAddress)
 Initialization of the MCP4725 peripheral.
 
FctERR MCP4725_Init_Single (void)
 Initialization for MCP4725 peripheral.
 
FctERR MCP4725_General_Call (I2C_HandleTypeDef *const hi2c, const uint8_t cmd)
 I2C general call for MCP4725.
 
FctERR MCP4725_Write (I2C_slave_t *const pSlave, const uint8_t *data, const uint16_t nb)
 I2C Write function for MCP4725.
 
FctERR MCP4725_Read (I2C_slave_t *const pSlave, uint8_t *data, const uint16_t nb)
 I2C Read function for MCP4725.
 

Detailed Description

MCP4725 Driver.

Author
SMFSW

MCP4725: 12-Bit Digital-to-Analog Converter with EEPROM Memory

Macro Definition Documentation

◆ I2C_MCP4725_NB

#define I2C_MCP4725_NB   1U

Number of MCP4725 peripherals.

Note
Define I2C_MCP4725_NB to enable multiple peripherals of this type

◆ MCP4725_BASE_ADDR

#define MCP4725_BASE_ADDR   MCP4725A1_ADDR

MCP4725 Base address.

Note
Define MCP4725_BASE_ADDR to change default device base address

◆ MCP4725A0_ADDR

#define MCP4725A0_ADDR   0x60U

MCP4725 address.

◆ MCP4725A1_ADDR

#define MCP4725A1_ADDR   0x62U

MCP4725 with A1 address.

◆ MCP4725A2_ADDR

#define MCP4725A2_ADDR   0x64U

MCP4725 with A2 address.

Enumeration Type Documentation

◆ MCP4725_cmd

Register map enum of MCP4725.

Enumerator
MCP4725__FAST_MODE 

This command is used to change the DAC register. EEPROM is not affected.

MCP4725__WRITE_DAC 

Load configuration bits and data code to the DAC Register.

MCP4725__WRITE_DAC_EEP 

Load configuration bits and data code to the DAC Register and also write the EEPROM.

MCP4725__RESERVED_1 

Reserved for future use.

MCP4725__RESERVED_2 

Reserved for future use.

MCP4725__RESERVED_3 

Reserved for future use.

MCP4725__RESERVED_4 

Reserved for future use.

◆ MCP4725_pd

enum MCP4725_pd

Power down enum of MCP4725.

Enumerator
MCP4725__PWR_NORMAL 

Normal mode.

MCP4725__PWR_DOWN_1K 

1K Ohm resistor to ground

MCP4725__PWR_DOWN_100K 

100K Ohm resistor to ground

MCP4725__PWR_DOWN_500K 

500K Ohm resistor to ground

Function Documentation

◆ MCP4725_General_Call()

FctERR MCP4725_General_Call ( I2C_HandleTypeDef *const hi2c,
const uint8_t cmd )

I2C general call for MCP4725.

Parameters
[in]hi2c- pointer to general call I2C instance
[in]cmd- Command to send
Returns
FctERR - error code
Here is the caller graph for this function:

◆ MCP4725_Init()

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

Initialization of the MCP4725 peripheral.

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

◆ MCP4725_Init_Single()

FctERR MCP4725_Init_Single ( void )

Initialization for MCP4725 peripheral.

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

◆ MCP4725_Read()

FctERR MCP4725_Read ( I2C_slave_t *const pSlave,
uint8_t * data,
const uint16_t nb )

I2C Read function for MCP4725.

Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in,out]data- pointer to read to
[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:

◆ MCP4725_Write()

FctERR MCP4725_Write ( I2C_slave_t *const pSlave,
const uint8_t * data,
const uint16_t nb )

I2C Write function for MCP4725.

Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in]data- pointer to write from
[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: