int32_t frequencyTicks = 65535;\r
int32_t dutyCycle = CFG_PWM_DEFAULT_DUTYCYCLE;\r
\r
- if(argc > 0) {\r
- getNumber (argv[0], &dutyCycle);\r
- if(dutyCycle < 1 || dutyCycle > 100) {\r
- printf("Invalid duty cycle [1..65535]%s", CFG_PRINTF_NEWLINE);\r
- return;\r
- }\r
-\r
- if(argc > 1) {\r
- getNumber (argv[1], &frequencyTicks);\r
- if(frequencyTicks < 0 || frequencyTicks > 0xffff) {\r
- printf("Invalid frequency [1..65535]%s", CFG_PRINTF_NEWLINE);\r
- return;\r
- }\r
- } else {\r
- frequencyTicks = 65535;\r
- }\r
- } else {\r
- dutyCycle = CFG_PWM_DEFAULT_DUTYCYCLE;\r
+ getNumber (argv[0], &dutyCycle);\r
+ if(dutyCycle < 1 || dutyCycle > 100) \r
+ {\r
+ printf("Invalid duty cycle [1..65535]%s", CFG_PRINTF_NEWLINE);\r
+ return;\r
}\r
\r
- if(! pwmStarted) {\r
- printf("Initializing PWM%s", CFG_PRINTF_NEWLINE);\r
- pwmInit();\r
+ getNumber (argv[1], &frequencyTicks);\r
+ if(frequencyTicks < 0 || frequencyTicks > 0xffff) \r
+ {\r
+ printf("Invalid frequency [1..65535]%s", CFG_PRINTF_NEWLINE);\r
+ return;\r
}\r
- \r
- printf("Setting frequency ticks to %u%s", (uint16_t) frequencyTicks, CFG_PRINTF_NEWLINE);\r
+\r
+ printf("Setting frequency: %u ticks%s", (uint16_t) frequencyTicks, CFG_PRINTF_NEWLINE);\r
pwmSetFrequencyInTicks(frequencyTicks);\r
- printf("Setting duty cycle to %u%s", (uint16_t) dutyCycle, CFG_PRINTF_NEWLINE);\r
+ printf("Setting duty cycle: %u%%%s", (uint16_t) dutyCycle, CFG_PRINTF_NEWLINE);\r
pwmSetDutyCycle(dutyCycle);\r
- if(! pwmStarted) {\r
- pwmStart();\r
- pwmStarted = 1;\r
+ if(! pwmStarted) \r
+ {\r
+ printf("Initializing PWM%s", CFG_PRINTF_NEWLINE);\r
+ pwmStart();\r
+ pwmStarted = 1;\r
}\r
}\r
#endif\r