posathenew.blogg.se

Due wire library
Due wire library









due wire library due wire library

I would be happy to generate the pull requests for the AVR core and I could also probably handle the DUE as well.įrom my recollection when I looked at this a while back, the DUE core uses some low level i2c code that is not available so to work around that, I would think that adding these to the Wire API would not be too controversial. If WIRE_HAS_GETCLOCK is defined the Wire library has a getClock() function that returns the actual master clock frequency currently in use. If WIRE_HAS_SETCLOCK is defined the Wire library has a setClock() function that returns the actual frequency selected. To help sketches and libraries know if this functionality exists two defines were createdĮach one indicates that this functionality exists.

due wire library

If an entity wants to know what the clock frequency is prior to calling setClock() it can always simply call getClock() to get it. In the end, we opted for both setClock() and getClock() to have consistent return values. We also discussed leaving setClock() as a void but then there is no way to return failure status for things like the bus being in slave mode. We did have a discussion about returning the previous frequency from setClock() instead of the new/current actual frequency but that can complicate things when trying to get the actual frequency and creates an inconsistency with getClock() To get the current frequency without modifying the current frequency. It is useful to have both functions as this allows not only getting the current actual clock frequency selected when setting the clock but also the ability If the object is currently in slave mode, zero is returned.Ī new method getClock() was also added that simply returns the current actual master clock frequency. Note that the actual clock frequency can be different than the requested frequency. SetClock() was changed to return the actual clock frequency instead of being a void. The API functions do not alter the existing Wire API so any existing code that uses Wire is not affected. The pic32 core has created Wire API method functions to do this. In some types of applications it can also be useful to know the actual master clock frequency vs what was requested. There are times where being able to get the current master clock frequency can be useful. Currently, the Wire library has a way to set/alter the i2c master clock frequency but does not have a way to get the current/actual master i2c clock frequency being used.











Due wire library