driver: ltc2631

This commit is contained in:
2023-03-26 00:35:58 +01:00
parent 7d30ec0355
commit d387c26596
11 changed files with 362 additions and 31 deletions

View File

@@ -147,13 +147,13 @@ void ad9833_setMode(ad9833_handle_t *hfg, AD_mode_t mode)
static uint32_t ad9833_calcFreq(float f)
// Calculate register value for AD9833 frequency register from a frequency
{
return (uint32_t)((f * AD_2POW28 / AD_MCLK) + 0.5);
return (uint32_t)((f * AD_2POW28 / AD_MCLK) + 0.5f);
}
static uint16_t ad9833_calcPhase(float a)
// Calculate the value for AD9833 phase register from given phase in tenths of a degree
{
return (uint16_t)((512.0 * (a / 10) / 45) + 0.5);
return (uint16_t)((512.0f * (a / 10) / 45) + 0.5f);
}
void ad9833_setFrequency(ad9833_handle_t *hfg, AD_channel_t chan, float freq)