battman3 2.0.0.0
main.c File Reference

BATT-MAN3 Click example. More...

#include "board.h"
#include "log.h"
#include "battman3.h"

Macros

#define LOG_THRESHOLD_1SEC   10
 BATT-MAN 3 Click LOG delay.
 
#define LOG_THRESHOLD_3SEC   30
 
#define LOG_THRESHOLD_5SEC   50
 

Functions

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

Detailed Description

BATT-MAN3 Click example.

Description

This example showcases ability of device to charge battery, and outputs and supply 4 different devices with 3 LDO's and 1 boost channel.

The demo application is composed of two sections :

Application Init

Initialization of the communication modules(UART, I2C) and 3 additional input pins(power good, battery ok, and interrupt). Configures device to enable charging, battery voltage monitoring, sets charging termination to 3.7V, charging threshold to 3.1V and dead battery to 2.5V. Enables all 3 LDO's( channel 1 -> 3.3V, channel 2 -> 1.5V, and channel 3 -> 2.5V ).

Application Task

Reads battery voltage level and logs it. Besides that reads status and logs every change on charging and battery status. If power good flag occurs(PGD pin goes low) disables LDO's, and reenables them when battery is full(when battery reaches charging termination voltage).

Author
Luka Filipovic

Macro Definition Documentation

◆ LOG_THRESHOLD_1SEC

#define LOG_THRESHOLD_1SEC   10

BATT-MAN 3 Click LOG delay.

Macro that specifies delay between logs of battery voltage.

◆ LOG_THRESHOLD_3SEC

#define LOG_THRESHOLD_3SEC   30

◆ LOG_THRESHOLD_5SEC

#define LOG_THRESHOLD_5SEC   50

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 )