Author Topic: Nspire: Keypad Input  (Read 13410 times)

0 Members and 1 Guest are viewing this topic.

Offline sammyMaX

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 204
  • Rating: +9/-0
    • View Profile
Re: Nspire: Keypad Input
« Reply #15 on: September 15, 2011, 05:39:56 pm »
I wanted such a method because it would save some code (not really that important). Right now I have ten if statements (for buttons for the numbers 0 to 9) and each calls the same function with its keycode as an argument, that then adds the character to a string for output. It would be cool if all these if statements could be grouped together since they call the same thing.

Are you wondering who Sammy is? My avatar is Sammy.
   

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Nspire: Keypad Input
« Reply #16 on: September 16, 2011, 03:48:34 am »
I remember Goplat posted once an OS function definition to directly read key events (and key codes). I can't find it back, I don't think it has been integrated to Ndless.
Ndless.me with the finest TI-Nspire programs

Offline bsl

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 157
  • Rating: +14/-0
    • View Profile
Re: Nspire: Keypad Input
« Reply #17 on: September 16, 2011, 10:04:22 am »
I remember Goplat posted once an OS function definition to directly read key events (and key codes). I can't find it back, I don't think it has been integrated to Ndless.
http://ourl.ca/4852/112431

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Nspire: Keypad Input
« Reply #18 on: September 16, 2011, 10:09:43 am »
Interesting :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline bsl

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 157
  • Rating: +14/-0
    • View Profile
Re: Nspire: Keypad Input
« Reply #19 on: September 16, 2011, 08:21:52 pm »
To use this in Ndless 2.0:
Code: [Select]
static const unsigned get_event_addrs[] = {0x1016C354, 0x1016e36c, 0x101b2724, 0x101b2fec};  //OS 1.7 ,OS2.0.1.60
#define get_event SYSCALL_CUSTOM(get_event_addrs, int,  struct event *)
« Last Edit: September 16, 2011, 08:25:06 pm by bsl »

Offline sammyMaX

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 204
  • Rating: +9/-0
    • View Profile
Re: Nspire: Keypad Input
« Reply #20 on: September 19, 2011, 09:19:05 pm »
I don't get what your code does, bsl, and I don't really get Goplat's either :( Could anyone explain to me what they do, and how to use them?

Are you wondering who Sammy is? My avatar is Sammy.
   

Offline lkj

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +58/-1
    • View Profile
Re: Nspire: Keypad Input
« Reply #21 on: September 27, 2011, 11:54:16 am »
This code lets you use an OS function to get the key code. When you call it, it waits until a key gets pressed and then gives you the key code.
To use it you have to copy paste Goplat's code into your project and replace #ifdef to #endif with the two codelines bsl posted.

Offline sammyMaX

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 204
  • Rating: +9/-0
    • View Profile
Re: Nspire: Keypad Input
« Reply #22 on: September 27, 2011, 05:37:28 pm »
When you call it, it waits until a key gets pressed and then gives you the key code.
Okay, thanks. I'll try it out.

Are you wondering who Sammy is? My avatar is Sammy.