Ejemplo n.º 1
0
struct Max31855Data readMax31855Data()
{
	union {
		uint32_t dword;
		struct Max31855Data data;
	} u;
	GPIO_PinClear(p_cs);

	for (int i = 0; i < 32; i++)
	{
		u.dword <<= 1;

		GPIO_PinSet(p_clk); /* Set CLK to sample value */

		WAIT_Waitus(1);

		if ( GPIO_Read(GPIOB) & (1l << (p_miso - 32)) )
			u.dword |= 1; /* Read value from MISO */

		GPIO_PinClear(p_clk); /* Set CLK to shift value */
	}

	GPIO_PinSet(p_cs);

	return u.data;
}
Ejemplo n.º 2
0
void SetLine(uint8_t line)
{		
	GPIO_PinSet(KEYBED_LINE_EN_DIS);					/* turn decoder off (inverted logic) */
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	#ifdef BOARD_EMPHASE_V01_REV_A
		FIO1CLR2 = 0b11110000;		/* reset all 4 pins */
		FIO1SET2 = line << 4;		/* set the encoded line */
	#elif BOARD_PROTOTYPE
		FIO0CLR0 = 0b11110000;		/* reset all 4 pins */
		FIO0SET0 = line << 4;		/* set the encoded line */
	#endif
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	_delay_clk;
	GPIO_PinClr(KEYBED_LINE_EN_DIS);					/* enable decoder ic */
}
Ejemplo n.º 3
0
void initMAX31855()
{
	GPIO_PinInit(p_clk, GPIO_PinOutput);
	GPIO_PinInit(p_cs, GPIO_PinOutput);
	GPIO_PinInit(p_miso, GPIO_PinInput);

	GPIO_PinClear(p_clk);

	GPIO_PinSet(p_cs);
}
Ejemplo n.º 4
0
/**	@brief  	General initialization of the input and output pins. (public)
	@todo		KEYBED_Init(): Pin-Names should be defined in nl_board.h
*******************************************************************************/
void KEYBED_Init(void)
{
	/* output pins for the line decoder */
	GPIO_PinOpt(KEYBED_LINE_A);
	GPIO_PinOpt(KEYBED_LINE_B);
	GPIO_PinOpt(KEYBED_LINE_C);
	GPIO_PinOpt(KEYBED_LINE_D);
	GPIO_PinOpt(KEYBED_LINE_EN_DIS);	// Enable Pin of the Line Decoder

	/* explicite states */
	GPIO_PinClr(KEYBED_LINE_A);
	GPIO_PinClr(KEYBED_LINE_B);
	GPIO_PinClr(KEYBED_LINE_C);
	GPIO_PinClr(KEYBED_LINE_D);
	GPIO_PinSet(KEYBED_LINE_EN_DIS);	// turn decoder off (inverted logic)

	/* input pins for the keys*/
	GPIO_PinIpt(KEYBED_KEY_0);
	GPIO_PinIpt(KEYBED_KEY_1);
	GPIO_PinIpt(KEYBED_KEY_2);
	GPIO_PinIpt(KEYBED_KEY_3);
	GPIO_PinIpt(KEYBED_KEY_4);
	GPIO_PinIpt(KEYBED_KEY_5);
	GPIO_PinIpt(KEYBED_KEY_6);
	GPIO_PinIpt(KEYBED_KEY_7);

	/* no pull ups for the inputs */
	GPIO_PinMod(KEYBED_KEY_0, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_1, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_2, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_3, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_4, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_5, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_6, GPIO_FLOATING);
	GPIO_PinMod(KEYBED_KEY_7, GPIO_FLOATING);

	SetLine(1);
}
Ejemplo n.º 5
0
/**	@brief	With this function the Error Led on the emphase mainboard can be
			turned on. The programm will stay until the Task_Error_Reset button
			is pressed.
*******************************************************************************/
void DEBUG_ErrorLed(void)
{
	GPIO_PinSet(DEBUG_LED_ERROR);
	while (GPIO_PinGet(DEBUG_BUTTON_TASK_ERROR_RESET) == 1);
	GPIO_PinClr(DEBUG_LED_ERROR);
}