Add code for rotary encoder
This commit is contained in:
@@ -18,8 +18,25 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ROTARY_ENCODER_H__
|
||||
#define __ROTARY_ENCODER_H__
|
||||
|
||||
#include <stm32/stm32f4xx.h>
|
||||
|
||||
#define ROTARY_ENCODER_TIMER TIM5
|
||||
#define ROTARY_ENCODER_TIMER_RCC_MASK RCC_APB1ENR_TIM5EN
|
||||
#define ROTARY_ENCODER_PIN1 0
|
||||
#define ROTARY_ENCODER_PIN2 1
|
||||
#define ROTARY_ENCODER_PORT GPIOA
|
||||
#define ROTARY_ENCODER_PORT_ALTFUNC 2
|
||||
#define ROTARY_ENCODER_RCC_MASK RCC_AHB1ENR_GPIOAEN
|
||||
|
||||
void rotary_encoder_setup(void);
|
||||
|
||||
uint32_t rotary_encoder_get_abs_val(void);
|
||||
|
||||
int32_t rotary_encoder_get_chage_val(void);
|
||||
|
||||
void rotary_encoder_stop(void);
|
||||
|
||||
#endif /* __ROTARY_ENCODER_H__ */
|
||||
|
Reference in New Issue
Block a user