2011-11-12 22:57:42 -04:00
|
|
|
#ifndef __APM_RC_H__
|
|
|
|
#define __APM_RC_H__
|
2011-12-26 19:14:26 -04:00
|
|
|
|
|
|
|
|
2011-11-12 22:57:42 -04:00
|
|
|
#include <inttypes.h>
|
2011-12-26 19:14:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
// Radio channels
|
|
|
|
|
|
|
|
// Note channels are from 0!
|
|
|
|
|
|
|
|
#define CH_1 0
|
|
|
|
#define CH_2 1
|
|
|
|
#define CH_3 2
|
|
|
|
#define CH_4 3
|
|
|
|
#define CH_5 4
|
|
|
|
#define CH_6 5
|
|
|
|
#define CH_7 6
|
|
|
|
#define CH_8 7
|
2011-11-15 19:56:10 -04:00
|
|
|
#define CH_9 8
|
2011-11-12 22:57:42 -04:00
|
|
|
#define CH_10 9
|
|
|
|
#define CH_11 10
|
2011-11-15 19:56:10 -04:00
|
|
|
|
2011-12-26 19:14:26 -04:00
|
|
|
|
2011-11-12 22:57:42 -04:00
|
|
|
#define NUM_CHANNELS 8
|
2011-12-26 19:14:26 -04:00
|
|
|
|
|
|
|
|
2011-12-03 23:42:08 -04:00
|
|
|
|
|
|
|
class Arduino_Mega_ISR_Registry;
|
|
|
|
|
2011-12-26 19:14:26 -04:00
|
|
|
class APM_RC_Class
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2011-12-05 03:06:58 -04:00
|
|
|
virtual void Init( Arduino_Mega_ISR_Registry * isr_reg ) = 0;
|
2011-11-12 22:57:42 -04:00
|
|
|
virtual void OutputCh(uint8_t ch, uint16_t pwm) = 0;
|
2012-04-22 23:29:39 -03:00
|
|
|
virtual uint16_t OutputCh_current(uint8_t ch) = 0;
|
2011-11-12 22:57:42 -04:00
|
|
|
virtual uint16_t InputCh(uint8_t ch) = 0;
|
|
|
|
virtual uint8_t GetState() = 0;
|
|
|
|
virtual void clearOverride(void) = 0;
|
2012-03-02 02:23:22 -04:00
|
|
|
virtual void Force_Out() = 0;
|
|
|
|
virtual void SetFastOutputChannels( uint32_t channelmask, uint16_t speed_hz = 400 ) = 0;
|
|
|
|
virtual void enable_out(uint8_t) = 0;
|
|
|
|
virtual void disable_out(uint8_t) = 0;
|
|
|
|
|
2012-03-25 09:13:31 -03:00
|
|
|
virtual void Force_Out0_Out1(void) = 0;
|
|
|
|
virtual void Force_Out2_Out3(void) = 0;
|
|
|
|
virtual void Force_Out6_Out7(void) = 0;
|
|
|
|
|
2012-03-02 02:23:22 -04:00
|
|
|
protected:
|
|
|
|
uint16_t _map_speed(uint16_t speed_hz) { return 2000000UL / speed_hz; }
|
2012-01-17 14:19:27 -04:00
|
|
|
|
2011-12-26 19:14:26 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-12 22:57:42 -04:00
|
|
|
#include "APM_RC_APM1.h"
|
2011-11-25 19:11:14 -04:00
|
|
|
#include "APM_RC_APM2.h"
|
2011-12-26 19:14:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|