mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/hal/TARGET_NORDIC/TARGET_NRF51822/serial_api.c@104:a6a92e2e5a92, 2014-02-21 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Feb 21 12:15:10 2014 +0000
- Revision:
- 104:a6a92e2e5a92
- Parent:
- 85:e1a8e879a6a9
- Child:
- 227:7bd0639b8911
Synchronized with git revision 195a50befc6da080be0051d0d9bc0838f6cb873e
Full URL: https://github.com/mbedmicro/mbed/commit/195a50befc6da080be0051d0d9bc0838f6cb873e/
nrf-mbed merge
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 85:e1a8e879a6a9 | 1 | /* mbed Microcontroller Library |
mbed_official | 104:a6a92e2e5a92 | 2 | * Copyright (c) 2013 Nordic Semiconductor |
mbed_official | 85:e1a8e879a6a9 | 3 | * |
mbed_official | 85:e1a8e879a6a9 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mbed_official | 85:e1a8e879a6a9 | 5 | * you may not use this file except in compliance with the License. |
mbed_official | 85:e1a8e879a6a9 | 6 | * You may obtain a copy of the License at |
mbed_official | 85:e1a8e879a6a9 | 7 | * |
mbed_official | 85:e1a8e879a6a9 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbed_official | 85:e1a8e879a6a9 | 9 | * |
mbed_official | 85:e1a8e879a6a9 | 10 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 85:e1a8e879a6a9 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 85:e1a8e879a6a9 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 85:e1a8e879a6a9 | 13 | * See the License for the specific language governing permissions and |
mbed_official | 85:e1a8e879a6a9 | 14 | * limitations under the License. |
mbed_official | 85:e1a8e879a6a9 | 15 | */ |
mbed_official | 85:e1a8e879a6a9 | 16 | // math.h required for floating point operations for baud rate calculation |
mbed_official | 85:e1a8e879a6a9 | 17 | //#include <math.h> |
mbed_official | 85:e1a8e879a6a9 | 18 | #include <string.h> |
mbed_official | 85:e1a8e879a6a9 | 19 | |
mbed_official | 85:e1a8e879a6a9 | 20 | #include "serial_api.h" |
mbed_official | 85:e1a8e879a6a9 | 21 | #include "cmsis.h" |
mbed_official | 85:e1a8e879a6a9 | 22 | #include "pinmap.h" |
mbed_official | 85:e1a8e879a6a9 | 23 | #include "error.h" |
mbed_official | 85:e1a8e879a6a9 | 24 | /****************************************************************************** |
mbed_official | 85:e1a8e879a6a9 | 25 | * INITIALIZATION |
mbed_official | 85:e1a8e879a6a9 | 26 | ******************************************************************************/ |
mbed_official | 85:e1a8e879a6a9 | 27 | #define UART_NUM 1 |
mbed_official | 85:e1a8e879a6a9 | 28 | |
mbed_official | 85:e1a8e879a6a9 | 29 | static const PinMap PinMap_UART_TX[] = { |
mbed_official | 85:e1a8e879a6a9 | 30 | {TX_PIN_NUMBER, UART_0, 1}, |
mbed_official | 85:e1a8e879a6a9 | 31 | { NC , NC , 0} |
mbed_official | 85:e1a8e879a6a9 | 32 | }; |
mbed_official | 85:e1a8e879a6a9 | 33 | |
mbed_official | 85:e1a8e879a6a9 | 34 | static const PinMap PinMap_UART_RX[] = { |
mbed_official | 85:e1a8e879a6a9 | 35 | {RX_PIN_NUMBER, UART_0, 1}, |
mbed_official | 85:e1a8e879a6a9 | 36 | {NC , NC , 0} |
mbed_official | 85:e1a8e879a6a9 | 37 | }; |
mbed_official | 85:e1a8e879a6a9 | 38 | |
mbed_official | 85:e1a8e879a6a9 | 39 | static uint32_t serial_irq_ids[UART_NUM] = {0}; |
mbed_official | 85:e1a8e879a6a9 | 40 | static uart_irq_handler irq_handler; |
mbed_official | 85:e1a8e879a6a9 | 41 | static uint32_t acceptedSpeeds[16][2] = {{1200,UART_BAUDRATE_BAUDRATE_Baud1200}, |
mbed_official | 85:e1a8e879a6a9 | 42 | {2400,UART_BAUDRATE_BAUDRATE_Baud2400}, |
mbed_official | 85:e1a8e879a6a9 | 43 | {4800,UART_BAUDRATE_BAUDRATE_Baud4800}, |
mbed_official | 85:e1a8e879a6a9 | 44 | {9600,UART_BAUDRATE_BAUDRATE_Baud9600}, |
mbed_official | 85:e1a8e879a6a9 | 45 | {14400,UART_BAUDRATE_BAUDRATE_Baud14400}, |
mbed_official | 85:e1a8e879a6a9 | 46 | {19200,UART_BAUDRATE_BAUDRATE_Baud19200}, |
mbed_official | 85:e1a8e879a6a9 | 47 | {28800,UART_BAUDRATE_BAUDRATE_Baud28800}, |
mbed_official | 85:e1a8e879a6a9 | 48 | {38400,UART_BAUDRATE_BAUDRATE_Baud38400}, |
mbed_official | 85:e1a8e879a6a9 | 49 | {57600,UART_BAUDRATE_BAUDRATE_Baud57600}, |
mbed_official | 85:e1a8e879a6a9 | 50 | {76800,UART_BAUDRATE_BAUDRATE_Baud76800}, |
mbed_official | 85:e1a8e879a6a9 | 51 | {115200,UART_BAUDRATE_BAUDRATE_Baud115200}, |
mbed_official | 85:e1a8e879a6a9 | 52 | {230400,UART_BAUDRATE_BAUDRATE_Baud230400}, |
mbed_official | 85:e1a8e879a6a9 | 53 | {250000,UART_BAUDRATE_BAUDRATE_Baud250000}, |
mbed_official | 85:e1a8e879a6a9 | 54 | {460800,UART_BAUDRATE_BAUDRATE_Baud460800}, |
mbed_official | 85:e1a8e879a6a9 | 55 | {921600,UART_BAUDRATE_BAUDRATE_Baud921600}, |
mbed_official | 85:e1a8e879a6a9 | 56 | {1000000,UART_BAUDRATE_BAUDRATE_Baud1M}}; |
mbed_official | 85:e1a8e879a6a9 | 57 | |
mbed_official | 85:e1a8e879a6a9 | 58 | int stdio_uart_inited = 0; |
mbed_official | 85:e1a8e879a6a9 | 59 | serial_t stdio_uart; |
mbed_official | 85:e1a8e879a6a9 | 60 | |
mbed_official | 85:e1a8e879a6a9 | 61 | |
mbed_official | 85:e1a8e879a6a9 | 62 | void serial_init(serial_t *obj, PinName tx, PinName rx) { |
mbed_official | 85:e1a8e879a6a9 | 63 | // determine the UART to use -- for mcu's with multiple uart connections |
mbed_official | 85:e1a8e879a6a9 | 64 | UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX); |
mbed_official | 85:e1a8e879a6a9 | 65 | UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX); |
mbed_official | 85:e1a8e879a6a9 | 66 | UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx); |
mbed_official | 85:e1a8e879a6a9 | 67 | |
mbed_official | 85:e1a8e879a6a9 | 68 | if ((int)uart == NC) { |
mbed_official | 85:e1a8e879a6a9 | 69 | error("Serial pinout mapping failed"); |
mbed_official | 85:e1a8e879a6a9 | 70 | } |
mbed_official | 85:e1a8e879a6a9 | 71 | |
mbed_official | 85:e1a8e879a6a9 | 72 | obj->uart = (NRF_UART_Type *)uart; |
mbed_official | 85:e1a8e879a6a9 | 73 | |
mbed_official | 85:e1a8e879a6a9 | 74 | //pin configurations -- |
mbed_official | 85:e1a8e879a6a9 | 75 | //outputs |
mbed_official | 85:e1a8e879a6a9 | 76 | NRF_GPIO->DIR |= (1<<tx);//TX_PIN_NUMBER); |
mbed_official | 85:e1a8e879a6a9 | 77 | NRF_GPIO->DIR |= (1<<RTS_PIN_NUMBER); |
mbed_official | 85:e1a8e879a6a9 | 78 | |
mbed_official | 85:e1a8e879a6a9 | 79 | NRF_GPIO->DIR &= ~(1<<rx);//RX_PIN_NUMBER); |
mbed_official | 85:e1a8e879a6a9 | 80 | NRF_GPIO->DIR &= ~(1<<CTS_PIN_NUMBER); |
mbed_official | 85:e1a8e879a6a9 | 81 | |
mbed_official | 85:e1a8e879a6a9 | 82 | obj->uart->PSELRTS = RTS_PIN_NUMBER; |
mbed_official | 85:e1a8e879a6a9 | 83 | obj->uart->PSELTXD = tx;//TX_PIN_NUMBER; |
mbed_official | 85:e1a8e879a6a9 | 84 | |
mbed_official | 85:e1a8e879a6a9 | 85 | //inputs |
mbed_official | 85:e1a8e879a6a9 | 86 | obj->uart->PSELCTS = CTS_PIN_NUMBER; |
mbed_official | 85:e1a8e879a6a9 | 87 | obj->uart->PSELRXD = rx;//RX_PIN_NUMBER; |
mbed_official | 85:e1a8e879a6a9 | 88 | |
mbed_official | 85:e1a8e879a6a9 | 89 | |
mbed_official | 85:e1a8e879a6a9 | 90 | // set default baud rate and format |
mbed_official | 85:e1a8e879a6a9 | 91 | serial_baud (obj, 9600); |
mbed_official | 85:e1a8e879a6a9 | 92 | serial_format(obj, 8, ParityNone, 1); |
mbed_official | 85:e1a8e879a6a9 | 93 | |
mbed_official | 85:e1a8e879a6a9 | 94 | obj->uart->ENABLE = (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos);; |
mbed_official | 85:e1a8e879a6a9 | 95 | obj->uart->TASKS_STARTTX = 1; |
mbed_official | 85:e1a8e879a6a9 | 96 | obj->uart->TASKS_STARTRX = 1; |
mbed_official | 85:e1a8e879a6a9 | 97 | obj->uart->EVENTS_RXDRDY =0; |
mbed_official | 85:e1a8e879a6a9 | 98 | |
mbed_official | 85:e1a8e879a6a9 | 99 | obj->index = 0; |
mbed_official | 85:e1a8e879a6a9 | 100 | |
mbed_official | 85:e1a8e879a6a9 | 101 | // set rx/tx pins in PullUp mode |
mbed_official | 85:e1a8e879a6a9 | 102 | pin_mode(tx, PullUp); |
mbed_official | 85:e1a8e879a6a9 | 103 | pin_mode(rx, PullUp); |
mbed_official | 85:e1a8e879a6a9 | 104 | |
mbed_official | 85:e1a8e879a6a9 | 105 | if (uart == STDIO_UART) { |
mbed_official | 85:e1a8e879a6a9 | 106 | stdio_uart_inited = 1; |
mbed_official | 85:e1a8e879a6a9 | 107 | memcpy(&stdio_uart, obj, sizeof(serial_t)); |
mbed_official | 85:e1a8e879a6a9 | 108 | } |
mbed_official | 85:e1a8e879a6a9 | 109 | } |
mbed_official | 85:e1a8e879a6a9 | 110 | |
mbed_official | 85:e1a8e879a6a9 | 111 | void serial_free(serial_t *obj) { |
mbed_official | 85:e1a8e879a6a9 | 112 | serial_irq_ids[obj->index] = 0; |
mbed_official | 85:e1a8e879a6a9 | 113 | } |
mbed_official | 85:e1a8e879a6a9 | 114 | |
mbed_official | 85:e1a8e879a6a9 | 115 | // serial_baud |
mbed_official | 85:e1a8e879a6a9 | 116 | // set the baud rate, taking in to account the current SystemFrequency |
mbed_official | 85:e1a8e879a6a9 | 117 | void serial_baud(serial_t *obj, int baudrate) { |
mbed_official | 85:e1a8e879a6a9 | 118 | if(baudrate<=1200){ |
mbed_official | 85:e1a8e879a6a9 | 119 | obj->uart->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1200; |
mbed_official | 85:e1a8e879a6a9 | 120 | return; |
mbed_official | 85:e1a8e879a6a9 | 121 | } |
mbed_official | 85:e1a8e879a6a9 | 122 | |
mbed_official | 85:e1a8e879a6a9 | 123 | for(int i=1;i<16;i++){ |
mbed_official | 85:e1a8e879a6a9 | 124 | if(baudrate<acceptedSpeeds[i][0]){ |
mbed_official | 85:e1a8e879a6a9 | 125 | obj->uart->BAUDRATE = acceptedSpeeds[i-1][1]; |
mbed_official | 85:e1a8e879a6a9 | 126 | return; |
mbed_official | 85:e1a8e879a6a9 | 127 | } |
mbed_official | 85:e1a8e879a6a9 | 128 | } |
mbed_official | 85:e1a8e879a6a9 | 129 | obj->uart->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud1M; |
mbed_official | 85:e1a8e879a6a9 | 130 | } |
mbed_official | 85:e1a8e879a6a9 | 131 | |
mbed_official | 85:e1a8e879a6a9 | 132 | void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) { |
mbed_official | 85:e1a8e879a6a9 | 133 | // 0: 1 stop bits, 1: 2 stop bits |
mbed_official | 85:e1a8e879a6a9 | 134 | // int parity_enable, parity_select; |
mbed_official | 85:e1a8e879a6a9 | 135 | switch (parity) { |
mbed_official | 85:e1a8e879a6a9 | 136 | case ParityNone: |
mbed_official | 85:e1a8e879a6a9 | 137 | obj->uart->CONFIG = 0; |
mbed_official | 85:e1a8e879a6a9 | 138 | break; |
mbed_official | 85:e1a8e879a6a9 | 139 | default: |
mbed_official | 85:e1a8e879a6a9 | 140 | obj->uart->CONFIG = (UART_CONFIG_PARITY_Included<<UART_CONFIG_PARITY_Pos); |
mbed_official | 85:e1a8e879a6a9 | 141 | return; |
mbed_official | 85:e1a8e879a6a9 | 142 | } |
mbed_official | 85:e1a8e879a6a9 | 143 | //no Flow Control |
mbed_official | 85:e1a8e879a6a9 | 144 | } |
mbed_official | 85:e1a8e879a6a9 | 145 | |
mbed_official | 85:e1a8e879a6a9 | 146 | //****************************************************************************** |
mbed_official | 85:e1a8e879a6a9 | 147 | // * INTERRUPT HANDLING |
mbed_official | 85:e1a8e879a6a9 | 148 | //****************************************************************************** |
mbed_official | 85:e1a8e879a6a9 | 149 | static inline void uart_irq(uint32_t iir, uint32_t index) { |
mbed_official | 85:e1a8e879a6a9 | 150 | SerialIrq irq_type; |
mbed_official | 85:e1a8e879a6a9 | 151 | switch (iir) { |
mbed_official | 85:e1a8e879a6a9 | 152 | case 1: |
mbed_official | 85:e1a8e879a6a9 | 153 | irq_type = TxIrq; |
mbed_official | 85:e1a8e879a6a9 | 154 | break; |
mbed_official | 85:e1a8e879a6a9 | 155 | case 2: |
mbed_official | 85:e1a8e879a6a9 | 156 | irq_type = RxIrq; |
mbed_official | 85:e1a8e879a6a9 | 157 | break; |
mbed_official | 85:e1a8e879a6a9 | 158 | |
mbed_official | 85:e1a8e879a6a9 | 159 | default: return; |
mbed_official | 85:e1a8e879a6a9 | 160 | } |
mbed_official | 85:e1a8e879a6a9 | 161 | |
mbed_official | 85:e1a8e879a6a9 | 162 | if (serial_irq_ids[index] != 0){ |
mbed_official | 85:e1a8e879a6a9 | 163 | irq_handler(serial_irq_ids[index], irq_type); |
mbed_official | 85:e1a8e879a6a9 | 164 | } |
mbed_official | 85:e1a8e879a6a9 | 165 | } |
mbed_official | 85:e1a8e879a6a9 | 166 | #ifdef __cplusplus |
mbed_official | 85:e1a8e879a6a9 | 167 | extern "C" { |
mbed_official | 85:e1a8e879a6a9 | 168 | #endif |
mbed_official | 85:e1a8e879a6a9 | 169 | void UART0_IRQHandler() |
mbed_official | 85:e1a8e879a6a9 | 170 | { |
mbed_official | 85:e1a8e879a6a9 | 171 | uint32_t irtype =0; |
mbed_official | 85:e1a8e879a6a9 | 172 | |
mbed_official | 85:e1a8e879a6a9 | 173 | if(NRF_UART0->EVENTS_TXDRDY){ |
mbed_official | 85:e1a8e879a6a9 | 174 | irtype =1; |
mbed_official | 85:e1a8e879a6a9 | 175 | } |
mbed_official | 85:e1a8e879a6a9 | 176 | else if(NRF_UART0->EVENTS_RXDRDY){ |
mbed_official | 85:e1a8e879a6a9 | 177 | irtype =2; |
mbed_official | 85:e1a8e879a6a9 | 178 | } |
mbed_official | 85:e1a8e879a6a9 | 179 | uart_irq(irtype, 0); |
mbed_official | 85:e1a8e879a6a9 | 180 | } |
mbed_official | 85:e1a8e879a6a9 | 181 | #ifdef __cplusplus |
mbed_official | 85:e1a8e879a6a9 | 182 | } |
mbed_official | 85:e1a8e879a6a9 | 183 | #endif |
mbed_official | 85:e1a8e879a6a9 | 184 | void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) { |
mbed_official | 85:e1a8e879a6a9 | 185 | irq_handler = handler; |
mbed_official | 85:e1a8e879a6a9 | 186 | serial_irq_ids[obj->index] = id; |
mbed_official | 85:e1a8e879a6a9 | 187 | } |
mbed_official | 85:e1a8e879a6a9 | 188 | |
mbed_official | 85:e1a8e879a6a9 | 189 | void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) { |
mbed_official | 85:e1a8e879a6a9 | 190 | IRQn_Type irq_n = (IRQn_Type)0; |
mbed_official | 85:e1a8e879a6a9 | 191 | |
mbed_official | 85:e1a8e879a6a9 | 192 | switch ((int)obj->uart) { |
mbed_official | 85:e1a8e879a6a9 | 193 | case UART_0: irq_n=UART0_IRQn ; |
mbed_official | 85:e1a8e879a6a9 | 194 | break; |
mbed_official | 85:e1a8e879a6a9 | 195 | } |
mbed_official | 85:e1a8e879a6a9 | 196 | |
mbed_official | 85:e1a8e879a6a9 | 197 | if (enable) { |
mbed_official | 85:e1a8e879a6a9 | 198 | switch (irq) { |
mbed_official | 85:e1a8e879a6a9 | 199 | case RxIrq: obj->uart->INTENSET |= (UART_INTENSET_RXDRDY_Msk);break; |
mbed_official | 85:e1a8e879a6a9 | 200 | case TxIrq: obj->uart->INTENSET |= (UART_INTENSET_TXDRDY_Msk);break; |
mbed_official | 85:e1a8e879a6a9 | 201 | } |
mbed_official | 85:e1a8e879a6a9 | 202 | NVIC_SetPriority(irq_n, 3); |
mbed_official | 85:e1a8e879a6a9 | 203 | NVIC_EnableIRQ(irq_n); |
mbed_official | 85:e1a8e879a6a9 | 204 | } |
mbed_official | 85:e1a8e879a6a9 | 205 | else { // disable |
mbed_official | 85:e1a8e879a6a9 | 206 | int all_disabled = 0; |
mbed_official | 85:e1a8e879a6a9 | 207 | switch (irq) { |
mbed_official | 85:e1a8e879a6a9 | 208 | case RxIrq: obj->uart->INTENSET &= ~(UART_INTENSET_RXDRDY_Msk); |
mbed_official | 85:e1a8e879a6a9 | 209 | all_disabled = (obj->uart->INTENSET& (UART_INTENSET_TXDRDY_Msk))==0; |
mbed_official | 85:e1a8e879a6a9 | 210 | break; |
mbed_official | 85:e1a8e879a6a9 | 211 | case TxIrq: obj->uart->INTENSET &= ~(UART_INTENSET_TXDRDY_Msk); |
mbed_official | 85:e1a8e879a6a9 | 212 | all_disabled = (obj->uart->INTENSET& (UART_INTENSET_RXDRDY_Msk))==0; |
mbed_official | 85:e1a8e879a6a9 | 213 | break; |
mbed_official | 85:e1a8e879a6a9 | 214 | } |
mbed_official | 85:e1a8e879a6a9 | 215 | |
mbed_official | 85:e1a8e879a6a9 | 216 | if (all_disabled){ |
mbed_official | 85:e1a8e879a6a9 | 217 | NVIC_DisableIRQ(irq_n); |
mbed_official | 85:e1a8e879a6a9 | 218 | } |
mbed_official | 85:e1a8e879a6a9 | 219 | } |
mbed_official | 85:e1a8e879a6a9 | 220 | } |
mbed_official | 85:e1a8e879a6a9 | 221 | |
mbed_official | 85:e1a8e879a6a9 | 222 | //****************************************************************************** |
mbed_official | 85:e1a8e879a6a9 | 223 | //* READ/WRITE |
mbed_official | 85:e1a8e879a6a9 | 224 | //****************************************************************************** |
mbed_official | 85:e1a8e879a6a9 | 225 | int serial_getc(serial_t *obj) { |
mbed_official | 85:e1a8e879a6a9 | 226 | while (!serial_readable(obj)); |
mbed_official | 85:e1a8e879a6a9 | 227 | |
mbed_official | 85:e1a8e879a6a9 | 228 | obj->uart->EVENTS_RXDRDY = 0; |
mbed_official | 85:e1a8e879a6a9 | 229 | |
mbed_official | 85:e1a8e879a6a9 | 230 | return (uint8_t)obj->uart->RXD; |
mbed_official | 85:e1a8e879a6a9 | 231 | } |
mbed_official | 85:e1a8e879a6a9 | 232 | |
mbed_official | 85:e1a8e879a6a9 | 233 | void serial_putc(serial_t *obj, int c) { |
mbed_official | 85:e1a8e879a6a9 | 234 | obj->uart->TXD = (uint8_t)c; |
mbed_official | 85:e1a8e879a6a9 | 235 | |
mbed_official | 85:e1a8e879a6a9 | 236 | while (!serial_writable(obj)); |
mbed_official | 85:e1a8e879a6a9 | 237 | |
mbed_official | 85:e1a8e879a6a9 | 238 | obj->uart->EVENTS_TXDRDY =0; |
mbed_official | 85:e1a8e879a6a9 | 239 | } |
mbed_official | 85:e1a8e879a6a9 | 240 | |
mbed_official | 85:e1a8e879a6a9 | 241 | int serial_readable(serial_t *obj) { |
mbed_official | 85:e1a8e879a6a9 | 242 | return (obj->uart->EVENTS_RXDRDY == 1); |
mbed_official | 85:e1a8e879a6a9 | 243 | } |
mbed_official | 85:e1a8e879a6a9 | 244 | |
mbed_official | 85:e1a8e879a6a9 | 245 | int serial_writable(serial_t *obj) { |
mbed_official | 85:e1a8e879a6a9 | 246 | return (obj->uart->EVENTS_TXDRDY ==1); |
mbed_official | 85:e1a8e879a6a9 | 247 | } |
mbed_official | 85:e1a8e879a6a9 | 248 | |
mbed_official | 85:e1a8e879a6a9 | 249 | void serial_break_set(serial_t *obj) { |
mbed_official | 85:e1a8e879a6a9 | 250 | obj->uart->TASKS_SUSPEND = 1; |
mbed_official | 85:e1a8e879a6a9 | 251 | } |
mbed_official | 85:e1a8e879a6a9 | 252 | |
mbed_official | 85:e1a8e879a6a9 | 253 | void serial_break_clear(serial_t *obj) { |
mbed_official | 85:e1a8e879a6a9 | 254 | obj->uart->TASKS_STARTTX = 1; |
mbed_official | 85:e1a8e879a6a9 | 255 | obj->uart->TASKS_STARTRX = 1; |
mbed_official | 85:e1a8e879a6a9 | 256 | } |