Skip to content

Commit

Permalink
Add closedown function
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMartensson committed Jul 16, 2023
1 parent 2007696 commit eb574cf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Src/Open_SAE_J1939/Closedown_ECU.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Closedown_ECU.c
*
* Created on: 16 Juli. 2023
* Author: Daniel Mårtensson
*/

#include "Open_SAE_J1939.h"

/* Layers */
#include "../Hardware/Hardware.h"

/* Save our ECU parameters into J1939 structure. Very useful if you want your ECU remember its NAME + address + identifications at startup. */
bool Open_SAE_J1939_Closedown_ECU(J1939* j1939) {
uint32_t ECU_information_length = sizeof(Information_this_ECU);
uint8_t ECU_information_data[sizeof(Information_this_ECU)];
memcpy(ECU_information_data, (uint8_t*)&j1939->information_this_ECU, ECU_information_length);
return Save_Struct(ECU_information_data, ECU_information_length, (char*)INFORMATION_THIS_ECU);
}
3 changes: 3 additions & 0 deletions Src/Open_SAE_J1939/Open_SAE_J1939.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ bool Open_SAE_J1939_Listen_For_Messages(J1939 *j1939);
/* This function should ONLY be called at your ECU startup */
bool Open_SAE_J1939_Startup_ECU(J1939* j1939);

/* This function should ONLY be called at your ECU closedown */
bool Open_SAE_J1939_Closedown_ECU(J1939* j1939);

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit eb574cf

Please sign in to comment.