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@4:98c76c7b8020, 2015-11-24 (annotated)
- Committer:
- pantunovi
- Date:
- Tue Nov 24 13:50:20 2015 +0000
- Revision:
- 4:98c76c7b8020
- Parent:
- 3:227ecd07b9cd
- Child:
- 5:57bbd3728fd0
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 | 3:227ecd07b9cd | 8 | DRV8301(PinName cs, PinName mosi, PinName miso, PinName sck, PinName en_gate); |
pantunovi | 4:98c76c7b8020 | 9 | uint8_t input; |
pantunovi | 4:98c76c7b8020 | 10 | |
pantunovi | 4:98c76c7b8020 | 11 | void startup(); |
pantunovi | 4:98c76c7b8020 | 12 | void setCurrentLimit(uint8_t input); |
pantunovi | 4:98c76c7b8020 | 13 | void setGain(uint8_t input); |
pantunovi | 4:98c76c7b8020 | 14 | void setPWMNumber(uint8_t input); |
pantunovi | 4:98c76c7b8020 | 15 | void setOCPMode(uint8_t input); |
pantunovi | 4:98c76c7b8020 | 16 | void setOCTW(uint8_t input); |
pantunovi | 4:98c76c7b8020 | 17 | uint16_t getRegister1(); |
pantunovi | 4:98c76c7b8020 | 18 | uint16_t getRegister2(); |
pantunovi | 4:98c76c7b8020 | 19 | uint16_t readStatReg1(); |
pantunovi | 4:98c76c7b8020 | 20 | uint16_t readStatReg2(); |
pantunovi | 0:2825ac4882fd | 21 | private: |
pantunovi | 0:2825ac4882fd | 22 | //varijable |
pantunovi | 3:227ecd07b9cd | 23 | DigitalOut cs; |
pantunovi | 3:227ecd07b9cd | 24 | DigitalOut mosi; |
pantunovi | 3:227ecd07b9cd | 25 | DigitalIn miso; |
pantunovi | 3:227ecd07b9cd | 26 | DigitalOut sck; |
pantunovi | 3:227ecd07b9cd | 27 | DigitalOut en_gate; |
pantunovi | 0:2825ac4882fd | 28 | uint16_t register1; |
pantunovi | 0:2825ac4882fd | 29 | uint16_t register2; |
pantunovi | 0:2825ac4882fd | 30 | int maskPWM; |
pantunovi | 0:2825ac4882fd | 31 | int maskOCP; |
pantunovi | 0:2825ac4882fd | 32 | int maskOCTW; |
pantunovi | 0:2825ac4882fd | 33 | int maskGain; |
pantunovi | 0:2825ac4882fd | 34 | int maskCurrentLimit; |
pantunovi | 3:227ecd07b9cd | 35 | uint16_t statReg1; |
pantunovi | 3:227ecd07b9cd | 36 | uint16_t statReg2; |
pantunovi | 3:227ecd07b9cd | 37 | uint16_t registerStatus1; |
pantunovi | 3:227ecd07b9cd | 38 | uint16_t registerStatus2; |
pantunovi | 0:2825ac4882fd | 39 | //funkcije |
pantunovi | 4:98c76c7b8020 | 40 | |
pantunovi | 3:227ecd07b9cd | 41 | |
pantunovi | 0:2825ac4882fd | 42 | }; |
pantunovi | 0:2825ac4882fd | 43 | #endif |