Contiki-NG
antenna-sw.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Zolertia
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 /* -------------------------------------------------------------------------- */
30 /**
31  * \addtogroup zoul
32  * @{
33  *
34  * \defgroup remote-antenna RE-Mote Antenna switch
35  *
36  * Driver for the RE-Mote RF antenna switch, to enable either the internal
37  * ceramic antenna or an external one connected to the uFL connector
38  * @{
39  *
40  * \file
41  * Header file for the RE-Mote RF antenna switch
42  */
43 /* -------------------------------------------------------------------------- */
44 #ifndef ANTENNA_SW_H_
45 #define ANTENNA_SW_H_
46 /* -------------------------------------------------------------------------- */
47 #include <stdint.h>
48 /* -------------------------------------------------------------------------- */
49 #define ANTENNA_SW_SELECT_2_4GHZ 0
50 #define ANTENNA_SW_SELECT_SUBGHZ (1 << ANTENNA_RF_SW_PIN)
51 #define ANTENNA_SW_SELECT_ERROR (-1)
52 /* -------------------------------------------------------------------------- */
53 /**
54  * \brief Init function for the antenna switch
55  *
56  * The RE-Mote platform allows to programatically select between the 2.4GHz
57  * RF interface of the CC2538, or the Sub-1GHz RF interface of the CC1200.
58  * The function is set to enable the Sub-1GHz as default,
59  * it should be called from the contiki-main initialization process.
60  *
61  * \return ignored
62  */
63 void antenna_sw_config(void);
64 
65 /**
66  * \brief Function to select between the 2.4GHz or Sub-1GHz RF interface
67  *
68  * \param val Select antenna.
69  * 2.4GHz : ANTENNA_SW_SELECT_2_4GHZ or
70  * Sub-1GHz: ANTENNA_SW_SELECT_SUBGHZ
71  * \return the selected antenna position, or ANTENNA_SW_SELECT_ERROR if not
72  * previously configured
73  */
74 int antenna_sw_select(uint8_t val);
75 
76 /**
77  * \brief Function to read the current status of the RF switch
78  *
79  *
80  * \return the selected antenna position, or ANTENNA_SW_SELECT_ERROR if not
81  * previously configured
82  */
83 int antenna_sw_get(void);
84 /* -------------------------------------------------------------------------- */
85 #endif /* ifndef ANTENNA_SW_H_ */
86 /* -------------------------------------------------------------------------- */
87 /**
88  * @}
89  * @}
90  */
void antenna_sw_config(void)
Init function for the antenna switch.
Definition: antenna-sw.c:65
int antenna_sw_get(void)
Function to read the current status of the RF switch.
Definition: antenna-sw.c:82
int antenna_sw_select(uint8_t val)
Function to select between the 2.4GHz or Sub-1GHz RF interface.
Definition: antenna-sw.c:93