Re #3536: cosmetics
This commit is contained in:
@@ -322,10 +322,12 @@ void setupPulsesPXX()
|
|||||||
putPcmHead();
|
putPcmHead();
|
||||||
putPcmByte(g_model.header.modelId[0]);
|
putPcmByte(g_model.header.modelId[0]);
|
||||||
uint8_t flag1 = 0;
|
uint8_t flag1 = 0;
|
||||||
if (moduleFlag[0] == MODULE_BIND)
|
if (moduleFlag[0] == MODULE_BIND) {
|
||||||
flag1 |= (g_eeGeneral.countryCode << 1) | PXX_SEND_BIND;
|
flag1 |= (g_eeGeneral.countryCode << 1) | PXX_SEND_BIND;
|
||||||
else if (moduleFlag[0] == MODULE_RANGECHECK)
|
}
|
||||||
|
else if (moduleFlag[0] == MODULE_RANGECHECK) {
|
||||||
flag1 |= PXX_SEND_RANGECHECK;
|
flag1 |= PXX_SEND_RANGECHECK;
|
||||||
|
}
|
||||||
putPcmByte(flag1); // First byte of flags
|
putPcmByte(flag1); // First byte of flags
|
||||||
putPcmByte(0); // Second byte of flags
|
putPcmByte(0); // Second byte of flags
|
||||||
for (uint8_t i=0; i<8; i+=2) { // First 8 channels only
|
for (uint8_t i=0; i<8; i+=2) { // First 8 channels only
|
||||||
@@ -447,7 +449,9 @@ void DSM2_Init(void)
|
|||||||
UCSR0B = 0 | (0 << RXCIE0) | (0 << TXCIE0) | (0 << UDRIE0) | (0 << RXEN0) | (0 << TXEN0) | (0 << UCSZ02);
|
UCSR0B = 0 | (0 << RXCIE0) | (0 << TXCIE0) | (0 << UDRIE0) | (0 << RXEN0) | (0 << TXEN0) | (0 << UCSZ02);
|
||||||
UCSR0C = 0 | (1 << UCSZ01) | (1 << UCSZ00);
|
UCSR0C = 0 | (1 << UCSZ01) | (1 << UCSZ00);
|
||||||
|
|
||||||
while (UCSR0A & (1 << RXC0)) UDR0; // flush receive buffer
|
while (UCSR0A & (1 << RXC0)) {
|
||||||
|
UDR0; // flush receive buffer
|
||||||
|
}
|
||||||
|
|
||||||
// These should be running right from power up on a FrSky enabled '9X.
|
// These should be running right from power up on a FrSky enabled '9X.
|
||||||
DSM2_EnableTXD(); // enable DSM2 UART transmitter
|
DSM2_EnableTXD(); // enable DSM2 UART transmitter
|
||||||
@@ -479,7 +483,7 @@ void sendByteDsm2(uint8_t b) //max 10changes 0 10 10 10 10 1
|
|||||||
uint8_t len = BITLEN_DSM2; //max val: 9*16 < 256
|
uint8_t len = BITLEN_DSM2; //max val: 9*16 < 256
|
||||||
for (uint8_t i=0; i<=8; i++) { //8Bits + Stop=1
|
for (uint8_t i=0; i<=8; i++) { //8Bits + Stop=1
|
||||||
bool nlev = b & 1; //lsb first
|
bool nlev = b & 1; //lsb first
|
||||||
if (lev == nlev){
|
if (lev == nlev) {
|
||||||
len += BITLEN_DSM2;
|
len += BITLEN_DSM2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -566,7 +570,7 @@ void setupPulsesDSM2()
|
|||||||
static void _send_u8(uint8_t u8)
|
static void _send_u8(uint8_t u8)
|
||||||
{
|
{
|
||||||
#ifdef SIMU
|
#ifdef SIMU
|
||||||
*(pulses2MHzPtr)++=u8;
|
*(pulses2MHzPtr)++ = u8;
|
||||||
#else
|
#else
|
||||||
asm volatile(
|
asm volatile(
|
||||||
" st Z+,%A[u] \n\t"
|
" st Z+,%A[u] \n\t"
|
||||||
@@ -578,10 +582,11 @@ static void _send_u8(uint8_t u8)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _send_u16(uint16_t u16)
|
static void _send_u16(uint16_t u16)
|
||||||
{
|
{
|
||||||
#ifdef SIMU
|
#ifdef SIMU
|
||||||
*(*(uint16_t**)&pulses2MHzWPtr)++=u16;
|
*(*(uint16_t**)&pulses2MHzWPtr)++ = u16;
|
||||||
#else
|
#else
|
||||||
asm volatile(
|
asm volatile(
|
||||||
" st Z+,%A[t0] \n\t"
|
" st Z+,%A[t0] \n\t"
|
||||||
@@ -599,11 +604,11 @@ static void _send_1(uint16_t t0)
|
|||||||
{
|
{
|
||||||
// *(*(uint16_t**)&pulses2MHzPtr)++=t0;
|
// *(*(uint16_t**)&pulses2MHzPtr)++=t0;
|
||||||
_send_u16(t0);
|
_send_u16(t0);
|
||||||
*pulses2MHzWPtr++=CTRL_CNT;
|
*pulses2MHzWPtr++ = CTRL_CNT;
|
||||||
//_send_u8(CTRL_CNT);
|
//_send_u8(CTRL_CNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _send_rep1(uint16_t t0,uint8_t cnt)
|
static void _send_rep1(uint16_t t0, uint8_t cnt)
|
||||||
{
|
{
|
||||||
// *(*(uint16_t**)&pulses2MHzPtr)++=t0;
|
// *(*(uint16_t**)&pulses2MHzPtr)++=t0;
|
||||||
_send_u16(t0);
|
_send_u16(t0);
|
||||||
@@ -652,7 +657,9 @@ void picco_sendB1(bool bit)
|
|||||||
|
|
||||||
void picco_sendBn(uint8_t bits, uint8_t n)
|
void picco_sendBn(uint8_t bits, uint8_t n)
|
||||||
{
|
{
|
||||||
while (n--) picco_sendB1(bits & (1<<n));
|
while (n--) {
|
||||||
|
picco_sendB1(bits & (1<<n));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BITS 10
|
#define BITS 10
|
||||||
@@ -661,7 +668,7 @@ void picco_sendBn(uint8_t bits, uint8_t n)
|
|||||||
NOINLINE uint8_t reduce7u(int16_t v, uint8_t sfr)
|
NOINLINE uint8_t reduce7u(int16_t v, uint8_t sfr)
|
||||||
{
|
{
|
||||||
v += (1<<BITS2);
|
v += (1<<BITS2);
|
||||||
if (v < 0) v=0;
|
if (v < 0) v = 0;
|
||||||
if (v >= (1<<BITS)) v=(1<<BITS)-1;
|
if (v >= (1<<BITS)) v=(1<<BITS)-1;
|
||||||
return v >> sfr;
|
return v >> sfr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user