Page 1 of 1

hardware control

Unread postPosted: 05 Jun 2020, 20:02
by parisse
I made some progresses in order to "simulate" OFF/ON inside KhiCAS by setting the backlight to 0. If a student enters KhiCAS during the math course and presses OFF then ON 5 minutes later, the current code (see below) is ok, but if the calc stays like this a few days, this will probably drains the batteries too much. I wonder how I could improve it in order to decrease power consumption.
The current code looks like this
Code: Select all
...
    if (allow_suspend && nspire_ctrl && on_key_pressed()){
      nspire_ctrl=false;
      while (on_key_pressed())
   msleep(10);
      // somewhat OFF by setting LCD to 0
      unsigned NSPIRE_CONTRAST_ADDR=0x900f0020;
      unsigned oldval=*(volatile unsigned *)NSPIRE_CONTRAST_ADDR;
      *(volatile unsigned *)NSPIRE_CONTRAST_ADDR=0x100;
      while (!on_key_pressed())
   msleep(100);
      *(volatile unsigned *)NSPIRE_CONTRAST_ADDR=oldval;
      statusline(0);
      sync_screen();
      continue;
    }
...

I also tried to write to the led (I have introduced the read32 and write32 commands to make tries easy inside the KhiCAS shell), but it seems to be locked:
Code: Select all
16=>=>
l=0x90110b00
a=read32(l)
b=0b1010011
write32(l,b)

read32(l) stills return 0x1643
(N.B. 16=>=> is a KhiCAS command to display integers in hexa).

Re: hardware control

Unread postPosted: 05 Jun 2020, 20:28
by critor
Yes, on recent Nspire versions and hardwares, the LED port is locked by at least 2 other ports if I remember well.
You had to write to those other ports to unlock it, it may not work anymore.

If I remember well, information about these ports is/was available on Cemetech and Omnimaga.

Although, if you unlock the LED, the calculator is going to reboot some seconds after you're back to the OS (after exiting the Ndless program, KhiCAS in your case). Even if you reset the LED to its original state and relock it before exiting.
So unlocking the LED is either not a solution, or not enough.