![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
rainbow
setting.h@7:e9086c72bb22, 2019-08-20 (annotated)
- Committer:
- jobuuu
- Date:
- Tue Aug 20 12:27:19 2019 +0000
- Revision:
- 7:e9086c72bb22
- Parent:
- 5:a4319f79457b
- Child:
- 11:82d8768d7351
Updated : 20190820;
Who changed what in which revision?
User | Revision | Line number | New 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 | // pwm |
jobuuu | 2:a1c0a37df760 | 7 | #define PIN_V PB_7 |
jobuuu | 2:a1c0a37df760 | 8 | #define PIN_W PB_6 |
jobuuu | 2:a1c0a37df760 | 9 | //#define PWM_ARR 0x465 // loop 80k, pwm 40k |
jobuuu | 2:a1c0a37df760 | 10 | //#define PWM_ARR 0x8CA // loop 40k, pwm 20k |
jobuuu | 2:a1c0a37df760 | 11 | #define PWM_ARR 0x1194 // loop 20k, pwm 10k |
jobuuu | 2:a1c0a37df760 | 12 | //#define PWM_ARR 0x2328 // loop 10k, pwm 5k |
jobuuu | 2:a1c0a37df760 | 13 | |
jobuuu | 2:a1c0a37df760 | 14 | #define FREQ_5k 5000.0 |
jobuuu | 2:a1c0a37df760 | 15 | #define FREQ_10k 10000.0 |
jobuuu | 2:a1c0a37df760 | 16 | #define FREQ_20k 20000.0 |
jobuuu | 2:a1c0a37df760 | 17 | #define FREQ_40k 40000.0 |
jobuuu | 5:a4319f79457b | 18 | #define DT_5k 0.0002 |
jobuuu | 5:a4319f79457b | 19 | #define DT_10k 0.0001 |
jobuuu | 5:a4319f79457b | 20 | #define DT_20k 0.00005 |
jobuuu | 5:a4319f79457b | 21 | #define DT_40k 0.000025 |
jobuuu | 5:a4319f79457b | 22 | |
jobuuu | 7:e9086c72bb22 | 23 | extern DigitalOut check; |
jobuuu | 7:e9086c72bb22 | 24 | extern DigitalOut check_2; |
jobuuu | 7:e9086c72bb22 | 25 | extern AnalogOut dac_1; |
jobuuu | 7:e9086c72bb22 | 26 | extern AnalogOut dac_2; |
jobuuu | 7:e9086c72bb22 | 27 | |
jobuuu | 2:a1c0a37df760 | 28 | extern double dtc_v; |
jobuuu | 2:a1c0a37df760 | 29 | extern double dtc_w; |
GiJeongKim | 0:51c43836c1d7 | 30 | |
GiJeongKim | 0:51c43836c1d7 | 31 | // I2C |
GiJeongKim | 0:51c43836c1d7 | 32 | extern I2C i2c; // SDA, SCL (for K22F) |
GiJeongKim | 0:51c43836c1d7 | 33 | extern const int i2c_slave_addr1; |
GiJeongKim | 0:51c43836c1d7 | 34 | extern unsigned int value; // 10bit output of reading sensor AS5510 |
GiJeongKim | 0:51c43836c1d7 | 35 | |
GiJeongKim | 0:51c43836c1d7 | 36 | // SPI |
GiJeongKim | 0:51c43836c1d7 | 37 | extern SPI eeprom; //(SPI_MOSI, SPI_MISO, SPI_SCK); |
GiJeongKim | 0:51c43836c1d7 | 38 | extern DigitalOut eeprom_cs; |
GiJeongKim | 0:51c43836c1d7 | 39 | extern SPI enc; |
GiJeongKim | 0:51c43836c1d7 | 40 | extern DigitalOut enc_cs; |
GiJeongKim | 0:51c43836c1d7 | 41 | |
GiJeongKim | 0:51c43836c1d7 | 42 | // UART |
jobuuu | 7:e9086c72bb22 | 43 | extern Serial pc; //Serial pc(PA_9,PA_10); _ UART |
jobuuu | 7:e9086c72bb22 | 44 | |
jobuuu | 7:e9086c72bb22 | 45 | // CAN |
jobuuu | 7:e9086c72bb22 | 46 | extern CAN can; |
jobuuu | 7:e9086c72bb22 | 47 | extern CANMessage msg; |
jobuuu | 7:e9086c72bb22 | 48 | |
jobuuu | 7:e9086c72bb22 | 49 | // Board Information |
jobuuu | 7:e9086c72bb22 | 50 | |
jobuuu | 7:e9086c72bb22 | 51 | |
jobuuu | 7:e9086c72bb22 | 52 | // User Function |
jobuuu | 7:e9086c72bb22 | 53 | |
jobuuu | 7:e9086c72bb22 | 54 | void CurrentControl(); |
jobuuu | 7:e9086c72bb22 | 55 | void ValveControl(unsigned int ControlMode); |