NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
ble_ll_rfmgmt.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef H_BLE_LL_RFMGMT_
21#define H_BLE_LL_RFMGMT_
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include "ble_ll_tmr.h"
28
29void ble_ll_rfmgmt_init(void);
30
31#if MYNEWT_VAL(BLE_LL_RFMGMT_ENABLE_TIME) > 0
32
33void ble_ll_rfmgmt_reset(void);
34
35/* Notify rfmgmt that scan window has changed (only called from ble_ll_scan) */
36void ble_ll_rfmgmt_scan_changed(bool enabled, uint32_t next_window);
37
38/* Notify rfmgmt that 1st scheduled item has changed (only called from ble_ll_sched) */
39void ble_ll_rfmgmt_sched_changed(struct ble_ll_sched_item *first);
40
41/* Notify rfmgmt that RF is no longer needed by current event */
42void ble_ll_rfmgmt_release(void);
43
44/* Enables RF immediately and returns tick at which RF will be fully enabled */
45uint32_t ble_ll_rfmgmt_enable_now(void);
46
47/* Returns true only if RF is currently fully enabled (i.e. not off or enabling) */
48bool ble_ll_rfmgmt_is_enabled(void);
49
50#else
51
52static inline void ble_ll_rfmgmt_reset(void) { }
53static inline void ble_ll_rfmgmt_scan_changed(bool e, uint32_t n) { }
54static inline void ble_ll_rfmgmt_sched_changed(struct ble_ll_sched_item *f) { }
55static inline void ble_ll_rfmgmt_release(void) { }
56static inline uint32_t ble_ll_rfmgmt_enable_now(void) { return ble_ll_tmr_get(); }
57static inline bool ble_ll_rfmgmt_is_enabled(void) { return true; }
58
59#endif
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif /* H_BLE_LL_RFMGMT_ */