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
11
namespace
ctre
{
12
namespace
phoenix
{
13
namespace
platform
{
14
namespace
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
29
enum class
can_state_t
:
int
{
30
ERROR_ACTIVE
= 0,
31
ERROR_WARNING
,
32
ERROR_PASSIVE
,
33
BUS_OFF
,
34
STOPPED
,
35
SLEEPING
36
};
37
38
/**
39
* Information about the status of a CAN bus.
40
*/
41
struct
canbus_status_t
{
42
float
bus_util
;
//!< [0, 1]
43
uint32_t
bus_error
;
44
uint32_t
arbitration_lost
;
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
ctre::phoenix::platform::can
Definition
Platform.hpp:22
ctre::phoenix::platform::can::can_state_t
can_state_t
Definition
canframe.hpp:29
ctre::phoenix::platform::can::can_state_t::STOPPED
@ STOPPED
Definition
canframe.hpp:34
ctre::phoenix::platform::can::can_state_t::ERROR_ACTIVE
@ ERROR_ACTIVE
Definition
canframe.hpp:30
ctre::phoenix::platform::can::can_state_t::SLEEPING
@ SLEEPING
Definition
canframe.hpp:35
ctre::phoenix::platform::can::can_state_t::ERROR_PASSIVE
@ ERROR_PASSIVE
Definition
canframe.hpp:32
ctre::phoenix::platform::can::can_state_t::BUS_OFF
@ BUS_OFF
Definition
canframe.hpp:33
ctre::phoenix::platform::can::can_state_t::ERROR_WARNING
@ ERROR_WARNING
Definition
canframe.hpp:31
ctre::phoenix::platform
Definition
TimeUtil.hpp:14
ctre::phoenix
Definition
StatusCodes.h:22
ctre
Definition
motor_constants.h:14
ctre::phoenix::platform::can::canbus_status_t
Information about the status of a CAN bus.
Definition
canframe.hpp:41
ctre::phoenix::platform::can::canbus_status_t::tec
uint16_t tec
Definition
canframe.hpp:49
ctre::phoenix::platform::can::canbus_status_t::bus_util
float bus_util
[0, 1]
Definition
canframe.hpp:42
ctre::phoenix::platform::can::canbus_status_t::restarts
uint32_t restarts
Definition
canframe.hpp:45
ctre::phoenix::platform::can::canbus_status_t::bus_off
uint32_t bus_off
Definition
canframe.hpp:46
ctre::phoenix::platform::can::canbus_status_t::tx_full
uint32_t tx_full
Definition
canframe.hpp:47
ctre::phoenix::platform::can::canbus_status_t::can_state
int can_state
can_state_t
Definition
canframe.hpp:50
ctre::phoenix::platform::can::canbus_status_t::rec
uint16_t rec
Definition
canframe.hpp:48
ctre::phoenix::platform::can::canbus_status_t::arbitration_lost
uint32_t arbitration_lost
Definition
canframe.hpp:44
ctre::phoenix::platform::can::canbus_status_t::bus_error
uint32_t bus_error
Definition
canframe.hpp:43
ctre::phoenix::platform::can::canframe_t
"plain old data" container for holding a CAN Frame Event.
Definition
canframe.hpp:20
ctre::phoenix::platform::can::canframe_t::hwTimestampUs
uint64_t hwTimestampUs
Hardware timestamp if receive event. Zero otherwise.
Definition
canframe.hpp:22
ctre::phoenix::platform::can::canframe_t::arbID
uint32_t arbID
ArbID of the CAN frame.
Definition
canframe.hpp:21
ctre::phoenix::platform::can::canframe_t::swTimestampUs
uint64_t swTimestampUs
Software timestamp if receive event. Zero otherwise.
Definition
canframe.hpp:23
ctre::phoenix::platform::can::canframe_t::len
uint8_t len
Number of bytes in payload.
Definition
canframe.hpp:26
ctre::phoenix::platform::can::canframe_t::data
uint8_t data[64]
Data bytes.
Definition
canframe.hpp:24
ctre::phoenix::platform::can::canframe_t::flags
uint32_t flags
CAN flags, such as FD and BRS.
Definition
canframe.hpp:25
ctre
phoenix
platform
canframe.hpp
Generated by
1.15.0