Beispiel #1
0
void ADIS_Reset() {
    uint32_t a = 100000;
    ADIS_RESET_WRITE(Bit_RESET);
    while (a) a--;
    ADIS_RESET_WRITE(Bit_SET);
}
Beispiel #2
0
void GPIO_Configuration(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;
	
	// PA1 - MIC
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
	GPIO_InitStructure.GPIO_Speed = 0;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; // analog input
	GPIO_Init (GPIOA, &GPIO_InitStructure);

	// PA0 - WAKEUP button
	GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_0;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(GPIOA, &GPIO_InitStructure);

	// PA3 - ADIS reset, PA4 - nRF Chip Select 
	GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_3 | GPIO_Pin_4;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(GPIOA, &GPIO_InitStructure);


	// PB2 - LCD_DC, PB10 - ADIS_CS
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_10;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // output push-pull
	GPIO_Init(GPIOB, &GPIO_InitStructure);

	// PB5 - SENS_INT
	GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_5;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; // input pull-down
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(GPIOB, &GPIO_InitStructure);

	// PC12 - LED, PC7 - LCD_RES, PC8 - nRF CE, PC10 - LCD_E
	GPIO_WriteBit(GPIOC,GPIO_Pin_12,Bit_SET);
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_10;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // output push-pull
	GPIO_Init(GPIOC, &GPIO_InitStructure);

	// PC13 - TAMP button, PC6 -Joy Center, PC9 - nRF IRQ
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_6 | GPIO_Pin_9;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; // input floating
	GPIO_Init(GPIOC, &GPIO_InitStructure);

	// PC5 - Joystick
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
	GPIO_InitStructure.GPIO_Speed = 0;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; // analog input
	GPIO_Init (GPIOC, &GPIO_InitStructure);

	// Configure USB pull-up pin
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
	GPIO_Init(GPIOC, &GPIO_InitStructure);

	NRF_CS_WRITE(Bit_SET);
	NRF_CE_WRITE(Bit_RESET);

	ADIS_CS_WRITE(Bit_SET);
	ADIS_RESET_WRITE(Bit_SET);
}