From e57f008a56291335b4f4fb794c7364f5fb369bcb Mon Sep 17 00:00:00 2001
From: GijsSchoonderbeek <schoonderbeek@astron.nl>
Date: Wed, 6 Jan 2021 14:51:15 +0100
Subject: [PATCH] Modified the scripts to run on Raspberry Pi.

Script will check if it is run on a PI, in that case a different I2C serial library is used.
---
 set_adc.py    | 18 +++++++++++++++++-
 set_adc_tm.py | 20 ++++++++++++++++++--
 set_clk.py    | 20 ++++++++++++++++++--
 set_clk_tm.py | 20 ++++++++++++++++++--
 4 files changed, 71 insertions(+), 7 deletions(-)

diff --git a/set_adc.py b/set_adc.py
index 8aabf03..ec48ff0 100644
--- a/set_adc.py
+++ b/set_adc.py
@@ -1,11 +1,27 @@
 '''
+Copyright 2021 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten,
+ASTRON Netherlands Institute for Radio Astronomy
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
 Set ADC
 
 '''
 import sys
 import time
 sys.path.insert(0,'.')
-from I2C_serial import *
+import os
+if os.name =="posix":
+    from I2C_serial_pi import *
+else:
+    from I2C_serial import *
 
 sleep_time=0.05
 CHECK_I2C_DEVICES = False
diff --git a/set_adc_tm.py b/set_adc_tm.py
index 4b1ff4e..dc17bc1 100644
--- a/set_adc_tm.py
+++ b/set_adc_tm.py
@@ -1,11 +1,27 @@
 '''
-Set ADC
+Copyright 2021 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten,
+ASTRON Netherlands Institute for Radio Astronomy
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Test script to write single registers of RCU2_ADC
 
 '''
 import sys
 import time
 sys.path.insert(0,'.')
-from I2C_serial import *
+import os
+if os.name =="posix":
+    from I2C_serial_pi import *
+else:
+    from I2C_serial import *
 
 sleep_time=0.05
 CHECK_I2C_DEVICES = False
diff --git a/set_clk.py b/set_clk.py
index bd6da61..cb1d565 100644
--- a/set_clk.py
+++ b/set_clk.py
@@ -1,11 +1,27 @@
 '''
-Set ADC
+Copyright 2021 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten,
+ASTRON Netherlands Institute for Radio Astronomy
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Set PCC_CLK
 
 '''
 import sys
 import time
 sys.path.insert(0,'.')
-from I2C_serial import *
+import os
+if os.name =="posix":
+    from I2C_serial_pi import *
+else:
+    from I2C_serial import *
 
 sleep_time=0.05
 PWR_RST = False
diff --git a/set_clk_tm.py b/set_clk_tm.py
index eb0b022..50b28a8 100644
--- a/set_clk_tm.py
+++ b/set_clk_tm.py
@@ -1,11 +1,27 @@
 '''
-Set ADC
+Copyright 2021 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten,
+ASTRON Netherlands Institute for Radio Astronomy
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Test script to write single registers of PCC_CLK.
 
 '''
 import sys
 import time
 sys.path.insert(0,'.')
-from I2C_serial import *
+import os
+if os.name =="posix":
+    from I2C_serial_pi import *
+else:
+    from I2C_serial import *
 
 sleep_time=0.05
 PWR_RST = False
-- 
GitLab