DUNE: Uniform Navigational Environment
2017.01.0
|
Public Types | |
typedef std::map< std::string, PowerChannel * > | PowerChannelMap |
Public Member Functions | |
Task (const std::string &name, Tasks::Context &ctx) | |
~Task (void) | |
void | onUpdateParameters (void) |
void | clearPowerChannels (void) |
void | onEntityReservation (void) |
void | onResourceAcquisition (void) |
void | onResourceInitialization (void) |
void | packParam (unsigned index, double value, uint8_t *bfr) |
void | updateParams (void) |
void | controlPowerChannel (PowerChannel *channel, IMC::PowerChannelControl::OperationEnum op, double sched=-1.0) |
void | writeLCD (unsigned line, const uint8_t *data, unsigned data_len) |
void | consume (const IMC::LcdControl *msg) |
void | consume (const IMC::PowerChannelControl *msg) |
void | consume (const IMC::QueryPowerChannelState *msg) |
void | onCommand (uint8_t cmd, const uint8_t *data, int data_size) |
void | sendMessages (const uint16_t *unpack) |
bool | waitForCommand (uint8_t code) |
void | onVersion (unsigned major, unsigned minor, unsigned patch) |
void | checkSchedules (void) |
void | updatePowerChannels (void) |
void | onMain (void) |
Public Attributes | |
Arguments | m_args |
Hardware::LUCL::Protocol | m_proto |
bool | m_pwr_down |
uint16_t | m_pwr_chns |
MCP23017 * | m_gpios |
bool | m_halt |
IMC::Message * | m_adcs [c_adcs_count] |
PowerChannelMap | m_pwr_chs |
Static Public Attributes | |
static const uint8_t | c_addr |
typedef std::map<std::string, PowerChannel*> Power::MCBv2::Task::PowerChannelMap |
Convenience type definition for a table of power channels.
|
inline |
References Power::MCBv2::Arguments::adc_elabels, Power::MCBv2::Arguments::adc_factors, Power::MCBv2::Arguments::adc_messages, Power::MCBv2::Arguments::adc_ref, Power::MCBv2::Arguments::charged_amp, Power::MCBv2::Arguments::i2c_dev, Power::MCBv2::Arguments::lcd, m_adcs, m_args, Power::MCBv2::Arguments::model, Power::MCBv2::Arguments::pwr_names, and Power::MCBv2::Arguments::pwr_states.
|
inline |
References clearPowerChannels(), m_adcs, and m_gpios.
|
inline |
Check schedules.
References consume(), m_pwr_chs, Power::MCBv2::PowerChannel::sched_off, Power::MCBv2::PowerChannel::sched_on, and Power::MCBv2::PowerChannel::state.
Referenced by onMain().
|
inline |
References m_pwr_chs.
Referenced by onUpdateParameters(), and ~Task().
|
inline |
References Power::MCBv2::Arguments::lcd, m_args, and writeLCD().
Referenced by checkSchedules().
|
inline |
References Power::MCBv2::CMD_HALT, Power::MCBv2::CMD_SAVE, controlPowerChannel(), m_halt, m_proto, m_pwr_chns, and m_pwr_chs.
|
inline |
References m_pwr_chs.
|
inline |
References Power::MCBv2::CMD_BLIGHT, Power::MCBv2::CMD_SAVE, Power::MCBv2::PowerChannel::id, m_gpios, m_proto, m_pwr_chns, Power::MCBv2::PowerChannel::sched_off, Power::MCBv2::PowerChannel::sched_on, Power::MCBv2::MCP23017::setGPIOs(), and Power::MCBv2::PowerChannel::state.
Referenced by consume(), and onResourceInitialization().
|
inline |
On Command call.
[in] | cmd | command. |
[in] | data | buffer of data. |
[in] | data_size | size of data. |
References Power::MCBv2::BIT_SW_SYS_ON, Power::MCBv2::CMD_STATE, m_pwr_down, and sendMessages().
Referenced by waitForCommand().
|
inline |
Reserve entities.
References Power::MCBv2::Arguments::adc_elabels, m_adcs, and m_args.
|
inline |
References checkSchedules(), Power::MCBv2::CMD_STATE, m_halt, m_proto, updatePowerChannels(), and waitForCommand().
|
inline |
Acquire resources.
References c_addr, Power::MCBv2::MCP23017::getGPIOs(), Power::MCBv2::Arguments::i2c_dev, m_args, m_gpios, m_proto, and m_pwr_chns.
|
inline |
Initialize resources.
References controlPowerChannel(), m_proto, m_pwr_chs, updateParams(), and waitForCommand().
|
inline |
Update task parameters.
References Power::MCBv2::Arguments::adc_elabels, Power::MCBv2::Arguments::adc_messages, clearPowerChannels(), Power::MCBv2::PowerChannel::id, m_adcs, m_args, m_pwr_chs, Power::MCBv2::Arguments::pwr_names, Power::MCBv2::Arguments::pwr_states, and Power::MCBv2::PowerChannel::state.
|
inline |
On version call.
[in] | major | major version number. |
[in] | minor | minor version number. |
[in] | patch | patch version number. |
Referenced by waitForCommand().
|
inline |
Write value to position in a given buffer.
[in] | index | position index. |
[in] | value | value to be written. |
[out] | bfr | buffer. |
Referenced by updateParams().
|
inline |
Send Message.
[in] | unpack | pointer to unpacked data buffer. |
References Power::MCBv2::Arguments::adc_factors, Power::MCBv2::Arguments::adc_ref, m_adcs, and m_args.
Referenced by onCommand().
|
inline |
Update parameters.
References Power::MCBv2::Arguments::adc_factors, Power::MCBv2::Arguments::adc_ref, Power::MCBv2::Arguments::charged_amp, Power::MCBv2::CMD_PARAMS, m_args, m_proto, packParam(), and waitForCommand().
Referenced by onResourceInitialization().
|
inline |
References m_pwr_chns, and m_pwr_chs.
Referenced by onMain().
|
inline |
Wait for command.
[in] | code | command code. |
References m_proto, onCommand(), and onVersion().
Referenced by onMain(), onResourceInitialization(), updateParams(), and writeLCD().
|
inline |
References Power::MCBv2::CMD_LCD_LINE, m_proto, and waitForCommand().
Referenced by consume().
|
static |
Device I2C address.
Referenced by onResourceAcquisition().
IMC::Message* Power::MCBv2::Task::m_adcs[c_adcs_count] |
ADC messages.
Referenced by onEntityReservation(), onUpdateParameters(), sendMessages(), Task(), and ~Task().
Arguments Power::MCBv2::Task::m_args |
Task arguments.
Referenced by consume(), onEntityReservation(), onResourceAcquisition(), onUpdateParameters(), sendMessages(), Task(), and updateParams().
MCP23017* Power::MCBv2::Task::m_gpios |
GPIO controller.
Referenced by controlPowerChannel(), onResourceAcquisition(), and ~Task().
Hardware::LUCL::Protocol Power::MCBv2::Task::m_proto |
Device protocol handler.
Referenced by consume(), controlPowerChannel(), onMain(), onResourceAcquisition(), onResourceInitialization(), updateParams(), waitForCommand(), and writeLCD().
uint16_t Power::MCBv2::Task::m_pwr_chns |
Power channels (1 bit per channel).
Referenced by consume(), controlPowerChannel(), onResourceAcquisition(), and updatePowerChannels().
PowerChannelMap Power::MCBv2::Task::m_pwr_chs |
Power channels by name.
Referenced by checkSchedules(), clearPowerChannels(), consume(), onResourceInitialization(), onUpdateParameters(), and updatePowerChannels().
bool Power::MCBv2::Task::m_pwr_down |
True if power down is in progress.
Referenced by onCommand().