#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "../roomba/roomba.h"
#include "../rtos/os.h"
#include "../uart/uart.h"
Go to the source code of this file.
Queue globals
Definition at line 58 of file remote.c.
Enumerator |
---|
FULL_BACK |
|
HALF_BACK |
|
DEAD_ZONE |
|
HALF_FORWARD |
|
FULL_FORWARD |
|
Definition at line 47 of file remote.c.
Application level main function. Creates the required tasks and then terminates
Definition at line 548 of file remote.c.
Initializes A to D conversion.
Definition at line 173 of file remote.c.
Auto mode, Drive straight forward.
Definition at line 426 of file remote.c.
void Bluetooth_Receive |
( |
| ) |
|
Receive the joystick, laser, and mode data from the base station over bluetooth.
Definition at line 486 of file remote.c.
Send the photocell reading back to the base station.
Definition at line 472 of file remote.c.
int buffer_dequeue |
( |
int * |
queue, |
|
|
int * |
front, |
|
|
int * |
rear |
|
) |
| |
Dequeues the value from the specified buffer and returns it.
Definition at line 105 of file remote.c.
void buffer_enqueue |
( |
int |
val, |
|
|
int * |
queue, |
|
|
int * |
front, |
|
|
int * |
rear |
|
) |
| |
Enqueues the value into the specified buffer.
Definition at line 94 of file remote.c.
int buffer_isEmpty |
( |
int * |
front, |
|
|
int * |
rear |
|
) |
| |
Returns 1 if the buffer is empty.
Definition at line 87 of file remote.c.
int buffer_isFull |
( |
int * |
front, |
|
|
int * |
rear |
|
) |
| |
Returns 1 if the buffer is full.
Definition at line 80 of file remote.c.
Drive straight backwards
Definition at line 386 of file remote.c.
Sets PORTH3 to low.
Definition at line 162 of file remote.c.
Sets PORTL2 to low.
Definition at line 136 of file remote.c.
Sets PORTL5 to low.
Definition at line 149 of file remote.c.
Sets PORTL6 to low.
Definition at line 123 of file remote.c.
Sets PORTH3 to high.
Definition at line 156 of file remote.c.
Sets PORTL2 to high.
Definition at line 130 of file remote.c.
Sets PORTL5 to high.
Definition at line 143 of file remote.c.
Sets PORTL6 to high.
Definition at line 117 of file remote.c.
Get the bumper and virtual wall data packets from the Roomba.
Definition at line 335 of file remote.c.
Idle task to run when nothing else is ready.
Definition at line 198 of file remote.c.
Checks the laserQueue, if something is available to dequeue, do it and turn the laser state on or off depending on the value.
Definition at line 207 of file remote.c.
void LightSensor_Task |
( |
| ) |
|
Sample the lightsensor and if a spike is detected, then the roomba is hit and it is time to die. Every half a second also recalculate the threshold value to account for the roomba moving between light and dark places.
Definition at line 295 of file remote.c.
Drive in the direction the joystick is pointing.
Definition at line 393 of file remote.c.
Do the opposite of the Roombas current state.
Definition at line 353 of file remote.c.
Determine what movement to make based on sensors, and whether it is in manual or auto mode.
Definition at line 433 of file remote.c.
Initializes Timer4 to control the servo. Timer4 is configured as phase and frequency PWM mode with a prescaler of 64 and non-inverted PWM. OCR4A=375 Then sets the servo to the middle. 0 degrees = 125, 90 degrees = 375, and 180 degrees= 625.
Definition at line 181 of file remote.c.
Slowly move the servo to the desired goal (servoState). If the servo is in the deadzone, do not move.
Definition at line 229 of file remote.c.
void Set_Photocell_Threshold |
( |
| ) |
|
Takes three readings from the photocells and averages them to get a threshold for what the room is currently like.
Definition at line 260 of file remote.c.
uint8_t BluetoothReceivePID |
uint8_t GetSensorDataTaskPID |
uint8_t LightSensorTaskPID |
uint16_t photocellReading |