Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90413473
incr_encoder.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 1, 11:18
Size
1009 B
Mime Type
text/x-c
Expires
Sun, Nov 3, 11:18 (2 d)
Engine
blob
Format
Raw Data
Handle
22069988
Attached To
R2671 HHRI-software
incr_encoder.h
View Options
#ifndef __INCR_ENCODERS_H
#define __INCR_ENCODERS_H
#include "../main.h"
#define CODER_A_Pin GPIO_Pin_0
#define CODER_A_Port GPIOA
#define CODER_A_PinSource GPIO_PinSource0
#define CODER_B_Pin GPIO_Pin_1
#define CODER_B_Port GPIOA
#define CODER_B_PinSource GPIO_PinSource1
#define CODER_I_Pin GPIO_Pin_3
#define CODER_I_Port GPIOE
#define CODER_RESOLUTION ((uint32_t)2000) // Number of increments per turn.
/** @defgroup Encoder Driver / Incremental encoder
* @brief Driver for an incremental encoder.
*
* This driver uses a timer of the STM32, configured as a quadrature decoder.
*
* Call enc_Init() first in the initialization code. Then, call enc_GetPosition() to
* get the decoded value.
* The output value is the paddle position in degrees, taking the reduction
* ratio into account.
*
* @addtogroup Encoder
* @{
*/
void enc_Init(void);
float32_t enc_GetPosition(void);
void enc_SetPosition(float32_t newPosition);
/**
* @}
*/
#endif
Event Timeline
Log In to Comment