mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-12 01:25:59 +00:00
Added DMA support for ADC
This commit is contained in:
parent
8901abdb9c
commit
1fc34fa574
@ -31,6 +31,14 @@ namespace sta
|
|||||||
*/
|
*/
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts conversion of the incoming analog signal in DMA mode.
|
||||||
|
*
|
||||||
|
* @param buffer The buffer to write the converted values to.
|
||||||
|
* @param length The length of the buffer to write the converted values to.
|
||||||
|
*/
|
||||||
|
void startDMA(uint32_t * buffer, size_t length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Polls for the converted analog signal.
|
* @brief Polls for the converted analog signal.
|
||||||
*
|
*
|
||||||
|
@ -17,6 +17,17 @@ namespace sta
|
|||||||
HAL_ADC_Start(handle_);
|
HAL_ADC_Start(handle_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void STM32ADC::startDMA(uint32_t * buffer, size_t length)
|
||||||
|
{
|
||||||
|
STA_ASSERT(buffer != nullptr);
|
||||||
|
STA_ASSERT(length != 0);
|
||||||
|
STA_ASSERT(handle_->DMA_Handle != nullptr);
|
||||||
|
|
||||||
|
HAL_StatusTypeDef res = HAL_ADC_Start_DMA(handle_, buffer, length);
|
||||||
|
|
||||||
|
STA_ASSERT(res == HAL_OK);
|
||||||
|
}
|
||||||
|
|
||||||
void STM32ADC::poll(uint32_t timeout)
|
void STM32ADC::poll(uint32_t timeout)
|
||||||
{
|
{
|
||||||
HAL_StatusTypeDef res = HAL_ADC_PollForConversion(handle_, timeout);
|
HAL_StatusTypeDef res = HAL_ADC_PollForConversion(handle_, timeout);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user