Exemplo n.º 1
0
void VTable::setFrameNum(int index, int pNum){
	unsigned x = pNum;
	if(ifPresent(index))
		B_SET(x, 31);
	if(ifModified(index))
		B_SET(x, 30);
	if(ifReferenced(index))
		B_SET(x, 29);
	if(ifPageout(index))
		B_SET(x, 28);

	vTable[index] = x;
}
Exemplo n.º 2
0
void ButtonInit()
{
	B_UNSET(BUTTON_PORT_DIR, BUTTON_PIN_BIT);		// set as input
	B_UNSET( BUTTON_PORT_IFG, BUTTON_PIN_BIT);		// IFG cleared
	B_SET( BUTTON_PORT_IES, BUTTON_PIN_BIT);		// high-to-low transition

	char printf_buff[140];
	snprintf(printf_buff, sizeof(printf_buff), "Button released...%s", ICT_TAB_STRING);
	UartXmitString(printf_buff);
	int timeout = 200;
	while( !ButtonState() &&  timeout)
	{
		timeout--;
		delay_ms(1);
	}
	if ( timeout == 0 )
	{
		snprintf(printf_buff, sizeof(printf_buff), "OK\n\r");

	}
	else// button pressed or floating pin
	{
		snprintf(printf_buff, sizeof(printf_buff), "FAIL\n\r");
	}
	UartXmitString(printf_buff);
}
Exemplo n.º 3
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
	}
}
Exemplo n.º 4
0
void SPIStart(void)
{
	B_SET(SPI_MOSI_SEL, SPI_MOSI_BIT);
	B_SET(SPI_MOSI_SEL2, SPI_MOSI_BIT);

	B_SET(SPI_MISO_SEL, SPI_MISO_BIT);
	B_SET(SPI_MISO_SEL2, SPI_MISO_BIT);

	B_SET(SPI_CLK_SEL, SPI_CLK_BIT);
	B_SET(SPI_CLK_SEL2, SPI_CLK_BIT);

	UCB0CTL0 = UCCKPH + UCMSB + UCMST + UCSYNC;  // 3-pin, 8-bit SPI master
	UCB0CTL1 = UCSSEL_2;                     // SMCLK
	UCB0BR0 = 0x01;                          // Fsys
	UCB0BR1 = 0;                              //
	//UCB0MCTL = 0;                             // No modulation
	UCB0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
}
Exemplo n.º 5
0
void VTable::setPresent(int index){
	B_SET(vTable[index], 31);
}
Exemplo n.º 6
0
void VTable::setPageout(int index){
	B_SET(vTable[index], 28);
}
Exemplo n.º 7
0
void VTable::setReferenced(int index){
	B_SET(vTable[index], 29);
}
Exemplo n.º 8
0
void VTable::setModified(int index){
	B_SET(vTable[index], 30);
}
Exemplo n.º 9
0
void ButtonEnableInterrupt()
{
	B_UNSET(BUTTON_PORT_IFG, BUTTON_PIN_BIT);		// clear IFG
	B_SET(BUTTON_PORT_IE, BUTTON_PIN_BIT);			// interrupt enabled
}