Description
This example demonstrates the usage of the nPZero driver to setup the ADC and there threshould's. Booth ADC's (Internal and External) are set in the example code, the ADC_IN pin for this example is connected to VDD.
Code nPZero HAL read example
Code snippet ...
np0_status_e np0_hal_read(uint8_t slave_address, uint8_t slave_register, uint8_t *pData, uint16_t size, uint32_t timeout)
{
uint8_t transmitData[] = { slave_register};
if (HAL_I2C_Master_Transmit(&m_hi2c1, slave_address, transmitData, sizeof(transmitData), timeout) != HAL_OK)
{
}
if (HAL_I2C_Master_Receive(&m_hi2c1, slave_address, pData, size, timeout) != HAL_OK)
{
}
}
np0_status_e
Definition: np0.h:31
@ ERR
Definition: np0.h:33
#define I2C_DELAY_MS
Definition: np0_hal.c:34
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.
Definition: np0_hal.c:54
Note
- Adapt the code to match your MCU throw np0_hal_init.
- Consult the nPZero driver function documentation for precise function usage.