pros/serial.h file

Contains prototypes for the V5 Generic Serial related functions.

This file should not be modified by users, since it gets replaced whenever a kernel upgrade occurs.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Namespaces

namespace pros
LLEMU Conditional Include
namespace pros::c

Serial communication functions

These functions allow programmers to communicate using UART over RS485

int32_t serial_enable(uint8_t port)
Enables generic serial on the given port.
int32_t serial_set_baudrate(uint8_t port, int32_t baudrate)
Sets the baudrate for the serial port to operate at.
int32_t serial_flush(uint8_t port)
Clears the internal input and output FIFO buffers.
int32_t serial_get_read_avail(uint8_t port)
Returns the number of bytes available to be read in the the port's FIFO input buffer.
int32_t serial_get_write_free(uint8_t port)
Returns the number of bytes free in the port's FIFO output buffer.
int32_t serial_peek_byte(uint8_t port)
Reads the next byte avaliable in the port's input buffer without removing it.
int32_t serial_read_byte(uint8_t port)
Reads the next byte avaliable in the port's input buffer.
int32_t serial_read(uint8_t port, uint8_t* buffer, int32_t length)
Reads up to the next length bytes from the port's input buffer and places them in the user supplied buffer.
int32_t serial_write_byte(uint8_t port, uint8_t buffer)
Write the given byte to the port's output buffer.
int32_t serial_write(uint8_t port, uint8_t* buffer, int32_t length)
Writes up to length bytes from the user supplied buffer to the port's output buffer.