X-Git-Url: http://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/b5e1d01dc3ef67418901a4d43b5f78c879663a9d..3da0b84d086be43fc78b4a4b75828babacd0cd13:/project/commands/cmd_pwm.c diff --git a/project/commands/cmd_pwm.c b/project/commands/cmd_pwm.c index 00e7de4..c327a0a 100644 --- a/project/commands/cmd_pwm.c +++ b/project/commands/cmd_pwm.c @@ -1,7 +1,7 @@ /**************************************************************************/ /*! @file cmd_sysinfo.c - @author K. Townsend (microBuilder.eu) + @author Miceuz @brief Code to execute for cmd_sysinfo in the 'core/cmd' command-line interpretter. @@ -10,7 +10,7 @@ Software License Agreement (BSD License) - Copyright (c) 2010, microBuilder SARL + Copyright (c) 2012, microBuilder SARL All rights reserved. Redistribution and use in source and binary forms, with or without @@ -40,14 +40,10 @@ #include "projectconfig.h" #include "core/cmd/cmd.h" -#include "core/systick/systick.h" -#include "core/iap/iap.h" #include "project/commands.h" // Generic helper functions -#include "core/pwm/pwm.h" -#ifdef CFG_PRINTF_UART - #include "core/uart/uart.h" -#endif +#ifdef CFG_PWM + #include "core/pwm/pwm.h" /**************************************************************************/ /*! @@ -58,27 +54,26 @@ uint8_t pwmStarted = 0; void cmd_pwm(uint8_t argc, char **argv) { int32_t frequencyTicks = 65535; - int32_t dutyCycle = 25; + int32_t dutyCycle = CFG_PWM_DEFAULT_DUTYCYCLE; if(argc > 0) { getNumber (argv[0], &dutyCycle); if(dutyCycle < 1 || dutyCycle > 100) { - printf("Invalid duty cycle. Duty cycle must be [1 .. 65535]%s", CFG_PRINTF_NEWLINE); + printf("Invalid duty cycle [1..65535]%s", CFG_PRINTF_NEWLINE); return; } if(argc > 1) { getNumber (argv[1], &frequencyTicks); if(frequencyTicks < 0 || frequencyTicks > 0xffff) { - printf("Invalid frequency. Frequency must be [1 .. 65535]%s", CFG_PRINTF_NEWLINE); + printf("Invalid frequency [1..65535]%s", CFG_PRINTF_NEWLINE); return; } } else { frequencyTicks = 65535; } } else { - dutyCycle = 25; - + dutyCycle = CFG_PWM_DEFAULT_DUTYCYCLE; } if(! pwmStarted) { @@ -94,4 +89,5 @@ void cmd_pwm(uint8_t argc, char **argv) { pwmStart(); pwmStarted = 1; } -} \ No newline at end of file +} +#endif