Contiki-NG
rf-switch.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
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 copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 /*---------------------------------------------------------------------------*/
31 /** \addtogroup rf-core
32  * @{
33  *
34  * \defgroup rf-switch RF Switch
35  *
36  * Header file for RF switch support
37  *
38  * @{
39  *
40  * \file
41  * Header file with definitions related to RF switch support
42  */
43 /*---------------------------------------------------------------------------*/
44 #ifndef RF_SWITCH_H_
45 #define RF_SWITCH_H_
46 /*---------------------------------------------------------------------------*/
47 #include "contiki.h"
48 
49 #include <stdint.h>
50 /*---------------------------------------------------------------------------*/
51 #ifdef RF_SWITCH_CONF_PATH_2_4GHZ
52 #define RF_SWITCH_PATH_2_4GHZ RF_SWITCH_CONF_PATH_2_4GHZ
53 #else
54 #define RF_SWITCH_PATH_2_4GHZ 0
55 #endif
56 
57 #ifdef RF_SWITCH_CONF_PATH_SUBGHZ
58 #define RF_SWITCH_PATH_SUBGHZ RF_SWITCH_CONF_PATH_SUBGHZ
59 #else
60 #define RF_SWITCH_PATH_SUBGHZ 1
61 #endif
62 /*---------------------------------------------------------------------------*/
63 #ifdef RF_SWITCH_CONF_ENABLE
64 #define RF_SWITCH_ENABLE RF_SWITCH_CONF_ENABLE
65 #else
66 #define RF_SWITCH_ENABLE 0
67 #endif
68 /*---------------------------------------------------------------------------*/
69 #if RF_SWITCH_ENABLE
70 /**
71  * \brief Initialise RF switch pin states.
72  */
73 void rf_switch_init(void);
74 
75 /**
76  * \brief Power up the RF switch.
77  */
78 void rf_switch_power_up(void);
79 
80 /**
81  * \brief Power down the RF switch.
82  */
83 void rf_switch_power_down(void);
84 
85 /**
86  * \brief Select RF path
87  * \param path The RF path to select on the switch.
88  *
89  * The path argument can take values RF_SWITCH_PATH_xyz
90  */
91 void rf_switch_select_path(uint8_t path);
92 #else
93 #define rf_switch_init()
94 #define rf_switch_power_up()
95 #define rf_switch_power_down()
96 #define rf_switch_select_path(p)
97 #endif /* RF_SWITCH_ENABLE */
98 /*---------------------------------------------------------------------------*/
99 #endif /* RF_SWITCH_H_ */
100 /*---------------------------------------------------------------------------*/
101 /**
102  * @}
103  * @}
104  */