Xbee Arduino
Arduino Driver for Xbee
|
Platform-specific abstraction layer for hardware interfaces. More...
#include <stdint.h>
Go to the source code of this file.
Enumerations | |
enum | uart_status_t { UART_SUCCESS = 0 , UART_INIT_FAILED , UART_ERROR_TIMEOUT , UART_ERROR_OVERRUN , UART_ERROR_UNKNOWN } |
Functions | |
int | portUartRead (uint8_t *buffer, int length) |
Reads data from the UART. More... | |
int | portUartWrite (const uint8_t *buf, uint16_t len) |
Writes data to the UART. More... | |
uint32_t | portMillis (void) |
Returns the number of milliseconds since the program started. More... | |
void | portFlushRx (void) |
Flushes the UART receive buffer. More... | |
int | portUartInit (uint32_t baudrate, void *device) |
Initializes the UART for communication on the Arduino platform. More... | |
void | portDelay (uint32_t ms) |
Delays execution for a specified number of milliseconds. More... | |
void | portDebugPrintf (const char *format,...) |
Prints debug information to the Serial output. More... | |
Platform-specific abstraction layer for hardware interfaces.
This file defines the platform-specific functions and macros used by the XBee library to interface with hardware. It provides abstraction for serial communication, timing, GPIO control, and other low-level operations required by the XBee modules.
@license MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
enum uart_status_t |
void portDebugPrintf | ( | const char * | format, |
... | |||
) |
Prints debug information to the Serial output.
This function provides a formatted print capability for debugging purposes, similar to printf.
format | The format string (same as printf). |
... | The values to print. |
void portDelay | ( | uint32_t | ms | ) |
Delays execution for a specified number of milliseconds.
This function pauses execution for the specified duration using Arduino's delay()
function.
ms | The number of milliseconds to delay. |
void portFlushRx | ( | void | ) |
Flushes the UART receive buffer.
This function clears any data that may be present in the UART's receive buffer.
uint32_t portMillis | ( | void | ) |
Returns the number of milliseconds since the program started.
This function uses Arduino's millis()
function to return the time elapsed since the device was powered on.
int portUartInit | ( | uint32_t | baudrate, |
void * | device | ||
) |
Initializes the UART for communication on the Arduino platform.
This function sets up the UART peripheral with the specified baud rate.
baudrate | The baud rate for UART communication. |
device | Pointer to the HardwareSerial or SoftwareSerial instance representing the UART to use. |
int portUartRead | ( | uint8_t * | buffer, |
int | length | ||
) |
Reads data from the UART.
This function reads up to the specified number of bytes from the UART and stores them in the provided buffer. It blocks until the requested number of bytes has been read or an error occurs.
buffer | Pointer to the buffer where the data will be stored. |
length | Maximum number of bytes to read. |
int portUartWrite | ( | const uint8_t * | data, |
uint16_t | length | ||
) |
Writes data to the UART.
This function sends the specified number of bytes from the provided buffer over the UART.
data | Pointer to the data to be written. |
length | Number of bytes to write. |