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@2:bdca7d22b783, 2015-11-23 (annotated)
- Committer:
- pantunovi
- Date:
- Mon Nov 23 13:14:48 2015 +0000
- Revision:
- 2:bdca7d22b783
- Parent:
- 0:2825ac4882fd
- Child:
- 3:227ecd07b9cd
Somewhat improved but still incomplete, still problems with class constructor
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 | private: |
pantunovi | 0:2825ac4882fd | 11 | //varijable |
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 | uint16_t register1; |
pantunovi | 0:2825ac4882fd | 17 | uint16_t register2; |
pantunovi | 0:2825ac4882fd | 18 | int maskPWM; |
pantunovi | 0:2825ac4882fd | 19 | int maskOCP; |
pantunovi | 0:2825ac4882fd | 20 | int maskOCTW; |
pantunovi | 0:2825ac4882fd | 21 | int maskGain; |
pantunovi | 0:2825ac4882fd | 22 | int maskCurrentLimit; |
pantunovi | 2:bdca7d22b783 | 23 | //int registerStatus1; |
pantunovi | 2:bdca7d22b783 | 24 | //int registerStatus2; |
pantunovi | 0:2825ac4882fd | 25 | //funkcije |
pantunovi | 0:2825ac4882fd | 26 | void startup(); |
pantunovi | 0:2825ac4882fd | 27 | void setCurrentLimit(uint8_t input); |
pantunovi | 0:2825ac4882fd | 28 | void setGain(uint8_t input); |
pantunovi | 0:2825ac4882fd | 29 | void setPWMNumber(uint8_t input); |
pantunovi | 0:2825ac4882fd | 30 | void setOCPMode(uint8_t input); |
pantunovi | 0:2825ac4882fd | 31 | void setOCTW(uint8_t input); |
pantunovi | 0:2825ac4882fd | 32 | uint16_t getRegister1(); |
pantunovi | 2:bdca7d22b783 | 33 | uint16_t getRegister2(); |
pantunovi | 0:2825ac4882fd | 34 | }; |
pantunovi | 0:2825ac4882fd | 35 | #endif |