summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/pofo_kbd.h
blob: 07762ff6af5ef3b2839d7773bbe915d3d6053549 (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
// license:BSD-3-Clause
// copyright-holders:Jaen Saul
#ifndef MAME_MACHINE_POFO_KBD_H
#define MAME_MACHINE_POFO_KBD_H

#pragma once

#include "machine/keyboard.h"

class pofo_keyboard_device : public device_t, protected device_matrix_keyboard_interface<8U>
{
public:
	pofo_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);

	// callbacks
	auto int_handler() { return m_int_handler.bind(); }

	// from host
	uint8_t read() { return m_data; }

protected:
	void key_make(u8 row, u8 column) override;
	void key_break(u8 row, u8 column) override;

	void device_start() override;
	void device_reset() override;

	ioport_constructor device_input_ports() const override;

private:
	devcb_write_line m_int_handler;
	uint8_t m_data;

	void trigger();
};

DECLARE_DEVICE_TYPE(POFO_KEYBOARD, pofo_keyboard_device);

#endif // MAME_MACHINE_POFO_KBD_H