mirror of https://github.com/rusefi/isotp-c.git
Enable warnings when compiling and fix a few.
This commit is contained in:
parent
513d8c8d70
commit
08ac01d130
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
|||
CC = gcc
|
||||
INCLUDES = -Isrc -Ideps/bitfield-c/src
|
||||
CFLAGS = $(INCLUDES) -c -w -Wall -Werror -g -ggdb -std=gnu++0x -coverage
|
||||
CFLAGS = $(INCLUDES) -c -Wall -Werror -g -ggdb -std=gnu99 -coverage
|
||||
LDFLAGS = -coverage -lm
|
||||
LDLIBS = -lcheck
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit eab0c42eac865a7e965878a7f2ad548371bd34d5
|
||||
Subproject commit 7f1d5473842361f97fef886bc4e98949ecf853b6
|
|
@ -3,6 +3,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
IsoTpShims SHIMS;
|
||||
IsoTpReceiveHandle RECEIVE_HANDLE;
|
||||
|
@ -30,7 +31,7 @@ void debug(const char* format, ...) {
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
void mock_send_can(const uint16_t arbitration_id, const uint8_t* data,
|
||||
bool mock_send_can(const uint16_t arbitration_id, const uint8_t* data,
|
||||
const uint8_t size) {
|
||||
can_frame_was_sent = true;
|
||||
last_can_frame_sent_arb_id = arbitration_id;
|
||||
|
@ -38,9 +39,7 @@ void mock_send_can(const uint16_t arbitration_id, const uint8_t* data,
|
|||
if(size > 0) {
|
||||
memcpy(last_can_payload_sent, data, size);
|
||||
}
|
||||
}
|
||||
|
||||
void mock_set_timer(uint16_t time_ms, void (*callback)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void message_received(const IsoTpMessage* message) {
|
||||
|
@ -80,7 +79,7 @@ void can_frame_sent(const uint16_t arbitration_id, const uint8_t* payload,
|
|||
}
|
||||
|
||||
void setup() {
|
||||
SHIMS = isotp_init_shims(debug, mock_send_can, mock_set_timer);
|
||||
SHIMS = isotp_init_shims(debug, mock_send_can, NULL);
|
||||
RECEIVE_HANDLE = isotp_receive(&SHIMS, 0x2a, message_received);
|
||||
memset(last_message_sent_payload, 0, OUR_MAX_ISO_TP_MESSAGE_SIZE);
|
||||
memset(last_message_received_payload, 0, OUR_MAX_ISO_TP_MESSAGE_SIZE);
|
||||
|
|
|
@ -48,8 +48,7 @@ START_TEST (test_send_single_frame)
|
|||
{
|
||||
const uint8_t payload[] = {0x12, 0x34};
|
||||
uint16_t arbitration_id = 0x2a;
|
||||
IsoTpSendHandle handle = isotp_send(&SHIMS, arbitration_id, payload,
|
||||
sizeof(payload), message_sent);
|
||||
isotp_send(&SHIMS, arbitration_id, payload, sizeof(payload), message_sent);
|
||||
ck_assert_int_eq(last_message_sent_arb_id, arbitration_id);
|
||||
fail_unless(last_message_sent_status);
|
||||
ck_assert_int_eq(last_message_sent_payload[0], 0x12);
|
||||
|
|
Loading…
Reference in New Issue