Library to use my Photo MOS Relays Circuit having 16 or less channels.
Fork of PMRC4ch by
Diff: PMRC16ch.h
- Revision:
- 20:26972de3cf90
- Parent:
- 19:1112aeb5cddd
- Child:
- 21:fa067e2a30f2
--- a/PMRC16ch.h Tue Jun 26 13:14:16 2018 +0000 +++ b/PMRC16ch.h Thu Jun 28 08:49:54 2018 +0000 @@ -64,37 +64,36 @@ // Const. enum State { ALLGROUND = 0, - CH1 = 0b/*1V*/1000/**/0000/**/0000/**/0000/**/0000/**/0000/**/0000/**/0000/*16G*/, - CH2 = 0b/*1V*/0010/**/0000/**/0000/**/0000/**/0000/**/0000/**/0000/**/0000/*16G*/, - CH3 = 0b/*1V*/0000/**/1000/**/0000/**/0000/**/0000/**/0000/**/0000/**/0000/*16G*/, - CH4 = 0b/*1V*/0000/**/0010/**/0000/**/0000/**/0000/**/0000/**/0000/**/0000/*16G*/, - CH5 = 0b/*1V*/0000/**/0000/**/1000/**/0000/**/0000/**/0000/**/0000/**/0000/*16G*/, - CH6 = 0b/*1V*/0000/**/0000/**/0010/**/0000/**/0000/**/0000/**/0000/**/0000/*16G*/, - CH7 = 0b/*1V*/0000/**/0000/**/0000/**/1000/**/0000/**/0000/**/0000/**/0000/*16G*/, - CH8 = 0b/*1V*/0000/**/0000/**/0000/**/0010/**/0000/**/0000/**/0000/**/0000/*16G*/, - CH9 = 0b/*1V*/0000/**/0000/**/0000/**/0000/**/1000/**/0000/**/0000/**/0000/*16G*/, - CH10= 0b/*1V*/0000/**/0000/**/0000/**/0000/**/0010/**/0000/**/0000/**/0000/*16G*/, - CH11= 0b/*1V*/0000/**/0000/**/0000/**/0000/**/0000/**/1000/**/0000/**/0000/*16G*/, - CH12= 0b/*1V*/0000/**/0000/**/0000/**/0000/**/0000/**/0010/**/0000/**/0000/*16G*/, - CH13= 0b/*1V*/0000/**/0000/**/0000/**/0000/**/0000/**/0000/**/1000/**/0000/*16G*/, - CH14= 0b/*1V*/0000/**/0000/**/0000/**/0000/**/0000/**/0000/**/0010/**/0000/*16G*/, - CH15= 0b/*1V*/0000/**/0000/**/0000/**/0000/**/0000/**/0000/**/0000/**/1000/*16G*/, - CH16= 0b/*1V*/0000/**/0000/**/0000/**/0000/**/0000/**/0000/**/0000/**/0010/*16G*/, + CH1 = /*1V*/0b10000000/**/00000000/**/00000000/**/00000000/*16G*/, + CH2 = /*1V*/0b00100000/**/00000000/**/00000000/**/00000000/*16G*/, + CH3 = /*1V*/0b00001000/**/00000000/**/00000000/**/00000000/*16G*/, + CH4 = /*1V*/0b00000010/**/00000000/**/00000000/**/00000000/*16G*/, + CH5 = /*1V*/0b00000000/**/10000000/**/00000000/**/00000000/*16G*/, + CH6 = /*1V*/0b00000000/**/00100000/**/00000000/**/00000000/*16G*/, + CH7 = /*1V*/0b00000000/**/00001000/**/00000000/**/00000000/*16G*/, + CH8 = /*1V*/0b00000000/**/00000010/**/00000000/**/00000000/*16G*/, + CH9 = /*1V*/0b00000000/**/00000000/**/10000000/**/00000000/*16G*/, + CH10= /*1V*/0b00000000/**/00000000/**/00100000/**/00000000/*16G*/, + CH11= /*1V*/0b00000000/**/00000000/**/00001000/**/00000000/*16G*/, + CH12= /*1V*/0b00000000/**/00000000/**/00000010/**/00000000/*16G*/, + CH13= /*1V*/0b00000000/**/00000000/**/00000000/**/10000000/*16G*/, + CH14= /*1V*/0b00000000/**/00000000/**/00000000/**/00100000/*16G*/, + CH15= /*1V*/0b00000000/**/00000000/**/00000000/**/00001000/*16G*/, + CH16= /*1V*/0b00000000/**/00000000/**/00000000/**/00000010/*16G*/, ALLHiZ = 9999 }; enum Polarity {Anodic = 0, Cathodic = 1}; // // Function to set channel // - char allGround(); - char setCh(State ch, Polarity cp = Cathodic); - char setCh(char ch, Polarity cp = Cathodic); + void allGround(); void allHiZ(); + void setCh(char ch, Polarity cp = Cathodic); void setBits(uint32_t bits, int num_of_bits, Polarity cp = Cathodic); // // Function to get prameter // - char getState();//inline definition + uint32_t getState();//inline definition bool getPol(); //inline definition private: @@ -125,12 +124,12 @@ // // Var for store state // - State m_PMRC_state; + uint32_t m_PMRC_state; Polarity m_PMRC_POL; }; -inline char PMRC16ch::getState() +inline uint32_t PMRC16ch::getState() { - return static_cast<char>(m_PMRC_state); + return static_cast<uint32_t>(m_PMRC_state); } inline bool PMRC16ch::getPol() {