Contiki 3.x
platform-conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Nordic Semiconductor
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 /**
32  * \addtogroup platform
33  * @{
34  *
35  * \addtogroup nrf52dk nRF52 Development Kit
36  * @{
37  *
38  * \addtogroup nrf52dk-platform-conf Platform configuration
39  * @{
40  * \file
41  * Platform features configuration.
42  * \author
43  * Wojciech Bober <wojciech.bober@nordicsemi.no>
44  *
45  */
46 #ifndef PLATFORM_CONF_H_
47 #define PLATFORM_CONF_H_
48 
49 #include "boards.h"
50 
51 #define PLATFORM_HAS_BATTERY 0
52 #define PLATFORM_HAS_RADIO 0
53 #define PLATFORM_HAS_TEMPERATURE 1
54 
55 /**
56  * \name Leds configurations
57  *
58  * On nRF52dk all leds are green.
59  *
60  * @{
61  */
62 #define PLATFORM_HAS_LEDS 1
63 
64 #define LEDS_1 (1 << (LED_1 - LED_START)) // 1
65 #define LEDS_2 (1 << (LED_2 - LED_START)) // 2
66 #define LEDS_3 (1 << (LED_3 - LED_START)) // 4
67 #define LEDS_4 (1 << (LED_4 - LED_START)) // 8
68 
69 #define LEDS_GREEN LEDS_1
70 #define LEDS_YELLOW LEDS_2
71 #define LEDS_RED LEDS_3
72 #define LEDS_BLUE LEDS_4
73 
74 #define LEDS_CONF_ALL (LEDS_1 | LEDS_2 | LEDS_3 | LEDS_4)
75 
76 /**
77  * \brief If set to 1 then LED1 and LED2 are used by the
78  * platform to indicate BLE connection state.
79  */
80 #define PLATFORM_INDICATE_BLE_STATE 1
81 /** @} */
82 
83 /**
84  * \name Button configurations
85  *
86  * @{
87  */
88 /* Notify various examples that we have Buttons */
89 #define PLATFORM_HAS_BUTTON 1
90 
91 /*
92  * Override button symbols from dev/button-sensor.h, for the examples that
93  * include it
94  */
95 #define button_sensor button_1
96 #define button_sensor2 button_2
97 
98 /**
99  * \brief nRF52 RTC instance to be used for Contiki clock driver.
100  * \note RTC 0 is used by the SoftDevice.
101  */
102 #define PLATFORM_RTC_INSTANCE_ID 1
103 
104 /**
105  * \brief nRF52 timer instance to be used for Contiki rtimer driver.
106  * \note Timer 0 is used by the SoftDevice.
107  */
108 #define PLATFORM_TIMER_INSTANCE_ID 1
109 
110 /** @} */
111 /*---------------------------------------------------------------------------*/
112 /**
113  * \name Compiler configuration and platform-specific type definitions
114  *
115  * Those values are not meant to be modified by the user
116  * @{
117  */
118 #define CLOCK_CONF_SECOND 128
119 
120 /* Compiler configurations */
121 #define CCIF
122 #define CLIF
123 
124 /* Platform typedefs */
125 typedef uint32_t clock_time_t;
126 typedef uint32_t uip_stats_t;
127 
128 /* Clock (time) comparison macro */
129 #define CLOCK_LT(a, b) ((signed long)((a) - (b)) < 0)
130 
131 #define RTIMER_ARCH_SECOND 62500
132 /*
133  * rtimer.h typedefs rtimer_clock_t as unsigned short. We need to define
134  * RTIMER_CLOCK_DIFF to override this
135  */
136 typedef uint32_t rtimer_clock_t;
137 #define RTIMER_CLOCK_DIFF(a,b) ((int32_t)((a)-(b)))
138 
139 /** @} */
140 /*---------------------------------------------------------------------------*/
141 /** @}
142  * @}
143  * @}
144  */
145 #endif /* PLATFORM_CONF_H_ */