Search code examples
androidtimerdigitalioio

Number of single precision inputs on IOIO


Looking at this page it mentions that double precision digital pulse input (32-bit timer) can be divided into 2 single precision 16-bit timers.

https://github.com/ytai/ioio/wiki/Pulse-Input

It says there are 3 single and 3 double modules.

Does this mean that 9 pins can be used for single precision pulse input? (3 single + 3*2)?

Is this correct?


Solution

  • With the existing support code you can do up to 6 (3+3) concurrent channels. You get get to up to 9 single precision channels with some tweaks to the underlying code.

    Specifically, in the file software/IOIOLib/src/ioio/lib/impl/Board.java, search for where the Hardware class instances are created and notice that arguments 5 and 6 of the ctor are the double- and single- precision input capture (pulse input) module numbers. E.g.:

    static final Hardware IOIO0004 = new Hardware(MAP_IOIO0004,
                9, 4, 3, new int[] {0, 2, 4}, new int[] { 6, 7, 8 },
                new int[][] {{ 4, 5 }, { 1, 2 }, { 26, 25 }},
                new int[] { 36, 37, 38 });
    

    If you replace:

    new int[] {0, 2, 4}, new int[] { 6, 7, 8 }
    

    With:

    new int[] {}, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }
    

    You'd get 9 single-precision and 0 double-precision modules, etc.