nimble_riot.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef NIMBLE_RIOT_H
23 #define NIMBLE_RIOT_H
24 
25 #include <stdbool.h>
26 #include <stdint.h>
27 #include "kernel_defines.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
38 #ifndef NIMBLE_CONTROLLER_PRIO
39 #define NIMBLE_CONTROLLER_PRIO (0)
40 #endif
41 
45 #ifndef NIMBLE_CONTROLLER_STACKSIZE
46 #define NIMBLE_CONTROLLER_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
47 #endif
48 
52 #ifndef NIMBLE_HOST_PRIO
53 #if IS_USED(MODULE_NIMBLE_NETIF)
54 /* when using IP, the host should have a higher prio than the netif thread, but
55  * MUST always have a lower priority then the controller thread. Setting it to
56  * controller prio plus will guarantee the latter while also matching the first
57  * condition as long as the default netif prio is not changed. */
58 #define NIMBLE_HOST_PRIO (NIMBLE_CONTROLLER_PRIO + 1)
59 #else
60 #define NIMBLE_HOST_PRIO (THREAD_PRIORITY_MAIN - 2)
61 #endif
62 #endif
63 
67 #ifndef NIMBLE_HOST_STACKSIZE
68 #define NIMBLE_HOST_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
69 #endif
70 
74 typedef enum {
77 #if IS_USED(MODULE_NIMBLE_PHY_2MBIT)
78  NIMBLE_PHY_2M,
79 #endif
80 #if IS_USED(MODULE_NIMBLE_PHY_CODED)
81  NIMBLE_PHY_CODED,
82 #endif
83 } nimble_phy_t;
84 
88 extern uint8_t nimble_riot_own_addr_type;
89 
103 extern bool nimble_port_initialized;
104 
108 void nimble_riot_init(void);
109 
115 #if MYNEWT_VAL_BLE_EXT_ADV
116 int nimble_riot_get_phy_hci(uint8_t mode);
117 #endif
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* NIMBLE_RIOT_H */
bool nimble_port_initialized
Indicates whether Setup NimBLE's controller has been initialized.
uint8_t nimble_riot_own_addr_type
Export our own address type for later usage.
nimble_phy_t
BLE PHY modes.
Definition: nimble_riot.h:74
void nimble_riot_init(void)
Setup and run NimBLE's controller and host threads.
@ NIMBLE_PHY_1M
legacy 1Mbit PHY mode (always supported)
Definition: nimble_riot.h:76
@ NIMBLE_PHY_INVALID
PHY mode invalid.
Definition: nimble_riot.h:75
Common macros and compiler attributes/pragmas configuration.