Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Created by simon on 19.06.2019.
- //
- #include "main.h"
- #include "cmsis_os.h"
- #include "rtc.h"
- #include "ui.h"
- #include "IOprocessing.h"
- #include <stdio.h>
- #include <string.h>
- #include <spi.h>
- #include <dac.h>
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wmissing-noreturn"
- extern osTimerId RotEncPushTimerHandle;
- extern osTimerId RotEncRotTimerHandle;
- /**
- * @brief Function implementing the IOTask thread.
- * @param argument: Not used
- * @retval None
- */
- void IOTaskFxn(void const *argument) {
- int msToWait = 50;
- xTimerChangePeriod(RotEncPushTimerHandle, pdMS_TO_TICKS(msToWait), portMAX_DELAY);
- xTimerChangePeriod(RotEncRotTimerHandle, pdMS_TO_TICKS(msToWait), portMAX_DELAY);
- uint16_t buffer;
- uint16_t action;
- for (;;) {
- if (xQueueReceive(IOQueueHandle, &buffer, portMAX_DELAY)) {
- switch (buffer) {
- case ROT_ENC_ENTER:
- if (!xTimerIsTimerActive(RotEncPushTimerHandle)) {
- action = ROT_ENC_ENTER;
- xQueueSend(UITaskQueueHandle, &action, portMAX_DELAY);
- xTimerReset(RotEncPushTimerHandle, portMAX_DELAY);
- }
- break;
- case ROT_ENC_RIGHT:
- if (!xTimerIsTimerActive(RotEncRotTimerHandle)) {
- action = ROT_ENC_RIGHT;
- xQueueSend(UITaskQueueHandle, &action, portMAX_DELAY);
- xTimerReset(RotEncRotTimerHandle, portMAX_DELAY);
- }
- break;
- case ROT_ENC_LEFT:
- if (!xTimerIsTimerActive(RotEncRotTimerHandle)) {
- action = ROT_ENC_LEFT;
- xQueueSend(UITaskQueueHandle, &action, portMAX_DELAY);
- xTimerReset(RotEncRotTimerHandle, portMAX_DELAY);
- }
- break;
- }
- }
- osDelay(5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement