From 2a1708dcf4ff0b25c4ec46304d6d6cc655c3e635 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Mon, 27 Nov 2023 09:00:57 +0100 Subject: [PATCH] schemas: add -pascal standard unit suffix Certain sensors use Pascal units. Signed-off-by: Krzysztof Kozlowski --- dtschema/fixups.py | 2 +- dtschema/meta-schemas/core.yaml | 2 +- dtschema/meta-schemas/vendor-props.yaml | 2 +- dtschema/schemas/property-units.yaml | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dtschema/fixups.py b/dtschema/fixups.py index d7b99de9..4e158697 100644 --- a/dtschema/fixups.py +++ b/dtschema/fixups.py @@ -75,7 +75,7 @@ def _fixup_int_matrix(subschema): int_array_re = re.compile('int(8|16|32|64)-array') -unit_types_re = re.compile('-(bps|kBps|bits|percent|bp|m?hz|sec|ms|us|ns|ps|mm|nanoamp|(micro-)?ohms|micro(amp|watt)(-hours)?|milliwatt|microvolt|picofarads|(milli)?celsius|kelvin|kpascal)$') +unit_types_re = re.compile('-(bps|kBps|bits|percent|bp|m?hz|sec|ms|us|ns|ps|mm|nanoamp|(micro-)?ohms|micro(amp|watt)(-hours)?|milliwatt|microvolt|picofarads|(milli)?celsius|kelvin|k?pascal)$') # Remove this once we remove array to matrix fixups known_array_props = { diff --git a/dtschema/meta-schemas/core.yaml b/dtschema/meta-schemas/core.yaml index 1cfff770..51d7f6c8 100644 --- a/dtschema/meta-schemas/core.yaml +++ b/dtschema/meta-schemas/core.yaml @@ -58,7 +58,7 @@ definitions: propertyNames: enum: [ description, deprecated ] - '-(bits|bps|kBps|percent|bp|mhz|hz|sec|ms|us|ns|ps|mm|nanoamp|microamp(-hours)?|(micro-)?ohms|microwatt-hours|microvolt|(femto|pico)farads|(milli)?celsius|kelvin|kpascal)$': + '-(bits|bps|kBps|percent|bp|mhz|hz|sec|ms|us|ns|ps|mm|nanoamp|microamp(-hours)?|(micro-)?ohms|microwatt-hours|microvolt|(femto|pico)farads|(milli)?celsius|kelvin|k?pascal)$': allOf: - $ref: cell.yaml#/array - description: Standard unit suffix properties don't need a type $ref diff --git a/dtschema/meta-schemas/vendor-props.yaml b/dtschema/meta-schemas/vendor-props.yaml index b778fbf9..fcc37269 100644 --- a/dtschema/meta-schemas/vendor-props.yaml +++ b/dtschema/meta-schemas/vendor-props.yaml @@ -17,7 +17,7 @@ patternProperties: '^rcar_sound,': true '-(bits|bps|kBps|percent|bp|mhz|hz|sec|ms|us|ns|ps|mm)$': true '-(nanoamp|microamp|microamp-hours|ohms|micro-ohms|microwatt-hours)$': true - '-(microvolt|(femto|pico)farads|celsius|millicelsius|kelvin|kpascal)$': true + '-(microvolt|(femto|pico)farads|celsius|millicelsius|kelvin|k?pascal)$': true ",.*-names$": type: object diff --git a/dtschema/schemas/property-units.yaml b/dtschema/schemas/property-units.yaml index ac0d885e..4532d76d 100644 --- a/dtschema/schemas/property-units.yaml +++ b/dtschema/schemas/property-units.yaml @@ -124,6 +124,9 @@ patternProperties: description: SI unit of thermodynamic temperature # Pressure + "-pascal$": + $ref: types.yaml#/definitions/int32-array + description: pascal "-kpascal$": $ref: types.yaml#/definitions/int32-array description: kilopascal