summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/dioutput.h
blob: 1ba6f9d9f818d269402dfe654c6359e9f63a007d (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
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/***************************************************************************

    dioutput.h

    Device Output interfaces.

***************************************************************************/

#pragma once

#ifndef __EMU_H__
#error Dont include this file directly; include emu.h instead.
#endif

#ifndef __DIOUTPUT_H__
#define __DIOUTPUT_H__



//**************************************************************************
//  MACROS
//**************************************************************************

#define MCFG_OUTPUT_INDEX(_index) \
	device_output_interface::set_output_index(*device, _index);

#define MCFG_OUTPUT_NAME(_name) \
	device_output_interface::set_output_name(*device, _name);



//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

// ======================> device_output_interface

class device_output_interface : public device_interface
{
public:
	// construction/destruction
	device_output_interface(const machine_config &mconfig, device_t &device);
	virtual ~device_output_interface();

	static void set_output_index(device_t &device, int index) { dynamic_cast<device_output_interface &>(device).m_output_index = index; }
	static void set_output_name(device_t &device, const char *name) { dynamic_cast<device_output_interface &>(device).m_output_name = name; }

	void set_output_value(int value) const;
	void set_led_value(int value) const;
	void set_lamp_value(int value) const;
	void set_digit_value(int value) const;

protected:
	int m_output_index;
	const char *m_output_name;
};



#endif  /* __DIOUTPUT_H__ */