Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
2063d3f5f6
Spelling and wording changes 2026-11-11 22:55:59 +00:00
RowanC
83fac395d9
Add meson build 2026-11-11 20:36:30 +00:00
RowanC
ed77634402 Bring api up to currrent state 2026-06-24 18:55:58 +01:00
4 changed files with 16 additions and 6 deletions

2
.gitignore vendored
View file

@ -1,3 +1,3 @@
*.ignore *.ignore
testbuild.sh testbuild.sh
a.so *.so

View file

@ -10,15 +10,16 @@ implemented by the calling program.
This API provides 2 structs for storing data to be written to, and received from This API provides 2 structs for storing data to be written to, and received from
the VCU over CAN. They are `nrai_can_ai_read` and `nrai_can_ai_write` for data the VCU over CAN. They are `nrai_can_ai_read` and `nrai_can_ai_write` for data
received from the VCU and data to write to the VCU respectively. received from the VCU and data to write to the VCU respectively.
This API provides functions for the AI to pack data into CAN frames, named in This API provides functions for the client to pack data into CAN frames, named in
the format the format
`int32_t nrai_can_mkframe_<frame_name>(struct nrai_can_ai_write *, struct can_frame *);` `int32_t nrai_can_mkframe_<frame_name>(struct nrai_can_ai_write *, struct can_frame *);`
and function for the AI to unpack CAN frames, named in the format and functions for the client to unpack CAN frames, named in the format
`int32_t nrai_can_unpack_<frame_name>(struct nrai_can_ai_read *, struct can_frame *);`. `int32_t nrai_can_unpack_<frame_name>(struct nrai_can_ai_read *, struct can_frame *);`.
This API also provides an enum for translating CAN message names into their ID, This API also provides an enum for translating CAN message names into their ID,
all entry's are named in the format `NRAI_CAN_ID_<frame_name>` all entries are named in the format `NRAI_CAN_ID_<frame_name>`, As well as enums
for values contained within frames (see header file).
## Notes ## Notes
This API makes use of limited use of C23 extensions for the purpose of either This API makes use of limited use of C23 extensions where their use either
improving clarity or simplifying code. While all C23 extensions used are improves clarity or simplifies code. While all C23 extensions used are
supported by GCC and Clang, not all compilers support them. supported by GCC and Clang, not all compilers support them.

8
meson.build Normal file
View file

@ -0,0 +1,8 @@
project('nrai_CAN_API', 'C')
lib = static_library('nrai_CAN_API','nrai_CAN_API.c', install : true)
pkg = import('pkgconfig')
install_headers('nrai_CAN_API.h')
pkg.generate(lib,
# version : '1.1',
description : 'the nrai api to pack and unpack CAN frames from the ADS-DV Software Interface Specification into simpler data structures ')

View file

@ -165,6 +165,7 @@ enum{
/* VCU2AI_Status: AS_STATE*/ /* VCU2AI_Status: AS_STATE*/
enum{ enum{
AS_STATE_AS_INIT = 0,
AS_STATE_AS_OFF = 1, AS_STATE_AS_OFF = 1,
AS_STATE_AS_READY = 2, AS_STATE_AS_READY = 2,
AS_STATE_AS_DRIVING = 3, AS_STATE_AS_DRIVING = 3,