A PWM library for LPC1768 that enables the sending of n number of PWM impulses through registry editing of LPC1768.
Diff: TruePWM.cpp
- Revision:
- 2:881243185b6a
- Parent:
- 0:b3a0656d2b6e
diff -r ce44c89d1128 -r 881243185b6a TruePWM.cpp --- a/TruePWM.cpp Thu Oct 20 13:55:29 2016 +0000 +++ b/TruePWM.cpp Thu Oct 27 08:00:58 2016 +0000 @@ -127,6 +127,7 @@ void TruePWM::nImpulse(int n) { //Sends n number of impulses if(LPC_PWM1->TCR != 0x00000009) LPC_PWM1->TCR = 0x00000009; + LPC_PWM1->MCR &= ~0x4; //resets PWMR0S bit to its original state (0) so nImpulse can be called again without problems float m= LPC_PWM1->MR0*n; t0.attach_us(this,&TruePWM::stopPWM, m); }