From f67f3563019f7b171c6d7be4168d59defbe7facd Mon Sep 17 00:00:00 2001
From: kruger <kruger@astron.nl>
Date: Tue, 6 Jul 2021 16:27:04 +0200
Subject: [PATCH] UNB2 I2C enabled pin set on UNB2_on

---
 config/UNB2TR.yaml | 11 ++++++++++-
 scripts/UNB2on.py  |  8 ++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 scripts/UNB2on.py

diff --git a/config/UNB2TR.yaml b/config/UNB2TR.yaml
index 6c15cd8..3dbda4a 100644
--- a/config/UNB2TR.yaml
+++ b/config/UNB2TR.yaml
@@ -48,7 +48,7 @@ drivers:
    type: gpio
    parameters: [19,26] 
 
- - name: GPIO2
+ - name: I2C_GPIO
    type: gpio
    parameters: [11,13] 
 
@@ -258,6 +258,14 @@ variables:
      convert_unit: bool_invert
      dim: 2
 
+   - name: UNB2_I2C_enabled
+     driver: I2C_GPIO
+     mask: UNB2_mask
+     width: 1
+     rw:  ro
+     dtype: boolean
+     dim: 2
+
    - name: UNB2_Front_Panel_LED_colour
      description: bit 0=Red, 1=Blue, 2=Green
      mask: UNB2_mask
@@ -485,6 +493,7 @@ methods:
     mask: UNB2_mask
     driver: switch_FP
     instructions:
+     - UNB2_I2C_enabled: 1 #Make sure I2C switches are enabled
      - FP_IO.CONF: 0xf8 #bit 0-2 output for LED
      - UNB2_PWR_on: 0 #already inverted
      - UNB2_Front_Panel_LED_colour: 3 #green
diff --git a/scripts/UNB2on.py b/scripts/UNB2on.py
new file mode 100644
index 0000000..77bf51c
--- /dev/null
+++ b/scripts/UNB2on.py
@@ -0,0 +1,8 @@
+from test_common import *
+connect("opc.tcp://localhost:4841/")
+
+set_value("UNB2_mask_RW",[True,True])
+
+callmethod("UNB2_on")
+
+disconnect();
-- 
GitLab