-
Notifications
You must be signed in to change notification settings - Fork 5
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
Breakout I2C UART SPI AnalogRead AnalogWrite #9
Conversation
I'd go for option 2 (standalone objects) to avoid the second level of indirection as you perfectly noticed 🙂 |
@facchinm @Rocketct i've updated the pr.
One more question about pin naming: for internal usage such as I2C class initialization should we go for |
I think |
sure was the PMC, @pennam here (https://github.com/bcmi-labs/AutomationCarrierLibrary/blob/master/src/MachineControl.h#L196-L323) the PWM code based on HRTIMER, in the class i made, I've used the same naming so you should find it already aligned with the PWM ones, here the example if you need https://github.com/bcmi-labs/AutomationCarrierLibrary/blob/master/examples/Analog_Out/Analog_Out.ino. Last but important how to instance, one of that object and the difference with respect the mbed::PWM https://github.com/bcmi-labs/AutomationCarrierLibrary/blob/master/src/MachineControl.h#L329-L384 |
Status update:
|
Is there a reason why we want to adopt underscores for SPI and I2C while for UART we just append the number? e.g. UART1 vs I2C_0? Afaik in Arduino API we usually use camel-case without underscores. Same for functions. e.g. |
We cannot use SPI0 and I2C0 because are already used as defines in ST mbed source files. To access I2C functions i've reused Wire API so from sketch user needs to write:
The same for all other peripherals, |
yes the macros without underscore are already defined on mbed's core so that name is the nearest as possible keeping the analogy with the silk |
Hmm, but we're using them as scoped variable names in |
because I2C0 is a define and the preprocessor will replace it |
Ah, I see, actually I2C0 would work but I2C1 is defined :-D That's unfortunate. |
For I2C issue i've submitted this patch ARMmbed/mbed-os#14659 @facchinm should i wait/request a formal approval to merge this pr? |
LGTM! |
Sorry guys @facchinm @Rocketct, but need some more advice here. Following yesterday discussion i wrote some lines of code:
Breakout.I2C_0.begin()
I think is not possible to declare objects into external fileObjects.cpp
cause they need to be insideBreakoutCarrierClass
BreakoutI2CClass
,BreakoutUARTClass
,BreakoutPWMClass
, but this adds another nesting level and the result to the user will beBreakout.I2C.BUS_0.begin()
And now the real question, is there any C++ trick to avoid this double nesting?