summaryrefslogtreecommitdiffstats
path: root/source/ct-Bot/include/shift.h
blob: d4a4c24d81f092bbe090146cb28fd6feedc5d42b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * c't-Sim - Robotersimulator fuer den c't-Bot
 * 
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your
 * option) any later version. 
 * This program is distributed in the hope that it will be 
 * useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 * PURPOSE. See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public 
 * License along with this program; if not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307, USA.
 * 
 */

/*! @file 	shift.h
 * @brief 	Routinen zur Ansteuerung der Shift-Register
 * @author 	Benjamin Benz (bbe@heise.de)
 * @date 	20.12.05
*/

#ifndef SHIFT_H_
#define SHIFT_H_


#define SHIFT_LATCH	(1<<1)			/*!< Clock to store Data into shiftregister */

#define SHIFT_REGISTER_DISPLAY	0x04	/*!< Port-Pin for shiftregister latch (display) */
#define SHIFT_REGISTER_LED	0x10	/*!< Port-Pin for shiftregister latch (leds) */
#define SHIFT_REGISTER_ENA	0x08	/*!< Port-Pin for shiftregister latch (enable) */

/*!
 * Initialisert die Shift-Register
 */
void shift_init(void);

/*!
 * Schiebt Daten durch eines der drei 74HC595-Schieberegister
 * Achtung: den Port sollte man danach noch per shift_clear() zuruecksetzen!
 * @param data	Das Datenbyte
 * @param latch_data der Pin, an dem der Daten-latch-Pin des Registers (PIN 11) haengt
 * @param latch_store der Pin, an dem der latch-Pin zum Transfer des Registers (PIN 12) haengt
 */
void shift_data_out(uint8 data, uint8 latch_data, uint8 latch_store);

/*!
 * Schiebt Daten durch eines der drei 74HC595-Schieberegister,
 * vereinfachte Version, braucht kein shift_clear().
 * Funktioniert NICHT fuer das Shift-Register, an dem das Display haengt!!!
 * @param data	Das Datenbyte
 * @param latch_data der Pin, an dem der Daten-latch-Pin des Registers (PIN 11) haengt
 */
void shift_data(uint8 data, uint8 latch_data);

/*!
 * Setzt die Shift-Register wieder zurueck
 */ 
void shift_clear(void);
#endif