firmware
IEM Firmware Documentation
Loading...
Searching...
No Matches
codegen Namespace Reference

Data Structures

class  BusContext
class  MessageContext
class  PaddingContext
class  SignalContext

Functions

 generate (str|os.PathLike|list[str|os.PathLike] dbc_path, str|os.PathLike out_path=Path(""))
 get_type_width (int length)

Variables

str INC_DIR = "inc"
str DBC_GLOB = "*.dbc"
str SOURCE_TEMPLATE = "can.c.j2"
str HEADER_TEMPLATE = "can.h.j2"
str CMAKELISTS_TEMPLATE = "CMakeLists.txt.j2"
str STATIC_CHECKS_TEMPLATE = "codec_static_checks.h.j2"
float VERSION = 0.1
 parser = ArgumentParser()
 type
 help
 nargs
 out_path
 dbc_path
 args = parser.parse_args()

Detailed Description

Generates C code and CMake configuration files to pack and unpack signals in CAN messages from a DBC file.

Function Documentation

◆ generate()

codegen.generate ( str | os.PathLike | list[str | os.PathLike] dbc_path,
str | os.PathLike out_path = Path("") )
Generates C code and CMake configuration files

:param dbc_path: Path or list of paths to input DBC files (or directories containing input DBC files)
:type dbc_path: str | os.PathLike | list[str | os.PathLike]
:param out_path: Path to the output directory for generated code
:type out_path: str | os.PathLike

◆ get_type_width()

codegen.get_type_width ( int length)
Given a signal length, returns the smallest C integer type width (in bits) needed to contain it

Variable Documentation

◆ args

codegen.args = parser.parse_args()

◆ CMAKELISTS_TEMPLATE

str codegen.CMAKELISTS_TEMPLATE = "CMakeLists.txt.j2"

◆ DBC_GLOB

str codegen.DBC_GLOB = "*.dbc"

◆ dbc_path

codegen.dbc_path

◆ HEADER_TEMPLATE

str codegen.HEADER_TEMPLATE = "can.h.j2"

◆ help

codegen.help

◆ INC_DIR

str codegen.INC_DIR = "inc"

◆ nargs

codegen.nargs

◆ out_path

codegen.out_path

◆ parser

codegen.parser = ArgumentParser()

◆ SOURCE_TEMPLATE

str codegen.SOURCE_TEMPLATE = "can.c.j2"

◆ STATIC_CHECKS_TEMPLATE

str codegen.STATIC_CHECKS_TEMPLATE = "codec_static_checks.h.j2"

◆ type

codegen.type

◆ VERSION

float codegen.VERSION = 0.1