Skip to content

Commit

Permalink
add Hy8001 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Jan 15, 2025
1 parent 897a4a1 commit b7d6736
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/builder2ibek/converters/ipac.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
from enum import Enum

from builder2ibek.converters.epics_base import add_interrupt_vector
from builder2ibek.converters.globalHandler import globalHandler
from builder2ibek.types import Entity, Generic_IOC

xml_component = "ipac"


class Direction(Enum):
Input = 0
Output = 1
Mixed = 2


@globalHandler
def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):
"""
Expand All @@ -15,3 +23,13 @@ def handler(entity: Entity, entity_type: str, ioc: Generic_IOC):
vec = add_interrupt_vector()
entity.add_entity(vec)
entity.interrupt_vector = vec.name

if entity_type == "Hy8001":
entity.direction = Direction(entity.direction).name
entity.remove("name")
for key in ["invertin", "invertout", "ip_support"]:
value = str(entity[key])
if value.lower() == "true":
entity[key] = True
elif value.lower() == "false":
entity[key] = False
2 changes: 1 addition & 1 deletion src/builder2ibek/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Dataclasses for representing XML and YAML in memory
"""

from dataclasses import dataclass, field
from dataclasses import dataclass
from pathlib import Path
from typing import Any

Expand Down

0 comments on commit b7d6736

Please sign in to comment.