1 // license:BSD-3-Clause
2 // copyright-holders:hap
3 /*
4 
5   Epson SED1500 series LCD Driver
6 
7 */
8 
9 #ifndef MAME_VIDEO_SED1500_H
10 #define MAME_VIDEO_SED1500_H
11 
12 #pragma once
13 
14 /*
15 
16 pinout reference (brief)
17 
18 OSC: oscillator (resistors or XTAL)
19 A0-A6: address
20 D0-D7: data (I/O)
21 WR/RD: write/read signal
22 CS: chip select
23 SYNC: frame synchronize (I/O)
24 
25 CL: OSC output
26 COM: LCD commons
27 SEG: LCD segments
28 
29 */
30 
31 class sed1500_device : public device_t
32 {
33 public:
34 	sed1500_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
35 
36 	// configuration helpers
write_segs()37 	auto write_segs() { return m_write_segs.bind(); } // common number in offset, segment data in data
38 
39 	void write(offs_t offset, u8 data);
40 	u8 read(offs_t offset);
41 
42 protected:
43 	sed1500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cmax, u8 smax);
44 
45 	// device-level overrides
46 	virtual void device_start() override;
47 	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
48 
49 	emu_timer *m_lcd_timer;
50 
51 	const u8 m_cmax; // number of COL pins
52 	const u8 m_smax; // number of SEG pins
53 	u8 m_mode = 0;
54 	u8 m_cout = 0;
55 	u8 m_ram[0x80];
56 
57 	// callbacks
58 	devcb_write64 m_write_segs;
59 };
60 
61 class sed1501_device : public sed1500_device
62 {
63 public:
64 	sed1501_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
65 };
66 
67 class sed1502_device : public sed1500_device
68 {
69 public:
70 	sed1502_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
71 };
72 
73 class sed1503_device : public sed1500_device
74 {
75 public:
76 	sed1503_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
77 };
78 
79 
80 DECLARE_DEVICE_TYPE(SED1500, sed1500_device)
81 DECLARE_DEVICE_TYPE(SED1501, sed1501_device)
82 DECLARE_DEVICE_TYPE(SED1502, sed1502_device)
83 DECLARE_DEVICE_TYPE(SED1503, sed1503_device)
84 
85 #endif // MAME_VIDEO_SED1500_H
86