gyo

Committer:
nanjo
Date:
Sat May 11 07:50:16 2019 +0000
Revision:
15:8c49a263e344
Parent:
14:8a6c8ae74691
add start select key

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gotto0 1:8810976be033 1 #ifndef INCLDUED_SBDBT_h_
gotto0 1:8810976be033 2 #define INCLDUED_SBDBT_h_
gotto0 0:afe58893bfe7 3 #include "mbed.h"
gotto0 0:afe58893bfe7 4
gotto0 7:30e05998769b 5 //data[1]
gotto0 8:f3e2b37e206f 6 #define SHIKAKU_ 0x01
gotto0 8:f3e2b37e206f 7 #define L1_ 0x02
gotto0 8:f3e2b37e206f 8 #define L2_ 0x04
nanjo 9:8538fc8f6259 9 #define L3_ 0x08
nanjo 9:8538fc8f6259 10 #define R1_ 0x10
nanjo 9:8538fc8f6259 11 #define R2_ 0x20
nanjo 9:8538fc8f6259 12 #define R3_ 0x40
gotto0 7:30e05998769b 13
gotto0 7:30e05998769b 14 //data[2]
gotto0 8:f3e2b37e206f 15 #define UE_ 0x01
gotto0 8:f3e2b37e206f 16 #define SITA_ 0x02
gotto0 8:f3e2b37e206f 17 #define MIGI_ 0x04
gotto0 8:f3e2b37e206f 18 #define HIDARI_ 0x08
gotto0 8:f3e2b37e206f 19 #define SANKAKU_ 0x10
gotto0 8:f3e2b37e206f 20 #define BATU_ 0x20
gotto0 8:f3e2b37e206f 21 #define MARU_ 0x40
gotto0 8:f3e2b37e206f 22 #define START_ 3
gotto0 8:f3e2b37e206f 23 #define SELECT_ 12
gotto0 6:da71294502ee 24
nanjo 12:f7eb7dfa1356 25 /**
nanjo 12:f7eb7dfa1356 26 *
nanjo 12:f7eb7dfa1356 27 * Example:
nanjo 12:f7eb7dfa1356 28 * @code
nanjo 12:f7eb7dfa1356 29 * #include "mbed.h"
nanjo 12:f7eb7dfa1356 30 * #include "SBDBT.h"
nanjo 12:f7eb7dfa1356 31 *
nanjo 12:f7eb7dfa1356 32 * // sbdbt pins: PA_0 = Tx, PA_1 = Rx,9600 = baud
nanjo 12:f7eb7dfa1356 33 * SBDBT sbdbt(PA_0,PA_1,9600);
nanjo 12:f7eb7dfa1356 34 * DigitalOut LED(LED1);//LED
nanjo 12:f7eb7dfa1356 35 *
nanjo 12:f7eb7dfa1356 36 * int main() {
nanjo 14:8a6c8ae74691 37 while(1){
nanjo 14:8a6c8ae74691 38 * sbdbt.print();
nanjo 12:f7eb7dfa1356 39 * if(sbdbt.CIRCLE)LED = 1;
nanjo 14:8a6c8ae74691 40 * }
nanjo 12:f7eb7dfa1356 41 * }
nanjo 12:f7eb7dfa1356 42 * @endcode
nanjo 12:f7eb7dfa1356 43 */
nanjo 12:f7eb7dfa1356 44
nanjo 12:f7eb7dfa1356 45 class SBDBT
nanjo 12:f7eb7dfa1356 46 {
nanjo 12:f7eb7dfa1356 47 private:
nanjo 12:f7eb7dfa1356 48 char i;
nanjo 12:f7eb7dfa1356 49 char length;
nanjo 12:f7eb7dfa1356 50 char value;
nanjo 12:f7eb7dfa1356 51 char position;
nanjo 12:f7eb7dfa1356 52 char *tmp;
nanjo 12:f7eb7dfa1356 53 Serial *sr;
nanjo 9:8538fc8f6259 54
nanjo 12:f7eb7dfa1356 55 public:
nanjo 12:f7eb7dfa1356 56 char readable;
nanjo 12:f7eb7dfa1356 57 char *data;
nanjo 12:f7eb7dfa1356 58 char *data_p;
nanjo 12:f7eb7dfa1356 59 /** Create an SBDBT object connected to the specified UART pins.
nanjo 12:f7eb7dfa1356 60 *
nanjo 12:f7eb7dfa1356 61 * @param Tx
nanjo 12:f7eb7dfa1356 62 * @param Rx
nanjo 12:f7eb7dfa1356 63 */
nanjo 12:f7eb7dfa1356 64 SBDBT(PinName, PinName);
nanjo 12:f7eb7dfa1356 65 /** Create an SBDBT object connected to the specified UART pins.
nanjo 12:f7eb7dfa1356 66 *
nanjo 12:f7eb7dfa1356 67 * @param Tx
nanjo 12:f7eb7dfa1356 68 * @param Rx
nanjo 12:f7eb7dfa1356 69 * @param baud Set serial port baud rate
nanjo 12:f7eb7dfa1356 70 */
nanjo 12:f7eb7dfa1356 71 SBDBT(PinName, PinName, int baud);
nanjo 12:f7eb7dfa1356 72 void getf();
nanjo 12:f7eb7dfa1356 73 void print();
nanjo 12:f7eb7dfa1356 74 int8_t State_check();
nanjo 12:f7eb7dfa1356 75 void check();
nanjo 12:f7eb7dfa1356 76 char CIRCLE;
nanjo 12:f7eb7dfa1356 77 char CROSS;
nanjo 12:f7eb7dfa1356 78 char SQUARE;
nanjo 12:f7eb7dfa1356 79 char TRIANGLE;
nanjo 12:f7eb7dfa1356 80 char L1;
nanjo 12:f7eb7dfa1356 81 char L2;
nanjo 12:f7eb7dfa1356 82 char L3;
nanjo 12:f7eb7dfa1356 83 char R1;
nanjo 12:f7eb7dfa1356 84 char R2;
nanjo 12:f7eb7dfa1356 85 char R3;
nanjo 12:f7eb7dfa1356 86 char UPkey;
nanjo 12:f7eb7dfa1356 87 char DOWNkey;
nanjo 12:f7eb7dfa1356 88 char RIGHTkey;
nanjo 12:f7eb7dfa1356 89 char LEFTkey;
nanjo 15:8c49a263e344 90 char START;
nanjo 15:8c49a263e344 91 char SELECT;
nanjo 12:f7eb7dfa1356 92 signed char RX;
nanjo 12:f7eb7dfa1356 93 signed char RY;
nanjo 12:f7eb7dfa1356 94 signed char LX;
nanjo 12:f7eb7dfa1356 95 signed char LY;
nanjo 12:f7eb7dfa1356 96 char rs_x_check();
nanjo 12:f7eb7dfa1356 97 char rs_y_check();
nanjo 12:f7eb7dfa1356 98 char ls_x_check();
nanjo 12:f7eb7dfa1356 99 char ls_y_check();
nanjo 12:f7eb7dfa1356 100 ~SBDBT();
nanjo 12:f7eb7dfa1356 101 };
nanjo 12:f7eb7dfa1356 102
nanjo 9:8538fc8f6259 103
gotto0 0:afe58893bfe7 104 #endif