diff --git a/industry/scpi/Kconfig b/industry/scpi/Kconfig index d8911ecc79e..6797051e680 100644 --- a/industry/scpi/Kconfig +++ b/industry/scpi/Kconfig @@ -7,10 +7,71 @@ config SCPI_PARSER tristate "SCPI instrument side parser" default n +if SCPI_PARSER + +menu "SCPI parser unit support" + +config SCPI_PARSER_UNITS_IMPERIAL + bool "Imperial units" + default n + +config SCPI_PARSER_UNITS_ANGLE + bool "Angle units" + default n + +config SCPI_PARSER_UNITS_PARTICLES + bool "Particle units" + default n + +config SCPI_PARSER_UNITS_DISTANCE + bool "Distance units" + default n + +config SCPI_PARSER_UNITS_MAGNETIC + bool "Magnetic units" + default n + +config SCPI_PARSER_UNITS_LIGHT + bool "Light units" + default n + +config SCPI_PARSER_UNITS_ENERGY_FORCE_MASS + bool "Energy, force, and mass units" + default n + +config SCPI_PARSER_UNITS_TIME + bool "Time units" + default n + +config SCPI_PARSER_UNITS_TEMPERATURE + bool "Temperature units" + default n + +config SCPI_PARSER_UNITS_RATIO + bool "Ratio units" + default n + +config SCPI_PARSER_UNITS_POWER + bool "Power units" + default y + +config SCPI_PARSER_UNITS_FREQUENCY + bool "Frequency units" + default y + +config SCPI_PARSER_UNITS_ELECTRIC + bool "Electric units" + default y + +config SCPI_PARSER_UNITS_ELECTRIC_CHARGE_CONDUCTANCE + bool "Electric charge and conductance units" + default n + +endmenu + config SCPI_PARSER_DEMO bool "Enable the SCPI parser library demo" default n - depends on SCPI_PARSER if SCPI_PARSER_DEMO @@ -23,3 +84,5 @@ config SCPI_PARSER_DEMO_STACKSIZE default DEFAULT_TASK_STACKSIZE endif + +endif diff --git a/industry/scpi/Makefile b/industry/scpi/Makefile index c86267297ec..51501112984 100644 --- a/industry/scpi/Makefile +++ b/industry/scpi/Makefile @@ -39,6 +39,24 @@ CFLAGS += -DHAVE_SNPRINTF CFLAGS += -DHAVE_STRNDUP CFLAGS += -DHAVE_STRNCASECMP +SCPI_UNIT = $(if $(filter y,$(CONFIG_SCPI_PARSER_UNITS_$(1))),1,0) +SCPI_UECC = $(call SCPI_UNIT,ELECTRIC_CHARGE_CONDUCTANCE) + +CFLAGS += -DUSE_UNITS_IMPERIAL=$(call SCPI_UNIT,IMPERIAL) +CFLAGS += -DUSE_UNITS_ANGLE=$(call SCPI_UNIT,ANGLE) +CFLAGS += -DUSE_UNITS_PARTICLES=$(call SCPI_UNIT,PARTICLES) +CFLAGS += -DUSE_UNITS_DISTANCE=$(call SCPI_UNIT,DISTANCE) +CFLAGS += -DUSE_UNITS_MAGNETIC=$(call SCPI_UNIT,MAGNETIC) +CFLAGS += -DUSE_UNITS_LIGHT=$(call SCPI_UNIT,LIGHT) +CFLAGS += -DUSE_UNITS_ENERGY_FORCE_MASS=$(call SCPI_UNIT,ENERGY_FORCE_MASS) +CFLAGS += -DUSE_UNITS_TIME=$(call SCPI_UNIT,TIME) +CFLAGS += -DUSE_UNITS_TEMPERATURE=$(call SCPI_UNIT,TEMPERATURE) +CFLAGS += -DUSE_UNITS_RATIO=$(call SCPI_UNIT,RATIO) +CFLAGS += -DUSE_UNITS_POWER=$(call SCPI_UNIT,POWER) +CFLAGS += -DUSE_UNITS_FREQUENCY=$(call SCPI_UNIT,FREQUENCY) +CFLAGS += -DUSE_UNITS_ELECTRIC=$(call SCPI_UNIT,ELECTRIC) +CFLAGS += -DUSE_UNITS_ELECTRIC_CHARGE_CONDUCTANCE=$(SCPI_UECC) + ifneq ($(CONFIG_SCPI_PARSER_DEMO),) MAINSRC = $(SCPI_UNPACK)/examples/test-interactive/main.c CSRCS += scpi-def.c