Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew 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 :
lypinator 0:bb348c97df44 17 * File : bt_types.h
lypinator 0:bb348c97df44 18 *
lypinator 0:bb348c97df44 19 * Description : Common Bluetooth types
lypinator 0:bb348c97df44 20 *-------------------------------------------------------------------------*/
lypinator 0:bb348c97df44 21
lypinator 0:bb348c97df44 22 /**
lypinator 0:bb348c97df44 23 * @file bt_types.h
lypinator 0:bb348c97df44 24 * @brief Common Bluetooth types
lypinator 0:bb348c97df44 25 */
lypinator 0:bb348c97df44 26
lypinator 0:bb348c97df44 27 #ifndef _BT_TYPES_H_
lypinator 0:bb348c97df44 28 #define _BT_TYPES_H_
lypinator 0:bb348c97df44 29
lypinator 0:bb348c97df44 30 #include "cb_comdefs.h"
lypinator 0:bb348c97df44 31
lypinator 0:bb348c97df44 32 /*===========================================================================
lypinator 0:bb348c97df44 33 * DEFINES
lypinator 0:bb348c97df44 34 *=========================================================================*/
lypinator 0:bb348c97df44 35
lypinator 0:bb348c97df44 36 #define SIZE_OF_BD_ADDR (6)
lypinator 0:bb348c97df44 37 #define SIZE_OF_COD (3)
lypinator 0:bb348c97df44 38 #define SIZE_OF_LINK_KEY (16)
lypinator 0:bb348c97df44 39 #define SIZE_OF_NAME_INCOMING (248)
lypinator 0:bb348c97df44 40 #define SIZE_OF_NAME_OUTGOING (64)
lypinator 0:bb348c97df44 41 #define SIZE_OF_PIN_CODE ((cb_uint8)16)
lypinator 0:bb348c97df44 42 #define SIZE_OF_LAP (3)
lypinator 0:bb348c97df44 43 #define SIZE_OF_AFH_LMP_HCI_CHANNEL_MAP (10)
lypinator 0:bb348c97df44 44 #define CHANNEL_MAP_SIZE (5)
lypinator 0:bb348c97df44 45 #define SIZE_OF_EXT_INQ_RSP (240)
lypinator 0:bb348c97df44 46 #define MIN_PASSKEY_VALUE (0)
lypinator 0:bb348c97df44 47 #define MAX_PASSKEY_VALUE (999999)
lypinator 0:bb348c97df44 48 #define INVALID_CONN_HANDLE ((TConnHandle)0xFFFF)
lypinator 0:bb348c97df44 49 #define MAX_ADV_DATA_LENGTH (31)
lypinator 0:bb348c97df44 50 #define UUID_LENGTH (16)
lypinator 0:bb348c97df44 51
lypinator 0:bb348c97df44 52
lypinator 0:bb348c97df44 53 #define PACKET_TYPE_DM1 (0x0008)
lypinator 0:bb348c97df44 54 #define PACKET_TYPE_DH1 (0x0010)
lypinator 0:bb348c97df44 55 #define PACKET_TYPE_DM3 (0x0400)
lypinator 0:bb348c97df44 56 #define PACKET_TYPE_DH3 (0x0800)
lypinator 0:bb348c97df44 57 #define PACKET_TYPE_DM5 (0x4000)
lypinator 0:bb348c97df44 58 #define PACKET_TYPE_DH5 (0x8000)
lypinator 0:bb348c97df44 59
lypinator 0:bb348c97df44 60 #define PACKET_TYPE_NO_2_DH1 (0x0002)
lypinator 0:bb348c97df44 61 #define PACKET_TYPE_NO_3_DH1 (0x0004)
lypinator 0:bb348c97df44 62 #define PACKET_TYPE_NO_2_DH3 (0x0100)
lypinator 0:bb348c97df44 63 #define PACKET_TYPE_NO_3_DH3 (0x0200)
lypinator 0:bb348c97df44 64 #define PACKET_TYPE_NO_2_DH5 (0x1000)
lypinator 0:bb348c97df44 65 #define PACKET_TYPE_NO_3_DH5 (0x2000)
lypinator 0:bb348c97df44 66
lypinator 0:bb348c97df44 67 #define PACKET_TYPE_ALL (PACKET_TYPE_DM1 | PACKET_TYPE_DH1 | PACKET_TYPE_DM3 | PACKET_TYPE_DH3 | PACKET_TYPE_DM5 | PACKET_TYPE_DH5)
lypinator 0:bb348c97df44 68
lypinator 0:bb348c97df44 69 #define BD_ADDR_IS_STATIC_RANDOM(BdAddress) ((BdAddress[0] & 0xC0) == 0xC0)
lypinator 0:bb348c97df44 70 #define BD_ADDR_IS_NON_RESOLVABLE(BdAddress) ((BdAddress[0] & 0xC0) == 0x00)
lypinator 0:bb348c97df44 71 #define BD_ADDR_IS_RESOLVABLE(BdAddress) ((BdAddress[0] & 0xC0) == 0x40)
lypinator 0:bb348c97df44 72
lypinator 0:bb348c97df44 73 #define BT_INVALID_STATIC_LINK_KEY (0)
lypinator 0:bb348c97df44 74 /*===========================================================================
lypinator 0:bb348c97df44 75 * TYPES
lypinator 0:bb348c97df44 76 *=========================================================================*/
lypinator 0:bb348c97df44 77
lypinator 0:bb348c97df44 78 typedef cb_int32 int32;
lypinator 0:bb348c97df44 79 typedef cb_uint32 uint32;
lypinator 0:bb348c97df44 80 typedef cb_boolean boolean;
lypinator 0:bb348c97df44 81 typedef cb_int8 int8;
lypinator 0:bb348c97df44 82 typedef cb_uint8 uint8;
lypinator 0:bb348c97df44 83 typedef cb_int16 int16;
lypinator 0:bb348c97df44 84 typedef cb_uint16 uint16;
lypinator 0:bb348c97df44 85
lypinator 0:bb348c97df44 86 typedef cb_uint8 TErrorCode;
lypinator 0:bb348c97df44 87 typedef cb_uint8 TLinkType;
lypinator 0:bb348c97df44 88 typedef cb_uint16 TPacketType;
lypinator 0:bb348c97df44 89 typedef cb_uint16 TConnHandle;
lypinator 0:bb348c97df44 90
lypinator 0:bb348c97df44 91 typedef enum
lypinator 0:bb348c97df44 92 {
lypinator 0:bb348c97df44 93 BT_SECURITY_MODE_1 = 1,
lypinator 0:bb348c97df44 94 BT_SECURITY_MODE_2,
lypinator 0:bb348c97df44 95 BT_SECURITY_MODE_3,
lypinator 0:bb348c97df44 96 BT_SECURITY_MODE_4
lypinator 0:bb348c97df44 97
lypinator 0:bb348c97df44 98 } TSecurityMode;
lypinator 0:bb348c97df44 99
lypinator 0:bb348c97df44 100 typedef enum
lypinator 0:bb348c97df44 101 {
lypinator 0:bb348c97df44 102 BT_SECURITY_LEVEL_0 = 0,
lypinator 0:bb348c97df44 103 BT_SECURITY_LEVEL_1,
lypinator 0:bb348c97df44 104 BT_SECURITY_LEVEL_2,
lypinator 0:bb348c97df44 105 BT_SECURITY_LEVEL_3,
lypinator 0:bb348c97df44 106 // Used with security modes 1,2,3 where security level is not applicable
lypinator 0:bb348c97df44 107 BT_SECURITY_LEVEL_DUMMY = 5,
lypinator 0:bb348c97df44 108
lypinator 0:bb348c97df44 109 } TSecurityLevel;
lypinator 0:bb348c97df44 110
lypinator 0:bb348c97df44 111
lypinator 0:bb348c97df44 112 typedef enum
lypinator 0:bb348c97df44 113 {
lypinator 0:bb348c97df44 114 BT_MASTER_SLAVE_POLICY_ALWAYS_MASTER = 0,
lypinator 0:bb348c97df44 115 BT_MASTER_SLAVE_POLICY_OTHER_SIDE_DECIDE = 1
lypinator 0:bb348c97df44 116
lypinator 0:bb348c97df44 117 } TMasterSlavePolicy;
lypinator 0:bb348c97df44 118
lypinator 0:bb348c97df44 119 typedef enum
lypinator 0:bb348c97df44 120 {
lypinator 0:bb348c97df44 121 BT_TYPE_CLASSIC = 0,
lypinator 0:bb348c97df44 122 BT_TYPE_LOW_ENERGY = 1
lypinator 0:bb348c97df44 123
lypinator 0:bb348c97df44 124 } TBluetoothType;
lypinator 0:bb348c97df44 125
lypinator 0:bb348c97df44 126 typedef enum
lypinator 0:bb348c97df44 127 {
lypinator 0:bb348c97df44 128 BT_PUBLIC_ADDRESS = 0x00,
lypinator 0:bb348c97df44 129 BT_RANDOM_ADDRESS = 0x01,
lypinator 0:bb348c97df44 130
lypinator 0:bb348c97df44 131 } TAddressType;
lypinator 0:bb348c97df44 132
lypinator 0:bb348c97df44 133 typedef struct
lypinator 0:bb348c97df44 134 {
lypinator 0:bb348c97df44 135 cb_uint8 BdAddress[SIZE_OF_BD_ADDR];
lypinator 0:bb348c97df44 136 TAddressType AddrType;
lypinator 0:bb348c97df44 137
lypinator 0:bb348c97df44 138 } TBdAddr;
lypinator 0:bb348c97df44 139
lypinator 0:bb348c97df44 140 typedef struct
lypinator 0:bb348c97df44 141 {
lypinator 0:bb348c97df44 142 cb_uint8 Cod[SIZE_OF_COD];
lypinator 0:bb348c97df44 143
lypinator 0:bb348c97df44 144 } TCod;
lypinator 0:bb348c97df44 145
lypinator 0:bb348c97df44 146 typedef struct
lypinator 0:bb348c97df44 147 {
lypinator 0:bb348c97df44 148 cb_uint8 LinkKey[SIZE_OF_LINK_KEY];
lypinator 0:bb348c97df44 149
lypinator 0:bb348c97df44 150 } TLinkKey;
lypinator 0:bb348c97df44 151
lypinator 0:bb348c97df44 152 typedef struct
lypinator 0:bb348c97df44 153 {
lypinator 0:bb348c97df44 154 cb_uint8 Name[SIZE_OF_NAME_INCOMING];
lypinator 0:bb348c97df44 155
lypinator 0:bb348c97df44 156 } TName;
lypinator 0:bb348c97df44 157
lypinator 0:bb348c97df44 158 typedef struct
lypinator 0:bb348c97df44 159 {
lypinator 0:bb348c97df44 160 cb_uint8 Name[SIZE_OF_NAME_OUTGOING];
lypinator 0:bb348c97df44 161
lypinator 0:bb348c97df44 162 } TNameOutgoing;
lypinator 0:bb348c97df44 163
lypinator 0:bb348c97df44 164 typedef struct
lypinator 0:bb348c97df44 165 {
lypinator 0:bb348c97df44 166 cb_uint8 PinCode[SIZE_OF_PIN_CODE];
lypinator 0:bb348c97df44 167
lypinator 0:bb348c97df44 168 } TPinCode;
lypinator 0:bb348c97df44 169
lypinator 0:bb348c97df44 170 typedef cb_uint32 TPasskey;
lypinator 0:bb348c97df44 171
lypinator 0:bb348c97df44 172 typedef struct
lypinator 0:bb348c97df44 173 {
lypinator 0:bb348c97df44 174 cb_uint8 Lap[SIZE_OF_LAP];
lypinator 0:bb348c97df44 175
lypinator 0:bb348c97df44 176 } TLap;
lypinator 0:bb348c97df44 177
lypinator 0:bb348c97df44 178 typedef struct
lypinator 0:bb348c97df44 179 {
lypinator 0:bb348c97df44 180 cb_uint8 Data[SIZE_OF_EXT_INQ_RSP];
lypinator 0:bb348c97df44 181
lypinator 0:bb348c97df44 182 } TExtInqRsp;
lypinator 0:bb348c97df44 183
lypinator 0:bb348c97df44 184 typedef cb_uint8 TAfhLmpHciChannelMap[SIZE_OF_AFH_LMP_HCI_CHANNEL_MAP];
lypinator 0:bb348c97df44 185
lypinator 0:bb348c97df44 186 typedef struct
lypinator 0:bb348c97df44 187 {
lypinator 0:bb348c97df44 188 uint16 channel[CHANNEL_MAP_SIZE];
lypinator 0:bb348c97df44 189 } TChannelMap;
lypinator 0:bb348c97df44 190
lypinator 0:bb348c97df44 191
lypinator 0:bb348c97df44 192 typedef enum
lypinator 0:bb348c97df44 193 {
lypinator 0:bb348c97df44 194 BT_ADV_TYPE_ADV = 0x01,
lypinator 0:bb348c97df44 195 BT_ADV_TYPE_SCAN = 0x00,
lypinator 0:bb348c97df44 196 } TAdvDataType;
lypinator 0:bb348c97df44 197
lypinator 0:bb348c97df44 198 typedef struct
lypinator 0:bb348c97df44 199 {
lypinator 0:bb348c97df44 200 TAdvDataType type;
lypinator 0:bb348c97df44 201 cb_uint8 length;
lypinator 0:bb348c97df44 202 cb_uint8 data[MAX_ADV_DATA_LENGTH];
lypinator 0:bb348c97df44 203 } TAdvData;
lypinator 0:bb348c97df44 204
lypinator 0:bb348c97df44 205 typedef struct
lypinator 0:bb348c97df44 206 {
lypinator 0:bb348c97df44 207 cb_uint16 createConnectionTimeout;
lypinator 0:bb348c97df44 208 cb_uint16 connectionIntervalMin;
lypinator 0:bb348c97df44 209 cb_uint16 connectionIntervalMax;
lypinator 0:bb348c97df44 210 cb_uint16 connectionLatency;
lypinator 0:bb348c97df44 211 cb_uint16 linkLossTimeout;
lypinator 0:bb348c97df44 212 cb_uint16 scanInterval;
lypinator 0:bb348c97df44 213 cb_uint16 scanWindow;
lypinator 0:bb348c97df44 214 } TAclParamsLe;
lypinator 0:bb348c97df44 215
lypinator 0:bb348c97df44 216 #endif /* _BT_TYPES_H */