Main Program

Dependencies:   mbed AQM1602 HMC6352 PID

setting/main.h

Committer:
lilac0112_1
Date:
2016-02-02
Revision:
35:a0421268ee95
Parent:
31:0b0f64831771
Child:
40:f68474b1d5e7

File content as of revision 35:a0421268ee95:

#ifndef _MAIN_H_
#define _MAIN_H_

#include "def.h"

//pc(Computer)
RawSerial pc(monitor_tx, monitor_rx);
//led(main)
DigitalOut LED[4]={led1, led2, led3, led4};
//line(bottom)
BusOut LineSignalHolder(lineInA, lineInB, lineInC);
BusIn RawLineSignal(lineA2, lineB2, lineC2);
BusIn HeldLineSignal(lineA1, lineB1, lineC1);
InterruptIn Line[3]={lineA2, lineB2, lineC2};
//ballcheck(bottom)
DigitalIn BallChecker(ballcheck);
//debug_switch(debug_board)
DigitalIn Sw[4] = {selectsw1, selectsw2, debugsw1, debugsw2};
//motor(main)
Serial motor(motor_tx, motor_rx);
//spi(main)
SPI spi(SPI_mosi, SPI_miso, SPI_slck);
DigitalOut spi_ss[4]={SPI_ss_sd, SPI_ss_sonic, SPI_ss_color, SPI_ss_ir};
//bluetooth(debug_board)
RawSerial RN42(blue_rxd, blue_txd);
DigitalOut RN42_Reset(blue_reset);
//lcd(debug_board)
AQM1602 Lcd(lcd_sda, lcd_scl);
//cmps(debug_board)
HMC6352 hmc(sens_sda, sens_scl);
//mouse(bottom)
adns_9800 mouse_sensor(mouse_mosi, mouse_miso, mouse_slck, mouse_ss);
//solenoid(bottom)
DigitalOut kicker(solenoid);

//Serial for motors
int speed[4]={0};
string StringFIN;
//PID
PID pid(P_GAIN,I_GAIN,D_GAIN, RATE);
Ticker pidupdate;
//for Serial
volatile uint8_t INdata[DATA_NUM]={0}, EXdata[DATA_NUM]={0};
//for DataSet
Record data;
//for transition
Ticker Sw_ticker;
Timeout button;
bool state[4]={0,0,0,0};
uint8_t statesum=0, last_statesum=0;
// for Time
Ticker Motor_ticker;
Ticker Line_ticker;
Ticker Ir_ticker;
Ticker Solenoid_ticker;
Timeout Solenoid_timeout; 
Timeout Line_timeout;

Ticker Duty[DUTY_NUM];
Timeout Stp;
double dutycycle[DUTY_NUM] ={//[s]
    0.2
};

#endif /*_MAIN_H_*/