diff options
author | Alexander <trotsenkoa@gmail.com> | 2022-06-29 11:03:02 +0300 |
---|---|---|
committer | Alexander <trotsenkoa@gmail.com> | 2022-06-29 11:03:02 +0300 |
commit | 1702ce6ce430a66bb7af51644b91b7c196e719d9 (patch) | |
tree | 6039acbdf047873d32aaf55969286c5f0d55958f /Project/src/main.c |
Создаю новый репозиторий. Программа для версии NixieClock_v2. Работает, часы тикают. Есть проблема, что скачет вторая сеносрная кнопка (она в другом канале). Поэтому на нее собираюсь сделать антидребезг.
Diffstat (limited to 'Project/src/main.c')
-rw-r--r-- | Project/src/main.c | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/Project/src/main.c b/Project/src/main.c new file mode 100644 index 0000000..bf1c5b0 --- /dev/null +++ b/Project/src/main.c @@ -0,0 +1,178 @@ +/** + ****************************************************************************** + * @file STM32L152_Ex01_3TKeys_EVAL\src\main.c + * @author MCD Application Team + * @version V1.1.0 + * @date 24-February-2014 + * @brief Basic example of how to use the STMTouch Driver. + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> + * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + +/* + . + . , + STM32CubeMX. + + , , + ( , , , ) +*/ + +//#define LED_DRIVER + +// NixieClock_v2, +// NixieLUT + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +// FreeRTOS includes +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" +#include "semphr.h" + +#include "ltimers.h" +#include "head_task.h" +#include "button_task.h" +#include "button_handler.h" +#include "nixie_driver_task.h" +#include "light_sensor_task.h" + +#ifdef LED_DRIVER +#include "led_driver_task.h" +#endif + +#include "indicate_modes_task.h" +#include "tsl_user.h" +#include "time.h" + + +/* Private typedefs ----------------------------------------------------------*/ +/* Private defines -----------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ + +// +// - ? + +#define STACK_SIZE_HEAD ( (unsigned short) 230 ) +#define STACK_SIZE_NIXIE_DRIVER ( (unsigned short) 80 ) +#define STACK_SIZE_BUTTON ( (unsigned short) 200 ) +#define STACK_SIZE_LIGHT_SENSOR ( (unsigned short) 70 ) +#ifdef LED_DRIVER +#define STACK_SIZE_LED_DRIVER ( (unsigned short) 70 ) +#endif +#define STACK_SIZE_INDICATE_MODES ( (unsigned short) 250 ) + +/* Private functions prototype ---------------------------------------------- */ + + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +void InitAll ( void ) +{ + InitLTimers (); + NixieDriverInit (); + LightSensorInit(); +#ifdef LED_DRIVER + LED_DriverInit (); +#endif + TSL_user_Init (); + TimeInit (); + HeadTaskInit (); + IndicateModesInit (); + ButtonInit (); +} + + +BaseType_t TaskSuccess = NULL; + +// ------------------------------------------------------------- // +int main () +{ + InitAll (); + + // FreeRTOS ----------------------------------------------- // + + // !!! + // ! ( ) + + // , + // , . + // + + //BaseType_t TaskSuccess = NULL; + + TaskSuccess = xTaskCreate ( Head_Task, "Head_Task", STACK_SIZE_HEAD, NULL, tskIDLE_PRIORITY + 2, NULL ); + configASSERT( TaskSuccess ); + + TaskSuccess = xTaskCreate ( IndicateModes_Task, "IndicateModes_Task", STACK_SIZE_INDICATE_MODES, NULL, tskIDLE_PRIORITY + 2, NULL ); + configASSERT( TaskSuccess ); + + TaskSuccess = xTaskCreate ( Button_Task, "Button_Task", STACK_SIZE_BUTTON, NULL, tskIDLE_PRIORITY + 2, NULL ); + configASSERT( TaskSuccess ); + + TaskSuccess = xTaskCreate ( LightSensor_Task, "LightSensor_Task", STACK_SIZE_LIGHT_SENSOR, NULL, tskIDLE_PRIORITY + 2, NULL ); + configASSERT( TaskSuccess ); + + TaskSuccess = xTaskCreate ( NixieDriver_Task, "NixieDriver_Task", STACK_SIZE_NIXIE_DRIVER, NULL, tskIDLE_PRIORITY + 2, NULL ); + configASSERT( TaskSuccess ); + +#ifdef LED_DRIVER + TaskSuccess = xTaskCreate ( LED_Driver_Task, "LED_Driver_Task", STACK_SIZE_LED_DRIVER, NULL, tskIDLE_PRIORITY + 2, NULL ); + configASSERT( TaskSuccess ); +#endif + + vTaskStartScheduler (); // ( ) + +} // end of main + + + +#ifdef USE_FULL_ASSERT +/** + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ +void assert_failed ( uint8_t* file, uint32_t line ) +{ + /* User can add his own implementation to report the file name and line number, + ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + + /* Infinite loop */ + for (;;) + { + } +} +#endif + + +// - FreeRTOS ------------------------------------------------ // +void vApplicationMallocFailedHook ( void ) { for( ;; ); } +void vApplicationStackOverflowHook ( TaskHandle_t pxTask, char *pcTaskName ) { for( ;; ); } +void vApplicationIdleHook ( void ) { } + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + + + |