test in progress
This commit is contained in:
26
Core/RotaryCoder/RotaryCoder.c
Normal file
26
Core/RotaryCoder/RotaryCoder.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include "RotaryCoder.h"
|
||||
|
||||
uint16_t COUNT;
|
||||
uint16_t DIR;
|
||||
|
||||
uint8_t EC11_init(void)
|
||||
{
|
||||
COUNT = 0;
|
||||
DIR = 0;
|
||||
HAL_TIM_Encoder_Start(&htim3, TIM_CHANNEL_ALL);
|
||||
// HAL_TIM_Encoder_Start_IT(&htim3,TIM_CHANNEL_ALL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint16_t EC11_DIR(void)
|
||||
{
|
||||
DIR = __HAL_TIM_IS_TIM_COUNTING_DOWN(&htim3);
|
||||
// STATUS.DATA.COUNT = __HAL_TIM_GET_COUNTER(&htim3);
|
||||
return DIR;
|
||||
}
|
||||
|
||||
uint16_t EC11_COUNT(void)
|
||||
{
|
||||
COUNT = __HAL_TIM_GET_COUNTER(&htim3);
|
||||
return COUNT;
|
||||
}
|
13
Core/RotaryCoder/RotaryCoder.h
Normal file
13
Core/RotaryCoder/RotaryCoder.h
Normal file
@ -0,0 +1,13 @@
|
||||
// Rotary encoder library for Arduino.
|
||||
#include "main.h"
|
||||
#include "tim.h"
|
||||
|
||||
#ifndef rotary_h
|
||||
#define rotary_h
|
||||
|
||||
uint8_t
|
||||
EC11_init(void);
|
||||
// Process pin(s)
|
||||
uint16_t EC11_DIR(void);
|
||||
uint16_t EC11_COUNT(void);
|
||||
#endif
|
Reference in New Issue
Block a user