Incomplete library for configuration of a DRV8301 pre-driver through a SPI interface.
DRV8301 is 3-Phase Brushless Motor Pre-Driver with Dual Current Sense Amps and Buck Converter (PWM Ctrl w/ SPI). Please find more information on Texas Instruments web pages and datasheet.
DRV8301.h@0:2825ac4882fd, 2015-11-21 (annotated)
- Committer:
- pantunovi
- Date:
- Sat Nov 21 17:36:16 2015 +0000
- Revision:
- 0:2825ac4882fd
- Child:
- 2:bdca7d22b783
Incomplete version, lacking a valid constructor and input data for write functions in main.cpp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pantunovi | 0:2825ac4882fd | 1 | #ifndef DRV8301_H |
pantunovi | 0:2825ac4882fd | 2 | #define DRV8301_H |
pantunovi | 0:2825ac4882fd | 3 | |
pantunovi | 0:2825ac4882fd | 4 | #include "mbed.h" |
pantunovi | 0:2825ac4882fd | 5 | |
pantunovi | 0:2825ac4882fd | 6 | class DRV8301{ |
pantunovi | 0:2825ac4882fd | 7 | public: |
pantunovi | 0:2825ac4882fd | 8 | DRV8301(PinName MOSI, PinName MISO, PinName SCK); |
pantunovi | 0:2825ac4882fd | 9 | uint8_t input; |
pantunovi | 0:2825ac4882fd | 10 | |
pantunovi | 0:2825ac4882fd | 11 | /* protected: |
pantunovi | 0:2825ac4882fd | 12 | DigitalOut EN_GATE; |
pantunovi | 0:2825ac4882fd | 13 | DigitalOut MOSI; |
pantunovi | 0:2825ac4882fd | 14 | DigitalIn MISO; |
pantunovi | 0:2825ac4882fd | 15 | DigitalOut SCK; |
pantunovi | 0:2825ac4882fd | 16 | */ |
pantunovi | 0:2825ac4882fd | 17 | private: |
pantunovi | 0:2825ac4882fd | 18 | //varijable |
pantunovi | 0:2825ac4882fd | 19 | DigitalOut EN_GATE; |
pantunovi | 0:2825ac4882fd | 20 | DigitalOut MOSI; |
pantunovi | 0:2825ac4882fd | 21 | DigitalIn MISO; |
pantunovi | 0:2825ac4882fd | 22 | DigitalOut SCK; |
pantunovi | 0:2825ac4882fd | 23 | uint16_t register1; |
pantunovi | 0:2825ac4882fd | 24 | uint16_t register2; |
pantunovi | 0:2825ac4882fd | 25 | int maskPWM; |
pantunovi | 0:2825ac4882fd | 26 | int maskOCP; |
pantunovi | 0:2825ac4882fd | 27 | int maskOCTW; |
pantunovi | 0:2825ac4882fd | 28 | int maskGain; |
pantunovi | 0:2825ac4882fd | 29 | int maskCurrentLimit; |
pantunovi | 0:2825ac4882fd | 30 | int registerStatus1; |
pantunovi | 0:2825ac4882fd | 31 | int registerStatus2; |
pantunovi | 0:2825ac4882fd | 32 | //funkcije |
pantunovi | 0:2825ac4882fd | 33 | void startup(); |
pantunovi | 0:2825ac4882fd | 34 | void setCurrentLimit(uint8_t input); |
pantunovi | 0:2825ac4882fd | 35 | void setGain(uint8_t input); |
pantunovi | 0:2825ac4882fd | 36 | void setPWMNumber(uint8_t input); |
pantunovi | 0:2825ac4882fd | 37 | void setOCPMode(uint8_t input); |
pantunovi | 0:2825ac4882fd | 38 | void setOCTW(uint8_t input); |
pantunovi | 0:2825ac4882fd | 39 | uint16_t getRegister1(); |
pantunovi | 0:2825ac4882fd | 40 | uint16_t getRegister2(); |
pantunovi | 0:2825ac4882fd | 41 | |
pantunovi | 0:2825ac4882fd | 42 | }; |
pantunovi | 0:2825ac4882fd | 43 | #endif |