Skip to content

Runtime Mode change of PIN #7334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
drahnr opened this issue Jun 26, 2018 · 4 comments
Closed

Runtime Mode change of PIN #7334

drahnr opened this issue Jun 26, 2018 · 4 comments

Comments

@drahnr
Copy link
Contributor

drahnr commented Jun 26, 2018

Description

I have a set of pins which are re=used depending on the operation mode (SPI, I2C, GPIO IRQ, ADC, DigitalOut).

What is the desired way of doing this in mbed os?

If I utilize a PIN as DigitalOut, which de-allocates with a scope and afterwards allocate again with DigitalIn.
What is the state while it is not allocated? Is it going back to the default state (and where is that defined?)

Issue request type

[X] Question
[ ] Enhancement
[ ] Bug

@drahnr drahnr changed the title Mode change of PIN Runtime Mode change of PIN Jun 26, 2018
@ciarmcom
Copy link
Member

ARM Internal Ref: MBOTRIAGE-928

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 27, 2018

What is the state while it is not allocated? Is it going back to the default state (and where is that defined?)

This is not yet defined, but should be. This will be address by the specs update for all HAL (including those you are using). ctor initializes it for specific functionality, but not all drivers call free (so dtor is empty). Therefore the state is preserved. The answer would be, state changes only on initialization.

@ARMmbed/mbed-os-core Please review

@drahnr
Copy link
Contributor Author

drahnr commented Jun 27, 2018

It would be greate if there would be a convert_to<DigitalOut>(PinConvertible) where all the Pin types derive from the PinConvertiable base, and depending ton the Pin this works or doesn't (runtime check) (just a quick idea though)

@deepikabhavnani
Copy link

This is duplicate of #3106.

Since destructor code is empty, deallocation is not done.

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

No branches or pull requests

4 participants