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

42 lines
1.3 KiB
C
Raw Normal View History

/*
* 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.
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)
};
/*!
* Number of 10 microseconds to lock rotor in first commutation step before
* the timed startup sequence is initiated.
*/
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();
#endif /* RISCV_BLDC_H_ */