Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork130
Commitdf98331
committed
Add a new 'OUTPUT_OPENDRAIN' pinmode for platforms.
Not every MCU offers open drain pins, but some do. This changemeans that they'll no longer have to play games to implement anAPI-compatible pinMode() function that offers open drain.Fixes#155If you're reading this commit message because you need to add anotherpin mode to this enum, the hacky trivial workaround is to do somethinglike this in your core:```// This typedef is used to extend the PinMode typedef enum// in the ArduinoAPI, since they don't have contantstypedef enum { INPUT_ANALOG = 99 , // We assume that the Arduino core will never have 99 PinModes OUTPUT_OPEN_DRAIN // It'd be cleaner to be able to count the size of that enum} PinModeExtension;```Because PinMode is an enum and not a proper type, the compiler willlet the user pass either a PinMode or a PinModeExtension to yourpinMode() function, even though the signature is`void pinMode(pin_size_t ulPin, PinMode ulMode)`1 parent6a524ad commitdf98331
1 file changed
+5
-4
lines changedLines changed: 5 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
19 |
| - | |
20 |
| - | |
21 |
| - | |
22 |
| - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
23 | 24 |
| |
24 | 25 |
| |
25 | 26 |
| |
|
0 commit comments
Comments
(0)