Reorganizing project
This commit is contained in:
commit
9924e704db
14 changed files with 1029 additions and 0 deletions
51
inc/ll_usartcore.h
Normal file
51
inc/ll_usartcore.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* ll_dmadrivenusartcore.h
|
||||
*
|
||||
* Created on: Nov 4, 2019
|
||||
* Author: abody
|
||||
*/
|
||||
|
||||
#ifndef LL_USARTCORE_H_
|
||||
#define LL_USARTCORE_H_
|
||||
#include <platform/usart_ll.h>
|
||||
|
||||
#include "f4ll/ll_dmahelper.h"
|
||||
|
||||
namespace f4ll {
|
||||
|
||||
class LL_UsartCore
|
||||
{
|
||||
public:
|
||||
static inline void HandleUsartIrq(LL_UsartCore *_this) { _this->UsartIsr(); }
|
||||
static inline void HandleRxDmaIrq(LL_UsartCore *_this) { _this->RxDmaIsr(); }
|
||||
static inline void HandleTxDmaIrq(LL_UsartCore *_this) { _this->TxDmaIsr(); }
|
||||
|
||||
protected:
|
||||
LL_UsartCore(USART_TypeDef *usart, DMA_TypeDef *dma, uint32_t streamRx, uint32_t streamTx);
|
||||
|
||||
virtual void ReceiverIdle() = 0;
|
||||
virtual void TransmissionComplete() = 0;
|
||||
|
||||
virtual void RxDmaTransferComplete() = 0;
|
||||
virtual void RxDmaHalfTransfer() = 0;
|
||||
virtual void RxDmaError(LL_DmaHelper::DmaErrorType reason) = 0;
|
||||
|
||||
virtual void TxDmaTransferComplete() = 0;
|
||||
virtual void TxDmaHalfTransfer() = 0;
|
||||
virtual void TxDmaError(LL_DmaHelper::DmaErrorType reason) = 0;
|
||||
|
||||
void SetupTransmit(void const *buffer, uint16_t length);
|
||||
void SetupReceive(void *buffer, uint16_t length);
|
||||
|
||||
void UsartIsr();
|
||||
void RxDmaIsr();
|
||||
void TxDmaIsr();
|
||||
|
||||
USART_TypeDef *m_usart;
|
||||
LL_DmaHelper m_rxDma;
|
||||
LL_DmaHelper m_txDma;
|
||||
};
|
||||
|
||||
} /* namespace f4ll */
|
||||
|
||||
#endif /* LL_USARTCORE_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue