rainbow

Dependencies:   mbed FastPWM

Committer:
jobuuu
Date:
Tue Aug 20 07:38:55 2019 +0000
Revision:
2:a1c0a37df760
Parent:
0:51c43836c1d7
Child:
5:a4319f79457b
HydraulicControlBoard_190820

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GiJeongKim 0:51c43836c1d7 1 #include "mbed.h"
GiJeongKim 0:51c43836c1d7 2 #include "FastPWM.h"
GiJeongKim 0:51c43836c1d7 3
jobuuu 2:a1c0a37df760 4 #define PI 3.141592
jobuuu 2:a1c0a37df760 5
GiJeongKim 0:51c43836c1d7 6 extern DigitalOut check;
GiJeongKim 0:51c43836c1d7 7 extern DigitalOut check_2;
GiJeongKim 0:51c43836c1d7 8 extern AnalogOut dac_1;
GiJeongKim 0:51c43836c1d7 9 extern AnalogOut dac_2;
GiJeongKim 0:51c43836c1d7 10
GiJeongKim 0:51c43836c1d7 11 // pwm
jobuuu 2:a1c0a37df760 12 #define PIN_V PB_7
jobuuu 2:a1c0a37df760 13 #define PIN_W PB_6
jobuuu 2:a1c0a37df760 14 //#define PWM_ARR 0x465 // loop 80k, pwm 40k
jobuuu 2:a1c0a37df760 15 //#define PWM_ARR 0x8CA // loop 40k, pwm 20k
jobuuu 2:a1c0a37df760 16 #define PWM_ARR 0x1194 // loop 20k, pwm 10k
jobuuu 2:a1c0a37df760 17 //#define PWM_ARR 0x2328 // loop 10k, pwm 5k
jobuuu 2:a1c0a37df760 18
jobuuu 2:a1c0a37df760 19 #define FREQ_5k 5000.0
jobuuu 2:a1c0a37df760 20 #define FREQ_10k 10000.0
jobuuu 2:a1c0a37df760 21 #define FREQ_20k 20000.0
jobuuu 2:a1c0a37df760 22 #define FREQ_40k 40000.0
jobuuu 2:a1c0a37df760 23 extern double dtc_v;
jobuuu 2:a1c0a37df760 24 extern double dtc_w;
GiJeongKim 0:51c43836c1d7 25
GiJeongKim 0:51c43836c1d7 26 // I2C
GiJeongKim 0:51c43836c1d7 27 extern I2C i2c; // SDA, SCL (for K22F)
GiJeongKim 0:51c43836c1d7 28 extern const int i2c_slave_addr1;
GiJeongKim 0:51c43836c1d7 29 extern unsigned int value; // 10bit output of reading sensor AS5510
GiJeongKim 0:51c43836c1d7 30
GiJeongKim 0:51c43836c1d7 31 // SPI
GiJeongKim 0:51c43836c1d7 32 extern SPI eeprom; //(SPI_MOSI, SPI_MISO, SPI_SCK);
GiJeongKim 0:51c43836c1d7 33 extern DigitalOut eeprom_cs;
GiJeongKim 0:51c43836c1d7 34 extern SPI enc;
GiJeongKim 0:51c43836c1d7 35 extern DigitalOut enc_cs;
GiJeongKim 0:51c43836c1d7 36
GiJeongKim 0:51c43836c1d7 37 // UART
GiJeongKim 0:51c43836c1d7 38 extern Serial pc; //Serial pc(PA_9,PA_10); _ UART