AVR Z-LINKŪ


com.h

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00056 #ifndef COM_H
00057 #define COM_H
00058 /*============================ INCLDUE =======================================*/
00059 #include <stdint.h>
00060 #include <stdbool.h>
00061 
00062 #include "compiler.h"
00063 /*============================ MACROS ========================================*/
00064 #define ENABLE_RECEIVER  ( UCSR0B |= ( 1 << RXEN0 ) ) 
00065 #define DISABLE_RECEIVER ( UCSR0B &= ~( 1 << RXEN0 ) ) 
00067 #define ENABLE_TRANSMITTER  ( UCSR0B |= ( 1 << TXEN0 ) ) 
00068 #define DISABLE_TRANSMITTER ( UCSR0B &= ~( 1 << TXEN0 ) ) 
00070 #define ENABLE_RECEIVE_COMPLETE_INTERRUPT  ( UCSR0B |= ( 1 << RXCIE0 ) ) 
00071 #define DISABLE_RECEIVE_COMPLETE_INTERRUPT ( UCSR0B &= ~( 1 << RXCIE0 ) ) 
00073 #define LOW ( 0x00 )
00074 #define XRAM_ENABLE( )     XMCRA |= ( 1 << SRE ); XMCRB |= ( 1 << XMBK )
00075 #define XRAM_DISABLE( )    XMCRA &= ~( 1 << SRE )
00076 
00077 #define FTDI_PORT                       ( PORTE )
00078 #define FTDI_DDR                        ( DDRE )
00079 #define FTDI_PIN                        ( PINE )
00080 #define FTDI_TX_PIN                             ( PINE6 ) //Transmit buffer empty. PE6
00081 #define FTDI_TX_MASK                    ( 1 << FTDI_TX_PIN )
00082 #define FTDI_RX_PIN                             ( PINE7 ) //Receive buffer full. PE7
00083 #define FTDI_FIFO_ADDRESS       ( 0xF000 )
00084 #define FTDI_Fifo ( ( volatile uint8_t * )FTDI_FIFO_ADDRESS )
00085 
00086 #define FTDI_ENABLE_TX( )                                               ( FTDI_DDR &= ~( 1 << FTDI_TX_PIN ) )
00087 #define FTDI_CONFIGURE_PIN_CHANGE_INTERRUPT( )  ( EICRB &= ~( ( 1 << ISC71 ) | ( 1 << ISC70 ) ) )
00088 #define FTDI_ENABLE_RECEIVER( )                                 ( EIMSK |= ( 1 << FTDI_RX_PIN ) )
00089 #define FTDI_DISABLE_RECEIVER( )                                (EIMSK &= ~( 1 << FTDI_RX_PIN ) )
00090 /*============================ TYPEDEFS ======================================*/
00098 typedef enum{
00099   
00100   BR_9600  = 0x33, 
00101   BR_19200 = 0x19, 
00102   BR_38400 = 0x0C  
00103 }baud_rate_t;
00104 /*============================ VARIABLES =====================================*/
00105 /*============================ PROTOTYPES ====================================*/
00106 
00107 void com_init( baud_rate_t rate );
00108 void com_send_string( uint8_t *data, uint8_t data_length );
00109 void com_send_hex( uint8_t nmbr );
00110 uint8_t * com_get_received_data( void );
00111 uint8_t com_get_number_of_received_bytes( void );
00112 void com_reset_receiver( void );
00113 #endif
@DOC_TITLE@
Generated on Wed Jul 25 21:15:49 2007 for AVR2001 Software Programmer's Manual by doxygen 1.4.7