Rename pwm_devinit() to board_pwm_setup(). Add CONFIG_BOARDCTL_PWMTEST that will enable calling board_pwm_setup() from boardctl(). Replace calls to pwm_devinit() in apps/examples/pwm with calls to boardctl(). In all configurations that enable the apps/examples/pwm test, make sure that boardctl() suppoprt is properly enabled.
This commit is contained in:
parent
2be8eee936
commit
08f57f5d90
@ -6,7 +6,8 @@
|
||||
config EXAMPLES_PWM
|
||||
bool "Pulse width modulation (PWM) example"
|
||||
default n
|
||||
depends on PWM && NSH_BUILTIN_APPS
|
||||
depends on PWM && NSH_BUILTIN_APPS && LIB_BOARDCTL
|
||||
select BOARDCTL_PWMTEST
|
||||
---help---
|
||||
Enable the Pulse width modulation (PWM) example
|
||||
|
||||
|
@ -100,15 +100,4 @@
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pwm_devinit()
|
||||
*
|
||||
* Description:
|
||||
* Perform architecuture-specific initialization of the PWM hardware. This
|
||||
* interface must be provided by all configurations using apps/examples/pwm
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int pwm_devinit(void);
|
||||
|
||||
#endif /* __APPS_EXAMPLES_PWM_PWM_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/pwm/pwm_main.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -41,6 +41,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/boardctl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -313,10 +314,10 @@ int pwm_main(int argc, char *argv[])
|
||||
* this test.
|
||||
*/
|
||||
|
||||
ret = pwm_devinit();
|
||||
ret = boardctl(BOARDIOC_PWMTEST_SETUP, 0);
|
||||
if (ret != OK)
|
||||
{
|
||||
printf("pwm_main: pwm_devinit failed: %d\n", ret);
|
||||
printf("pwm_main: boardctl failed: %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user