AP_HAL_AVR: stub RCOutput implementations for APM1 and APM2

This commit is contained in:
Pat Hickey 2012-08-27 16:46:07 -07:00 committed by Andrew Tridgell
parent acfbddef0d
commit 064faafdd3
3 changed files with 164 additions and 8 deletions

View File

@ -7,18 +7,56 @@
class AP_HAL_AVR::APM1RCOutput : public AP_HAL::RCOutput { class AP_HAL_AVR::APM1RCOutput : public AP_HAL::RCOutput {
public: public:
APM1RCOutput() : _init(0) {} /* No init argument required */
void init(int machtnicht) { _init = 1; } void init(void* machtnicht);
private:
int _init; /* 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 { class AP_HAL_AVR::APM2RCOutput : public AP_HAL::RCOutput {
public: public:
APM2RCOutput() : _init(0) {} /* No init argument required */
void init(int machtnicht) { _init = 2; } void init(void* machtnicht);
private:
int _init; /* 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__ #endif // __AP_HAL_AVR_RC_OUTPUT_H__

View File

@ -0,0 +1,59 @@
#include <avr/interrupt.h>
#include <AP_HAL_AVR.h>
#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) {
}

View File

@ -0,0 +1,59 @@
#include <avr/interrupt.h>
#include <AP_HAL_AVR.h>
#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) {
}