示例#1
0
文件: ticket.c 项目: Ilgrim/MAMEHub
void ticket_dispenser_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	// if we still have power, keep toggling ticket states
	if (m_power)
	{
		m_status ^= m_active_bit;
		LOG(("Ticket Status Changed to %02X\n", m_status));
		m_timer->adjust(m_period);
	}

	// update LED status (fixme: should map to an output)
	set_led_status(machine(), 2, (m_status == m_ticketdispensed));

	// if we just dispensed, increment global count
	if (m_status == m_ticketdispensed)
	{
		increment_dispensed_tickets(machine(), 1);
		LOG(("Ticket Dispensed\n"));
	}
}
示例#2
0
static TIMER_CALLBACK( ticket_dispenser_toggle )
{
	ticket_state *state = get_safe_token((device_t *)ptr);

	/* If we still have power, keep toggling ticket states. */
	if (state->m_power)
	{
		state->m_status ^= state->m_active_bit;
		LOG(("Ticket Status Changed to %02X\n", state->m_status));
		state->m_timer->adjust(attotime::from_msec(state->m_time_msec));
	}

	if (state->m_status == state->m_ticketdispensed)
	{
		set_led_status(machine, 2,1);
		increment_dispensed_tickets(machine, 1);

		LOG(("Ticket Dispensed\n"));
	}
	else
	{
		set_led_status(machine, 2,0);
	}
}