pub unsafe extern "C" fn sdm_channel_set_pulse_density(
chan: *mut sdm_channel_t,
density: i8,
) -> i32Expand description
@brief Set the pulse density of the PDM output signal.
@note The raw output signal requires a low-pass filter to restore it into analog voltage,
the restored analog output voltage could be Vout = VDD_IO / 256 * density + VDD_IO / 2
@note This function is allowed to run within ISR context
@note This function will be placed into IRAM if CONFIG_SDM_CTRL_FUNC_IN_IRAM is on,
so that it’s allowed to be executed when Cache is disabled
@param[in] chan SDM channel created by sdm_new_channel
@param[in] density Quantized pulse density of the PDM output signal, ranges from -128 to 127.
But the range of [-90, 90] can provide a better randomness.
@return
- ESP_OK: Set pulse density successfully
- ESP_ERR_INVALID_ARG: Set pulse density failed because of invalid argument
- ESP_FAIL: Set pulse density failed because of other error