ジャイロ追加前

Dependencies:   mbed FreeRTOS

typedef.h

Committer:
MasashiNomura
Date:
2018-12-18
Revision:
30:13ada1a24c59
Parent:
27:ff63c23bc689
Child:
31:56c554c560c1

File content as of revision 30:13ada1a24c59:

#ifndef _TYPEDEF_H_
#define _TYPEDEF_H_
/////////////////////////////////////////////////////////////////////
#include "debug.h"
#include <bitset>

//Asciiコード
#define BS  0x08
#define HT  0x09
#define TAB 0x09
#define LF  0x0A
#define CR  0x0D
#define SPC 0x20
#define ESC 0x1B

/*  
 *  共通で使用する型の定義
 *
 */

typedef unsigned char   UCHAR;
typedef unsigned short  UINT16;
typedef short           INT16;
typedef unsigned int    UINT32;

//ユーザースイッチ(ハンドル)のレジスタ読み値のビットフィールド
typedef union{
    UINT16  w;
    struct{    
        UCHAR brk_l     : 1;
        UCHAR brk_r     : 1;
        UCHAR resv_1    : 1;
        UCHAR resv_2    : 1;
        UCHAR mot_stop  : 1;
        UCHAR resv_3    : 1;
        UCHAR resv_4    : 1;
        UCHAR resv_5    : 1;
        UCHAR resv_6    : 1;
        UCHAR all_stop  : 1;
        // UCHAR axl_r : 1;
        // UCHAR axl_l : 1;
        // UCHAR stop : 1;
        // UCHAR y_ctrl : 1;
        // UCHAR eng_stop : 1;
    }bf;
}typUserSw;

//姿勢制御用PIDパラメータ構造体
typedef struct{
    float PP;
    float P;
    float I;
    float D;
    float IMax;
    float IMin;
}typPidPara;

//モーターのパラメータ構造体
typedef struct{
    //UCHAR num;
    //INT16 offset;
    INT16 limit_hi;
    INT16 limit_low;
}typMotPara;

enum DIR_TYPE {
    CW,         // +
    CCW,        // -
    UNK,        // 不定
};
enum DIR_ATT_TYPE{
    CLOSING,    // 近づく方向
    GO_AWAY,    // 遠のく方向
    UNK_DIR,        // 不定
};
typedef struct{
    float tarAng;       //ターゲット角度
    float curAng;       //現在の角度
    float curAngVelo;   //角速度
    DIR_TYPE dir;         //回転方向
    DIR_ATT_TYPE dir_att;  //ターゲット角度に向かっているかどうかの方向
}TypeAttData;

typedef std::bitset<4> typFlg4Mot;
/////////////////////////////////////////////////////////////////////
#endif