Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
|
#include "ca821x-generic-exchange.h"
#include "ca821x-posix-util-internal.h"
#include "uart-exchange.h"
#include <Windows.h>
#include <assert.h>
#include <stdio.h>
#include <time.h>
Classes | |
struct | uart_exchange_info |
Private data for the UART exchange. More... | |
struct | uart_dev_ll_node |
Structure representing a node in a linked list, used to store the port number of every detected serial device. More... | |
Macros | |
#define | CASCODA_UART_BAUDRATE 115200 |
#define | SMALLEST_ALLOWED_PORT_NUMBER 2 |
#define | LARGEST_ALLOWED_PORT_NUMBER 255 |
Enumerations | |
enum | events_array_index { UNBLOCKING_READ_EVENT = 0 , SERIAL_ACTIVITY_EVENT , NUM_EVENTS } |
The two types of events that are watched. More... | |
enum | serial_op_completion_info { OPERATION_PERFORMED_SYNCHRONOUSLY = 0 , OPERATION_PERFORMED_ASYNCHRONOUSLY , OPERATION_FAILED } |
Different ways a serial read or write operation can occur. More... | |
Functions | |
ca_error | uart_exchange_init (ca821x_errorhandler callback, struct ca821x_dev *pDeviceRef, union ca821x_util_init_extra_arg arg) |
void | uart_exchange_deinit (struct ca821x_dev *pDeviceRef) |
Deinitialise the uart exchange, so that it can be reinitialised by another process, or reopened later. More... | |
ca_error | uart_exchange_enumerate (util_device_found aCallback, void *aContext) |
Function to enumerate all of the UART devices configured (in the CASCODA_UART environment variable), calling aCallback with a struct describing each one. More... | |
int | uart_exchange_reset (unsigned long resettime, struct ca821x_dev *pDeviceRef) |
Send a hard reset to the ca821x. More... | |
#define CASCODA_UART_BAUDRATE 115200 |
#define LARGEST_ALLOWED_PORT_NUMBER 255 |
#define SMALLEST_ALLOWED_PORT_NUMBER 2 |
enum events_array_index |
void uart_exchange_deinit | ( | struct ca821x_dev * | pDeviceRef | ) |
Deinitialise the uart exchange, so that it can be reinitialised by another process, or reopened later.
pDeviceRef | Pointer to initialised ca821x_device_ref struct |
ca_error uart_exchange_enumerate | ( | util_device_found | aCallback, |
void * | aContext | ||
) |
Function to enumerate all of the UART devices configured (in the CASCODA_UART environment variable), calling aCallback with a struct describing each one.
The struct passed to aCallback will only be valid for the duration that the function is called. This function will not return until every callback has been called.
aCallback | The callback to call with each result |
aContext | The generic void pointer to provide to the callback when it is called |
CA_ERROR_SUCCESS | Enumeration successful |
CA_ERROR_NOT_FOUND | No devices found |
ca_error uart_exchange_init | ( | ca821x_errorhandler | callback, |
struct ca821x_dev * | pDeviceRef, | ||
union ca821x_util_init_extra_arg | arg | ||
) |
int uart_exchange_reset | ( | unsigned long | resettime, |
struct ca821x_dev * | pDeviceRef | ||
) |
Send a hard reset to the ca821x.
This should not be necessary, but is provided in case the ca821x becomes unresponsive to spi.
[in] | resettime | The length of time (in ms) to hold the reset pin active for. 1ms is usually a suitable value for this. |
[in] | pDeviceRef | Pointer to initialised ca821x_device_ref struct |