progress on xmega port

master
Eggert Jung 5 years ago
parent 11e93273e6
commit 3056c3fd11

@ -199,7 +199,6 @@ ISR(UART_RECEIVE_INTERRUPT)
} }
} }
//TODO
ISR(UART_TRANSMIT_INTERRUPT) ISR(UART_TRANSMIT_INTERRUPT)
{ {
BusState&=~(1<<TransmitRequested); BusState&=~(1<<TransmitRequested);
@ -207,7 +206,11 @@ ISR(UART_TRANSMIT_INTERRUPT)
UART_DATA=rxbuffer[DataPos]; UART_DATA=rxbuffer[DataPos];
DataPos++; DataPos++;
if (DataPos==(PacketTopIndex+1)) { if (DataPos==(PacketTopIndex+1)) {
#ifndef __AVR_ATxmega32A4__
UART_CONTROL&=~(1<<UART_UDRIE); UART_CONTROL&=~(1<<UART_UDRIE);
#else
USARTD0_CTRLA &= ~(USART_DREINTLVL_gm);
#endif
} }
} }
@ -222,6 +225,7 @@ ISR(UART_TRANSMIT_COMPLETE_INTERRUPT)
//TODO //TODO
void modbusInit(void) void modbusInit(void)
{ {
#ifndef __AVR_ATxmega32A4__
UBRRH = (unsigned char)((UBRR) >> 8); UBRRH = (unsigned char)((UBRR) >> 8);
UBRRL = (unsigned char) UBRR; UBRRL = (unsigned char) UBRR;
UART_STATUS = (1<<U2X); //double speed mode. UART_STATUS = (1<<U2X); //double speed mode.
@ -236,6 +240,13 @@ void modbusInit(void)
transceiver_rxen(); transceiver_rxen();
#endif #endif
BusState=(1<<TimerActive); BusState=(1<<TimerActive);
#elif
//BRR
//RX, TX enable
//Interrupt enable (levels)
//Physical type
//Busstate
#endif
} }
/* @brief: Sends a response. /* @brief: Sends a response.
@ -243,7 +254,6 @@ void modbusInit(void)
* Arguments: - packtop: Position of the last byte containing data. * Arguments: - packtop: Position of the last byte containing data.
* modbusSendException is a good usage example. * modbusSendException is a good usage example.
*/ */
//TODO
void modbusSendMessage(unsigned char packtop) void modbusSendMessage(unsigned char packtop)
{ {
PacketTopIndex=packtop+2; PacketTopIndex=packtop+2;
@ -253,7 +263,13 @@ void modbusSendMessage(unsigned char packtop)
#if PHYSICAL_TYPE == 485 #if PHYSICAL_TYPE == 485
transceiver_txen(); transceiver_txen();
#endif #endif
#ifndef __AVR_ATxmega32A4__
UART_CONTROL|=(1<<UART_UDRIE); UART_CONTROL|=(1<<UART_UDRIE);
#else
USARTD0_CTRLA |= USART_DREINTLVL_HI_gc;
#endif
BusState&=~(1<<ReceiveCompleted); BusState&=~(1<<ReceiveCompleted);
} }

Loading…
Cancel
Save