K7MDL2 / IC-705-BLE-Serial-Example

Demonstrates how to connect to the IC-705 using Bluetooth Low Energy (BLE) and BT Classic Serial Port Profile for CI-V control and USB Host for a wider range of CI-V radios
2 stars 0 forks source link

Add support for more than 1 IO module #15

Closed K7MDL2 closed 2 weeks ago

K7MDL2 commented 1 month ago

Accept up to 4 IO modules for more outputs.

I also have a selection of M5Stack relay "units", 4, 2 and 1 relay modules, that use a Grove connection (I2C cable) to the CPU. Can add many through a hub module.

K7MDL2 commented 2 weeks ago

I received some IO devices today, the EXT.IO2 V1.1 UNIT and the 4RELAY MODULE 13.2. v1.1. Added support in the decoder code for input from the EXT.IO2 -OR- the 4IN8OUT (only 1 allowed) and outputs on either, or both, of the 4IN8OUT and 4RELAY modules.

Added a new input pattern to band matching list in Decoder.h. Now when a wired input or XVTR button is pressed, it searches the list for the first match. Since there are only 3 inputs (currently) allocated for band input (4th is PTT from radio), you can select one of 3 bands, or use a custom or BCD pattern (defined in the decoder tables today) to get many more.

In theory we can add a 2nd IO module for 8 inputs and 16 outputs, or more relay modules adding 4 more relays each to the total, or use the EXT.IO2 GPIO extender plugged into Port A normally, and can rejigger them for more inputs or digital outputs.

The EXT.IO2 input voltage is limited to 3.3V. The IC-705 is 5V open circuit so I elected to stick with the 4IN8OUT module for inputs by default since it has resistors that divide down the voltage well under 3.3V for a total current draw of only 0.85ma.

In the code as of today, I set the wired inputs up to select only 2 XVTR bands, 903 and 2304MHz. On the 4Relay module, relay1=903 active, relay2=903_PTT, relay3=2304 band active, and relay4=2304_PTT. The 4IN8OUT module outputs are in parallel today until a better means of config is created to differentiate the module types. Modules may or may not be present complicating config rules, plus the final rules need to be read from SD card.