Interrupt handlers C -> C++
This commit is contained in:
parent
9dba241466
commit
4de62c7f74
10 changed files with 105 additions and 75 deletions
13
app/globals_cpp.cpp
Normal file
13
app/globals_cpp.cpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* globals_cpp.cpp
|
||||
*
|
||||
* Created on: Nov 4, 2019
|
||||
* Author: abody
|
||||
*/
|
||||
#include "globals.h"
|
||||
|
||||
#include "ll_hsusart.h"
|
||||
|
||||
f4ll::LL_HsUsart *g_usarts[4];
|
||||
|
||||
|
17
app/globals_cpp.h
Normal file
17
app/globals_cpp.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* globals_cpp.h
|
||||
*
|
||||
* Created on: Nov 4, 2019
|
||||
* Author: abody
|
||||
*/
|
||||
|
||||
#ifndef GLOBALS_CPP_H_
|
||||
#define GLOBALS_CPP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "ll_hsusart.h"
|
||||
|
||||
extern f4ll::LL_HsUsart *g_usarts[4];
|
||||
|
||||
#endif // __cplusplus
|
||||
#endif /* GLOBALS_CPP_H_ */
|
|
@ -8,39 +8,16 @@
|
|||
#include <stdlib.h>
|
||||
#include "ll_hsusart.h"
|
||||
#include "ll_crchandler.h"
|
||||
#include "ll_testbed.h"
|
||||
#include "main.h"
|
||||
extern "C" {
|
||||
#include "main.h"
|
||||
#include "globals.h"
|
||||
#include "strutil.h"
|
||||
}
|
||||
#include "globals_cpp.h"
|
||||
|
||||
#define PACKAGE_DELAY_MS 0
|
||||
#define STATS_DELAY_MS 1000
|
||||
|
||||
f4ll::LL_CrcHandler *g_crc = nullptr;
|
||||
|
||||
f4ll::LL_HsUsart *g_usarts[4];
|
||||
|
||||
extern "C" void _HandleCrcDmaIrq(void)
|
||||
{
|
||||
f4ll::LL_CrcHandler::Instance().DmaTransferCompleted();
|
||||
}
|
||||
|
||||
extern "C" void _HandleUsartIrq(int offset)
|
||||
{
|
||||
f4ll::LL_HsUsart::HandleUsartIrq(g_usarts[offset]);
|
||||
}
|
||||
|
||||
extern "C" void _HandleUsartRxDmaIrq(int offset)
|
||||
{
|
||||
f4ll::LL_HsUsart::HandleRxDmaIrq(g_usarts[offset]);
|
||||
}
|
||||
|
||||
extern "C" void _HandleUsartTxDmaIrq(int offset)
|
||||
{
|
||||
f4ll::LL_HsUsart::HandleTxDmaIrq(g_usarts[offset]);
|
||||
}
|
||||
|
||||
#define ADDINFO(b,s,u) \
|
||||
b += strcpy_ex(b,s); \
|
||||
|
@ -85,7 +62,7 @@ extern "C" void MainLoop()
|
|||
f4ll::LL_CrcHandler::Init(DMA2, LL_DMA_STREAM_4);
|
||||
|
||||
f4ll::LL_CrcHandler::Slot<2> slt;
|
||||
f4ll::LL_HsUsart u1{USART1, DMA2, LL_DMA_STREAM_2, LL_DMA_STREAM_7};
|
||||
f4ll::LL_HsUsart u1{ USART1, DMA2, LL_DMA_STREAM_2, LL_DMA_STREAM_7 };
|
||||
f4ll::LL_HsUsart u2{ USART2, DMA1, LL_DMA_STREAM_5, LL_DMA_STREAM_6 };
|
||||
f4ll::LL_HsUsart u3{ USART3, DMA1, LL_DMA_STREAM_1, LL_DMA_STREAM_3 };
|
||||
f4ll::LL_HsUsart u6{ USART6, DMA2, LL_DMA_STREAM_1, LL_DMA_STREAM_6 };
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* ll_testbed.h
|
||||
*
|
||||
* Created on: Oct 31, 2019
|
||||
* Author: compi
|
||||
*/
|
||||
|
||||
#ifndef LL_TESTBED_H_
|
||||
#define LL_TESTBED_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void _HandleCrcDmaIrq(void);
|
||||
void _HandleUsartIrq(int offset);
|
||||
void _HandleUsartRxDmaIrq(int offset);
|
||||
void _HandleUsartTxDmaIrq(int offset);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* LL_TESTBED_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue