connecting a laptop touchpad to the Espruino

Posted on
  • Hi guys,

    I am trying to interface an old Synaptics touchpad with the Espruino.
    Basically, the protocol is PS/2. (http://www.synaptics.com/sites/default/f­iles/ACF126.pdf)
    I started implementing something with some setWatch functions in order to react at CLK falling edges.
    I am encountering many problems, as the scripting machine is not fast enough to handle things in time.

    In order to correctly sample the input digital stream (on DATA line), I tought using an USART (in synchronous mode, with a clock line) but, ... , it is currently not available in Espruino, is it?

    Did someone already work on PS/2 interfaces?

  • Sorry for the delay - I was away last week.

    Yes, sadly the JS execution is just a tad too slow for setWatch. It might work with a keyboard where you only get a few bytes at a time, but something like a touchpad where you get a stream of data would probably be too fast.

    While USART isn't in 1v79, it is in the latest GitHub builds and will be in 1v80 (I can't release it yet because there's a bug when calling save() twice in a row). You could try out one of the GitHub builds though, which would work.

    I've tested with PS2, and it's as simple as:

    Serial1.setup(9600,{rx:B7, tx:B6, ck:A8, parity:"odd"});
    Serial1.on('data', function(d) {
      for (var i=0;i<d.length;i++) handlePS2(d.charCodeAt(i));
    });
    
  • Thanks Gordon. Currently I solved the problem by using an intermediate stm32 which is responsible to convert PS/2 commands into an UART based command protocol. I will wait for the 1v80 release, then I will try again with the example you tested (BTW, thank you for that example code).

  • Just to say, 1v80 is already here - so it should work now assuming the firmware is up to date :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

connecting a laptop touchpad to the Espruino

Posted by Avatar for Jean-Philippe_Rey @Jean-Philippe_Rey

Actions