Roomba Tank
CSC 460 Project 3
Macros | Functions | Variables
base.c File Reference
#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.

Macros

#define F_CPU   16000000
 
#define MAX   10
 

Functions

int buffer_isFull (int *front, int *rear)
 
int buffer_isEmpty (int *front, int *rear)
 
void buffer_enqueue (int val, int *queue, int *front, int *rear)
 
int buffer_dequeue (int *queue, int *front, int *rear)
 
void Idle ()
 
void InitADC ()
 
void JoystickTask ()
 
void SwitchTask ()
 
void LaserTask ()
 
void bluetoothReceive ()
 
void screenTask ()
 
void RoombaTask ()
 
void a_main ()
 

Variables

unsigned int IdlePID
 
MUTEX bluetooth_mutex
 
MUTEX ls_mutex
 
MUTEX adc_mutex
 
int x
 
int y = 375
 
int rx
 
int ry
 
uint16_t photocellReading
 
uint8_t LASER = 0
 
uint8_t SERVO = 1
 
uint8_t LS = 2
 
uint8_t SCREEN = 3
 
uint8_t ROOMBA = 4
 
uint8_t MODE = 5
 
int servoState = 375
 
uint8_t laser = 0
 
uint8_t previousLaser = 0
 
uint8_t mode = 0
 
uint8_t previousMode = 0
 
int lSQueue [MAX]
 
int lSFront = 0
 
int lSRear = 0
 

Macro Definition Documentation

#define F_CPU   16000000

Definition at line 1 of file base.c.

#define MAX   10

Definition at line 35 of file base.c.

Function Documentation

void a_main ( )

Application level main function. Creates the required tasks and then terminates

Definition at line 317 of file base.c.

void bluetoothReceive ( )

Receives the lightsensor data from the remote station over bluetooth.

Definition at line 207 of file base.c.

int buffer_dequeue ( int *  queue,
int *  front,
int *  rear 
)

Dequeues the value from the specified buffer and returns it.

Definition at line 70 of file base.c.

void buffer_enqueue ( int  val,
int *  queue,
int *  front,
int *  rear 
)

Enqueues the value into the specified buffer.

Definition at line 58 of file base.c.

int buffer_isEmpty ( int *  front,
int *  rear 
)

Return 1 if the buffer is empty.

Definition at line 51 of file base.c.

int buffer_isFull ( int *  front,
int *  rear 
)

Return 1 if the buffer is full.

Definition at line 44 of file base.c.

void Idle ( )

Idle task to run when nothing else is ready.

Definition at line 85 of file base.c.

void InitADC ( )

Initializes A to D conversion.

Definition at line 93 of file base.c.

void JoystickTask ( )

Reads x from the joystick and sends it over bluetooth to the remote station.

Definition at line 101 of file base.c.

void LaserTask ( )

Read the digital pin for the laser pushbutton and if it has changed, send the data to the remote station.

Definition at line 181 of file base.c.

void RoombaTask ( )

Reads x and y from the joystick and maps them to commands to send to the remote station for control over the Roomba.

Definition at line 248 of file base.c.

void screenTask ( )

Definition at line 235 of file base.c.

void SwitchTask ( )

Reads a digital button and if it has changed, send a byte to the remote station.

Definition at line 155 of file base.c.

Variable Documentation

MUTEX adc_mutex

Definition at line 14 of file base.c.

MUTEX bluetooth_mutex

Definition at line 12 of file base.c.

unsigned int IdlePID

Definition at line 10 of file base.c.

uint8_t LASER = 0

Definition at line 20 of file base.c.

uint8_t laser = 0

Definition at line 29 of file base.c.

uint8_t LS = 2

Definition at line 22 of file base.c.

MUTEX ls_mutex

Definition at line 13 of file base.c.

int lSFront = 0

Definition at line 38 of file base.c.

int lSQueue[MAX]

Definition at line 37 of file base.c.

int lSRear = 0

Definition at line 39 of file base.c.

uint8_t MODE = 5

Definition at line 25 of file base.c.

uint8_t mode = 0

Definition at line 32 of file base.c.

uint16_t photocellReading

Definition at line 18 of file base.c.

uint8_t previousLaser = 0

Definition at line 30 of file base.c.

uint8_t previousMode = 0

Definition at line 33 of file base.c.

uint8_t ROOMBA = 4

Definition at line 24 of file base.c.

int rx

Definition at line 17 of file base.c.

int ry

Definition at line 17 of file base.c.

uint8_t SCREEN = 3

Definition at line 23 of file base.c.

uint8_t SERVO = 1

Definition at line 21 of file base.c.

int servoState = 375

Definition at line 27 of file base.c.

int x

Definition at line 16 of file base.c.

int y = 375

Definition at line 16 of file base.c.