News for hackers. Stuff that matters.
Re:Using a Time-Of-Flight LIDAR Sensor by delinka on Thursday December 08, 2016 @11:29AM (#13131439)
Indeed, their init routine seriously violates the DRY principle. At the very least, each section could be implemented by a macro, but I prefer your 'table-driven' implementation.
Re:Using a Time-Of-Flight LIDAR Sensor by Gibbon1 on Thursday December 08, 2016 @06:40PM (#13135393)
I have a feeling writing is that way is mostly habit because you often end up with init routines where the device barfs during init for various reasons[1] and you need to execute 'plan b'. That said I'd consider using macro's to be a distant third option.

[1] Classic is the uP resets and re-runs the init code on I2C bus peripherals that have already been configured.