Provide powerful and efficient lighting for various portable applications
A
A
Hardware Overview
How does it work?
LED Flash 4 Click is based on the AS1170, a high-current LED driver from ams OSRAM, designed for high-performance LED flash and torch applications. The AS1170 is an inductive, highly efficient DC-DC step-up converter that operates with an external power supply from 2.7V up to 4.4V at a fixed frequency of 4MHz. It includes two internal current sinks, enabling the independent control of two onboard flash LEDs (XPCWHT-L1-R250-00A01), which deliver exceptional light quality. With its soft Start-Up feature, the AS1170 integrates easily into noise-sensitive RF systems. This chip has several protection functions, including flash timeout, overvoltage, overtemperature, undervoltage, and short circuit protection, ensuring reliable operation even in demanding environments. This Click board™ is ideal for use as a flash or torch,
providing significant advantages such as precise control over LED brightness and extended battery life due to the efficient power conversion. LED Flash 4 Click uses a standard 2-wire I2C communication protocol, allowing the host MCU to control the AS1170 with ease. The I2C interface supports clock frequencies up to 400kHz, with the I2C address selectable via the onboard ADDR SEL jumpers, providing flexibility in communication setup. Additionally, the board features an STB (strobe) pin and a digital signal with a pulldown resistor, which controls the strobe time for the flash function, enabling precise timing and synchronization of the LED flash. The AS1170 also incorporates a hardware automatic shutdown mode that activates if no I2C clock signal is detected for 100ms, eliminating the need for an additional
enable input to power down the device when the system shuts down. Besides a VIN terminal for external supplying the AS1170, the board also includes a VOUT terminal that allows the AS1170 to power a 5V system, such as an audio amplifier. This operating mode can be selected via the I2C interface by setting the corresponding register bit (const_v_mode=1). In this mode, the current sinks are disabled, and the LEDs cannot be switched on, making it suitable for powering external devices. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
Flip&Click PIC32MZ is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller, the PIC32MZ2048EFH100 from Microchip, four mikroBUS™ sockets for Click board™ connectivity, two USB connectors, LED indicators, buttons, debugger/programmer connectors, and two headers compatible with Arduino-UNO pinout. Thanks to innovative manufacturing technology,
it allows you to build gadgets with unique functionalities and features quickly. Each part of the Flip&Click PIC32MZ development kit contains the components necessary for the most efficient operation of the same board. In addition, there is the possibility of choosing the Flip&Click PIC32MZ programming method, using the chipKIT bootloader (Arduino-style development environment) or our USB HID bootloader using mikroC, mikroBasic, and mikroPascal for PIC32. This kit includes a clean and regulated power supply block through the USB Type-C (USB-C) connector. All communication
methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, user-configurable buttons, and LED indicators. Flip&Click PIC32MZ development kit allows you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC32
MCU Memory (KB)
2048
Silicon Vendor
Microchip
Pin count
100
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for LED Flash 4 Click driver.
Key functions:
ledflash4_set_led1_current
- This function sets the LED1 maximum current in mA.ledflash4_set_led2_current
- This function sets the LED2 maximum current in mA.ledflash4_set_stb_pin
- This function sets the strobe (STB) pin logic state.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief LED Flash 4 Click example
*
* # Description
* This example demonstrates the use of LED Flash 4 click board by toggling
* the LEDs output.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and performs the click default configuration which sets
* the click in flash mode with the LED current of 50mA for both LEDs. The strobe
* pin is set to active high level type.
* ## Application Task
* Toggles the LEDs output every 2 seconds using the strobe pin, and displays the LEDs
* state on the USB UART.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "ledflash4.h"
static ledflash4_t ledflash4;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
ledflash4_cfg_t ledflash4_cfg; /**< 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 @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
ledflash4_cfg_setup( &ledflash4_cfg );
LEDFLASH4_MAP_MIKROBUS( ledflash4_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == ledflash4_init( &ledflash4, &ledflash4_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( LEDFLASH4_ERROR == ledflash4_default_cfg ( &ledflash4 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
log_printf( &logger, " LEDs ON\r\n\n" );
ledflash4_set_stb_pin ( &ledflash4, LEDFLASH4_STROBE_PIN_HIGH );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, " LEDs OFF\r\n\n" );
ledflash4_set_stb_pin ( &ledflash4, LEDFLASH4_STROBE_PIN_LOW );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END