4 #include <avr/interrupt.h> 5 #include <util/delay.h> 6 #include "../roomba/roomba.h" 7 #include "../rtos/os.h" 8 #include "../uart/uart.h" 81 return (*rear == (*front - 1) %
QSize);
88 return (*rear == *front);
99 *rear = (*rear + 1) %
QSize;
109 int result = queue[*front];
110 *front = (*front + 1) %
QSize;
118 PORTL |= _BV(PORTL6);
124 PORTL &= ~_BV(PORTL6);
131 PORTL |= _BV(PORTL2);
137 PORTL &= ~_BV(PORTL2);
144 PORTL |= _BV(PORTL5);
150 PORTL &= ~_BV(PORTL5);
157 PORTL |= _BV(PORTH3);
163 PORTL &= ~_BV(PORTH3);
175 ADCSRA |= (1<<ADEN) | (1<<ADPS0) | (1<<ADPS1) | (1<<ADPS2);
188 TCCR4A = (1<<COM4A1) | (1<<COM4B1) | (1<<WGM41);
189 TCCR4B |= (1<<WGM43) | (1<<WGM42) | (1<<CS41) | (1<<CS40);
265 ADMUX = (ADMUX & 0xE0);
267 ADMUX = (ADMUX | 0x07);
273 while((ADCSRA)&(1<<ADSC));
279 while((ADCSRA)&(1<<ADSC));
285 while((ADCSRA)&(1<<ADSC));
300 ADMUX = (ADMUX & 0xE0);
302 ADMUX = (ADMUX | 0x07);
308 while((ADCSRA)&(1<<ADSC));
496 if(( UCSR1A & (1<<RXC1))) {
520 else if (flag ==
ROOMBA) {
525 else if (flag ==
MODE) {
int buffer_isEmpty(int *front, int *rear)
int buffer_dequeue(int *queue, int *front, int *rear)
uint8_t BluetoothReceivePID
uint8_t LightSensorTaskPID
void Bluetooth_Send_Byte(uint8_t data_out)
void Set_Photocell_Threshold()
void buffer_enqueue(int val, int *queue, int *front, int *rear)
enum laser_states LASER_STATES
void Task_Terminate(void)
unsigned char Bluetooth_Receive_Byte()
enum servo_states SERVO_STATES
uint8_t GetSensorDataTaskPID
PID Task_Create(voidfuncptr f, PRIORITY py, int arg)
int buffer_isFull(int *front, int *rear)
void Roomba_Play(uint8_t song)
unsigned char Roomba_Receive_Byte()
uint16_t photocellReading
void Bluetooth_UART_Init()
void Roomba_Drive(int16_t velocity, int16_t radius)
void Mutex_Unlock(MUTEX m)
void Roomba_QueryList(uint8_t packet1, uint8_t packet2)