Skip to content

Commit

Permalink
schemas: add -pascal standard unit suffix
Browse files Browse the repository at this point in the history
Certain sensors use Pascal units.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
  • Loading branch information
krzk authored and robherring committed Nov 27, 2023
1 parent 3c36915 commit 2a1708d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dtschema/fixups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion dtschema/meta-schemas/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dtschema/meta-schemas/vendor-props.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions dtschema/schemas/property-units.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a1708d

Please sign in to comment.