PinManager Class Reference
|
yasimavr
|
MCU pin manager. More...
#include <sim_pin.h>
Classes | |
| struct | drv_entry_t |
| struct | pin_entry_t |
Public Types | |
| typedef sim_id_t | mux_id_t |
Public Member Functions | |
| PinManager (const std::vector< pin_id_t > &pin_ids) | |
| ~PinManager () | |
| bool | register_driver (PinDriver &drv) |
| bool | add_mux_config (ctl_id_t drv, const std::vector< pin_id_t > &pins, mux_id_t mux_id=default_mux_id) |
| void | set_current_mux (ctl_id_t drv, mux_id_t index) |
| void | set_current_mux (ctl_id_t drv, PinDriver::pin_index_t, mux_id_t index) |
| mux_id_t | current_mux (ctl_id_t drv, PinDriver::pin_index_t pin_index) const |
| std::vector< pin_id_t > | current_mux_pins (ctl_id_t drv) const |
| Pin * | pin (pin_id_t pin_id) const |
| PinManager (const PinManager &)=delete | |
| PinManager & | operator= (const PinManager &)=delete |
Static Public Attributes | |
| static constexpr mux_id_t | default_mux_id = "DEFAULT" |
Friends | |
| class | Pin |
| class | PinDriver |
Detailed Description
MCU pin manager.
Class managing a set of pins and the mux configurations between the pin drivers and the pins.
The mux configuration are identified by a ID, with 0 a reserved value. This ID must be unique for a particular driver. A default mux ID is provided by the static constant default_mux_id which can be used for drivers that have only one mux config.
Member Typedef Documentation
◆ mux_id_t
| typedef sim_id_t PinManager::mux_id_t |
Constructor & Destructor Documentation
◆ PinManager() [1/2]
|
explicit |
Construct a pin manager.
- Parameters
-
pin_ids array of the pin IDs managed by this. A Pin object is constructed for each of these IDs.
◆ ~PinManager()
| PinManager::~PinManager | ( | ) |
◆ PinManager() [2/2]
|
delete |
Member Function Documentation
◆ add_mux_config()
| bool PinManager::add_mux_config | ( | ctl_id_t | drv_id, |
| const std::vector< pin_id_t > & | pin_ids, | ||
| mux_id_t | mux_id = default_mux_id |
||
| ) |
Add a mux configuration for a pin driver.
- Parameters
-
drv_id ID of the driver pin_ids Array of the pin IDs corresponding to the indexes used by the driver mux_id ID for the mux config (unique for the driver), must be > 0
- Returns
- true if the operation succeeded
- Note
- the first mux config is automatically activated.
◆ current_mux()
| PinManager::mux_id_t PinManager::current_mux | ( | ctl_id_t | drv_id, |
| PinDriver::pin_index_t | pin_index | ||
| ) | const |
Returns the ID of the currently activated mux config for a pin driver. If no mux is activated, returns 0.
- Parameters
-
drv_id ID of the driver
◆ current_mux_pins()
Returns the pin IDs to which a driver is attached according to its currently activated mux config. If no mux config is activated for this driver, an array filled with zeros is returned.
- Parameters
-
drv_id ID of the driver
◆ operator=()
|
delete |
◆ pin()
Return a pointer to a Pin object
- Parameters
-
drv_id ID of the pin
◆ register_driver()
| bool PinManager::register_driver | ( | PinDriver & | drv | ) |
Register a pin driver with this manager.
- Parameters
-
drv driver to register
◆ set_current_mux() [1/2]
Activate a mux configuration for all pins of a pin driver.
- Parameters
-
drv_id ID of the driver mux_index index of the new configuration to activate. May be 0 i.e. no mux is activated.
◆ set_current_mux() [2/2]
| void PinManager::set_current_mux | ( | ctl_id_t | drv_id, |
| PinDriver::pin_index_t | pin_index, | ||
| mux_id_t | mux_id | ||
| ) |
Activate a mux configuration for one pin of a pin driver.
- Parameters
-
drv_id ID of the driver pin_index Index of the pin mux_index index of the new configuration to activate. May be 0 i.e. no mux is activated.
Friends And Related Symbol Documentation
◆ Pin
|
friend |
◆ PinDriver
|
friend |
Member Data Documentation
◆ default_mux_id
|
staticconstexpr |
The documentation for this class was generated from the following files:
Generated by