mirror of
https://github.com/cnlohr/lolra.git
synced 2026-06-17 00:09:31 +00:00
Ok, done for 27MHz
This commit is contained in:
@@ -91,18 +91,13 @@ SOFTWARE.
|
|||||||
Calculated to use the 19.75th harmonic @ 27.08571429MHz, but ideal found at 27.08643MHz
|
Calculated to use the 19.75th harmonic @ 27.08571429MHz, but ideal found at 27.08643MHz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Q 2080
|
#define Q 1000
|
||||||
|
|
||||||
|
#define PWM_PERIOD (28-1) //For 27.000500MHz
|
||||||
// For Quadrature - use 30
|
//#define QUADRATURE
|
||||||
// For nonquadrature use 40.
|
|
||||||
|
|
||||||
#define PWM_PERIOD (28-1) //For 27MHz
|
|
||||||
#define QUADRATURE
|
|
||||||
//#define TIGHT_OUT
|
//#define TIGHT_OUT
|
||||||
//#define DUMPBUFF
|
//#define DUMPBUFF
|
||||||
|
#define PWM_OUTPUT 7
|
||||||
#define PWM_OUTPUT 9
|
|
||||||
|
|
||||||
//#define PWM_PERIOD (32-1)
|
//#define PWM_PERIOD (32-1)
|
||||||
//#define QUADRATURE
|
//#define QUADRATURE
|
||||||
@@ -283,14 +278,15 @@ void InnerLoop()
|
|||||||
int s = 1<<( ( 32 - __builtin_clz(is) )/2);
|
int s = 1<<( ( 32 - __builtin_clz(is) )/2);
|
||||||
s = (s + is/s)/2;
|
s = (s + is/s)/2;
|
||||||
|
|
||||||
|
#ifdef TIGHT_OUT
|
||||||
|
printf( "%d\n", is );
|
||||||
|
#elif defined( PWM_OUTPUT )
|
||||||
|
|
||||||
|
|
||||||
int tv = (i>>PWM_OUTPUT) + (PWM_PERIOD/2);
|
int tv = (i>>PWM_OUTPUT) + (PWM_PERIOD/2);
|
||||||
if( tv < 0 ) tv = 0;
|
if( tv < 0 ) tv = 0;
|
||||||
if( tv >= PWM_PERIOD ) tv = PWM_PERIOD-1;
|
if( tv >= PWM_PERIOD ) tv = PWM_PERIOD-1;
|
||||||
|
|
||||||
#ifdef TIGHT_OUT
|
|
||||||
printf( "%d\n", tv );
|
|
||||||
#elif defined( PWM_OUTPUT )
|
|
||||||
TIM1->CH4CVR = tv;
|
TIM1->CH4CVR = tv;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user