Sang Vu Van
/
New
mesh phone
main.cpp
- Committer:
- SangSTBK
- Date:
- 2012-07-02
- Revision:
- 0:c674504a6536
File content as of revision 0:c674504a6536:
#include "mbed.h" #include "system_defines.h" #include "stdlib.h" #include "font_1.h" #include "string.h" #include "math.h" //--------------------------------------------------------- /* SSD1963_8-bit Program for writing to Newhaven Display 5.7" TFT 640x480 (c)2010 Curt Lagerstam - Newhaven Display International, LLC. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ //--------------------------------------------------------- #include "graphic.h" //#include "i2c.h" /*Following are HARD WIRED on the controller board */ //DigitalIn DOWN = P3^6; //sbit RIGHT = P3^2; //****************************************************************************** //====================================================== #include "RF22.h" //Serial pc(USBTX,USBRX); I2C i2c(p28,p27); InterruptIn event(p29); RF22 rf22(p8,p5,p6,p7,p9); #include "touch.h" void interrupt() { is_touch = 1; led = !led; } //======================================= int main(void) { int i,j; back_color = GREEN; SDN = 0; // pc.printf("CHIM"); RS = 1; event.fall(&interrupt); Init_SSD1963(); //init_touch(); clear_to_color(back_color); WEAK = 1; LCDSetRect(10,10,100,120,0,BLUE); big_button(); sqbutton1(50,50,1,DEEPINK); i2c.frequency(10000); init_nomal_mode(); if(rf22.init()== true) { // pc.printf("OK"); } else { // pc.printf("RF error"); } while (1) { if(is_touch == 1) { LCDPutChar('A',200,200,2,WHITE,RED); // ft_read_data(); read_touch_possition(); is_touch = 0; if(button_poss == 0) { if((touch_x > 50)&&(touch_x < 100)&&(touch_y > 50)&&(touch_y < 100)) { sqbutton1(50,50,1,back_color); sqbutton1(200,50,1,DEEPINK); button_poss = 1; } } else { if((touch_x > 200)&&(touch_x < 250)&&(touch_y > 50)&&(touch_y < 100)) { sqbutton1(50,50,1,DEEPINK); sqbutton1(200,50,1,back_color); button_poss = 0; } } } myled=!myled; } }