HRI board firmware v2.1 Microcontroller firmware of the board used during the HRI labs.

incr_encoder.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2017 EPFL-LSRO (Laboratoire de Systemes Robotiques).
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __INCR_ENCODERS_H
18 #define __INCR_ENCODERS_H
19
20 #include "../main.h"
21
22 #define CODER_A_Pin GPIO_Pin_0
23 #define CODER_A_Port GPIOA
24 #define CODER_A_PinSource GPIO_PinSource0
25
26 #define CODER_B_Pin GPIO_Pin_1
27 #define CODER_B_Port GPIOA
28 #define CODER_B_PinSource GPIO_PinSource1
29
30 #define CODER_I_Pin GPIO_Pin_3
31 #define CODER_I_Port GPIOE
32
33 #define CODER_RESOLUTION ((uint32_t)2000) // Number of increments per turn.
34
49 void enc_Init(void);
50 float32_t enc_GetPosition(void);
51 void enc_SetPosition(float32_t newPosition);
52
57 #endif
enc_SetPosition
void enc_SetPosition(float32_t newPosition)
Set the position offset.
Definition: incr_encoder.c:60
enc_GetPosition
float32_t enc_GetPosition(void)
Gets the current motor shaft angle, measured by the encoder counter.
Definition: incr_encoder.c:42
enc_Init
void enc_Init(void)
Initialize the incremental encoder driver.
Definition: incr_encoder.c:30