BPLightContraption
 All Classes Namespaces Files Functions Variables Macros Pages
Functions
serial.c File Reference

Microcontroller serial communications functions. More...

#include <avr/io.h>
#include "bits.h"
#include "serial.h"
Include dependency graph for serial.c:

Go to the source code of this file.

Functions

void Serial_init (void)
 Initializes the serial port. More...
 
uint8_t Serial_receive (void)
 Retrieve a byte from the receive register. More...
 
void Serial_flush (void)
 Flushes the serial port receive buffer. More...
 
uint8_t Serial_needsreading (void)
 Returns 1 if there is something to be read from the serial port, zero otherwise. More...
 
void Serial_send (uint8_t c)
 Sends a byte through the serial port. More...
 
void Serial_send1 (uint8_t c)
 
void Serial_send2 (uint8_t c1, uint8_t c2)
 Sends 2 bytes through the serial port. More...
 
void Serial_send3 (uint8_t c1, uint8_t c2, uint8_t c3)
 Sends 3 bytes through the serial port. More...
 
void Serial_send4 (uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4)
 Sends 4 bytes through the serial port. More...
 
void Serial_send5 (uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4, uint8_t c5)
 Sends 5 bytes through the serial port. More...
 
void Serial_send6 (uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4, uint8_t c5, uint8_t c6)
 Sends 6 bytes through the serial port. More...
 
void Serial_sendarr (const uint8_t *arr, uint8_t len)
 Sends an array of bytes through the serial port. More...
 

Detailed Description

Microcontroller serial communications functions.

Prototypes in serial.h

Author
Benjamin Pritchard (ben@b.nosp@m.enny.nosp@m.p.org)

Definition in file serial.c.

Function Documentation

void Serial_flush ( void  )

Flushes the serial port receive buffer.

It will block until it gets something to receive

Definition at line 45 of file serial.c.

Here is the caller graph for this function:

void Serial_init ( void  )

Initializes the serial port.

Currently, the port is set to 8N1 and the baud rate specified by MYUBRR. This function also enables the receiver interrupt.

Definition at line 13 of file serial.c.

Here is the caller graph for this function:

uint8_t Serial_needsreading ( void  )

Returns 1 if there is something to be read from the serial port, zero otherwise.

Definition at line 66 of file serial.c.

uint8_t Serial_receive ( void  )

Retrieve a byte from the receive register.

Will block until there is something to be retrieved

Definition at line 35 of file serial.c.

Here is the caller graph for this function:

void Serial_send ( uint8_t  c)

Sends a byte through the serial port.

Definition at line 72 of file serial.c.

Here is the caller graph for this function:

void Serial_send1 ( uint8_t  c)

Definition at line 82 of file serial.c.

Here is the call graph for this function:

void Serial_send2 ( uint8_t  c1,
uint8_t  c2 
)

Sends 2 bytes through the serial port.

Definition at line 89 of file serial.c.

Here is the call graph for this function:

void Serial_send3 ( uint8_t  c1,
uint8_t  c2,
uint8_t  c3 
)

Sends 3 bytes through the serial port.

Definition at line 97 of file serial.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void Serial_send4 ( uint8_t  c1,
uint8_t  c2,
uint8_t  c3,
uint8_t  c4 
)

Sends 4 bytes through the serial port.

Definition at line 106 of file serial.c.

Here is the call graph for this function:

void Serial_send5 ( uint8_t  c1,
uint8_t  c2,
uint8_t  c3,
uint8_t  c4,
uint8_t  c5 
)

Sends 5 bytes through the serial port.

Definition at line 117 of file serial.c.

Here is the call graph for this function:

void Serial_send6 ( uint8_t  c1,
uint8_t  c2,
uint8_t  c3,
uint8_t  c4,
uint8_t  c5,
uint8_t  c6 
)

Sends 6 bytes through the serial port.

Definition at line 129 of file serial.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void Serial_sendarr ( const uint8_t *  arr,
uint8_t  len 
)

Sends an array of bytes through the serial port.

Parameters
[in]arrArray of bytes to send
[in]lenNumber of bytes to send

Definition at line 142 of file serial.c.

Here is the call graph for this function:

Here is the caller graph for this function: