From 1b9ddfb1aecb4c57812db79e5336b07362755796 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Fri, 15 Mar 2024 21:19:54 -0700 Subject: [PATCH] AP_DAC: apply unity gain --- libraries/AP_DAC/AP_DAC_DACx0501.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/AP_DAC/AP_DAC_DACx0501.cpp b/libraries/AP_DAC/AP_DAC_DACx0501.cpp index 1cb2cf6d28ff34..dcb5be6a79262b 100644 --- a/libraries/AP_DAC/AP_DAC_DACx0501.cpp +++ b/libraries/AP_DAC/AP_DAC_DACx0501.cpp @@ -74,7 +74,15 @@ void AP_DAC_DACx0501::init() return; } + _dev->set_retries(10); + // Set gain to unity + uint8_t buf[3]; + buf[0] = DACx0501_REG_GAIN; + buf[1] = 0; + buf[2] = 0; + UNUSED_RESULT(_dev->transfer(buf, sizeof(buf), nullptr, 0)); _dev->set_retries(3); + _dev->register_periodic_callback(20 * 1000, FUNCTOR_BIND_MEMBER(&AP_DAC_DACx0501::thread, void)); }