![]() |
RUI3 (RAK Unified Interface 3) - RAK4631
|
Provide a hardware independent serial driver layer for API layer to use. More...
Go to the source code of this file.
Data Structures | |
struct | udrv_serial_api |
Macros | |
#define | SERIAL_NO_TIMEOUT UINT32_MAX |
Typedefs | |
typedef enum _SERIAL_STATE | SERIAL_STATE |
typedef enum _SERIAL_EVENT | SERIAL_EVENT |
typedef enum _SERIAL_WIRE_MODE_E | SERIAL_WIRE_MODE_E |
typedef enum _SERIAL_WORD_LEN_E | SERIAL_WORD_LEN_E |
typedef enum _SERIAL_STOP_BIT_E | SERIAL_STOP_BIT_E |
typedef enum _SERIAL_PARITY_E | SERIAL_PARITY_E |
typedef enum _SERIAL_PORT | SERIAL_PORT |
typedef enum _SERIAL_WLOCK_STATE | SERIAL_WLOCK_STATE |
typedef void(* | SERIAL_CLI_HANDLER) (SERIAL_PORT, void *) |
Functions | |
void | udrv_serial_register_onewire_handler (SERIAL_CLI_HANDLER handler) |
This API is used to register a one-wire handler. More... | |
bool | is_udrv_serial_initialized (SERIAL_PORT Port) |
This API is used to check if a specified serial port is initialized. More... | |
void | udrv_serial_init (SERIAL_PORT Port, uint32_t BaudRate, SERIAL_WORD_LEN_E DataBits, SERIAL_STOP_BIT_E StopBits, SERIAL_PARITY_E Parity, SERIAL_WIRE_MODE_E WireMode) |
This API is used to initialize a specified serial port. More... | |
void | udrv_serial_deinit (SERIAL_PORT Port) |
This API is used to deinitialize a specified serial port. More... | |
int32_t | udrv_serial_write (SERIAL_PORT Port, uint8_t const *Buffer, int32_t NumberOfBytes) |
int32_t | udrv_serial_printf (SERIAL_PORT Port, const char *fmt,...) |
This API is like printf() to format any kinds of data type into a byte sequence, and write it to a specified serial port. More... | |
int32_t | udrv_serial_log_printf (const char *fmt,...) |
This API is like printf() to format any kinds of data type into a byte sequence, and write it to every serial port in AT Command Mode. More... | |
int32_t | udrv_serial_read (SERIAL_PORT Port, uint8_t *Buffer, int32_t NumberOfBytes) |
This API is used to read a byte sequence from a specified serial port. More... | |
int32_t | udrv_serial_peek (SERIAL_PORT Port) |
This API is used to peek a byte from a specified serial port. More... | |
void | udrv_serial_flush (SERIAL_PORT Port) |
This API is used to wait a specified serial port to complete data writing. More... | |
void | udrv_serial_lock (void) |
This API is used to lock a specified serial port. More... | |
void | udrv_serial_unlock (void) |
This API is used to maunually unlock a specified serial port. More... | |
int32_t | udrv_serial_get_passwd (char *passwd, uint32_t len) |
This API is used to get the unlock password for a specified serial port. More... | |
int32_t | udrv_serial_set_passwd (const char *passwd, uint32_t len) |
This API is used to set the unlock password for a specified serial port. More... | |
SERIAL_WLOCK_STATE | udrv_serial_get_lock_state (SERIAL_PORT Port) |
This API is used to get the lock state of a specified serial port. More... | |
void | udrv_serial_disable (SERIAL_PORT Port) |
This API is used to disable a specified serial port. More... | |
void | udrv_serial_enable (SERIAL_PORT Port) |
This API is used to enable a specified serial port. More... | |
int32_t | udrv_serial_read_available (SERIAL_PORT Port) |
This API is used to get the number of bytes available for reading from the specified serial port. More... | |
uint32_t | udrv_serial_get_timeout () |
This API is used to get the timeout value for read/write/flush API. More... | |
void | udrv_serial_set_timeout (uint32_t timeout) |
This API is used to set the timeout value for read/write/flush API. More... | |
void | udrv_serial_suspend () |
Suspend serial hardware before entering sleep mode. More... | |
void | udrv_serial_resume () |
Resume serial hardware after leaving sleep mode. More... | |
void | serial_fallback_handler (SERIAL_PORT port, uint8_t ch) |
Let AT+BOOT and AT+ATM works in any serial mode. More... | |
Provide a hardware independent serial driver layer for API layer to use.
#define SERIAL_NO_TIMEOUT UINT32_MAX |
typedef enum _SERIAL_STATE SERIAL_STATE |
typedef enum _SERIAL_EVENT SERIAL_EVENT |
typedef enum _SERIAL_WIRE_MODE_E SERIAL_WIRE_MODE_E |
typedef enum _SERIAL_WORD_LEN_E SERIAL_WORD_LEN_E |
typedef enum _SERIAL_STOP_BIT_E SERIAL_STOP_BIT_E |
typedef enum _SERIAL_PARITY_E SERIAL_PARITY_E |
typedef enum _SERIAL_PORT SERIAL_PORT |
typedef enum _SERIAL_WLOCK_STATE SERIAL_WLOCK_STATE |
typedef void(* SERIAL_CLI_HANDLER) (SERIAL_PORT, void *) |
enum _SERIAL_STATE |
enum _SERIAL_EVENT |
enum _SERIAL_WIRE_MODE_E |
enum _SERIAL_WORD_LEN_E |
enum _SERIAL_STOP_BIT_E |
enum _SERIAL_PARITY_E |
enum _SERIAL_PORT |
enum _SERIAL_WLOCK_STATE |
void udrv_serial_register_onewire_handler | ( | SERIAL_CLI_HANDLER | handler | ) |
This API is used to register a one-wire handler.
void |
SERIAL_CLI_HANDLER | handler: the handler function to handle the received characters |
bool is_udrv_serial_initialized | ( | SERIAL_PORT | Port | ) |
This API is used to check if a specified serial port is initialized.
bool |
SERIAL_PORT | Port: the specified serial port to be checked |
void udrv_serial_init | ( | SERIAL_PORT | Port, |
uint32_t | BaudRate, | ||
SERIAL_WORD_LEN_E | DataBits, | ||
SERIAL_STOP_BIT_E | StopBits, | ||
SERIAL_PARITY_E | Parity, | ||
SERIAL_WIRE_MODE_E | WireMode | ||
) |
This API is used to initialize a specified serial port.
void |
SERIAL_PORT | Port: the specified serial port to be initialized |
uint32_t | BaudRate: the initialized value of baud rate setting |
SERIAL_WORD_LEN_E | DataBits: the initialized value of data bits setting |
SERIAL_STOP_BIT_E | StopBits: the initialized value of stop bits setting |
SERIAL_PARITY_E | Parity: the initialized value of parity bits setting |
SERIAL_WIRE_MODE_E | WireMode: the initialized value of wire mode |
void udrv_serial_deinit | ( | SERIAL_PORT | Port | ) |
This API is used to deinitialize a specified serial port.
void |
SERIAL_PORT | Port: the specified serial port to be deinitialized |
int32_t udrv_serial_write | ( | SERIAL_PORT | Port, |
uint8_t const * | Buffer, | ||
int32_t | NumberOfBytes | ||
) |
int32_t udrv_serial_printf | ( | SERIAL_PORT | Port, |
const char * | fmt, | ||
... | |||
) |
This API is like printf() to format any kinds of data type into a byte sequence, and write it to a specified serial port.
int32_t |
SERIAL_PORT | Port: the specified serial port |
const | char *fmt: |
int32_t udrv_serial_log_printf | ( | const char * | fmt, |
... | |||
) |
This API is like printf() to format any kinds of data type into a byte sequence, and write it to every serial port in AT Command Mode.
int32_t |
const | char *fmt: |
int32_t udrv_serial_read | ( | SERIAL_PORT | Port, |
uint8_t * | Buffer, | ||
int32_t | NumberOfBytes | ||
) |
This API is used to read a byte sequence from a specified serial port.
int32_t |
SERIAL_PORT | Port: the specified serial port |
uint8_t | const *Buffer: |
int32_t | NumberOfBytes: |
int32_t udrv_serial_peek | ( | SERIAL_PORT | Port | ) |
This API is used to peek a byte from a specified serial port.
int32_t |
SERIAL_PORT | Port: the specified serial port |
void udrv_serial_flush | ( | SERIAL_PORT | Port | ) |
This API is used to wait a specified serial port to complete data writing.
void |
SERIAL_PORT | Port: the specified serial port |
void udrv_serial_lock | ( | void | ) |
This API is used to lock a specified serial port.
void |
void udrv_serial_unlock | ( | void | ) |
This API is used to maunually unlock a specified serial port.
void |
int32_t udrv_serial_get_passwd | ( | char * | passwd, |
uint32_t | len | ||
) |
This API is used to get the unlock password for a specified serial port.
int32_t |
char | *passwd: |
uint32_t | len: |
int32_t udrv_serial_set_passwd | ( | const char * | passwd, |
uint32_t | len | ||
) |
This API is used to set the unlock password for a specified serial port.
int32_t |
const | char *passwd: |
uint32_t | len: |
SERIAL_WLOCK_STATE udrv_serial_get_lock_state | ( | SERIAL_PORT | Port | ) |
This API is used to get the lock state of a specified serial port.
SERIAL_WLOCK_STATE |
SERIAL_PORT | Port: the specified serial port |
void udrv_serial_disable | ( | SERIAL_PORT | Port | ) |
This API is used to disable a specified serial port.
void |
SERIAL_PORT | Port: the specified serial port |
void udrv_serial_enable | ( | SERIAL_PORT | Port | ) |
This API is used to enable a specified serial port.
void |
SERIAL_PORT | Port: the specified serial port |
int32_t udrv_serial_read_available | ( | SERIAL_PORT | Port | ) |
This API is used to get the number of bytes available for reading from the specified serial port.
int32_t |
SERIAL_PORT | Port: the specified serial port |
uint32_t udrv_serial_get_timeout | ( | ) |
This API is used to get the timeout value for read/write/flush API.
uint32_t |
void udrv_serial_set_timeout | ( | uint32_t | timeout | ) |
This API is used to set the timeout value for read/write/flush API.
void |
uint32_t | timeout: the timeout value |
void udrv_serial_suspend | ( | ) |
Suspend serial hardware before entering sleep mode.
void udrv_serial_resume | ( | ) |
Resume serial hardware after leaving sleep mode.
void serial_fallback_handler | ( | SERIAL_PORT | port, |
uint8_t | ch | ||
) |
Let AT+BOOT and AT+ATM works in any serial mode.