示例#1
0
/**
 * constructor for the configuration manager
 * (which pulls together all the pieces)
 */
Config::Config() {

	// load up the shift cascade configurations
	input = &inCfg;
	output = &outCfg;

	// load up the LED configuration
	leds = new LedCfg();

	// figure out how many sensors are configured
	int num_sensors = 0;
	for ( int i = 0; i < 256; i++ ) {
		if (get_sensor_data(i, X_zone) == 0xff)
			break;
		num_sensors++;
	}
	sensors = new SensorCfg( num_sensors );

	// figure out how many control pins are configured
	int num_controls = 0;
	for( int i = 0; i < 8; i++ ) {
		int p = get_ctrl_data(i, CTRL_PIN);
		if (p < 0)
			break;
		num_controls++;
	}
	controls = new CtrlCfg(num_controls);
}
示例#2
0
int XY_Get_Ctrl_Data(attitude_data_t *_data)
{
	if(check_ctrl_data_if_available() == -1)
	{
		return -1;
	}

	*_data = get_ctrl_data();
	return 0;
}
示例#3
0
int CtrlCfg::scale( int i ) {
	return (i < num_bits) ?  get_ctrl_data(i, CTRL_SCALE) : -1;
}
示例#4
0
bool CtrlCfg::sense( int i ) {
	return (i < num_bits) ?  get_ctrl_data(i, CTRL_SENSE) : -1;
}
示例#5
0
int CtrlCfg::pin( int i ) {
	return (i < num_bits) ?  get_ctrl_data(i, CTRL_PIN) : -1;
}