diff --git a/libraries/AP_HAL_AVR/RCOutput.h b/libraries/AP_HAL_AVR/RCOutput.h index df4e3c14d4..adbf71a940 100644 --- a/libraries/AP_HAL_AVR/RCOutput.h +++ b/libraries/AP_HAL_AVR/RCOutput.h @@ -7,18 +7,56 @@ class AP_HAL_AVR::APM1RCOutput : public AP_HAL::RCOutput { public: - APM1RCOutput() : _init(0) {} - void init(int machtnicht) { _init = 1; } -private: - int _init; + /* No init argument required */ + void init(void* machtnicht); + + /* Output freq (1/period) control */ + void set_freq(uint32_t chmask, uint16_t freq_hz); + uint16_t get_freq(uint8_t ch); + + /* Output active/highZ control, either by single channel at a time + * or a mask of channels */ + void enable_ch(uint8_t ch); + void enable_mask(uint32_t chmask); + + void disable_ch(uint8_t ch); + void disable_mask(uint32_t chmask); + + /* Output, either single channel or bulk array of channels */ + void write(uint8_t ch, uint16_t period_ms); + void write(uint8_t ch, uint16_t* period_ms, uint8_t len); + + /* Read back current output state, as either single channel or + * array of channels. */ + uint16_t read(uint8_t ch); + void read(uint16_t* period_ms, uint8_t len); }; class AP_HAL_AVR::APM2RCOutput : public AP_HAL::RCOutput { public: - APM2RCOutput() : _init(0) {} - void init(int machtnicht) { _init = 2; } -private: - int _init; + /* No init argument required */ + void init(void* machtnicht); + + /* Output freq (1/period) control */ + void set_freq(uint32_t chmask, uint16_t freq_hz); + uint16_t get_freq(uint8_t ch); + + /* Output active/highZ control, either by single channel at a time + * or a mask of channels */ + void enable_ch(uint8_t ch); + void enable_mask(uint32_t chmask); + + void disable_ch(uint8_t ch); + void disable_mask(uint32_t chmask); + + /* Output, either single channel or bulk array of channels */ + void write(uint8_t ch, uint16_t period_ms); + void write(uint8_t ch, uint16_t* period_ms, uint8_t len); + + /* Read back current output state, as either single channel or + * array of channels starting at 0. */ + uint16_t read(uint8_t ch); + void read(uint16_t* period_ms, uint8_t len); }; #endif // __AP_HAL_AVR_RC_OUTPUT_H__ diff --git a/libraries/AP_HAL_AVR/RCOutput_APM1.cpp b/libraries/AP_HAL_AVR/RCOutput_APM1.cpp new file mode 100644 index 0000000000..4888e8f6af --- /dev/null +++ b/libraries/AP_HAL_AVR/RCOutput_APM1.cpp @@ -0,0 +1,59 @@ + +#include + +#include +#include "RCOutput.h" +using namespace AP_HAL_AVR; + +/* No init argument required */ +void APM1RCOutput::init(void* machtnicht) { + +} + +/* Output freq (1/period) control */ +void APM1RCOutput::set_freq(uint32_t chmask, uint16_t freq_hz) { + +} + +uint16_t APM1RCOutput::get_freq(uint8_t ch) { + +} + +/* Output active/highZ control, either by single channel at a time + * or a mask of channels */ +void APM1RCOutput::enable_ch(uint8_t ch) { + enable_mask(1 << ch); +} + +void APM1RCOutput::enable_mask(uint32_t chmask) { + +} + +void APM1RCOutput::disable_ch(uint8_t ch) { + disable_mask(1 << ch); +} + +void APM1RCOutput::disable_mask(uint32_t chmask) { + +} + +/* Output, either single channel or bulk array of channels */ +void APM1RCOutput::write(uint8_t ch, uint16_t period_ms) { + +} + +void APM1RCOutput::write(uint8_t ch, uint16_t* period_ms, uint8_t len) { + +} + + +/* Read back current output state, as either single channel or + * array of channels. */ +uint16_t APM1RCOutput::read(uint8_t ch) { + +} + +void APM1RCOutput::read(uint16_t* period_ms, uint8_t len) { + +} + diff --git a/libraries/AP_HAL_AVR/RCOutput_APM2.cpp b/libraries/AP_HAL_AVR/RCOutput_APM2.cpp new file mode 100644 index 0000000000..33c2455a08 --- /dev/null +++ b/libraries/AP_HAL_AVR/RCOutput_APM2.cpp @@ -0,0 +1,59 @@ + +#include + +#include +#include "RCOutput.h" +using namespace AP_HAL_AVR; + +/* No init argument required */ +void APM2RCOutput::init(void* machtnicht) { + +} + +/* Output freq (1/period) control */ +void APM2RCOutput::set_freq(uint32_t chmask, uint16_t freq_hz) { + +} + +uint16_t APM2RCOutput::get_freq(uint8_t ch) { + +} + +/* Output active/highZ control, either by single channel at a time + * or a mask of channels */ +void APM2RCOutput::enable_ch(uint8_t ch) { + enable_mask(1 << ch); +} + +void APM2RCOutput::enable_mask(uint32_t chmask) { + +} + +void APM2RCOutput::disable_ch(uint8_t ch) { + disable_mask(1 << ch); +} + +void APM2RCOutput::disable_mask(uint32_t chmask) { + +} + +/* Output, either single channel or bulk array of channels */ +void APM2RCOutput::write(uint8_t ch, uint16_t period_ms) { + +} + +void APM2RCOutput::write(uint8_t ch, uint16_t* period_ms, uint8_t len) { + +} + + +/* Read back current output state, as either single channel or + * array of channels. */ +uint16_t APM2RCOutput::read(uint8_t ch) { + +} + +void APM2RCOutput::read(uint16_t* period_ms, uint8_t len) { + +} +