int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* 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_DMA_Init(); MX_I2C3_Init(); MX_TIM1_Init(); MX_TIM2_Init(); MX_TIM3_Init(); MX_TIM4_Init(); MX_TIM5_Init(); MX_USART1_UART_Init(); MX_USART2_UART_Init(); MX_TIM11_Init(); /* USER CODE BEGIN 2 */ HAL_TIM_Base_Start_IT(&htim11); // 100 msec timer initSonar( MAX_SONAR); initSerOutput(); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ // >>>>> Sonar reading triggerSonar( COUPLE_0_2); HAL_Delay(49); triggerSonar( COUPLE_1_3); HAL_Delay(49); // <<<<< Sonar reading // >>>>> Serial Output convertMeasures(); sendMeasures(); // <<<<< Serial Output } /* USER CODE END 3 */ }
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* 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_DMA_Init(); MX_ADC1_Init(); MX_I2C1_Init(); MX_RTC_Init(); MX_SPI2_Init(); MX_TIM1_Init(); MX_TIM2_Init(); MX_TIM3_Init(); MX_TIM4_Init(); MX_USART3_UART_Init(); /* USER CODE BEGIN 2 */ encoderInit(); pwmInit(); // adcInit(); uartInit(); timInterruptInit(); gyroInit(GYROHIGH); calibrateGyro(); // rotaryRight(800); // HAL_Delay(500); // rotaryLeft(800); drive(VEL); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ }
int main(void) { HAL_Init(); SystemClock_Config(); led2__init(); MX_TIM4_Init(); if (HAL_TIM_Base_Start_IT(&htim4) != HAL_OK) { Error_Handler(); } while (1) { } }
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* 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_DMA_Init(); MX_ADC1_Init(); MX_I2C1_Init(); MX_SPI1_Init(); MX_TIM1_Init(); MX_TIM4_Init(); MX_TIM6_Init(); MX_USART1_UART_Init(); MX_USART2_UART_Init(); MX_USART3_UART_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ FlyMain(); } /* USER CODE END 3 */ }
int main(void) { HAL_Init(); SystemClock_Config(); led2__init(); MX_DMA_Init(); MX_TIM4_Init(); if (HAL_TIM_Base_Start_DMA(&htim4, (uint32_t *) data, 2) != HAL_OK) { /* Starting Error */ Error_Handler(); } while (1) { } }
void InitSystem(DeviceConfig *devState){ // init HAL HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Initialize all configured peripherals */ InitDeviceConfig(devState); MX_USB_DEVICE_Init(); MX_GPIO_Init(); MX_I2C2_Init(devState); MX_ADC1_Init(devState); MX_ADC1_Init(devState); MX_SPI2_Init(devState); MX_TIM4_Init(devState); MX_USART3_UART_Init(devState); init_printf(NULL,usb_putc); }
int main(void) { /* USER CODE BEGIN 1 */ CMDLINE_CONTEXT cmd_context; const char *zhonx_info = (char *)CONFIG_ZHONX_INFO_ADDR; /* USER CODE END 1 */ /* 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_DMA_Init(); MX_ADC1_Init(); MX_ADC2_Init(); MX_ADC3_Init(); MX_I2C1_Init(); MX_RNG_Init(); MX_TIM1_Init(); MX_TIM2_Init(); MX_TIM3_Init(); MX_TIM4_Init(); MX_TIM5_Init(); MX_TIM6_Init(); MX_TIM7_Init(); MX_TIM8_Init(); MX_TIM11_Init(); MX_USART3_UART_Init(); /* USER CODE BEGIN 2 */ expanderInit(); HAL_Delay(100); mainControlInit(); ssd1306Init(0); timesBaseInit(); ledPowerBlink(990, 10); settingsInit(); mulimeterInit(); bluetoothInit(); toneInit(); spyPostInit(); positionControlSetPositionType(GYRO); mainControlSetFollowType(NO_FOLLOW); toneSetVolulme(100); tone(F4, 50); toneItMode(A4, 50); // Register Output callback cmd_context.out = blockingPrintf; // Initialize Command Line module cmdline_init(&cmd_context); // Check if robot name is populated in Flash memset(zhonxName, 0, sizeof(zhonxName)); // Retrieve ZHONX information from flash if any if (zhonx_info[0] == 'Z') { strcpy(zhonxName, zhonx_info); } while (zhonxName[0] == 0) { menu(zhonxNameMenu); } while (1) { menu(mainMenu); powerOffConfirmation(); } /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) ; /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ /* USER CODE END 3 */ }
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* 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_DMA_Init(); MX_CRC_Init(); MX_I2C1_Init(); MX_SPI2_Init(); MX_TIM2_Init(); MX_TIM3_Init(); MX_TIM4_Init(); MX_USART2_UART_Init(); /* USER CODE BEGIN 2 */ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET); // reinitialize uart with speed from config huart2.Init.BaudRate = USART_DEBUG_SPEED; HAL_UART_Init(&huart2); DEBUG_PRINTF("Hello, Lepton!\n\r"); fflush(stdout); lepton_init(); HAL_Delay(1000); init_lepton_command_interface(); #ifdef ENABLE_LEPTON_AGC enable_lepton_agc(); #endif #ifdef Y16 enable_telemetry(); #else enable_rgb888(PSUEDOCOLOR_LUT); #endif DEBUG_PRINTF("reading_tmp007_regs...\n\r"); read_tmp007_regs(); DEBUG_PRINTF("Initialized...\n\r"); HAL_Delay(250); MX_USB_DEVICE_Init(); PT_INIT(&lepton_task_pt); PT_INIT(&usb_task_pt); PT_INIT(&uart_task_pt); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ PT_SCHEDULE(lepton_task(&lepton_task_pt)); PT_SCHEDULE(usb_task(&usb_task_pt)); PT_SCHEDULE(uart_task(&uart_task_pt)); PT_SCHEDULE(button_task(&button_task_pt)); } /* USER CODE END 3 */ }
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* 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_I2C3_Init(); MX_SPI3_Init(); MX_TIM1_Init(); MX_TIM2_Init(); MX_TIM3_Init(); MX_TIM4_Init(); MX_TIM5_Init(); MX_USART1_UART_Init(); /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ /* USER CODE BEGIN RTOS_MUTEX */ /* add mutexes, ... */ /* USER CODE END RTOS_MUTEX */ /* USER CODE BEGIN RTOS_SEMAPHORES */ /* add semaphores, ... */ /* USER CODE END RTOS_SEMAPHORES */ /* USER CODE BEGIN RTOS_TIMERS */ /* start timers, add new ones, ... */ /* USER CODE END RTOS_TIMERS */ /* Create the thread(s) */ /* definition and creation of defaultTask */ osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128); defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL); /* USER CODE BEGIN RTOS_THREADS */ /* add threads, ... */ /* USER CODE END RTOS_THREADS */ /* Create the queue(s) */ /* definition and creation of xQueueUARTReceive */ osMessageQDef(xQueueUARTReceive, 3, char); xQueueUARTReceiveHandle = osMessageCreate(osMessageQ(xQueueUARTReceive), NULL); /* USER CODE BEGIN RTOS_QUEUES */ /* add queues, ... */ /* USER CODE END RTOS_QUEUES */ /* Start scheduler */ osKernelStart(); /* We should never get here as control is now taken by the scheduler */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ }
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* System interrupt init*/ /* Sets the priority grouping field */ HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_1); HAL_NVIC_SetPriority(SysTick_IRQn, 0, 1); /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_ADC1_Init(); MX_I2C1_Init(); MX_TIM1_Init(); MX_TIM3_Init(); MX_TIM4_Init(); MX_TIM6_Init(); MX_TIM7_Init(); MX_TIM8_Init(); MX_TIM10_Init(); MX_USART3_UART_Init(); /* USER CODE BEGIN 2 */ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, SET); /* USER CODE END 2 */ /* USER CODE BEGIN 3 */ // test_Expander(); ssd1306Init(0); test_Telemeters(); ADXRS620_Init(); TimesBase_Init(); test_Encoders(); Straight_Control_Start(GYRO); test_Beeper(); Led_Power_Blink(990, 10, 0); //test_Gyro(); Debug_ADXRS620(); //Debug_Straight_Control(); while(1); // test_Encoders(); // test_Vbat(); // test_EasterEgg(); //test_Gyro(); // test_Motor_Move(); // test_Motors(); // test_Telemeters(); // HAL_Delay(1000); // test_LineSensors(); // test_Oled(); // test_IR_Sensors(); /* USER CODE END 3 */ }
int main(void) { /* USER CODE BEGIN 1 */ osKernelInitialize(); /* USER CODE END 1 */ /* 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_TIM2_Init(); MX_USART2_UART_Init(); MX_TIM4_Init(); MX_TIM3_Init(); MX_ADC1_Init(); /* USER CODE BEGIN 2 */ //#ifdef USE_FULL_ASSERT #ifndef MAC_COORDINATOR // Board - Serial identification sprintf(Buf, "\x0cNUCLEO-F446 Debug Terminal\r\nVisible Light Communication " "Project\r\n---\r\nDEV_CONFIG=%d\r\n\r\n", DEV_CONFIG); HAL_UART_Transmit(&huart2, (uint8_t *) Buf, strlen(Buf), 0xffff); #endif //#endif // Initialize Optical Driver DRV_Init(); // Initialize PHY layer PHY_Init(); // Initialize MAC APP layer MAC_AppInit(); // Create threads #ifdef MAC_COORDINATOR tid_blinkLED = osThreadCreate (osThread(blinkLED), NULL); #endif //tid_sendSerial = osThreadCreate (osThread(sendSerial), NULL); //tid_checkButton = osThreadCreate (osThread(checkButton), NULL); // Start thread execution osKernelStart(); // Run codes DRV_RX_Start(); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { osDelay(1000); #ifdef MAC_COORDINATOR osSignalSet(tid_blinkLED, 0x0001); #endif } /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ /* USER CODE END 3 */ }