Oh, that is pretty cool. The code is in my https://github.com/ChuckM/libopencm3-stm32f429-changes/tree/pins-demo branch of my loc3 repo and is also in PR #412 on the main Github repo for libopencm3.
On Sun, Mar 15, 2015 at 8:23 PM, Daniel Serpell <daniel.serp...@gmail.com> wrote: > Hi!, > > On Sun, Mar 15, 2015 at 5:11 PM, Chuck McManis <chuck.mcma...@gmail.com> > wrote: >> I have been building a set of utility functions that sit "beside" the >> libopencm3 library and make it a bit faster/easier to generate code >> that uses libopencm3. One piece that seems particularly useful is the >> 'pins' api, which is a higher level expression of the gpio_xxx api >> that loc3 currently has. Things that I like about my version are that >> you can say (for example) >> >> pin_attributes(PIN_FAST, PB5, PB6, PC0, PD0, PD1, PD8, PD9, PD10, >> PD14, PD15, PE0, PE1, PE7, PE8, PE9, PE10, PE11, PE12, PE13, PE14, >> PE15, PF0, PF1, PF2, PF3, PF4, PF5, PF11, PF12, PF13, PF14, PF15, PG0, >> PG1, PG4, PG5, PG8, PG15, PXX); > > [...] > >> The downside is that if you miss the PXX at the end it can provide a >> hard to diagnose failure. So far though the upside has been worth it. >> > > I have not seen your code, but note that you can use a macro with > variable number of arguments to hide this, like: > > #define pin_attributes(attr, ...) real_pin_attributes(attr, __VA_ARGS__, > PXX) > > This will add the "PXX" at the end irrespective of the original number > of arguments, and will give an error if no pin arguments are supplied. > > Daniel. > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > libopencm3-devel mailing list > libopencm3-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libopencm3-devel ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ libopencm3-devel mailing list libopencm3-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libopencm3-devel