Repaired send func
[sudos/9s12.git] / sources / app / board.h
blob421da056953aa94aa7dab8f2da4ea5ada5b5d5a1
1 #ifndef BOARD_H
2 #define BOARD_H
4 #include "includes.h"
5 #include "image.h"
8 #define METER 3200
10 #define LED4 PORTB_PB4
11 #define LED3 PORTB_PB5
12 #define LED2 PORTB_PB6
13 #define LED1 PORTB_PB7
15 #define KEY1 PORTE_PE6
16 #define KEY2 PORTE_PE5
17 ///#define KEY3 PORTE_PE6
18 //#define KEY4 PORTE_PE7
20 #define D0 PORTA_PA0
21 #define D1 PORTA_PA1
22 #define D2 PORTA_PA2
23 #define D3 PORTA_PA3
24 #define D4 PORTA_PA4
25 #define D5 PORTA_PA5
26 #define D6 PORTA_PA6
27 #define D7 PORTA_PA7
29 #define FIFO_REN PORTB_PB0
30 #define FIFO_RCLK PORTB_PB1
31 #define FIFO_OE PORTB_PB2
33 #define ADC_OE PORTB_PB3
35 #define FIFO_RS PTT_PTT4
36 #define FIFO_WEN PTT_PTT5
37 #define FIFO_EF PTT_PTT6
39 #define ARM_RDY PTM_PTM0
40 #define ARM_MODE PTM_PTM5
41 #define ARM_CLK PTM_PTM3
42 #define ARM_RCVD PTM_PTM2
44 #define DATA_DDR PTS_PTS3
48 extern unsigned char image_data[VER][HOR];
51 /* **************************************************
52 * Board declared global variables .
53 * PAY ATTENTION to define each one at modified file.
54 * **************************************************/
56 extern byte LINECNT; //Count line numbers while IRQ is enable
57 extern byte FRAMECNT; //Count frame numbers while PJINT is enable
58 extern byte LINEACH;
59 extern byte CNTFLAG;
60 extern byte LOFCNT; //Count each LINEACH capture one line
61 extern int DR;
62 extern int SPEED;
63 extern byte data[LINE][PIEX];
66 extern byte EVNB; // Environment Brightness
67 extern bool KNOCK; // Task communicating
69 struct ctrl_data{
70 INT16U LOR;
71 INT16U WPLUS;
72 INT16U MOTOR;
73 INT16U RVS; // Control motor reverse running
76 struct mod_data{
77 byte MOD; // Trace Module. LINE:0; 'S'route:1; 'U'route:2;
78 byte STA; // Route stage. Basically 3 Stage will be implemented. 1: head into; 2: in middle; 3: head out
79 byte RQR; // Module change require. Almost occured from 'S' 'U' to LINE
81 int CNT; // Trace central offset in LINE
82 int TOP; // Trace top boundary in LINE
83 byte LFT; // Trace left boundary in PIEX
84 byte RIT; // Trace right boundary in PIEX
87 struct pid_data{
88 int kp;
89 int ki;
90 int kd;
94 void delay(int );
95 void dvrinit(void);
96 void transchar(char *);
97 void transchar_n(char *);
98 int transdbg(char *buff, int size);
100 void envb(void);
101 void ctrl_pad(void);
102 void data_proc(void);
103 void ctrl_0(void);
104 void ctrl_1(void);
105 void ctrl_2(void);
106 int feedback(int a, int b, struct pid_data pid);
107 int speed_acq(void);
109 #endif