2021A Conste RX/TX lib

Dependents:   R21_ConsteSlave2

conste.h

Committer:
TakushimaYukimasa
Date:
2021-11-04
Revision:
0:847ba7e5b1a0
Child:
1:b67e696c0ec3
Child:
2:4571cb39d887

File content as of revision 0:847ba7e5b1a0:

#ifndef INCLUDED_CONSTE_h_
#define INCLUDED_CONSTE_h_

#include "mbed.h"

/* マクロ定義 ----------------------------------------------------------------*/

/* 定数定義 ------------------------------------------------------------------*/

/* クラス定義 ----------------------------------------------------------------*/

/*******************************************************************************
 * @名称   CONSTE
 * @概要   2021Aチーム コントロールステーション受信クラス
*******************************************************************************/
class CONSTE
{
private:

    /* 受信割り込み用関数 */
    void uartRX(void);
    
    uint8_t severalRX;
    
    /* 受信生データ */
    uint8_t readData[255];
    uint8_t readLoc;
    /* 各種処理済みデータ */
    uint8_t arrayRestore[255];
    
    
public:
    Serial uart;
    Timer lostRX;
    
    CONSTE(PinName tx, PinName rx, int baud);
    
    // 操作パラメータ
    bool baseStart;
    bool baseEMO;
    
    /* 受信データ */
    //タイマ時間(ms)
    uint32_t timeMs;
    // タイマが動いてるか否か
    bool isStart;
    // 非常停止状態 (trueの時はモーターを止めてください)
    bool isEMO;
    // ロボットの状態 1…モード異常 2…座標追従失敗 3…正常
    uint8_t RobotStat[3];
    
    
    /* 送信データ */
    // 識別番号 0…のあ 1…ねぷちゅーん 2…とりとん 4…リモコン1 6…リモコン2
    uint8_t identificationNum;
    /* ロボット送信データ */
    // ロボットの状態 1…モード異常 2…座標追従失敗 3…正常
    uint8_t status;
    /* リモコン送信データ */
    // 非常停止SW状態
    bool swEMO;
    // スタートSW状態
    bool swStart;
    // バッテリ電圧 (4bit)
    int8_t batteryRemain;
};

#endif