Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Functions.cpp
00001 #include "Functions.h" 00002 #include "PinAssign.h" 00003 #include "GlobalVars.h" 00004 00005 Timeout pwm_7; 00006 Timeout pwm_8; 00007 float pwm_t7; 00008 float pwm_t8; 00009 void pwmout7(void) {pwm7 = 0;} 00010 void pwmout8(void) {pwm8 = 0;} 00011 00012 void Proc(void) 00013 { 00014 if(RcvBit&0x80) var1=OPENPWM; 00015 if(RcvBit&0x40) var2=OPENPWM; 00016 if(RcvBit&0x20) var3=OPENPWM; 00017 if(RcvBit&0x10) var4=OPENPWM; 00018 if(RcvBit&0x08) var5=OPENPWM; 00019 if(RcvBit&0x04) var6=OPENPWM; 00020 if(RcvBit&0x02) var7=OPENPWM; 00021 if(RcvBit&0x01) var8=OPENPWM; 00022 } 00023 void RcvProc(void) 00024 { 00025 unsigned char buf; 00026 00027 buf=Switch.getc(); 00028 00029 if((RcvCnt==1||RcvCnt==2)&&buf==0xfe) RcvCnt++; 00030 else if(RcvCnt==3){RcvBit=buf; RcvCnt++;} 00031 else if(RcvCnt==4&&RcvBit==buf) RcvCnt++; 00032 else if(RcvCnt==5&&buf==0xff) RcvCnt++; 00033 else if(RcvCnt==6&&buf==0xff) {RcvCnt=1; Proc();} 00034 else RcvCnt=1; 00035 } 00036 void SndPWM(void) 00037 { 00038 pwm_t7 = var7*0.000001f; 00039 pwm_t8 = var8*0.000001f; 00040 00041 pwm1.pulsewidth_us(var1); 00042 pwm2.pulsewidth_us(var2); 00043 pwm3.pulsewidth_us(var3); 00044 pwm4.pulsewidth_us(var4); 00045 pwm5.pulsewidth_us(var5); 00046 pwm6.pulsewidth_us(var6); 00047 00048 pwm7 = 1; 00049 pwm_7.attach(&pwmout7, pwm_t7); 00050 pwm8 = 1; 00051 pwm_8.attach(&pwmout8, pwm_t8); 00052 } 00053 void InitPWM(void) 00054 { 00055 var1=CLOSEPWM; 00056 var2=CLOSEPWM; 00057 var3=CLOSEPWM; 00058 var4=CLOSEPWM; 00059 var5=CLOSEPWM; 00060 var6=CLOSEPWM; 00061 var7=CLOSEPWM; 00062 var8=CLOSEPWM; 00063 }
Generated on Sun Jul 17 2022 21:29:30 by
1.7.2