signal_generator: also reject negative frequencies

This commit is contained in:
Robert Jördens 2021-07-21 13:29:13 +02:00
parent f4fd752d54
commit 4f04bf17a8

View File

@ -77,7 +77,7 @@ impl TryFrom<BasicConfig> for Config {
// Validate base frequency tuning word to be below Nyquist. // Validate base frequency tuning word to be below Nyquist.
const NYQUIST: f32 = (1u32 << 31) as _; const NYQUIST: f32 = (1u32 << 31) as _;
if 2.0 * ftw > NYQUIST { if ftw < 0.0 || 2.0 * ftw > NYQUIST {
return Err(Error::InvalidFrequency); return Err(Error::InvalidFrequency);
} }