Hallo

bumper_left und bumper_right funktionieren nur zusammen mit task_Bumpers(). Ohne das Tasksystem des RP6 kann man die Bumpers aber auch direkt mit getBumperLeft() und getBumperRight() auswerten:

Code:
/*****************************************************************************/
// Bumpers:

/**
 * 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;
}

// -------------------------------
// Bumpers State changed handler:

void BUMPERS_stateChanged_DUMMY(void){}
static void (*BUMPERS_stateChangedHandler)(void) = BUMPERS_stateChanged_DUMMY;
/**
 * Use this function to set the Bumpers state change handler. 
 * 
 */
void BUMPERS_setStateChangedHandler(void (*bumperHandler)(void)) 
{
	BUMPERS_stateChangedHandler = bumperHandler;
}
// -------------------------------

volatile uint8_t bumper_timer;
uint8_t bumper_left;
uint8_t bumper_right;

/**
 * If you call this frequently out of the mainloop (or use task_RP6System which
 * calls this routine for you), the global bumper_left and bumper_right
 * variables are updated automatically every 50ms and can be used everywhere
 * in your program. It can also call an event handler routine, that you
 * need to register with BUMPERS_setStateChangedHandler before.
 */
void task_Bumpers(void)
{
	if(bumper_timer > 50) { // 50ms
		uint8_t left = getBumperLeft();
		uint8_t right = getBumperRight();
		if(bumper_left != left || bumper_right != right) {
			bumper_left = left;
			bumper_right = right;
			BUMPERS_stateChangedHandler();
		}
		bumper_timer = 0;
	}
}
Die Funktionen der Bumper in der Datei RP6RobotBaseLib.c der RP6-Library.

Da ich kein M32 besitze verstehe ich nicht ganz, was du mit dem Programmausschnitt beabsichtigst. Ich vermute, es handelt sich um Code für die RP6-Base, weil das M32 selbst keine Bumper hat?

Gruß

mic