static void s_overridden_appl_initialise_services(void) { eOipv4addr_t ipaddress = eom_ipnet_GetIPaddress(eom_ipnet_GetHandle()); // if we want to use another board ... uncomment the following for board 10.0.1.2 ... or change to other address. // ipaddress = eo_common_ipv4addr(10, 0, 1, 2); // initialise services ... eo_services_Initialise(ipaddress); // and start them on the basis of the boardnumber // ..... DONT DO IT ANYMORE because now we use runtime configuration. // eo_services_Start(eo_services_GetHandle()); }
extern void eom_emsappl_hid_userdef_initialise(EOMtheEMSappl* p) { EOMtheEMSapplCfg* emsapplcfg = eom_emsapplcfg_GetHandle(); // the led-pulser is initted as first thing // pulse led3 forever at 20 hz. eo_ledpulser_Start(eo_ledpulser_GetHandle(), eo_ledpulser_led_three, EOK_reltime1sec/20, 0); { // board number is from IP address s_boardnum = 0; eOipv4addr_t ipaddress = eom_ipnet_GetIPaddress(eom_ipnet_GetHandle()); s_boardnum = ipaddress >> 24; s_boardnum --; if(s_boardnum > 16) { //return; s_boardnum = 0; } //s_boardnum = 0; //it imposes that the board is the eb1 } { // CAN-MAPPING // marco.accame on 19 may 2015: here we load the map of can ... and also we map the entities into some can boards // ... if we have any. EOtheCANmapping * canmap = eo_canmap_Initialise(NULL); // now i load the map of can boards EOconstvector *canboards = eoboardconfig_code2canboards(s_boardnum); eo_canmap_LoadBoards(canmap, canboards); // now i load mc-joints, mc-motors, as-strain, as-mais, sk-skin EOconstvector *entitydes = NULL; // mc entitydes = eoboardconfig_code2entitydescriptors(s_boardnum, eoprot_endpoint_motioncontrol, eoprot_entity_mc_joint); eo_canmap_ConfigEntity(canmap, eoprot_endpoint_motioncontrol, eoprot_entity_mc_joint, entitydes); entitydes = eoboardconfig_code2entitydescriptors(s_boardnum, eoprot_endpoint_motioncontrol, eoprot_entity_mc_motor); eo_canmap_ConfigEntity(canmap, eoprot_endpoint_motioncontrol, eoprot_entity_mc_motor, entitydes); // as entitydes = eoboardconfig_code2entitydescriptors(s_boardnum, eoprot_endpoint_analogsensors, eoprot_entity_as_strain); eo_canmap_ConfigEntity(canmap, eoprot_endpoint_analogsensors, eoprot_entity_as_strain, entitydes); entitydes = eoboardconfig_code2entitydescriptors(s_boardnum, eoprot_endpoint_analogsensors, eoprot_entity_as_mais); eo_canmap_ConfigEntity(canmap, eoprot_endpoint_analogsensors, eoprot_entity_as_mais, entitydes); // sk entitydes = eoboardconfig_code2entitydescriptors(s_boardnum, eoprot_endpoint_skin, eoprot_entity_sk_skin); eo_canmap_ConfigEntity(canmap, eoprot_endpoint_skin, eoprot_entity_sk_skin, entitydes); } { // CAN-PROTOCOL EOtheCANprotocol * canprot = eo_canprot_Initialise(NULL); } { // ETH-PROTOCOL // marco.accame on 24 apr 2015: here is how to customise the eth protocol from a generic to a specific board // so far, we can keep it in here. but further on we shall customise one endpoint at a time in runtime. EOnvSet* nvset = eom_emstransceiver_GetNVset(eom_emstransceiver_GetHandle()); uint8_t i = 0; // 1. set the board number. the value of the generic board is 99. // the correct value is used only for retrieving it later on and perform specific actions based on the board number eo_nvset_BRDlocalsetnumber(nvset, s_boardnum); EOconstvector* epcfg_cvector = eoboardconfig_code2EPcfg(s_boardnum); // 2. load all the endpoints specific to this board. the generic board loads only management uint16_t numofepcfgs = eo_constvector_Size(epcfg_cvector); for(i=0; i<numofepcfgs; i++) { eOprot_EPcfg_t* epcfg = (eOprot_EPcfg_t*) eo_constvector_At(epcfg_cvector, i); if(eobool_true == eoprot_EPcfg_isvalid(epcfg)) { eo_nvset_LoadEP(nvset, epcfg, eobool_true); } } // now we must define the .... proxy rules // if we have board number equal to 1 or 3 ... (eb2 or eb4) then we set it for mc only eOprotBRD_t localboard = eoprot_board_local_get(); if((1 == localboard) || (3 == localboard)) { eoprot_config_proxied_variables(eoprot_board_localboard, eoprot_endpoint_motioncontrol, eoprot_b02_b04_mc_isproxied); } } // start the application body eOemsapplbody_cfg_t applbodyconfig; memcpy(&applbodyconfig, &theemsapplbodycfg, sizeof(eOemsapplbody_cfg_t)); // now i get the encoder config const eOappEncReader_cfg_t *enccfg = eoboardconfig_code2encoderconfig(s_boardnum); memcpy(&applbodyconfig.encoderreaderconfig, enccfg, sizeof(eOappEncReader_cfg_t)); eo_emsapplBody_Initialise(&applbodyconfig); }