Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1152 → Rev 1208

/branches/V0.71i_DSL_X_LED/rcdsl.c
35,6 → 35,49
If you have any questions, feel free to send me an e-mail.
 
Connection of DSL to SV1 of FC:
( DSL Pin1 is on side of channel 4 )
 
1. GND <--> pin 7 (GND)
2. TXD <--> pin 3 (RXD1 Atmega644p)
3. RXD <--> pin 4 (TXD1 Atmega644p) optional
4. 5V <--> pin 2 (5V)
 
Do not connect the receiver via PPM-Sumsignal output the same time.
 
Data are send at 38400baud8n1
 
Data Frame: |0xFF|0xFF|0x1F|FREQALLOC|??|RSSI|VBAT|??|CRC|10|CH0D1|CH0D0|CH1D1|CH1D0|CRC| ...etc
 
FREQALLOC = 35, 40, 72
RSSI = 0.. 255 // Received signal strength indicator
VBAT = 0...255 // supply voltage (0.0V.. 8.2V)
 
Servo Pair: |0x1X|CHXD1|CHXD0|CHX+1D1|CHX+1D0|CRC|
X is channel index of 1 servo value
D1D0 is servo value as u16 in range of 7373 (1ms) to 14745 (2ms)
there are 8 channels submitted, i.e 4 servo pairs
 
 
Frame examples with signel received
 
FFFF 1F23F079A304AD 1036012B1E6F 122AFB2AECB2 142B4D2B4404 1636872B33CE
FFFF 1F23F079A304AD 1036002B1F6F 122AFE2AEBB0 142B4B2B4406 1636872B33CE
FFFF 1F23F079A304AD 1035FF2B226E 122AFC2AEAB3 142B4E2B4304 1636882B33CD
FFFF 1F23F079A304AD 1036022B1E6E 122AFB2AEEB0 142B4A2B4506 1636872B33CE
FFFF 1F23F079A304AD 1036022B1E6E 122AFE2AEBB0 142B4B2B4406 1636882B33CD
FFFF 1F23F079A304AD 1036012B1E6F 122AFD2AEAB2 142B4E2B4403 1636862B33CF
FFFF 1F23F079A304AD 1036032B1D6E 122AFD2AEBB1 142B4C2B4504 1636862B33CF
 
Frame examples with no signal received
 
FFFF 1F23F000A30426
FFFF 1F23F000A30426
FFFF 1F23F000A30426
FFFF 1F23F000A30426
FFFF 1F23F000A30426
FFFF 1F23F000A30426
FFFF 1F23F000A30426
*/
 
#include "rcdsl.h"
49,9 → 92,9
#define UART1_BAUDRATE 38400
 
volatile uint8_t rcdsl_RSSI = 0;
uint8_t rcdsl_battery=0;
uint8_t rcdsl_allocation=0;
uint8_t data[6];
volatile uint8_t rcdsl_battery=0;
volatile uint8_t rcdsl_allocation=0;
volatile uint8_t data[6];
 
typedef union {
uint16_t pos[2];
58,6 → 101,7
uint8_t dat[4];
} servos_t;
 
 
void rcdsl_init(void) {
 
// Save state of status register and disable interrupts
83,6 → 127,8
// Reactive interrupts, if they were active before
SREG = sreg;
 
printf("\n\rUART 1 initialized.");
 
}
 
void rcdsl_new_signal(uint8_t channel, int16_t signal)
89,7 → 135,7
// This function is called, when a new servo signal is properly received.
// Parameters: servo - servo number (0-9)
// signal - servo signal between 7373 (1ms) and 14745 (2ms)
{
{
volatile signed int tmp;
uint8_t index = channel+1; // Der MK fängt bei 1 an zu zählen
132,8 → 178,10
if ((data[0])==0x1F) {
// Get frequency allocation
rcdsl_allocation = data[0+1];
// Get signal quality
// Get signal quality
rcdsl_RSSI = data[2+1];
SenderOkay = (212 * (uint16_t) rcdsl_RSSI) / 128; // have to be scaled approx. by a factor of 1.66 to get 200 at full level
if(SenderOkay > 255) SenderOkay = 255;
// Get voltage of battery supply
rcdsl_battery = data[3+1];
}