From da96f8b585d7772e1eefef2f40a23e841cda3389 Mon Sep 17 00:00:00 2001 From: Niklas Eiling Date: Thu, 18 Apr 2024 14:46:03 +0200 Subject: [PATCH] fpga: improve comments in register.cpp Signed-off-by: Niklas Eiling --- fpga/lib/ips/register.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fpga/lib/ips/register.cpp b/fpga/lib/ips/register.cpp index 83bb134c0..9310a1183 100644 --- a/fpga/lib/ips/register.cpp +++ b/fpga/lib/ips/register.cpp @@ -43,9 +43,12 @@ bool Register::check() { } // This is Dino specific for now - we should possibly move this to Dino in the future - setRegister(0, static_cast(1000)); // set Dino to a rate of 20 kHz - setRegister(1, -0.001615254F); - setRegister(2, 10.8061F); + constexpr double dinoClk = 25e9; // Dino is clocked with 25 Mhz + constexpr double sampleRate = 20e6; // We want to achieve a timestep of 50us + constexpr uint32_t dinoTimerVal = static_cast(dinoClk / sampleRate); + setRegister(0, dinoTimerVal); // Timer value for generating ADC trigger signal + setRegister(1, -0.001615254F); // Scale factor for ADC value + setRegister(2, 10.8061F); // Offset for ADC value uint32_t rate = getRegister(0); float scale = getRegisterFloat(1); float offset = getRegisterFloat(2);