コード例 #1
0
ファイル: motors.c プロジェクト: kralf/era-libs
void era_motors_init(era_motors_p motors, can_device_p can_dev, 
  era_config_joint_p config) {
  if (!can_dev) {
    can_dev = malloc(sizeof(can_device_t));
    can_init(can_dev, 0);
  }

  epos_node_p node_a = (epos_node_p)motors;
  config_p config_a = (config_p)config;
  int i;
  for (i = 0; i < sizeof(era_motors_t)/sizeof(epos_node_t); ++i)
    epos_init(&node_a[i], can_dev, &config_a[i]);

  era_motors_home_init(motors);
}
コード例 #2
0
ファイル: epos.c プロジェクト: ptroja/libepos
void epos_init_arg(epos_node_p node, int argc, char **argv, const char* 
  prefix) {
  can_device_p can_dev = malloc(sizeof(can_device_t));
  can_init_arg(can_dev, argc, argv, 0);

  config_t config;
  if (config_init_arg(&config, argc, argv, (prefix) ? prefix : 
      EPOS_CONFIG_ARG_PREFIX)) {
    config_print_help(stdout, &epos_default_config, EPOS_CONFIG_ARG_PREFIX);
    config_print_help(stdout, &can_default_config, CAN_CONFIG_ARG_PREFIX);
    exit(0);
  }
    
  epos_init(node, can_dev, &config);

  config_destroy(&config);
}