Ejemplo n.º 1
0
/* SPI ram test */
uint8_t test2(void)
{
	// VBIT Mux needs setting as SCK is shared
	GPIO_Off(VBIT_SEL);	// Low=AVR, High=VBIT
	xprintf(PSTR("Status=%03d\n\r"),GetSerialRamStatus());	
	char test[40];
	test[0]=0x7f;
	test[1]=0x7e;
	test[2]=0x7d;
	test[3]=0x7c;
	test[4]=0x7b;
	test[5]=0x7a;
	test[6]=0x79;
	test[7]=0x78;
	test[8]=0x77;
	test[9]=0x76;
	test[10]=1;
	SetSerialRamStatus(SPIRAM_MODE_SEQUENTIAL);
	xprintf(PSTR("Status=%03d\n\r"),GetSerialRamStatus());		
	SetSerialRamAddress(SPIRAM_WRITE, 0);
	WriteSerialRam(test, 10);
	DeselectSerialRam();
	test[0]='x';
	test[1]='y';
	test[2]='z';
	test[3]=0;
		SetSerialRamAddress(SPIRAM_READ, 0);
		ReadSerialRam(test,10);
		DeselectSerialRam();
	xputs(PSTR("Test ended Have a Nice Day\n\r"));	
	xprintf(PSTR("\n\r test0=%02X test1=%02X test2=%02X\n\r\n\r"), test[0],test[1],test[2]);
	if (test[0]!=0x7f || test[1]!=0x7e || test [2]!=0x7d)
		return 1; // fail
	return 0; // OK
}
Ejemplo n.º 2
0
void Release_Servo(TIM_TypeDef* TIMx, GPIO_TypeDef* GPIOx, int Pin){
	
	/*Initialize GPIO*/
	struct GPIO_Parameters GPIO;
	GPIO.Pin 	= Pin;
	GPIO.Mode 	= Output;
	GPIO.Speed = High_Speed;
	GPIO.PuPd 	= Pull_Down;
	GPIO_Init(GPIOx,GPIO);
	
	TIMx->CR1 &= ~TIM_CR1_CEN;
	
	 GPIO_Off(GPIOx,6);
}