summaryrefslogtreecommitdiff
path: root/apps/examples/pwm
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-03-31 16:59:22 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-03-31 16:59:22 -0600
commit62e6ca593af8f98726c9760ad7dd4c65d90edff9 (patch)
treefb60e22e61d85691120bbf5386ec1fc3ad9bd23a /apps/examples/pwm
parent920edab8e265baef8bcaa3128822f7cc41dd1ad3 (diff)
downloadpx4-nuttx-62e6ca593af8f98726c9760ad7dd4c65d90edff9.tar.gz
px4-nuttx-62e6ca593af8f98726c9760ad7dd4c65d90edff9.tar.bz2
px4-nuttx-62e6ca593af8f98726c9760ad7dd4c65d90edff9.zip
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.
Diffstat (limited to 'apps/examples/pwm')
-rw-r--r--apps/examples/pwm/Kconfig3
-rw-r--r--apps/examples/pwm/pwm.h11
-rw-r--r--apps/examples/pwm/pwm_main.c7
3 files changed, 6 insertions, 15 deletions
diff --git a/apps/examples/pwm/Kconfig b/apps/examples/pwm/Kconfig
index 94dc6fb7a..50672bb8f 100644
--- a/apps/examples/pwm/Kconfig
+++ b/apps/examples/pwm/Kconfig
@@ -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
diff --git a/apps/examples/pwm/pwm.h b/apps/examples/pwm/pwm.h
index c1c6820e8..e6703991a 100644
--- a/apps/examples/pwm/pwm.h
+++ b/apps/examples/pwm/pwm.h
@@ -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 */
diff --git a/apps/examples/pwm/pwm_main.c b/apps/examples/pwm/pwm_main.c
index ba5687541..844551550 100644
--- a/apps/examples/pwm/pwm_main.c
+++ b/apps/examples/pwm/pwm_main.c
@@ -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;
}