RUI3 (RAK Unified Interface 3) - RAK4631
One Wire Serial

Functions

 RAKOneWireSerial (uint32_t pin, rak_onewire_serial_recv_cb callback)
 
void begin (uint32_t baud, RAK_SERIAL_MODE mode=RAK_DEFAULT_MODE)
 
size_t write (const uint8_t *buf, size_t size)
 
int available (void)
 
int read (void)
 
void end (void)
 

Detailed Description

Function Documentation

◆ RAKOneWireSerial()

RAKOneWireSerial ( uint32_t  pin,
rak_onewire_serial_recv_cb  callback 
)
Description
This API chooses the pin number for one wire serial and prepare the callback function for receiving data
Syntax
OneWireSerial(pin, callback)
Parameters
pinthe pin number
callbackthe callback for receiving data

◆ begin()

void begin ( uint32_t  baud,
RAK_SERIAL_MODE  mode = RAK_DEFAULT_MODE 
)
Description
This API sets the speed (baud rate) for the serial communication.
Syntax
Serial.begin(baud);
Serial.begin(baud, mode);
Parameters
baudThe baudrate to set for the Serial
mode(optinal)The mode that use UART in different way (if not assigned, RAK_DEFAULT_MODE is chosen)
List:
RAK_AT_MODE
RAK_API_MODE
RAK_CUSTOM_MODE
RAK_DEFAULT_MODE

◆ write()

size_t write ( const uint8_t *  buf,
size_t  size 
)
Description
This API is used to write a byte sequence to a specified one wire serial port.
Syntax
Serial.write(buf, size)
Parameters
bufan array to send as a series of bytes
sizethe number of bytes to be sent from the array
Returns
number of bytes sent successfully(Type: size_t)

◆ available()

int available ( void  )
Description
This API is used to get the number of bytes available for reading from the specified one wire serial port.
Syntax
Serial.available();
Return values
thenumber of bytes available for reading from the specified one wire serial port(Type: int)

◆ read()

int read ( void  )
Description
Reads incoming one wire serial data
Syntax
Serial.read()
Returns
The first byte of incoming one wire serial data available(Type: int32_t)
Return values
-1Read fail,get nothing from the specified one wire serial port

◆ end()

void end ( void  )
Description
This API closes the one wire serial port
Syntax
Serial.end()