/*******Test_Module_TYPE == Test_LED END*******/ ///*******Test_Module_TYPE == Test_IMU*******/ void Module_setup(void) { u32 total,free; Modules_Power_Control(ALL_Module,1); USART_INIT(115200,3,ENABLE); //serial port 2 initialize, baud rate 9600 ,enable receive interupt (bluebooth) USART_INIT(9600,2,ENABLE); //Initializes the IMU all modules IMU_INIT(IMU_ALL_IC); GPS_Config(); LED_Init(); if(SD_Init()!= SD_OK){ printf("SD Init failed!\r\n"); } else printf("SD Init OK!\r\n"); exfuns_init(); f_mount(fs[0],"0:",1); if(exf_getfree((u8 *)"0",&total,&free)) { printf("SD Card Fatfs Error!\r\n"); } else{ printf("SD Total Size: %d MB\r\n",total>>10); printf("SD Free Size: %d MB\r\n",free>>10); } }
//TEST IMU void Module_setup_imu(void) { //Open IMU power Modules_Power_Control(IMU_Blue_Power,1); Modules_Power_Control(GPS_Power,1); //Initializes serial port 2 USART_INIT(9600,2,ENABLE); //Initializes the IMU all modules IMU_INIT(IMU_ALL_IC); GPS_Config(); }
/*void Module(void) { //Open Bluetooth power Modules_Power_Control(IMU_Blue_Power,1); //// Modules_Power_Control(Zigbee_Power,1); //// USART_INIT(9600,3,ENABLE); //Initializes serial port 2 USART_INIT(9600,2,ENABLE); } void loop(void) { uint8_t AddSDstr[256],length; // //Receive data from bluetooth length = USART_RECV_DATA_LEN(AddSDstr,2); //send a string to bluetooth USART_Write_LEN("recv data",strlen("recv data"),2); // //send data to bluetooth USART_Write_LEN(AddSDstr,length,2); }*/ ///*******Test_Module_TYPE == Test_IMU END *******/ ///******Test_Module_TYPE == Test_GPS******/ void Module_setup_gps(void) { // // The value of "Print_Port" is 3 in the retarget.h (serial 3 printing) //// //Initialize serial port 3 testing //// Modules_Power_Control(Zigbee_Power,1); //// USART_INIT(9600,3,ENABLE); // // // The value of "Print_Port" is 2 in the retarget.h (Bluetooth printing) // //Initialize serial port 2 testing(blue) // Modules_Power_Control(IMU_Blue_Power,1); USART_INIT(9600,2,ENABLE); // //GPS power on Modules_Power_Control(GPS_Power,1); // //GPS config GPS_Config(); }
int main(void) { //int16_t AccelGyro[6]={0}; delay_init(72); //USART1_Config(); MPU6050_Initialize(); GPS_Config(); printf("\r\n GPS Ready.\r\n"); nmea_decode_test(); //USART3_Config(); /* //Usart1 setup, sending info using printf int16_t AccelGyro[6]={0}; USART1_Config(); GPS_Config(); printf("\r\n GPS Ready.\r\n"); nmea_decode_test(); MPU6050_I2C_Init(); MPU6050_Initialize(); if( MPU6050_TestConnection()== TRUE){ // connection success }else{ // connection failed } MPU6050_GetRawAccelGyro(AccelGyro); */ while(1){ /* tempOut=USART3_getTemp(); printf("temp is: %d\n",tempOut); delay(10000000); */ } }
/*******Test_Module_TYPE == Test_GPS END *******/ ///*********Test_Module_TYPE == Test_SD**************/ void Module_setup_sd(void) { u32 total,free; //open bule power for testing // Modules_Power_Control(Zigbee_Power,1); USART_INIT(115200,3,ENABLE); // //open SD power Modules_Power_Control(SD_Power,1); Modules_Power_Control(IMU_Blue_Power,1); Modules_Power_Control(GPS_Power,1); //Initializes serial port 2 USART_INIT(9600,2,ENABLE); //Initializes the IMU all modules IMU_INIT(IMU_ALL_IC); GPS_Config(); printf("Before SDCARD init\r\n"); // //³õʼ»¯SD¿¨ SD initialize if(SD_Init()!= SD_OK){ printf("SD Init failed!\r\n"); } else printf("SD Init OK!\r\n"); exfuns_init(); f_mount(fs[0],"0:",1); if(exf_getfree((u8 *)"0",&total,&free)) { printf("SD Card Fatfs Error!\r\n"); } else{ printf("SD Total Size: %d MB\r\n",total>>10); printf("SD Free Size: %d MB\r\n",free>>10); } }