I'm trying to make a driver for the xmega256 and m644 in ref. to SPI. The code below is in SPI.c, and their proto's. are in SPI.h, but it won't compile. What am i doin wrong?? MCU = xmega in makefile.
The error is for the spi.h -- " macro names must be identifiers "
thanks in advance
SPI.C
#ifdef ( atxmega256a3 ) void init_spiC( void ) { PORTC_DIRSET = 0xBE; //PORTD_DIRCLR = 0x10; //PORTC.PIN0CTRL = 0x30; PORTC_OUTSET = 0x1E; //PORTB |= (1<<4); SPIC_CTRL = 0x50; //Enable, mstr and ... //SPIC_STATUS = 0x00; //... Fclk/4 ( if Fclk = 2MHz ) } uint8_t spiC_wrt( uint8_t b ) { SPIC_DATA = b; while( !spic_done ); return SPIC_DATA; } #else void init_spi( void ) { // set_led; //sets a bit ( bit 6 ) DDRB = 0xBC; PORTB = 0x1E; //PORTB |= (1<<4); SPCR = 0x50; //Enable, mstr and ... SPSR = 0x01; //... Fclk/32. /* SPCR = 0x40; SPSR = 0x00; SPCR = 0x50; */ } uint8_t spi_wrt( uint8_t b ) { SPDR = b; while( !(SPSR & 0x80) ); return SPDR; } #endif
SPI.h
#ifdef ( atxmega256a3 ) void init_spiC( void ); uint8_t spiC_wrt( uint8_t b ); #else void init_spi( void ); uint8_t spi_wrt( uint8_t ); #endif