Audio System + Drivers (#562)

This commit is contained in:
Shadowtrance
2026-07-14 16:34:29 +10:00
committed by GitHub
parent fa4a6e255c
commit 955416dac8
137 changed files with 8847 additions and 387 deletions
+11
View File
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.20)
include("${CMAKE_CURRENT_LIST_DIR}/../../Buildscripts/module.cmake")
file(GLOB_RECURSE SOURCE_FILES "source/*.c*")
tactility_add_module(es8311-module
SRCS ${SOURCE_FILES}
INCLUDE_DIRS include/
REQUIRES TactilityKernel audio-codec-module esp_codec_dev
)
+195
View File
@@ -0,0 +1,195 @@
Apache License
==============
_Version 2.0, January 2004_
_&lt;<http://www.apache.org/licenses/>&gt;_
### Terms and Conditions for use, reproduction, and distribution
#### 1. Definitions
“License” shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
“Licensor” shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
“Legal Entity” shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, “control” means **(i)** the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
outstanding shares, or **(iii)** beneficial ownership of such entity.
“You” (or “Your”) shall mean an individual or Legal Entity exercising
permissions granted by this License.
“Source” form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
“Object” form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
“Work” shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
“Derivative Works” shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
“Contribution” shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
“submitted” means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as “Not a Contribution.”
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
#### 2. Grant of Copyright License
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
#### 3. Grant of Patent License
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
#### 4. Redistribution
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
this License; and
* **(b)** You must cause any modified files to carry prominent notices stating that You
changed the files; and
* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
#### 5. Submission of Contributions
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
#### 6. Trademarks
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
#### 7. Disclaimer of Warranty
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
#### 8. Limitation of Liability
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
#### 9. Accepting Warranty or Additional Liability
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
_END OF TERMS AND CONDITIONS_
### APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets `[]` replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same “printed page” as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed 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.
+12
View File
@@ -0,0 +1,12 @@
# ES8311 audio codec
A driver for the `ES8311` audio codec by Everest Semiconductor, wired as a dual
in/out `AUDIO_CODEC_TYPE` device (speaker output + microphone input on the same
chip). The I2C bus is the device's parent; the I2S controller carrying audio data
is referenced via a devicetree phandle.
Wraps Espressif's `esp_codec_dev` ES8311 implementation.
See https://www.everest-semi.com/pdf/ES8311%20PB.pdf
License: [Apache v2.0](LICENSE-Apache-2.0.md)
@@ -0,0 +1,11 @@
description: Everest Semiconductor ES8311 audio codec (speaker output + mic input, dual mode)
include: [ "i2c-device.yaml" ]
compatible: "everest,es8311"
properties:
i2s:
type: phandle
required: true
description: "I2S controller device that carries audio data"
+3
View File
@@ -0,0 +1,3 @@
dependencies:
- TactilityKernel
bindings: bindings
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <tactility/bindings/bindings.h>
#include <drivers/es8311.h>
#ifdef __cplusplus
extern "C" {
#endif
DEFINE_DEVICETREE(es8311, struct Es8311Config)
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <tactility/error.h>
#include <tactility/drivers/audio_codec.h>
struct Device;
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief ES8311 codec device configuration.
*
* The ES8311 is wired as both control (I2C) and audio (I2S) device: the I2C
* bus is the device's parent (per i2c-device.yaml), while the I2S controller
* is referenced via a devicetree phandle. It operates in dual mode
* (speaker output + mic input) on boards such as M5Stack StickS3.
*/
struct Es8311Config {
/** I2C address on the bus (typically 0x18) */
uint8_t address;
/** I2S controller device that carries audio data */
struct Device* i2s_device;
};
#ifdef __cplusplus
}
#endif
+400
View File
@@ -0,0 +1,400 @@
// SPDX-License-Identifier: Apache-2.0
#include <drivers/es8311.h>
#include <tactility/device.h>
#include <tactility/drivers/audio_codec.h>
#include <tactility/drivers/audio_codec_adapters.h>
#include <tactility/drivers/i2c_controller.h>
#include <tactility/drivers/i2s_controller.h>
#include <tactility/log.h>
#include <es8311_codec.h>
#include <esp_codec_dev.h>
#include <esp_codec_dev_defaults.h>
#include <cmath>
#define TAG "ES8311"
namespace {
// Volume curve maps 1..100 to roughly -49.5dB..0dB; native ES8311 range is wide enough
// that we expose a flat 0..100 percent scale to callers and let esp_codec_dev convert.
constexpr uint32_t NATIVE_SAMPLE_RATE = 44100;
struct Es8311Data {
const audio_codec_ctrl_if_t* ctrl_if = nullptr;
const audio_codec_data_if_t* data_if = nullptr;
const audio_codec_gpio_if_t* gpio_if = nullptr;
const audio_codec_if_t* codec_if = nullptr;
esp_codec_dev_handle_t codec_device = nullptr;
bool is_open = false;
AudioCodecDirection open_direction = AUDIO_CODEC_DIR_BOTH;
esp_codec_dev_sample_info_t open_sample_info = {};
};
#define GET_CONFIG(device) (static_cast<const Es8311Config*>((device)->config))
#define GET_DATA(device) (static_cast<Es8311Data*>(device_get_driver_data(device)))
// region AudioCodecApi
error_t open(Device* device, const struct AudioCodecStreamConfig* config) {
auto* data = GET_DATA(device);
if (data->codec_device == nullptr) {
return ERROR_RESOURCE;
}
esp_codec_dev_sample_info_t sample_info = {
.bits_per_sample = config->bits_per_sample,
.channel = config->channels,
.channel_mask = 0,
.sample_rate = config->sample_rate,
.mclk_multiple = 0,
};
if (data->is_open) {
// open_direction == BOTH already serves INPUT-only or OUTPUT-only requests on the
// same sample settings -- only an exact direction mismatch (e.g. requesting BOTH
// while opened for INPUT only) needs a reopen.
bool direction_compatible = data->open_direction == config->direction
|| data->open_direction == AUDIO_CODEC_DIR_BOTH;
bool same_config = direction_compatible
&& data->open_sample_info.bits_per_sample == sample_info.bits_per_sample
&& data->open_sample_info.channel == sample_info.channel
&& data->open_sample_info.sample_rate == sample_info.sample_rate;
return same_config ? ERROR_NONE : ERROR_RESOURCE;
}
if (esp_codec_dev_open(data->codec_device, &sample_info) != ESP_CODEC_DEV_OK) {
LOG_E(TAG, "Failed to open codec device");
return ERROR_RESOURCE;
}
data->is_open = true;
data->open_direction = config->direction;
data->open_sample_info = sample_info;
return ERROR_NONE;
}
error_t close(Device* device) {
auto* data = GET_DATA(device);
if (data->codec_device == nullptr) {
return ERROR_RESOURCE;
}
if (data->is_open) {
esp_codec_dev_close(data->codec_device);
data->is_open = false;
}
return ERROR_NONE;
}
error_t read(Device* device, void* buffer, size_t size, size_t* bytes_read, TickType_t timeout) {
(void) timeout;
auto* data = GET_DATA(device);
if (!data->is_open) {
return ERROR_RESOURCE;
}
// esp_codec_dev_read returns the number of bytes read (>= 0) on success, or a negative
// ESP_CODEC_DEV_* error code on failure -- it does NOT return ESP_CODEC_DEV_OK (0) for
// a successful nonzero-length read.
int result = esp_codec_dev_read(data->codec_device, buffer, (int) size);
if (result < 0) {
return ERROR_RESOURCE;
}
*bytes_read = (size_t) result;
return ERROR_NONE;
}
error_t write(Device* device, const void* buffer, size_t size, size_t* bytes_written, TickType_t timeout) {
(void) timeout;
auto* data = GET_DATA(device);
if (!data->is_open) {
return ERROR_RESOURCE;
}
// esp_codec_dev_write returns the number of bytes written (>= 0) on success, or a negative
// ESP_CODEC_DEV_* error code on failure -- it does NOT return ESP_CODEC_DEV_OK (0) for
// a successful nonzero-length write.
int result = esp_codec_dev_write(data->codec_device, const_cast<void*>(buffer), (int) size);
if (result < 0) {
return ERROR_RESOURCE;
}
*bytes_written = (size_t) result;
return ERROR_NONE;
}
error_t set_volume(Device* device, AudioCodecDirection direction, float volume_percent) {
auto* data = GET_DATA(device);
if (data->codec_device == nullptr) {
return ERROR_RESOURCE;
}
if (volume_percent < 0.0f || volume_percent > 100.0f) {
return ERROR_RESOURCE;
}
if (direction == AUDIO_CODEC_DIR_OUTPUT) {
int volume = (int) std::lround(volume_percent);
return (esp_codec_dev_set_out_vol(data->codec_device, volume) == ESP_CODEC_DEV_OK) ? ERROR_NONE : ERROR_RESOURCE;
}
if (direction == AUDIO_CODEC_DIR_INPUT) {
// ES8311 ADC gain range is roughly 0..24 dB; map 0..100% linearly onto it.
float db = (volume_percent / 100.0f) * 24.0f;
return (esp_codec_dev_set_in_gain(data->codec_device, db) == ESP_CODEC_DEV_OK) ? ERROR_NONE : ERROR_RESOURCE;
}
return ERROR_NOT_SUPPORTED;
}
error_t get_volume(Device* device, AudioCodecDirection direction, float* volume_percent) {
auto* data = GET_DATA(device);
if (data->codec_device == nullptr) {
return ERROR_RESOURCE;
}
if (direction == AUDIO_CODEC_DIR_OUTPUT) {
int volume = 0;
if (esp_codec_dev_get_out_vol(data->codec_device, &volume) != ESP_CODEC_DEV_OK) {
return ERROR_RESOURCE;
}
*volume_percent = (float) volume;
return ERROR_NONE;
}
if (direction == AUDIO_CODEC_DIR_INPUT) {
float db = 0.0f;
if (esp_codec_dev_get_in_gain(data->codec_device, &db) != ESP_CODEC_DEV_OK) {
return ERROR_RESOURCE;
}
*volume_percent = (db / 24.0f) * 100.0f;
return ERROR_NONE;
}
return ERROR_NOT_SUPPORTED;
}
error_t set_mute(Device* device, AudioCodecDirection direction, bool muted) {
auto* data = GET_DATA(device);
if (data->codec_device == nullptr) {
return ERROR_RESOURCE;
}
if (direction == AUDIO_CODEC_DIR_OUTPUT) {
return (esp_codec_dev_set_out_mute(data->codec_device, muted) == ESP_CODEC_DEV_OK) ? ERROR_NONE : ERROR_RESOURCE;
}
if (direction == AUDIO_CODEC_DIR_INPUT) {
return (esp_codec_dev_set_in_mute(data->codec_device, muted) == ESP_CODEC_DEV_OK) ? ERROR_NONE : ERROR_RESOURCE;
}
return ERROR_NOT_SUPPORTED;
}
error_t get_mute(Device* device, AudioCodecDirection direction, bool* muted) {
auto* data = GET_DATA(device);
if (data->codec_device == nullptr) {
return ERROR_RESOURCE;
}
if (direction == AUDIO_CODEC_DIR_OUTPUT) {
return (esp_codec_dev_get_out_mute(data->codec_device, muted) == ESP_CODEC_DEV_OK) ? ERROR_NONE : ERROR_RESOURCE;
}
if (direction == AUDIO_CODEC_DIR_INPUT) {
return (esp_codec_dev_get_in_mute(data->codec_device, muted) == ESP_CODEC_DEV_OK) ? ERROR_NONE : ERROR_RESOURCE;
}
return ERROR_NOT_SUPPORTED;
}
error_t get_native_channels(Device* device, AudioCodecDirection direction, uint8_t* channels) {
(void) device;
if (direction != AUDIO_CODEC_DIR_INPUT && direction != AUDIO_CODEC_DIR_OUTPUT) {
return ERROR_NOT_SUPPORTED;
}
*channels = (direction == AUDIO_CODEC_DIR_INPUT) ? 1 : 2;
return ERROR_NONE;
}
error_t get_native_sample_rate(Device* device, AudioCodecDirection direction, uint32_t* rate_hz) {
(void) device;
(void) direction;
*rate_hz = NATIVE_SAMPLE_RATE;
return ERROR_NONE;
}
error_t get_capabilities(Device* device, AudioCodecDirection* supported_directions) {
(void) device;
*supported_directions = AUDIO_CODEC_DIR_BOTH;
return ERROR_NONE;
}
static const struct AudioCodecApi API = {
.open = open,
.close = close,
.read = read,
.write = write,
.set_volume = set_volume,
.get_volume = get_volume,
.set_mute = set_mute,
.get_mute = get_mute,
.get_native_sample_rate = get_native_sample_rate,
.get_native_channels = get_native_channels,
.get_capabilities = get_capabilities,
.get_input_gain_multiplier = nullptr,
};
// endregion
// region Driver lifecycle
error_t start_device(Device* device) {
const auto* config = GET_CONFIG(device);
auto* i2c_controller = device_get_parent(device);
if (i2c_controller == nullptr || device_get_type(i2c_controller) != &I2C_CONTROLLER_TYPE) {
LOG_E(TAG, "Parent is not an I2C controller");
return ERROR_RESOURCE;
}
auto* i2s_controller = config->i2s_device;
if (i2s_controller == nullptr || device_get_type(i2s_controller) != &I2S_CONTROLLER_TYPE) {
LOG_E(TAG, "I2S controller device is not valid");
return ERROR_RESOURCE;
}
auto* data = new Es8311Data();
data->ctrl_if = audio_codec_adapter_new_i2c_ctrl(i2c_controller, config->address);
data->data_if = audio_codec_adapter_new_i2s_data(i2s_controller);
if (data->ctrl_if == nullptr || data->data_if == nullptr) {
LOG_E(TAG, "Failed to create adapters");
goto cleanup;
}
if (data->ctrl_if->open(data->ctrl_if, nullptr, 0) != ESP_CODEC_DEV_OK) {
LOG_E(TAG, "Failed to open control interface");
goto cleanup;
}
if (data->data_if->open(data->data_if, nullptr, 0) != ESP_CODEC_DEV_OK) {
LOG_E(TAG, "Failed to open data interface");
goto cleanup;
}
{
es8311_codec_cfg_t codec_config = {};
codec_config.ctrl_if = data->ctrl_if;
codec_config.gpio_if = nullptr;
codec_config.codec_mode = ESP_CODEC_DEV_WORK_MODE_BOTH;
codec_config.pa_pin = -1;
codec_config.pa_reverted = false;
codec_config.master_mode = false;
codec_config.use_mclk = true;
codec_config.digital_mic = false;
codec_config.invert_mclk = false;
codec_config.invert_sclk = false;
codec_config.no_dac_ref = false;
codec_config.mclk_div = 0;
data->codec_if = es8311_codec_new(&codec_config);
if (data->codec_if == nullptr) {
LOG_E(TAG, "Failed to create ES8311 codec interface");
goto cleanup;
}
}
{
esp_codec_dev_cfg_t dev_config = {
.dev_type = ESP_CODEC_DEV_TYPE_IN_OUT,
.codec_if = data->codec_if,
.data_if = data->data_if,
};
data->codec_device = esp_codec_dev_new(&dev_config);
if (data->codec_device == nullptr) {
LOG_E(TAG, "Failed to create codec device");
goto cleanup;
}
}
device_set_driver_data(device, data);
return ERROR_NONE;
cleanup:
// Mirrors stop_device's teardown order -- delete_*_if() routines close their interface
// first, so we don't need separate ->close() calls here.
if (data->codec_device != nullptr) {
esp_codec_dev_delete(data->codec_device);
}
if (data->codec_if != nullptr) {
audio_codec_delete_codec_if(data->codec_if);
}
if (data->gpio_if != nullptr) {
audio_codec_adapter_delete_gpio(data->gpio_if);
}
if (data->data_if != nullptr) {
audio_codec_delete_data_if(data->data_if);
}
if (data->ctrl_if != nullptr) {
audio_codec_delete_ctrl_if(data->ctrl_if);
}
delete data;
return ERROR_RESOURCE;
}
error_t stop_device(Device* device) {
auto* data = GET_DATA(device);
if (data == nullptr) {
return ERROR_NONE;
}
if (data->is_open) {
esp_codec_dev_close(data->codec_device);
}
if (data->codec_device != nullptr) {
esp_codec_dev_delete(data->codec_device);
}
if (data->codec_if != nullptr) {
audio_codec_delete_codec_if(data->codec_if);
}
if (data->gpio_if != nullptr) {
audio_codec_adapter_delete_gpio(data->gpio_if);
}
if (data->data_if != nullptr) {
audio_codec_delete_data_if(data->data_if);
}
if (data->ctrl_if != nullptr) {
audio_codec_delete_ctrl_if(data->ctrl_if);
}
device_set_driver_data(device, nullptr);
delete data;
return ERROR_NONE;
}
// endregion
} // namespace
extern "C" {
Driver es8311_driver = {
.name = "es8311",
.compatible = (const char*[]) { "everest,es8311", nullptr },
.start_device = start_device,
.stop_device = stop_device,
.api = &API,
.device_type = &AUDIO_CODEC_TYPE,
.owner = nullptr,
.internal = nullptr,
};
}
+30
View File
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/check.h>
#include <tactility/driver.h>
#include <tactility/module.h>
extern "C" {
extern Driver es8311_driver;
static error_t start() {
check(driver_construct_add(&es8311_driver) == ERROR_NONE);
return ERROR_NONE;
}
static error_t stop() {
check(driver_remove_destruct(&es8311_driver) == ERROR_NONE);
return ERROR_NONE;
}
extern const ModuleSymbol es8311_module_symbols[];
Module es8311_module = {
.name = "es8311",
.start = start,
.stop = stop,
.symbols = es8311_module_symbols,
.internal = nullptr
};
}
+6
View File
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/module.h>
const struct ModuleSymbol es8311_module_symbols[] = {
MODULE_SYMBOL_TERMINATOR
};