O'Reilly logo
  • Alexander Jaworowski thinks this is interesting:

Before, we were hiding the I/O pin in the LED code (creating a hierarchy of functions that depend only on the lower levels). With dependency injection, we’ll remove the dependency of LED code upon the I/O pin by passing an I/O handler as a parameter to the LED initialization code. The I/O handler will know which pin to change and how to change it, but the LED code will know only how to call the I/O handler.

From

Cover of Making Embedded Systems

Note

Some example code would be nice here! One assumes that it will come further down - but not.

Lets see if we can provide some example: ... ran out of mem, see this gist

https://gist.github.com/alexjaw/50a93176744fa903f53549ebf9122eaf