start adapting for xmega
This commit is contained in:
@@ -45,7 +45,6 @@ THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include "yaMBSiavr.h"
|
#include "yaMBSiavr.h"
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#include "aBusIO.h"
|
|
||||||
|
|
||||||
volatile unsigned char BusState = 0;
|
volatile unsigned char BusState = 0;
|
||||||
volatile uint16_t modbusTimer = 0;
|
volatile uint16_t modbusTimer = 0;
|
||||||
@@ -200,6 +199,7 @@ ISR(UART_RECEIVE_INTERRUPT)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO
|
||||||
ISR(UART_TRANSMIT_INTERRUPT)
|
ISR(UART_TRANSMIT_INTERRUPT)
|
||||||
{
|
{
|
||||||
BusState&=~(1<<TransmitRequested);
|
BusState&=~(1<<TransmitRequested);
|
||||||
@@ -219,6 +219,7 @@ ISR(UART_TRANSMIT_COMPLETE_INTERRUPT)
|
|||||||
modbusReset();
|
modbusReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO
|
||||||
void modbusInit(void)
|
void modbusInit(void)
|
||||||
{
|
{
|
||||||
UBRRH = (unsigned char)((UBRR) >> 8);
|
UBRRH = (unsigned char)((UBRR) >> 8);
|
||||||
@@ -242,6 +243,7 @@ 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;
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include "aBusIO.h"
|
|
||||||
/**
|
/**
|
||||||
* @code #include <yaMBSIavr.h> @endcode
|
* @code #include <yaMBSIavr.h> @endcode
|
||||||
*
|
*
|
||||||
@@ -179,7 +178,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define UBRRH UBRR0H
|
#define UBRRH UBRR0H
|
||||||
#define UBRRL UBRR0L
|
#define UBRRL UBRR0L
|
||||||
|
|
||||||
#elif defined(__AVR_ATmega8__)|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) || defined(__AVR_ATmega323__)
|
#elif defined(__AVR_ATmega7__)|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) || defined(__AVR_ATmega323__)
|
||||||
#define UART_TRANSMIT_COMPLETE_INTERRUPT USART_TXC_vect
|
#define UART_TRANSMIT_COMPLETE_INTERRUPT USART_TXC_vect
|
||||||
#define UART_RECEIVE_INTERRUPT USART_RXC_vect
|
#define UART_RECEIVE_INTERRUPT USART_RXC_vect
|
||||||
#define UART_TRANSMIT_INTERRUPT USART_UDRE_vect
|
#define UART_TRANSMIT_INTERRUPT USART_UDRE_vect
|
||||||
@@ -188,6 +187,13 @@ THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define UART_DATA UDR
|
#define UART_DATA UDR
|
||||||
#define UART_UDRIE UDRIE
|
#define UART_UDRIE UDRIE
|
||||||
|
|
||||||
|
#elif defined(__AVR_ATxmega32A4__)
|
||||||
|
#define UART_TRANSMIT_COMPLETE_INTERRUPT USARTD0_TXC_vect
|
||||||
|
#define UART_RECEIVE_INTERRUPT USARTD0_RXC_vect
|
||||||
|
#define UART_TRANSMIT_INTERRUPT USARTD0_DRE_vect
|
||||||
|
#define UART_DATA USARTD0.DATA
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error "no definition available"
|
#error "no definition available"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user