I would like to have and `mcpdir` control command to control pin role: say, mcpdir,1,1 would turn pin#1 low-output, mcpdir,1,0 would reset pin#1 to initial state (pulled-up-input, I believe).
I tried this chunk (in purely naive way, compiled from parts of mcpgpio command and PLUGIN_INIT of _P009_MCP.ino)
Code: Select all
if (event->Par2) {
Plugin_009_Write(event->Par1, 0);
setPinState(PLUGIN_ID_009, event->Par1, PIN_MODE_OUTPUT, 0);
} else {
Plugin_009_Config(event->Par1, 1);
setPinState(PLUGIN_ID_009, event->Par1, PIN_MODE_INPUT, 0);
}
Wonder how to reliably reset pin?
TIA,
--Vladimir