Initial commit
mbed-dev-master/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/cb_main.h@0:bb348c97df44, 2020-09-16 (annotated)
- Committer:
- lypinator
- Date:
- Wed Sep 16 01:11:49 2020 +0000
- Revision:
- 0:bb348c97df44
Added PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lypinator | 0:bb348c97df44 | 1 | /*--------------------------------------------------------------------------- |
lypinator | 0:bb348c97df44 | 2 | * Copyright (c) 2016, u-blox Malmö, All Rights Reserved |
lypinator | 0:bb348c97df44 | 3 | * SPDX-License-Identifier: LicenseRef-PBL |
lypinator | 0:bb348c97df44 | 4 | * |
lypinator | 0:bb348c97df44 | 5 | * This file and the related binary are licensed under the |
lypinator | 0:bb348c97df44 | 6 | * Permissive Binary License, Version 1.0 (the "License"); |
lypinator | 0:bb348c97df44 | 7 | * you may not use these files except in compliance with the License. |
lypinator | 0:bb348c97df44 | 8 | * |
lypinator | 0:bb348c97df44 | 9 | * You may obtain a copy of the License here: |
lypinator | 0:bb348c97df44 | 10 | * LICENSE-permissive-binary-license-1.0.txt and at |
lypinator | 0:bb348c97df44 | 11 | * https://www.mbed.com/licenses/PBL-1.0 |
lypinator | 0:bb348c97df44 | 12 | * |
lypinator | 0:bb348c97df44 | 13 | * See the License for the specific language governing permissions and |
lypinator | 0:bb348c97df44 | 14 | * limitations under the License. |
lypinator | 0:bb348c97df44 | 15 | * |
lypinator | 0:bb348c97df44 | 16 | * Component: Main for WiFi-driver and BT stack |
lypinator | 0:bb348c97df44 | 17 | * File : cb_main.h |
lypinator | 0:bb348c97df44 | 18 | * |
lypinator | 0:bb348c97df44 | 19 | * Description : |
lypinator | 0:bb348c97df44 | 20 | *-------------------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 21 | |
lypinator | 0:bb348c97df44 | 22 | #ifndef _CB_MAIN_H_ |
lypinator | 0:bb348c97df44 | 23 | #define _CB_MAIN_H_ |
lypinator | 0:bb348c97df44 | 24 | |
lypinator | 0:bb348c97df44 | 25 | #include "bt_types.h" |
lypinator | 0:bb348c97df44 | 26 | #include "cb_bt_man.h" |
lypinator | 0:bb348c97df44 | 27 | #include "cb_wlan.h" |
lypinator | 0:bb348c97df44 | 28 | #include "mbed_events.h" |
lypinator | 0:bb348c97df44 | 29 | |
lypinator | 0:bb348c97df44 | 30 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 31 | * DEFINES |
lypinator | 0:bb348c97df44 | 32 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 33 | #define cbMAIN_TARGET_INVALID_ID -1 |
lypinator | 0:bb348c97df44 | 34 | |
lypinator | 0:bb348c97df44 | 35 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 36 | * TYPES |
lypinator | 0:bb348c97df44 | 37 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 38 | typedef struct |
lypinator | 0:bb348c97df44 | 39 | { |
lypinator | 0:bb348c97df44 | 40 | TBdAddr address; /** Bluetooth address that shall be assigned to controller. Pass invalidBdAddress to use controller default address*/ |
lypinator | 0:bb348c97df44 | 41 | cbBM_LeRole leRole; /** Bluetooth low energy role */ |
lypinator | 0:bb348c97df44 | 42 | cb_int8 maxOutputPower; /** Maximum output power. */ |
lypinator | 0:bb348c97df44 | 43 | cb_uint32 maxLinkKeysClassic; /** Max number of CLASSIC link keys */ |
lypinator | 0:bb348c97df44 | 44 | cb_uint32 maxLinkKeysLe; /** Max number of link keys BLE*/ |
lypinator | 0:bb348c97df44 | 45 | } cbMAIN_BtInitParams; |
lypinator | 0:bb348c97df44 | 46 | |
lypinator | 0:bb348c97df44 | 47 | typedef void(*cbMAIN_ErrorHandler)( |
lypinator | 0:bb348c97df44 | 48 | cb_int32 errorCode, |
lypinator | 0:bb348c97df44 | 49 | const cb_char* filename, |
lypinator | 0:bb348c97df44 | 50 | cb_uint32 line); |
lypinator | 0:bb348c97df44 | 51 | |
lypinator | 0:bb348c97df44 | 52 | typedef struct |
lypinator | 0:bb348c97df44 | 53 | { |
lypinator | 0:bb348c97df44 | 54 | cbWLAN_MACAddress mac; /**< MAC of WLAN interface, set to all zeros if hardware programmed address should be used. */ |
lypinator | 0:bb348c97df44 | 55 | cbWM_TxPowerSettings txPowerSettings; /**< Transmission power settings. */ |
lypinator | 0:bb348c97df44 | 56 | } cbMAIN_WlanStartParams; |
lypinator | 0:bb348c97df44 | 57 | |
lypinator | 0:bb348c97df44 | 58 | /*--------------------------------------------------------------------------- |
lypinator | 0:bb348c97df44 | 59 | * Callback to indicate that initialization of BT stack is completed. |
lypinator | 0:bb348c97df44 | 60 | *-------------------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 61 | typedef void(*cbMAIN_initBtComplete)(void); |
lypinator | 0:bb348c97df44 | 62 | |
lypinator | 0:bb348c97df44 | 63 | /*=========================================================================== |
lypinator | 0:bb348c97df44 | 64 | * FUNCTIONS |
lypinator | 0:bb348c97df44 | 65 | *=========================================================================*/ |
lypinator | 0:bb348c97df44 | 66 | |
lypinator | 0:bb348c97df44 | 67 | /** |
lypinator | 0:bb348c97df44 | 68 | * Initialize OS, timers, GPIO's, heap and OTP. |
lypinator | 0:bb348c97df44 | 69 | * |
lypinator | 0:bb348c97df44 | 70 | * @return void |
lypinator | 0:bb348c97df44 | 71 | */ |
lypinator | 0:bb348c97df44 | 72 | extern void cbMAIN_initOS(void); |
lypinator | 0:bb348c97df44 | 73 | |
lypinator | 0:bb348c97df44 | 74 | /** |
lypinator | 0:bb348c97df44 | 75 | * Start Bluetooth HW. |
lypinator | 0:bb348c97df44 | 76 | * |
lypinator | 0:bb348c97df44 | 77 | * @param pInitParameters Initial configuration parameters. These parameters can |
lypinator | 0:bb348c97df44 | 78 | * not be changed once Bluetooth has been started. |
lypinator | 0:bb348c97df44 | 79 | * @param callback Will be invoked when initialisation is done. |
lypinator | 0:bb348c97df44 | 80 | * @return void |
lypinator | 0:bb348c97df44 | 81 | */ |
lypinator | 0:bb348c97df44 | 82 | extern void cbMAIN_initBt(cbMAIN_BtInitParams *pInitParameters, cbMAIN_initBtComplete callback); |
lypinator | 0:bb348c97df44 | 83 | |
lypinator | 0:bb348c97df44 | 84 | /** |
lypinator | 0:bb348c97df44 | 85 | * Initialize WLAN component. |
lypinator | 0:bb348c97df44 | 86 | * @return Port specific TARGET identifier |
lypinator | 0:bb348c97df44 | 87 | */ |
lypinator | 0:bb348c97df44 | 88 | extern cb_int32 cbMAIN_initWlan(void); |
lypinator | 0:bb348c97df44 | 89 | |
lypinator | 0:bb348c97df44 | 90 | /** |
lypinator | 0:bb348c97df44 | 91 | * Start WLAN component. |
lypinator | 0:bb348c97df44 | 92 | * Create WLAN driver instance, bind it to targetId and start the driver. |
lypinator | 0:bb348c97df44 | 93 | * |
lypinator | 0:bb348c97df44 | 94 | * @param targetId Port specific TARGET identifier. |
lypinator | 0:bb348c97df44 | 95 | * @param params Start parameters passed to WLAN driver instance. |
lypinator | 0:bb348c97df44 | 96 | * @return cbSTATUS_OK if successful, otherwise cbSTATUS_ERROR. |
lypinator | 0:bb348c97df44 | 97 | */ |
lypinator | 0:bb348c97df44 | 98 | extern cb_int32 cbMAIN_startWlan(cb_int32 targetId, cbMAIN_WlanStartParams *params); |
lypinator | 0:bb348c97df44 | 99 | |
lypinator | 0:bb348c97df44 | 100 | /** |
lypinator | 0:bb348c97df44 | 101 | * Register error handler function. |
lypinator | 0:bb348c97df44 | 102 | * |
lypinator | 0:bb348c97df44 | 103 | * @param errHandler Function to be invoked in case of error. |
lypinator | 0:bb348c97df44 | 104 | * @return void |
lypinator | 0:bb348c97df44 | 105 | */ |
lypinator | 0:bb348c97df44 | 106 | extern void cbMAIN_registerErrorHandler(cbMAIN_ErrorHandler errHandler); |
lypinator | 0:bb348c97df44 | 107 | |
lypinator | 0:bb348c97df44 | 108 | /** |
lypinator | 0:bb348c97df44 | 109 | * Start driver OS. This must be called after all cbMAIN_initOS/cbMAIN_initBt/cbMAIN_initWlan |
lypinator | 0:bb348c97df44 | 110 | * to start the driver thread. |
lypinator | 0:bb348c97df44 | 111 | * |
lypinator | 0:bb348c97df44 | 112 | * @return void |
lypinator | 0:bb348c97df44 | 113 | */ |
lypinator | 0:bb348c97df44 | 114 | extern void cbMAIN_startOS(void); |
lypinator | 0:bb348c97df44 | 115 | |
lypinator | 0:bb348c97df44 | 116 | /** |
lypinator | 0:bb348c97df44 | 117 | * Get event queue. Used for running a function in the same thread context as the driver. |
lypinator | 0:bb348c97df44 | 118 | * Can not be called before cbMAIN_initOS/cbMAIN_initBt/cbMAIN_initWlan. |
lypinator | 0:bb348c97df44 | 119 | * Use cbMAIN_dispatchEventQueue to trigger the driver to call the queued up functions. |
lypinator | 0:bb348c97df44 | 120 | * @return EventQueue Pointer to the event queue where function calls can be enqueued. |
lypinator | 0:bb348c97df44 | 121 | */ |
lypinator | 0:bb348c97df44 | 122 | extern EventQueue* cbMAIN_getEventQueue(void); |
lypinator | 0:bb348c97df44 | 123 | |
lypinator | 0:bb348c97df44 | 124 | /** |
lypinator | 0:bb348c97df44 | 125 | * Lock driver from usage. This must be used if a C API function is used outside of the driver thread context. |
lypinator | 0:bb348c97df44 | 126 | * The driver should only be locked for as small time as possible. |
lypinator | 0:bb348c97df44 | 127 | * @return void |
lypinator | 0:bb348c97df44 | 128 | */ |
lypinator | 0:bb348c97df44 | 129 | extern void cbMAIN_driverLock(void); |
lypinator | 0:bb348c97df44 | 130 | |
lypinator | 0:bb348c97df44 | 131 | /** |
lypinator | 0:bb348c97df44 | 132 | * Unlock driver. used when the C API function has finished executing to release the driver for others to use. |
lypinator | 0:bb348c97df44 | 133 | * |
lypinator | 0:bb348c97df44 | 134 | * @return void |
lypinator | 0:bb348c97df44 | 135 | */ |
lypinator | 0:bb348c97df44 | 136 | extern void cbMAIN_driverUnlock(void); |
lypinator | 0:bb348c97df44 | 137 | |
lypinator | 0:bb348c97df44 | 138 | /** |
lypinator | 0:bb348c97df44 | 139 | * Dispatch event queue. Should be called to trigger calls that have been queued up in the driver context |
lypinator | 0:bb348c97df44 | 140 | * |
lypinator | 0:bb348c97df44 | 141 | * @return void |
lypinator | 0:bb348c97df44 | 142 | */ |
lypinator | 0:bb348c97df44 | 143 | extern void cbMAIN_dispatchEventQueue(void); |
lypinator | 0:bb348c97df44 | 144 | |
lypinator | 0:bb348c97df44 | 145 | #endif /*_CB_MAIN_H_*/ |