コード例 #1
0
ファイル: main.c プロジェクト: saewave/RemoteSwitch
int main(void)
{
#if MOVE_VECTOR_TABLE == 1
    for (uint32_t i = 0; i < 48; i++) {
        VectorTable[i] = *(__IO uint32_t *)(MAIN_PROGRAM_START_ADDRESS + (i << 2));
    }
    SYSCFG->CFGR1 |= SYSCFG_CFGR1_MEM_MODE;
    RCC->APB2ENR |= RCC_APB2ENR_SYSCFGCOMPEN;
#endif
    __enable_irq();

    InitPeriph();

    if (SAE_READ_ADDR_ON_START) {
        readConfig();
    }

    Transceiver_Configure();

    dxputs("InitAll Done!\n\n");

#if SAE_ALL_TIME_RX_MODE == 1
    Transceiver_ClearFifo(Transceiver_CLEAR_TX_FIFO | Transceiver_CLEAR_RX_FIFO);
    Transceiver_RxMode();
    EXTI_Configure();
#endif

    rfStartup();

    TIM14->CR1 |= TIM_CR1_CEN;
//TIM16->CR1 |= TIM_CR1_CEN;
#if USE_STOP_MODE == 1
    GOTO_Stop();
    //We should never been here!
    dxputs("What I'm doing here?\n");
#endif
    while (1) {
#if USE_STOP_MODE == 0
        if (HandleStatus) {
            HandleStatus = 0x00;
            Transceiver_HandleStatus();
        }
#endif
    }
}
コード例 #2
0
ファイル: main.c プロジェクト: WeSpeakEnglish/STM32PLC
int main(void)
{
  uint8_t oldRelease = 0;
  /* USER CODE BEGIN 1 */
  /* USER CODE END 1 */
  /* Enable I-Cache-------------------------------------------------------------*/
  SCB_EnableICache();
  /* Enable D-Cache-------------------------------------------------------------*/
  SCB_EnableDCache();
  /* MCU Configuration----------------------------------------------------------*/
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
  /* Configure the system clock */
  SystemClock_Config();
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_ADC1_Init();
  MX_DMA_Init();
  MX_CAN1_Init();
  MX_CAN2_Init();
  MX_DAC_Init();
  MX_DMA2D_Init();
  MX_FMC_Init();
  MX_I2C2_Init();
  MX_SDMMC1_SD_Init();
  MX_SPI2_Init();
  MX_TIM6_Init();
  MX_TIM7_Init();
  MX_USART2_UART_Init();
  MX_USART3_UART_Init();
  MX_USART6_UART_Init();
  MX_FATFS_Init();
  MX_USB_HOST_Init();
  MX_TIM11_Init();
  MX_TIM13_Init();
  MX_TIM14_Init();

  /* USER CODE BEGIN 2 */
  //MPU_Config(); 
  InitPeriph();
  
  /* USER CODE END 2 */
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while(1){
  /* USER CODE END WHILE */
    MX_USB_HOST_Process();

  /* USER CODE BEGIN 3 */
   RoutineFast(); // get and run deals from medium queue 

   if(oldRelease && Touch_Data.status == TOUCH_RELEASED){
   ReleaseFunction();
   }
   else
   {oldRelease = 1;}
 if(UpdateScreen|| DISP.ReleaseFlag || TimeIsReady){
  Run_GUI();

  Show_GUI();
  UpdateScreen = 0;
  DISP.ReleaseFlag = 0;
  }
    
  }
  /* USER CODE END 3 */

}