summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/astrocde/lightpen.h
blob: 49991a2574d71c87ccd3e3672132de099bae939f (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
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
#ifndef MAME_BUS_ASTROCDE_LIGHTPEN_H
#define MAME_BUS_ASTROCDE_LIGHTPEN_H

#pragma once

#include "accessory.h"


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

// ======================> astrocade_lightpen_device

class astrocade_lightpen_device : public device_t,
								  public device_astrocade_accessory_interface
{
public:
	// construction/destruction
	astrocade_lightpen_device(machine_config const &mconfig, char const *tag, device_t *owner, const XTAL &clock = XTAL());
	virtual ~astrocade_lightpen_device();

	DECLARE_INPUT_CHANGED_MEMBER(trigger);

protected:
	// device_t implementation
	virtual void device_start() override;
	virtual void device_reset() override;
	virtual ioport_constructor device_input_ports() const override;

	TIMER_CALLBACK_MEMBER(trigger_tick);

private:
	required_ioport m_trigger;
	required_ioport m_lightx;
	required_ioport m_lighty;
	emu_timer *m_pen_timer;
	bool m_retrigger;
};


/***************************************************************************
 DEVICE TYPES
 ***************************************************************************/

DECLARE_DEVICE_TYPE(ASTROCADE_LIGHTPEN, astrocade_lightpen_device)

#endif // MAME_BUS_ASTROCDE_LIGHTPEN_H