Minor clarifications.

master
Paul Sokolovsky 2015-11-09 11:44:34 +02:00
rodzic c2fab60ebd
commit fcf0ff841b
1 zmienionych plików z 1 dodań i 1 usunięć

@ -56,7 +56,7 @@ Conventions are:
- Selection of a peripheral/entity is done by an id. A port must allow to specify ids by a sequential integer starting at 0 and going to MAX (MAX is a constant defined in the periph class). Ports can optionally allow to specify periphs by a string (this allows to write portable code across boards that provide similar periphs, specify by MCU name, etc). There can be also "virtual" peripherals, e.g. bitbanging I2C port, software timer, etc. These are recommended to have negative ids, with -1 being a default choice. If there're multiple types of the same virtual peripheral (e.g. OS software timers with different properties), further negative values can be given, and symbolic constants are recommended to be provided for them. But another implementation strategy for this case is to define separate classes for such cases, instead of overloading default Timer class - e.g. OSSlowTimer, OSFastTimer.
- All periphs provide a constructor, `.init()` and `.deinit()`. The `Pin` and the `IRQ` class are the exception here, `Pin` doesn't provide `.deinit()` because a single pin cannot be completely de-initalized, and also because of the dynamic nature of pins which can be used as GPIO and also by other peripherals.
- All periphs provide a constructor, `.init()` and `.deinit()` methods. The `Pin` and the `IRQ` classes are the exception here, `Pin` doesn't provide `.deinit()` because a single pin cannot be completely de-initalized, and also because of the dynamic nature of pins which can be used as GPIO and also by other peripherals.
- Peripherals should provide default values for all the initialization arguments, this way when calling `.init()` with no params, or the constructor with only the peripheral id (or no id at all, then the default one is used), it will be initialized with the default configuration.