nPZero IC
API and Examples for the nPZero
Loading...
Searching...
No Matches
Macros | Functions
np0_hal.c File Reference

Source file for nPZero Hardware Abstraction Layer (HAL) More...

#include "../Inc/np0_hal.h"
#include <stdio.h>
Include dependency graph for np0_hal.c:

Macros

#define I2C_DELAY_MS   5
 

Functions

np0_status_e np0_hal_read (uint8_t slave_address, uint8_t slave_register, uint8_t *pData, uint16_t size, uint32_t timeout)
 Function to read from registers over I2C.
 
np0_status_e np0_hal_write (uint8_t slave_address, uint8_t *pData, uint16_t size, uint32_t timeout)
 Function to write to registers over I2C.
 
np0_status_e np0_hal_init ()
 Function to initialize hardware dependent I2C interface.
 

Detailed Description

Source file for nPZero Hardware Abstraction Layer (HAL)

This file contains the hardware-specific functions and configurations for the I2C communication interface. Users are required to customize these functions according to their target hardware and MCU setup.

The functions in this file serve as an abstraction layer between the IPMIC driver and the hardware-specific I2C implementation on the target system. Users should modify these functions to match the I2C peripheral and communication protocol used in their system.

Note
This file provides placeholder functions and configurations that need to be adapted to the specific hardware and MCU setup. Users must replace these placeholders with the actual implementations relevant to their system.
Warning
Incorrect configuration or improper implementation of these functions may result in I2C communication failures or unexpected behavior.

Macro Definition Documentation

◆ I2C_DELAY_MS

#define I2C_DELAY_MS   5

I2C Delay operation

Function Documentation

◆ np0_hal_init()

np0_status_e np0_hal_init ( void  )

Function to initialize hardware dependent I2C interface.

Returns
np0_status_e Status

◆ np0_hal_read()

np0_status_e np0_hal_read ( uint8_t  slave_address,
uint8_t  slave_register,
uint8_t *  pData,
uint16_t  size,
uint32_t  timeout 
)

Function to read from registers over I2C.

Note
The device 7 bits address value in datasheet must be shifted to the left before calling the interface.
Function is blocking.
Parameters
[in]slave_addressI2C Address for slave.
[in]slave_registerRegister Address to read.
[out]pDataPointer to data buffer where read data will be stored.
[in]sizeSize of data to be received.
[in]timeoutTimeout before transmission is asserted.
Returns
np0_status_e Status

◆ np0_hal_write()

np0_status_e np0_hal_write ( uint8_t  slave_address,
uint8_t *  pData,
uint16_t  size,
uint32_t  timeout 
)

Function to write to registers over I2C.

Note
The device 7 bits address value in datasheet must be shifted to the left before calling the interface.
Function is blocking.
Parameters
[in]slave_addressI2C Address for slave.
[in]pDataPointer to data buffer to write.
[in]sizeSize of data buffer to be sent.
[in]timeoutTimeout before transmission is asserted.
Returns
np0_status_e Status