SDK4.0
This document shows Ameba SDK 4.0 APIs
serial_api.h File Reference

This file provides mbed API for UART. More...

#include "device.h"

Ameba Common

enum  SerialParity {
  ParityNone = 0, ParityOdd = 1, ParityEven = 2, ParityForced1 = 3,
  ParityForced0 = 4
}
 UART Parity mode used by serial_format. More...
 
enum  SerialIrq { RxIrq, TxIrq }
 UART Interrupt enable/disable used by serial_irq_set. More...
 
enum  FlowControl { FlowControlNone, FlowControlRTS, FlowControlCTS, FlowControlRTSCTS }
 UART FlowControl mode used by serial_set_flow_control. More...
 
typedef void(* uart_irq_handler) (uint32_t id, SerialIrq event)
 
typedef struct serial_s serial_t
 
void serial_init (serial_t *obj, PinName tx, PinName rx)
 Initializes the UART device, include clock/function/interrupt/UART registers. More...
 
void serial_free (serial_t *obj)
 Deinitializes the UART device, include clock/function/interrupt/UART registers. More...
 
void serial_baud (serial_t *obj, int baudrate)
 Set UART device baudrate. More...
 
void serial_format (serial_t *obj, int data_bits, SerialParity parity, int stop_bits)
 Set UART format. More...
 
void serial_irq_handler (serial_t *obj, uart_irq_handler handler, uint32_t id)
 Set UART interrupt hander if needed. More...
 
void serial_irq_set (serial_t *obj, SerialIrq irq, uint32_t enable)
 Enable/Disable UART interrupt. More...
 
int serial_getc (serial_t *obj)
 get one byte from UART. More...
 
void serial_putc (serial_t *obj, int c)
 send one byte use UART. More...
 
int serial_readable (serial_t *obj)
 check if there is data in rx fifo. More...
 
int serial_writable (serial_t *obj)
 check if write data to tx fifo is permitted. More...
 
void serial_clear (serial_t *obj)
 Clear Rx fifo. More...
 
void serial_break_set (serial_t *obj)
 enable UART break contol function. More...
 
void serial_break_clear (serial_t *obj)
 disable UART break contol function. More...
 
void serial_pinout_tx (PinName tx)
 set tx pinmux. More...
 
void serial_set_flow_control (serial_t *obj, FlowControl type, PinName rxflow, PinName txflow)
 uart autoflow contol setting. More...
 

Detailed Description

This file provides mbed API for UART.

mbed Microcontroller Library

Author
Version
V1.0.0
Attention

Copyright (c) 2006-2013 ARM Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.