Update platform drivers
src/uart_extra.h@9:9e247b9c9abf, 2020-06-15 (annotated)
- Committer:
- EndaKilgarriff
- Date:
- Mon Jun 15 13:03:55 2020 +0000
- Revision:
- 9:9e247b9c9abf
- Include the following libraries:; - crc; - crc8; - uart; - util; - Add microsecond delay; - Move baud rate definition to mbed_app.json file; - Add bit shift for I2C slave address; - Check error for redefinition; - Make gpio handling more robust;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EndaKilgarriff | 9:9e247b9c9abf | 1 | /***************************************************************************//** |
EndaKilgarriff | 9:9e247b9c9abf | 2 | * @file uart_extra.h |
EndaKilgarriff | 9:9e247b9c9abf | 3 | * @brief: Header containing extra types required for UART interface |
EndaKilgarriff | 9:9e247b9c9abf | 4 | ******************************************************************************** |
EndaKilgarriff | 9:9e247b9c9abf | 5 | * Copyright (c) 2020 Analog Devices, Inc. |
EndaKilgarriff | 9:9e247b9c9abf | 6 | * |
EndaKilgarriff | 9:9e247b9c9abf | 7 | * All rights reserved. |
EndaKilgarriff | 9:9e247b9c9abf | 8 | * |
EndaKilgarriff | 9:9e247b9c9abf | 9 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
EndaKilgarriff | 9:9e247b9c9abf | 10 | * By using this software you agree to the terms of the associated |
EndaKilgarriff | 9:9e247b9c9abf | 11 | * Analog Devices Software License Agreement. |
EndaKilgarriff | 9:9e247b9c9abf | 12 | *******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 13 | |
EndaKilgarriff | 9:9e247b9c9abf | 14 | #ifndef UART_EXTRA_H |
EndaKilgarriff | 9:9e247b9c9abf | 15 | #define UART_EXTRA_H |
EndaKilgarriff | 9:9e247b9c9abf | 16 | |
EndaKilgarriff | 9:9e247b9c9abf | 17 | |
EndaKilgarriff | 9:9e247b9c9abf | 18 | // Platform support needs to be C-compatible to work with other drivers |
EndaKilgarriff | 9:9e247b9c9abf | 19 | #ifdef __cplusplus |
EndaKilgarriff | 9:9e247b9c9abf | 20 | extern "C" |
EndaKilgarriff | 9:9e247b9c9abf | 21 | { |
EndaKilgarriff | 9:9e247b9c9abf | 22 | #endif |
EndaKilgarriff | 9:9e247b9c9abf | 23 | |
EndaKilgarriff | 9:9e247b9c9abf | 24 | /******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 25 | /***************************** Include Files **********************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 26 | /******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 27 | #include <stdio.h> |
EndaKilgarriff | 9:9e247b9c9abf | 28 | |
EndaKilgarriff | 9:9e247b9c9abf | 29 | /******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 30 | /********************** Macros and Constants Definitions **********************/ |
EndaKilgarriff | 9:9e247b9c9abf | 31 | /******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 32 | |
EndaKilgarriff | 9:9e247b9c9abf | 33 | /******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 34 | /********************** Variables and User defined data types *****************/ |
EndaKilgarriff | 9:9e247b9c9abf | 35 | /******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 36 | |
EndaKilgarriff | 9:9e247b9c9abf | 37 | /* |
EndaKilgarriff | 9:9e247b9c9abf | 38 | * Note: The structure members are not strongly typed, as this file is included |
EndaKilgarriff | 9:9e247b9c9abf | 39 | * in application specific '.c' files. The mbed code structure does not |
EndaKilgarriff | 9:9e247b9c9abf | 40 | * allow inclusion of mbed driver files (e.g. mbed.h) into '.c' files. |
EndaKilgarriff | 9:9e247b9c9abf | 41 | * All the members are hence typecasted to mbed specific type during |
EndaKilgarriff | 9:9e247b9c9abf | 42 | * uart init and read/write operations. |
EndaKilgarriff | 9:9e247b9c9abf | 43 | **/ |
EndaKilgarriff | 9:9e247b9c9abf | 44 | |
EndaKilgarriff | 9:9e247b9c9abf | 45 | /** |
EndaKilgarriff | 9:9e247b9c9abf | 46 | * @struct mbed_uart_init_param |
EndaKilgarriff | 9:9e247b9c9abf | 47 | * @brief Structure holding the UART init parameters for mbed platform. |
EndaKilgarriff | 9:9e247b9c9abf | 48 | */ |
EndaKilgarriff | 9:9e247b9c9abf | 49 | typedef struct { |
EndaKilgarriff | 9:9e247b9c9abf | 50 | uint8_t uart_tx_pin; // UART Transmit Pin |
EndaKilgarriff | 9:9e247b9c9abf | 51 | uint8_t uart_rx_pin; // UART Receive Pin |
EndaKilgarriff | 9:9e247b9c9abf | 52 | } mbed_uart_init_param; |
EndaKilgarriff | 9:9e247b9c9abf | 53 | |
EndaKilgarriff | 9:9e247b9c9abf | 54 | /** |
EndaKilgarriff | 9:9e247b9c9abf | 55 | * @struct mbed_uart_desc |
EndaKilgarriff | 9:9e247b9c9abf | 56 | * @brief UART specific descriptor for the mbed platform. |
EndaKilgarriff | 9:9e247b9c9abf | 57 | */ |
EndaKilgarriff | 9:9e247b9c9abf | 58 | typedef struct { |
EndaKilgarriff | 9:9e247b9c9abf | 59 | void *uart_port; // UART port instance |
EndaKilgarriff | 9:9e247b9c9abf | 60 | } mbed_uart_desc; |
EndaKilgarriff | 9:9e247b9c9abf | 61 | |
EndaKilgarriff | 9:9e247b9c9abf | 62 | /******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 63 | /************************ Functions Declarations ******************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 64 | /******************************************************************************/ |
EndaKilgarriff | 9:9e247b9c9abf | 65 | |
EndaKilgarriff | 9:9e247b9c9abf | 66 | |
EndaKilgarriff | 9:9e247b9c9abf | 67 | #ifdef __cplusplus // Closing extern c |
EndaKilgarriff | 9:9e247b9c9abf | 68 | } |
EndaKilgarriff | 9:9e247b9c9abf | 69 | #endif |
EndaKilgarriff | 9:9e247b9c9abf | 70 | |
EndaKilgarriff | 9:9e247b9c9abf | 71 | #endif /* UART_EXTRA_H */ |