Final Project files for mBed development.

Dependencies:   m3pi mbed

project.h

Committer:
John Wilkey
Date:
2014-11-13
Revision:
6:00b7198f0b51
Parent:
5:01882c3de2dc
Child:
7:6e5cc24e1ce7

File content as of revision 6:00b7198f0b51:

/**
 * @file    project.h
 * @brief   Main header file for includes and whatnot 
 *          for the other project files.
 * @author  John Wilkey
 */
 
#ifndef _PROJECT_H
#define _PROJECT_H

#include <stdio.h>
#include "mbed.h"
#include "m3pi.h"
#define TURN_SPEED 0.25
#define DRIVE_SPEED 0.5
#define ERR_SUCCESS 0
#define ERR_FAILURE 1

/**
 * @brief   Provides access to the digital outputs on the mbed controller.
 *
 * Note that by default these output pins are hardwired to the 6 LEDs that 
 * stripe the development extension board. 
 */
typedef struct {
    DigitalOut pin15(p15),
    DigitalOut pin15(p15),
    DigitalOut pin15(p15),
    DigitalOut pin15(p16),
    DigitalOut pin15(p17),
    DigitalOut pin15(p18),
    DigitalOut pin15(p19),
    DigitalOut pin15(p20)
} digi_out_pins;

/**
 * @brief Driver forward.
 *
 * @param[in]   amt     Amount to drive forward.
 * @param[in]   spd     Drive speed.
 * @return              Success or failure. 
 */
int foward(float amt, float spd);

/**
 * @brief Drive backward.
 *
 * @param[in]   amt     Amount to drive backward.
 * @param[in]   spd     Drive speed.
 * @return              Success or failure. 
 */
int backward(float amt);

/**
 * @brief Turn right.
 *
 * @param[in]   deg     Desired final turn angle from starting position.
 * @param[in]   spd     Desired turning speed.
 * @return              Success or failure. 
 */
int right(float deg);

/**
 * @brief Turn left.
 *
 * @param[in]   deg     Desired final turn angle from starting position.
 * @param[in]   spd     Desired turning speed.
 * @return              Success or failure. 
 */
int left (float deg);

/**
 * @brief Controller decision logic.
 *
 * Decide what to do next based on the status of the drawing so far.
 *
 */
void next_action();

/**
 * @brief Print a formatted message to the LCD
 */
void pretty_print(char* msg);



#endif