ticket: Use output finder (nw)

This commit is contained in:
AJR 2018-05-13 12:07:23 -04:00
parent f565f3bdbb
commit 4eec26e60f
2 changed files with 9 additions and 5 deletions

View File

@ -49,7 +49,8 @@ ticket_dispenser_device::ticket_dispenser_device(const machine_config &mconfig,
m_ticketnotdispensed(0), m_ticketnotdispensed(0),
m_status(0), m_status(0),
m_power(0), m_power(0),
m_timer(nullptr) m_timer(nullptr),
m_output(*this, "led2") // TODO: probably shouldn't be hardcoded
{ {
} }
@ -102,7 +103,7 @@ WRITE_LINE_MEMBER( ticket_dispenser_device::motor_w )
{ {
LOG(("%s: Ticket Power Off\n", machine().describe_context())); LOG(("%s: Ticket Power Off\n", machine().describe_context()));
m_timer->adjust(attotime::never); m_timer->adjust(attotime::never);
machine().output().set_led_value(2, 0); m_output = 0;
} }
m_power = false; m_power = false;
} }
@ -126,6 +127,8 @@ void ticket_dispenser_device::device_start()
m_timer = timer_alloc(); m_timer = timer_alloc();
m_output.resolve();
save_item(NAME(m_status)); save_item(NAME(m_status));
save_item(NAME(m_power)); save_item(NAME(m_power));
} }
@ -160,11 +163,11 @@ void ticket_dispenser_device::device_timer(emu_timer &timer, device_timer_id id,
m_status = !m_status; m_status = !m_status;
LOG(("%s: Ticket Power Off\n", machine().describe_context())); LOG(("%s: Ticket Power Off\n", machine().describe_context()));
m_timer->adjust(attotime::never); m_timer->adjust(attotime::never);
machine().output().set_led_value(2, 0); m_output = 0;
} }
// update LED status (fixme: should map to an output) // update output status
machine().output().set_led_value(2, (m_status == m_ticketdispensed)); m_output = m_status == m_ticketdispensed;
// if we just dispensed, increment global count // if we just dispensed, increment global count
if (m_status == m_ticketdispensed) if (m_status == m_ticketdispensed)

View File

@ -95,6 +95,7 @@ protected:
bool m_status; bool m_status;
bool m_power; bool m_power;
emu_timer *m_timer; emu_timer *m_timer;
output_finder<> m_output;
}; };
#endif // MAME_MACHINE_TICKET_H #endif // MAME_MACHINE_TICKET_H