qmk_firmware/assets/drivers_apa102.md.DBz660in.js

16 lines
5.9 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.Cauyuiy8.js";
const __pageData = JSON.parse('{"title":"APA102 Driver","description":"","frontmatter":{},"headers":[],"relativePath":"drivers/apa102.md","filePath":"drivers/apa102.md","lastUpdated":null}');
const _sfc_main = { name: "drivers/apa102.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="apa102-driver" tabindex="-1">APA102 Driver <a class="header-anchor" href="#apa102-driver" aria-label="Permalink to &quot;APA102 Driver {#apa102-driver}&quot;"></a></h1><p>This driver provides support for APA102 addressable RGB LEDs. They are similar to the <a href="./ws2812">WS2812</a> LEDs, but have increased data and refresh rates.</p><h2 id="usage" tabindex="-1">Usage <a class="header-anchor" href="#usage" aria-label="Permalink to &quot;Usage {#usage}&quot;"></a></h2><p>In most cases, the APA102 driver code is automatically included if you are using either the <a href="./../features/rgblight">RGBLight</a> or <a href="./../features/rgb_matrix">RGB Matrix</a> feature with the <code>apa102</code> driver set, and you would use those APIs instead.</p><p>However, if you need to use the driver standalone, add the following to your <code>rules.mk</code>:</p><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">APA102_DRIVER_REQUIRED = yes</span></span></code></pre></div><p>You can then call the APA102 API by including <code>apa102.h</code> in your code.</p><h2 id="basic-configuration" tabindex="-1">Basic Configuration <a class="header-anchor" href="#basic-configuration" aria-label="Permalink to &quot;Basic Configuration {#basic-configuration}&quot;"></a></h2><p>Add the following to your <code>config.h</code>:</p><table><thead><tr><th>Define</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>APA102_DI_PIN</code></td><td><em>Not defined</em></td><td>The GPIO pin connected to the DI pin of the first LED in the chain</td></tr><tr><td><code>APA102_CI_PIN</code></td><td><em>Not defined</em></td><td>The GPIO pin connected to the CI pin of the first LED in the chain</td></tr><tr><td><code>APA102_DEFAULT_BRIGHTNESS</code></td><td><code>31</code></td><td>The default global brightness level of the LEDs, from 0 to 31</td></tr></tbody></table><h2 id="api" tabindex="-1">API <a class="header-anchor" href="#api" aria-label="Permalink to &quot;API {#api}&quot;"></a></h2><h3 id="api-apa102-init" tabindex="-1"><code>void apa102_init(void)</code> <a class="header-anchor" href="#api-apa102-init" aria-label="Permalink to &quot;`void apa102_init(void)` {#api-apa102-init}&quot;"></a></h3><p>Initialize the LED driver. This function should be called first.</p><hr><h3 id="api-apa102-set-color" tabindex="-1"><code>void apa102_set_color(uint16_t index, uint8_t red, uint8_t green, uint8_t blue)</code> <a class="header-anchor" href="#api-apa102-set-color" aria-label="Permalink to &quot;`void apa102_set_color(uint16_t index, uint8_t red, uint8_t green, uint8_t blue)` {#api-apa102-set-color}&quot;"></a></h3><p>Set the color of a single LED. This function does not immediately update the LEDs; call <code>apa102_flush()</code> after you are finished.</p><h4 id="api-apa102-set-color-arguments" tabindex="-1">Arguments <a class="header-anchor" href="#api-apa102-set-color-arguments" aria-label="Permalink to &quot;Arguments {#api-apa102-set-color-arguments}&quot;"></a></h4><ul><li><code>uint16_t index</code><br> The LED index in the APA102 chain.</li><li><code>uint8_t red</code><br> The red value to set.</li><li><code>uint8_t green</code><br> The green value to set.</li><li><code>uint8_t blue</code><br> The blue value to set.</li></ul><hr><h3 id="api-apa102-set-color-all" tabindex="-1"><code>void apa102_set_color_all(uint8_t red, uint8_t green, uint8_t blue)</code> <a class="header-anchor" href="#api-apa102-set-color-all" aria-label="Permalink to &quot;`void apa102_set_color_all(uint8_t red, uint8_t green, uint8_t blue)` {#api-apa102-set-color-all}&quot;"></a></h3><p>Set the color of all LEDs.</p><h4 id="api-apa102-set-color-all-arguments" tabindex="-1">Arguments <a class="header-anchor" href="#api-apa102-set-color-all-arguments" aria-label="Permalink to &quot;Arguments {#api-apa102-set-color-all-arguments}&quot;"></a></h4><ul><li><code>uint8_t red</code><br> The red value to set.</li><li><code>uint8_t green</code><br> The green value to set.</li><li><code>uint8_t blue</code><br> The blue value to set.</li></ul><hr><h3 id="api-apa102-flush" tabindex="-1"><code>void apa102_flush(void)</code> <a class="header-anchor" href="#api-apa102-flush" aria-label="Permalink to &quot;`void apa102_flush(void)` {#api-apa102-flush}&quot;"></a></h3><p>Flush the PWM values to the LED chain.</p><hr><h3 id="api-apa102-set-brightness" tabindex="-1"><code>void apa102_set_brightness(uint8_t brightness)</code> <a class="header-anchor" href="#api-apa102-set-brightness" aria-label="Permalink to &quot;`void apa102_set_brightness(uint8_t brightness)` {#api-apa102-set-brightness}&quot;"></a></h3><p>Set the global brightness.</p><h4 id="api-apa102-set-brightness-arguments" tabindex="-1">Arguments <a class="header-anchor" href="#api-apa102-set-brightness-arguments" aria-label="Permalink to &quot;Arguments {#api-apa102-set-brightness-arguments}&quot;"></a></h4><ul><li><code>uint8_t brightness</code><br> The brightness level to set, from 0 to 31.</li></ul>', 31);
const _hoisted_32 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_32);
}
const apa102 = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
apa102 as default
};