Пример #1
0
extern void eom_emsappl_hid_userdef_on_exit_RUN(EOMtheEMSappl* p)
{    
    // EOtheCANservice: set straigth mode and force parsing of all packets in the RX queues.
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    eo_canserv_ParseAll(eo_canserv_GetHandle());  
  
    
    // stop services 
    
    // motion-control
    eo_motioncontrol_Stop(eo_motioncontrol_GetHandle());
    eo_motioncontrol_Deactivate(eo_motioncontrol_GetHandle());
    
    // stop tx activity of services that may have been started by callback function
    
    // strain... no strain in here
//    eo_strain_Stop(eo_strain_GetHandle());
//    eo_strain_Deactivate(eo_strain_GetHandle());
        
    // skin
    eo_skin_Stop(eo_skin_GetHandle());
    eo_skin_Deactivate(eo_skin_GetHandle());
        
    // mais
    eo_mais_Stop(eo_mais_GetHandle());
    eo_mais_Deactivate(eo_mais_GetHandle());

    // inertials
    eo_inertials2_Stop(eo_inertials2_GetHandle());    
    eo_inertials2_Deactivate(eo_inertials2_GetHandle());
}
extern void eoprot_fun_UPDT_as_mais_config_mode(const EOnv* nv, const eOropdescriptor_t* rd)
{
    eOas_maismode_t *maismode = (eOas_maismode_t*)rd->data;
    eo_mais_ConfigMode(eo_mais_GetHandle(), *maismode);
    
//    //uint8_t number = eoprot_ID2index(rd->id32);
//    eOas_maismode_t *maismode = (eOas_maismode_t*)rd->data;
//    eOsmStatesEMSappl_t currentstate = eo_sm_emsappl_STerr;
//    eOcanprot_command_t command = {0};
//    command.class = eocanprot_msgclass_pollingAnalogSensor;
//    command.type  = ICUBCANPROTO_POL_AS_CMD__SET_TXMODE;
//    command.value = maismode;
//    
//    //if pc104 tell me to enable maistx, before to send cmd verify if i'm in RUN state:
//    // if yes ==> ok no problem
//    // if no ==> i'll send cmd when go to RUN state
//    if(eoas_maismode_txdatacontinuously == *maismode)
//    {
//        //only if the appl is in RUN state enable mais tx
//        eom_emsappl_GetCurrentState(eom_emsappl_GetHandle(), &currentstate);
//        if(eo_sm_emsappl_STrun == currentstate)
//        {
//            eo_canserv_SendCommandToEntity(eo_canserv_GetHandle(), &command, rd->id32);
//        }
//    }
//    else
//    {
//         eo_canserv_SendCommandToEntity(eo_canserv_GetHandle(), &command, rd->id32);
//    }
}
Пример #3
0
extern void eom_emsappl_hid_userdef_on_entry_ERR(EOMtheEMSappl* p)
{
    // pulse led3 forever at 4 hz.
    eo_ledpulser_Start(eo_ledpulser_GetHandle(), eo_ledpulser_led_three, EOK_reltime1sec/4, 0);
   

    // EOtheCANservice: set straight mode and force parsing of all packets in the RX queues.
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    eo_canserv_ParseAll(eo_canserv_GetHandle());  

    
    
    // stop services which may have been started 
    
    // motion-control
    eo_motioncontrol_Stop(eo_motioncontrol_GetHandle());
    eo_motioncontrol_Deactivate(eo_motioncontrol_GetHandle());
        
    // stop tx activity of services that may have been started by callback function
    
    // strain... no strain in here
//    eo_strain_Stop(eo_strain_GetHandle());
//    eo_strain_Deactivate(eo_strain_GetHandle());
        
    // skin
    eo_skin_Stop(eo_skin_GetHandle());
    eo_skin_Deactivate(eo_skin_GetHandle());
        
    // mais
    eo_mais_Stop(eo_mais_GetHandle());
    eo_mais_Deactivate(eo_mais_GetHandle());

    // inertials
    eo_inertials2_Stop(eo_inertials2_GetHandle());    
    eo_inertials2_Deactivate(eo_inertials2_GetHandle());
    
    // inertials3
    eo_inertials3_Stop(eo_inertials3_GetHandle());    
    eo_inertials3_Deactivate(eo_inertials3_GetHandle());
    
    // temperatures
    eo_temperatures_Stop(eo_temperatures_GetHandle());    
    eo_temperatures_Deactivate(eo_temperatures_GetHandle());     
}
extern void eoprot_fun_UPDT_as_mais_config_datarate(const EOnv* nv, const eOropdescriptor_t* rd)
{
    uint8_t *datarate = (uint8_t*)rd->data;
    eo_mais_ConfigDataRate(eo_mais_GetHandle(), *datarate);
    
//    eOcanprot_command_t command = {0};
//    command.class = eocanprot_msgclass_pollingAnalogSensor;
//    command.type  = ICUBCANPROTO_POL_AS_CMD__SET_CANDATARATE;
//    command.value = datarate;
//    
//    eo_canserv_SendCommandToEntity(eo_canserv_GetHandle(), &command, rd->id32);    
}
extern void eoprot_fun_UPDT_as_mais_config(const EOnv* nv, const eOropdescriptor_t* rd)
{
    eOas_mais_config_t *cfg = (eOas_mais_config_t*)rd->data;    
    eo_mais_Config(eo_mais_GetHandle(), cfg);
    
//    uint8_t number = eoprot_ID2index(rd->id32);
//    eOsmStatesEMSappl_t currentstate = eo_sm_emsappl_STerr;    
//    eOcanprot_command_t command = {0};
//    command.class = eocanprot_msgclass_pollingAnalogSensor;
//    
//    //if pc104 tell me to enable maistx, before to send cmd verify if i'm in RUN state:
//    // if yes ==> ok no problem
//    // if no ==> i'll send cmd when go to RUN state
//    if(eoas_maismode_txdatacontinuously == cfg->mode)
//    {
//        // only if the appl is in RUN state we enable mais tx
//        eom_emsappl_GetCurrentState(eom_emsappl_GetHandle(), &currentstate);
//        if(eo_sm_emsappl_STrun == currentstate)
//        {
//            command.type  = ICUBCANPROTO_POL_AS_CMD__SET_TXMODE;
//            command.value = &(cfg->mode);
//            eo_canserv_SendCommandToEntity(eo_canserv_GetHandle(), &command, rd->id32);
//        }
//    }    
//    
//    command.type  = ICUBCANPROTO_POL_AS_CMD__SET_CANDATARATE;
//    command.value = &(cfg->datarate);
//    eo_canserv_SendCommandToEntity(eo_canserv_GetHandle(), &command, rd->id32);

//    command.type  = ICUBCANPROTO_POL_AS_CMD__SET_RESOLUTION;
//    command.value = &(cfg->resolution);
//    eo_canserv_SendCommandToEntity(eo_canserv_GetHandle(), &command, rd->id32);    
//    
//    
//    eOas_mais_status_t *status = eo_entities_GetMaisStatus(eo_entities_GetHandle(), number);
//    if(NULL == status)
//    {
//        return; //error
//    }     

//    s_process_mais_resolution((eOas_maisresolution_t)cfg->resolution, status);
}
extern void eoprot_fun_UPDT_as_mais_config_resolution(const EOnv* nv, const eOropdescriptor_t* rd)
{
    eOas_maisresolution_t *resolution = (eOas_maisresolution_t*)rd->data;    
    eo_mais_ConfigResolution(eo_mais_GetHandle(), *resolution);
    
//    uint8_t number = eoprot_ID2index(rd->id32);
//    eOcanprot_command_t command = {0};
//    command.class = eocanprot_msgclass_pollingAnalogSensor;
//    command.type  = ICUBCANPROTO_POL_AS_CMD__SET_RESOLUTION;
//    command.value = resolution;
//    
//    eo_canserv_SendCommandToEntity(eo_canserv_GetHandle(), &command, rd->id32);    
//    
//    eOas_mais_status_t *status = eo_entities_GetMaisStatus(eo_entities_GetHandle(), number);
//    if(NULL == status)
//    {
//        return; //error
//    }     

//    s_process_mais_resolution(*resolution, status);   
}