Z-Wave Protocol Controller Reference
zwapi_serial.h
Go to the documentation of this file.
1/******************************************************************************
2 * # License
3 * <b>Copyright 2021 Silicon Laboratories Inc. www.silabs.com</b>
4 ******************************************************************************
5 * The licensor of this software is Silicon Laboratories Inc. Your use of this
6 * software is governed by the terms of Silicon Labs Master Software License
7 * Agreement (MSLA) available at
8 * www.silabs.com/about-us/legal/master-software-license-agreement. This
9 * software is distributed to you in Source Code format and is governed by the
10 * sections of the MSLA applicable to Source Code.
11 *
12 *****************************************************************************/
13
20#ifndef ZWAPI_SERIAL_H
21#define ZWAPI_SERIAL_H
22
23#include <stdint.h>
24#include <stdbool.h>
25#include "sl_status.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31// CLEANUP: Should really be private to zwapi, but zw_programmer.c and
32// ZWFirmwareUpdate.c calls these functions directly.
33
40int zwapi_serial_init(const char *serial_port);
41
47void zwapi_serial_close(void);
48
55int zwapi_serial_restart(void);
56
65int zwapi_serial_get_byte(uint8_t *c);
66
72void zwapi_serial_put_byte(uint8_t c);
73
83int zwapi_serial_get_buffer(uint8_t *c, int len);
84
93void zwapi_serial_put_buffer(uint8_t *c, int len);
94
104
114
123
136sl_status_t zwapi_serial_log_to_file_enable(const char *filename);
137
138#ifdef __cplusplus
139}
140#endif
141
142#endif // ZWAPI_SERIAL_H
uint32_t sl_status_t
Definition: sl_status.h:139
SL Status Codes.
int zwapi_serial_init(const char *serial_port)
Initialize the serial port to 115200 BAUD 8N1.
Definition: zwapi_serial.c:141
void zwapi_serial_drain_buffer(void)
Flush the serial output if using buffered output.
Definition: zwapi_serial.c:316
int zwapi_serial_get_buffer(uint8_t *c, int len)
Reads the output of the serial port device and stores the content in a buffer.
Definition: zwapi_serial.c:220
void zwapi_serial_put_byte(uint8_t c)
Write a byte to serial port device.
Definition: zwapi_serial.c:215
bool zwapi_serial_is_file_available(void)
Check the file descriptor for the serial device is available for I/O operations.
Definition: zwapi_serial.c:289
sl_status_t zwapi_serial_log_to_file_enable(const char *filename)
Enable logging of serial data to a file.
Definition: zwapi_serial.c:161
sl_status_t zwapi_serial_log_to_file_disable()
Disable/stop logging serial data to file.
Definition: zwapi_serial.c:184
int zwapi_serial_restart(void)
Closes and re-initialize the last open serial port.
Definition: zwapi_serial.c:200
void zwapi_serial_close(void)
De-Initialize the serial port.
Definition: zwapi_serial.c:194
int zwapi_serial_get_byte(uint8_t *c)
Reads a byte from the serial port device.
Definition: zwapi_serial.c:210
void zwapi_serial_put_buffer(uint8_t *c, int len)
Writes the content of a buffer to the serial port device.
Definition: zwapi_serial.c:252