6.3.3 Adding a new behavior to a slave port
The slave port must alter the standard behavior of the transmit direction.
Do not change the receive direction. This requires only a call to the same behavior of master
out to transfer the data from the slave port to the master
port. The modification of the transmitted data is implemented in slave behavior
Select the Source tab to display the LISA source code for
SerialCharDoubler.lisa, and modify the
SerialData slave port
slave port<SerialData> in
behavior dataTransmit(uint16_t data)
// start of escape sequence?
if(data == '\33')
inEscape = true;
// leave escape sequences untouched (only send one char)
// duplicate char on output
// end of escape sequence?
inEscape = false;
code does not double data for escape sequences but does for other characters. An
alphabetic character signals the end of escape sequences, resetting the
dataReceive() behavior calls the respective behavior of
the master port. Modify it.
The doubling does not affect signals, so represent the behaviors to set and get
signals as wrappers of the master port behaviors.
behavior signalsSet(uint8_t signal)