mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-11-04 21:09:06 +01:00
Message: LIN: Add wakeup request transmit
This commit is contained in:
committed by
Kyle Schwarz
parent
ee6b846acc
commit
9f747df692
@@ -140,6 +140,10 @@ static std::vector<uint8_t> EncodeFromMessageLIN(std::shared_ptr<Frame> frame, c
|
||||
linpacket->CoreMiniBitsLIN.TXCommander = 1;
|
||||
linpacket->CoreMiniBitsLIN.BreakOnly = 1;
|
||||
break;
|
||||
case LINMessage::Type::LIN_WAKEUP_REQUEST:
|
||||
linpacket->CoreMiniBitsLIN.TXCommander = 1;
|
||||
linpacket->CoreMiniBitsLIN.WakeupRequest = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -165,6 +169,18 @@ static std::vector<uint8_t> EncodeFromMessageLIN(std::shared_ptr<Frame> frame, c
|
||||
linpacket->CoreMiniBitsLIN.len = 0;
|
||||
}
|
||||
|
||||
if(linmsg->linMsgType == LINMessage::Type::LIN_WAKEUP_REQUEST) {
|
||||
const int steps = LINMessage::wakeupPulseWidthSteps(*linmsg);
|
||||
if(!steps) {
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return {};
|
||||
}
|
||||
// data[0] is the pulse width in 50 us steps
|
||||
// data[1] to data[7]: future bits reserved for more LIN wake features
|
||||
linpacket->CoreMiniBitsLIN.len = 1;
|
||||
linpacket->data[0] = static_cast<uint8_t>(steps);
|
||||
}
|
||||
|
||||
// Description/stats and network
|
||||
linpacket->stats = linmsg->description;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user