98 lines
4.0 KiB
C
98 lines
4.0 KiB
C
#ifndef HARDWARE_H
|
||
#define HARDWARE_H
|
||
/*================================================================================================
|
||
|
||
hardware.h SiWiCom copyright 2006 v1.0 (2006-05-04)
|
||
|
||
Name: Joakim Nilsson E-mail: mail@jopin.se
|
||
Name: Christoffer Martinsson E-mail: cm@cmtec.se
|
||
|
||
Description: Pin and port definitions of Atmel ATMega48 in project SiWiCom
|
||
|
||
================================================================================================*/
|
||
/*===============================================================================================
|
||
Definition of CPU speed (needed for delay routine)
|
||
================================================================================================*/
|
||
#define F_CPU 1000000UL
|
||
|
||
/*===============================================================================================
|
||
Definition of SPI routines
|
||
================================================================================================*/
|
||
#define SPI_PORT PORTB // PORTB as SPI-port
|
||
#define SPI_PIN PINB
|
||
#define SPI_DDR DDRB // DDRB as direction for SPI pindirection
|
||
|
||
#define MOSI PB3 // Master Out - Slave In
|
||
#define MISO PB4 // Master In - Slave Out
|
||
#define SCK PB5 // Serial Clock
|
||
#define SS PB2 // Slave select
|
||
/*SPI-master or SPI-slave config*/
|
||
#define _SPI_MASTER_
|
||
//#define _SPI_SLAVE_
|
||
|
||
/*Chip select configuration*/
|
||
#define SPI_CS0_PORT PORTB //CS0 on portB
|
||
#define SPI_CS0_DDR DDRB
|
||
#define SPI_CS0 PB2
|
||
|
||
/*===============================================================================================
|
||
Definition of output pins for LED´s
|
||
================================================================================================*/
|
||
#define LED2 PD7 //Green
|
||
#define LED3 PD6 //Yellow1
|
||
#define LED4 PD5 //Red
|
||
#define LED5 PD4 //Yellow2
|
||
#define LED_PORT PORTD //LED-port = PORT D
|
||
#define LED_DDR DDRD //LED-direction = DDRD
|
||
/*================================================================================================
|
||
Definition of testpoints
|
||
================================================================================================*/
|
||
#define TP1 ADC6 // Only A/D-converter input
|
||
#define TP2 ADC7 // Only A/D-converter input
|
||
#define TP3 PB1
|
||
|
||
/*================================================================================================
|
||
Definition of input pins via dipswitch S1
|
||
================================================================================================*/
|
||
#define SW1 PC2
|
||
#define SW2 PC3
|
||
#define SW3 PC4
|
||
#define SW4 PC5
|
||
#define SW_PORT PORTC
|
||
#define SW_DDR DDRC
|
||
#define SW_PIN PINC //To read pin status when using pullup
|
||
|
||
/*================================================================================================
|
||
Definition of UART port
|
||
================================================================================================*/
|
||
#define USART_RX PD0
|
||
#define USART_TX PD1
|
||
#define USART_DDR DDRD
|
||
#define USART_PORT PORTD
|
||
/*================================================================================================
|
||
Definition for USB routines
|
||
================================================================================================*/
|
||
#define USB_ACTIVE PD2
|
||
#define USB_ACTIVE_PIN PIND
|
||
/*================================================================================================
|
||
Definition of CC1100 routines
|
||
================================================================================================*/
|
||
#define GDO0 PC1
|
||
#define GDO0_PORT PORTC
|
||
#define GDO0_DDR DDRC
|
||
#define GDO0_PIN PINC
|
||
|
||
#define GDO2 PD3
|
||
#define GDO2_PORT PORTD
|
||
#define GDO2_DDR DDRD
|
||
#define GDO2_PIN PIND
|
||
|
||
#define CS_CC1100 SPI_CS0_NR
|
||
/*================================================================================================
|
||
End
|
||
================================================================================================*/
|
||
#endif // HARDWARE_H
|
||
|
||
|
||
|