eeprom_test

Dependencies:   mbed FastPWM

Committer:
jobuuu
Date:
Tue Aug 20 10:12:00 2019 +0000
Revision:
5:a4319f79457b
Parent:
2:a1c0a37df760
Child:
7:e9086c72bb22
dd

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 5:a4319f79457b 23 #define DT_5k 0.0002
jobuuu 5:a4319f79457b 24 #define DT_10k 0.0001
jobuuu 5:a4319f79457b 25 #define DT_20k 0.00005
jobuuu 5:a4319f79457b 26 #define DT_40k 0.000025
jobuuu 5:a4319f79457b 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
GiJeongKim 0:51c43836c1d7 43 extern Serial pc; //Serial pc(PA_9,PA_10); _ UART