src/uart.h
00001 /*
00002  * uart.h
00003  *
00004  *  Created on: 2011/07/31
00005  *      Author: lynxeyed
00006  */
00007 
00008 #ifndef UART_H_
00009 #define UART_H_
00010 
00011 #include "LPC11xx.h"
00012 #ifdef __cplusplus
00013   extern "C" {
00014 #endif
00015 
00016 typedef enum {marySerial1,mbedSerial1,mbedSerial2} SERIAL_PORT; // Defaults:marySerial1
00017 typedef enum {BYTE, BIN, OCT, DEC, HEX} SERIAL_FORMAT;
00018 
00019 
00020 
00021 class USerial {
00022 private:
00023         SERIAL_PORT port;
00024         SERIAL_FORMAT format;
00025         int speed;
00026 
00027 public:
00028         USerial();//USerial(SERIAL_PORT port);          // announce the constructor to initialize
00029         ~USerial();
00030 
00031         void begin(int speed);
00032         void end() ;
00033         void print(const char *s);
00034         void print(int val, SERIAL_FORMAT format);
00035         void println(const char *s);
00036         void println(int val, SERIAL_FORMAT format) ;
00037         int  read(void);
00038         void write(const char c);
00039         void write(const char *s,int length);
00040 };
00041 
00042 
00043 #ifdef __cplusplus
00044   }
00045 #endif
00046 
00047 #endif /* UART_H_ */
 全て クラス ファイル 関数 変数 列挙型 列挙型の値 マクロ定義