Giter Club home page Giter Club logo

nspire-io's People

Contributors

compujuckel avatar juju2143 avatar vogtinator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nspire-io's Issues

Programm compilation error

I'm wrote this .cpp program:

#include <os.h>
#include <nspireio/nspireio.h>
int main(void)
{
        uart_puts("Nspire I/O testing tool\n");
        uart_printf("Compiled %s %s\n",__DATE__,__TIME__);
        wait_key_pressed();
        return 0;
}

And when I compile it give me this error:

mkdir -p .
nspire-ld hello.o -o ./helloworld-cpp.elf -Wl,-lnspireio
hello.o: In function `main':
hello.cpp:(.text.startup+0x8): undefined reference to `uart_puts(char const*)'
hello.cpp:(.text.startup+0x18): undefined reference to `uart_printf(char*, ...)'
collect2: error: ld a retourné le statut de sortie 1
Makefile:39 : la recette pour la cible « helloworld-cpp.elf » a échouée
make: *** [helloworld-cpp.elf] Erreur 1

What I'm doing wrong ?

uart reading is not blocking in test.c

I have tried an extract from test.c. This one:

	uart_puts("Enter text: ");
	uart_getsn(input,100);
	uart_printf("Your text was: %s\n",input);

The problem is that uart_getsn that uses uart_getchar is not blocking as expected. The uart_printf is executed, and the program exits.
What am I doing wrong ?
I'm using a TI-Nspire CX CAS

Impossible to type some symbols on the Nspire CX

On the TI-Nspire CX, you cannot type symbols like '<', '>'...
In fact, any character that has a dedicated key on the ClickPad devices but doesn't on the CX keyboard cannot be typed, if I'm not mistaken.
This issue is quite annoying for programs such as MicroPython since these symbols are frequent in programming.

No malloc check

The pointer returned by malloc is never checked against NULL anywhere.
Especially on the nspire this is dangerous, as 0x0 points to a valid writable area and access doesn't lead directly to a crash.

How to clean uart buffer

I'm trying to communicate with an esp8266.
Responses ends with "OK\r\n".
But it looks like the buffer is still containing garbage.
Is there a way to flush remaining data (ie ignore it)?

I don't know if this is good, I've written a uart_getsn clone but which waits for "\r\n"
If response is OK\r\n then I can send a new command to the esp8266. But the esp8266 says its busy.
I think this is because the buffer is not empty (I've seen this with a logic analyzer).

Maybe I'm wrong with this.

Thanks for any help

uart_getchar block the program!

So this function:
char uart_getchar(void) { volatile unsigned *recv_buffer_reg = (unsigned*)0x90020000; while(!uart_ready()) idle(); char tmp = *recv_buffer_reg; uart_putchar(tmp); return tmp; }
block's the programm and wait for incomming data is there a solution for just if there is data so execute the rest of the function or not ?

Compile error

Error durring the installation:

make all
nspire-gcc -Wall -W -marm -O3  -c common/queue.c -o common/queue.o
nspire-gcc -Wall -W -marm -O3  -c common/cursor.c -o common/cursor.o
In file included from common/cursor.c:28:0:
common/../include/nspireio/nspireio.h:393:17: warning: la fonction en ligne « nio_time_get » est déclarée mais jamais définie
 inline unsigned nio_time_get();
                 ^~~~~~~~~~~~
nspire-gcc -Wall -W -marm -O3  -c common/console.c -o common/console.o
common/console.c: Dans la fonction « nio_load »:
common/console.c:191:5: warning: cette instruction « if » ne protège pas… [-Wmisleading-indentation]
     if(c->drawing_enabled)
     ^~
common/console.c:194:2: note: …cette instruction, mais l'indentation de cette dernière est trompeuse car elle fait croire qu'elle est gardée par le « if »
  if(fclose(f) == EOF)
  ^~
In file included from common/console.c:29:0:
common/console.c: Au plus haut niveau:
common/../include/nspireio/nspireio.h:393:17: warning: la fonction en ligne « nio_time_get » est déclarée mais jamais définie
 inline unsigned nio_time_get();
                 ^~~~~~~~~~~~
nspire-gcc -Wall -W -marm -O3  -c common/util.c -o common/util.o
nspire-gcc -Wall -W -marm -O3  -c arch-nspire/nspire-uart.c -o arch-nspire/nspire-uart.o
nspire-gcc -Wall -W -marm -O3  -c arch-nspire/nspire.c -o arch-nspire/nspire.o
arch-nspire/nspire.c: Dans la fonction « nio_scrbuf_flip »:
arch-nspire/nspire.c:35:36: error: « SCREEN_BYTES_SIZE » non déclaré (première utilisation dans cette fonction); vouliez-vous utiliser « _REENT_SIGNAL_SIZE » ?
  memcpy(SCREEN_BASE_ADDRESS,scrbuf,SCREEN_BYTES_SIZE);
                                    ^~~~~~~~~~~~~~~~~
                                    _REENT_SIGNAL_SIZE
arch-nspire/nspire.c:35:36: note: chaque identificateur non déclaré est rapporté une seule fois pour chaque fonction dans laquelle il apparaît
arch-nspire/nspire.c: Dans la fonction « nio_scrbuf_init »:
arch-nspire/nspire.c:42:19: error: « SCREEN_BYTES_SIZE » non déclaré (première utilisation dans cette fonction); vouliez-vous utiliser « _REENT_SIGNAL_SIZE » ?
   scrbuf = malloc(SCREEN_BYTES_SIZE);
                   ^~~~~~~~~~~~~~~~~
                   _REENT_SIGNAL_SIZE
arch-nspire/nspire.c: Dans la fonction « nio_scrbuf_clear »:
arch-nspire/nspire.c:51:21: error: « SCREEN_BYTES_SIZE » non déclaré (première utilisation dans cette fonction); vouliez-vous utiliser « _REENT_SIGNAL_SIZE » ?
  memset(scrbuf,0xFF,SCREEN_BYTES_SIZE);
                     ^~~~~~~~~~~~~~~~~
                     _REENT_SIGNAL_SIZE
arch-nspire/nspire.c: Dans la fonction « nio_pixel_set »:
arch-nspire/nspire.c:110:8: warning: déclaration implicite de la fonction « lcd_isincolor » [-Wimplicit-function-declaration]
   fp = lcd_isincolor() ? nio_pixel_set_16bpp : nio_pixel_set_4bpp;
        ^~~~~~~~~~~~~
Makefile:27 : la recette pour la cible « arch-nspire/nspire.o » a échouée
make: *** [arch-nspire/nspire.o] Erreur 1

What I'm doing wrong ?

uart_ready() Error

So I wrote this script:

#include <os.h>
#include <nspireio/uart.hpp>
#include <nspireio/console.hpp>

int key_already_pressed = 0;
char oldinput[100] = {0};
char voidlist[100] = {0};
int dispInput = 0;

int main(void)
{
	assert_ndless_rev(874);
	//clrscr();
	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. Compiled the %s At %s\n",__DATE__,__TIME__);
	nio_color(&csl,NIO_COLOR_WHITE,NIO_COLOR_BLACK);
	nio_puts("Press any ESC to exit and CTRL to send msg...\n");
	while(!isKeyPressed(KEY_NSPIRE_ESC)){
		if(isKeyPressed(KEY_NSPIRE_CTRL) && !key_already_pressed){
			nio_printf(">");
			char input2[100] = {0};
			nio_getsn(input2,100);
			uart_printf("\r\n");
			uart_printf(input2);
			key_already_pressed = 1;
		}
		if(!any_key_pressed())
			key_already_pressed = 0;
		if(uart_ready()) {
			char input[100] = {0};
			uart_getsn(input,100);
			if(strcmp(oldinput,input) != 0) {
				if(input != voidlist) {
					nio_puts(input);
					strcpy(oldinput,input);
					strcpy(input,voidlist);
				}
			}
		}
	}
	nio_puts("Tests finished.");
	nio_free(&csl);   
	return 0;
} 

But It keep writting the the buffer (input) on the serial console (arduino) AND the TI Nspire
After searching It's apparently the uart_ready() function that give always true return after one message. Is there a way to clear the serial buffer of the Ti orsomething like this ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.