Пример #1
0
interrupt(SENSOR_PORT_VECTOR) Sensor_ISR(void)
{
	if (B_IS_SET(MS5607_EOC_IFG, MS5607_EOC_PIN))	//End Of Conversion Interrupt
	{
		B_UNSET(MS5607_EOC_IFG, MS5607_EOC_PIN); 	// clear IFG
		PowerExitLowPower();
	}
}
Пример #2
0
void MS5607WaitEOC(void)
{
	while(!B_IS_SET(MS5607_EOC_IN, MS5607_EOC_PIN))	// PIN low: conversion not over
	{
#ifdef 	SENSOR_EOC_INTERRUPT
		__disable_interrupt();
		B_UNSET(MS5607_EOC_IFG, MS5607_EOC_PIN);
		B_SET(MS5607_EOC_IE, MS5607_EOC_PIN);
		__enable_interrupt();
		PowerEnterLowPower();
		__disable_interrupt();
		B_UNSET(MS5607_EOC_IE, MS5607_EOC_PIN);
		__enable_interrupt();
#else
		__no_operation();
#endif // SENSOR_EOC_INTERRUPT
	}
}
Пример #3
0
bool VTable::ifPageout(int index){
	return B_IS_SET(vTable[index], 28);
}
Пример #4
0
bool VTable::ifReferenced(int index){
	return B_IS_SET(vTable[index], 29);
}
Пример #5
0
bool VTable::ifModified(int index){
	return B_IS_SET(vTable[index], 30);
}
Пример #6
0
bool VTable::ifPresent(int index){
	return B_IS_SET(vTable[index], 31);
}
Пример #7
0
uint8_t Button()
{
	uint8_t button_state = BUTTON_NONE;

	static uint8_t button_last_state = 0;
	static uint8_t button_tempo = 0;
	static int16_t ButtonDoubleTimeout = 0;
	static bool		ButtonDoubleOk = false;

	if(!B_IS_SET(BUTTON_PORT_IN, BUTTON_PIN_BIT))
	{

		if((ButtonDoubleTimeout <= 0)||(ButtonDoubleTimeout == BUTTON_DOUBLE_TIMEOUT))
		{
			ButtonDoubleTimeout = BUTTON_DOUBLE_TIMEOUT;
		}
		else
		{
			ButtonDoubleOk = true;
		}
		button_tempo++;
		if (button_tempo >= BUTTON_LONG_TIMEOUT)
		{
			button_state = BUTTON_LONG;
			ButtonDoubleTimeout = -1;
			button_last_state = button_state;
		}
		else
			button_state = BUTTON_PRESSED;


	}
	else if (ButtonDoubleOk)
	{
		ButtonDoubleOk = false;
		ButtonDoubleTimeout = -1;
		button_state = BUTTON_DOUBLE;
	}
	else
	{
		if (ButtonDoubleTimeout >= 0 )
		{
			ButtonDoubleTimeout--;
		}
		if (ButtonDoubleTimeout == 0)
		{
			button_state = BUTTON_SHORT;
			ButtonDoubleTimeout = -1;
		}
		button_tempo = 0;
	}

#ifdef DEBUG_BUTTON
	char printf_buff[30];
	char printf_len = 0;
	if(button_state == BUTTON_SHORT)
	{
		printf_len += snprintf(printf_buff+printf_len, sizeof(printf_buff)-printf_len, "Button short\n\r");
		UartXmitString(printf_buff);
	}
	else if(button_state == BUTTON_DOUBLE)
	{
		printf_len += snprintf(printf_buff+printf_len, sizeof(printf_buff)-printf_len, "Button double\n\r");
	UartXmitString(printf_buff);
}
	else if(button_state == BUTTON_LONG)
	{
		printf_len += snprintf(printf_buff+printf_len, sizeof(printf_buff)-printf_len, "Button long\n\r");
	UartXmitString(printf_buff);
}
#endif //DEBUG_BUTTON
	return button_state;
}
Пример #8
0
uint8_t ButtonState()
{
	return !B_IS_SET(BUTTON_PORT_IN, BUTTON_PIN_BIT);
}