mesh phone

Dependencies:   RF22 mbed

Committer:
SangSTBK
Date:
Mon Jul 02 03:41:36 2012 +0000
Revision:
0:c674504a6536
mesh

Who changed what in which revision?

UserRevisionLine numberNew contents of line
SangSTBK 0:c674504a6536 1 #include "mbed.h"
SangSTBK 0:c674504a6536 2 #include "system_defines.h"
SangSTBK 0:c674504a6536 3 #include "stdlib.h"
SangSTBK 0:c674504a6536 4 #include "font_1.h"
SangSTBK 0:c674504a6536 5 #include "string.h"
SangSTBK 0:c674504a6536 6 #include "math.h"
SangSTBK 0:c674504a6536 7 //---------------------------------------------------------
SangSTBK 0:c674504a6536 8 /*
SangSTBK 0:c674504a6536 9 SSD1963_8-bit
SangSTBK 0:c674504a6536 10 Program for writing to Newhaven Display 5.7" TFT 640x480
SangSTBK 0:c674504a6536 11
SangSTBK 0:c674504a6536 12 (c)2010 Curt Lagerstam - Newhaven Display International, LLC.
SangSTBK 0:c674504a6536 13
SangSTBK 0:c674504a6536 14 This program is free software; you can redistribute it and/or modify
SangSTBK 0:c674504a6536 15 it under the terms of the GNU General Public License as published by
SangSTBK 0:c674504a6536 16 the Free Software Foundation; either version 2 of the License, or
SangSTBK 0:c674504a6536 17 (at your option) any later version.
SangSTBK 0:c674504a6536 18
SangSTBK 0:c674504a6536 19 This program is distributed in the hope that it will be useful,
SangSTBK 0:c674504a6536 20 but WITHOUT ANY WARRANTY; without even the implied warranty of
SangSTBK 0:c674504a6536 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
SangSTBK 0:c674504a6536 22 GNU General Public License for more details.
SangSTBK 0:c674504a6536 23 */
SangSTBK 0:c674504a6536 24
SangSTBK 0:c674504a6536 25 //---------------------------------------------------------
SangSTBK 0:c674504a6536 26 #include "graphic.h"
SangSTBK 0:c674504a6536 27 //#include "i2c.h"
SangSTBK 0:c674504a6536 28
SangSTBK 0:c674504a6536 29 /*Following are HARD WIRED on the controller board */
SangSTBK 0:c674504a6536 30 //DigitalIn DOWN = P3^6;
SangSTBK 0:c674504a6536 31 //sbit RIGHT = P3^2;
SangSTBK 0:c674504a6536 32
SangSTBK 0:c674504a6536 33 //******************************************************************************
SangSTBK 0:c674504a6536 34
SangSTBK 0:c674504a6536 35
SangSTBK 0:c674504a6536 36 //======================================================
SangSTBK 0:c674504a6536 37
SangSTBK 0:c674504a6536 38
SangSTBK 0:c674504a6536 39 #include "RF22.h"
SangSTBK 0:c674504a6536 40 //Serial pc(USBTX,USBRX);
SangSTBK 0:c674504a6536 41 I2C i2c(p28,p27);
SangSTBK 0:c674504a6536 42 InterruptIn event(p29);
SangSTBK 0:c674504a6536 43 RF22 rf22(p8,p5,p6,p7,p9);
SangSTBK 0:c674504a6536 44 #include "touch.h"
SangSTBK 0:c674504a6536 45 void interrupt()
SangSTBK 0:c674504a6536 46 {
SangSTBK 0:c674504a6536 47
SangSTBK 0:c674504a6536 48 is_touch = 1;
SangSTBK 0:c674504a6536 49 led = !led;
SangSTBK 0:c674504a6536 50
SangSTBK 0:c674504a6536 51 }
SangSTBK 0:c674504a6536 52 //=======================================
SangSTBK 0:c674504a6536 53 int main(void) {
SangSTBK 0:c674504a6536 54 int i,j;
SangSTBK 0:c674504a6536 55 back_color = GREEN;
SangSTBK 0:c674504a6536 56 SDN = 0;
SangSTBK 0:c674504a6536 57 // pc.printf("CHIM");
SangSTBK 0:c674504a6536 58 RS = 1;
SangSTBK 0:c674504a6536 59 event.fall(&interrupt);
SangSTBK 0:c674504a6536 60 Init_SSD1963();
SangSTBK 0:c674504a6536 61 //init_touch();
SangSTBK 0:c674504a6536 62 clear_to_color(back_color);
SangSTBK 0:c674504a6536 63 WEAK = 1;
SangSTBK 0:c674504a6536 64 LCDSetRect(10,10,100,120,0,BLUE);
SangSTBK 0:c674504a6536 65 big_button();
SangSTBK 0:c674504a6536 66 sqbutton1(50,50,1,DEEPINK);
SangSTBK 0:c674504a6536 67 i2c.frequency(10000);
SangSTBK 0:c674504a6536 68 init_nomal_mode();
SangSTBK 0:c674504a6536 69 if(rf22.init()== true)
SangSTBK 0:c674504a6536 70 {
SangSTBK 0:c674504a6536 71 // pc.printf("OK");
SangSTBK 0:c674504a6536 72 }
SangSTBK 0:c674504a6536 73 else
SangSTBK 0:c674504a6536 74 {
SangSTBK 0:c674504a6536 75 // pc.printf("RF error");
SangSTBK 0:c674504a6536 76 }
SangSTBK 0:c674504a6536 77 while (1)
SangSTBK 0:c674504a6536 78 {
SangSTBK 0:c674504a6536 79
SangSTBK 0:c674504a6536 80 if(is_touch == 1)
SangSTBK 0:c674504a6536 81 {
SangSTBK 0:c674504a6536 82 LCDPutChar('A',200,200,2,WHITE,RED);
SangSTBK 0:c674504a6536 83 // ft_read_data();
SangSTBK 0:c674504a6536 84 read_touch_possition();
SangSTBK 0:c674504a6536 85 is_touch = 0;
SangSTBK 0:c674504a6536 86 if(button_poss == 0)
SangSTBK 0:c674504a6536 87 {
SangSTBK 0:c674504a6536 88 if((touch_x > 50)&&(touch_x < 100)&&(touch_y > 50)&&(touch_y < 100))
SangSTBK 0:c674504a6536 89 {
SangSTBK 0:c674504a6536 90 sqbutton1(50,50,1,back_color);
SangSTBK 0:c674504a6536 91 sqbutton1(200,50,1,DEEPINK);
SangSTBK 0:c674504a6536 92 button_poss = 1;
SangSTBK 0:c674504a6536 93 }
SangSTBK 0:c674504a6536 94 }
SangSTBK 0:c674504a6536 95 else
SangSTBK 0:c674504a6536 96 {
SangSTBK 0:c674504a6536 97 if((touch_x > 200)&&(touch_x < 250)&&(touch_y > 50)&&(touch_y < 100))
SangSTBK 0:c674504a6536 98 {
SangSTBK 0:c674504a6536 99 sqbutton1(50,50,1,DEEPINK);
SangSTBK 0:c674504a6536 100 sqbutton1(200,50,1,back_color);
SangSTBK 0:c674504a6536 101 button_poss = 0;
SangSTBK 0:c674504a6536 102 }
SangSTBK 0:c674504a6536 103 }
SangSTBK 0:c674504a6536 104 }
SangSTBK 0:c674504a6536 105 myled=!myled;
SangSTBK 0:c674504a6536 106 }
SangSTBK 0:c674504a6536 107 }