Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-dev-f303 FastPWM3
Diff: DRV8323/DRV.cpp
- Revision:
- 58:4f8f58ecb52a
- Parent:
- 57:f3336e9eb1f2
- Child:
- 59:b41cbfa3b30e
diff -r f3336e9eb1f2 -r 4f8f58ecb52a DRV8323/DRV.cpp
--- a/DRV8323/DRV.cpp Wed Sep 22 08:36:54 2021 +0000
+++ b/DRV8323/DRV.cpp Wed Sep 22 09:30:48 2021 +0000
@@ -1,6 +1,15 @@
#include "mbed.h"
#include "DRV.h"
+#include "structs.h"
+#include "foc.h"
+#include "hw_setup.h"
+#include "hw_config.h"
+#include "motor_config.h"
+#include "stm32f4xx_flash.h"
+#include "CAN_com.h"
+
+
DRV832x::DRV832x(SPI *spi, DigitalOut *cs){
_spi = spi;
_cs = cs;
@@ -67,7 +76,8 @@
}
-void DRV832x::print_faults(void)
+CANMessage txMsg_liu;
+void DRV832x::print_faults(CAN *_can)
{
uint16_t val1 = read_FSR1();
wait_us(10);
@@ -99,11 +109,20 @@
if(val2 & (1<<1)){printf("VGS_HC\n\r");}
if(val2 & (1)){printf("VGS_LC\n\r");}
-
+ if(val1 >0 || val2>0)
+ {
+ txMsg_liu.id = 10;
+ txMsg_liu.data[0] = (val1>>8)&0xff;
+ txMsg_liu.data[1] = (val1)&0xff;
+ txMsg_liu.data[2] = (val2>>8)&0xff;
+ txMsg_liu.data[3] = (val2)&0xff;
+ txMsg_liu.len = 4;
+ _can->write(txMsg_liu);
+
}
-
+}
void DRV832x::enable_gd(void)
{
uint16_t val = (read_register(DCR)) & (~(0x1<<2));