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 /Libraries/LTimers/ltimers.c |
Создаю новый репозиторий. Программа для версии NixieClock_v2. Работает, часы тикают. Есть проблема, что скачет вторая сеносрная кнопка (она в другом канале). Поэтому на нее собираюсь сделать антидребезг.
Diffstat (limited to 'Libraries/LTimers/ltimers.c')
-rw-r--r-- | Libraries/LTimers/ltimers.c | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/Libraries/LTimers/ltimers.c b/Libraries/LTimers/ltimers.c new file mode 100644 index 0000000..ccdbf00 --- /dev/null +++ b/Libraries/LTimers/ltimers.c @@ -0,0 +1,137 @@ +/* ltimers.c + + + . , + 1 ( + , 1 + , , . ). + - ProcessLTimers(), + . ltimers.h. + , , +, . + 1 ( + ) + - ProcessLTimers();. #include "ltimers.h" + , - . , + : + +StartLTimer ( LTIMER_LED_BLINK ); // +GetLTimer ( LTIMER_LED_BLINK ); // + + : +... +// ltimers.h , +// , MAX_LTIMERS +#include "ltimers.h" +... + +int main () +{ + ... + // 1 + InitLTimersHardWare(); + + // ( ) + InitLTimers (); + + // + StartLTimer ( LTIMER_LED_BLINK ); + + // + while (1) + { + // + if ( GetLTimer ( LTIMER_LED_BLINK ) >= 500 ) + { + LED_ON; + } + } +} + +*** + + 1. +. , +8- , , , . + + 2. , - ProcessLTimers() + . - StartLTimer + , , + . +, . . +. + + 3. uint32_t + . +*/ + +#include "ltimers.h" +#include "ltimers_config.h" + +uint32_t LTimers [MAX_LTIMERS] = { 0 }; + + +// ---------------------------------------------------------------------------- +// . +// - +// . +// ---------------------------------------------------------------------------- +void InitLTimers (void) +{ + LTimersConfig (); +} + + +// ---------------------------------------------------------------------------- +// - +// +// - LTimerNum_t ltimers.h +// - , 1 +// ---------------------------------------------------------------------------- +uint32_t GetLTimer ( LTimersNames_t LTimer ) +{ + return LTimers[ LTimer ]; +} + + +// ---------------------------------------------------------------------------- +// - +// 1 +// - LTimerNum_t ltimers.h +// ---------------------------------------------------------------------------- +void StartLTimer ( LTimersNames_t LTimer ) +{ + LTimers[ LTimer ] = 0; +} + + +// ---------------------------------------------------------------------------- +// -, . +// ltimers.h +// LTimerNum_t. MAX_LTIMERS +// . +// - TIM6_IRQHandler 1 . +// 1 +// ---------------------------------------------------------------------------- +void ProcessLTimers (void) +{ + for ( uint32_t i = 0; i < MAX_LTIMERS; i++ ) + { + LTimers[i]++; + } +} + + + + + + + + + + + + + + + |