You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
977 B
46 lines
977 B
/* |
|
* AP_Relay.h |
|
* |
|
* Created on: Oct 2, 2011 |
|
* Author: Amilcar Lucas |
|
*/ |
|
|
|
/// @file AP_Relay.h |
|
/// @brief APM relay control class |
|
#pragma once |
|
|
|
#include <AP_Param/AP_Param.h> |
|
|
|
#define AP_RELAY_NUM_RELAYS 6 |
|
|
|
/// @class AP_Relay |
|
/// @brief Class to manage the ArduPilot relay |
|
class AP_Relay { |
|
public: |
|
AP_Relay(); |
|
|
|
/* Do not allow copies */ |
|
AP_Relay(const AP_Relay &other) = delete; |
|
AP_Relay &operator=(const AP_Relay&) = delete; |
|
|
|
// setup the relay pin |
|
void init(); |
|
|
|
// activate the relay |
|
void on(uint8_t relay); |
|
|
|
// de-activate the relay |
|
void off(uint8_t relay); |
|
|
|
// see if the relay is enabled |
|
bool enabled(uint8_t relay) { return relay < AP_RELAY_NUM_RELAYS && _pin[relay] != -1; } |
|
|
|
// toggle the relay status |
|
void toggle(uint8_t relay); |
|
|
|
static const struct AP_Param::GroupInfo var_info[]; |
|
|
|
private: |
|
AP_Int8 _pin[AP_RELAY_NUM_RELAYS]; |
|
AP_Int8 _default; |
|
};
|
|
|