pac1944 2.0.0.0
main.c File Reference

PAC1944 Click example. More...

#include "board.h"
#include "log.h"
#include "pac1944.h"

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

PAC1944 Click example.

Description

This demo application shows an example of measuring voltage, current and power in a selected part of the circuit. Note that PAC1944 is a high side power monitor, therefore the desired channel should be connected accordingly.

The demo application is composed of two sections :

Application Init

Initialization of I2C module, log UART and additional pins. In addition, a default configuration is performed as followed: Sample mode is 1024, adaptive accumulation; INT pin is set as an alert; SLW pin is set as slow sampling rate control; All channels are on; Channel 1 is set for bipolar measurements; Channel 2 is set for bipolar measurements reduced by half; Channel 3 and 4 are set for unipolar measurements.

Application Task

The application sends a refresh command which stores the measurement data in registers. Measurements are acquired for voltage, current and power on channel 1 of PAC1944 click board. The last 8 measurements are averaged and calculated in bipolar mode. Process is repeated every two seconds.

Author
Stefan Nikolic

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )