fix missing inits in motors and encoders
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "drvEncoder.h"
|
||||
#include "hwTIM.c"
|
||||
|
||||
|
||||
extern TIM_HandleTypeDef htim1;
|
||||
@@ -8,6 +9,8 @@ extern TIM_HandleTypeDef htim4;
|
||||
|
||||
|
||||
void drvEncoder_Init(void) {
|
||||
HW_TIM_Init();
|
||||
|
||||
HAL_TIM_Encoder_Start(&htim1, TIM_CHANNEL_ALL);
|
||||
HAL_TIM_Encoder_Start(&htim2, TIM_CHANNEL_ALL);
|
||||
HAL_TIM_Encoder_Start(&htim3, TIM_CHANNEL_ALL);
|
||||
|
||||
@@ -205,7 +205,7 @@ void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* tim_encoderHandle)
|
||||
}
|
||||
}
|
||||
|
||||
void HW_TIM_init(void)
|
||||
void HW_TIM_Init(void)
|
||||
{
|
||||
MX_TIM1_Init();
|
||||
MX_TIM2_Init();
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "main.h"
|
||||
|
||||
extern TIM_HandleTypeDef htim1;
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
extern TIM_HandleTypeDef htim3;
|
||||
extern TIM_HandleTypeDef htim4;
|
||||
|
||||
void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* tim_encoderHandle);
|
||||
void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* tim_encoderHandle);
|
||||
void HW_TIM_Init(void);
|
||||
@@ -3,6 +3,7 @@ set(KPI_Rover_Motors_Inc
|
||||
)
|
||||
|
||||
set(KPI_Rover_Motors_Src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hwI2C2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drvMotors.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PCA9685.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ulGD.c
|
||||
|
||||
@@ -61,6 +61,8 @@ static void pca9685_write4(uint8_t reg, uint16_t on, uint16_t off)
|
||||
*/
|
||||
bool PCA9685_Init(void)
|
||||
{
|
||||
HW_I2C2_Init();
|
||||
|
||||
/* 1. Reset device (Wake up) */
|
||||
pca9685_write(MODE1, 0x00);
|
||||
HAL_Delay(10);
|
||||
|
||||
Reference in New Issue
Block a user