Replies: 10 comments 20 replies
-
embed::i2c::configure()The problem with configure is that it contains clock rate. Making this particular API public means that any arbitrary driver can change the frequency of the I2C peripheral. This is a problem because we can have a situation where devices can support different clock rates from each other. For example, say we have 3 drivers, two of which support 100kHz and one that supports 400kHz. Each driver set the i2c configure to their preferred high speed clock rate. Let's assume that in this application the developer did not specify a consistent clock rate for each driver even though they support specifying one over the default. So each driver will set the clock to their maximum rate. Running a bus faster then some devices can handle is against the protocol rules for I2C and the behavior is undefined. This begs the question, should this API be apart of the interface or not? The current purpose of this API is to be used with So the choice is to keep this as an API for configuring the device or make setting the clock rate driver specific with their own rules and behaviors.
|
Beta Was this translation helpful? Give feedback.
-
embed::serial::attach_interrupt(/* ... */) or ::capacity()We currently do not have this API but should we make it a hard requirement? The idea of attach interrupt would be that when the capacity of the DMA or interrupt driven serial port fills to a particular percentage, a user defined callback is executed. That callback can then be used to handle pulling data out of the buffer. When I think about this problem I think about the esp8266 driver. The main thing to understand about that driver, without actually looking at the specifications is that, when you execute a request to a server the amount of data you get back can be enormous. The esp8266 could inject its own handler that manages pulling data out of the serial port and into its own buffer. BUT! Not all DMA based MCUs can support interrupting at arbitrary fill percentages so thats another thing to be concerned about. What other hand I drop based systems for cereal and immediately tell you when they hit a certain limit. |
Beta Was this translation helpful? Give feedback.
-
Should there be an embed::input_output_pin?Should there exist an interface just for supporting a pin that can have its direction switched from input to output. This particular functionality would be useful for developing a bit-bang i2c driver. In particular, output_pin has an interesting capability from its current API. If you set it as open collector and set the active level to |
Beta Was this translation helpful? Give feedback.
-
Should
|
Beta Was this translation helpful? Give feedback.
-
embed::serial::settings::frame_sizeI've been debating if we should even allow anything beyond 8-bits per frame for serial. As far as I can tell the applications for other bit sizes are very limited and removing this from the settings API will reduce the size of
I don't think there are any modern tools that care to use any bit width other than 9 bits. And a particular need arises for differing bit widths, I firmly believe that a new interface should be made for that purpose to not create overlap between these two. Maybe call it |
Beta Was this translation helpful? Give feedback.
-
pwm::configureMaybe this should just be |
Beta Was this translation helpful? Give feedback.
-
hal::dac + hal::adc + hal::pwm + hal::motor + hal::i2cAll confirmed by team on Aug 10th 2022 by the team see video https://www.youtube.com/watch?v=6DH4BEXwn1E |
Beta Was this translation helpful? Give feedback.
-
serial::configureJust a thought... when would the driver call configure twice? For I2c and SPI configuring the bus may be necessary when talking to different devices. Serial is 1-to-1 normally, except in the cases of RS485 or RS232 but the frame configuration should be the same for all of the devices on the bus. Every driver will have to ensure that the baud rate and other settings are set at the start of operation. But other than that, there will no longer be a need for configure to execute once more. Thus it puts it into question if the device shouldn't simply be configured with the frame configuration needed before being passed into a device driver. Thus the device driver does not configure the device but simply uses it directly assuming the frame information has been supplied already. |
Beta Was this translation helpful? Give feedback.
-
output_pin starting level does not it make senseThis cannot be controlled after the creation of the pin so having a configuration option for it does not make sense. |
Beta Was this translation helpful? Give feedback.
-
Should hal::timer have a get_range() functionThe idea of get_range() or some equivalent is that the timer can return to the user what it is capable of in terms of scheduling a callback. It can return a pair, or struct indicating the shortest possible schedule time and the longest possible schedule time. This is in contrast to what the current API has which informs the user via an error return type. But this seems very wrong as error should be considered for exception situations and not for situations where the user simply needs to know the bounds of a driver. |
Beta Was this translation helpful? Give feedback.
-
Go through each and every alpha launch interface and consider the following:
boost::leaf::result<T>
return type and determine if any APIs can get away without themThe list of interfaces to go through are the following:
countersteady_clockBeta Was this translation helpful? Give feedback.
All reactions