/* File:	funkset.h	
 * Project:	Funkset Ansteuerung
 * 		http://www.thomaskropf.at/funkset.php
 * Version:	1.0
 * Date:	Sun Feb 18 02:55:08 CET 2007
 * uC:		AVR ATMega16 @ 14.7456 MHz
 *
 * Author:	Thomas Kropf
 * 		http://www.thomaskropf.at
 * 		uC@thomaskropf.at
 *
 *
 *       LP801B
 *    --------------
 * 1 -|A0       VDD|- 18
 * 2 -|A1      DOUT|- 17
 * 3 -|A2      OSC2|- 16
 * 4 -|A3      OSC1|- 15
 * 5 -|A4        TE|- 14
 * 6 -|A5        D0|- 13
 * 7 -|A6        D1|- 12
 * 8 -|A7        D2|- 11
 * 9 -|GND       D3|- 10
 *    --------------
 *
 *    Pin Assignment:
 *
 *	PIN0 = A5
 *	PIN1 = A6
 *	PIN2 = A7
 *
 *	PIN3 = D0
 *	PIN4 = D1
 *	PIN5 = D2
 *	PIN6 = D3
 *
 *	PIN7 = TE
 *
 * A0 - A4 are also very important. This source code
 * does not care about those pins. On the original PCB
 * you had to choose a code via dip switches. Now either you
 * put similiar dip switches on your new PCB (which I didn't)
 * or you just hardwire them to VCC or GND. But don't forget
 * to randomly pick a combination and use the same one on
 * all sockets!
 *
 */



#ifndef _FUNKSET_H
#define _FUNKSET_H

#include <avr/io.h>

/* defines the port to which you attached the address and data pins */
#define FS_PORT PORTC
#define FS_DDR DDRC

/* defines the time how long you want to send (i.e. enable TE pin) the data */
#define FS_SEND_TIME 5

/* enable actually sets the pin to logic 0 */
#define FS_ENABLE_TE() FS_PORT &= ~(1 << 7)
#define FS_DISABLE_TE() FS_PORT |= (1 << 7)


void fs_turn_on_A(void);
void fs_turn_on_B(void);
void fs_turn_on_C(void);
void fs_turn_on_D(void);
void fs_turn_on_E(void);

void fs_turn_off_A(void);
void fs_turn_off_B(void);
void fs_turn_off_C(void);
void fs_turn_off_D(void);
void fs_turn_off_E(void);

void busywait(uint8_t limit);


#endif
