75 lines
1.4 KiB
C++
Executable file
75 lines
1.4 KiB
C++
Executable file
#ifndef _BOARD_H_
|
|
#define _BOARD_H_
|
|
|
|
#include <avr/io.h>
|
|
#include <avr/interrupt.h>
|
|
#include <stdlib.h>
|
|
//#include "uart.h"
|
|
#include "../global.h"
|
|
|
|
//#define abs(a) ((a < 0)? -a : a)
|
|
|
|
#define BEEPER_PIN PG2
|
|
|
|
// Definiere Konstanten für die Motoren/Dribbler
|
|
#define MOTOR0_PORT PORTB
|
|
#define MOTOR0_PWM OCR1A
|
|
#define MOTOR0_A (1 << 0)
|
|
#define MOTOR0_B (1 << 1)
|
|
|
|
#define MOTOR1_PORT PORTB
|
|
#define MOTOR1_PWM OCR1B
|
|
#define MOTOR1_A (1 << 2)
|
|
#define MOTOR1_B (1 << 3)
|
|
|
|
#define MOTOR2_PORT PORTD
|
|
#define MOTOR2_PWM OCR3A
|
|
#define MOTOR2_A (1 << 5)
|
|
#define MOTOR2_B (1 << 4)
|
|
|
|
|
|
// Dribbler
|
|
#define DRIBBLER_PORT PORTD
|
|
#define DRIBBLER_AN PORTA |= (1 << 5);
|
|
#define DRIBBLER_AUS PORTA &= ~(1 << 5);
|
|
#define DRIBBLER_A (1 << 6)
|
|
#define DRIBBLER_B (1 << 7)
|
|
|
|
// Kicker
|
|
#define KICKER_AN PORTG |= (1 << PG3);
|
|
#define KICKER_AUS PORTG &= ~(1 << PG3);
|
|
#define KICKER_USLEEP 10
|
|
|
|
|
|
// Definiere Konstanten für Abstandsensoren
|
|
#define ABSTAND_PORT PORTC
|
|
#define ABSTAND_DDR DDRC
|
|
#define ABSTAND_PIN PINC
|
|
|
|
#define UART_BAUD_RATE 9600
|
|
|
|
class Board
|
|
{
|
|
private:
|
|
public:
|
|
Board();
|
|
~Board();
|
|
|
|
int GetADC(uint8_t channel);
|
|
int GetAbstand(int i);
|
|
|
|
void beep(int freq);
|
|
void ledOn();
|
|
void ledOff();
|
|
void led(bool status);
|
|
void motor(int i, int speed);
|
|
void kicker();
|
|
|
|
void dribbler(bool status);
|
|
void dribblerOn();
|
|
void dribblerOff();
|
|
};
|
|
|
|
#endif
|
|
|
|
|