diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-02-14 18:06:40 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-02-14 18:07:29 -0500 |
commit | 2e37a1f1000d2ce827a028206e6b42b10536e7b3 (patch) | |
tree | 10e469b80e88ec51ea999eb115c3cf11eab48ae1 /src/uds | |
parent | 85c06482daca518981b2b0c1d5661b10a8d5c379 (diff) |
Add an option to pad outgoing CAN frames to 8 bytes (on by default).
Fixed #3.
Diffstat (limited to 'src/uds')
-rw-r--r-- | src/uds/uds.c | 3 | ||||
-rw-r--r-- | src/uds/uds_types.h | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/uds/uds.c b/src/uds/uds.c index f38c6aa..9fec9a8 100644 --- a/src/uds/uds.c +++ b/src/uds/uds.c @@ -87,6 +87,7 @@ DiagnosticRequestHandle diagnostic_request(DiagnosticShims* shims, handle.isotp_shims = isotp_init_shims(shims->log, shims->send_can_message, shims->set_timer); + handle.isotp_shims.frame_padding = !request->no_frame_padding; handle.isotp_send_handle = isotp_send(&handle.isotp_shims, request->arbitration_id, payload, @@ -121,7 +122,7 @@ DiagnosticRequestHandle diagnostic_request(DiagnosticShims* shims, // that are just called continuously from the main loop. it's a waste of a // few cpu cycles but it may be more natural than callbacks. // - // what woudl a timer callback look like...it would need to pass the handle + // what would a timer callback look like...it would need to pass the handle // and that's all. seems like a context void* would be able to capture all // of the information but arg, memory allocation. look at how it's done in // the other library again diff --git a/src/uds/uds_types.h b/src/uds/uds_types.h index 88c7ce4..10d15d6 100644 --- a/src/uds/uds_types.h +++ b/src/uds/uds_types.h @@ -42,6 +42,10 @@ typedef enum { * payload - (optional) The payload for the request, if the request requires * one. If payload_length is 0 this field is ignored. * payload_length - The length of the payload, or 0 if no payload is used. + * no_frame_padding - false if sent CAN payloads should *not* be padded out to a + * full 8 byte CAN frame. Many ECUs require this, but others require the + * size of the CAN message to only be the actual data. By default padding + * is enabled (so this struct value can default to 0). * type - the type of the request (TODO unused) */ typedef struct { @@ -52,6 +56,7 @@ typedef struct { uint8_t pid_length; uint8_t payload[MAX_UDS_PAYLOAD_LENGTH]; uint8_t payload_length; + bool no_frame_padding; DiagnosticRequestType type; } DiagnosticRequest; |