diff --git a/Multiprotocol/MultiOrange.cpp.xmega b/Multiprotocol/MultiOrange.cpp.xmega index 2a331fa..85a7ca0 100644 --- a/Multiprotocol/MultiOrange.cpp.xmega +++ b/Multiprotocol/MultiOrange.cpp.xmega @@ -17,7 +17,8 @@ static void module_reset(void) ; static void update_led_status(void) ; static void set_rx_tx_addr(uint32_t id) ; uint16_t limit_channel_100(uint8_t ch) ; - +void initTXSerial( uint8_t speed); +void Serial_write(uint8_t data); extern void NRF24L01_Reset(void ) ; extern void A7105_Reset(void ) ; diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 0ded1cb..ec6bdc8 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -628,11 +628,19 @@ void update_serial_data() RX_FLAG_off; //data has been processed do { - cli(); + #ifdef XMEGA + cli(); + #else + UCSR0B &= ~(1< UBRR0H = UBRRH_VALUE; @@ -898,6 +909,7 @@ uint8_t SPI_Read(void) // replacement millis() and micros() // These work polled, no interrupts // micros() MUST be called at least once every 32 milliseconds +#ifndef XMEGA uint16_t MillisPrecount ; uint16_t lastTimerValue ; uint32_t TotalMicros ; @@ -997,6 +1009,7 @@ void init() // this needs to be called before setup() or some functions won't work there sei(); } +#endif //XMEGA /**************************/ /**************************/ @@ -1053,7 +1066,7 @@ ISR(USART_RX_vect) if((USARTC0.STATUS & 0x1C)==0) // Check frame error, data overrun and parity error #else - UCSR0B &= ~(1<=TXBUFFER_SIZE) - tx_head=0; - tx_buff[tx_head]=data; + uint8_t nextHead ; + nextHead = tx_head + 1 ; + if ( nextHead >= TXBUFFER_SIZE ) + nextHead = 0 ; + tx_buff[nextHead]=data; + tx_head = nextHead ; #ifdef XMEGA USARTC0.CTRLA = (USARTC0.CTRLA & 0xFC) | 0x01 ; #else UCSR0B |= (1<