Close

Working Phone....somewhat

A project log for Open Source Cell Phone

A completely open hardware and open source software cell phone

hugh-darrowHugh Darrow 10/19/2014 at 05:500 Comments

So I know its been a while but this is a good update. I have completed all the software required to dial out, look at the number dialed, call, answer, receive, clear the screen etc. It tooks a little bit of doing, and a brilliant idea if I might say so, but the way I made the dial part work was to hack the way cpp uses strings. In cpp it uses a character array in order to store the strings, and you can concatenate the string with an additional character. So I started by first declaring bufStr at "ATD" the first part of the AT command required to initiate a call, then for each touch space area I used bufStr += "(number wanted here". Thereby you enter 10 numbers you get something like bufStr = "ATD1234567890" with all the neccessary digits reuired to initiate a phone call, the only last needed characters are, bufStr += ";\r\n", while the carriage return and newline actually took me reading the HEX code coming from the commands sent from the SSCOM32.exe program, and then back tracing them on an ASCII table to the appropriate characters. Then define a new touch area with the character C, and have it send bufStr by serial1.write() to the GPRS shield, only thing is it needs to be in characters, not a defined string. So that too is an easy fix by using the toCharArray function in Arduino, with the resulting command looking like so

bufStr.toCharArray(charBuf, 16);
Serial1.write(charBuf);

16 being the 16 bytes of characters needed to transmit. I then need to create a way to to see the numbers dialed in progress. Suffice it to say, this was much harder, and in the end, I used a switch statement with each touch field. I guarantee this isn't the best way, but at this moment, I couldn't find any other way to do it, and I tried a few, but I also guarantee its my inexperience in coding, so please chime in and correct me if you can or want. So an example for the "1" digit it looks like

if (tx > 605 && tx < 675 && ty > 185 && ty < 305) {
delay(50);
bufStr += "1";
place++;
tft.textMode();
tft.textRotate(true);
tft.textColor(RA8875_WHITE, RA8875_BLACK);
tft.textEnlarge(2);
switch (place) {
case 1:
tft.textSetCursor(75, 40);
break;
case 2:
tft.textSetCursor(75, 60);
break;
case 3:
tft.textSetCursor(75, 80);
break;
case 4:
tft.textSetCursor(75, 100);
break;
case 5:
tft.textSetCursor(75, 120);
break;
case 6:
tft.textSetCursor(75, 140);
break;
case 7:
tft.textSetCursor(75, 160);
break;
case 8:
tft.textSetCursor(75, 180);
break;
case 9:
tft.textSetCursor(75, 200);
break;
case 10:
tft.textSetCursor(75, 220);
break;
}
tft.textWrite("1");
delay(50);
}

with place declared at the top at 0. In this way each character is written in order, by the number in the array it falls to. Last is to place the call with touch zone "C"

if (tx > 800 && tx < 1024 && ty > 0 && ty < 200) {
delay(50);
if (bufStr.length() == 13) {
bufStr += ";\r\n";
bufStr.toCharArray(charBuf, 16);
Serial1.write(charBuf);
// reset string
bufStr = "ATD";
// clear onscreen display
tft.graphicsMode();
tft.fillRect(75, 40, 75, 200, RA8875_BLACK);
place = 0;
}
delay(50);
}

I have it reset the string each time whether C, A, or H was touched, letting H be almost a clear on all accounts. And to clear the text of numbers dialed I just draw right over the top of them. At some point in the future I want to be able to backspace a character, display a call coming in, have dynamic screens, and ultimately have text messaging, as right now all texts have to be answered by my computer. And I haven't really looked further into off storage of texts, but a while back I saw an AT command for offload to storage, so I'll be exploring that further. Anyway good luck and have fun, next post will be all the units in a portable container.

Discussions