Пример #1
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s)
       before to branch to application main. 
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */ 

  /* Initialize LEDs mounted on EVAL board */
  STM_EVAL_LEDInit(LED1);
  STM_EVAL_LEDInit(LED2);

  /* Configure EXTI Line0 (connected to PA0 pin) in interrupt mode */
  EXTILine0_Config();

  /* Configure EXTI Line13/15 (connected to PG13/15 pin) in interrupt mode 
     according to EVAL used */
  EXTILine13_15_Config();

  /* Generate software interrupt: simulate a falling edge applied on EXTI0 line */
  EXTI_GenerateSWInterrupt(EXTI_Line0);

  while (1)
  {
  }
}
Пример #2
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
 /* This sample code shows how to use STM32F4xx GPIO HAL API to toggle PG6, PG7,
    PG10, and PG12 IOs (connected to LED1, LED2, LED3 and LED4 on STM324x9I-EVAL board) 
    in an infinite loop.
    To proceed, 3 steps are required: */
  
  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Global MSP (MCU Support Package) initialization
     */
  HAL_Init();
  /* Configure the system clock */
  SystemClock_Config();
  
  /* -1- Initialize LEDs mounted on EVAL board */
  BSP_LED_Init(LED1);
  BSP_LED_Init(LED2);
  
  /* -2- Configure EXTI Line0 (connected to PA0 pin) in interrupt mode */
  EXTILine0_Config();

  /* -3- Configure EXTI Line13 (connected to PC13 pin) in interrupt mode */
  EXTILine13_15_Config();

  while (1)
  {
  }
}
Пример #3
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{  
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file startup_stm32f446xx.s) before to branch to application main. 
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */      
  
  /* CEC device initialization */
#if defined (DEVICE_1)
  DestinationAddress = DEVICE_ADDRESS_2; /* follower address */
  MyOwnAddress       = DEVICE_ADDRESS_1;
#elif defined (DEVICE_2)
  DestinationAddress = DEVICE_ADDRESS_1; /* follower address */
  MyOwnAddress       = DEVICE_ADDRESS_2;
#endif  
  
  /* IP configuration */ 
  CEC_Config();
  
  /* User Button Configuration */
  EXTILine13_15_Config();
   
  /* Build the Header block to send */
  HeaderBlockValueToSend = (uint8_t)((uint32_t)(MyOwnAddress) << CEC_INITIATOR_LSB_POS) | DestinationAddress;
  
  /* Test start */
  
  /* Enter infinite reception loop:
  * Each Time a reception is done, according to the value 
  * of "ReceivedFrame" the examples runs a specified 
  * Routine :
  * If the reception is correct TransferStatus value is PASSED ,otherwise it is FAILED */
  
  while(1)
  {
    if(ReceivedFrame == 0)
    {
    }
    /* If Bad Reception  */
    if(ReceivedFrame == 2)
    {
      /* Not Ok */
      TransferStatus = FAILED;
      ReceivedFrame = 0;
    }
    if (ReceivedFrame == 1)
    {
      /* OK */
      if ((Tab_Rx[1] ==0x44) && (Tab_Rx[2] == 0x42)) /* Test on the opcode value */
      {
        TransferStatus = PASSED;
        ReceivedFrame = 0;
        CEC_FlushRxBuffer();
      }     
    }
  }
}