mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 19:33:35 +08:00
LPC11C24: More complete test
This commit is contained in:
@@ -42,7 +42,7 @@ BUILDDIR = build
|
|||||||
OBJDIR = $(BUILDDIR)/obj
|
OBJDIR = $(BUILDDIR)/obj
|
||||||
DEPDIR = $(BUILDDIR)/dep
|
DEPDIR = $(BUILDDIR)/dep
|
||||||
|
|
||||||
DEF += -DNDEBUG -DCHIP_LPC11CXX -DCORE_M0 -DTHUMB_NO_INTERWORKING
|
DEF += -DNDEBUG -DCHIP_LPC11CXX -DCORE_M0 -DTHUMB_NO_INTERWORKING -U__STRICT_ANSI__
|
||||||
|
|
||||||
FLAGS = -mthumb -mcpu=cortex-m0 -mno-thumb-interwork
|
FLAGS = -mthumb -mcpu=cortex-m0 -mno-thumb-interwork
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* Pavel Kirienko, 2014 <pavel.kirienko@gmail.com>
|
* Pavel Kirienko, 2014 <pavel.kirienko@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <board.hpp>
|
#include <board.hpp>
|
||||||
#include <chip.h>
|
#include <chip.h>
|
||||||
#include <uavcan_lpc11c24/can.hpp>
|
#include <uavcan_lpc11c24/can.hpp>
|
||||||
@@ -22,6 +23,7 @@ int main()
|
|||||||
uavcan_lpc11c24::clock::init();
|
uavcan_lpc11c24::clock::init();
|
||||||
|
|
||||||
uavcan::MonotonicTime prev_mono;
|
uavcan::MonotonicTime prev_mono;
|
||||||
|
uavcan::MonotonicTime prev_time_pub_at;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -52,5 +54,19 @@ int main()
|
|||||||
{
|
{
|
||||||
board::setStatusLed(false);
|
board::setStatusLed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((ts_mono - prev_time_pub_at).toMSec() >= 1000)
|
||||||
|
{
|
||||||
|
prev_time_pub_at = ts_mono;
|
||||||
|
|
||||||
|
uavcan::CanFrame frm;
|
||||||
|
frm.dlc = 8;
|
||||||
|
std::fill_n(frm.data, 8, 0);
|
||||||
|
snprintf(reinterpret_cast<char*>(frm.data), 8, "%u", unsigned(ts_mono.toMSec()));
|
||||||
|
|
||||||
|
frm.id = ts_mono.toMSec() | uavcan::CanFrame::FlagEFF;
|
||||||
|
|
||||||
|
ENFORCE(1 == uavcan_lpc11c24::CanDriver::instance().send(frm, ts_mono, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user