avrora.sim.mcu
Class Timer16Bit.BufferedRegister

java.lang.Object
  extended byavrora.sim.RWRegister
      extended byavrora.sim.mcu.Timer16Bit.BufferedRegister
All Implemented Interfaces:
ActiveRegister
Enclosing class:
Timer16Bit

protected class Timer16Bit.BufferedRegister
extends RWRegister

In PWN modes, writes to the OCRnx registers are buffered. Specifically, the actual write is delayed until a certain event (the counter reaching either TOP or BOTTOM) specified by the particular PWN mode. BufferedRegister implements this by writing to a buffer register on a write and reading from the buffered register in a read. When the buffered register is to be updated, the flush() method should be called.


Field Summary
 
Fields inherited from class avrora.sim.RWRegister
value
 
Constructor Summary
protected Timer16Bit.BufferedRegister()
           
 
Method Summary
protected  void flush()
           
 byte read()
          The read() method reads the 8-bit value of the IO register as a byte.
 boolean readBit(int bit)
          The readBit() method reads a single bit from the IO register.
 byte readBuffer()
           
 void write(byte val)
          The write() method writes an 8-bit value to the IO register as a byte.
 void writeBit(int bit, 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
 

Constructor Detail

Timer16Bit.BufferedRegister

protected Timer16Bit.BufferedRegister()
Method Detail

write

public void write(byte val)
Description copied from class: RWRegister
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
Overrides:
write in class RWRegister
Parameters:
val - the value to write

writeBit

public void writeBit(int bit,
                     boolean val)
Description copied from class: RWRegister
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
Overrides:
writeBit in class RWRegister
Parameters:
bit - the number of the bit to write
val - the value of the bit to write

readBuffer

public byte readBuffer()

read

public byte read()
Description copied from class: RWRegister
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
Overrides:
read in class RWRegister
Returns:
the value of the register as a byte

readBit

public boolean readBit(int bit)
Description copied from class: RWRegister
The readBit() method reads a single bit from the IO register.

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

flush

protected void flush()