49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
//
|
|
// Created by nano on 4/26/25.
|
|
//
|
|
#ifndef COMMS_H
|
|
#define COMMS_H
|
|
#include <libserialport.h>
|
|
#include <stdlib.h>
|
|
|
|
typedef u_int8_t byte;
|
|
|
|
/**
|
|
* Initializes the serial communication for the usb -> uart board
|
|
*/
|
|
void comm_init_communication();
|
|
|
|
void comm_get_port_list(struct sp_port ***port_list);
|
|
|
|
void comm_list_serial_ports(struct sp_port **port_list);
|
|
|
|
/**
|
|
* Opens communication to the selected serial port and sets the correct parameters for the zigbee carrier board.
|
|
*/
|
|
void comm_open_port();
|
|
|
|
/**
|
|
* Ends the serial communication for the usb -> uart board
|
|
*/
|
|
void comm_end_communication();
|
|
|
|
int comm_blocking_read(byte *data, int amount_of_bytes, int timeout);
|
|
|
|
int comm_await_data_ready(int timeout);
|
|
|
|
int comm_await_ready_for_tx(int timeout);
|
|
|
|
int comm_nonblocking_read(byte *data, int amount_of_bytes);
|
|
|
|
int comm_blocking_read(byte *data, int amount_of_bytes, int timeout);
|
|
|
|
int comm_nonblocking_write(byte *data, int amount_of_bytes);
|
|
|
|
int comm_blocking_write(byte *data, int amount_of_bytes, int timeout);
|
|
|
|
|
|
int check(enum sp_return result);
|
|
|
|
|
|
#endif //COMMS_H
|