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.
 
 

54 lines
1.8 KiB

  1. #ifndef __TARGET_H__
  2. #define __TARGET_H__
  3. /* *********************************************************************** */
  4. #if defined(CONFIG_funkstuff168)
  5. /*
  6. * using ATmega168 @16MHz:
  7. * Fuse E: 0xFA (512 words bootloader)
  8. * Fuse H: 0xDD (2.7V BOD)
  9. * Fuse L: 0xFF (external crystal)
  10. */
  11. #define F_CPU 16000000
  12. #define RFM12_ADDRESS 0x11
  13. #define TIMEOUT 1000
  14. /* 1ms @16MHz */
  15. #define TIMER_RELOAD (0xFF - 250)
  16. #define VERSION_STRING "FUNKBOOTm168v1.0"
  17. #define SIGNATURE_BYTES 0x1E, 0x94, 0x06
  18. #define LED_INIT() { DDRD |= ((1<<PORTD5) | (1<<PORTD6)); LED_OFF(); }
  19. #define LED_GN_ON() PORTD &= ~(1<<PORTD5)
  20. #define LED_GN_OFF() PORTD |= (1<<PORTD5)
  21. #define LED_GN_TOGGLE() PORTD ^= (1<<PORTD5)
  22. #define LED_RT_ON() PORTD &= ~(1<<PORTD6)
  23. #define LED_RT_OFF() PORTD |= (1<<PORTD6)
  24. #define LED_OFF() PORTD |= ((1<<PORTD5) | (1<<PORTD6))
  25. #define RFM12_INT_INIT() EICRA |= (1<<ISC11)
  26. #define RFM12_INT_ON() EIMSK |= (1<<INT1)
  27. #define RFM12_INT_OFF() EIMSK &= ~(1<<INT1)
  28. #define RFM12_INT_CLEAR() EIFR = INTF1
  29. #define RFM12_INT_VECT INT1_vect
  30. #define RFM12_CS_INIT() DDRD |= (1<<PORTD7)
  31. #define RFM12_CS_ACTIVE() PORTD &= ~(1<<PORTD7)
  32. #define RFM12_CS_INACTIVE() PORTD |= (1<<PORTD7)
  33. #define RFM12_SPI_INIT() { /* SS, SCK and MOSI are outputs */ \
  34. DDRB |= (1<<PORTB2) | (1<<PORTB3) | (1<<PORTB5); \
  35. /* SPI Master, F_CPU /16 */ \
  36. SPCR = (1<<SPE) | (1<<MSTR) | (1<<SPR0); \
  37. }
  38. /* *********************************************************************** */
  39. #else
  40. #error "unknown CONFIG"
  41. #endif
  42. /* *********************************************************************** */
  43. #endif /* __TARGET_H__ */