rfswitch  2.0.0.0
Main Page

RF Switch click

RF Switch Click is a Click boardâ„¢ equipped with the MASWSS0115, a GaAs PHEMT MMIC single-pole, double-throw (SPDT) switch developed by Macom for switching between small signal components such as filter banks, single-band LNAs, converters, etc. The MASWSS0115 is ideally suited for applications where a very small size and low cost are required.

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Sep 2021.
  • Type : GPIO type

Software Support

We provide a library for the RFSwitch 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 RFSwitch Click driver.

Standard key functions :

Example key functions :

Example Description

This is an example that demonstrates the use of the RF Switch Click board.

The demo application is composed of two sections :

Application Init

Initialization driver enable's - GPIO, also write log and powers on device.

void application_init ( void )
{
log_cfg_t log_cfg;
rfswitch_cfg_t rfswitch_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
rfswitch_cfg_setup( &rfswitch_cfg );
RFSWITCH_MAP_MIKROBUS( rfswitch_cfg, MIKROBUS_1 );
if ( DIGITAL_OUT_UNSUPPORTED_PIN == rfswitch_init( &rfswitch, &rfswitch_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, "------------------------\r\n" );
log_printf( &logger, " Powering device on \r\n" );
rfswitch_power_on( &rfswitch );
Delay_ms ( 100 );
log_printf( &logger, "------------------------\r\n" );
log_printf( &logger, " Select option to \r\n" );
log_printf( &logger, " select channel \r\n" );
log_printf( &logger, "------------------------\r\n" );
log_printf( &logger, " 1. Channel 1 selected \r\n" );
log_printf( &logger, " 2. Channel 2 selected \r\n" );
log_printf( &logger, " 3. Switching channel \r\n" );
log_printf( &logger, "------------------------\r\n" );
}

Application Task

Waiting for valid user input and executes functions based on set of valid commands. Results are being sent to the Usart Terminal where you can track their changes.

void application_task ( void )
{
uint8_t tx_buf;
if ( log_read( &logger, &tx_buf, 1 ) ) {
switch ( tx_buf ) {
case '1' : {
log_printf( &logger, " Switching to RF port 1 \r\n" );
log_printf( &logger, "------------------------\r\n" );
break;
}
case '2' : {
log_printf( &logger, " Switching to RF port 2 \r\n" );
log_printf( &logger, "------------------------\r\n" );
break;
}
case '3' : {
log_printf( &logger, " Switching RF port \r\n" );
log_printf( &logger, "------------------------\r\n" );
break;
}
default : {
log_printf( &logger, " Select option to \r\n" );
log_printf( &logger, " select channel \r\n" );
log_printf( &logger, "------------------------\r\n" );
log_printf( &logger, " 1. Channel 1 selected \r\n" );
log_printf( &logger, " 2. Channel 2 selected \r\n" );
log_printf( &logger, " 3. Switching channel \r\n" );
log_printf( &logger, "------------------------\r\n" );
}
}
}
}

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.RFSwitch

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.


RFSWITCH_SELECT_CHANNEL_2
#define RFSWITCH_SELECT_CHANNEL_2
Definition: rfswitch.h:77
rfswitch_init
err_t rfswitch_init(rfswitch_t *ctx, rfswitch_cfg_t *cfg)
RF Switch initialization function.
rfswitch_select_channel
void rfswitch_select_channel(rfswitch_t *ctx, uint8_t select_channel)
RF Switch select channel function.
rfswitch_cfg_t
RF Switch Click configuration object.
Definition: rfswitch.h:118
application_task
void application_task(void)
Definition: main.c:68
rfswitch_cfg_setup
void rfswitch_cfg_setup(rfswitch_cfg_t *cfg)
RF Switch configuration object setup function.
rfswitch_power_on
void rfswitch_power_on(rfswitch_t *ctx)
RF Switch power on function.
RFSWITCH_SELECT_CHANNEL_1
#define RFSWITCH_SELECT_CHANNEL_1
Definition: rfswitch.h:76
rfswitch_t
RF Switch Click context object.
Definition: rfswitch.h:107
rfswitch_switch_channel
void rfswitch_switch_channel(rfswitch_t *ctx)
RF Switch switch channel function.
RFSWITCH_MAP_MIKROBUS
#define RFSWITCH_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: rfswitch.h:95
application_init
void application_init(void)
Definition: main.c:28