PinDriver Class Reference
|
yasimavr
|
MCU pin driver. More...
#include <sim_pin.h>
Public Types | |
| typedef unsigned int | pin_index_t |
Public Member Functions | |
| PinDriver (ctl_id_t id, pin_index_t pin_count) | |
| virtual | ~PinDriver () |
| void | set_enabled (bool enabled) |
| void | set_enabled (pin_index_t index, bool enabled) |
| bool | enabled (pin_index_t index) const |
| void | update_pin_state (pin_index_t pin_index) |
| void | update_pin_states () |
| Wire::state_t | pin_state (pin_index_t pin_index) const |
| Pin::controls_t | gpio_controls (pin_index_t pin_index) const |
| PinDriver (const PinDriver &)=delete | |
| PinDriver & | operator= (const PinDriver &)=delete |
| virtual Pin::controls_t | override_gpio (pin_index_t pin_index, const Pin::controls_t &controls)=0 |
| virtual void | digital_state_changed (pin_index_t pin_index, bool state) |
Friends | |
| class | PinManager |
Detailed Description
MCU pin driver.
PinDriver is an interface that allows to override the controls of a MCU pin. It is usually used as a sub-object of a peripheral that, under some conditions, takes control of a GPIO.
The PinDriver does not know which pins it controls. The driver only references pins by a arbitrary integer index (0 to N) that has meaning only for the driver.
To operate, a driver must be registered with the PinManager object during the device initialisation phase. They are referenced by their ID, which must be unique. It is usually the same ID as the corresponding peripheral.
- See also
- Pin, PinManager
Member Typedef Documentation
◆ pin_index_t
| typedef unsigned int PinDriver::pin_index_t |
Constructor & Destructor Documentation
◆ PinDriver() [1/2]
| PinDriver::PinDriver | ( | ctl_id_t | id, |
| pin_index_t | pin_count | ||
| ) |
Construct a pin driver.
- Parameters
-
id Driver ID, usually the same ID as the parent peripheral pin_count Number of pin driven by this driver
◆ ~PinDriver()
|
virtual |
◆ PinDriver() [2/2]
|
delete |
Member Function Documentation
◆ digital_state_changed()
|
virtual |
Stub called when the digital state of a pin has changed after a state resolution.
- Parameters
-
pin_index Index of the pin state New digital state of the pin
Reimplemented in ArchAVR_TWI::_PinDriver, ArchAVR_USART::_PinDriver, ArchAVR_USI::_PinDriver, ArchXT_TWI::_PinDriver, ArchXT_USART::_PinDriver, ArchAVR_SPI::_PinDriver, and ArchXT_SPI::_PinDriver.
◆ enabled()
| bool PinDriver::enabled | ( | pin_index_t | pin_index | ) | const |
Returns the enable/disable override state for one pin.
- Parameters
-
pin_index Index of the pin
◆ gpio_controls()
| Pin::controls_t PinDriver::gpio_controls | ( | pin_index_t | pin_index | ) | const |
Returns the GPIO controls of a pin, as configured by the GPIO port controller.
- Parameters
-
pin_index Index of the pin
◆ operator=()
◆ override_gpio()
|
pure virtual |
Stub called when a state resolution is taking place on a pin that the driver is controlling. The reimplementation should make a copy of the controls structure in argument, change its members according to the override state and return the result.
- Parameters
-
pin_index index of the pin controls pin controls as configured by the GPIO port controller
- Returns
- the controls to apply to the pin
Implemented in ArchXT_TimerA::_PinDriver, ArchAVR_SPI::_PinDriver, ArchAVR_TWI::_PinDriver, ArchAVR_USART::_PinDriver, ArchAVR_USI::_PinDriver, ArchXT_SPI::_PinDriver, ArchXT_TWI::_PinDriver, ArchXT_USART::_PinDriver, and ArchXT_TimerB::_PinDriver.
◆ pin_state()
| Wire::state_t PinDriver::pin_state | ( | pin_index_t | pin_index | ) | const |
Returns the resolved state of a pin.
- Parameters
-
pin_index Index of the pin
◆ set_enabled() [1/2]
| void PinDriver::set_enabled | ( | bool | enabled | ) |
Enable/disable the override for all the pins.
- Parameters
-
enabled Enable/disable the driver
◆ set_enabled() [2/2]
| void PinDriver::set_enabled | ( | pin_index_t | pin_index, |
| bool | enabled | ||
| ) |
Enable/disable a pin override.
- Parameters
-
pin_index Index of the pin enabled Enable/disable the driver
◆ update_pin_state()
| void PinDriver::update_pin_state | ( | pin_index_t | pin_index | ) |
Forces a state resolution for one pin. No-op if the driver is disabled for that pin.
- Parameters
-
pin_index Index of the pin to update
◆ update_pin_states()
| void PinDriver::update_pin_states | ( | ) |
Forces a state resolution of all the pins. No-op if the driver is disabled for all pins.
Friends And Related Symbol Documentation
◆ PinManager
|
friend |
The documentation for this class was generated from the following files:
Generated by