ECE 486 Support Libraries
|
Functions | |
void | initialize (uint16_t timer_count_value, enum Num_Channels_In chanin, enum Num_Channels_Out chanout) |
Wrapper function to perform all processor initialization for ECE 486. More... | |
void | initialize_ece486 (uint16_t timer_count_value, enum Num_Channels_In chanin, enum Num_Channels_Out chanout, enum Clock_Reference clkref) |
Wrapper function to perform all processor initialization for ECE 486. More... | |
float | getsamplingfrequency (void) |
Simple function to return the best guess at the actual sampling frequency. More... | |
float getsamplingfrequency | ( | void | ) |
void initialize | ( | uint16_t | timer_count_value, |
enum Num_Channels_In | chanin, | ||
enum Num_Channels_Out | chanout | ||
) |
Wrapper function to perform all processor initialization for ECE 486.
initialize() is provided for backward compatibility: It assumes that the internal (MSI) RC oscillator is to be used as the clock reference signal. To specify use of an external crystal reference, use
This wrapper function is called by users at the start of ECE 486 routines to perform initialization of I/O pins, ADCs, DACs, Timers, DMAs, and Interrupts.
Input parameters determine the ADC/DAC sample rate, and the number of input and output analog channels. Sample rates are determined by specifying a timer_count_value, which determines the ultimate sample frequency. Various #define constants are provided to obtain common sample rates: Timer Count constants for determining ADC/DAC sample rates.
For example:
is used to configure the STM32-Discovery board for sampling at a 50 ksamples/second input and output rate, with one analog input channel, and two analog output channels.
It is not possible to have different ADC and DAC sample rates using this routine.
A call to initialize() also pauses program execution until the "USER" button is pressed, (Joystic "center" on the STM32L476G-Discovery board.) This pause allows the board to be re-programmed without interference from DMA activity.
[in] | timer_count_value | Number of timer counts required per analog sample processed. |
[in] | chanin | Number of input channels: MONO_IN or STEREO_IN |
[in] | chanout | Number of output channels: MONO_OUT or STEREO_OUT |
void initialize_ece486 | ( | uint16_t | timer_count_value, |
enum Num_Channels_In | chanin, | ||
enum Num_Channels_Out | chanout, | ||
enum Clock_Reference | clkref | ||
) |
Wrapper function to perform all processor initialization for ECE 486.
This wrapper function is called by users at the start of ECE 486 routines to perform initialization of I/O pins, ADCs, DACs, Timers, DMAs, and Interrupts.
Input parameters determine the ADC/DAC sample rate, and the number of input and output analog channels, and the source of the clock reference signal. Sample rates are determined by specifying a timer_count_value, which determines the ultimate sample frequency. Various #define constants are provided to obtain common sample rates: Timer Count constants for determining ADC/DAC sample rates.
For example:
is used to configure the STM32-Discovery board for sampling at a 50 ksamples/second input and output rate, with one analog input channel, and two analog output channels. The internal RC MSI oscillator is used to provide the clock generation reference.
It is not possible to have different ADC and DAC sample rates using this routine.
A call to initialize_ece486() also pauses program execution until the "USER" button is pressed, (Joystic "center" on the STM32L476G-Discovery board.) This pause allows the board to be re-programmed without interference from DMA activity.
[in] | timer_count_value | Number of timer counts required per analog sample processed. |
[in] | chanin | Number of input channels: MONO_IN or STEREO_IN |
[in] | chanout | Number of output channels: MONO_OUT or STEREO_OUT |
[in] | clkref | Clock ref source: MSI_INTERNAL_RC or HSE_EXTERNAL_8MHz |