Firmwares/riscv-bldc-forced-commutation/src/riscv-bldc.h

42 lines
1.3 KiB
C++

/*
* 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 {
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.
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
DRIVE_MASK=(1<<UL)|(1<<UH)| (1<<VL)|(1<<VH)| (1<<WL)|(1<<WH)
};
/*!
* Number of 10 microseconds to lock rotor in first commutation step before
* the timed startup sequence is initiated.
*/
const auto STARTUP_DELAY=25000U;
extern "C" void handle_m_ext_interrupt();
extern "C" void handle_m_time_interrupt();
#endif /* RISCV_BLDC_H_ */