2018-08-08 20:59:10 +02:00
|
|
|
/*
|
|
|
|
* riscv-bldc.h
|
|
|
|
*
|
|
|
|
* Created on: 28.07.2018
|
|
|
|
* Author: eyck
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RISCV_BLDC_H_
|
|
|
|
#define RISCV_BLDC_H_
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
extern uint32_t pwm;
|
|
|
|
extern uint32_t DRIVE_PORT;
|
|
|
|
|
|
|
|
enum {
|
2018-09-14 14:03:20 +02:00
|
|
|
UL=1, //! Port pin connected to phase U, low side enable switch.
|
|
|
|
UH=0, //! Port pin connected to phase U, high side enable switch.
|
|
|
|
VL=11, //! Port pin connected to phase V, low side enable switch.
|
|
|
|
VH=10, //! Port pin connected to phase V, high side enable switch.
|
|
|
|
WL=19, //! Port pin connected to phase W, low side enable switch.
|
|
|
|
WH=20, //! Port pin connected to phase W, high side enable switch.
|
2018-10-16 18:51:48 +02:00
|
|
|
SENSU_P=0, //! Phase U voltage to sense positive zero cross
|
|
|
|
SENSV_P=1, //! Phase V voltage to sense positive zero cross
|
|
|
|
SENSW_P=2, //! Phase W voltage to sense positive zero cross
|
|
|
|
SENSU_N=4, //! Phase U voltage to sense negative zero cross
|
|
|
|
SENSV_N=5, //! Phase V voltage to sense negative zero cross
|
|
|
|
SENSW_N=6, //! Phase W voltage to sense negative zero cross
|
2018-09-14 14:03:20 +02:00
|
|
|
DRIVE_MASK=(1<<UL)|(1<<UH)| (1<<VL)|(1<<VH)| (1<<WL)|(1<<WH)
|
2018-08-08 20:59:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
2018-10-21 22:29:45 +02:00
|
|
|
* Number of 10 microseconds to lock rotor in first commutation step before
|
2018-08-08 20:59:10 +02:00
|
|
|
* the timed startup sequence is initiated.
|
|
|
|
*/
|
2018-10-21 22:29:45 +02:00
|
|
|
const auto STARTUP_DELAY=25000U;
|
2018-09-14 14:03:20 +02:00
|
|
|
|
|
|
|
extern "C" void handle_m_ext_interrupt();
|
|
|
|
extern "C" void handle_m_time_interrupt();
|
2018-08-08 20:59:10 +02:00
|
|
|
|
|
|
|
#endif /* RISCV_BLDC_H_ */
|