}
-#define BUMPER_PIN 17 // bumper pin (SCK1)
-#define COLOR_PIN 8 // bumper pin (SDA/P0.3)
+#define BUMPER_PIN 17 // bumper pin (SCK1/P0_17)
+#define COLOR_PIN 3 // change color of dress pin (SDA1/P0_3)
-#define BUMPER_LEFT 21 // Port 1
-#define BUMPER_RIGHT 23 // Port 1
+#define BUMPER_LEFT 19 // left bumper MOSI1/P0_19
+#define BUMPER_RIGHT 9 // right bumper RXD1/P0_9
void handle_bumper()
{
- if (IO0PIN & (1<<BUMPER_PIN))
+ if (IO1PIN & (1<<BUMPER_PIN))
sw &= ~CAN_SWITCH_BUMPER;
else
sw |= CAN_SWITCH_BUMPER;
else
sw |= CAN_SWITCH_LEFT;
- if (IO1PIN & (1<<BUMPER_RIGHT))
+ if (IO0PIN & (1<<BUMPER_RIGHT))
sw &= ~CAN_SWITCH_RIGHT;
else
sw |= CAN_SWITCH_RIGHT;
SET_PIN(PINSEL0, COLOR_PIN, PINSEL_0);
SET_PIN(PINSEL1, 1, PINSEL_0); // inicializace bumper pinu (FIXME SET_PIN je BLBA implemetace, musim ji nekdy opravit)
-/* SET_PIN(PINSEL1, BUMPER_LEFT, PINSEL_0); */
-/* SET_PIN(PINSEL1, BUMPER_RIGHT, PINSEL_0); */
+ SET_PIN(PINSEL1, 3, PINSEL_0);
+ SET_PIN(PINSEL0, BUMPER_RIGHT, PINSEL_0);
- IO0DIR &= ~((1<<START_PIN) | (1<<BUMPER_PIN) | (1 << COLOR_PIN));
- IO1DIR &= ~((1<<BUMPER_LEFT) | (1<<BUMPER_RIGHT));
+ IO0DIR &= ~((1<<START_PIN) | (1<<BUMPER_RIGHT) | (1 << COLOR_PIN));
+ IO1DIR &= ~((1<<BUMPER_PIN) | (1<<BUMPER_LEFT));
- IO1DIR &= ~(3<<20);
+ //IO1DIR &= ~(3<<20);
send_rs_str("Vidle started\n");
// The above send_rs_str is importat - we wait for the first AD conversion to be finished