#include "digirule1.h"

///////////////////////////////////////////////////////////////////////////////
// public functions

void mode_shift_reg_init( void )
{
	all_leds_set( 0 );
}

void mode_shift_reg_process( void )
{
	if( button.a.pressed )		// data
		A_LED ^= 1;
	
	else if( button.gate_select.pressed )		// shift
	{
		XNOR_LED = NAND_LED;
		NAND_LED = NOR_LED;
		NOR_LED  = XOR_LED;
		XOR_LED  = AND_LED;
		AND_LED  = OR_LED;
		OR_LED   = NOT_LED;
		NOT_LED  = A_LED;
	}
	else if( button.b.pressed )		// clear
	{
		NOT_LED  = 0;
		OR_LED   = 0;
		AND_LED  = 0;
		XOR_LED  = 0;
		NOR_LED  = 0;
		NAND_LED = 0;
		XNOR_LED = 0;
	}
}
