2022-02-19 06:37:12 -08:00
|
|
|
/*
|
|
|
|
Copyright 2016 - 2022 Benjamin Vedder benjamin@vedder.se
|
|
|
|
Copyright 2022 Jakub Tomczak
|
|
|
|
|
|
|
|
This file is part of the VESC firmware.
|
|
|
|
|
|
|
|
The VESC firmware is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
The VESC firmware is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-01-09 08:10:40 -08:00
|
|
|
#ifndef ENCODER_ENCODER_H_
|
|
|
|
#define ENCODER_ENCODER_H_
|
|
|
|
|
|
|
|
#include "hal.h"
|
2022-02-19 09:51:34 -08:00
|
|
|
#include "encoder_datatype.h"
|
|
|
|
#include "TS5700N8501.h"
|
|
|
|
#include "AS504x.h"
|
|
|
|
#include "MT6816.h"
|
|
|
|
#include "ENC_SINCOS.h"
|
|
|
|
#include "AD2S1205.h"
|
2022-01-09 08:10:40 -08:00
|
|
|
|
|
|
|
// GENERIC GLOBAL
|
|
|
|
void encoder_deinit(void);
|
2022-02-19 09:51:34 -08:00
|
|
|
encoder_ret_t encoder_init(volatile mc_configuration *conf);
|
2022-01-09 08:10:40 -08:00
|
|
|
|
|
|
|
float encoder_read_deg(void);
|
|
|
|
float encoder_read_deg_multiturn(void);
|
|
|
|
encoder_type_t encoder_is_configured(void);
|
|
|
|
bool encoder_index_found(void);
|
|
|
|
void encoder_reset_multiturn(void);
|
|
|
|
void encoder_reset_errors(void);
|
|
|
|
|
2022-02-19 09:51:34 -08:00
|
|
|
void encoder_check_faults(volatile mc_configuration *m_conf, bool is_second_motor);
|
2022-01-09 08:10:40 -08:00
|
|
|
|
2022-02-19 09:51:34 -08:00
|
|
|
// Interrupt handlers
|
|
|
|
void encoder_pin_isr(void);
|
2022-01-09 08:10:40 -08:00
|
|
|
void encoder_tim_isr(void);
|
|
|
|
|
|
|
|
#endif /* ENCODER_ENCODER_H_ */
|