mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-13 15:49:20 +08:00
48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef __LOW_LEVEL_H
|
|
#define __LOW_LEVEL_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include <cmsis_os.h>
|
|
#include <stdbool.h>
|
|
#include <adc.h>
|
|
|
|
/* Exported types ------------------------------------------------------------*/
|
|
|
|
typedef struct{
|
|
int type;
|
|
int index;
|
|
} monitoring_slot;
|
|
|
|
/* Exported constants --------------------------------------------------------*/
|
|
extern const float elec_rad_per_enc;
|
|
/* Exported variables --------------------------------------------------------*/
|
|
/* Exported macro ------------------------------------------------------------*/
|
|
/* Exported functions --------------------------------------------------------*/
|
|
|
|
//Note: to control without feed forward, set feed forward terms to 0.0f.
|
|
|
|
void pwm_trig_adc_cb(ADC_HandleTypeDef* hadc, bool injected);
|
|
void vbus_sense_adc_cb(ADC_HandleTypeDef* hadc, bool injected);
|
|
|
|
// Utility
|
|
void global_fault(int error);
|
|
// Initalisation
|
|
void start_adc_pwm();
|
|
void start_pwm(TIM_HandleTypeDef* htim);
|
|
void sync_timers(TIM_HandleTypeDef* htim_a, TIM_HandleTypeDef* htim_b,
|
|
uint16_t TIM_CLOCKSOURCE_ITRx, uint16_t count_offset);
|
|
|
|
void update_brake_current();
|
|
void set_brake_current(float brake_current);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif //__LOW_LEVEL_H
|