Add bootloader
This commit is contained in:
parent
4f42094b0e
commit
6844ca9a8d
35 changed files with 27266 additions and 13 deletions
42
controller/fw/bootloader/lib/DRV8313/DRV8313.cpp
Normal file
42
controller/fw/bootloader/lib/DRV8313/DRV8313.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#include "DRV8313.h"
|
||||
|
||||
DRV8313Driver::DRV8313Driver(int phA, int phB, int phC, int en1, int en2, int en3, int slp, int rst,
|
||||
int flt) : BLDCDriver3PWM(phA, phB, phC, en1, en2, en3), slp_pin(slp), rst_pin(rst),
|
||||
flt_pin(flt) {
|
||||
}
|
||||
|
||||
int DRV8313Driver::init() {
|
||||
// Get state from flt pin
|
||||
if (_isset(flt_pin)) {
|
||||
pinMode(flt_pin, INPUT);
|
||||
if (digitalRead(flt_pin) == HIGH) {
|
||||
// if the fault pin is high the driver is in fault state
|
||||
// reset the driver
|
||||
if (_isset(rst_pin)) {
|
||||
pinMode(rst_pin, OUTPUT);
|
||||
digitalWrite(rst_pin, LOW);
|
||||
delay(1);
|
||||
digitalWrite(rst_pin, HIGH);
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return BLDCDriver3PWM::init();
|
||||
}
|
||||
|
||||
void DRV8313Driver::enable() {
|
||||
// Enable the driver
|
||||
if (_isset(slp_pin)) {
|
||||
pinMode(slp_pin, OUTPUT);
|
||||
digitalWrite(slp_pin, HIGH);
|
||||
}
|
||||
BLDCDriver3PWM::enable();
|
||||
}
|
||||
|
||||
void DRV8313Driver::disable() {
|
||||
if (_isset(slp_pin)) {
|
||||
pinMode(slp_pin, OUTPUT);
|
||||
digitalWrite(slp_pin, LOW);
|
||||
}
|
||||
BLDCDriver3PWM::disable();
|
||||
}
|
20
controller/fw/bootloader/lib/DRV8313/DRV8313.h
Normal file
20
controller/fw/bootloader/lib/DRV8313/DRV8313.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include "SimpleFOC.h"
|
||||
|
||||
class DRV8313Driver : public BLDCDriver3PWM {
|
||||
public:
|
||||
DRV8313Driver(int phA, int phB, int phC, int en1 = NOT_SET, int en2 = NOT_SET, int en3 = NOT_SET, int slp = NOT_SET,
|
||||
int rst = NOT_SET, int flt = NOT_SET);
|
||||
|
||||
int init() override;
|
||||
|
||||
void enable() override;
|
||||
|
||||
void disable() override;
|
||||
|
||||
private:
|
||||
int slp_pin;
|
||||
int rst_pin;
|
||||
int flt_pin;
|
||||
};
|
10
controller/fw/bootloader/lib/DRV8313/library.properties
Normal file
10
controller/fw/bootloader/lib/DRV8313/library.properties
Normal file
|
@ -0,0 +1,10 @@
|
|||
name=DRV8313 Simple FOC
|
||||
version=1.0.0
|
||||
author=vanyabeat <vanyabeat@protonmail.com>
|
||||
maintainer=vanyabeat <vanyabeat@protonmail.com>
|
||||
sentence=Simple library to work with DRV8313 and Simple FOC (for Robotroller in Robosemmbler)
|
||||
paragraph=Simple library to work with DRV8313 and Simple FOC and simple library intended for hobby comunity to run the BLDC and Stepper motor using FOC algorithm. It is intended to support as many BLDC/Stepper motor+sensor+driver combinations as possible and in the same time maintain simplicity of usage. Library supports Arudino devices such as Arduino UNO, MEGA, NANO and similar, stm32 boards such as Nucleo and Bluepill, ESP32 and Teensy boards.
|
||||
category=Device Control
|
||||
url=https://docs.simplefoc.com
|
||||
architectures=*
|
||||
includes=SimpleFOC.h
|
Loading…
Add table
Add a link
Reference in a new issue