Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

GPIO pins go high on startup #72

Closed
svollenweider opened this issue Oct 5, 2021 · 1 comment · Fixed by #82
Closed

GPIO pins go high on startup #72

svollenweider opened this issue Oct 5, 2021 · 1 comment · Fixed by #82
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@svollenweider
Copy link
Contributor

Dear all
The GPIO pins seem to go high on startup when calling digital_programmables.init(). I have fixed it by setting the Pin to off before setting the pinMode.

Line 86 of ArduinoIOExpander.cpp looks now like this. Everything seems to work as intended

  void ArduinoIOExpanderClass::initPins()
  {
      if (_tca.getAddress() == IO_ADD) {
        PinStatus status = SWITCH_OFF;
        set(IO_WRITE_CH_PIN_00, status);
        set(IO_WRITE_CH_PIN_01, status);
        set(IO_WRITE_CH_PIN_02, status);
        set(IO_WRITE_CH_PIN_03, status);
        set(IO_WRITE_CH_PIN_04, status);
        set(IO_WRITE_CH_PIN_05, status);
        set(IO_WRITE_CH_PIN_06, status);
        set(IO_WRITE_CH_PIN_07, status);
        set(IO_WRITE_CH_PIN_08, status);
        set(IO_WRITE_CH_PIN_09, status);
        set(IO_WRITE_CH_PIN_10, status);
        set(IO_WRITE_CH_PIN_11, status);
        
        pinMode(IO_WRITE_CH_PIN_00, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_01, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_02, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_03, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_04, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_05, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_06, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_07, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_08, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_09, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_10, OUTPUT);
        pinMode(IO_WRITE_CH_PIN_11, OUTPUT);
        pinMode(IO_READ_CH_PIN_00, INPUT);
        pinMode(IO_READ_CH_PIN_01, INPUT);
        pinMode(IO_READ_CH_PIN_02, INPUT);
        pinMode(IO_READ_CH_PIN_03, INPUT);
        pinMode(IO_READ_CH_PIN_04, INPUT);
        pinMode(IO_READ_CH_PIN_05, INPUT);
        pinMode(IO_READ_CH_PIN_06, INPUT);
        pinMode(IO_READ_CH_PIN_07, INPUT);
        pinMode(IO_READ_CH_PIN_08, INPUT);
        pinMode(IO_READ_CH_PIN_09, INPUT);
        pinMode(IO_READ_CH_PIN_10, INPUT);
        pinMode(IO_READ_CH_PIN_11, INPUT);
      } else {
        pinMode(DIN_READ_CH_PIN_00, INPUT);
        pinMode(DIN_READ_CH_PIN_01, INPUT);
        pinMode(DIN_READ_CH_PIN_02, INPUT);
        pinMode(DIN_READ_CH_PIN_03, INPUT);
        pinMode(DIN_READ_CH_PIN_04, INPUT);
        pinMode(DIN_READ_CH_PIN_05, INPUT);
        pinMode(DIN_READ_CH_PIN_06, INPUT);
        pinMode(DIN_READ_CH_PIN_07, INPUT);
      }
  }

So far I have not observed any unwanted effects from this change

@svollenweider

This comment was marked as spam.

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Mar 25, 2022
@per1234 per1234 linked a pull request Mar 25, 2022 that will close this issue
@per1234 per1234 added the conclusion: resolved Issue was resolved label Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants