Code: Select all
/******************************* HOTT RECIVER ************************************/
/* Graupner Hott HD */
//#define SUMD PITCH,YAW,THROTTLE,ROLL,AUX1,AUX2,AUX3,AUX4
//#define RX_SERIAL_PORT 1
rx.cpp
configureReceiver()
Code: Select all
// Init Graupner/SJ RX
#if defined (SUMD)
SerialOpen(RX_SERIAL_PORT,115200);
#endif
// Init SBUS RX
#if defined(SBUS)
SerialOpen(RX_SERIAL_PORT,100000);
switch (RX_SERIAL_PORT) { //parity
case 0: UCSR0C |= (1<<UPM01)|(1<<USBS0); break;
case 1: UCSR1C |= (1<<UPM11)|(1<<USBS1); break;
case 2: UCSR2C |= (1<<UPM21)|(1<<USBS2); break;
case 3: UCSR3C |= (1<<UPM31)|(1<<USBS3); break;
}
#endif
Note i did omit the mega #ifdef for sbus parity, since bitnames for 328 and 32u4 are the same as for mega. This "should" work ...
the driver:
Code: Select all
/**************************************************************************************/
/*************** SUMD ********************/
/**************************************************************************************/
#if defined(SUMD)
#define SUMD_SYNCBYTE 0xA8
#define SUMD_MAXCHAN 8
#define SUMD_BUFFSIZE SUMD_MAXCHAN*2 + 5 // 6 channels + 5 -> 17 bytes for 6 channels
static uint8_t sumdIndex=0;
static uint8_t sumdSize=0;
static uint8_t sumd[SUMD_BUFFSIZE]={0};
void readSumD(void) {
while (SerialAvailable(RX_SERIAL_PORT)) {
int val = SerialRead(RX_SERIAL_PORT);
if(sumdIndex == 0 && val != SUMD_SYNCBYTE) continue;
if(sumdIndex == 2) sumdSize = val;
if(sumdIndex < SUMD_BUFFSIZE) sumd[sumdIndex] = val;
sumdIndex++;
if(sumdIndex == sumdSize*2+5)
{
sumdIndex = 0;
spekFrameFlags = 0x00;
debug[1] = sumd[1];
if (sumdSize > SUMD_MAXCHAN) sumdSize = SUMD_MAXCHAN;
for (uint8_t b = 0; b < sumdSize; b++)
rcValue[b] = ((sumd[2*b+3]<<8) | sumd[2*b+4])>>3;
spekFrameDone = 0x01; // havent checked crc at all
#if defined(FAILSAFE)
if (sumd[1] == 0x01)
{if(failsafeCnt > 20) failsafeCnt -= 20; else failsafeCnt = 0;} // clear FailSafe counter
#endif
}
}
}
#endif
readrawrc()
Code: Select all
#if defined(SPEKTRUM) || defined(SBUS) || defined(SUMD)
computeRC()
Code: Select all
#if defined(SPEKTRUM) || defined(SBUS) || defined(SUMD) // no averaging for Spektrum & SBUS & SUMD signal
multiwii.cpp
Code: Select all
#if defined(SPEKTRUM) || defined(SBUS) || defined(SUMD)
volatile uint8_t spekFrameFlags;
volatile uint32_t spekTimeLast;
uint8_t spekFrameDone;
#endif
Code: Select all
#if defined(SPEKTRUM)
if (spekFrameFlags == 0x01) readSpektrum();
#endif
#if defined(SBUS)
if (spekFrameFlags == 0x01) readSBus();
#endif
#if defined(SUMD)
if (spekFrameFlags == 0x01) readSumD();
#endif
#if defined(SPEKTRUM) || defined(SBUS) || defined(SUMD)
if ((spekFrameDone == 0x01) || ((int16_t)(currentTime-rcTime) >0 )) {
serial.cpp
store_uart_in_buf()
Code: Select all
#if defined(SPEKTRUM) || defined(SBUS) || defined(SUMD)
I hope i did not forget anything.