説明を見る。00001 #ifndef UART_H_
00002 #define UART_H_
00003
00004
00028 #include "LPC11xx.h"
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 const char radix_bin[]="01";
00033 const char radix_oct[]="01234567";
00034 const char radix_dec[]="0123456789";
00035 const char radix_hex[]="0123456789ABCDEF";
00036
00042 typedef enum {
00043 marySerial1,
00044 mbedSerial1,
00045 mbedSerial2
00046 } SERIAL_PORT;
00047
00051 typedef enum {
00052 BYTE = 0x01,
00053 BIN = 0x02,
00054 OCT = 0x08,
00055 DEC = 0x0A,
00056 HEX = 0x10
00057 } SERIAL_FORMAT;
00058
00059
00060 class USerial {
00061 private:
00062 SERIAL_PORT port;
00063 SERIAL_FORMAT format;
00064 int speed;
00065
00066 public:
00067 USerial();
00068 ~USerial();
00069
00070 void begin(int speed);
00071 void end() ;
00072 void print(const char *s);
00073 void print(int val, SERIAL_FORMAT format);
00074 void println(const char *s);
00075 void println(int val, SERIAL_FORMAT format) ;
00076 int read(void);
00077 void write(const char c);
00078 void write(const char *s,int length);
00079 };
00080
00081
00082 extern USerial Serial;
00083
00084 #ifdef __cplusplus
00085 }
00086 #endif
00087
00088
00089 #endif