hollyhock
Loading...
Searching...
No Matches
Macros | Enumerations | Functions | Variables
serial.h File Reference

Functions used for sending and receiving serial data. More...

#include <stdint.h>
#include <stdbool.h>
Include dependency graph for serial.h:

Go to the source code of this file.

Macros

#define ro(...)   __attribute__((access(read_only, __VA_ARGS__)))
 
#define rw(...)   __attribute__((access(read_write, __VA_ARGS__)))
 
#define wo(...)   __attribute__((access(write_only, __VA_ARGS__)))
 

Enumerations

enum  Serial_Bitrate {
  SERIAL_BITRATE_300 = 0 , SERIAL_BITRATE_1200 = 1 , SERIAL_BITRATE_2400 = 2 , SERIAL_BITRATE_4800 = 3 ,
  SERIAL_BITRATE_9600 = 5 , SERIAL_BITRATE_19200 = 6 , SERIAL_BITRATE_38400 = 7 , SERIAL_BITRATE_57600 = 8 ,
  SERIAL_BITRATE_115200 = 9
}
 
enum  Serial_Parity { SERIAL_PARITY_NONE = 0 , SERIAL_PARITY_ODD = 1 , SERIAL_PARITY_EVEN = 2 }
 
enum  Serial_Data_Length { SERIAL_DATA_LENGTH_8BIT = 0 , SERIAL_DATA_LENGTH_7BIT = 1 }
 
enum  Serial_Stop_Bits { SERIAL_STOP_BITS_1 = 0 , SERIAL_STOP_BITS_2 = 1 }
 

Functions

struct __attribute__ ((packed)) Serial_Settings
 

Variables

int(* Serial_Open )(const struct Serial_Settings *mode) ro(1)
 
int(* Serial_IsOpen )(void)
 
int(* Serial_Close )(bool abortPending)
 
int(* Serial_Read )(unsigned char *out, int sz, short *count) wo(1
 
int(* wo )(3)
 
int(* Serial_ReadSingle )(unsigned char *out) wo(1)
 
int(* Serial_Peek )(int idx, unsigned char *out) wo(1)
 
int(* Serial_PollRX )(void)
 
int(* Serial_ClearRX )(void)
 
int(* Serial_Write )(const unsigned char *buf, int count) ro(1
 
int(*) int(* Serial_WriteSingle )(unsigned char x)
 
int(* Serial_WriteUnbuffered )(unsigned char x)
 
int(* Serial_PollTX )(void)
 
int(* Serial_ClearTX )(void)
 

Detailed Description

Functions used for sending and receiving serial data.

Variable Documentation

◆ Serial_Open

int(* Serial_Open) (const struct Serial_Settings *mode) ro(1) ( const struct Serial_Settings *  mode)
extern

Opens the 3-pin serial port with the specified parameters. see https://prizm.cemetech.net/index.php?title=Serial_Open for more info. mode: 0 always 0 1 bit rate 0=300, 5=9600, 9=115200 2 parity 0=none, 1=odd, 2=even 3 data length 0=8bit, 1=7bit 4 stop bits 0=1bit, 1=2bit 5 always 0 Returns: 0 success 3 already open

Parameters
modeThe mode of the serial port.

◆ Serial_Write

int(* Serial_Write) (const unsigned char *buf, int count) ro(1 ( const unsigned char *  buf,
int  count 
)
extern

Sends a number of bytes through the 3-pin serial port, by putting them in the transmit buffer. see https://prizm.cemetech.net/index.php?title=Serial_Write

Parameters
bufpointer to buffer containing the bytes to transmit @count amount of bytes to transmit from buf