You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

46 lines
1.5 KiB

  1. #ifndef __TARGET_H__
  2. #define __TARGET_H__
  3. /* *********************************************************************** */
  4. /*
  5. * using ATmega328p @16MHz:
  6. * Fuse E: 0x02 (512 words bootloader)
  7. * Fuse H: 0xDC (2.7V BOD)
  8. * Fuse L: 0xFF (external crystal)
  9. */
  10. #define F_CPU 16000000
  11. #define BAUDRATE 38400
  12. #define RFM12_ADDRESS 0x01
  13. #define TIMEOUT 1000
  14. /* 1ms @16MHz */
  15. #define TIMER_RELOAD (0xFF - 250)
  16. #define LED_INIT() DDRD |= (1<<PORTD4)
  17. #define LED_ON() PORTD |= (1<<PORTD4)
  18. #define LED_OFF() PORTD &= ~(1<<PORTD4)
  19. #define LED_TOGGLE() PORTD ^= (1<<PORTD4)
  20. #define UART_RXBUF_SIZE 128
  21. #define UART_TXBUF_SIZE 128
  22. #define RFM12_INT_INIT() EICRA |= (1<<ISC01)
  23. #define RFM12_INT_ON() EIMSK |= (1<<INT0)
  24. #define RFM12_INT_OFF() EIMSK &= ~(1<<INT0)
  25. #define RFM12_INT_CLEAR() EIFR = INTF0
  26. #define RFM12_INT_VECT INT0_vect
  27. #define RFM12_CS_INIT() DDRD |= (1<<PORTD7)
  28. #define RFM12_CS_ACTIVE() PORTD &= ~(1<<PORTD7)
  29. #define RFM12_CS_INACTIVE() PORTD |= (1<<PORTD7)
  30. #define RFM12_SPI_INIT() { /* SS, SCK and MOSI are outputs */ \
  31. DDRB |= (1<<PORTB2) | (1<<PORTB3) | (1<<PORTB5); \
  32. /* SPI Master, F_CPU /16 */ \
  33. SPCR = (1<<SPE) | (1<<MSTR) | (1<<SPR0); \
  34. }
  35. /* *********************************************************************** */
  36. #endif /* __TARGET_H__ */