Skip to content

File ns_i2c_register_driver.c

FileList > neuralSPOT > neuralspot > ns-i2c > src > ns_i2c_register_driver.c

Go to the source code of this file

Generic i2c driver for register-based i2c devices. More...

  • #include "ns_i2c_register_driver.h"
  • #include "am_hal_iom.h"
  • #include "ns_i2c.h"

Public Functions

Type Name
uint32_t ns_i2c_read_reg (ns_i2c_config_t * cfg, uint32_t devAddr, uint8_t regAddr, uint8_t * value, uint8_t mask)
Read 8-bit register over I2C.
uint32_t ns_i2c_read_sequential_regs (ns_i2c_config_t * cfg, uint32_t devAddr, uint32_t regAddr, void * buf, uint32_t size)
Read sequential 8-bit registers over I2C.
uint32_t ns_i2c_write_reg (ns_i2c_config_t * cfg, uint32_t devAddr, uint8_t regAddr, uint8_t value, uint8_t mask)
Write 8-bit register over I2C.
uint32_t ns_i2c_write_sequential_regs (ns_i2c_config_t * cfg, uint32_t devAddr, uint32_t regAddr, void * buf, uint32_t size)
Write sequential 8-bit registers over I2C.

Detailed Description

Author:

Carlos Morales

Version:

0.1

Date:

2022-08-26

Copyright:

Copyright (c) 2022

Public Functions Documentation

function ns_i2c_read_reg

Read 8-bit register over I2C.

uint32_t ns_i2c_read_reg (
    ns_i2c_config_t * cfg,
    uint32_t devAddr,
    uint8_t regAddr,
    uint8_t * value,
    uint8_t mask
) 

Parameters:

  • cfg I2C configuration
  • devAddr Device address
  • regAddr Register address
  • value Register Value
  • mask Read mask

Returns:

uint32_t status

Parameters:

  • cfg Handle obtained from ns_i2c_interface_init
  • devAddr Device address
  • regAddr 8-bit register address
  • value Register value
  • mask Read mask

Returns:

uint32_t status

function ns_i2c_read_sequential_regs

Read sequential 8-bit registers over I2C.

uint32_t ns_i2c_read_sequential_regs (
    ns_i2c_config_t * cfg,
    uint32_t devAddr,
    uint32_t regAddr,
    void * buf,
    uint32_t size
) 

Parameters:

  • cfg I2C configuration
  • devAddr Device address
  • regAddr First register address
  • buf Buffer to store register values
  • size Number of registers to read

Returns:

uint32_t status

Parameters:

  • cfg I2C configuration
  • devAddr Device address
  • regAddr First 8-bit register address
  • buf Buffer to store register values
  • size Number of registers to read

Returns:

uint32_t status

function ns_i2c_write_reg

Write 8-bit register over I2C.

uint32_t ns_i2c_write_reg (
    ns_i2c_config_t * cfg,
    uint32_t devAddr,
    uint8_t regAddr,
    uint8_t value,
    uint8_t mask
) 

Parameters:

  • cfg I2C configuration
  • devAddr Device address
  • regAddr Register address
  • value Register Value
  • mask Write mask

Returns:

uint32_t status

Parameters:

  • cfg Handle obtained from ns_i2c_interface_init
  • devAddr Device address
  • regAddr 8-bit register address
  • value Register value
  • mask Write mask

Returns:

uint32_t status

function ns_i2c_write_sequential_regs

Write sequential 8-bit registers over I2C.

uint32_t ns_i2c_write_sequential_regs (
    ns_i2c_config_t * cfg,
    uint32_t devAddr,
    uint32_t regAddr,
    void * buf,
    uint32_t size
) 

Parameters:

  • cfg I2C configuration
  • devAddr Device address
  • regAddr First register address
  • buf Pointer to buffer of values to be written
  • size Number of bytes to write

Returns:

uint32_t status

Parameters:

  • cfg I2C configuration
  • devAddr Device address
  • regAddr First 8-bit register address
  • buf Pointer to buffer of values to be written
  • size Number of bytes to write

Returns:

uint32_t status


The documentation for this class was generated from the following file neuralSPOT/neuralspot/ns-i2c/src/ns_i2c_register_driver.c