45

Dependencies:   mbed BufferedSerial LS7366LIB FastPWM

Revision:
0:c21936a3520a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.h	Mon Mar 23 08:38:40 2020 +0000
@@ -0,0 +1,104 @@
+double Speed_Igain[6]={ 0.1,
+                        0.1,
+                        0.1,
+                        0.1,
+                        0.1,
+                        0.1};
+double Speed_Pgain[6]={ 5,
+                        5,
+                        5,
+                        5,
+                        5,
+                        5};
+double Position_input_filter[6]
+                     ={ 0.05,
+                        0.05,
+                        0.05,
+                        0.05,
+                        0.05,
+                        0.05};
+
+double position_Pgain[6]
+                     ={ 20,
+                        20,
+                        20,
+                        20,
+                        20,
+                        20};
+
+double offset[6]={      1480,
+                        1480,
+                        1480,
+                        1480,
+                        1480,
+                        1480};
+                        
+double Speed_I_input_filter[6]
+                     ={ 0.005,
+                        0.005,
+                        0.005,
+                        0.005,
+                        0.005,
+                        0.005};
+
+
+// SPI
+#define SPI_MOSI1       PA_7
+#define SPI_MISO1       PA_6
+#define SPI_SCK1        PA_5
+
+// Encoder
+#define ENCODER_CS1     PB_0
+#define ENCODER_CS2     PC_1
+#define ENCODER_CS3     PC_0
+#define ENCODER_CS4     PB_15
+#define ENCODER_CS5     PB_14
+#define ENCODER_CS6     PB_13
+
+// Limit switch
+
+#define LIMIT_SW1       PC_3
+#define LIMIT_SW2       PC_2
+#define LIMIT_SW3       PC_5
+#define LIMIT_SW4       PC_9
+#define LIMIT_SW5       PC_6
+#define LIMIT_SW6       PC_8
+
+// Motor
+#define MOTOR_PWM1      PA_15
+#define MOTOR_PWM2      PA_9
+#define MOTOR_PWM3      PA_8
+#define MOTOR_PWM4      PB_10
+#define MOTOR_PWM5      PB_3
+#define MOTOR_PWM6      PA_10
+
+#include "spi_setup.h"
+#include "motor.h"
+#include "encoder.h"
+#include "timer.h"
+#include "speed_pid.h"
+#include "target_position_cal.h"
+#include "Position.h"
+#include "pc_serial.h"
+#include "limit.h"
+//#include "SPI_TO_UART.h"
+
+
+void board_init()
+{
+    /*
+    set_data[1]=Speed_Igain;
+    set_data[2]=Speed_Pgain;
+    set_data[4]=Position_input_filter;
+    set_data[5]=position_Pgain1;
+    set_data[6]=position_Pgain2;
+    set_data[7]=position_Pgain3;
+    set_data[8]=offset;
+    */
+    limit_init();
+    SPI_INIT();
+    motor_init();
+    Serial_Init();
+    timer_init();
+    
+}
\ No newline at end of file