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 : Wireless LAN driver
lypinator 0:bb348c97df44 17 * File : cb_types.h
lypinator 0:bb348c97df44 18 *
lypinator 0:bb348c97df44 19 * Description : Common definitions for a GCC compatible compiler.
lypinator 0:bb348c97df44 20 *-------------------------------------------------------------------------*/
lypinator 0:bb348c97df44 21
lypinator 0:bb348c97df44 22 /**
lypinator 0:bb348c97df44 23 * @file cb_types.h Defines type required for the entire driver.
lypinator 0:bb348c97df44 24 * The defines in this file will have to be adapted for the platform.
lypinator 0:bb348c97df44 25 * @ingroup platform
lypinator 0:bb348c97df44 26 */
lypinator 0:bb348c97df44 27
lypinator 0:bb348c97df44 28 #ifndef _CB_PLATFORM_BASIC_TYPES_H_
lypinator 0:bb348c97df44 29 #define _CB_PLATFORM_BASIC_TYPES_H_
lypinator 0:bb348c97df44 30
lypinator 0:bb348c97df44 31 #include <stdint.h>
lypinator 0:bb348c97df44 32 #include <stdbool.h>
lypinator 0:bb348c97df44 33
lypinator 0:bb348c97df44 34 /*===========================================================================
lypinator 0:bb348c97df44 35 * TYPES
lypinator 0:bb348c97df44 36 *=========================================================================*/
lypinator 0:bb348c97df44 37
lypinator 0:bb348c97df44 38 /*===========================================================================
lypinator 0:bb348c97df44 39 * COMMON SYSTEM DEFINES
lypinator 0:bb348c97df44 40 *=========================================================================*/
lypinator 0:bb348c97df44 41
lypinator 0:bb348c97df44 42 typedef int8_t cb_int8;
lypinator 0:bb348c97df44 43 typedef int16_t cb_int16;
lypinator 0:bb348c97df44 44 typedef int32_t cb_int32;
lypinator 0:bb348c97df44 45 typedef int64_t cb_int64;
lypinator 0:bb348c97df44 46
lypinator 0:bb348c97df44 47 typedef uint8_t cb_uint8;
lypinator 0:bb348c97df44 48 typedef uint16_t cb_uint16;
lypinator 0:bb348c97df44 49 typedef uint32_t cb_uint32;
lypinator 0:bb348c97df44 50 typedef uint64_t cb_uint64;
lypinator 0:bb348c97df44 51
lypinator 0:bb348c97df44 52 typedef bool cb_boolean;
lypinator 0:bb348c97df44 53 typedef char cb_char;
lypinator 0:bb348c97df44 54 typedef int cb_int;
lypinator 0:bb348c97df44 55
lypinator 0:bb348c97df44 56 /**
lypinator 0:bb348c97df44 57 * Used when declaring an empty array that does not take up space in a struct.
lypinator 0:bb348c97df44 58 * Example: struct { cb_uint8 payload[cb_EMPTY_ARRAY]; }
lypinator 0:bb348c97df44 59 * In some compilers this is empty i.e. payload[]. While in some it requires a zero.
lypinator 0:bb348c97df44 60 * I.e. payload[0];
lypinator 0:bb348c97df44 61 * Use this define to get it working for your system.
lypinator 0:bb348c97df44 62 */
lypinator 0:bb348c97df44 63 #define cb_EMPTY_ARRAY (0)
lypinator 0:bb348c97df44 64
lypinator 0:bb348c97df44 65 /*===========================================================================
lypinator 0:bb348c97df44 66 * DEFINES
lypinator 0:bb348c97df44 67 *=========================================================================*/
lypinator 0:bb348c97df44 68
lypinator 0:bb348c97df44 69 /**
lypinator 0:bb348c97df44 70 * Used in function definitions to declare an input parameter unused to avoid warnings.
lypinator 0:bb348c97df44 71 */
lypinator 0:bb348c97df44 72 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
lypinator 0:bb348c97df44 73 #define cb_UNUSED(x) UNUSED_ ## x __attribute__((unused))
lypinator 0:bb348c97df44 74 #else
lypinator 0:bb348c97df44 75 #define cb_UNUSED(x) UNUSED_ ## x
lypinator 0:bb348c97df44 76 #endif
lypinator 0:bb348c97df44 77
lypinator 0:bb348c97df44 78
lypinator 0:bb348c97df44 79 /**
lypinator 0:bb348c97df44 80 * Define cb_ASSERT to the wanted assert handler.
lypinator 0:bb348c97df44 81 */
lypinator 0:bb348c97df44 82 /*
lypinator 0:bb348c97df44 83 #define cb_ASSERT(exp) do { if (!(exp)) { \
lypinator 0:bb348c97df44 84 W_PRINT("ASSERT %s:%d\n", __FILE__, __LINE__); \
lypinator 0:bb348c97df44 85 while(1); \
lypinator 0:bb348c97df44 86 } } while(0)
lypinator 0:bb348c97df44 87 */
lypinator 0:bb348c97df44 88 #include "cb_assert.h"
lypinator 0:bb348c97df44 89
lypinator 0:bb348c97df44 90
lypinator 0:bb348c97df44 91 /**@{*/
lypinator 0:bb348c97df44 92 /**
lypinator 0:bb348c97df44 93 * Packed struct defines.
lypinator 0:bb348c97df44 94 * - cb_PACKED_STRUCT_ATTR_PRE is used before the typedef'ed struct declaration.
lypinator 0:bb348c97df44 95 * - cb_PACKED_STRUCT_ATTR_INLINE_PRE is after the typedef but before the struct declaration.
lypinator 0:bb348c97df44 96 * - cb_PACKED_STRUCT_ATTR_INLINE_POST is used after the struct declaration but before the typedef'ed name.
lypinator 0:bb348c97df44 97 * - cb_PACKED_STRUCT_ATTR_POST is used after the entire struct declaration.
lypinator 0:bb348c97df44 98 *
lypinator 0:bb348c97df44 99 * example:
lypinator 0:bb348c97df44 100 * cb_PACKED_STRUCT_ATTR_PRE
lypinator 0:bb348c97df44 101 * typedef cb_PACKED_STRUCT_ATTR_INLINE_PRE struct myPackedStruct {
lypinator 0:bb348c97df44 102 * int a;
lypinator 0:bb348c97df44 103 * int b;
lypinator 0:bb348c97df44 104 * } cb_PACKED_STRUCT_ATTR_INLINE_POST myPackedStruct
lypinator 0:bb348c97df44 105 * cb_PACKED_STRUCT_ATTR_POST
lypinator 0:bb348c97df44 106 *
lypinator 0:bb348c97df44 107 */
lypinator 0:bb348c97df44 108
lypinator 0:bb348c97df44 109 #define cb_PACKED_STRUCT_ATTR_PRE
lypinator 0:bb348c97df44 110
lypinator 0:bb348c97df44 111 #if defined(__ICCARM__)
lypinator 0:bb348c97df44 112 #define cb_PACKED_STRUCT_ATTR_INLINE_PRE __packed
lypinator 0:bb348c97df44 113 #else
lypinator 0:bb348c97df44 114 #define cb_PACKED_STRUCT_ATTR_INLINE_PRE
lypinator 0:bb348c97df44 115 #endif
lypinator 0:bb348c97df44 116
lypinator 0:bb348c97df44 117 #if defined(__ICCARM__)
lypinator 0:bb348c97df44 118 #define cb_PACKED_STRUCT_ATTR_INLINE_POST __packed
lypinator 0:bb348c97df44 119 #else
lypinator 0:bb348c97df44 120 #define cb_PACKED_STRUCT_ATTR_INLINE_POST __attribute__ ((__packed__))
lypinator 0:bb348c97df44 121 #endif
lypinator 0:bb348c97df44 122
lypinator 0:bb348c97df44 123
lypinator 0:bb348c97df44 124 #define cb_PACKED_STRUCT_ATTR_POST
lypinator 0:bb348c97df44 125
lypinator 0:bb348c97df44 126 /**@}*/
lypinator 0:bb348c97df44 127
lypinator 0:bb348c97df44 128
lypinator 0:bb348c97df44 129 #endif /* _CB_PLATFORM_BASIC_TYPES_H_ */
lypinator 0:bb348c97df44 130