Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WS2812 docs and add APA102 docs #22106

Merged
merged 4 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
* [Compatible Microcontrollers](compatible_microcontrollers.md)
* [Drivers](hardware_drivers.md)
* [ADC Driver](adc_driver.md)
* [APA102 Driver](apa102_driver.md)
* [Audio Driver](audio_driver.md)
* [I2C Driver](i2c_driver.md)
* [SPI Driver](spi_driver.md)
Expand Down
49 changes: 49 additions & 0 deletions docs/apa102_driver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# APA102 Driver :id=apa102-driver

This driver provides support for APA102 addressable RGB LEDs. They are similar to the [WS2812](ws2812_driver.md) LEDs, but have increased data and refresh rates.

## Usage :id=usage

In most cases, the APA102 driver code is automatically included if you are using either the [RGBLight](feature_rgblight.md) or [RGB Matrix](feature_rgb_matrix.md) feature with the `apa102` driver set, and you would use those APIs instead.

However, if you need to use the driver standalone, add the following to your `rules.mk`:

```make
APA102_DRIVER_REQUIRED = yes
```

You can then call the APA102 API by including `apa102.h` in your code.

## Basic Configuration :id=basic-configuration

Add the following to your `config.h`:

|Define |Default |Description |
|---------------------------|-------------|------------------------------------------------------------------|
|`APA102_DI_PIN` |*Not defined*|The GPIO pin connected to the DI pin of the first LED in the chain|
|`APA102_CI_PIN` |*Not defined*|The GPIO pin connected to the CI pin of the first LED in the chain|
|`APA102_DEFAULT_BRIGHTNESS`|`31` |The default global brightness level of the LEDs, from 0 to 31 |

## API :id=api

### `void apa102_setleds(rgb_led_t *start_led, uint16_t num_leds)`

Send RGB data to the APA102 LED chain.

#### Arguments :id=api-apa102-setleds-arguments

- `rgb_led_t *start_led`
A pointer to the LED array.
- `uint16_t num_leds`
The length of the LED array.

---

### `void apa102_set_brightness(uint8_t brightness)`

Set the global brightness.

#### Arguments :id=api-apa102-set-brightness-arguments

- `uint8_t brightness`
The brightness level to set, from 0 to 31.
2 changes: 1 addition & 1 deletion docs/reference_info_json.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ You can create `info.json` files at every level under `qmk_firmware/keyboards/<k

## APA102 :id=apa102

Configures the APA102 driver.
Configures the [APA102](apa102_driver.md) driver.

* `apa102`
* `clock_pin` (Required)
Expand Down
Loading