Message: LIN: Add wakeup request transmit

This commit is contained in:
Samuel Bejko
2026-11-04 13:30:36 -05:00
committed by Kyle Schwarz
parent ee6b846acc
commit 9f747df692
9 changed files with 228 additions and 0 deletions
@@ -47,11 +47,14 @@ public:
LIN_SYNC_ONLY = icsneoc2_lin_msg_type_sync_only,
LIN_UPDATE_RESPONDER = icsneoc2_lin_msg_type_update_responder,
LIN_ERROR = icsneoc2_lin_msg_type_error,
// needs firmware with LIN wakeup transmit; older firmware sends a commander header (break, sync, ID) instead
LIN_WAKEUP_REQUEST = icsneoc2_lin_msg_type_wakeup_request
};
static void calcChecksum(LINMessage& message);
uint8_t calcProtectedID(uint8_t& id);
// wakeupPulseWidthUs in 50 us steps, 0 if it is outside 250 to 5000 us
static int wakeupPulseWidthSteps(const LINMessage& message);
LINMessage() {};
LINMessage(uint8_t id) : ID(id & 0x3Fu), protectedID(calcProtectedID(ID)) {};
@@ -61,6 +64,9 @@ public:
uint8_t checksum = 0;
LINMessage::Type linMsgType = Type::NOT_SET;
bool isEnhancedChecksum = false;
// LIN_WAKEUP_REQUEST only, the same as the Vehicle Spy LIN Send Wake Width property: 250 to 5000 us,
// rounded to the nearest 50 us. Outside that range the transmit fails.
uint16_t wakeupPulseWidthUs = 300;
LINErrorFlags errFlags;
LINStatusFlags statusFlags;
};
+24
View File
@@ -381,6 +381,7 @@ typedef enum _icsneoc2_lin_msg_type_t {
icsneoc2_lin_msg_type_sync_only = 4,
icsneoc2_lin_msg_type_update_responder = 5,
icsneoc2_lin_msg_type_error = 6,
// needs firmware with LIN wakeup transmit; older firmware sends a commander header (break, sync, ID) instead
icsneoc2_lin_msg_type_wakeup_request = 7,
} _icsneoc2_lin_msg_type_t;
@@ -461,6 +462,29 @@ icsneoc2_error_t icsneoc2_message_lin_props_set(icsneoc2_message_t* message,
const uint8_t* id, const uint8_t* checksum,
const icsneoc2_lin_msg_type_t* msg_type, const bool* is_enhanced_checksum);
/**
* Get the wakeup pulse width of a LIN message.
*
* @param[in] message The message to query (must be a LIN message).
* @param[out] width_us Pointer to receive the pulse width in microseconds. The default is 300 us.
*
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_type if not a LIN message.
*/
icsneoc2_error_t icsneoc2_message_lin_wakeup_width_get(const icsneoc2_message_t* message, uint16_t* width_us);
/**
* Set the wakeup pulse width of a LIN message. Only used by icsneoc2_lin_msg_type_wakeup_request.
*
* The same as the Vehicle Spy LIN Send Wake Width property: 250 to 5000 us, rounded to the nearest 50 us.
* Outside that range the transmit fails.
*
* @param[in] message The message to modify (must be a LIN message).
* @param[in] width_us The pulse width in microseconds.
*
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_type if not a LIN message.
*/
icsneoc2_error_t icsneoc2_message_lin_wakeup_width_set(icsneoc2_message_t* message, uint16_t width_us);
/**
* Get the LIN error flags of a message.
*