summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/lc7582.h
blob: 3a744395829f66417d00d94393146a3dd235a0f5 (plain) (blame)
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
64
65
66
67
68
69
70
71
// license:BSD-3-Clause
// copyright-holders:hap
/*

  Sanyo LC7582 LCD Driver

*/

#ifndef MAME_VIDEO_LC7582_H
#define MAME_VIDEO_LC7582_H

#pragma once

/*

quick pinout reference (64-pin QFP)

pin     desc
------------------------------
1-54  = S1-S53 segment outputs, pin 24 N/C, pins 45-54 also used with AD/DSP
55    = OSC
56    = Vdd
57    = _INH
58    = Vlcd
59    = Vss
60    = CE   \
61    = CLK  | serial input
62    = DATA /
63,64 = COM1/COM2 outputs

*/


class lc7582_device : public device_t
{
public:
	lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);

	// configuration helpers
	auto write_segs() { return m_write_segs.bind(); } // S pins, COM1/COM2 in offset

	DECLARE_WRITE_LINE_MEMBER(data_w) { m_data = (state) ? 1 : 0; }
	DECLARE_WRITE_LINE_MEMBER(clk_w);
	DECLARE_WRITE_LINE_MEMBER(ce_w);
	DECLARE_WRITE_LINE_MEMBER(inh_w) { m_blank = bool(state); refresh_output(); }

protected:
	// device-level overrides
	virtual void device_start() override;

private:
	void refresh_output();

	int m_data;
	int m_ce;
	int m_clk;
	bool m_blank;

	int m_duty;
	int m_addsp;
	u64 m_shift;
	u64 m_latch[2];

	// callbacks
	devcb_write64 m_write_segs;
};


DECLARE_DEVICE_TYPE(LC7582, lc7582_device)

#endif // MAME_VIDEO_LC7582_H