What do you mean? As i know execution time is not affected by Lock? Initialize methods may be used during usual execution also, so interrupts of given modules may cause initialization fail. By the way initialize methods should assume arbitrary values in configuration registers, and not default values, which is not always easy and not everywhere done. Georgi Am 08/28/13, schrieb Niklas Hauser <niklas.hauser@rwth-aachen.de>:
Hi,
quick question: Is it a good idea to use
xpcc::atomic::Lock lock;
at the beginning of each and every Peripheral::initialize() method?
Since initialize is mostly called during setup, execution time is not so important, and it reduces unwanted behaviour.
What do you think? Niklas _______________________________________________ xpcc-dev mailing list xpcc-dev@lists.rwth-aachen.de http://mailman.rwth-aachen.de/mailman/listinfo/xpcc-dev
On 28. Aug 2013, at 15:54 , Georgi Grinshpun <Georgi.Grinshpun@rwth-aachen.de> wrote:
What do you mean? As i know execution time is not affected by Lock?
I meant, that the initialize method is not called 1000-10000 a second, and therefore the Lock overhead (3-10 cycles) is not so important.
Initialize methods may be used during usual execution also, so interrupts of given modules may cause initialization fail.
I will add it then.
By the way initialize methods should assume arbitrary values in configuration registers, and not default values, which is not always easy and not everywhere done.
I am thinking of adding the initialize() method into the interface as well. Currently we have the following initialize concepts: Uart::initialize< (int) Baudrate >(); Spi::initialize< (int) Frequency >(Mode); I2c::initilaize< (enum class) DataRate >(); SoftwareSpi and SoftwareI2c initializers have the same syntax, so you can have a true drop-in replacement. I think it makes a lot of sense to specify these minimum initializers also in the interfaces, along with some developer comments about using Lock and watching out for arbitrary register values. Niklas
participants (2)
-
Georgi Grinshpun
-
Niklas Hauser