Console handler in C++

This commit is contained in:
Attila Body 2019-11-08 09:04:35 +01:00
parent f0c2ad69c9
commit 2d6567b1b2
5 changed files with 131 additions and 41 deletions

43
lib/ll_consolehandler.h Normal file
View file

@ -0,0 +1,43 @@
/*
* ll_consolehandler.h
*
* Created on: Nov 7, 2019
* Author: abody
*/
#ifndef LL_CONSOLEHANDLER_H_
#define LL_CONSOLEHANDLER_H_
#include "ll_hsusart.h"
#include "singleton.h"
namespace f4ll {
class LL_ConsoleHandler: public LL_UsartCore, public Singleton<LL_ConsoleHandler>
{
friend class Singleton<LL_ConsoleHandler>;
public:
// LL_UsartCore pure virtual function implementations
virtual void ReceiverIdle(void);
virtual void TransmissionComplete(void);
virtual void RxDmaTransferComplete(void);
virtual void RxDmaHalfTransfer(void);
virtual void RxDmaError(LL_DmaHelper::DmaErrorType reason);
virtual void TxDmaTransferComplete(void);
virtual void TxDmaHalfTransfer(void);
virtual void TxDmaError(LL_DmaHelper::DmaErrorType reason);
void PrintStats(uint8_t id, LL_HsUsart &usart);
private:
LL_ConsoleHandler(USART_TypeDef *usart, DMA_TypeDef *dma, uint32_t streamRx, uint32_t streamTx);
char m_buffer[128];
uint16_t m_used = 0;
};
} /* namespace f4ll */
#endif /* LL_CONSOLEHANDLER_H_ */