ardupilot/libraries/AP_Relay/AP_Relay.h

49 lines
972 B
C
Raw Normal View History

// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
/*
* AP_Relay.h
*
* Created on: Oct 2, 2011
* Author: Amilcar Lucas
*/
/// @file AP_Relay.h
/// @brief APM relay control class
2012-11-30 21:47:32 -04:00
#ifndef __AP_RELAY_H__
#define __AP_RELAY_H__
#include <AP_Param.h>
2014-01-19 21:59:21 -04:00
#define AP_RELAY_NUM_RELAYS 4
/// @class AP_Relay
/// @brief Class to manage the APM relay
class AP_Relay {
public:
AP_Relay();
2012-12-04 19:26:30 -04:00
// setup the relay pin
void init();
// activate the relay
2014-01-19 21:59:21 -04:00
void on(uint8_t relay);
// de-activate the relay
2014-01-19 21:59:21 -04:00
void off(uint8_t relay);
2014-01-20 00:35:38 -04:00
// see if the relay is enabled
bool enabled(uint8_t relay) { return relay < AP_RELAY_NUM_RELAYS && _pin[relay] != -1; }
// toggle the relay status
2014-01-19 21:59:21 -04:00
void toggle(uint8_t relay);
static const struct AP_Param::GroupInfo var_info[];
private:
2014-01-19 21:59:21 -04:00
AP_Int8 _pin[AP_RELAY_NUM_RELAYS];
AP_Int8 _default;
};
#endif /* AP_RELAY_H_ */