> > I think that function is overcomplicated and as you point out dangerous. > > What is the advantage of e.g. writing > rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USBEN); > against directly writing > RCC_APB1ENR |= RCC_APB1ENR_USBEN;
To my (simple) mind, it's the advantage for someone coming new to some application code and seeing "rcc_peripheral_enable_clock" and thinking, "Ok, this turns on a clock" and then briefly looking at some (not pretty) #defines and going, "right, USB, I'll just assume those other bits are right, because this code is working, now I know what this line of code does" vs looking at "RCC_APB1ENR |= RCC_APB1ENR_USBEN" and having to make sure I'm familiar with the refman ahead of time and like spending my day reading in capitals. I know it's a very minor thing, but it makes the code so much easier for my simple brane to deal with. I can read lowercase, separated (_) words that describe what's happening, and I don't have to scan for a P vs a H, and a 1 vs a 2 as single characters inside a larger word. Cheers, Karl P ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk _______________________________________________ libopencm3-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libopencm3-devel
