MPU9250.c
MPU_param_t init_MPU(MODE_t mode) {
	uint32_t freq_div = ((mode == SLOW)?80:4);
	// First init SPI interface on PD0-PD3
	SYSCTL_RCGCSSI_R |= 0x02;
	SYSCTL_RCGCGPIO_R |= 0x08;								// activate port D and then wait for bus
	while((SYSCTL_PRGPIO_R & 0x08) == 0) {};
																						// configure as SSI ports
	GPIO_PORTD_PCTL_R = (GPIO_PORTD_PCTL_R & 0xFFFF00F0) + 0x00002202;
	GPIO_PORTD_AMSEL_R = 0;										// disable analog output
	GPIO_PORTD_AFSEL_R |= 0x0D;								// enable alt function on PD0, 2, 3
	GPIO_PORTD_DEN_R |= 0x0F;									// enable digital ports
	GPIO_PORTD_DIR_R |= 0x02;									// Make PD1 (CS_n) output
	CS_n = CS_H;															// CS_n asserted
	
	SSI1_CR1_R = 0x0;													// disable SSI
	SSI1_CPSR_R = freq_div;										// make SSI bandwidth low 1MHz or high 20MHz
	SSI1_CR0_R = 0x000000C7;									// SPO =1, SPH=1; freescale; 8 bits of data at one time
	SSI1_CR1_R |= 0x00000002;									// enable SSI
	
	MPU_param_t MPU_param;
	preconfig(&MPU_param, TRUE);							// Fast calibrate using preset values, and write preset values to MPU-9250 registers
	set_accel_scale_MPU(&MPU_param, BITS_FS_4G);
	set_gyro_scale_MPU(&MPU_param, BITS_FS_1000DPS);
	
	//whoami_AK8963();
	UART_OutString("Initilization ends\r\n");
	return MPU_param;
}
// Initialize MPU with the given mode, and set up SPI interface

Initialize MPU with the given mode, and set up SPI interface
Initialize MPU with the given mode and set up SPI interface
MPU_param_t init_MPU(MODE_t mode) {
	uint32_t freq_div = ((mode == SLOW)?80:4);
	SYSCTL_RCGCSSI_R |= 0x02;
	SYSCTL_RCGCGPIO_R |= 0x08;								
	while((SYSCTL_PRGPIO_R & 0x08) == 0) {};
	GPIO_PORTD_PCTL_R = (GPIO_PORTD_PCTL_R & 0xFFFF00F0) + 0x00002202;
	GPIO_PORTD_AMSEL_R = 0;										
	GPIO_PORTD_AFSEL_R |= 0x0D;								
	GPIO_PORTD_DEN_R |= 0x0F;									
	GPIO_PORTD_DIR_R |= 0x02;									
	CS_n = CS_H;															
	SSI1_CR1_R = 0x0;													
	SSI1_CPSR_R = freq_div;										
	SSI1_CR0_R = 0x000000C7;									
	SSI1_CR1_R |= 0x00000002;									
	MPU_param_t MPU_param;
	preconfig(&MPU_param, TRUE);							
	set_accel_scale_MPU(&MPU_param, BITS_FS_4G);
	set_gyro_scale_MPU(&MPU_param, BITS_FS_1000DPS);
	UART_OutString("Initilization ends\r\n");
	return MPU_param;
}
MPU_param_t init_MPU ( MODE_t mode ) { uint32_t freq_div = ( ( mode == SLOW ) ? 80 : 4 ) ; SYSCTL_RCGCSSI_R |= 0x02 ; SYSCTL_RCGCGPIO_R |= 0x08 ; while ( ( SYSCTL_PRGPIO_R & 0x08 ) == 0 ) { } ; GPIO_PORTD_PCTL_R = ( GPIO_PORTD_PCTL_R & 0xFFFF00F0 ) + 0x00002202 ; GPIO_PORTD_AMSEL_R = 0 ; GPIO_PORTD_AFSEL_R |= 0x0D ; GPIO_PORTD_DEN_R |= 0x0F ; GPIO_PORTD_DIR_R |= 0x02 ; CS_n = CS_H ; SSI1_CR1_R = 0x0 ; SSI1_CPSR_R = freq_div ; SSI1_CR0_R = 0x000000C7 ; SSI1_CR1_R |= 0x00000002 ; MPU_param_t MPU_param ; preconfig ( & MPU_param , TRUE ) ; set_accel_scale_MPU ( & MPU_param , BITS_FS_4G ) ; set_gyro_scale_MPU ( & MPU_param , BITS_FS_1000DPS ) ; UART_OutString ( " \r \n " ) ; return MPU_param ; }
Initialize MPU with the given mode, and set up SPI interface
Initialize MPU with the given mode and set up SPI interface
// First init SPI interface on PD0-PD3
 // activate port D and then wait for bus
 // configure as SSI ports
 // disable analog output
 // enable alt function on PD0, 2, 3
 // enable digital ports
 // Make PD1 (CS_n) output
 // CS_n asserted
 // disable SSI
 // make SSI bandwidth low 1MHz or high 20MHz
 // SPO =1, SPH=1; freescale; 8 bits of data at one time
 // enable SSI
 // Fast calibrate using preset values, and write preset values to MPU-9250 registers
 //whoami_AK8963();
