5 changed files with 89 additions and 20 deletions
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
||||
|
||||
/*
|
||||
* AP_Relay.cpp |
||||
* |
||||
* Created on: Oct 2, 2011 |
||||
* Author: Amilcar Lucas |
||||
*/ |
||||
|
||||
#include <avr/io.h> |
||||
#include "wiring.h" |
||||
|
||||
#include "AP_Relay.h" |
||||
|
||||
void AP_Relay::on() |
||||
{ |
||||
PORTL |= B00000100; |
||||
} |
||||
|
||||
|
||||
void AP_Relay::off() |
||||
{ |
||||
PORTL &= ~B00000100; |
||||
} |
||||
|
||||
|
||||
void AP_Relay::toggle() |
||||
{ |
||||
PORTL ^= B00000100; |
||||
} |
||||
|
||||
|
||||
void AP_Relay::set(bool status) |
||||
{ |
||||
if (status) |
||||
on(); |
||||
else |
||||
off(); |
||||
} |
||||
|
||||
|
||||
bool AP_Relay::get() |
||||
{ |
||||
// TODO get the relay status
|
||||
return false; |
||||
} |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
// -*- 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
|
||||
|
||||
#ifndef AP_RELAY_H_ |
||||
#define AP_RELAY_H_ |
||||
|
||||
/// @class AP_Relay
|
||||
/// @brief Class to manage the APM relay
|
||||
class AP_Relay{ |
||||
public: |
||||
// activate the relay
|
||||
void on(); |
||||
|
||||
// de-activate the relay
|
||||
void off(); |
||||
|
||||
// toggle the relay status
|
||||
void toggle(); |
||||
|
||||
// set the relay status (on/off)
|
||||
void set(bool status); |
||||
|
||||
// get the relay status (on/off)
|
||||
bool get(); |
||||
}; |
||||
|
||||
|
||||
#endif /* AP_RELAY_H_ */ |
Loading…
Reference in new issue