CTRE Phoenix 6 C++ 26.70.0-alpha-2
Loading...
Searching...
No Matches
canframe.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) Cross The Road Electronics.  All rights reserved.
3 * License information can be found in CTRE_LICENSE.txt
4 * For support and suggestions contact support@ctr-electronics.com or file
5 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
6 */
7#pragma once
8
9#include <stdint.h>
10
11namespace ctre {
12namespace phoenix {
13namespace platform {
14namespace can {
15
16 /**
17 * "plain old data" container for holding a CAN Frame Event.
18 * Assignment of this type resolves to a copy-by-value.
19 */
20 struct canframe_t {
21 uint32_t arbID; //!< ArbID of the CAN frame.
22 uint64_t hwTimestampUs; //!< Hardware timestamp if receive event. Zero otherwise.
23 uint64_t swTimestampUs; //!< Software timestamp if receive event. Zero otherwise.
24 uint8_t data[64]; //!< Data bytes
25 uint32_t flags; //!< CAN flags, such as FD and BRS
26 uint8_t len; //!< Number of bytes in payload
27 };
28
37
38 /**
39 * Information about the status of a CAN bus.
40 */
42 float bus_util; //!< [0, 1]
43 uint32_t bus_error;
45 uint32_t restarts;
46 uint32_t bus_off;
47 uint32_t tx_full;
48 uint16_t rec;
49 uint16_t tec;
50 int can_state; //!< can_state_t
51 };
52
53} //namespace can
54} //namespace platform
55} //namespace phoenix
56} //namespace ctre
Definition Platform.hpp:22
can_state_t
Definition canframe.hpp:29
@ STOPPED
Definition canframe.hpp:34
@ ERROR_ACTIVE
Definition canframe.hpp:30
@ SLEEPING
Definition canframe.hpp:35
@ ERROR_PASSIVE
Definition canframe.hpp:32
@ BUS_OFF
Definition canframe.hpp:33
@ ERROR_WARNING
Definition canframe.hpp:31
Definition TimeUtil.hpp:14
Definition StatusCodes.h:22
Definition motor_constants.h:14
Information about the status of a CAN bus.
Definition canframe.hpp:41
uint16_t tec
Definition canframe.hpp:49
float bus_util
[0, 1]
Definition canframe.hpp:42
uint32_t restarts
Definition canframe.hpp:45
uint32_t bus_off
Definition canframe.hpp:46
uint32_t tx_full
Definition canframe.hpp:47
int can_state
can_state_t
Definition canframe.hpp:50
uint16_t rec
Definition canframe.hpp:48
uint32_t arbitration_lost
Definition canframe.hpp:44
uint32_t bus_error
Definition canframe.hpp:43
"plain old data" container for holding a CAN Frame Event.
Definition canframe.hpp:20
uint64_t hwTimestampUs
Hardware timestamp if receive event. Zero otherwise.
Definition canframe.hpp:22
uint32_t arbID
ArbID of the CAN frame.
Definition canframe.hpp:21
uint64_t swTimestampUs
Software timestamp if receive event. Zero otherwise.
Definition canframe.hpp:23
uint8_t len
Number of bytes in payload.
Definition canframe.hpp:26
uint8_t data[64]
Data bytes.
Definition canframe.hpp:24
uint32_t flags
CAN flags, such as FD and BRS.
Definition canframe.hpp:25