blob: 0cd585f740745a4a3a4fccaddd1503253919e3ac (
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
|
#ifndef SEG7_H
#define SEG7_H
#ifdef WITH_GUI
#include <SDL.h>
#endif
#include <stdint.h>
#include <stdbool.h>
// VIA connected on PORTA to 3 wires leading to the 3 coupled 74HC595
// shift register which enable the ROM address lines to read the LED
// segment data (cells 0-15 contain the encoded 7 segments of 16 hexdigits)
//
// PORTA connected as follows:
// xxxxx111
// +--- SER
// +---- RCLK
// +----- SRCLK
enum {
PORTA = 0x6001,
DDRA = 0x6003,
SER = 0x01,
RCLK = 0x02,
SRCLK = 0x04
};
typedef struct seg7_t
{
uint8_t ddr;
uint16_t shift;
uint16_t latch;
bool debug;
} seg7_t;
void seg7_init( seg7_t *seg );
uint8_t seg7_read( seg7_t *seg, uint16_t addr );
void seg7_write( seg7_t *seg, uint16_t addr, uint8_t data );
#endif
|