Mbed SDK for XRange SX1272 LoRa module
Dependents: XRangePingPong XRange-LoRaWAN-lmic-app lora-transceiver
SX1272 LoRa RF module
https://www.netblocks.eu/xrange-sx1272-lora-datasheet/
hal/serial_api.h@339:ac6f3fd999f3, 2016-01-07 (annotated)
- Committer:
- netblocks
- Date:
- Thu Jan 07 13:01:25 2016 +0000
- Revision:
- 339:ac6f3fd999f3
- Parent:
- 336:1e18a06a987b
HSE_VALUE set for XTAL 16Mhz
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dudmuck | 336:1e18a06a987b | 1 | /* mbed Microcontroller Library |
dudmuck | 336:1e18a06a987b | 2 | * Copyright (c) 2006-2013 ARM Limited |
dudmuck | 336:1e18a06a987b | 3 | * |
dudmuck | 336:1e18a06a987b | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
dudmuck | 336:1e18a06a987b | 5 | * you may not use this file except in compliance with the License. |
dudmuck | 336:1e18a06a987b | 6 | * You may obtain a copy of the License at |
dudmuck | 336:1e18a06a987b | 7 | * |
dudmuck | 336:1e18a06a987b | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
dudmuck | 336:1e18a06a987b | 9 | * |
dudmuck | 336:1e18a06a987b | 10 | * Unless required by applicable law or agreed to in writing, software |
dudmuck | 336:1e18a06a987b | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
dudmuck | 336:1e18a06a987b | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
dudmuck | 336:1e18a06a987b | 13 | * See the License for the specific language governing permissions and |
dudmuck | 336:1e18a06a987b | 14 | * limitations under the License. |
dudmuck | 336:1e18a06a987b | 15 | */ |
dudmuck | 336:1e18a06a987b | 16 | #ifndef MBED_SERIAL_API_H |
dudmuck | 336:1e18a06a987b | 17 | #define MBED_SERIAL_API_H |
dudmuck | 336:1e18a06a987b | 18 | |
dudmuck | 336:1e18a06a987b | 19 | #include "device.h" |
dudmuck | 336:1e18a06a987b | 20 | |
dudmuck | 336:1e18a06a987b | 21 | #if DEVICE_SERIAL |
dudmuck | 336:1e18a06a987b | 22 | |
dudmuck | 336:1e18a06a987b | 23 | #ifdef __cplusplus |
dudmuck | 336:1e18a06a987b | 24 | extern "C" { |
dudmuck | 336:1e18a06a987b | 25 | #endif |
dudmuck | 336:1e18a06a987b | 26 | |
dudmuck | 336:1e18a06a987b | 27 | typedef enum { |
dudmuck | 336:1e18a06a987b | 28 | ParityNone = 0, |
dudmuck | 336:1e18a06a987b | 29 | ParityOdd = 1, |
dudmuck | 336:1e18a06a987b | 30 | ParityEven = 2, |
dudmuck | 336:1e18a06a987b | 31 | ParityForced1 = 3, |
dudmuck | 336:1e18a06a987b | 32 | ParityForced0 = 4 |
dudmuck | 336:1e18a06a987b | 33 | } SerialParity; |
dudmuck | 336:1e18a06a987b | 34 | |
dudmuck | 336:1e18a06a987b | 35 | typedef enum { |
dudmuck | 336:1e18a06a987b | 36 | RxIrq, |
dudmuck | 336:1e18a06a987b | 37 | TxIrq |
dudmuck | 336:1e18a06a987b | 38 | } SerialIrq; |
dudmuck | 336:1e18a06a987b | 39 | |
dudmuck | 336:1e18a06a987b | 40 | typedef enum { |
dudmuck | 336:1e18a06a987b | 41 | FlowControlNone, |
dudmuck | 336:1e18a06a987b | 42 | FlowControlRTS, |
dudmuck | 336:1e18a06a987b | 43 | FlowControlCTS, |
dudmuck | 336:1e18a06a987b | 44 | FlowControlRTSCTS |
dudmuck | 336:1e18a06a987b | 45 | } FlowControl; |
dudmuck | 336:1e18a06a987b | 46 | |
dudmuck | 336:1e18a06a987b | 47 | typedef void (*uart_irq_handler)(uint32_t id, SerialIrq event); |
dudmuck | 336:1e18a06a987b | 48 | |
dudmuck | 336:1e18a06a987b | 49 | typedef struct serial_s serial_t; |
dudmuck | 336:1e18a06a987b | 50 | |
dudmuck | 336:1e18a06a987b | 51 | void serial_init (serial_t *obj, PinName tx, PinName rx); |
dudmuck | 336:1e18a06a987b | 52 | void serial_free (serial_t *obj); |
dudmuck | 336:1e18a06a987b | 53 | void serial_baud (serial_t *obj, int baudrate); |
dudmuck | 336:1e18a06a987b | 54 | void serial_format (serial_t *obj, int data_bits, SerialParity parity, int stop_bits); |
dudmuck | 336:1e18a06a987b | 55 | |
dudmuck | 336:1e18a06a987b | 56 | void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id); |
dudmuck | 336:1e18a06a987b | 57 | void serial_irq_set (serial_t *obj, SerialIrq irq, uint32_t enable); |
dudmuck | 336:1e18a06a987b | 58 | |
dudmuck | 336:1e18a06a987b | 59 | int serial_getc (serial_t *obj); |
dudmuck | 336:1e18a06a987b | 60 | void serial_putc (serial_t *obj, int c); |
dudmuck | 336:1e18a06a987b | 61 | int serial_readable (serial_t *obj); |
dudmuck | 336:1e18a06a987b | 62 | int serial_writable (serial_t *obj); |
dudmuck | 336:1e18a06a987b | 63 | void serial_clear (serial_t *obj); |
dudmuck | 336:1e18a06a987b | 64 | |
dudmuck | 336:1e18a06a987b | 65 | void serial_break_set (serial_t *obj); |
dudmuck | 336:1e18a06a987b | 66 | void serial_break_clear(serial_t *obj); |
dudmuck | 336:1e18a06a987b | 67 | |
dudmuck | 336:1e18a06a987b | 68 | void serial_pinout_tx(PinName tx); |
dudmuck | 336:1e18a06a987b | 69 | |
dudmuck | 336:1e18a06a987b | 70 | void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow); |
dudmuck | 336:1e18a06a987b | 71 | |
dudmuck | 336:1e18a06a987b | 72 | #ifdef __cplusplus |
dudmuck | 336:1e18a06a987b | 73 | } |
dudmuck | 336:1e18a06a987b | 74 | #endif |
dudmuck | 336:1e18a06a987b | 75 | |
dudmuck | 336:1e18a06a987b | 76 | #endif |
dudmuck | 336:1e18a06a987b | 77 | |
dudmuck | 336:1e18a06a987b | 78 | #endif |