gyo
Diff: SBDBT.h
- Revision:
- 12:f7eb7dfa1356
- Parent:
- 9:8538fc8f6259
- Child:
- 13:3fcee1ce2f8e
--- a/SBDBT.h Thu Apr 25 11:14:27 2019 +0000 +++ b/SBDBT.h Tue Apr 30 06:50:55 2019 +0000 @@ -22,51 +22,79 @@ #define START_ 3 #define SELECT_ 12 +/** + * + * Example: + * @code + * #include "mbed.h" + * #include "SBDBT.h" + * + * // sbdbt pins: PA_0 = Tx, PA_1 = Rx,9600 = baud + * SBDBT sbdbt(PA_0,PA_1,9600); + * DigitalOut LED(LED1);//LED + * + * int main() { + * sbdbt.printf("Hello, World!\n"); + * if(sbdbt.CIRCLE)LED = 1; + * } + * @endcode + */ + +class SBDBT +{ +private: + char i; + char length; + char value; + char position; + char *tmp; + Serial *sr; - class SBDBT - { - private: - char i; - char length; - char value; - char position; - char *tmp; - Serial *sr; - - public: - char readable; - char *data; - char *data_p; - SBDBT(PinName, PinName); - SBDBT(PinName, PinName, int); - void getf(); - void print(); - int8_t State_check(); - void check(); - char CIRCLE; - char CROSS; - char SQUARE; - char TRIANGLE; - char L1; - char L2; - char L3; - char R1; - char R2; - char R3; - char UPkey; - char DOWNkey; - char RIGHTkey; - char LEFTkey; - signed char RX; - signed char RY; - signed char LX; - signed char LY; - char rs_x_check(); - char rs_y_check(); - char ls_x_check(); - char ls_y_check(); - ~SBDBT(); - }; - +public: + char readable; + char *data; + char *data_p; + /** Create an SBDBT object connected to the specified UART pins. + * + * @param Tx + * @param Rx + */ + SBDBT(PinName, PinName); + /** Create an SBDBT object connected to the specified UART pins. + * + * @param Tx + * @param Rx + * @param baud Set serial port baud rate + */ + SBDBT(PinName, PinName, int baud); + void getf(); + void print(); + int8_t State_check(); + void check(); + char CIRCLE; + char CROSS; + char SQUARE; + char TRIANGLE; + char L1; + char L2; + char L3; + char R1; + char R2; + char R3; + char UPkey; + char DOWNkey; + char RIGHTkey; + char LEFTkey; + signed char RX; + signed char RY; + signed char LX; + signed char LY; + char rs_x_check(); + char rs_y_check(); + char ls_x_check(); + char ls_y_check(); + ~SBDBT(); +}; + #endif \ No newline at end of file