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" 45 return *rear == (*front - 1) &
MAX;
52 return *rear == *front;
64 *rear = (*rear + 1) %
MAX;
75 int result = queue[*front];
77 *front = (*front + 1) %
MAX;
95 ADCSRA|=(1<<ADEN)|(1<<ADPS0)|(1<<ADPS1)|(1<<ADPS2);
107 ADMUX = (ADMUX & 0xE0);
113 while((ADCSRA)&(1<<ADSC));
134 else if ((
x <= 380) && (
x >= 370)) {
158 PORTL |= (1<<PORTL1);
161 mode = (PINL & _BV(PL1)) ? 0 : 1;
183 PORTB |= (1<<PORTB1);
186 laser = (PINB & _BV(PB1)) ? 0 : 1;
214 if(( UCSR1A & (1<<RXC1))) {
220 ls_data = (ls_data1<<8) | (ls_data2);
254 ADMUX = (ADMUX & 0xE0);
260 while((ADCSRA)&(1<<ADSC));
265 ADMUX = (ADMUX & 0xE0);
273 while((ADCSRA)&(1<<ADSC));
279 if ((
ry > 750) && (
rx > 250) && (
rx < 750)) {
282 else if ((
ry < 250) && (
rx > 250) && (
rx < 750)) {
285 else if ((
rx > 750) && (
ry > 250) && (
ry < 750)) {
288 else if ((
rx < 250) && (
ry > 250) && (
ry < 750)) {
291 else if ((
ry > 750) && (
rx > 750)) {
294 else if ((
ry > 750) && (
rx < 250)) {
297 else if ((
ry < 250) && (
rx > 750)) {
300 else if ((
ry < 250) && (
rx < 250)) {
uint16_t photocellReading
int buffer_isFull(int *front, int *rear)
void Bluetooth_Send_Byte(uint8_t data_out)
void Task_Terminate(void)
unsigned char Bluetooth_Receive_Byte()
int buffer_isEmpty(int *front, int *rear)
PID Task_Create(voidfuncptr f, PRIORITY py, int arg)
void Bluetooth_UART_Init()
int buffer_dequeue(int *queue, int *front, int *rear)
void Mutex_Unlock(MUTEX m)
void buffer_enqueue(int val, int *queue, int *front, int *rear)