mbed
Fork of mbed-dev by
targets/TARGET_STM/serial_api_hal.h@182:57724642e740, 2018-02-16 (annotated)
- Committer:
- AnnaBridge
- Date:
- Fri Feb 16 16:09:33 2018 +0000
- Revision:
- 182:57724642e740
- Parent:
- 181:96ed750bd169
mbed-dev library. Release version 159.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 167:e84263d55307 | 1 | /* mbed Microcontroller Library |
AnnaBridge | 167:e84263d55307 | 2 | ******************************************************************************* |
AnnaBridge | 167:e84263d55307 | 3 | * Copyright (c) 2016, STMicroelectronics |
AnnaBridge | 167:e84263d55307 | 4 | * All rights reserved. |
AnnaBridge | 167:e84263d55307 | 5 | * |
AnnaBridge | 167:e84263d55307 | 6 | * Redistribution and use in source and binary forms, with or without |
AnnaBridge | 167:e84263d55307 | 7 | * modification, are permitted provided that the following conditions are met: |
AnnaBridge | 167:e84263d55307 | 8 | * |
AnnaBridge | 167:e84263d55307 | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
AnnaBridge | 167:e84263d55307 | 10 | * this list of conditions and the following disclaimer. |
AnnaBridge | 167:e84263d55307 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
AnnaBridge | 167:e84263d55307 | 12 | * this list of conditions and the following disclaimer in the documentation |
AnnaBridge | 167:e84263d55307 | 13 | * and/or other materials provided with the distribution. |
AnnaBridge | 167:e84263d55307 | 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
AnnaBridge | 167:e84263d55307 | 15 | * may be used to endorse or promote products derived from this software |
AnnaBridge | 167:e84263d55307 | 16 | * without specific prior written permission. |
AnnaBridge | 167:e84263d55307 | 17 | * |
AnnaBridge | 167:e84263d55307 | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
AnnaBridge | 167:e84263d55307 | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
AnnaBridge | 167:e84263d55307 | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 167:e84263d55307 | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
AnnaBridge | 167:e84263d55307 | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
AnnaBridge | 167:e84263d55307 | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
AnnaBridge | 167:e84263d55307 | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
AnnaBridge | 167:e84263d55307 | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
AnnaBridge | 167:e84263d55307 | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
AnnaBridge | 167:e84263d55307 | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 167:e84263d55307 | 28 | ******************************************************************************* |
AnnaBridge | 167:e84263d55307 | 29 | */ |
AnnaBridge | 167:e84263d55307 | 30 | |
AnnaBridge | 167:e84263d55307 | 31 | #ifndef MBED_SERIAL_API_HAL_H |
AnnaBridge | 167:e84263d55307 | 32 | #define MBED_SERIAL_API_HAL_H |
AnnaBridge | 167:e84263d55307 | 33 | |
AnnaBridge | 167:e84263d55307 | 34 | #include "serial_api.h" |
Anna Bridge |
181:96ed750bd169 | 35 | #include <string.h> |
Anna Bridge |
181:96ed750bd169 | 36 | #include "mbed_assert.h" |
Anna Bridge |
181:96ed750bd169 | 37 | #include "mbed_debug.h" |
Anna Bridge |
181:96ed750bd169 | 38 | #include "mbed_error.h" |
AnnaBridge | 167:e84263d55307 | 39 | |
Anna Bridge |
181:96ed750bd169 | 40 | #include "PeripheralPins.h" |
AnnaBridge | 167:e84263d55307 | 41 | |
AnnaBridge | 167:e84263d55307 | 42 | #ifdef __cplusplus |
AnnaBridge | 167:e84263d55307 | 43 | extern "C" { |
AnnaBridge | 167:e84263d55307 | 44 | #endif |
AnnaBridge | 167:e84263d55307 | 45 | /* |
AnnaBridge | 167:e84263d55307 | 46 | * Extend serial_api.h |
AnnaBridge | 167:e84263d55307 | 47 | */ |
AnnaBridge | 167:e84263d55307 | 48 | |
AnnaBridge | 167:e84263d55307 | 49 | #if DEVICE_SERIAL_ASYNCH |
AnnaBridge | 167:e84263d55307 | 50 | #define SERIAL_S(obj) (&((obj)->serial)) |
AnnaBridge | 167:e84263d55307 | 51 | #else |
AnnaBridge | 167:e84263d55307 | 52 | #define SERIAL_S(obj) (obj) |
AnnaBridge | 167:e84263d55307 | 53 | #endif |
AnnaBridge | 167:e84263d55307 | 54 | |
AnnaBridge | 167:e84263d55307 | 55 | |
AnnaBridge | 167:e84263d55307 | 56 | /** Initialize and configure the UART peripheral |
AnnaBridge | 167:e84263d55307 | 57 | * |
AnnaBridge | 167:e84263d55307 | 58 | * @param obj The serial object containing the configuration |
AnnaBridge | 167:e84263d55307 | 59 | */ |
Anna Bridge |
181:96ed750bd169 | 60 | HAL_StatusTypeDef init_uart(serial_t *obj); |
AnnaBridge | 167:e84263d55307 | 61 | |
AnnaBridge | 167:e84263d55307 | 62 | #ifdef __cplusplus |
AnnaBridge | 167:e84263d55307 | 63 | } |
AnnaBridge | 167:e84263d55307 | 64 | #endif |
AnnaBridge | 167:e84263d55307 | 65 | |
AnnaBridge | 167:e84263d55307 | 66 | #endif |