21 # pragma GCC optimize 1
31 x =
x * 48271 % 2147483647;
47 const short sign = (n < 0) ? -1 : 1;
55 buf[pos++] = char(n % 10 +
'0');
57 while ((n /= 10) > 0);
63 for (
unsigned i = 0, j = pos - 1U; i < j; i++, j--)
67 return static_cast<const char*
>(buf);
93 const int client_start_res = client.start(getNode().getHardwareVersion().unique_id);
94 if (client_start_res < 0)
99 while (!client.isAllocationComplete())
105 return client.getAllocatedNodeID();
125 while (bit_rate == 0)
146 getNode().setName(
"org.uavcan.lpc11c24_test");
148 uavcan::protocol::SoftwareVersion swver;
149 swver.major = FW_VERSION_MAJOR;
150 swver.minor = FW_VERSION_MINOR;
151 swver.vcs_commit = GIT_HASH;
152 swver.optional_field_flags = swver.OPTIONAL_FIELD_FLAG_VCS_COMMIT;
153 getNode().setSoftwareVersion(swver);
155 uavcan::protocol::HardwareVersion hwver;
158 std::copy(std::begin(uid), std::end(uid), std::begin(hwver.unique_id));
159 getNode().setHardwareVersion(hwver);
166 if (getNode().
start() < 0)
173 getNode().setNodeID(performDynamicNodeIDAllocation());
186 constexpr
unsigned NumFilters = 3;
211 if (getTimeSyncSlave().
start() < 0)
216 if (getLogger().
init() < 0)
221 getLogger().setLevel(uavcan::protocol::debug::LogLevel::DEBUG);
232 getNode().setModeOperational();
243 if ((ts - prev_log_at).toMSec() >= 1000)
268 uavcan::protocol::debug::LogMessage logmsg;
269 logmsg.level.value = uavcan::protocol::debug::LogLevel::INFO;
270 logmsg.source =
"app";
272 (void)getLogger().log(logmsg);