/*====================================================================================================*/ void System_Init( void ) { /* System Setup */ SystemInit(); /* Device Config */ GPIO_Config(); RS232_Config(); Sensor_Config(); LED_R = LED_ON; Sensor_Init(); AHRS_Init(&NumQ, &AngE); LED_R = LED_OFF; }
void SoftwareInit() { // // initialization BlueBird parameters for communication protocol. // InitParams(); ITG3200Init(); #ifdef USE_BMA180_INTERRUPT BMA180Init(); #endif MAG3110Init(); // // Set the priorities of the interrupts. // The following interrupts are used // (listed in priority from highest to lowest): // // QEI-ROLL - The input from the quadrature encoder. // // QEI-PITCH - The input from the quadrature encoder. // // PWM0 - The periodic control loop for the application. // // PWM1 - The periodic control loop for the application. // // UART0 - The UART <-> BBGCS. This must be the same // priority as the PAYLOAD interrupt in order to provide the // required mutual exclusion between the two. // // UART1 - The UART <-> PAYLOAD. This must be the same // priority as the BBGCS interrupt in order to provide the // required mutual exclusion between the two. // // // Set the priorities of the interrupts used by the application. // // // Enable the peripherals used by this example. // IntPrioritySet(INT_I2C0, 0x00); IntPrioritySet(INT_GPIOA, 0x02); IntPrioritySet(INT_GPIOE, 0x40); IntPrioritySet(QEI_PITCH_PHA_INT, 0x60); IntPrioritySet(QEI_ROLL_PHA_INT, 0x60); IntPrioritySet(INT_PWM0, 0x80); IntPrioritySet(INT_PWM1, 0x80); IntPrioritySet(INT_UART0, 0xA0); IntPrioritySet(INT_UART1, 0xA0); // // PITCH_MOTOR is PORTB & J6- PITCH Encoder // // moves gimbal to extreme right and down MotorBrakePositionClean(PITCH_MOTOR); //GeneralPitchRoll(PITCH_MOTOR,A3906_FORWARD,500); //EncoderInitReset(QEI0_BASE,PITCH_MOTOR,A3906_REVERSE); // J6 PITCH Encoder //EncoderInitReset(QEI0_BASE,PITCH_MOTOR,A3906_FORWARD); // J6 PITCH Encoder //EncoderInitReset(QEI0_BASE,PITCH_MOTOR,A3906_REVERSE); // J6 PITCH Encoder // // ROLL_MOTOR is PORTA & J8- ROLL Encoder // // moves gimbal to extreme right and down MotorBrakePositionClean(ROLL_MOTOR); //GeneralPitchRoll(ROLL_MOTOR,A3906_FORWARD,800); //EncoderInitReset(QEI1_BASE,ROLL_MOTOR,A3906_FORWARD); // J8 ROLL Encoder //EncoderInitReset(QEI1_BASE,ROLL_MOTOR,A3906_REVERSE); // J8 ROLL Encoder //EncoderInitReset(QEI1_BASE,ROLL_MOTOR,A3906_FORWARD); // J8 ROLL Encoder #ifdef USE_BMA180_INTERRUPT AHRS_Init(); #endif lastitg = g_ulTickCount; StabilizeInit(); //SetBitMode(); }