Luki.B.
25.10.2008, 12:24
Hi Leute, kann mir irgendjemand sagen mit welcher Funktion ich die IO-Ports des RP6 abfragen kann, den Code der Funktionen getBumper_left() und getBumper_right() verstehe ich nämlich nicht.
(
/**
* Returns true if the the left Bumper is hit.
* This function turns off the LED connected to the port, reads the Bumper
* value and restores previous LED state afterwards!
*
* Example:
*
* if(getBumperLeft())
* // do something
*/
uint8_t getBumperLeft(void)
{
PORTB &= ~SL6;
DDRB &= ~SL6;
nop();
uint8_t tmp = PINB & SL6;
if(statusLEDs.LED6) {
DDRB |= SL6;
PORTB |= SL6;
}
return tmp;
}
/**
* Returns true if the the right Bumper is hit.
* This function turns off the LED connected to the port, reads the Bumper
* value and restores previous LED state afterwards!
*
* Example:
*
* if(getBumperRight())
* // do something
*/
uint8_t getBumperRight(void)
{
PORTC &= ~SL3;
DDRC &= ~SL3;
nop();
uint8_t tmp = PINC & SL3;
if(statusLEDs.LED3) {
DDRC |= SL3;
PORTC |= SL3;
}
return tmp;
}
)
Jan Lukas #-o #-o
(
/**
* Returns true if the the left Bumper is hit.
* This function turns off the LED connected to the port, reads the Bumper
* value and restores previous LED state afterwards!
*
* Example:
*
* if(getBumperLeft())
* // do something
*/
uint8_t getBumperLeft(void)
{
PORTB &= ~SL6;
DDRB &= ~SL6;
nop();
uint8_t tmp = PINB & SL6;
if(statusLEDs.LED6) {
DDRB |= SL6;
PORTB |= SL6;
}
return tmp;
}
/**
* Returns true if the the right Bumper is hit.
* This function turns off the LED connected to the port, reads the Bumper
* value and restores previous LED state afterwards!
*
* Example:
*
* if(getBumperRight())
* // do something
*/
uint8_t getBumperRight(void)
{
PORTC &= ~SL3;
DDRC &= ~SL3;
nop();
uint8_t tmp = PINC & SL3;
if(statusLEDs.LED3) {
DDRC |= SL3;
PORTC |= SL3;
}
return tmp;
}
)
Jan Lukas #-o #-o