You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The simplest way to pass in the concrete implementation would be if the default factory functions (like shtc3) use the default implementation, but the ShtCx struct would allow swapping the implementation:
I'm not really sure if it is worth it to use hardware CRC if one just calculates the CRC of two bytes. I guess setting up the hardware CRC is overhead as well, but I may be wrong.
IMHO the hardware CRC is useful if one wants to calculate the CRC over some larger data in the flash.
Many STM32 MCUs (including the STM32L071) feature a hardware CRC implementation.
As an optimization, it would be nice if the default CRC software-implementation could be swapped with a custom implementation that may be faster.
This could be done using a trait:
The driver struct would then be parametrized:
The simplest way to pass in the concrete implementation would be if the default factory functions (like
shtc3
) use the default implementation, but theShtCx
struct would allow swapping the implementation:However, I'm not sure if the software implementation can be optimized out by the compiler or not. Probably not. Maybe a builder would be better.
What do you think, @rnestler?
The text was updated successfully, but these errors were encountered: