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(); }
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(); }
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(); }
Module::~Module() { endCommand(); qDeleteAll( d->modules ); delete d->project; delete d; }
void I2CFlexel::getTimeAndDate(byte* timeAndDate) { beginCommand(I2C_FLEXEL_COMMAND_GET_TIME_AND_DATE); endCommand(); requestBytes(7); readBytes(timeAndDate, 7); }
byte I2CFlexel::getFirmwareVersion() { beginCommand(I2C_FLEXEL_COMMAND_GET_FIRMWARE_VERSION); endCommand(); requestByte(); return readByte(); }
void I2CFlexel::setPwmForHighPowerPin(byte pin, byte pwmValue) { beginCommand(I2C_FLEXEL_COMMAND_SET_PWM_FOR_HIGH_POWER_PIN); sendCommandParameter(pin); sendCommandParameter(pwmValue); endCommand(); }
void I2CFlexel::setPwmForDcMotor(byte motorAndPosition, byte pwmValue) { beginCommand(I2C_FLEXEL_COMMAND_SET_PWM_FOR_DC_MOTOR); sendCommandParameter(motorAndPosition); sendCommandParameter(pwmValue); endCommand(); }
byte I2CFlexel::readKey(byte command) { beginCommand(command); endCommand(); requestByte(); return readByte(); }
void I2CFlexel::setServoMotorPosition(byte pin, byte msb, byte lsb) { beginCommand(I2C_FLEXEL_COMMAND_SET_SERVO_MOTOR_POSITION); sendCommandParameter(pin); sendCommandParameter(msb); sendCommandParameter(lsb); endCommand(); }
void I2CFlexel::setTime(byte sec, byte min, byte hour) { beginCommand(I2C_FLEXEL_COMMAND_SET_TIME); sendCommandParameter(sec); sendCommandParameter(min); sendCommandParameter(hour); endCommand(); }
void I2CFlexel::getAnalogInputValue(byte pin, byte* analog) { beginCommand(I2C_FLEXEL_COMMAND_GET_ANALOG_INPUT_VALUE); sendCommandParameter(pin); endCommand(); requestBytes(2); readBytes(analog, 2); }
/** * 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(); }
/** * 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(); }
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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * Reads the battery's current voltage in millivolts. */ uint16_t cm_read_battery_voltage(void) { sendByte(CmdSensors); padCommand(); sendByte(SEN_VOLTAGE); endCommand(); return readWord(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }