boards: shields: add Adafruit 16-channel PWM/Servo

Adds Adafruit 16-channel PWM/Servo Shield

Signed-off-by: Nick Ward <nix.ward@gmail.com>
This commit is contained in:
Nick Ward 2022-09-16 22:36:33 +10:00 committed by Carles Cufí
commit 402324180f
3 changed files with 122 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# Copyright (c) 2022 Nick Ward <nix.ward@gmail.com>
# SPDX-License-Identifier: Apache-2.0
config SHIELD_ADAFRUIT_PCA9685
def_bool $(shields_list_contains,adafruit_pca9685)

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2022 Nick Ward <nix.ward@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
&arduino_i2c {
status = "okay";
pca9685_adafruit_pca9685: pca9685@40 {
status = "okay";
compatible = "nxp,pca9685-pwm";
reg = <0x40>;
#pwm-cells = <2>;
};
};
/ {
pwmleds {
status = "okay";
compatible = "pwm-leds";
s_led0: s-led-0 {
pwms = <&pca9685_adafruit_pca9685 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led1: s-led-1 {
pwms = <&pca9685_adafruit_pca9685 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led2: s-led-2 {
pwms = <&pca9685_adafruit_pca9685 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led3: s-led-3 {
pwms = <&pca9685_adafruit_pca9685 3 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led4: s-led-4 {
pwms = <&pca9685_adafruit_pca9685 4 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led5: s-led-5 {
pwms = <&pca9685_adafruit_pca9685 5 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led6: s-led-6 {
pwms = <&pca9685_adafruit_pca9685 6 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led7: s-led-7 {
pwms = <&pca9685_adafruit_pca9685 7 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led8: s-led-8 {
pwms = <&pca9685_adafruit_pca9685 8 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led9: s-led-9 {
pwms = <&pca9685_adafruit_pca9685 9 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led10: s-led-10 {
pwms = <&pca9685_adafruit_pca9685 10 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led11: s-led-11 {
pwms = <&pca9685_adafruit_pca9685 11 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led12: s-led-12 {
pwms = <&pca9685_adafruit_pca9685 12 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led13: s-led-13 {
pwms = <&pca9685_adafruit_pca9685 13 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led14: s-led-14 {
pwms = <&pca9685_adafruit_pca9685 14 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
s_led15: s-led-15 {
pwms = <&pca9685_adafruit_pca9685 15 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
};
};

View file

@ -0,0 +1,45 @@
.. _adafruit_pca9685:
Adafruit 16-channel PWM/Servo Shield
####################################
Overview
********
The Adafruit 16-channel PWM/Servo shield is an Arduino
UNO R3 compatible shield based on the NXP PCA9685 IC.
More information about the shield can be found
at the `Adafruit 16-channel PWM/Servo Shield webpage`_.
Pins Assignments
================
+-----------------------+---------------------+
| Shield Connector Pin | Function |
+=======================+=====================+
| A5 | I2C - SCL1 |
+-----------------------+---------------------+
| A4 | I2C - SDA1 |
+-----------------------+---------------------+
Programming
***********
Set ``-DSHIELD=adafruit_pca9685`` when you invoke ``west build``.
For example:
.. zephyr-app-commands::
:zephyr-app: samples/drivers/led_pwm
:board: nrf52840dk_nrf52840
:shield: adafruit_pca9685
:goals: build
References
**********
.. target-notes::
.. _Adafruit 16-channel PWM/Servo Shield webpage:
https://learn.adafruit.com/adafruit-16-channel-pwm-slash-servo-shield?view=all