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

NCA9595 Driver. More...

#include "sarmfsw.h"
#include "I2C_component.h"
#include "I2C_peripheral.h"
#include "NCA9595_proc.h"
#include "NCA9595_ex.h"
Include dependency graph for NCA9595.h:
This graph shows which files directly or indirectly include this file:

Data Structures

union  uNCA9595_REG__IN
 Union for Input register pair of NCA9595. More...
 
union  uNCA9595_REG__OUT
 Union for Output register pair of NCA9595. More...
 
union  uNCA9595_REG__CFG
 Union for Config register pair of NCA9595. More...
 
union  uNCA9595_REG__POL
 Union for Polarity inversion register pair of NCA9595. More...
 
union  uNCA9595_REG__PUP
 Union for PullUp register pair of NCA9595. More...
 

Macros

#define I2C_NCA9595_NB   1U
 Number of NCA9595 peripherals.
 
#define NCA9595_ADDR   0x20U
 NCA9595 address.
 
#define NCA9595_BASE_ADDR   NCA9595_ADDR
 NCA9595 Base address.
 

Enumerations

enum  NCA9595_reg {
  NCA9595__InputPort0 = 0U , NCA9595__InputPort1 , NCA9595__OutputPort0 , NCA9595__OutputPort1 ,
  NCA9595__PolarityPort0 , NCA9595__PolarityPort1 , NCA9595__ConfigPort0 , NCA9595__ConfigPort1 ,
  NCA9595__PullUpConfigPort0 , NCA9595__PullUpConfigPort1
}
 Register map enum of NCA9595. More...
 
enum  NCA9595_wreg {
  NCA9595__InputPorts = NCA9595__InputPort0 , NCA9595__OutputPorts = NCA9595__OutputPort0 , NCA9595__PolarityPorts = NCA9595__PolarityPort0 , NCA9595__ConfigPorts = NCA9595__ConfigPort0 ,
  NCA9595__PullUpConfigPorts = NCA9595__PullUpConfigPort0
}
 Register map enum of NCA9595. More...
 
enum  NCA9595_Config { NCA9595__Cfg_Output = 0U , NCA9595__Cfg_Input }
 Configuration register values for NCA9595. More...
 
enum  NCA9595_Polarity { NCA9595__Pol_Direct = 0U , NCA9595__Pol_Invert }
 Polarity inversion register values for NCA9595. More...
 
enum  NCA9595_PullUp { NCA9595__PUp_Disable = 0U , NCA9595__PUp_Enable }
 Pull-Up configuration register values for NCA9595. More...
 

Functions

FctERR NCA9595_Init (const uint8_t idx, I2C_HandleTypeDef *const hi2c, const uint16_t devAddress)
 Initialization for NCA9595 peripheral.
 
FctERR NCA9595_Init_Single (void)
 Initialization for NCA9595 peripheral.
 
FctERR NCA9595_Write_Word (I2C_slave_t *const pSlave, const uint16_t *data, const uint16_t addr)
 I2C Write function for NCA9595.
 
FctERR NCA9595_Read_Word (I2C_slave_t *const pSlave, uint16_t *data, const uint16_t addr)
 I2C Read function for NCA9595.
 

Detailed Description

NCA9595 Driver.

Author
SMFSW

NCA9595: Low-voltage 16-bit I²C and SMBus I/O expander

Macro Definition Documentation

◆ I2C_NCA9595_NB

#define I2C_NCA9595_NB   1U

Number of NCA9595 peripherals.

Note
Define I2C_NCA9595_NB to enable multiple peripherals of this type

◆ NCA9595_ADDR

#define NCA9595_ADDR   0x20U

NCA9595 address.

◆ NCA9595_BASE_ADDR

#define NCA9595_BASE_ADDR   NCA9595_ADDR

NCA9595 Base address.

Note
Define NCA9595_BASE_ADDR to change default device base address

Enumeration Type Documentation

◆ NCA9595_Config

Configuration register values for NCA9595.

Enumerator
NCA9595__Cfg_Output 

corresponding port pin is enabled as an output

NCA9595__Cfg_Input 

corresponding port pin is enabled as a high-impedance input

◆ NCA9595_Polarity

Polarity inversion register values for NCA9595.

Enumerator
NCA9595__Pol_Direct 

corresponding port pin’s polarity is retained

NCA9595__Pol_Invert 

corresponding port pin’s polarity is inverted in the Input register

◆ NCA9595_PullUp

Pull-Up configuration register values for NCA9595.

Enumerator
NCA9595__PUp_Disable 

corresponding port pull-up resistors are disabled

NCA9595__PUp_Enable 

corresponding port pull-up resistors are enabled

◆ NCA9595_reg

Register map enum of NCA9595.

Note
Shouldn't be used directly (use NCA9595_wreg instead)
Enumerator
NCA9595__InputPort0 

Input port 0.

NCA9595__InputPort1 

Input port 1.

NCA9595__OutputPort0 

Output port 0.

NCA9595__OutputPort1 

Output port 1.

NCA9595__PolarityPort0 

Polarity inversion port 0.

NCA9595__PolarityPort1 

Polarity inversion port 1.

NCA9595__ConfigPort0 

Configuration port 0.

NCA9595__ConfigPort1 

Configuration port 1.

NCA9595__PullUpConfigPort0 

Configuration pull-up port 0.

NCA9595__PullUpConfigPort1 

Configuration pull-up port 1.

◆ NCA9595_wreg

Register map enum of NCA9595.

Enumerator
NCA9595__InputPorts 

Input ports.

NCA9595__OutputPorts 

Output ports.

NCA9595__PolarityPorts 

Polarity inversion ports.

NCA9595__ConfigPorts 

Configuration ports.

NCA9595__PullUpConfigPorts 

Configuration pull-up port 0.

Function Documentation

◆ NCA9595_Init()

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

Initialization for NCA9595 peripheral.

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

◆ NCA9595_Init_Single()

FctERR NCA9595_Init_Single ( void )

Initialization for NCA9595 peripheral.

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

◆ NCA9595_Read_Word()

FctERR NCA9595_Read_Word ( I2C_slave_t *const pSlave,
uint16_t * data,
const uint16_t addr )

I2C Read function for NCA9595.

Note
Reads 8bits register pair (address shall be even for little endian / odd for big endian)
Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in,out]data- pointer to read to
[in]addr- Address to read from
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCA9595_Write_Word()

FctERR NCA9595_Write_Word ( I2C_slave_t *const pSlave,
const uint16_t * data,
const uint16_t addr )

I2C Write function for NCA9595.

Note
Writes 8bits register pair (address shall be even for little endian / odd for big endian)
Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in]data- pointer to write from
[in]addr- Address to write to
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function: