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 
9 #pragma once
10 
24 #include <stdbool.h>
25 #include <stdint.h>
26 #include "kernel_defines.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
37 #ifndef NIMBLE_CONTROLLER_PRIO
38 #define NIMBLE_CONTROLLER_PRIO (0)
39 #endif
40 
44 #ifndef NIMBLE_CONTROLLER_STACKSIZE
45 #define NIMBLE_CONTROLLER_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
46 #endif
47 
51 #ifndef NIMBLE_HOST_PRIO
52 #if IS_USED(MODULE_NIMBLE_NETIF)
53 /* when using IP, the host should have a higher prio than the netif thread, but
54  * MUST always have a lower priority then the controller thread. Setting it to
55  * controller prio plus will guarantee the latter while also matching the first
56  * condition as long as the default netif prio is not changed. */
57 #define NIMBLE_HOST_PRIO (NIMBLE_CONTROLLER_PRIO + 1)
58 #else
59 #define NIMBLE_HOST_PRIO (THREAD_PRIORITY_MAIN - 2)
60 #endif
61 #endif
62 
66 #ifndef NIMBLE_HOST_STACKSIZE
67 #define NIMBLE_HOST_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
68 #endif
69 
73 typedef enum {
76 #if IS_USED(MODULE_NIMBLE_PHY_2MBIT)
77  NIMBLE_PHY_2M,
78 #endif
79 #if IS_USED(MODULE_NIMBLE_PHY_CODED)
80  NIMBLE_PHY_CODED,
81 #endif
82 } nimble_phy_t;
83 
87 extern uint8_t nimble_riot_own_addr_type;
88 
102 extern bool nimble_port_initialized;
103 
107 void nimble_riot_init(void);
108 
114 #if MYNEWT_VAL_BLE_EXT_ADV
115 int nimble_riot_get_phy_hci(uint8_t mode);
116 #endif
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
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:73
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:75
@ NIMBLE_PHY_INVALID
PHY mode invalid.
Definition: nimble_riot.h:74
Common macros and compiler attributes/pragmas configuration.