Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A lot of embedded compilers are bad or at least old. You frequently only get C and not C++, so you can use header files as a sort of template. Write all your real code to use a peripheral in the header, but wrap all the function names, global variable names, and peripheral register names in special macros. Then, in the .c file, you can include the header file multiple times as long as before each include you define a handful of macros that rename all the function, global variable, and register names in the header so they refer to the correct peripheral instance.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: