Пример #1
0
static void lock_and_outhole_monitor (void)
{
	/* Wait for balls to settle/amode to start before emptying
	 * locks/outhole */
	task_sleep_sec (3);
	while (!in_live_game)
	{
		if (switch_poll (SW_LOCK_LOWER))
		{
			device_request_kick (device_entry (DEVNO_LOCK));
		}

		if (switch_poll (SW_OUTHOLE))
		{
			sol_request (SOL_OUTHOLE);
		}
		if (!switch_poll (SW_AUTOFIRE2))
		{
			callset_invoke (clear_autofire);	
		}
		/* Wait for the balls to be cleared before starting again */
		task_sleep_sec (3);
	}
	task_exit ();
}
Пример #2
0
/**
 * Wait for a button to be pressed and released.
 */
extern inline void wait_for_button (const U8 swno)
{
	/* TODO - why is this not done in native mode? */
#ifndef CONFIG_NO_ACCEPT
#ifndef CONFIG_NATIVE
	while (!switch_poll (swno))
		task_sleep (TIME_66MS);

	while (switch_poll (swno))
		task_sleep (TIME_66MS);
#endif
#else
	task_sleep (TIME_500MS);
#endif
}
Пример #3
0
void io_task
   (
      uint_32 initial_data
   )
{
    
    puts("*****************************\n");
    puts("IO Task running\n");

    io_init();

    /* Run in 100ms loop to read buttons state  */
    while(1)
    {
    
       /* IO Task is running, wait for timeout */
        _time_delay(100);
    
        switch_poll();
        
        /* blink by LED1 to signalize io_task is running */
        if(timeout == 0) {
            timeout = 1;
            ioctl(file_leds, GPIO_IOCTL_WRITE_LOG1, NULL);
        }
        else {
            timeout = 0;
            ioctl(file_leds, GPIO_IOCTL_WRITE_LOG0, NULL);
        } 
    }
}
Пример #4
0
CALLSET_ENTRY (plunger, sw_launch_button)
{
#ifdef INCLUDE_AUTOPLUNGER
    if (switch_poll (MACHINE_SHOOTER_SWITCH))
    {
        sol_request_async (MACHINE_LAUNCH_SOLENOID);
    }
#endif
}
Пример #5
0
void debug_shell (void)
{
	shell_cursor = 0;
	for (;;)
	{
		if (switch_poll (SW_ESCAPE))
		{
			if (shell_cursor == shell_cmd)
			{
			}
			else
			{
				--shell_cursor;
			}
			shell_button_finish ();
		}
		else if (switch_poll (SW_UP))
		{
			shell_cmd[shell_cursor]++;
			shell_button_finish ();
		}
		else if (switch_poll (SW_DOWN))
		{
			shell_cmd[shell_cursor]--;
			shell_button_finish ();
		}
		else if (switch_poll (SW_ENTER))
		{
			if (shell_ctx[shell_cursor].exec)
			{
			}
			else
			{
				shell_cursor++;
			}
			shell_button_finish ();
		}
		else
		{
			switch_periodic ();
			task_runs_long ();
		}
	}
}
Пример #6
0
void print_header (void)
{
	if (print_header_needed == FALSE)
		return;

	print_header_needed = FALSE;
	printer_pageno++;

	/**
	 * Just before printing the page header, see if the PAUSE EVERY PAGE
	 * setting is on.  If so, the user must press Enter before the page
	 * is written.  This would be for printers that need paper manually fed
	 * into them.
	 */
	if (printer_config.pause_every_page == YES)
	{
		dmd_alloc_low_clean ();
		font_render_string_center (&font_mono5, 64, 11, "PRESS ENTER");
		font_render_string_center (&font_mono5, 64, 21, "FOR NEXT PAGE");
		dmd_show_low ();

		while (!switch_poll (SW_ENTER))
			task_sleep (TIME_66MS);
		while (switch_poll (SW_ENTER))
			task_sleep (TIME_66MS);
	}

	/* Print the actual page header.
	 * Note that we do not use sprintf() here, as that has been
	 * seen to cause stack overflows.  We opt for a much simpler
	 * approach whereby the tilde character is substituted with
	 * the real page number.  This limits reports to 9 pages.
	 * The proper solution would be to use fork a separate
	 * task to work around the stack size limitation.
	 */
	print_string (printout_name);
	print_line_right ("PAGE ~");
	print_nl ();
}
Пример #7
0
void logic_sync_lamps(void) {
    logic_brake(switch_poll(SWITCH_BRAKE));
    logic_lturn(switch_poll(SWITCH_LTURN));
    logic_rturn(switch_poll(SWITCH_RTURN));
    logic_headlamp(switch_poll(SWITCH_HEADLAMP));
    logic_highbeam(switch_poll(SWITCH_HIGHBEAM));
    logic_reverse(switch_poll(SWITCH_REVERSE));
}
Пример #8
0
/**
 * Debounce a button press, waiting for it to clear.
 */
U8 button_check (U8 sw)
{
	volatile U16 x;

	if (!switch_poll (sw))
		return 0;

	for (x=bpt_debounce_timer; x ; --x)
	{
		task_runs_long ();
		barrier ();
	}
	switch_periodic ();
	if (!switch_poll (sw))
	{
		bpt_repeat_count = 0;
		bpt_debounce_timer = 0x1C00;
		return 1;
	}
	else
	{
		bpt_repeat_count++;
		if (bpt_repeat_count >= 32)
		{
			bpt_repeat_count = 32;
			bpt_debounce_timer = 0x80;
			return 8;
		}
		else if (bpt_repeat_count >= 4)
		{
			bpt_debounce_timer = 0x600;
			return 4;
		}
		else
			return 1;
	}
}
Пример #9
0
/**
 * Do a DMD transition.
 *
 * Transitions are complicated because the old/new images may have
 * different color depths (mono or 4-color).  Also, we can only map
 * two pages at a time, but there may be up to 4 different pages
 * involved.
 *
 * First, we check to see if both old and new images are mono.  If so,
 * then the transition can be optimized slightly.
 *
 * For debugging transitions, define STEP_TRANSITION.  The transition
 * will take place one frame at a time; use the launch button to
 * step through each frame.
 */
void dmd_do_transition (void)
{
	const U8 new_dark_page = dmd_low_page;
	const U8 new_bright_page = dmd_high_page;

	dmd_trans_data_ptr = NULL;
	dmd_trans_data_ptr2 = NULL;

	page_push (TRANS_PAGE);

	if (dmd_transition->composite_init)
	{
		(*dmd_transition->composite_init) ();
		dmd_trans_data_ptr2 = dmd_trans_data_ptr;
	}

	while (dmd_in_transition)
	{
#if defined(STEP_TRANSITION) && defined(MACHINE_LAUNCH_SWITCH)
		while (!switch_poll (MACHINE_LAUNCH_SWITCH))
			task_sleep (TIME_33MS);
		task_sleep (TIME_100MS);
		while (switch_poll (MACHINE_LAUNCH_SWITCH))
			task_sleep (TIME_33MS);
#else
		task_sleep (dmd_transition->delay);
#endif

		do {
			dmd_composite_page = dmd_alloc ();
		} while ((dmd_composite_page == (new_dark_page & ~1)) ||
			(dmd_composite_page == (new_bright_page & ~1)));

		/* Handle the transition of the dark page first.
		 * Use the lower composite pair page. */
		pinio_dmd_window_set (PINIO_DMD_WINDOW_1, dmd_composite_page);
		dmd_do_transition_cycle (dmd_dark_page, new_dark_page);

		/* Handle the transition of the bright page.
		 * Use the upper composite pair page (+1). */
		{
			U8 *tmp_trans_data_ptr;

			tmp_trans_data_ptr = dmd_trans_data_ptr;
			dmd_trans_data_ptr = dmd_trans_data_ptr2;

			pinio_dmd_window_set (PINIO_DMD_WINDOW_1, dmd_composite_page+1);
			dmd_do_transition_cycle (dmd_bright_page, new_bright_page);

			dmd_trans_data_ptr2 = dmd_trans_data_ptr;
			dmd_trans_data_ptr = tmp_trans_data_ptr;
		}

		/* Make the composite pages visible */
		dmd_dark_page = dmd_composite_page;
		dmd_bright_page = dmd_composite_page+1;
	}

	page_pop ();
	dmd_transition = NULL;
}
Пример #10
0
/** Return TRUE if the given switch is ACTIVE.  This takes into
 * account whether or not the switch is an opto. */
bool switch_poll_logical (const switchnum_t sw)
{
	return switch_poll (sw) ^ switch_is_opto (sw);
}