#include "mcu.h"
#include "key.h"
#include "dipsw.h"

static int Count = 0;

void INT8_31_Handler(void)
{
	if((FM3_INTREQ->IRQ05MON & ((1 << 12) >> 8))
	|| (FM3_INTREQ->IRQ05MON & ((1 << 13) >> 8))
	|| (FM3_INTREQ->IRQ05MON & ((1 << 14) >> 8))
	|| (FM3_INTREQ->IRQ05MON & ((1 << 15) >> 8)))
	{

		if(FM3_GPIO->PDIR7_f.PD == 0) Count++;
		if(FM3_GPIO->PDIRF_f.P0 == 0) Count = get_dipsw();
		if(FM3_GPIO->PDIRF_f.P1 == 1) Count = 0xFF;
		if(FM3_GPIO->PDIRF_f.P2 == 1) Count--;
		led7seg_disp(Count);

		//外部割込み要因クリア
		FM3_EXTI->EICL_f.ECL12 = 0;
		FM3_EXTI->EICL_f.ECL13 = 0;
		FM3_EXTI->EICL_f.ECL14 = 0;
		FM3_EXTI->EICL_f.ECL15 = 0;

	}
	return;
}

