SmartOS/Test/PulsePortTest.cpp

37 lines
641 B
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "App\PulsePort.h"
#include "Device\Port.h"
void InitPort();
void TestPulsePort()
{
InitPort();
}
static void PulseHandler(PulsePort& port)
{
#if defined(DEBUG)
// down true 无遮挡   down false 有遮挡
//static UInt64 HideStr;
//static UInt64 UnHideStr;
// debug_printf("Press P%c%d down=%d", _PIN_NAME(port->_Port->_Pin),down);
#endif
}
// 初始化引脚
void InitPort()
{
static InputPort io(PA6);
static PulsePort Port;
//Port.Set(&io,35);
//Port.Register(PulseHandler, nullptr);
Port.Port = &io;
Port.Min = 35;
Port.Press = PulseHandler;
Port.Open();
}