On 13/10/13 16:36, Tommi Rouvali wrote: > Maybe rcc_peripheral_enable_clock function could check incoming > parameters and verify they are correct. This could be done only if DEBUG > is defined, so there is no extra overhead. In case of error, function > could call some user overridable function that allows user to print > error on console, or what ever he/she wishes to do with it. There were some assert macros setup a while ago but there hasn't been a determined push to incorporate them so far. In an ideal world someone would dedicate their waking hours to putting them in to every function. > > I think part of the problem is also documentation. There are some > functions that are hard to use because documentation and source code > both fail to tell what parameter value should be. Take for example > STM32F1xx->USART->usart_set_stopbits. Document says: > > "USART Set Stop Bit(s). > > The stop bits are specified as 0.5, 1, 1.5 or 2. > > Parameters > [in] usart unsigned 32 bit. USART block register address base > usart_reg_base > [in] stopbits unsigned 32 bit. Stop bits usart_cr2_stopbits. > " > " > So there is no way of knowing what should be inside stopbits variable. > The documentation has become slightly broken and needs some patching up work. The usart_cr2_stopbits field in the parameter documentation should have a link to the header file where the actual permitted values are specified (this in the doxygen HTML documentation, not in the code of course). This is done in other parts of libopencm3 and ideally will be fixed before the first release, which we are keen to do very soon.
Ken > > ------------------------------------------------------------------------------ > 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 ------------------------------------------------------------------------------ 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
