-
Notifications
You must be signed in to change notification settings - Fork 3k
Pinology #808
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
Pinology #808
Conversation
…_t is connected or initialized with NC Simple gpio_t structure in TARGET_KPSDK_MCUS field name changed to allign to other HALs
…igitalOut and DigitalInOut
… in random-iterator fashion
You can use BusIn::mask() or BusOut::mask() to get binary mask of all connected and NC pins in bus
This change follows changes in BUsIn and BusOUt API
…atures of BusOut::operator[] and DigitalOut::is_connected()
Looks very nice 👍 |
Why is index declared as unsigned int in operator[](unsigned int index) ? I can't find an exaplanation for those static dummy members. Why is assert commented out? That missing explanation would answer it.
|
Thanks , that explains it. What's your preference to 2nd (assertation in operator[])? |
0xc0170, |
…h mbed code guidelines. * Uncommented assertions in operators and added check for operator[] index < 0. * Moved one operator from private to public, this was a typo thing.
…T for cleaner code
@0xc0170: Simplified code and removed dummies. Now ASSERT will look after correct indexes and NC pins inside Bus component family. |
Description
This pull requests introduces simple improvements for GPIO HAL functions in mbed SDK.
Improvements introduce:
Rationale
Currently if you want to set proper bit(s) in Bus component you have to use write() method which will set all pins. In case you want to set/clear single pin you need to perform some bit operations and set/clear pin you want.
Currently:
With this pull request:
DigitalOut pin setup check
You can check if DigitalIn, DigitalOut and DigitalInOut component was initialized with NC (not connected) pin name value:
Bus pin masking
You can get bus pin mask to perform bit-wise operations and see e.g. if groups of pins are connected or not:
LED blinky example
Testing
Output for supporting test: