PWM driver works
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4205 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
6cf205e36e
commit
e292c452c1
@ -271,7 +271,11 @@
|
|||||||
*
|
*
|
||||||
* PD13 FSMC_A18 / MC_TIM4_CH2 pin 33 (EnB)
|
* PD13 FSMC_A18 / MC_TIM4_CH2 pin 33 (EnB)
|
||||||
*
|
*
|
||||||
* FSMC must be disabled in this case!
|
* FSMC must be disabled in this case! PD13 is available at:
|
||||||
|
*
|
||||||
|
* Daughterboard Extension Connector, CN3, pin 32 - available
|
||||||
|
* TFT LCD Connector, CN19, pin 17 -- not available without removing the LCD.
|
||||||
|
* Motor Control Connector CN15, pin 33 -- no available unless to connect SB14.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GPIO_TIM4_CH2 GPIO_TIM4_CH2_2
|
#define GPIO_TIM4_CH2 GPIO_TIM4_CH2_2
|
||||||
|
@ -92,7 +92,11 @@
|
|||||||
*
|
*
|
||||||
* PD13 FSMC_A18 / MC_TIM4_CH2 pin 33 (EnB)
|
* PD13 FSMC_A18 / MC_TIM4_CH2 pin 33 (EnB)
|
||||||
*
|
*
|
||||||
* FSMC must be disabled in this case!
|
* FSMC must be disabled in this case! PD13 is available at:
|
||||||
|
*
|
||||||
|
* Daughterboard Extension Connector, CN3, pin 32 - available
|
||||||
|
* TFT LCD Connector, CN19, pin 17 -- not available without removing the LCD.
|
||||||
|
* Motor Control Connector CN15, pin 33 -- no available unless to connect SB14.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define STM3240G_EVAL_PWMTIMER 4
|
#define STM3240G_EVAL_PWMTIMER 4
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include <nuttx/pwm.h>
|
#include <nuttx/pwm.h>
|
||||||
@ -102,18 +103,23 @@
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
void pwm_devinit(void)
|
int pwm_devinit(void)
|
||||||
{
|
{
|
||||||
|
static bool initialized = false;
|
||||||
struct pwm_lowerhalf_s *pwm;
|
struct pwm_lowerhalf_s *pwm;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* Have we already initialized? */
|
||||||
|
|
||||||
|
if (!initialized)
|
||||||
|
{
|
||||||
/* Call stm32_pwminitialize() to get an instance of the PWM interface */
|
/* Call stm32_pwminitialize() to get an instance of the PWM interface */
|
||||||
|
|
||||||
pwm = stm32_pwminitialize(STM3240G_EVAL_PWMTIMER);
|
pwm = stm32_pwminitialize(STM3240G_EVAL_PWMTIMER);
|
||||||
if (!pwm)
|
if (!pwm)
|
||||||
{
|
{
|
||||||
dbg("Failed to get the STM32 PWM lower half\n");
|
dbg("Failed to get the STM32 PWM lower half\n");
|
||||||
return;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register the PWM driver at "/dev/pwm0" */
|
/* Register the PWM driver at "/dev/pwm0" */
|
||||||
@ -122,7 +128,15 @@ void pwm_devinit(void)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
adbg("pwm_register failed: %d\n", ret);
|
adbg("pwm_register failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now we are initialized */
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_PWM */
|
#endif /* HAVE_PWM */
|
||||||
|
Loading…
Reference in New Issue
Block a user