summaryrefslogtreecommitdiffstats
path: root/source/AVR_Studio/Soccer/hal/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/AVR_Studio/Soccer/hal/board.c')
-rwxr-xr-xsource/AVR_Studio/Soccer/hal/board.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/source/AVR_Studio/Soccer/hal/board.c b/source/AVR_Studio/Soccer/hal/board.c
index b01d79c..458ed03 100755
--- a/source/AVR_Studio/Soccer/hal/board.c
+++ b/source/AVR_Studio/Soccer/hal/board.c
@@ -31,13 +31,13 @@ Board::Board() {
DDRG = (1 << PG0) | (1 << PG1) | (1 << PG2) | (1 << PG3) | (1 << PG4);
PORTG = (1 << PG0) | (1 << PG1);
- // aktiviere Kanal A+C auf PWM1 mit 8Bit
- //TCCR1A = (1<< COM1A1) | (1<< COM1C1) | (1<< WGM10);
- //TCCR1B = (1<<ICNC1) | (1<<CS12) | (1<<CS10); // set clock/prescaler 1/1024 -> enable counter
+ // aktiviere Kanal A+B auf PWM1 mit 8Bit
+ TCCR1A = (1<< COM1A1) | (1<< COM1B1) | (1<< WGM10);
+ TCCR1B = (1<<ICNC1) | (1<<CS12) | (1<<CS10); // set clock/prescaler 1/1024 -> enable counter
// aktiviere Kanal A+B auf PWM3 mit 8Bit
- //TCCR3A = (1<< COM3A1) | (1<< COM3B1) | (1<< WGM10);
- //TCCR3B = (1<<ICNC3) | (1<<CS32) | (1<<CS30); // set clock/prescaler 1/1024 -> enable counter
+ TCCR3A = (1<< COM3A1) | (1<< COM3B1) | (1<< WGM10);
+ TCCR3B = (1<<ICNC3) | (1<<CS32) | (1<<CS30); // set clock/prescaler 1/1024 -> enable counter
// Schalte Motoren auf 0
motor(0,0);
@@ -45,6 +45,10 @@ Board::Board() {
motor(2,0);
motor(3,0);
+ // Kicker-richtung einstellen
+ PORTE &= ~(1 << PE6); // Pin2 low
+ PORTA |= (1 << PA2); // Pin1 high
+
// Uart-Interface einschalten
uart1_init( 10); // 9600 BAUD bei 16MHz Atmel
@@ -198,27 +202,35 @@ void Board::motor(int i, int speed)
MOTOR2_PORT |= MOTOR2_A;//In 1 ein
}
}
- else if(i == 3)
+ else if(i == 3) // Dribbler... hier haben wir kein PWM
{
- DRIBBLER_PWM = pwm;
if(speed > 0)
{
DRIBBLER_PORT |= DRIBBLER_A;//In 1 ein
DRIBBLER_PORT &= ~DRIBBLER_B;//In 2 aus
+ DRIBBLER_PWMPORT |= DRIBBLER_PWM;
}
else if(speed < 0)
{
DRIBBLER_PORT |= DRIBBLER_B;//In 2 ein
DRIBBLER_PORT &= ~DRIBBLER_A;//In 1 aus
+ DRIBBLER_PWMPORT |= DRIBBLER_PWM;
}
else
{
DRIBBLER_PORT |= DRIBBLER_B;//In 2 ein
DRIBBLER_PORT |= DRIBBLER_A;//In 1 ein
+ DRIBBLER_PWMPORT &= ~DRIBBLER_PWM;
}
}
}
+void Board::kicker() {
+ KICKER_AN
+ usleep(KICKER_USLEEP);
+ KICKER_AUS
+}
+
//PWM routine für den Beeper
ISR (TIMER0_OVF_vect)
{