Bus: still broken!
parent
61042af398
commit
fecf68e816
@ -0,0 +1,29 @@
|
||||
package net.brokenmoon.redcontrol.api;
|
||||
|
||||
import com.simon816.j65el02.device.RedBus;
|
||||
import net.brokenmoon.redcontrol.RedControl;
|
||||
|
||||
public class RCRedbus extends RedBus {
|
||||
@Override
|
||||
public void write(int address, int data) {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
Peripheral peripheral = this.peripherals[this.activeDeviceId];
|
||||
if (peripheral != null) {
|
||||
peripheral.write(address, data & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActiveDevice(int id) {
|
||||
RedControl.LOGGER.info("Active device is now " + id);
|
||||
this.activeDeviceId = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveDevice() {
|
||||
RedControl.LOGGER.info("Active device is being read, and it is " + activeDeviceId);
|
||||
return this.activeDeviceId;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue