serial arduino controller

Dependents:   serial_arduino 300_PS3Dribbler 300_PS3com Quadrifoglio_PS3COM

Committer:
THtakahiro702286
Date:
Tue Jun 07 04:10:16 2022 +0000
Revision:
0:a591557e4771
Child:
1:36350a60662e
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
THtakahiro702286 0:a591557e4771 1 #ifndef SA_H
THtakahiro702286 0:a591557e4771 2 #define SA_H
THtakahiro702286 0:a591557e4771 3
THtakahiro702286 0:a591557e4771 4 #include "mbed.h"
THtakahiro702286 0:a591557e4771 5
THtakahiro702286 0:a591557e4771 6 class SerialArduino
THtakahiro702286 0:a591557e4771 7 {
THtakahiro702286 0:a591557e4771 8 public:
THtakahiro702286 0:a591557e4771 9 SerialArduino(PinName TX, PinName RX, int baud);
THtakahiro702286 0:a591557e4771 10 //attachの関数 使用の必要なし
THtakahiro702286 0:a591557e4771 11 void serialLoop();
THtakahiro702286 0:a591557e4771 12 //debug用 ヘッダー1を返す
THtakahiro702286 0:a591557e4771 13 uint8_t getHedder1();
THtakahiro702286 0:a591557e4771 14 //debug用 ヘッダー1を返す
THtakahiro702286 0:a591557e4771 15 uint8_t getHedder2();
THtakahiro702286 0:a591557e4771 16 //ボタンを返す 引数0から11
THtakahiro702286 0:a591557e4771 17 bool getButton(int num);
THtakahiro702286 0:a591557e4771 18 //トリガーを返す 引数0から1
THtakahiro702286 0:a591557e4771 19 uint8_t getTrigger(int num);
THtakahiro702286 0:a591557e4771 20 //スティックを返す 引数0から3
THtakahiro702286 0:a591557e4771 21 uint8_t getStick(int num);
THtakahiro702286 0:a591557e4771 22 //タイムアウトカウントを返す
THtakahiro702286 0:a591557e4771 23 uint16_t getTimeoutCount();
THtakahiro702286 0:a591557e4771 24 //通信確認兼更新 毎ループ処理すること 通信できてれば1を返す
THtakahiro702286 0:a591557e4771 25 bool getState();
THtakahiro702286 0:a591557e4771 26
THtakahiro702286 0:a591557e4771 27 private:
THtakahiro702286 0:a591557e4771 28 // uint8_t buff[3];
THtakahiro702286 0:a591557e4771 29 bool state;
THtakahiro702286 0:a591557e4771 30 const bool high=1;
THtakahiro702286 0:a591557e4771 31 uint8_t hedder1;
THtakahiro702286 0:a591557e4771 32 uint8_t hedder2;
THtakahiro702286 0:a591557e4771 33 uint8_t b0;
THtakahiro702286 0:a591557e4771 34 uint8_t b1;
THtakahiro702286 0:a591557e4771 35 uint16_t button;
THtakahiro702286 0:a591557e4771 36 uint8_t timeout;
THtakahiro702286 0:a591557e4771 37 int past,timeoutCount;
THtakahiro702286 0:a591557e4771 38 bool b[12]={0};
THtakahiro702286 0:a591557e4771 39 uint8_t trigger[2]={0};
THtakahiro702286 0:a591557e4771 40 uint8_t stick[4]={0};
THtakahiro702286 0:a591557e4771 41
THtakahiro702286 0:a591557e4771 42 char CRLF[3] = "\r\n";
THtakahiro702286 0:a591557e4771 43 // uint16_t checkSum;
THtakahiro702286 0:a591557e4771 44 int i;
THtakahiro702286 0:a591557e4771 45 UnbufferedSerial mini;
THtakahiro702286 0:a591557e4771 46
THtakahiro702286 0:a591557e4771 47 };
THtakahiro702286 0:a591557e4771 48
THtakahiro702286 0:a591557e4771 49
THtakahiro702286 0:a591557e4771 50
THtakahiro702286 0:a591557e4771 51 #endif