A PWM library for LPC1768 that enables the sending of n number of PWM impulses through registry editing of LPC1768.

Files at this revision

API Documentation at this revision

Comitter:
mcmrk
Date:
Thu Oct 27 08:00:58 2016 +0000
Parent:
1:ce44c89d1128
Commit message:
updated nImpulse function. sets PWMMR0S bit to its original state

Changed in this revision

TruePWM.cpp Show annotated file Show diff for this revision Revisions of this file
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);
 }