Instant SoC Class Library  3.1
FC_IO_UART_TX Class Reference

UART Transmitter. More...

Inheritance diagram for FC_IO_UART_TX:
FC_Base

Public Member Functions

 FC_IO_UART_TX (int baudrate, int fifo_depth=16)
 
void SetTextMode (bool text_mode=true)
 
U32 GetNumReady ()
 
bool Write (U8 d)
 
FC_IO_UART_TXoperator<< (char d)
 
FC_IO_UART_TXoperator<< (const char *msg)
 

Additional Inherited Members

- Protected Member Functions inherited from FC_Base
 FC_Base (int addr_range_32=0)
 
U32 Get ()
 
U32 Get (int i)
 
void Set (const U32 v)
 
void Set (const U32 v, int i)
 
- Protected Attributes inherited from FC_Base
volatile U32 * pBase
 
- Static Protected Attributes inherited from FC_Base
static U32 g_id
 

Detailed Description

UART Transmitter.

Adds to interface:
<name> : out std_logic
where <name> is c++ object name.
Any number of instances are allowed.

// This example shows how to use the FC_IO_UART_RX, FC_IO_UART_TX and FC_IO_SegmentDisplay classes.
// When started the application sends a hello world message on the tx uart.
// When receiving a char the char is scrolled on the the segment display
// The received bytes are sent on tx (echoed).
#include "fc_io.h"
#include "fc_system.h"
U32 ToSeg(char c); // Translates char to active segments
int main()
{
//% hw_begin
FC_IO_Clk clk(100);
FC_IO_UART_RX rx(115200);
FC_IO_UART_TX tx(115200);
//% hw_end
tx << "Hello world!!\r\n";
U32 seg[4] = {0,0,0,0}; // Init all segments
for (;;)
{
if( rx.NumValid() > 0 ) {
char b = rx.GetByte(); // Read one byte
for(int i=3;i>=0;i--) { // Shift the segments
if(i==0)
seg[i] = ToSeg(b);
else
seg[i] = seg[i-1];
sd.SetDisplay( seg[i], i );
}
tx << b; // Echo the received byte
}
}
}
FC_IO_Clk
System clock input.
Definition: fc_io.h:55
FC_IO_UART_TX
UART Transmitter.
Definition: fc_io.h:348
FC_IO_UART_RX
UART Receiver.
Definition: fc_io.h:399
FC_IO_SegmentDisplay
Segment Display controller.
Definition: fc_io.h:688