Exemple #1
0
	void I2CFlexel::loadLcdCustomCharacters(byte addr, byte *bitmap)
	{
		beginCommand(I2C_FLEXEL_COMMAND_LOAD_LCD_CUSTOM_CHARACTERS);
		sendCommandParameter(addr);
		sendCommandParameters(bitmap, I2C_FLEXEL_LCD_CHAR_ROWS_COUNT);
		endCommand();
	}
/**
 * Sends the provided byte out over IR.
 */
void cm_send_ir(const uint8_t &data)
{
	sendByte(CmdIRChar);
	padCommand();
	sendByte(data);
	endCommand();
}
/**
 * Plays the song stored under the given number.
 */
void cm_play_song(const uint8_t &song_number)
{
	sendByte(CmdPlay);
	padCommand();
	sendByte(song_number);
	endCommand();
}
Exemple #4
0
	void I2CFlexel::setLcdCursorPosition(byte row, byte column)
	{
		beginCommand(I2C_FLEXEL_COMMAND_SET_LCD_CURSOR_POSITION);
		sendCommandParameter(min(I2C_FLEXEL_LCD_MAX_ROWS_COUNT - 1, row));
		sendCommandParameter(min(I2C_FLEXEL_LCD_MAX_COLS_COUNT - 1, column));
		endCommand();
	}
Exemple #5
0
	void I2CFlexel::printStringOnLcd(const char *str, uint8_t length)
	{
		beginCommand(I2C_FLEXEL_COMMAND_PRINT_STRING_ON_LCD);
		sendCommandParameter(length);
		sendCommandParameters( (byte*) str, length);
		endCommand();
	}
/**
 * Tells the robot to play the specified demo.
 *   See the DEMO_* constants for more information.
 */
void cm_play_demo(const uint8_t &demo)
{
	sendByte(CmdDemo);
	padCommand();
	sendByte(demo);
	endCommand();
}
Exemple #7
0
Module::~Module()
{
    endCommand();
    qDeleteAll( d->modules );
    delete d->project;
    delete d;
}
Exemple #8
0
	void I2CFlexel::getTimeAndDate(byte* timeAndDate)
	{
		beginCommand(I2C_FLEXEL_COMMAND_GET_TIME_AND_DATE);
		endCommand();
		requestBytes(7);
		readBytes(timeAndDate, 7);
	}
Exemple #9
0
	byte I2CFlexel::getFirmwareVersion()
	{
		beginCommand(I2C_FLEXEL_COMMAND_GET_FIRMWARE_VERSION);
		endCommand();
		requestByte();
		return readByte();
	}
Exemple #10
0
	void I2CFlexel::setPwmForHighPowerPin(byte pin, byte pwmValue)
	{
		beginCommand(I2C_FLEXEL_COMMAND_SET_PWM_FOR_HIGH_POWER_PIN);
		sendCommandParameter(pin);
		sendCommandParameter(pwmValue);
		endCommand();
	}
Exemple #11
0
	void I2CFlexel::setPwmForDcMotor(byte motorAndPosition, byte pwmValue)
	{
		beginCommand(I2C_FLEXEL_COMMAND_SET_PWM_FOR_DC_MOTOR);
		sendCommandParameter(motorAndPosition);
		sendCommandParameter(pwmValue);
		endCommand();
	}
Exemple #12
0
	byte I2CFlexel::readKey(byte command)
	{
		beginCommand(command);
		endCommand();
		requestByte();
		return readByte();
	}
Exemple #13
0
	void I2CFlexel::setServoMotorPosition(byte pin, byte msb, byte lsb)
	{
		beginCommand(I2C_FLEXEL_COMMAND_SET_SERVO_MOTOR_POSITION);
		sendCommandParameter(pin);
		sendCommandParameter(msb);
		sendCommandParameter(lsb);
		endCommand();
	}
Exemple #14
0
	void I2CFlexel::setTime(byte sec, byte min, byte hour)
	{
		beginCommand(I2C_FLEXEL_COMMAND_SET_TIME);
		sendCommandParameter(sec);
		sendCommandParameter(min);
		sendCommandParameter(hour);
		endCommand();
	}
Exemple #15
0
	void I2CFlexel::getAnalogInputValue(byte pin, byte* analog)
	{
		beginCommand(I2C_FLEXEL_COMMAND_GET_ANALOG_INPUT_VALUE);
		sendCommandParameter(pin);
		endCommand();
		requestBytes(2);
		readBytes(analog, 2);
	}
Exemple #16
0
/**
 * Reads the strength of the wall sensor's signal.
 * The range is 0 to 4095.
 */
uint16_t cm_read_wall_signal(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_WALL_SIGNAL);
	endCommand();
	
	return readWord();
}
Exemple #17
0
/**
 * Reads the strength of the front left cliff sensor's signal.
 * The range is 0 to 4095.
 */
uint16_t cm_read_front_left_cliff_signal(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_FRONT_LEFT_CLIFF_SIGNAL);
	endCommand();
	
	return readWord();
}
Exemple #18
0
	void I2CFlexel::setDate(byte wday, byte day, byte month, byte year)
	{
		beginCommand(I2C_FLEXEL_COMMAND_SET_DATE);
		sendCommandParameter(wday);
		sendCommandParameter(day);
		sendCommandParameter(month);
		sendCommandParameter(year);
		endCommand();
	}
Exemple #19
0
/**
 * Reads the strength of the far right cliff sensor's signal.
 * The range is 0 to 4095.
 */
uint16_t cm_read_right_cliff_signal(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_FAR_RIGHT_CLIFF_SIGNAL);
	endCommand();
	
	return readWord();
}
Exemple #20
0
/**
 * Reads the current Open Interface mode.
 * See the OI_MODE_* codes in the cm.h header.
 */
uint8_t cm_read_oi_mode(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_OI_MODE);
	endCommand();
	
	return readByte();
}
Exemple #21
0
/**
 * Reads the battery's estimated charge capacity in milliamp-hours.
 * Note: This value is not accurate if the robot is running off Alkaline batteries.
 */
uint16_t cm_read_battery_capacity(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_CAPACITY);
	endCommand();
	
	return readWord();
}
Exemple #22
0
/**
 * Reads the number of the currently-playing song.
 * Range is 0-15.
 */
uint8_t cm_read_current_song_number(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_SONG_NUMBER);
	endCommand();
	
	return readByte();
}
Exemple #23
0
/**
 * Returns the last-requested radius.
 * Range is -32768 to 32767, units are in millimeters.
 */
uint16_t cm_read_requested_radius(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_RADIUS);
	endCommand();
	
	return readWord();
}
Exemple #24
0
/**
 * Returns 1 if there is a song currently playing.
 */
uint8_t cm_read_is_song_playing(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_SONG_PLAYING);
	endCommand();
	
	return readByte();
}
Exemple #25
0
/**
 * Reads the battery's current temperature in degrees Celsius.
 */
int8_t cm_read_battery_temperature(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_TEMPERATURE);
	endCommand();
	
	return readWord();
}
Exemple #26
0
/**
 * Reads the battery's current charge in milliamp-hours.
 * Note: This value is not accurate if the robot is running off Alkaline batteries.
 */
uint16_t cm_read_battery_charge(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_CHARGE);
	endCommand();
	
	return readWord();
}
Exemple #27
0
/**
 * Reads the battery's current voltage in millivolts.
 */
uint16_t cm_read_battery_voltage(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_VOLTAGE);
	endCommand();
	
	return readWord();
}
Exemple #28
0
/**
 * Reads the amount of current running into (positive values) or out of (negative values)
 *   the robot's battery.
 */
int16_t cm_read_battery_current(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_CURRENT);
	endCommand();
	
	return readWord();
}
Exemple #29
0
/**
 * Returns the last-requested speed for the left wheel.
 * Range is -500 to 500, in millimeters per second.
 */
uint16_t cm_read_requested_left_speed(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_LEFT_WHEEL_SPEED);
	endCommand();
	
	return readWord();
}
Exemple #30
0
/**
 * Reads the battery's current charging state.
 * See the BATTERY_* codes in the cm.h header.
 */
uint8_t cm_read_charging_state(void)
{
	sendByte(CmdSensors);
	padCommand();
	sendByte(SEN_CHARGE_STATE);
	endCommand();
	
	return readByte();
}