?? serial.h
字號:
/**
* \file serial.h
* \brief Serial port API
*
* The functions debug_init() and debug() implement non-RTOS
* serial port initialization and a blocked debug output. The
* debug() function can be used in 'error message and die'
* situations.
*/
#ifndef SERIAL_H
#define SERIAL_H
#include <stdint.h>
/* Serial port debug interface */
void debug_init();
void debug(char *msg);
/* Serial port RTOS interface */
int32_t serial_init();
/* Read a character from the serial port */
int32_t serial_getchar();
/* Write a character to the serial port */
int32_t serial_putchar(int8_t ch);
/* Write a string to the serial port */
int32_t serial_puts(int8_t *msg);
/* Read a string */
int32_t serial_gets(int8_t *msg, uint32_t max);
/* Serial port configuration.
*
* UART1 configuration: Ch 9 pp101-114 User Manual.
*
* The LPC213x devices use the VPB clock to generate
* a 16x baud-rate clock reference to the UART.
*
* Examples:
* VPB clock = 15MHz.
*
* Baud rate Divisor
* --------- -------
* 9600 97
* 14400 65
* 19200 48
* 38400 24
* 57600 16
* 115200 8
*
* and the VPB clock could be 60MHz on the LPC devices,
* it just happens to reset to CPU clock divided by 4.
*/
#define SERIAL_CLOCK (15000000/16)
#define SERIAL_PARITY_NONE 0
#define SERIAL_PARITY_ODD 1
#define SERIAL_PARITY_EVEN 2
#define SERIAL_PARITY_FORCE_ONE 3
#define SERIAL_PARITY_FORCE_ZERO 4
int32_t serial_config(
uint32_t baud_rate,
uint32_t data_width,
uint32_t stop_bits,
uint32_t parity);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -