TEST_CODE_ApplyTo2V1_API

Dependencies:   SDFileSystem max32630fthr USBDevice

Committer:
china_sn0w
Date:
Tue Jul 28 01:40:05 2020 +0000
Revision:
4:217334c3a5b2
Parent:
1:7530b7eb757a
A

Who changed what in which revision?

UserRevisionLine numberNew contents of line
china_sn0w 1:7530b7eb757a 1 #include "mbed.h"
china_sn0w 1:7530b7eb757a 2 #include "max32630fthr.h"
china_sn0w 1:7530b7eb757a 3 #include "USBSerial.h"
china_sn0w 1:7530b7eb757a 4 #include "I2CSlave.h"
china_sn0w 1:7530b7eb757a 5 #include "CmdHandler.h"
china_sn0w 1:7530b7eb757a 6 #include "DUT_RegConfig.h"
china_sn0w 1:7530b7eb757a 7 #include "AVDD_CONFIG.h"
china_sn0w 1:7530b7eb757a 8 #include "ServoRun.h"
china_sn0w 1:7530b7eb757a 9
china_sn0w 1:7530b7eb757a 10 extern DigitalOut PULSE;
china_sn0w 1:7530b7eb757a 11 extern DigitalOut DI;
china_sn0w 1:7530b7eb757a 12
china_sn0w 4:217334c3a5b2 13 float servo_run = 0;
china_sn0w 1:7530b7eb757a 14
china_sn0w 1:7530b7eb757a 15 void ServoRunThread(void)
china_sn0w 1:7530b7eb757a 16 {
china_sn0w 1:7530b7eb757a 17 uint32_t step = 0;
china_sn0w 1:7530b7eb757a 18
china_sn0w 1:7530b7eb757a 19 while(1)
china_sn0w 1:7530b7eb757a 20 {
china_sn0w 1:7530b7eb757a 21 if(servo_run)
china_sn0w 1:7530b7eb757a 22 {
china_sn0w 4:217334c3a5b2 23 step = servo_run * 40;//1M Stage
china_sn0w 4:217334c3a5b2 24 //step = servo_run * 30.30303030;//2M Stage
china_sn0w 1:7530b7eb757a 25 while(step--)
china_sn0w 1:7530b7eb757a 26 {
china_sn0w 1:7530b7eb757a 27 PULSE = 1;
china_sn0w 1:7530b7eb757a 28 wait_ms(1);
china_sn0w 1:7530b7eb757a 29 PULSE = 0;
china_sn0w 1:7530b7eb757a 30 wait_ms(1);
china_sn0w 1:7530b7eb757a 31 }
china_sn0w 1:7530b7eb757a 32 servo_run = 0;
china_sn0w 1:7530b7eb757a 33 }
china_sn0w 1:7530b7eb757a 34 wait_ms(100);
china_sn0w 1:7530b7eb757a 35 }
china_sn0w 1:7530b7eb757a 36 }
china_sn0w 1:7530b7eb757a 37
china_sn0w 1:7530b7eb757a 38 void ServoRun(uint8_t dir, uint32_t mm)
china_sn0w 1:7530b7eb757a 39 {
china_sn0w 1:7530b7eb757a 40 DI = dir;
china_sn0w 1:7530b7eb757a 41 servo_run = mm;
china_sn0w 1:7530b7eb757a 42 }
china_sn0w 1:7530b7eb757a 43
china_sn0w 1:7530b7eb757a 44 uint32_t CheckUntil(void)
china_sn0w 1:7530b7eb757a 45 {
china_sn0w 1:7530b7eb757a 46 return servo_run;
china_sn0w 1:7530b7eb757a 47 }
china_sn0w 1:7530b7eb757a 48