2022_Ateam_MOTORprogramをscrp_slaveでメインマイコンからコントローラー状況を読み取れるように改良。 また、モータに0以外のpwmが送られている場合に基盤付属のledが点灯するようにした。

Dependencies:   SBDBT arrc_mbed BNO055

library/function.hpp

Committer:
guesta
Date:
2022-04-08
Revision:
13:369f4abc1f36
Parent:
12:894e5ac49810

File content as of revision 13:369f4abc1f36:

#ifndef function_hpp
#define function_hpp
#include "mbed.h"

//変数
bool auto_mode = false;
int x_component;
int y_component;
int l_x_component;
int l_y_component;
int l2_num;
int r2_num;
int right_phase;
bool up;
bool down;
bool l1;
bool r1;
bool auto_start;
int stop;
bool auto_move;
bool redZone = 0;

//Rスティックのx成分取得
bool getLstick_x(int rx_data,int &tx_data){
    x_component = rx_data;
    return true;
}

//Rスティックのy成分取得
bool getLstick_y(int rx_data,int &tx_data){
    y_component = rx_data;
    return true;
}

//Lスティックのx成分取得
bool getRstick_x(int rx_data,int &tx_data){
    l_x_component = rx_data;
    return true;
}

bool getRstick_y(int rx_data,int &tx_data){
    l_y_component = rx_data;
    return true;
}

//L1取得
bool getL2(int rx_data,int &tx_data){
     l2_num = rx_data;
     return true;
}

//R2取得
bool getR2(int rx_data,int &tx_data){
     r2_num = rx_data;
     return true;
}
     

//自動、手動モード切り替え
bool change_mode(int rx_data,int &tx_data){
    auto_mode = rx_data;
    return true;
}

//上キー取得
bool getUp(int rx_data,int &tx_data){
     up = rx_data;
     return true;
}

//下キー取得
bool getDown(int rx_data,int &tx_data){
     down = rx_data;
     return true;
}

//L1取得
bool getL1(int rx_data,int &tx_data){
    l1 = rx_data;
    return true;
}

//R1取得
bool getR1(int rx_data,int &tx_data){
    r1 = rx_data;
    return true;
}

//auto_start取得
bool getStart(int rx_data,int &tx_data){
    auto_start = rx_data;
    return true;
}

//自動移動開始読み取り
bool getCircle(int rx_data,int &tx_data){
    auto_move = rx_data;
    return true;
}

//フィールド読み取り
bool getZone(int rx_data,int &tx_data){
    redZone = rx_data;
    return true;
}
    
//非常停止
bool getStop(int rx_data,int &tx_data){
    stop = rx_data;
    return true;
}


#endif