mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
panda.cc: add functions to set can and data speed (#22920)
old-commit-hash: 04e1a25881db89fd186b0a621299093b282dc47b
This commit is contained in:
@@ -344,6 +344,14 @@ void Panda::send_heartbeat() {
|
||||
usb_write(0xf3, 1, 0);
|
||||
}
|
||||
|
||||
void Panda::set_can_speed_kbps(uint16_t bus, uint16_t speed) {
|
||||
usb_write(0xde, bus, (speed * 10));
|
||||
}
|
||||
|
||||
void Panda::set_data_speed_kbps(uint16_t bus, uint16_t speed) {
|
||||
usb_write(0xf9, bus, (speed * 10));
|
||||
}
|
||||
|
||||
uint8_t Panda::len_to_dlc(uint8_t len) {
|
||||
if (len <= 8) {
|
||||
return len;
|
||||
|
||||
@@ -96,6 +96,8 @@ class Panda {
|
||||
void set_power_saving(bool power_saving);
|
||||
void set_usb_power_mode(cereal::PeripheralState::UsbPowerMode power_mode);
|
||||
void send_heartbeat();
|
||||
void set_can_speed_kbps(uint16_t bus, uint16_t speed);
|
||||
void set_data_speed_kbps(uint16_t bus, uint16_t speed);
|
||||
uint8_t len_to_dlc(uint8_t len);
|
||||
void can_send(capnp::List<cereal::CanData>::Reader can_data_list);
|
||||
bool can_receive(std::vector<can_frame>& out_vec);
|
||||
|
||||
Reference in New Issue
Block a user