From c862638fd1126a61abbc9fb3c013f0859db3456c Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Thu, 8 Dec 2022 18:55:55 +0100 Subject: [PATCH] Created calibration data structure for Module17 --- openrtx/include/calibration/calibInfo_Mod17.h | 42 +++++++++++++++++++ platform/targets/Module17/platform.c | 15 +++++-- 2 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 openrtx/include/calibration/calibInfo_Mod17.h diff --git a/openrtx/include/calibration/calibInfo_Mod17.h b/openrtx/include/calibration/calibInfo_Mod17.h new file mode 100644 index 00000000..be9ae570 --- /dev/null +++ b/openrtx/include/calibration/calibInfo_Mod17.h @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (C) 2022 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * + * Mathis Schmieder DB9MAT * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, see * + ***************************************************************************/ + +#ifndef CALIBINFO_MOD17_H +#define CALIBINFO_MOD17_H + +#include +#include + +/** + * \brief Calibration data for Module17. + */ +typedef struct +{ + uint16_t tx_wiper; + uint16_t rx_wiper; + uint8_t mic_gain; + uint8_t tx_invert : 1, + rx_invert : 1, + _padding : 6; +} +mod17Calib_t; + +#endif /* CALIBINFO_MOD17_H */ diff --git a/platform/targets/Module17/platform.c b/platform/targets/Module17/platform.c index 9847bd75..e9c11b7e 100644 --- a/platform/targets/Module17/platform.c +++ b/platform/targets/Module17/platform.c @@ -29,8 +29,11 @@ #include #include #include +#include #include +mod17Calib_t mod17CalData; + void platform_init() { /* Configure GPIOs */ @@ -53,10 +56,14 @@ void platform_init() i2c_init(); mcp4551_init(SOFTPOT_RX); mcp4551_init(SOFTPOT_TX); - mcp4551_setWiper(SOFTPOT_TX, 0x100); - //mcp4551_setWiper(SOFTPOT_RX, MCP4551_WIPER_A); - audio_init(); + + /* Set defaults for calibration */ + mod17CalData.tx_wiper = 0x080; + mod17CalData.rx_wiper = 0x080; + mod17CalData.tx_invert = 0; + mod17CalData.rx_invert = 0; + mod17CalData.mic_gain = 0; } void platform_terminate() @@ -157,7 +164,7 @@ void platform_beepStop() const void *platform_getCalibrationData() { - return NULL; + return ((const void *) &mod17CalData); } const hwInfo_t *platform_getHwInfo()