You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server
Administration Center

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - TheStaticTurtle

#1
Calculator Development / Re: TI Nspire uart
October 02, 2018, 01:39:04 PM
While I don't exactly understand you question I'm glad to hhave helped you for something and I indeed continued to work on this project after this post and the program evolved into this:
https://github.com/TurtleForGaming/nspire-communication/blob/master/nspire-client/uart_sms/hello.cpp And if you want to see the whole project look at this post: https://codewalr.us/index.php?topic=2299.0
#2
Other / Up: TI Nspire SMS Shield
April 22, 2018, 09:15:29 PM
see first post (up)
#3
Other / TI Nspire SMS Shield
January 25, 2018, 08:11:25 PM
So all started last year in class when I was talking to a friend about the nspire after some time we discussed that I will be cool to be able to send SMS with the nspire. After that I did some research on how I will be able to do this:
First solution was LUA but the send function was not implemented in my calc version and there is no way to get data back.
Next was Ndless which one I choose. After letting the project die for almost 6 months I restarted it and started making my program on the calc side.
I have take about a 3-4 month to send and get data "flawlessly". But after a LOT of tweaking. I can send and receive msg via the uart port at the bottom of the calc. Next I have implemented contact selection. For all of my testing I have to solder a wire to the back port on the calc and fault "Humm that such a terrible idea". So I went in solidworks and started designing my own case for the ti and here is my first test:

Very old link: (http://i65.tinypic.com/k4fp80.jpg)
I haven't 3D printed the final version yet so I can't show you.

After the ndless part completed I let the project die again for around a month and then I started modifying the case a little bit more to add pin hole / hole for the Bluetooth module /etc...
Then I started making the android app to make the SMS sending / reading possible add I did that for around two month on Android studio.

And here I am with my first working prototype of the Nspire SMS Shield "working":

Old links see new shield below
( http://i66.tinypic.com/skvsc4.jpg / http://i66.tinypic.com/kthz5.jpg )

There is a lot of tweaking left to do but I works and I'm not stopping the developement here
If you are interested in the source code please contact me :)

UPDATE n°1:

It's a long time i know. So i have make a github if someone got any interest: https://github.com/TurtleForGaming/nspire-communication
I've make a new 3d printed shield (last version I think):


And I completly redone the apps
(Video comming soon)
#4
Calculator Development / Re: TI Nspire uart
January 21, 2018, 04:06:55 PM
After some time I managed to make this function work :w00t:. So for now my function look like this:
char* uart_getsn(char* str, int num) {
        int i = 0;
        int max = num-1;
        while(1 && releasefunc()) {
                while(uart_ready() && isKeyPressed(KEY_NSPIRE_ESC)) {
                        if(i == max) {
                                str[i] = 0;
                                return str;
                        }
                        char c = uart_getchar();
                        str[i] = c;
                        if(c == '\b'){  i -= 2; }
                        else if(c == '\r')      { str[i] =0; return str; }
                        i++;

                }
        }
}


definitvely not perfect since i have to send \r after each command  and I have added  isKeyPressed(KEY_NSPIRE_ESC) to the while in case of stuck (append only one time) but I work for me.
#5
Calculator Development / Re: TI Nspire uart
January 21, 2018, 01:17:14 PM
So I have read the whole pdf but I don't see how to make an interrupt. For first I doesn't done so much C and I absolutly don't know how to make an interrupt but the one thing that I have seen fromthe pdf is that there is a byte to see if the receive FIFO is 1/2 full but I don't know how to make it work.
#6
Calculator Development / Re: TI Nspire uart
January 21, 2018, 12:30:22 PM
Well can I increase the FIFO buffer size. If not you said that I can write an interrupt for reciveing data but I dont really know how to do that. And if all of that is not really possible how do I disable it ?
#7
Calculator Development / Re: TI Nspire uart
January 21, 2018, 10:00:07 AM
It stilll blocking at 32 chars  :'(
#8
Calculator Development / Re: TI Nspire uart
January 20, 2018, 09:54:10 PM
Well know my calc is blocked in a loop probably:
while(!(*fr & 0x10))
                idle();


And not displaying anything  ;D
#9
Calculator Development / Re: TI Nspire uart
January 20, 2018, 09:45:12 PM
I'm getting:
Quoteerror: can't convert « unsigned int* » to « volatile uint8_t* {aka volatile unsigned char*} » in the initialisation
         volatile uint8_t *fr = (unsigned*)0x90020018;
#10
Calculator Development / Re: TI Nspire uart
January 20, 2018, 09:27:14 PM
I'have already tried that no luck
#11
Calculator Development / Re: TI Nspire uart
January 20, 2018, 09:21:21 PM
I have posted this bug  ;)
And I don't have an another module
#12
Calculator Development / Re: TI Nspire uart
January 20, 2018, 08:05:25 PM
Well I changed my android code to add 20mills sec each 10 char but no luck
#13
Calculator Development / Re: TI Nspire uart
January 20, 2018, 06:12:29 PM
Can you decrease the baudrate of the Ti Nspire ?
#14
Calculator Development / Re: TI Nspire uart
January 20, 2018, 05:29:39 PM
I'm not a pro programmer just a student so what is the FIFO and how does I do that ?
#15
Calculator Development / TI Nspire uart
January 20, 2018, 01:44:33 PM
So for around 2month now I'm developping an bluetooth interface (via UART) to the TI-Nspire. For that I use ndless and nspire-io (a bit modified to not lock the calc while waiting for message and echo remove). But for the past day I'm encoutering a little problem:  when i send a message to the calc (with or without bluetooth) I only get 32chars for exemple if I send:

Quote%%|NUMS|10|TestA|TestB|TestC|TestD|TestE|TestF|TestG|TestH|TestI|TestJ
I will only get
Quote%%|NUMS|10|TestA|TestB|TestC|Tes

which is a big problem for me and I don't really know why it append.

Here is my code:
#include <os.h>
#include <nspireio/uart.hpp>
#include <nspireio/console.hpp>

int key_already_pressed_ctrl = 0;
int key_already_pressed_contact = 0;
char* contact = "%%|NUMS|6|Name1|Name2|Name3|Name4|Name6|Name7";
int hasSelectedContact = 0;

// Modidification of the uart_getsn() function to remove the echo.


char* uart_getsn_mdf(char* str, int num) {
for(int i = 0; i < num-1; i++){
if(uart_ready()) {
char c = uart_getchar();
str[i] = c;
if(c == '\b'){ i -= 2; }
else if(c == '\r') { str[i] =0; return str; }
}
}
str[num] = 0;
return str;
}

char* uart_gets_mdf(char* str)
{
        return uart_getsn_mdf(str,50);
}

int numberOfCharsInArray(char* array) {
  return strlen(array);
}

int main(void)
{
//Write the program title
assert_ndless_rev(874);
nio_console csl;
nio_init(&csl,NIO_MAX_COLS,NIO_MAX_ROWS,0,0,NIO_COLOR_WHITE,NIO_COLOR_BLACK,TRUE);
nio_set_default(&csl);
nio_color(&csl,NIO_COLOR_BLACK,NIO_COLOR_WHITE);
nio_printf("               Nspire UART Chat by Samy.             ");
nio_printf("         Compiled the %s At %s        ",__DATE__,__TIME__);
nio_color(&csl,NIO_COLOR_BLACK,NIO_COLOR_LIGHTRED);
nio_printf("      Press  ESC key to exit and CTRL to send msg.    ");
nio_printf("                                                    ");
nio_color(&csl,NIO_COLOR_WHITE,NIO_COLOR_BLACK);
nio_puts("");

//Send that we are online
uart_printf("#$#CALC:ENTERING:SMS\r\n");

//Main loop
while(!isKeyPressed(KEY_NSPIRE_ESC)){
if(isKeyPressed(KEY_NSPIRE_CTRL) && !key_already_pressed_ctrl && !key_already_pressed_contact){
if(hasSelectedContact) {
nio_printf("<< ");
char output[90] = {0};
nio_getsn(output,90);
uart_printf("$#$SMS:");
int num = numberOfCharsInArray(output);
for(char* it = output; *it; ++it) {
uart_printf("%c",*it);
sleep(100);
}
uart_printf("\r\n");
} else {
nio_printf("You must select an contact !\r\n");
}
key_already_pressed_ctrl = 1;
}
if(isKeyPressed(KEY_NSPIRE_C) && !key_already_pressed_contact && !key_already_pressed_ctrl){
// START Contact select part
nio_clear(&csl);
//Title
nio_color(&csl,NIO_COLOR_BLACK,NIO_COLOR_WHITE);
nio_printf("                        Contact                      ");
nio_color(&csl,NIO_COLOR_WHITE,NIO_COLOR_BLACK);
//Search
nio_printf("Name search: ");
char output[90] = {0};
nio_getsn(output,90);
uart_printf("$#$UPDATENUM:%s\r\n",output);

nio_color(&csl,NIO_COLOR_BLACK,NIO_COLOR_WHITE);
nio_clear(&csl);
while(!uart_ready() && !isKeyPressed(KEY_NSPIRE_ESC)) {
nio_printf("                        Waiting                      ");
sleep(500);
}
nio_color(&csl,NIO_COLOR_BLACK,NIO_COLOR_WHITE);
nio_printf("                        Contact                      ");
nio_color(&csl,NIO_COLOR_WHITE,NIO_COLOR_BLACK);
nio_clear(&csl);

char input[1024] = {0};
//sleep(500);
uart_getsn_mdf(input,1024);

nio_puts(input);
nio_puts("Select your contact:");

contact = input;

        char* namestable[1024];
        char* s;
        int i=0;
        s = strtok(contact ,"|");
        while (s != NULL) {
        if(i>1) {
namestable[i] = s;
}
        if(i>2) {
        nio_printf("  %i) %s. \r\n",i-3,s);
                }
                s = strtok (NULL, "|");
                i++;
        }
        nio_printf("Change contact to (n)?");
        char selected[10] = {0};
        nio_getsn(selected,10);
        int ii = atoi(selected);
ii=ii+3;
        if(ii >= 0 && namestable[ii] != "None") {
                nio_printf("Changing send contact to %s. \r\n",namestable[ii]);
uart_printf("$#$CHANGENUM:%s\r\n",namestable[ii]);
hasSelectedContact = 1;
nio_clear(&csl);
nio_color(&csl,NIO_COLOR_BLACK,NIO_COLOR_WHITE);
// Display reponsive title
nio_printf(" Info: Now chating with: %s \r\n", namestable[ii]);
nio_printf("                                                     ");
nio_puts("");
        } else {
hasSelectedContact = 0;
nio_clear(&csl);
nio_color(&csl,NIO_COLOR_BLACK,NIO_COLOR_LIGHTRED);
nio_printf("                                                     ");
nio_printf("  Error: Error while selecting contact please retry. ");
nio_printf("          If the error persist contact samy :)       ");
nio_printf("                                                     ");
nio_color(&csl,NIO_COLOR_WHITE,NIO_COLOR_BLACK);
nio_puts("");
        }
nio_color(&csl,NIO_COLOR_WHITE,NIO_COLOR_BLACK);
        // END Contact select part
key_already_pressed_contact = 1;
}
if(!any_key_pressed()) {
key_already_pressed_ctrl = 0;
key_already_pressed_contact = 0;
}
if(uart_ready()) {
sleep(500);
char input[1024] = {0};
uart_gets_mdf(input);
contact = input;
nio_printf("%s\r\n",input);
nio_printf("%s",input);
nio_puts("");
}
}

//Send that we are offline
uart_printf("#$#CALC:LEAVING:SMS\r\n");

//Exiting
nio_puts("Offline message sended. Exiting ...");
nio_free(&csl);
return 0;
}



For those who doesn't want to understand all of my code here is the part where I get my messages:

if(uart_ready()) {
sleep(500);
char input[1024] = {0};
uart_gets_mdf(input);
nio_printf("%s",input);
nio_puts("");
}


And here are the modified function:

char* uart_getsn_mdf(char* str, int num) {
for(int i = 0; i < num-1; i++){
if(uart_ready()) {
char c = uart_getchar();
str[i] = c;
if(c == '\b'){ i -= 2; }
else if(c == '\r') { str[i] =0; return str; }
}
}
str[num] = 0;
return str;
}

char* uart_gets_mdf(char* str)
{
        return uart_getsn_mdf(str,50);
}


If somebody wanna help me I'm taking it.
PS: I'm french so sorry for mistakes
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal