예제 #1
0
int main(void)
{
    RCC_Configuration();
    GPIO_Configuration();
    USART1_Configuration();
    LED_Initialization();
    USART1_puts("Hello World!\r\n");
    USART1_puts("Just for STM32F429I Discovery verify USART1 with USB TTL Cable\r\n");
    while(1)
    {
        //LED3_Toggle();

        //Recieve
        if(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) != RESET){ // == SET
        char t = USART_ReceiveData(USART1);
        if(t == 'a') LED3_Toggle();
        else if(t == 'b') LED4_Toggle();

        //Transmitt
        while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
        USART_SendData(USART1, t);

        }

    }

    while(1); // Don't want to exit
}
예제 #2
0
int main(void)
{
  
    RCC_Configuration();
    LED_Initialization();     //PG13 (GREEN) & PG14 (RED)
    USART1_Initialization();  //PA9 (TX) & PA10 (RX)
    SPI1_Initialization();    //PB3 (SCK) & PB4 (MISO) & PB5 (MOSI)
    Delay_1us(1000000);
    NRF2401_Initialization();
    Timer2_Initialization();

    // LED3_On();
    USART1_puts("\r\nHello World\r\n");
    // Delay_1us(500000);
    // LED3_Off();
    // Delay_1us(500000);    

    while(1)
    {
      if(task == 1){
        LED4_Toggle();

        /* NRF2401 TX Mode */
        NRF2401_SendData_1CH("KU");

        /* NRF2401 RX Mode */
        // uint8_t i;
        // for(i = 0; i < 24; i++){
        //   receivedData = NRF2401_ReceiveData_1CH()[i];
        //   USART_SendData(USART1, receivedData);
        // }
        // USART1_puts("\r\n");

        // NRF2401_ReceiveData_1CH();
        task = 0;
      }
    }

    while(1); // Don't want to exit
}
예제 #3
0
void USART1_Configuration(void)
{
    USART_InitTypeDef USART_InitStructure;

    /* USARTx configuration ------------------------------------------------------*/
    /* USARTx configured as follow:
     *  - BaudRate = 57600 baud
     *  - Word Length = 8 Bits
     *  - One Stop Bit
     *  - No parity
     *  - Hardware flow control disabled (RTS and CTS signals)
     *  - Receive and transmit enabled
     */
    USART_InitStructure.USART_BaudRate = 57600;
    USART_InitStructure.USART_WordLength = USART_WordLength_8b;
    USART_InitStructure.USART_StopBits = USART_StopBits_1;
    USART_InitStructure.USART_Parity = USART_Parity_No;
    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
    //START USART
    USART_Init(USART1, &USART_InitStructure);
    USART_Cmd(USART1, ENABLE);

    //Using Interrupt
    USART_ClearFlag(USART1, USART_FLAG_TC);

    //Enable RX interrupt & Disable TX interrupt
    USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
    USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);

    /* NVIC Initialization */
    NVIC_InitTypeDef NVIC_InitStruct = {
      .NVIC_IRQChannel = USART1_IRQn,
      .NVIC_IRQChannelPreemptionPriority = 0,
      .NVIC_IRQChannelSubPriority = 0,
      .NVIC_IRQChannelCmd = ENABLE
    };
    NVIC_Init(&NVIC_InitStruct);

}

void USART1_puts(char* s)
{
    while(*s) {
        while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
        USART_SendData(USART1, *s);
        s++;
    }
}

/**************************************************************************************/
int main(void)
{
    RCC_Configuration();
    GPIO_Configuration();
    USART1_Configuration();
    LED_Initialization();
    USART1_puts("Hello World!\r\n");
    USART1_puts("Just for STM32F429I Discovery verify USART1 with USB TTL Cable\r\n");

    while(1)
    {
        //LED4_Toggle();

        //Delay_1us(10000);
        //USART1_puts(i);        
    }
}
예제 #4
0
int main(void)
{
  PWM_Initialization();
  TIM1->CCR2 = 1000;
  TIM1->CCR3 = 1000;
  Delay_1us(500000);

  RCC_Configuration();
  PushButton_Initialization();
  LED_Initialization();
  //LCD_Initialization();
  //terminalBufferInitilization();

  Delay_1us(100000);
  SPI_Initialization();
  Delay_1us(100000);
  IMU_Initialization();
  Delay_1us(100000);
  Timer5_Initialization(); //Filter
  Timer2_Initialization(); //Print
  Timer4_Initialization(); //Read IMU

  USART3_Configuration();
  USART3_puts("\r\nHello World!\r\n");
    
  while(1)
  {
    if(PushButton_Read()){
      if(f.arm == 0){ 
        f.arm = 1;
        Delay_1us(500000);
      }
      else if(f.arm == 1){
        f.arm = 0;
        Delay_1us(500000);
      }
    }

    if(f.imu == 1){
      //LED3_Toggle();
      readIMU(gyroRaw, GYRO_DATA_REGISTER);
      gyro_remove_offset(gyroRaw);
      readIMU(accRaw, ACC_DATA_REGISTER);
      f.imu = 0;
    // }  

    // if(f.filter == 1){
      //LED4_Toggle();
      Filter(gyroRaw, gyroAngle, accRaw, accAngle, Angle);
      if(f.arm == 1){
        PID_control(Angle);
      }
      else{
        TIM1->CCR2 = 1000;
        TIM1->CCR3 = 1000;

        errorI = 0;
        errorD = 0;
        previous_error = 0;
      }

      //f.filter = 0;
    }

    strcmd_main();      

    //if(f.print == 1){
      
      // sprintf(lcd_text_main,"%.4f %.4f %d", Angle[0], Angle[1], f.arm);
      // //sprintf(lcd_text_main,"G: %.3f %.3f %.3f", EstV.G.X, EstV.G.Y, EstV.G.Z);
      // LCD_DisplayStringLine(LINE(1), lcd_text_main);
      // //sprintf(lcd_text_main,"A: %.3f %.3f %.3f", EstV.A.X, EstV.A.Y, EstV.A.Z);
      // //sprintf(lcd_text_main,"A: %.3f %.3f", sqX_sqZ, EstV.GA.X*EstV.GA.X + EstV.GA.Z*EstV.GA.Z);
      // // sprintf(lcd_text_main,"%.4f %.4f %.4f \n", gyroAngle[0], gyroAngle[1], gyroAngle[2]);
      // sprintf(lcd_text_main,"%d     ", gyroRaw[2]);
      // LCD_DisplayStringLine(LINE(2), lcd_text_main);
      // sprintf(lcd_text_main,"GA: %.3f %.3f %.3f", EstV.GA.X, EstV.GA.Y, EstV.GA.Z);
      // LCD_DisplayStringLine(LINE(3), lcd_text_main);
      //sprintf(lcd_text_main,"%.3f %.3f %.3f\n", EstV.G.Z, EstV.A.Z, EstV.GA.Z);
      
      //LCD_DisplayStringLine(LINE(2), (uint8_t*)" Ming6842 @ github");
      //terminalWrite(lcd_text_main);
      //PRINT_USART();
      //f.print = 0;
    //}
  }

  while(1); // Don't want to exit
}
예제 #5
0
int main(void)
{
    RCC_Configuration();
    GPIO_Configuration();
    LED_Initialization();
    uint8_t i=1,c=1;
    while(1)
    {

      //sevro
      if(PushButton_Read())
      {
        if(c==1)
        {
          c=0;
          if(PushButton_Read())
          {
            if(i==1)
            {
              i=2;
            }
            else if(i==2)
            {
              i=3;
            }
            else
            {
              i=1;
            }
          }
        }
      }
      if(PushButton_Read())
      {
        c=0;
      }
      else
      {
        c=1;
      }
      

      //
        if(i==1)
        {
          v13_on();
          v14_on();
          v15_on();
          Delay_1us(1000);
          v13_off();
          Delay_1us(500);
          v14_off();
          Delay_1us(500);
          v15_off();
          Delay_1us(18500);
        }
        if(i==2)
        {
          v13_on();
          v14_on();
          v15_on();
          Delay_1us(1000);
          v14_off();
          Delay_1us(500);
          v15_off();
          Delay_1us(500);
          v13_off();
          Delay_1us(18500);
        }
        if(i==3)
        {
          v13_on();
          v14_on();
          v15_on();
          Delay_1us(1000);
          v15_off();
          Delay_1us(500);
          v13_off();
          Delay_1us(500);
          v14_off();
          Delay_1us(18500);
        }
      
      // if(PushButton_Read())
      // {
      //   LED4_Off();
      //   for(i=0;i<90;i++)
      //   {
      //     LED3_Toggle();
      //     Delay_1us(100000-i*1000);

      //     if (PushButton_Read())
      //     {

      //     }
      //     else
      //       break;
      //   }
      // }
      // else
      // {

      //   LED4_Toggle();
      // Delay_1us(100000);
      //   LED3_Off();
      // }
      

    }

    while(1); // Don't want to exit
}
예제 #6
0
int main(void)
{

            CanTxMsg TxMessage;
  float X_offset =0.0f,Y_offset =0.0f,Z_offset =0.0f;
  float test_float=0.0f; uint8_t test_int=0;
  float GyX =0.0f, GyY =0.0f, GyZ =0.0f;
  float GyX_prev=0.0f,GyY_prev=0.0f,GyZ_prev=0.0f;
      uint16_t x_len=240;
      uint16_t y_len=320;

      uint16_t i=0;
      uint16_t buffer_screen[x_len][y_len];

      /* For gyro receiving  */
     float receivedGyro1=0,receivedGyro1_prev=0;
     float receivedGyro2=0,receivedGyro2_prev=0;
     float receivedGyro3=0,receivedGyro3_prev=0;
     uint8_t *ptr = & receivedGyro1;


      // uint16_t *buf_ptr = &buffer_screen;
      float runner=-8.0;

      rectangular_t rect1;
      rectangular_t prev_rect;
      rectangular_t rect_screen;


    char lcd_text_main[100];

    /* LCD Initialization */
    lcd_init();
    lcd_drawBackground(20,60,250);
    //lcd_drawBGPersimmon(20, 60, 250);



    /* LED Initialization */
    LED_Initialization();

    /* CAN Initialization */
    CAN2_Config();
    CAN2_NVIC_Config();

    /* MEMS Initialization */
    Demo_GyroConfig();

    Delay_1us(10000);
      #define CALIBRATE_COUNT 1000
      for (i=0;i<CALIBRATE_COUNT ;i++){
        Demo_GyroReadAngRate (Buffer);
        X_offset+= Buffer[0];
        Y_offset+= Buffer[1];
        Z_offset+= Buffer[2];
      }

      X_offset = X_offset/ (float)CALIBRATE_COUNT;
      Y_offset = Y_offset/ (float)CALIBRATE_COUNT;
      Z_offset = Z_offset/ (float)CALIBRATE_COUNT;


        rect_screen.xlen = x_len;
        rect_screen.ylen = y_len;
        rect_screen.xpos = 0;
        rect_screen.ypos = 0;

        #define NEEDLE_RADIUS 65
        #define NEEDLE_BASE_WIDTH 14
        #define NEEDLE_FRAME_THICKNESS 5
        
        #define NEEDLE1_CENTER_X 80
        #define NEEDLE1_CENTER_Y 100

        #define NEEDLE2_CENTER_X 80
        #define NEEDLE2_CENTER_Y 200

        #define NEEDLE3_CENTER_X 80
        #define NEEDLE3_CENTER_Y 300

        /* Drawing Needle frame 1 */
        LCD_SetLayer(LCD_BACKGROUND_LAYER);

        DrawThickCircle(NEEDLE1_CENTER_X ,NEEDLE1_CENTER_Y,NEEDLE_RADIUS+NEEDLE_FRAME_THICKNESS, 4,LCD_COLOR_BLACK,LCD_COLOR_WHITE-1);
       
        LCD_SetLayer(LCD_FOREGROUND_LAYER);

        DrawThickCircle(NEEDLE1_CENTER_X ,NEEDLE1_CENTER_Y,NEEDLE_BASE_WIDTH, 6,LCD_COLOR_BLACK,LCD_COLOR_WHITE-1);
        
        LCD_SetLayer(LCD_BACKGROUND_LAYER);
        LCD_SetColors(ASSEMBLE_RGB(20, 60, 250),LCD_COLOR_BLACK);
        LCD_DrawFullRect(NEEDLE1_CENTER_X- NEEDLE_RADIUS-NEEDLE_FRAME_THICKNESS*2,NEEDLE1_CENTER_Y+ NEEDLE_BASE_WIDTH+3,NEEDLE_RADIUS*2+NEEDLE_FRAME_THICKNESS*4,NEEDLE_RADIUS);

        LCD_SetLayer(LCD_FOREGROUND_LAYER);

        LCD_SetColors(LCD_COLOR_BLACK,LCD_COLOR_BLACK);
        LCD_DrawFullRect(NEEDLE1_CENTER_X- NEEDLE_RADIUS,NEEDLE1_CENTER_Y+ NEEDLE_BASE_WIDTH,NEEDLE_RADIUS*2,NEEDLE_FRAME_THICKNESS-1);

        /* Drawing Needle frame 2 */
        LCD_SetLayer(LCD_BACKGROUND_LAYER);

        DrawThickCircle(NEEDLE2_CENTER_X ,NEEDLE2_CENTER_Y,NEEDLE_RADIUS+NEEDLE_FRAME_THICKNESS, 4,LCD_COLOR_BLACK,LCD_COLOR_WHITE-1);
       
        LCD_SetLayer(LCD_FOREGROUND_LAYER);

        DrawThickCircle(NEEDLE2_CENTER_X ,NEEDLE2_CENTER_Y,NEEDLE_BASE_WIDTH, 6,LCD_COLOR_BLACK,LCD_COLOR_WHITE-1);
        
        LCD_SetLayer(LCD_BACKGROUND_LAYER);
        LCD_SetColors(ASSEMBLE_RGB(20, 60, 250),LCD_COLOR_BLACK);
        LCD_DrawFullRect(NEEDLE2_CENTER_X- NEEDLE_RADIUS-NEEDLE_FRAME_THICKNESS*2,NEEDLE2_CENTER_Y+ NEEDLE_BASE_WIDTH+3,NEEDLE_RADIUS*2+NEEDLE_FRAME_THICKNESS*4,NEEDLE_RADIUS);

        LCD_SetLayer(LCD_FOREGROUND_LAYER);

        LCD_SetColors(LCD_COLOR_BLACK,LCD_COLOR_BLACK);
        LCD_DrawFullRect(NEEDLE2_CENTER_X- NEEDLE_RADIUS,NEEDLE2_CENTER_Y+ NEEDLE_BASE_WIDTH,NEEDLE_RADIUS*2,NEEDLE_FRAME_THICKNESS-1);


        /* Drawing Needle frame 2 */
        LCD_SetLayer(LCD_BACKGROUND_LAYER);

        DrawThickCircle(NEEDLE3_CENTER_X ,NEEDLE3_CENTER_Y,NEEDLE_RADIUS+NEEDLE_FRAME_THICKNESS, 4,LCD_COLOR_BLACK,LCD_COLOR_WHITE-1);
       
        LCD_SetLayer(LCD_FOREGROUND_LAYER);

        DrawThickCircle(NEEDLE3_CENTER_X ,NEEDLE3_CENTER_Y,NEEDLE_BASE_WIDTH, 6,LCD_COLOR_BLACK,LCD_COLOR_WHITE-1);
        
        LCD_SetLayer(LCD_BACKGROUND_LAYER);
        LCD_SetColors(ASSEMBLE_RGB(20, 60, 250),LCD_COLOR_BLACK);
        LCD_DrawFullRect(NEEDLE3_CENTER_X- NEEDLE_RADIUS-NEEDLE_FRAME_THICKNESS*2,NEEDLE3_CENTER_Y+ NEEDLE_BASE_WIDTH+3,NEEDLE_RADIUS*2+NEEDLE_FRAME_THICKNESS*4,NEEDLE_RADIUS);

        LCD_SetLayer(LCD_FOREGROUND_LAYER);

        LCD_SetColors(LCD_COLOR_BLACK,LCD_COLOR_BLACK);
        LCD_DrawFullRect(NEEDLE3_CENTER_X- NEEDLE_RADIUS,NEEDLE3_CENTER_Y+ NEEDLE_BASE_WIDTH,NEEDLE_RADIUS*2,NEEDLE_FRAME_THICKNESS-1);

        /* Clear drawing buffer */
        PadRectangular(&buffer_screen,x_len,y_len,LCD_COLOR_WHITE, &rect_screen);




      while(1)
      {

        board_ID = PIN_ID_Read();

        LCD_SetColors(LCD_COLOR_BLACK,LCD_COLOR_WHITE-1);
        sprintf(lcd_text_main," CAN Demo ID:%d    ",board_ID);
        LCD_DisplayStringLine(LINE(0), (uint8_t*)lcd_text_main);

        Demo_GyroReadAngRate (Buffer);

        //Delay_1us(1000);

        /* MEMS Filtering */
        #define LP_ALPHA 0.1f
        GyX = GyX*(1.0f - LP_ALPHA) + (Buffer[0] - X_offset)*LP_ALPHA;
        GyY = GyY*(1.0f - LP_ALPHA) + (Buffer[1] - Y_offset)*LP_ALPHA;
        GyZ = GyZ*(1.0f - LP_ALPHA) + (Buffer[2] - Z_offset)*LP_ALPHA;

        if(GyX >  90.0f)  GyX =  90.0f;
        if(GyX < -90.0f)  GyX = -90.0f;
        if(GyY >  90.0f)  GyY =  90.0f;
        if(GyY <  -90.0f) GyY = -90.0f;
        if(GyZ >  90.0f)  GyZ =  90.0f;
        if(GyZ < -90.0f)  GyZ = -90.0f;

        /* Start drawing rectangular */
        prev_rect = rect1;

        rect1.xlen = 25;
        rect1.ylen = 30;
        rect1.xpos = x_len/2+ (int16_t)(GyY)-10;
        rect1.ypos = y_len/2 + (int16_t)(GyX)-10;


        if(board_ID == 1){


          MoveNeedle(LCD_BACKGROUND_LAYER,&buffer_screen,x_len,y_len,LCD_COLOR_GREEN,NEEDLE1_CENTER_X,NEEDLE1_CENTER_Y,-GyZ,-GyZ_prev,NEEDLE_RADIUS,NEEDLE_BASE_WIDTH);

        }else if(board_ID == 2){

          MoveNeedle(LCD_BACKGROUND_LAYER,&buffer_screen,x_len,y_len,LCD_COLOR_GREEN,NEEDLE2_CENTER_X,NEEDLE2_CENTER_Y,-GyZ,-GyZ_prev,NEEDLE_RADIUS,NEEDLE_BASE_WIDTH);

        }else {

          MoveNeedle(LCD_BACKGROUND_LAYER,&buffer_screen,x_len,y_len,LCD_COLOR_GREEN,NEEDLE3_CENTER_X,NEEDLE3_CENTER_Y,-GyZ,-GyZ_prev,NEEDLE_RADIUS,NEEDLE_BASE_WIDTH);

        }

            CAN2_TransmitGyro(board_ID,GyZ);

            /* Received Data */
            if( can2_rx_isr_flag ==1){

              do{

            if( can2_rx_isr_flag ==1){
                  can2RxMessage = CAN2_PassRXMessage();
                  can2_rx_isr_flag=0;
                }else{

                  CAN_Receive(CAN2, CAN_FIFO0, &can2RxMessage);
                }
                  GPIO_ToggleBits(GPIOG,GPIO_Pin_14);

                    ptr[0] = can2RxMessage.Data[0];
                    ptr[1] = can2RxMessage.Data[1];
                    ptr[2] = can2RxMessage.Data[2];
                    ptr[3] = can2RxMessage.Data[3];


                    if(( can2RxMessage.ExtId &   0x0000FFFF) == 1){
                        ptr = & receivedGyro1;
                    ptr[0] = can2RxMessage.Data[0];
                    ptr[1] = can2RxMessage.Data[1];
                    ptr[2] = can2RxMessage.Data[2];
                    ptr[3] = can2RxMessage.Data[3];


                        MoveNeedle(LCD_BACKGROUND_LAYER,&buffer_screen,x_len,y_len,LCD_COLOR_RED,NEEDLE1_CENTER_X,NEEDLE1_CENTER_Y,-receivedGyro1,-receivedGyro1_prev,NEEDLE_RADIUS,NEEDLE_BASE_WIDTH);
                        
                    receivedGyro1_prev = receivedGyro1;
                    }else if (( can2RxMessage.ExtId & 0x0000FFFF) == 2){
                        ptr = & receivedGyro2;
                    ptr[0] = can2RxMessage.Data[0];
                    ptr[1] = can2RxMessage.Data[1];
                    ptr[2] = can2RxMessage.Data[2];
                    ptr[3] = can2RxMessage.Data[3];
                        MoveNeedle(LCD_BACKGROUND_LAYER,&buffer_screen,x_len,y_len,LCD_COLOR_RED,NEEDLE2_CENTER_X,NEEDLE2_CENTER_Y,-receivedGyro2,-receivedGyro2_prev,NEEDLE_RADIUS,NEEDLE_BASE_WIDTH);
                        
                    receivedGyro2_prev = receivedGyro2;
                    }else if (( can2RxMessage.ExtId & 0x0000FFFF) == 3){
                        ptr = & receivedGyro3;
                    ptr[0] = can2RxMessage.Data[0];
                    ptr[1] = can2RxMessage.Data[1];
                    ptr[2] = can2RxMessage.Data[2];
                    ptr[3] = can2RxMessage.Data[3];
                        MoveNeedle(LCD_BACKGROUND_LAYER,&buffer_screen,x_len,y_len,LCD_COLOR_RED,NEEDLE3_CENTER_X,NEEDLE3_CENTER_Y,-receivedGyro3,-receivedGyro3_prev,NEEDLE_RADIUS,NEEDLE_BASE_WIDTH);
                        
                    receivedGyro3_prev = receivedGyro3;
                    }
                  // LCD_SetColors(LCD_COLOR_BLACK,LCD_COLOR_WHITE-1);
                  // sprintf(lcd_text_main," ID :%d         ", can2RxMessage.StdId);
                  // LCD_DisplayStringLine(LINE(1), (uint8_t*)lcd_text_main);
                  // LCD_SetColors(LCD_COLOR_BLACK,LCD_COLOR_WHITE-1);
                  // sprintf(lcd_text_main," Data :%f        ", receivedGyro);
                  // LCD_DisplayStringLine(LINE(2), (uint8_t*)lcd_text_main);
                }while(CAN_MessagePending(CAN2, CAN_FIFO0) > 0);



            }



          // {
          //   uint8_t status=0;



          //   while(CAN_TransmitStatus(CAN2, 0) != CAN_TxStatus_Ok ){

          //     status = CAN_TransmitStatus(CAN2, 0);
          //        if(status == CAN_TxStatus_Failed){

          //         GPIO_ToggleBits(GPIOG,GPIO_Pin_14);


          //        }
          //  }

          // }
            // TxMessage.StdId = (uint32_t)board_ID;
            // TxMessage.RTR = CAN_RTR_DATA;
            // TxMessage.IDE = CAN_ID_STD;
            // TxMessage.DLC = 8;
            // TxMessage.Data[0] = 0x01;
            // TxMessage.Data[1] = 0x01;
            // TxMessage.Data[2] = 0x01;
            // TxMessage.Data[3] = 0x01;
            // TxMessage.Data[4] = 0x01;
            // TxMessage.Data[5] = 0x01;
            // TxMessage.Data[6] = 0x01;
            // TxMessage.Data[7] = 0x01;
            // CAN_Transmit(CAN2, &TxMessage);

        //CAN2_TransmitGyro(test_int++,test_float);

        test_float += 0.1f;

        GyX_prev = GyX;
        GyZ_prev = GyZ;
        GyY_prev = GyY;

        runner += 1.0f;


        /* Faster method */
        //MoveAndUpdateRectangular(LCD_FOREGROUND_LAYER,&buffer_screen,x_len,y_len,LCD_COLOR_BLACK,&prev_rect, &rect1);
        
        /* Regular method */
        // PadRectangular(&buffer_screen,x_len,y_len,LCD_COLOR_WHITE, &prev_rect);
        // PadRectangular(&buffer_screen,x_len,y_len,LCD_COLOR_BLACK, &rect1);
         //DrawBufferToScreen(LCD_FOREGROUND_LAYER,buf_ptr,0,0, x_len,y_len);

      }

    
  
}
예제 #7
0
/* Model initialize function */
void test_udp_initialize(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));

  /* initialize error status */
  rtmSetErrorStatus(test_udp_M, (NULL));

  /* S-Function (UDPM_Receive_Int32): <S10>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1);

  /* S-Function (ARDrone_LED): <S4>/ARDrone_LED */
  LED_Initialization();

  /* S-Function (UDPM_Receive_Int32): <S12>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_b);

  /* S-Function (ARDrone_LED): <S4>/ARDrone_LED1 */
  LED_Initialization();

  /* S-Function (UDPM_Receive_Int32): <S13>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_l);

  /* S-Function (ARDrone_LED): <S4>/ARDrone_LED2 */
  LED_Initialization();

  /* S-Function (UDPM_Receive_Int32): <S14>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_l3);

  /* S-Function (ARDrone_LED): <S4>/ARDrone_LED3 */
  LED_Initialization();

  /* S-Function (UDPM_Receive_Int32): <S7>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_m);

  /* S-Function (ARDrone_Motor): <S6>/ARDrone_Motor */
  Motor_Initialization();

  /* S-Function (ARDrone_Motor): <S6>/ARDrone_Motor1 */
  Motor_Initialization();

  /* S-Function (ARDrone_Motor): <S6>/ARDrone_Motor2 */
  Motor_Initialization();

  /* S-Function (ARDrone_Motor): <S6>/ARDrone_Motor3 */
  Motor_Initialization();

  /* S-Function (ARDrone_Acc_X): <S1>/ARDrone_Acc_X */
  Accelero_Initialization();

  /* S-Function (ARDrone_Acc_Y): <S1>/ARDrone_Acc_Y */
  Accelero_Initialization();

  /* S-Function (ARDrone_Acc_Z): <S1>/ARDrone_Acc_Z */
  Accelero_Initialization();

  /* S-Function (ARDrone_Gyro_X): <S3>/ARDrone_Gyro_X */
  Gyro_Initialization();

  /* S-Function (ARDrone_Gyro_Y): <S3>/ARDrone_Gyro_Y */
  Gyro_Initialization();

  /* S-Function (ARDrone_Gyro_Z): <S3>/ARDrone_Gyro_Z */
  Gyro_Initialization();

  /* S-Function (UDPM_Send_Int32): <S7>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1);

  /* S-Function (UDPM_Receive_Int32): <S8>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_c);

  /* S-Function (UDPM_Send_Int32): <S8>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_d);

  /* S-Function (UDPM_Send_Int32): <S10>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_g);

  /* S-Function (UDPM_Send_Int32): <S12>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_gv);

  /* S-Function (UDPM_Send_Int32): <S13>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_m);

  /* S-Function (UDPM_Send_Int32): <S14>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_n);

  /* S-Function (ARDrone_Pressure): <S2>/ARDrone_Pressure */
  Barometer_Initialization();

  /* S-Function (ARDrone_Temperature): <S2>/ARDrone_Temperature */
  Barometer_Initialization();

  /* S-Function (UDPM_Receive_Int32): <S9>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_bv);

  /* S-Function (UDPM_Send_Int32): <S9>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_g1);

  /* S-Function (UDPM_Receive_Int32): <S18>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_o);

  /* S-Function (UDPM_Send_Int32): <S18>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_mg);

  /* S-Function (ARDrone_Magneto_Z): <S5>/ARDrone_Magneto_Z */
  Magneto_Initialization();

  /* S-Function (ARDrone_Magneto_Y): <S5>/ARDrone_Magneto_Y */
  Magneto_Initialization();

  /* S-Function (ARDrone_Magneto_X): <S5>/ARDrone_Magneto_X */
  Magneto_Initialization();

  /* S-Function (UDPM_Receive_Int32): <S11>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_l4);

  /* S-Function (UDPM_Send_Int32): <S11>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_i);

  /* S-Function (UDPM_Receive_Int32): <S15>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_k);

  /* S-Function (UDPM_Send_Int32): <S15>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_m2);

  /* S-Function (UDPM_Receive_Int32): <S16>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_g);

  /* S-Function (UDPM_Send_Int32): <S16>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_h);

  /* S-Function (ARDrone_Height): <Root>/Height */
  Height_Initialization();

  /* S-Function (UDPM_Receive_Int32): <S17>/UDPM_Receive_Int32 */
  udp_reception_init( (int32_T)test_udp_P.UDPM_Receive_Int32_p1_c2);

  /* S-Function (UDPM_Send_Int32): <S17>/UDPM_Send_Int32 */
  udp_emission_init( (int32_T)test_udp_P.UDPM_Send_Int32_p1_gi);
}