summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/ticket.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/ticket.h')
-rw-r--r--src/devices/machine/ticket.h40
1 files changed, 8 insertions, 32 deletions
diff --git a/src/devices/machine/ticket.h b/src/devices/machine/ticket.h
index 7330ad3cb74..b4d6d90d623 100644
--- a/src/devices/machine/ticket.h
+++ b/src/devices/machine/ticket.h
@@ -17,21 +17,9 @@
// GLOBAL VARIABLES
//**************************************************************************
-// device type definition
DECLARE_DEVICE_TYPE(TICKET_DISPENSER, ticket_dispenser_device)
DECLARE_DEVICE_TYPE(HOPPER, hopper_device)
-//**************************************************************************
-// CONSTANTS
-//**************************************************************************
-
-const uint8_t TICKET_MOTOR_ACTIVE_LOW = 0; /* Ticket motor is triggered by D7=0 */
-const uint8_t TICKET_MOTOR_ACTIVE_HIGH = 1; /* Ticket motor is triggered by D7=1 */
-
-const uint8_t TICKET_STATUS_ACTIVE_LOW = 0; /* Ticket is done dispensing when D7=0 */
-const uint8_t TICKET_STATUS_ACTIVE_HIGH = 1; /* Ticket is done dispensing when D7=1 */
-
-
//**************************************************************************
// TYPE DEFINITIONS
@@ -43,27 +31,21 @@ class ticket_dispenser_device : public device_t
{
public:
// construction/destruction
- ticket_dispenser_device(const machine_config &mconfig, const char *tag, device_t *owner, const attotime &period, uint8_t motor_sense, uint8_t status_sense)
+ ticket_dispenser_device(const machine_config &mconfig, const char *tag, device_t *owner, const attotime &period)
: ticket_dispenser_device(mconfig, tag, owner)
{
set_period(period);
- set_senses(motor_sense, status_sense, false);
}
ticket_dispenser_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
virtual ~ticket_dispenser_device();
// inline configuration helpers
void set_period(const attotime &period) { m_period = period; }
- void set_senses(uint8_t motor_sense, uint8_t status_sense, bool hopper_type)
- {
- m_motor_sense = motor_sense;
- m_status_sense = status_sense;
- m_hopper_type = hopper_type;
- }
+ auto dispense_handler() { return m_dispense_handler.bind(); }
// read/write handlers
- DECLARE_READ_LINE_MEMBER( line_r );
- DECLARE_WRITE_LINE_MEMBER( motor_w );
+ int line_r();
+ void motor_w(int state);
protected:
ticket_dispenser_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock = 0);
@@ -71,34 +53,28 @@ protected:
// device-level overrides
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
+ TIMER_CALLBACK_MEMBER(update_output_state);
// configuration state
- uint8_t m_motor_sense;
- uint8_t m_status_sense;
attotime m_period;
bool m_hopper_type;
- // active state
- bool m_motoron;
- bool m_ticketdispensed;
- bool m_ticketnotdispensed;
-
bool m_status;
bool m_power;
emu_timer *m_timer;
output_finder<> m_output;
+ devcb_write_line m_dispense_handler;
};
class hopper_device : public ticket_dispenser_device
{
public:
// construction/destruction
- hopper_device(const machine_config &mconfig, const char *tag, device_t *owner, const attotime &period, uint8_t motor_sense, uint8_t status_sense)
+ hopper_device(const machine_config &mconfig, const char *tag, device_t *owner, const attotime &period)
: hopper_device(mconfig, tag, owner)
{
set_period(period);
- set_senses(motor_sense, status_sense, true);
}
hopper_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
};