Library to use my Photo MOS Relays Circuit having 16 or less channels.

Fork of PMRC4ch by Akifumi Takahashi

Revision:
47:a097e670a983
Parent:
44:20a890fe5f83
Parent:
46:fe9918f73ec0
Child:
48:daef4fb51d25
--- a/PMRC16ch.cpp	Tue Oct 29 02:43:14 2019 +0000
+++ b/PMRC16ch.cpp	Wed Oct 21 20:56:01 2020 +0000
@@ -80,11 +80,8 @@
 //  ----------------------------------------------------------------------------
 void PMRC16ch::setTwin(char arg_stim_ch, char arg_ref_ch)
 {
-    uint32_t l_state = m_PMRC_state;
+    m_PMRC_mode = TWIN_ELECTRODES;
     m_PMRC_state = m_statearray[arg_stim_ch] | (m_statearray[arg_ref_ch] >> 1);
-    if(l_state == m_PMRC_state) return;
-    
-    m_PMRC_mode = TWIN_ELECTRODES;
     setBits(m_PMRC_state);
     upload();
     m_pos_stim = arg_stim_ch;
@@ -94,7 +91,7 @@
 {
     m_PMRC_mode = TWIN_ELECTRODES;
     m_PMRC_state = m_statearray[arg_stim_ch] 
-        | (m_statearray[arg_ref_ch1] >> 1)
+        |(m_statearray[arg_ref_ch1] >> 1)
         | (m_statearray[arg_ref_ch2] >> 1);
     setBits(m_PMRC_state);
     upload();
@@ -174,7 +171,7 @@
         tmp_bit[0] = 0b01 & (arg_bits >> (2 * i));
         tmp_bit[1] = 0b01 & (arg_bits >> (2 * i + 1));
         //  if the chan. is not HiZ meaning Hi or Lw
-        if(tmp_bit[0] | tmp_bit[1] == 0b01) {
+        if(tmp_bit[0] + tmp_bit[1] == 1) {
             m_SER = (tmp_bit[0] ^ m_PMRC_POL); //XOR Polarity
             update();
             m_SER = (tmp_bit[1] ^ m_PMRC_POL); //XOR Polarity