Tyler Altenhofen / Mbed 2 deprecated TylerPOVController

Dependencies:   mbed

main.cpp

Committer:
tyleralt
Date:
2015-04-21
Revision:
0:c8b0c4f50d18
Child:
1:533b878c22ab

File content as of revision 0:c8b0c4f50d18:

#include "mbed.h"
#include <vector>
#define BUFFER_SIZE 16
#define NUMBER_OF_SLICES 120


int offAngles [8] = {0, 180, 90, 270, 45, 225, 135, 315};
char slice_data [NUMBER_OF_SLICES][16]; //[slice][specific led distance] (0 is closest) & with approppriate bit for each arm 

class Point {
    int positionRadian, positionHeight, positionDistance;
    int arraySlice;
    char identifyingChar;
    public: 
    Point (int , int , int );
    int getArraySlice(void);
    char getIdentifyingChar(void);
    int getPositionDistance(void);
    void moveUp();
    void moveDown();
    void moveUp();
    void moveDown();
    void rotateRight();
    void rotateLeft();
    void moveIn();
    void moveOut();
        
};
Point :: Point (int posRadian, int posHeight, int posDistance){
    positionRadian = posRadian;
    positionHeight = posHeight;
    positionDistance = posDistance;
    arraySlice = positionRadian + offAngles[positionHeight];
    identifyingChar = 0x01 << posHeight;
}     
int Point :: getArraySlice (void){
    return arraySlice;
}
char Point :: getIdentifyingChar(void){
    return identifyingChar;
}
int Point :: getPositionDistance(void){
    return positionDistance;
}
void moveUp(){
    if (positionHeight < 7){
        positionHeight ++;
        IdentifyingChar << 1;
    }
}
void moveDown(){
    if(poisitiongHeight > 0){
        positionHeight --;
        IdentifyingChar >> 1;
    
void moveUp();
void moveDown();
void rotateRight();
void rotateLeft();
void moveIn();
void moveOut();
    
enum drawingMode { line, point, circle }
drawingMode currentMode;

InterruptIn buttonMode(p15);
InterruptIn buttonUp(p16);
InterruptIn buttonDown(p17);
InterruptIn buttonRotateRight(p18);
InterruptIn buttonRotateLeft(p19);
InterruptIn buttonMoveOut(p20);
InterruptIn buttonMoveIn(p21);

Ticker pointer;

void changeMode(){
}
void moveUp(){
}
void moveDown(){
}
void rotateRight(){
}
void rotateLeft(){
}
void moveOut(){
}
void moveIn(){
}
void pointerBlink(){
}

        

int main() {
    currentMode = point;
    buttonMode.rise(&changeMode);
    buttonUp.rise(&moveUp);
    buttonDown.rise(&moveDown);
    buttonRotateRight.rise(&rotateRight);
    buttonRotateLeft.rise(&rotateLeft);
    buttonMoveOut.rise(&moveOut);
    buttonMoveIn.rise(&moveIn);
    pointer.attach(&pointerBlink, .3);

    for (int i = 0; i < NUMBER_OF_SLICES; i ++){
        for (int j = 0; j < 16; j ++){
            slice_data = 0x00;
        }
    }
    changeMode.rise(&rotate_sense);
    

}