Skip to content

Conversation

mazgch
Copy link
Contributor

@mazgch mazgch commented Mar 4, 2014

Currently the gpio_init function is configuring a gpio either to pull low or to output low. This can be a problem if you need to respect timing of a pin or only set the pin low only when it should be. An example could be initializing multiple chip selects on an SPI bus. There is no way to init a pin as "input pull none" or "output high" or "input pull high". Therefore I am proposing a change to the gpio api.

The function gpio_init should only create the gpio object and not apply any changes to the hardware.

Unfortunately this change affects all targets. And I am not able to test them.

@mazgch
Copy link
Contributor Author

mazgch commented Mar 4, 2014

Currently targets use different definitions for the PullDefault. Maybe it could make sense to unify the default for all targets to have a consistent behaviour. But this may have impact on user code as behavior would change for some targets.

@toyowata
Copy link
Contributor

toyowata commented Mar 4, 2014

I am afraid of the impact of code size and runtime performance for application, since it will generate more static initialization code when application has a lot of global instances.
Did you consider about it?

@mazgch
Copy link
Contributor Author

mazgch commented Mar 4, 2014

Hi Watarai-san

If we want to optimize this we should move the constructors for the
DigitalIn/Out from the header to a cpp or c file in the common directory.

Michael

@mazgch
Copy link
Contributor Author

mazgch commented Mar 4, 2014

created new pull request #198 to address concern from watarai-san

@mazgch mazgch closed this Mar 4, 2014
bridadan added a commit that referenced this pull request Jun 21, 2016
pan- added a commit to pan-/mbed that referenced this pull request May 29, 2020
ccli8 pushed a commit to ccli8/mbed-os that referenced this pull request Aug 13, 2024
* Fix STM32 I2C v2 async transfer not doing a repeated start

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants