ジャパンオープン用のメインプログラム

Dependencies:   mbed AQM1602 HMC6352 PID

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.h Source File

main.h

00001 #ifndef _MAIN_H_
00002 #define _MAIN_H_
00003 
00004 #include "def.h"
00005 
00006 //pc(Computer)
00007 RawSerial pc(monitor_tx, monitor_rx);
00008 //led(main)
00009 //DigitalOut LED[4]={led1, led2, led3, led4};
00010 BusOut LED(led1, led2, led3, led4);
00011 //line(bottom)
00012 BusOut LineKeeper(lineInA, lineInB, lineInC);
00013 BusIn LineRaw(lineA2, lineB2, lineC2);
00014 BusIn LineHold(lineA1, lineB1, lineC1);
00015 InterruptIn Line[3]={lineA2, lineB2, lineC2};
00016 InterruptIn LineHolding[3]={lineA1, lineB1, lineC1};
00017 //ballcheck(bottom)
00018 InterruptIn BallChecker(ballcheck);
00019 AnalogIn BallCheckerA(ballcheck);
00020 //debug_switch(debug_board)
00021 DigitalIn Sw[4] = {selectsw1, selectsw2, debugsw1, debugsw2};
00022 //motor(main)
00023 Serial motor(motor_tx, motor_rx);
00024 //spi(main)
00025 SPI spi(SPI_mosi, SPI_miso, SPI_slck);
00026 DigitalOut spi_ss[4]={SPI_ss_sd, SPI_ss_sonic, SPI_ss_color, SPI_ss_ir};
00027 //bluetooth(debug_board)
00028 RawSerial RN42(blue_rxd, blue_txd);
00029 DigitalOut hmc_reset(blue_reset);
00030 //lcd(debug_board)
00031 AQM1602 Lcd(lcd_sda, lcd_scl);
00032 //cmps(debug_board)
00033 HMC6352 hmc(sens_sda, sens_scl);
00034 //mouse(bottom)
00035 adns_9800 mouse_sensor(mouse_mosi, mouse_miso, mouse_slck, mouse_ss);
00036 //solenoid(bottom)
00037 DigitalOut kicker(solenoid);
00038 
00039 //Serial for motors
00040 int speed[4]={0};
00041 string StringFIN;
00042 //PID
00043 PID pid(P_GAIN,I_GAIN,D_GAIN, RATE);
00044 //Ticker pidupdate;
00045 //for Serial
00046 volatile uint8_t INdata[DATA_NUM]={0}, EXdata[DATA_NUM]={0};
00047 //for DataSet
00048 //Record data;
00049 //NewStruct
00050 CompassVal cmps_set;
00051 SensorVal data;
00052 SystemVal sys;
00053 //for transition
00054 Ticker Sw_ticker;
00055 Timeout button;
00056 bool state[4]={0,0,0,0};
00057 uint8_t statesum=0, last_statesum=0;
00058 // for Time
00059 Ticker Motor_ticker;
00060 //Ticker Line_ticker;
00061 Ticker Info_ticker;
00062 //Ticker Hmc_ticker;
00063 
00064 //Timeout Line_timeout[3];
00065 Timeout Line_reset;
00066 
00067 Timeout Solenoid_timeout;
00068 Timeout Kick_stop;
00069 
00070 Timeout Turn_timeout;
00071 Timeout Turn_stop;
00072 
00073 Timeout Ball_judge;
00074 
00075 //Timeout Kick_now;
00076 //Timeout Front_now;
00077 //Timeout Line_home;
00078 
00079 Ticker Duty[DUTY_NUM];
00080 Timeout Stp;
00081 double dutycycle[DUTY_NUM] ={//[s]
00082     0.2
00083 };
00084 
00085 #endif /*_MAIN_H_*/