-
-
Save adityakamath/5a5cfde6745c67993a042af2615b6188 to your computer and use it in GitHub Desktop.
Feetech Write PWM (Mode 2) functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int SMS_STS::RegWritePwm(u8 ID, s16 Pwm) | |
{ | |
if(Pwm<0){ | |
Pwm = -Pwm; | |
Pwm |= (1<<10); | |
} | |
u8 bBuf[2]; | |
Host2SCS(bBuf+0, bBuf+1, Pwm); | |
return regWrite(ID, SMS_STS_GOAL_TIME_L, bBuf, 2); | |
} | |
void SMS_STS::SyncWritePwm(u8 ID[], u8 IDN, s16 Pwm[]) | |
{ | |
u8 offbuf[IDN][2]; | |
for(u8 i = 0; i<IDN; i++){ | |
if(Pwm[i]<0){ | |
Pwm[i] = -Pwm[i]; | |
Pwm[i] |= (1<<10); | |
} | |
u8 bBuf[2]; | |
Host2SCS(bBuf+0, bBuf+1, Pwm[i]); | |
memcpy(offbuf[i], bBuf, 2); | |
} | |
syncWrite(ID, IDN, SMS_STS_GOAL_TIME_L, (u8*)offbuf, 2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment