Open danielratiu opened 10 years ago
+1
In the smart meter codebase, I have started to add external modules for C standard libraries functions that I needed myself. What has turned out to be really useful is to have generic physical units on selected functions, e.g.,
math.h:
@GenericUnitDeclaration(U)
double/U/ round(double/U/ x);
This enables users to conveniently pass in arguments with physical units and get back results with appropriate physical units. Without that, one is forced to strip units from the arguments and re-introduce them on the result which makes the code somewhat hard to write and is very ugly to read.
In some cases it makes also sense to introduce concrete physical units, e.g.,
double sin(double/rad/ x);
This implies that a couple of more physical units would need to become intrinsic physical units, but why not?
If you find that these ideas are not totally absurd, then feel free to take a look at the com.itemis.embedded.platform.orbit module in the smart meter code base, or just ask me ;)
Every time when a standard library function is needed, it needs to be firstly lifted in mbeddr. It would be really helpful if mbeddr core incorporates also (a subset of) standard libraries.