first

Dependents:   17robo_fuzi 17robo_tokyo_kaede

Committer:
echo_piyo
Date:
Sun Sep 24 05:24:33 2017 +0000
Revision:
0:59256c750167
????2??

Who changed what in which revision?

UserRevisionLine numberNew contents of line
echo_piyo 0:59256c750167 1 /*
echo_piyo 0:59256c750167 2 ver1.0
echo_piyo 0:59256c750167 3 Sbdbt Name(tx,rx)
echo_piyo 0:59256c750167 4 sbdbtに接続するtx,rx
echo_piyo 0:59256c750167 5
echo_piyo 0:59256c750167 6 ver2.0
echo_piyo 0:59256c750167 7 Sbdbt Name(tx,rx)
echo_piyo 0:59256c750167 8 sbdbtに接続するtx,rx
echo_piyo 0:59256c750167 9
echo_piyo 0:59256c750167 10 begin(baudrate)
echo_piyo 0:59256c750167 11 sbdbtと通信するbaudrateを決定
echo_piyo 0:59256c750167 12
echo_piyo 0:59256c750167 13 ボタンデータ 0/1
echo_piyo 0:59256c750167 14 shikaku, l1, l2, r1, r2, start, select,
echo_piyo 0:59256c750167 15 up, down, right, left, sankaku, batu, maru
echo_piyo 0:59256c750167 16
echo_piyo 0:59256c750167 17 アナログスティックデータ -1 ~ 1
echo_piyo 0:59256c750167 18 left_x, left_y, right_x, right_y;
echo_piyo 0:59256c750167 19
echo_piyo 0:59256c750167 20 sbdbtから受信したデータ
echo_piyo 0:59256c750167 21 open_data[data_byte];
echo_piyo 0:59256c750167 22 */
echo_piyo 0:59256c750167 23
echo_piyo 0:59256c750167 24 #ifndef MBED_SBDBT_H
echo_piyo 0:59256c750167 25 #define MBED_SBDBT_H
echo_piyo 0:59256c750167 26
echo_piyo 0:59256c750167 27 #include "mbed.h"
echo_piyo 0:59256c750167 28 #include "bit_test.h"
echo_piyo 0:59256c750167 29
echo_piyo 0:59256c750167 30 #define start_byte 0b10000000
echo_piyo 0:59256c750167 31 #define Shikaku 0
echo_piyo 0:59256c750167 32 #define L1 1
echo_piyo 0:59256c750167 33 #define L2 2
echo_piyo 0:59256c750167 34 #define R1 3
echo_piyo 0:59256c750167 35 #define R2 4
echo_piyo 0:59256c750167 36 #define Start 0b00000011
echo_piyo 0:59256c750167 37 #define Select 0b00001100
echo_piyo 0:59256c750167 38 #define Up 0
echo_piyo 0:59256c750167 39 #define Down 1
echo_piyo 0:59256c750167 40 #define Right 2
echo_piyo 0:59256c750167 41 #define Left 3
echo_piyo 0:59256c750167 42 #define Sankaku 4
echo_piyo 0:59256c750167 43 #define Batu 5
echo_piyo 0:59256c750167 44 #define Maru 6
echo_piyo 0:59256c750167 45 #define EvenNeutral 0b01000000
echo_piyo 0:59256c750167 46 #define OddNeutral 0b00111111
echo_piyo 0:59256c750167 47 #define data_byte 8
echo_piyo 0:59256c750167 48 #define input_byte 7
echo_piyo 0:59256c750167 49
echo_piyo 0:59256c750167 50 class Sbdbt{
echo_piyo 0:59256c750167 51 public :
echo_piyo 0:59256c750167 52 Sbdbt(PinName mbed_tx, PinName mbed_rx, PinName pin_pairing);
echo_piyo 0:59256c750167 53 void begin(long baudrate);
echo_piyo 0:59256c750167 54 int get_pairingState();
echo_piyo 0:59256c750167 55
echo_piyo 0:59256c750167 56 short shikaku;
echo_piyo 0:59256c750167 57 short l1;
echo_piyo 0:59256c750167 58 short l2;
echo_piyo 0:59256c750167 59 short r1;
echo_piyo 0:59256c750167 60 short r2;
echo_piyo 0:59256c750167 61 short start;
echo_piyo 0:59256c750167 62 short select;
echo_piyo 0:59256c750167 63 short up;
echo_piyo 0:59256c750167 64 short down;
echo_piyo 0:59256c750167 65 short right;
echo_piyo 0:59256c750167 66 short left;
echo_piyo 0:59256c750167 67 short sankaku;
echo_piyo 0:59256c750167 68 short batu;
echo_piyo 0:59256c750167 69 short maru;
echo_piyo 0:59256c750167 70 float left_x;
echo_piyo 0:59256c750167 71 float left_y;
echo_piyo 0:59256c750167 72 float right_x;
echo_piyo 0:59256c750167 73 float right_y;
echo_piyo 0:59256c750167 74 int open_data[data_byte];
echo_piyo 0:59256c750167 75
echo_piyo 0:59256c750167 76 private :
echo_piyo 0:59256c750167 77 Serial SBDBT;
echo_piyo 0:59256c750167 78 DigitalIn pairing;
echo_piyo 0:59256c750167 79
echo_piyo 0:59256c750167 80 int read, data_start, checksum, byte,
echo_piyo 0:59256c750167 81 buffer[data_byte], data[data_byte];
echo_piyo 0:59256c750167 82 int Left_X, Left_Y, Right_X, Right_Y ;
echo_piyo 0:59256c750167 83
echo_piyo 0:59256c750167 84 void init();
echo_piyo 0:59256c750167 85 void check();
echo_piyo 0:59256c750167 86 void data_receive();
echo_piyo 0:59256c750167 87 };
echo_piyo 0:59256c750167 88
echo_piyo 0:59256c750167 89 #endif