avrora.sim
Class RWRegister

java.lang.Object
  extended byavrora.sim.RWRegister
All Implemented Interfaces:
ActiveRegister
Direct Known Subclasses:
ADC.ADCRegister, ADC.ControlRegister, ATMegaFamily.DirectionRegister, ATMegaFamily.FlagRegister, ATMegaFamily.MaskRegister, ATMegaFamily.PortRegister, ATMegaFamily.Timer0.ASSRRegister, EEPROM.EEARHReg, EEPROM.EECRReg, SPI.SPCRReg, Timer16Bit.BufferedRegister, Timer16Bit.OCRnxTempHighRegister, Timer16Bit.PairedRegister, Timer16Bit.TCNTnRegister, Timer8Bit.BufferedRegister, Timer8Bit.ControlRegister, Timer8Bit.TCNTnRegister, USART.ControlRegisterC, USART.DataRegister, USART.UBRRnHReg, USART.UBRRnLReg

public class RWRegister
extends java.lang.Object
implements ActiveRegister

The RWRegister class is an implementation of an IO register that has the simple, default behavior of being able to read and write just as a general purpose register or byte in SRAM.


Field Summary
protected  byte value
           
 
Constructor Summary
RWRegister()
           
 
Method Summary
 byte read()
          The read() method reads the 8-bit value of the IO register as a byte.
 boolean readBit(int num)
          The readBit() method reads a single bit from the IO register.
 void write(byte val)
          The write() method writes an 8-bit value to the IO register as a byte.
 void writeBit(int num, boolean val)
          The writeBit() method writes a single bit value into the IO register at the specified bit offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected byte value
Constructor Detail

RWRegister

public RWRegister()
Method Detail

read

public byte read()
The read() method reads the 8-bit value of the IO register as a byte. For simple RWRegister instances, this simply returns the internally stored value.

Specified by:
read in interface ActiveRegister
Returns:
the value of the register as a byte

write

public void write(byte val)
The write() method writes an 8-bit value to the IO register as a byte. For simple RWRegister instances, this simply writes the internally stored value.

Specified by:
write in interface ActiveRegister
Parameters:
val - the value to write

readBit

public boolean readBit(int num)
The readBit() method reads a single bit from the IO register.

Specified by:
readBit in interface ActiveRegister
Parameters:
num - the number of the bit to read
Returns:
the value of the bit as a boolean

writeBit

public void writeBit(int num,
                     boolean val)
The writeBit() method writes a single bit value into the IO register at the specified bit offset. For simple RWRegister instances, this simply updates the bit in the internally stored value

Specified by:
writeBit in interface ActiveRegister
Parameters:
num - the number of the bit to write
val - the value of the bit to write