You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/06/22 15:58:31 UTC

[GitHub] [incubator-nuttx] acassis commented on a diff in pull request #6498: Added PWM support for Raspberry Pi Pico

acassis commented on code in PR #6498:
URL: https://github.com/apache/incubator-nuttx/pull/6498#discussion_r903935645


##########
arch/arm/src/rp2040/Kconfig:
##########
@@ -141,6 +141,51 @@ config RP2040_I2C_DRIVER
 
 endif
 
+config RP2040_PWM
+	bool "PWM"
+	select PWM
+	select ARCH_HAVE_PWM_MULTICHAN
+
+if RP2040_PWM
+
+config PWM_MULTICHAN
+	bool "support muli-channel PWM"

Review Comment:
   ```suggestion
   	bool "Support Multi-Channel PWM"



##########
arch/arm/src/rp2040/rp2040_pwm.c:
##########
@@ -0,0 +1,484 @@
+/****************************************************************************
+ * arch/arm/src/rp2040/rp2040_pwm.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/timers/pwm.h>
+#include <arch/board/board.h>
+#include "rp2040_pwm.h"
+#include "rp2040_gpio.h"
+
+
+/****************************************************************************
+ * Local Function Prototypes
+ ****************************************************************************/
+
+static int  pwm_setup    ( struct pwm_lowerhalf_s  * dev ); 

Review Comment:
   ```suggestion
   static int  pwm_setup(struct pwm_lowerhalf_s  *dev);



##########
arch/arm/src/rp2040/rp2040_pwm.c:
##########
@@ -0,0 +1,484 @@
+/****************************************************************************
+ * arch/arm/src/rp2040/rp2040_pwm.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/timers/pwm.h>
+#include <arch/board/board.h>
+#include "rp2040_pwm.h"
+#include "rp2040_gpio.h"
+
+
+/****************************************************************************
+ * Local Function Prototypes
+ ****************************************************************************/
+
+static int  pwm_setup    ( struct pwm_lowerhalf_s  * dev ); 
+
+static int  pwm_shutdown ( struct pwm_lowerhalf_s  * dev );
+
+static int  pwm_start    ( struct pwm_lowerhalf_s  * dev,
+                           const struct pwm_info_s * info );

Review Comment:
   ```suggestion
   static int  pwm_start(struct pwm_lowerhalf_s  *dev,
                         const struct pwm_info_s *info);



##########
arch/arm/src/rp2040/rp2040_pwm.c:
##########
@@ -0,0 +1,484 @@
+/****************************************************************************
+ * arch/arm/src/rp2040/rp2040_pwm.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/timers/pwm.h>
+#include <arch/board/board.h>
+#include "rp2040_pwm.h"
+#include "rp2040_gpio.h"
+
+
+/****************************************************************************
+ * Local Function Prototypes
+ ****************************************************************************/
+
+static int  pwm_setup    ( struct pwm_lowerhalf_s  * dev ); 
+
+static int  pwm_shutdown ( struct pwm_lowerhalf_s  * dev );
+
+static int  pwm_start    ( struct pwm_lowerhalf_s  * dev,
+                           const struct pwm_info_s * info );
+
+static int  pwm_stop     ( struct pwm_lowerhalf_s  * dev );

Review Comment:
   ```suggestion
   static int  pwm_stop(struct pwm_lowerhalf_s  *dev);



##########
arch/arm/src/rp2040/rp2040_pwm.c:
##########
@@ -0,0 +1,484 @@
+/****************************************************************************
+ * arch/arm/src/rp2040/rp2040_pwm.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/timers/pwm.h>
+#include <arch/board/board.h>
+#include "rp2040_pwm.h"
+#include "rp2040_gpio.h"
+
+
+/****************************************************************************
+ * Local Function Prototypes
+ ****************************************************************************/
+
+static int  pwm_setup    ( struct pwm_lowerhalf_s  * dev ); 
+
+static int  pwm_shutdown ( struct pwm_lowerhalf_s  * dev );

Review Comment:
   ```suggestion
   static int  pwm_shutdown(struct pwm_lowerhalf_s  *dev);



##########
arch/arm/src/rp2040/Kconfig:
##########
@@ -141,6 +141,51 @@ config RP2040_I2C_DRIVER
 
 endif
 
+config RP2040_PWM
+	bool "PWM"
+	select PWM
+	select ARCH_HAVE_PWM_MULTICHAN
+
+if RP2040_PWM
+
+config PWM_MULTICHAN
+	bool "support muli-channel PWM"
+	default y
+
+	if PWM_MULTICHAN
+
+		config PWM_NCHANNELS
+		int "number of channels"

Review Comment:
   ```suggestion
   	int "Number of channels"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org