Skip to content

[2.0.x] Ensure pins are INPUT after attachInterrupt#10928

Merged
thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom
thinkyhead:bf2_no_set_input_needed
Jun 7, 2018
Merged

[2.0.x] Ensure pins are INPUT after attachInterrupt#10928
thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.0.xfrom
thinkyhead:bf2_no_set_input_needed

Conversation

@thinkyhead
Copy link
Member

According to @ktand There's no need to set pins to input because attachInterrupt will do it automatically. Does this extend to all STM32Fx platforms?

@thinkyhead thinkyhead added the T: HAL & APIs Topic related to the HAL and internal APIs. label Jun 4, 2018
@ktand
Copy link
Contributor

ktand commented Jun 4, 2018

@thinkyhead I think it depends on which STM32 Arduino core is being used. STM32GENERIC has a bug where it CHANGES the pinmode to input, with no pull up. The official Arduino_Core_STM32 doesn't modify the pinmode and that is how it should be, I believe.

@thinkyhead
Copy link
Member Author

@ktand — In that case, would it make more sense to set the pin mode after attachInterrupt for extra insurance?

@thinkyhead thinkyhead force-pushed the bf2_no_set_input_needed branch from 7bfff37 to a07c322 Compare June 6, 2018 07:27
@thinkyhead thinkyhead changed the title [2.0.x] Pins set to INPUT automatically on attachInterrupt [2.0.x] Ensure pins are INPUT after attachInterrupt Jun 6, 2018
@ktand
Copy link
Contributor

ktand commented Jun 6, 2018 via email

@thinkyhead thinkyhead merged commit a426986 into MarlinFirmware:bugfix-2.0.x Jun 7, 2018
@thinkyhead thinkyhead deleted the bf2_no_set_input_needed branch June 7, 2018 01:59
@ktand
Copy link
Contributor

ktand commented Jun 12, 2018

@thinkyhead I'm sorry but I misunderstood you. I was thinking you meant setting the pinMode for endstop-pins as defined in Configuration.h (ENDSTOPPULLUP, ENDSTOPPULLDOWN) after attachInterrupt. Just setting them to INPUT after attachInterrupt makes no sense as the attachInterrupt function in STM32GENERIC already does this. I think it would be best to just remove the SET_INPUT call.

@thinkyhead
Copy link
Member Author

…the attachInterrupt function in STM32GENERIC already does this…

Do we need to set the pullup for STM32GENERIC?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T: HAL & APIs Topic related to the HAL and internal APIs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants