1 // license:BSD-3-Clause
2 // copyright-holders:hap
3 /*
4 
5   Sanyo LC7582 LCD Driver
6 
7 */
8 
9 #ifndef MAME_VIDEO_LC7582_H
10 #define MAME_VIDEO_LC7582_H
11 
12 #pragma once
13 
14 /*
15 
16 quick pinout reference (64-pin QFP)
17 
18 pin     desc
19 ------------------------------
20 1-54  = S1-S53 segment outputs, pin 24 N/C, pins 45-54 also used with AD/DSP
21 55    = OSC
22 56    = Vdd
23 57    = _INH
24 58    = Vlcd
25 59    = Vss
26 60    = CE   \
27 61    = CLK  | serial input
28 62    = DATA /
29 63,64 = COM1/COM2 outputs
30 
31 */
32 
33 
34 class lc7582_device : public device_t
35 {
36 public:
37 	lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
38 
39 	// configuration helpers
write_segs()40 	auto write_segs() { return m_write_segs.bind(); } // S pins, COM1/COM2 in offset
41 
DECLARE_WRITE_LINE_MEMBER(data_w)42 	DECLARE_WRITE_LINE_MEMBER(data_w) { m_data = (state) ? 1 : 0; }
43 	DECLARE_WRITE_LINE_MEMBER(clk_w);
44 	DECLARE_WRITE_LINE_MEMBER(ce_w);
DECLARE_WRITE_LINE_MEMBER(inh_w)45 	DECLARE_WRITE_LINE_MEMBER(inh_w) { m_blank = bool(state); refresh_output(); }
46 
47 protected:
48 	// device-level overrides
49 	virtual void device_start() override;
50 
51 private:
52 	void refresh_output();
53 
54 	int m_data = 0;
55 	int m_ce = 0;
56 	int m_clk = 0;
57 	bool m_blank = false;
58 
59 	int m_duty = 0;
60 	int m_addsp = 0;
61 	u64 m_shift = 0;
62 	u64 m_latch[2] = { 0, 0 };
63 
64 	// callbacks
65 	devcb_write64 m_write_segs;
66 };
67 
68 
69 DECLARE_DEVICE_TYPE(LC7582, lc7582_device)
70 
71 #endif // MAME_VIDEO_LC7582_H
72