From 4f4f27e4d4839be524bd4872c04ac5a216c8fe24 Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Tue, 17 Mar 2026 21:55:33 -0800 Subject: [PATCH] refactor(drivers/rpm/pcf8583): convert params.c to module.yaml Convert 1 parameter file(s) from legacy C format to YAML module configuration. --- src/drivers/rpm/pcf8583/CMakeLists.txt | 2 + src/drivers/rpm/pcf8583/parameters.c | 82 ------------------------- src/drivers/rpm/pcf8583/parameters.yaml | 43 +++++++++++++ 3 files changed, 45 insertions(+), 82 deletions(-) delete mode 100644 src/drivers/rpm/pcf8583/parameters.c create mode 100644 src/drivers/rpm/pcf8583/parameters.yaml diff --git a/src/drivers/rpm/pcf8583/CMakeLists.txt b/src/drivers/rpm/pcf8583/CMakeLists.txt index 9eef9031a7..919e57f159 100644 --- a/src/drivers/rpm/pcf8583/CMakeLists.txt +++ b/src/drivers/rpm/pcf8583/CMakeLists.txt @@ -38,6 +38,8 @@ px4_add_module( PCF8583.cpp PCF8583.hpp pcf8583_main.cpp + MODULE_CONFIG + parameters.yaml DEPENDS drivers__device px4_work_queue diff --git a/src/drivers/rpm/pcf8583/parameters.c b/src/drivers/rpm/pcf8583/parameters.c deleted file mode 100644 index f34ea4ae6d..0000000000 --- a/src/drivers/rpm/pcf8583/parameters.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** -* PCF8583 eneable driver -* -* Run PCF8583 driver automatically -* -* @reboot_required true -* @min 0 -* @max 1 -* @group Sensors -* @value 0 Disabled -* @value 1 Eneabled -*/ -PARAM_DEFINE_INT32(SENS_EN_PCF8583, 0); - - -/** - * PCF8583 rotorfreq (i2c) pool interval - * - * Determines how often the sensor is read out. - * - * @reboot_required true - * @group Sensors - * @unit us - */ -PARAM_DEFINE_INT32(PCF8583_POOL, 1000000); - -/** - * PCF8583 rotorfreq (i2c) pulse reset value - * - * Internal device counter is reset to 0 when overrun this value, - * counter is able to store up to 6 digits - * reset of counter takes some time - measurement with reset has worse accuracy. - * 0 means reset counter after every measurement. - * - * @reboot_required true - * @group Sensors - */ -PARAM_DEFINE_INT32(PCF8583_RESET, 500000); - -/** - * PCF8583 rotorfreq (i2c) pulse count - * - * Nmumber of signals per rotation of actuator - * - * @reboot_required true - * @group Sensors - * @min 1 - */ -PARAM_DEFINE_INT32(PCF8583_MAGNET, 2); diff --git a/src/drivers/rpm/pcf8583/parameters.yaml b/src/drivers/rpm/pcf8583/parameters.yaml new file mode 100644 index 0000000000..cfb85bc2f1 --- /dev/null +++ b/src/drivers/rpm/pcf8583/parameters.yaml @@ -0,0 +1,43 @@ +module_name: pcf8583 +parameters: +- group: Sensors + definitions: + SENS_EN_PCF8583: + description: + short: PCF8583 eneable driver + long: Run PCF8583 driver automatically + type: enum + values: + 0: Disabled + 1: Eneabled + default: 0 + reboot_required: true + min: 0 + max: 1 + PCF8583_POOL: + description: + short: PCF8583 rotorfreq (i2c) pool interval + long: Determines how often the sensor is read out. + type: int32 + default: 1000000 + reboot_required: true + unit: us + PCF8583_RESET: + description: + short: PCF8583 rotorfreq (i2c) pulse reset value + long: |- + Internal device counter is reset to 0 when overrun this value, + counter is able to store up to 6 digits + reset of counter takes some time - measurement with reset has worse accuracy. + 0 means reset counter after every measurement. + type: int32 + default: 500000 + reboot_required: true + PCF8583_MAGNET: + description: + short: PCF8583 rotorfreq (i2c) pulse count + long: Nmumber of signals per rotation of actuator + type: int32 + default: 2 + reboot_required: true + min: 1