#ifndef __common_h__ #define __common_h__ // to enable serial-port debugging: //#define DEBUG // to enable MP3 auto-play from FLASH: //#define MP3_FLASH_LOAD //#define MP3_FLASH_LENGTH 32496 // number of bytes // to additionally enable MP3-from-FLASH testing #ifdef MP3_FLASH_LOAD #asm .equ __mp3_flash_addr=0x8000 .equ __mp3_flash_length=32496 .equ __mp3_buf_addr=0x1000 #endasm #endif #ifdef DEBUG #include #endif #define HIGH 1 #define LOW 0 #define TRUE 1 #define FALSE 0 /* Use an 1x16 alphanumeric LCD connected to PORTD as follows: [LCD] [ATmega103] 1 GND- 20 GND 2 +5V- 40 VCC 3 VLC 10k trimpot wiper (trimpot ends go to +5 and gnd) 4 RS - 21 PD0 5 RD - 22 PD1 6 EN - 23 PD2 11 D4 - 25 PD4 12 D5 - 26 PD5 13 D6 - 27 PD6 14 D7 - 28 PD7 */ #asm .equ __lcd_port=0x12 #endasm #include // LCD driver routines void lcd_line2(char flash * p) { lcd_gotoxy(0,1); lcd_putsf(" "); lcd_gotoxy(0,1); lcd_putsf(p); } #ifdef MP3_FLASH_LOAD /* void copy_ram_buffer() { #asm push XL push XH push ZL push ZH push r15 push r16 push r17 push r18 ldi XL, low(__mp3_buf_addr) ldi XH, high(__mp3_buf_addr) ldi ZL, low(__mp3_flash_addr*2) ldi ZH, high(__mp3_flash_addr*2) ldi r15, low(__mp3_flash_length) ldi r16, high(__mp3_flash_length) __copy_ram_buffer_copy_loop: lpm r17,Z lpm r18,Z adiw Z, 2 st r18,X+ st r17,X+ sbi r15, 2 sbci r16, 0 cpi r16, 0 brne __copy_ram_buffer_copy_loop cpi r15, 0 brne __copy_ram_buffer_copy_loop pop r18 pop r17 pop r16 pop r15 pop ZH pop ZL pop XH pop XL #endasm } */ #endif #define BOOL unsigned char #define BYTE unsigned char #define WORD unsigned int #define DWRD unsigned long #endif