updated can.h to have arduino specific can_frame 3 bytes smaller than can_frame structure used by other compilers#134
Open
arduinoenigma wants to merge 1 commit intoautowp:masterfrom
Open
Conversation
… can_frame structure used by other compilers
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



can_frame was changed in Pull Request (#122) to accommodate other compilers by adding alignas(8) to __u8 data[CAN_MAX_DLEN];
When compiling in Arduino, this adds 3 extra bytes of ram per each can_frame struct used.
This pull request detects if the arduino headers are used and then defines an arduino specific version
With alignas(8):
Serial.println(sizeof(can_frame));
16
Sketch uses 22854 bytes (74%) of program storage space. Maximum is 30720 bytes.
Global variables use 1800 bytes (87%) of dynamic memory, leaving 248 bytes for local variables. Maximum is 2048 bytes.
Without alignas(8):
Serial.println(sizeof(can_frame));
13
Sketch uses 22864 bytes (74%) of program storage space. Maximum is 30720 bytes.
Global variables use 1688 bytes (82%) of dynamic memory, leaving 360 bytes for local variables. Maximum is 2048 bytes.