grblHAL core  20241107
stream.c File Reference
#include <stdlib.h>
#include <string.h>
#include "hal.h"
#include "protocol.h"
#include "state_machine.h"
#include <stdio.h>
#include <stdarg.h>

Data Structures

struct  stream_state_t
 
union  stream_connection_flags_t
 
struct  stream_connection
 

Macros

#define DEBUG_BUFFER   100
 

Typedefs

typedef struct stream_connection stream_connection_t
 

Functions

void stream_register_streams (io_stream_details_t *details)
 
bool stream_enumerate_streams (stream_enumerate_callback_ptr callback)
 
bool stream_tx_blocking (void)
 
int16_t stream_get_null (void)
 Dummy function for reading data from a virtual empty input buffer. More...
 
bool stream_rx_suspend (stream_rx_buffer_t *rxbuffer, bool suspend)
 Function for blocking reads from or restoring an input buffer. More...
 
ISR_CODE bool ISR_FUNC() stream_buffer_all (char c)
 
ISR_CODE bool ISR_FUNC() stream_enqueue_realtime_command (char c)
 
bool stream_connected (void)
 
const io_stream_tstream_get_base (void)
 
io_stream_flags_t stream_get_flags (io_stream_t stream)
 
bool stream_set_description (const io_stream_t *stream, const char *description)
 
bool stream_connect (const io_stream_t *stream)
 
bool stream_connect_instance (uint8_t instance, uint32_t baud_rate)
 
void stream_disconnect (const io_stream_t *stream)
 
io_stream_t const * stream_open_instance (uint8_t instance, uint32_t baud_rate, stream_write_char_ptr rx_handler, const char *description)
 
void stream_mpg_set_mode (void *data)
 
ISR_CODE bool ISR_FUNC() stream_mpg_check_enable (char c)
 
bool stream_mpg_register (const io_stream_t *stream, bool rx_only, stream_write_char_ptr write_char)
 
bool stream_mpg_enable (bool on)
 Function for enabling/disabling input from a secondary input stream. More...
 
const io_stream_tstream_null_init (uint32_t baud_rate)
 
 __attribute__ ((weak))
 
void debug_writeln (const char *s)
 
void debug_printf (const char *fmt,...)
 
bool debug_stream_init (void)
 

Macro Definition Documentation

◆ DEBUG_BUFFER

#define DEBUG_BUFFER   100

Typedef Documentation

◆ stream_connection_t

Function Documentation

◆ __attribute__()

__attribute__ ( (weak)  )

◆ debug_printf()

void debug_printf ( const char *  fmt,
  ... 
)

◆ debug_stream_init()

bool debug_stream_init ( void  )

◆ debug_writeln()

void debug_writeln ( const char *  s)

◆ stream_buffer_all()

ISR_CODE bool ISR_FUNC() stream_buffer_all ( char  c)

◆ stream_connect()

bool stream_connect ( const io_stream_t stream)

◆ stream_connect_instance()

bool stream_connect_instance ( uint8_t  instance,
uint32_t  baud_rate 
)

◆ stream_connected()

bool stream_connected ( void  )

◆ stream_disconnect()

void stream_disconnect ( const io_stream_t stream)

◆ stream_enqueue_realtime_command()

ISR_CODE bool ISR_FUNC() stream_enqueue_realtime_command ( char  c)

◆ stream_enumerate_streams()

bool stream_enumerate_streams ( stream_enumerate_callback_ptr  callback)

◆ stream_get_base()

const io_stream_t* stream_get_base ( void  )

◆ stream_get_flags()

io_stream_flags_t stream_get_flags ( io_stream_t  stream)

◆ stream_get_null()

int16_t stream_get_null ( void  )

Dummy function for reading data from a virtual empty input buffer.

Returns
always -1 as there is no data available.

◆ stream_mpg_check_enable()

ISR_CODE bool ISR_FUNC() stream_mpg_check_enable ( char  c)

◆ stream_mpg_enable()

bool stream_mpg_enable ( bool  on)

Function for enabling/disabling input from a secondary input stream.

Parameters
ontrue if switching input to mpg stream, false when restoring original input.
Returns
true when succsessful, false otherwise.

◆ stream_mpg_register()

bool stream_mpg_register ( const io_stream_t stream,
bool  rx_only,
stream_write_char_ptr  write_char 
)

◆ stream_mpg_set_mode()

void stream_mpg_set_mode ( void *  data)

◆ stream_null_init()

const io_stream_t* stream_null_init ( uint32_t  baud_rate)

◆ stream_open_instance()

io_stream_t const* stream_open_instance ( uint8_t  instance,
uint32_t  baud_rate,
stream_write_char_ptr  rx_handler,
const char *  description 
)

◆ stream_register_streams()

void stream_register_streams ( io_stream_details_t details)

◆ stream_rx_suspend()

bool stream_rx_suspend ( stream_rx_buffer_t rxbuffer,
bool  suspend 
)

Function for blocking reads from or restoring an input buffer.

Parameters
rxbufferpointer to a stream_rx_buffer_t.
suspendwhen true hal.stream.read is changed to stream_get_null(), if false it is restored if already saved.
Returns
true if there is data in the buffer, false otherwise.

◆ stream_set_description()

bool stream_set_description ( const io_stream_t stream,
const char *  description 
)

◆ stream_tx_blocking()

bool stream_tx_blocking ( void  )

Variable Documentation

◆ baud_rate

uint32_t baud_rate

◆ instance

uint8_t instance