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)
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());
176 board::syslog(intToString(getNode().getNodeID().
get()).c_str());
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);
void setErrorLed(bool state)
static const uint32_t MaskExtID
static const uint32_t FlagEFF
Extended frame format.
void setStatusLed(bool state)
constexpr unsigned NodeMemoryPoolSize
static CanDriver & instance()
bool isAllocationComplete() const
UAVCAN_EXPORT OutputIt copy(InputIt first, InputIt last, OutputIt result)
uavcan::UtcDuration getPrevUtcAdjustment()
static uavcan::uint32_t detectBitRate(void(*idle_callback)()=nullptr)
NodeID getAllocatedNodeID() const
uavcan::int16_t configureFilters(const uavcan::CanFilterConfig *filter_configs, uavcan::uint16_t num_configs) override
static uint8_t swap(uint8_t x)
Dreht die beiden Nibble in einem Byte um.
static constexpr unsigned UniqueIDSize
static MonotonicDuration fromMSec(int64_t ms)
void syslog(const char *msg)
void readUniqueID(std::uint8_t out_uid[UniqueIDSize])
static SystemClock & instance()
uavcan::MonotonicTime getMonotonic()
int start(const UniqueID &unique_id, const NodeID preferred_node_id=NodeID::Broadcast, const TransferPriority transfer_priority=TransferPriority::OneHigherThanLowest)