2012-12-18 05:04:47 -04:00
|
|
|
#include <AP_HAL.h>
|
2015-05-04 03:15:12 -03:00
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
2012-12-17 23:56:21 -04:00
|
|
|
|
|
|
|
#include "RCOutput.h"
|
|
|
|
|
2015-05-04 03:15:12 -03:00
|
|
|
using namespace HALSITL;
|
2012-12-17 23:56:21 -04:00
|
|
|
|
|
|
|
void SITLRCOutput::init(void* machtnichts) {}
|
|
|
|
|
|
|
|
void SITLRCOutput::set_freq(uint32_t chmask, uint16_t freq_hz) {
|
|
|
|
_freq_hz = freq_hz;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t SITLRCOutput::get_freq(uint8_t ch) {
|
|
|
|
return _freq_hz;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SITLRCOutput::enable_ch(uint8_t ch)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void SITLRCOutput::disable_ch(uint8_t ch)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void SITLRCOutput::write(uint8_t ch, uint16_t period_us)
|
|
|
|
{
|
2014-11-11 00:15:28 -04:00
|
|
|
if (ch < 11) {
|
2015-05-04 21:59:07 -03:00
|
|
|
_sitlState->pwm_output[ch] = period_us;
|
2014-11-11 00:15:28 -04:00
|
|
|
}
|
2012-12-17 23:56:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SITLRCOutput::write(uint8_t ch, uint16_t* period_us, uint8_t len)
|
|
|
|
{
|
2015-05-04 21:59:07 -03:00
|
|
|
memcpy(_sitlState->pwm_output+ch, period_us, len*sizeof(uint16_t));
|
2012-12-17 23:56:21 -04:00
|
|
|
}
|
|
|
|
|
2015-05-04 21:59:07 -03:00
|
|
|
uint16_t SITLRCOutput::read(uint8_t ch)
|
2014-11-11 00:15:28 -04:00
|
|
|
{
|
|
|
|
if (ch < 11) {
|
2015-05-04 21:59:07 -03:00
|
|
|
return _sitlState->pwm_output[ch];
|
2014-11-11 00:15:28 -04:00
|
|
|
}
|
|
|
|
return 0;
|
2012-12-17 23:56:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SITLRCOutput::read(uint16_t* period_us, uint8_t len)
|
|
|
|
{
|
2015-05-04 21:59:07 -03:00
|
|
|
memcpy(period_us, _sitlState->pwm_output, len*sizeof(uint16_t));
|
2012-12-17 23:56:21 -04:00
|
|
|
}
|
2012-12-18 05:04:47 -04:00
|
|
|
|
|
|
|
#endif
|