GlobLib
HAL and API libraries for MCUs and hardware.
COMS128

Initialization routines for FIF08, USART and STRING11. More...

Files

file  coms128.h
 Header file for COMS128.
 

Macros

#define TX_SIZE   128
 Size of the memory buffer used by FIFO8.
 
#define COMS(X)   USART_setTxISR(X,COMOUT_con128(USART_add_put(X)))
 Macro function for simpler initialization. More...
 

Typedefs

typedef void(* ret_point) (void)
 Return function pointer type for COMOUT_con128.
 

Functions

ret_point COMOUT_con128 (void(*put)(uint8_t))
 Initializes FIFO8 and STRING11. More...
 

Detailed Description

Initialization routines for FIF08, USART and STRING11.

This module connects the STRING11 module to FIF8 and the passed USART object.

This provides serial communication to a terminal with a software buffer.

Sets up FIFO8 with the following

Sets up STRING11 to output into FIFO8 object

Author
Stuart Ianna
Version
1.0
Date
June 2018
Warning
None
Bug:
None
Todo:
Verified Compilers
  • arm-none-eabi-gcc (15:4.9.3+svn231177-1) 4.9.3 20150529 (prerelease)
Example - Typical usage.
//Change to include appropriate MCU target
#include <stm32f103cb_core.h>
#include "coms128.h"
//Create an instance for the USART object -> required for demo
USART serial;
int main(void)
{
//USART Hardware setup
USART_setup(&serial,USART_1);
COMS(serial);
//Print to terminal
while(1){
printl("Some line of stuff."); //Print with a line
for(int i = 0; i < 0x2EEEE;i++); //Wait
}
return 0;
}

Macro Definition Documentation

#define COMS (   X)    USART_setTxISR(X,COMOUT_con128(USART_add_put(X)))

Macro function for simpler initialization.

Parameters
XThe serial USART number

Definition at line 57 of file coms128.h.

Function Documentation

ret_point COMOUT_con128 ( void(*)(uint8_t)  put)

Initializes FIFO8 and STRING11.

Sets up FIFO8 with the following

  • FIFO8_AUTO -> Empties buffer automatically
  • Output function is linked to .put() of the serial object
  • Fifo buffer is contained statically
  • Fifo size define by TX_SIZE
  • FIFO8 object held statically

Sets up STRING11 to output into FIFO8 object

Parameters
putPointer to the USART put() function.
Returns
Pointer to the ISR callback function to trigger FIFO8_get()

Definition at line 27 of file coms128.c.