25 lines
645 B
C++
25 lines
645 B
C++
/*
|
|
* GpioPinDecoderv2.cpp
|
|
*
|
|
* Created on: 22 îêò. 2019 ã.
|
|
* Author: user
|
|
*/
|
|
|
|
#include "GpioPinDecoderv2.hh"
|
|
|
|
driver::GpioPinDecoder_v2::GpioPinDecoder_v2( Demux & demux, unsigned short default_pin, PinPack pack)
|
|
: demux(demux), default_pin(default_pin) {
|
|
|
|
for(Id i = 0; i < num_pins; i++) {
|
|
pin_mapping[i] = (( (i >> 0) & 1 ) << pack.pin[0] )
|
|
| (( (i >> 1) & 1 ) << pack.pin[1] )
|
|
| (( (i >> 2) & 1 ) << pack.pin[2] )
|
|
| (( (i >> 3) & 1 ) << pack.pin[3] );
|
|
|
|
pins[i] = PinOnDecoder( this, i );
|
|
}
|
|
|
|
default_pin = pin_mapping[default_pin];
|
|
|
|
}
|