Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Gamma Beta Alpha
Dependents: 2017_Bteam_I2CTransporter BETA_A ALPHA_A GAMMA_A
GammaPool.cpp
- Committer:
- Komazawa_sun
- Date:
- 2017-08-16
- Revision:
- 1:47ea89b6364e
- Parent:
- 0:52b800fb3844
File content as of revision 1:47ea89b6364e:
#include "GammaPool.h"
GammaPool::GammaPool()
:   _master(SDA, SCL)
{
    data_index[0] = ctrl.rx;
    data_index[1] = ctrl.ry;
    data_index[2] = ctrl.lx;
    data_index[3] = ctrl.r_sw1;
    data_index[4] = ctrl.r_sw2;
    data_index[5] = ctrl.r_sw3;
    data_index[6] = ctrl.r_sw4;
    data_index[7] = ctrl.r_s_sw1;
    data_index[8] = ctrl.r_s_sw2;
    data_index[9] = ctrl.l_sw1;
    data_index[10] = ctrl.l_sw2;
    data_index[11] = ctrl.l_sw3;
    data_index[12] = ctrl.l_sw4;
    data_index[13] = ctrl.l_s_sw1;
    data_index[14] = ctrl.l_s_sw2;
    data_index[15] = ctrl.mode1;
    data_index[16] = ctrl.mode2;
    data_index[17] = ctrl.r_srd;
    data_index[18] = ctrl.l_srd;
    data_index[19] = ar.r.max_limit;
    data_index[20] = ar.r.min_limit;
    data_index[21] = ar.l.max_limit;
    data_index[22] = ar.l.min_limit;
}
bool GammaPool::set()
{
    bool error = true;
    /*_master.transport(0, JUSHINKUN_ADDR,  0, ctrl.all_data, 10);
    _master.transport(APPER_BODY_ADDR, TspMode::send,    r.all_data,    4);
    _master.transport(APPER_BODY_ADDR, TspMode::reseive, r.all_data,    1);*/
    
    error &= ~_master.read(JUSHINKUN_ADDR, ctrl.all_data, 10);
    error &= ~_master.write(APPER_BODY_ADDR, a.all_data, 4);
    error &= ~_master.read(JUSHINKUN_ADDR, ar.all_data, 1);
    
    return error;
} 
int GammaPool::read(int index_num)
{
    return data_index[index_num];
}
        
void GammaPool::reset(){
    for(int t = 0; t < 10; t++)
        ctrl.all_data[t] = 0;
    for(int t = 0; t < 4; t++)
        a.all_data[t] = 0;
    ar.all_data[0] = 0;
}