Digi XBee(R) ANSI C Host Library
platform_config.h
1 /*
2  * Copyright (c) 2017 Digi International Inc.,
3  * All rights not expressly granted are reserved.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
7  * You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
10  * =======================================================================
11  */
19 #ifndef __XBEE_PLATFORM_EFM32
20 #define __XBEE_PLATFORM_EFM32
21 
22  // The necessary includes for Micrium OS
23 #ifdef EFM32_MICRIUM
24  #include <rtos/cpu/include/cpu.h>
25  #include <rtos/common/include/common.h>
26  #include <rtos/kernel/include/os.h>
27 
28  #include <rtos/common/include/rtos_err.h>
29  #include <rtos/common/include/rtos_utils.h>
30 #endif
31 
32  // The necessary includes for the efm32 board
33  #include "em_device.h"
34  #include "em_usart.h"
35  #include "em_cmu.h"
36  #include "em_core.h"
37  #include "em_gpio.h"
38 
39  // stdint.h for int8_t, uint8_t, int16_t, etc. types
40  #include <stdint.h>
41  #include <errno.h>
42  #include <inttypes.h>
43 
44  #define _f_memcpy memcpy
45  #define _f_memset memset
46 
47  // Must define since GDK doesn't have endian.h (the values must be unique)
48  #define LITTLE_ENDIAN 4321
49  #define BIG_ENDIAN 1234
50  #define BYTE_ORDER LITTLE_ENDIAN //This is hard-coded, but can be checked
51 
52  // macros used to declare a packed structure (no alignment of elements)
53  // The more-flexible XBEE_PACKED() replaced PACKED_STRUCT in 2019.
54  #define PACKED_STRUCT struct __attribute__ ((__packed__))
55  #define XBEE_PACKED(name, decl) PACKED_STRUCT name decl
56 
57  typedef uint8_t bool_t; // could instead use <stdbool.h>
58 
59  typedef struct xbee_serial_t {
60  uint32_t baudrate;
61  } xbee_serial_t;
62 
63  #define XBEE_MS_TIMER_RESOLUTION 1 // Our timer has 1 ms resolution
64  #define ZCL_TIME_EPOCH_DELTA 0
65 
66 #if defined(__cplusplus)
67  extern "C" {
68 #endif
69  int xbee_platform_init(void);
70  #define XBEE_PLATFORM_INIT() xbee_platform_init()
71 #if defined(__cplusplus)
72  }
73 #endif
74 #endif /* __XBEE_PLATFORM_EFM32 */
75 
unsigned long uint32_t
32-bit unsigned integer
Definition: platform_config.h:43
Definition: platform_config.h:71
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
int bool_t
Variable that can hold 0 or 1, may be an int for speed purporses or uint8_t for size optimization...
Definition: platform_config.h:51