qmk_firmware/assets/drivers_audio.md.B5ON2lEW.js

16 lines
27 KiB
JavaScript
Raw Normal View History

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.B9AX-CPi.js";
const __pageData = JSON.parse('{"title":"Audio Driver","description":"","frontmatter":{},"headers":[],"relativePath":"drivers/audio.md","filePath":"drivers/audio.md","lastUpdated":null}');
const _sfc_main = { name: "drivers/audio.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="audio-driver" tabindex="-1">Audio Driver <a class="header-anchor" href="#audio-driver" aria-label="Permalink to &quot;Audio Driver {#audio-driver}&quot;"></a></h1><p>The <a href="./../features/audio">Audio feature</a> breaks the hardware specifics out into separate, exchangeable driver units, with a common interface to the audio-&quot;core&quot; - which itself handles playing songs and notes while tracking their progress in an internal state, initializing/starting/stopping the driver as needed.</p><p>Not all MCUs support every available driver, either the platform-support is not there (yet?) or the MCU simply does not have the required hardware peripheral.</p><h2 id="avr" tabindex="-1">AVR <a class="header-anchor" href="#avr" aria-label="Permalink to &quot;AVR {#avr}&quot;"></a></h2><p>Boards built around an Atmega32U4 can use two sets of PWM capable pins, each driving a separate speaker. The possible configurations are:</p><table><thead><tr><th></th><th>Timer3</th><th>Timer1</th></tr></thead><tbody><tr><td>one speaker</td><td>C4,C5 or C6</td><td></td></tr><tr><td>one speaker</td><td></td><td>B4, B5 or B7</td></tr><tr><td>two speakers</td><td>C4,C5 or C6</td><td>B4, B5 or B7</td></tr></tbody></table><p>Currently there is only one/default driver for AVR based boards, which is automatically configured to:</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;">AUDIO_DRIVER = pwm_hardware</span></span></code></pre></div><h2 id="arm" tabindex="-1">ARM <a class="header-anchor" href="#arm" aria-label="Permalink to &quot;ARM {#arm}&quot;"></a></h2><p>For Arm based boards, QMK depends on ChibiOS - hence any MCU supported by the later is likely usable, as long as certain hardware peripherals are available.</p><p>Supported wiring configurations, with their ChibiOS/MCU peripheral requirement are listed below; piezo speakers are marked with 1 for the first/primary and 2 for the secondary.</p><table><thead><tr><th>driver</th><th>GPTD6<br>Tim6</th><th>GPTD7<br>Tim7</th><th>GPTD8<br>Tim8</th><th>PWMD1<sup>1</sup><br>Tim1_Ch1</th></tr></thead><tbody><tr><td>dac_basic</td><td>A4+DACD1 = 1</td><td>A5+DACD2 = 1</td><td>state</td><td></td></tr><tr><td></td><td>A4+DACD1 = 1 + Gnd</td><td>A5+DACD2 = 2 + Gnd</td><td>state</td><td></td></tr><tr><td></td><td>A4+DACD1 = 2 + Gnd</td><td>A5+DACD2 = 1 + Gnd</td><td>state</td><td></td></tr><tr><td></td><td>A4+DACD1 = 1 + Gnd</td><td></td><td>state</td><td></td></tr><tr><td></td><td></td><td>A5+DACD2 = 1 + Gnd</td><td>state</td><td></td></tr><tr><td>dac_additive</td><td>A4+DACD1 = 1 + Gnd</td><td></td><td></td><td></td></tr><tr><td></td><td>A5+DACD2 = 1 + Gnd</td><td></td><td></td><td></td></tr><tr><td></td><td>A4+DACD1 + A5+DACD2 = 1 <sup>2</sup></td><td></td><td></td><td></td></tr><tr><td>pwm_software</td><td>state-update</td><td></td><td></td><td>any = 1</td></tr><tr><td>pwm hardware</td><td>state-update</td><td></td><td></td><td>A8 = 1 <sup>3</sup></td></tr></tbody></table><p><sup>1</sup>: the routing and alternate functions for PWM differ sometimes between STM32 MCUs, if in doubt consult the data-sheet<br><sup>2</sup>: one piezo connected to A4 and A5, with AUDIO_PIN_ALT_AS_NEGATIVE set<br><sup>3</sup>: TIM1_CH1 = A8 on STM32F103C8, other combinations are possible, see Data-sheet. configured with: AUDIO_PWM_DRIVER and AUDIO_PWM_CHANNEL</p><h3 id="dac-basic" tabindex="-1">DAC basic <a class="header-anchor" href="#dac-basic" aria-label="Permalink to &quot;DAC basic {#dac-basic}&quot;"></a></h3><p>The default driver for ARM boards, in absence of an overriding configuration. This driver needs one Timer per enabled/used DAC channel, to trigger conversion; and a third timer to trigger state updates with the audio-core.</p><p>A
const _hoisted_54 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_54);
}
const audio = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
audio as default
};