irda4  2.1.0.0
Main Page

IrDA 4 click

IrDA 4 Click is a compact add-on board that provides a cost-effective solution for sending and receiving IR serial data. This board features the TFBS4650, an infrared transceiver from Vishay Semiconductors. The transceiver includes a PIN photodiode, an infrared emitter, and a low-power integral circuit and complies with the IrDA physical layer specification.

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Apr 2023.
  • Type : UART type

Software Support

We provide a library for the IrDA 4 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for IrDA 4 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of IrDA 4 click board by processing

the incoming data and displaying them on the USB UART.

The demo application is composed of two sections :

Application Init

Initializes the driver and disables the transmitter shutdown.

void application_init ( void )
{
log_cfg_t log_cfg;
irda4_cfg_t irda4_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
irda4_cfg_setup( &irda4_cfg );
IRDA4_MAP_MIKROBUS( irda4_cfg, MIKROBUS_1 );
if ( UART_ERROR == irda4_init( &irda4, &irda4_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Demonstrates the use of IrDA 4 clicks which can be used as transmitter or receiver.

  • TRANSMITTER : Device is sending tx_message data.
  • RECEIVER : Device is reading a message that is being transmitted and logs it on the UART terminal.
void application_task ( void )
{
#if defined( DEMO_APP_TRANSMITTER )
for ( uint8_t n_cnt = 0; n_cnt < 8; n_cnt++ )
{
irda4_generic_write( &irda4, &tx_message[ n_cnt ], 1 );
Delay_ms ( 500 );
}
log_printf( &logger, "Message sent \r\n" );
#else
if ( 1 == irda4_generic_read( &irda4, &rx_message, 1 ) )
{
log_printf( &logger, "%c", rx_message );
}
#endif
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.IrDA4

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


IRDA4_SHUTDOWN_DISABLED
#define IRDA4_SHUTDOWN_DISABLED
IrDA 4 control commands.
Definition: irda4.h:73
irda4_generic_write
err_t irda4_generic_write(irda4_t *ctx, uint8_t *data_in, uint16_t len)
IrDA 4 data writing function.
irda4_generic_read
err_t irda4_generic_read(irda4_t *ctx, uint8_t *data_out, uint16_t len)
IrDA 4 data reading function.
application_task
void application_task(void)
Definition: main.c:69
irda_hw_reset
void irda_hw_reset(irda4_t *ctx)
IrDA 4 hardware reset function.
irda4_cfg_setup
void irda4_cfg_setup(irda4_cfg_t *cfg)
IrDA 4 configuration object setup function.
IRDA4_MAP_MIKROBUS
#define IRDA4_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: irda4.h:105
application_init
void application_init(void)
Definition: main.c:37
irda4_cfg_t
IrDA 4 Click configuration object.
Definition: irda4.h:138
irda4_init
err_t irda4_init(irda4_t *ctx, irda4_cfg_t *cfg)
IrDA 4 initialization function.
irda4_t
IrDA 4 Click context object.
Definition: irda4.h:119
irda4_set_tx_shutdown
void irda4_set_tx_shutdown(irda4_t *ctx, uint8_t sd_state)
IrDA 4 TX shutdown function.