Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

sdk/mbed/sdk.h

Committer:
dan_ackme
Date:
2014-08-12
Revision:
11:ea484e1b7fc4
Parent:
1:6ec9998427ad
Child:
13:2b51f5267c92

File content as of revision 11:ea484e1b7fc4:

/*
 * Copyright 2014, ACKme Networks
 * All Rights Reserved.
 *
 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks;
 * the contents of this file may not be disclosed to third parties, copied
 * or duplicated in any form, in whole or in part, without the prior
 * written permission of ACKme Networks.
 */

#pragma once


#define MBED_SDK

#include "mbed.h"

namespace wiconnect
{

/**
 * @ingroup api_core_macro
 * @brief When defined enables asynchronous command processing
 */
#define WICONNECT_ASYNC_TIMER_ENABLED
/**
 * @ingroup api_core_macro
 * @brief When defined enables user supplied dynamic memory allocation
 */
#define WICONNECT_ENABLE_MALLOC
/**
 * @ingroup api_core_macro
 * @brief When defined enables Host<->Wiconnect Module serial RX buffering
 */
#define WICONNECT_SERIAL_RX_BUFFER
/**
 * @ingroup api_core_macro
 * @brief When defined enables certain conversion API functions to use a default buffer to store string
 */
#define WICONNECT_USE_DEFAULT_STRING_BUFFERS

/**
 * @ingroup api_core_macro
 * @brief When WICONNECT_ENABLE_MALLOC defined, this is the default malloc function
 */
#define WICONNECT_DEFAULT_MALLOC malloc
/**
 * @ingroup api_core_macro
 * @brief When WICONNECT_ENABLE_MALLOC defined, this is the default free function
 */
#define WICONNECT_DEFAULT_FREE free

/**
 * @ingroup api_core_macro
 * @brief The default Host<->Wiconnect Module serial BAUD rate
 */
#define WICONNECT_DEFAULT_BAUD 115200
/**
 * @ingroup api_core_macro
 * @brief The default command timeout (i.e max command executing time)
 */
#define WICONNECT_DEFAULT_TIMEOUT 3000 // ms
/**
 * @ingroup api_core_macro
 * @brief When WICONNECT_ASYNC_TIMER_ENABLED, this specifies the max number of asynchronous commands that may be queued
 */
#define WICONNECT_MAX_QUEUED_COMMANDS 8
/**
 * @ingroup api_core_macro
 * @brief When WICONNECT_ASYNC_TIMER_ENABLED, this specifies the period in milliseconds commands should be processed
 */
#define WICONNECT_DEFAULT_COMMAND_PROCESSING_PERIOD 50 // ms

/**
 * @ingroup api_core_macro
 * @brief The default blocking mode of the Library.
 */
#define WICONNECT_DEFAULT_NONBLOCKING false



// ----------------------------------------------------------------------------

#define WICONNECT_GPIO_BASE_CLASS : DigitalOut
#define WICONNECT_SERIAL_BASE_CLASS : RawSerial
#define WICONNECT_PERIODIC_TIMER_BASE_CLASS : Ticker
#define WICONNECT_EXTERNAL_INTERRUPT_GPIO_BASE_CLASS : InterruptIn

#define WICONNECT_MAX_PIN_IRQ_HANDLERS 3


/**
 * @ingroup api_core_macro
 * @brief Default value for a pin, Not connected
 */
#define PIN_NC NC

/**
 * @ingroup types_core
 * @brief Pin name on HOST
 */
typedef PinName Pin;

/**
 * @ingroup types_core
 * @brief Host<->Wiconnect Module serial configuration
 */
typedef struct _SerialConfig
{
    Pin rx;
    Pin tx;
    Pin cts;
    Pin rts;
    int baud;
    void *serialRxBuffer;
    int serialRxBufferSize;

    _SerialConfig(Pin rx, Pin tx, Pin cts, Pin rts, int baud = WICONNECT_DEFAULT_BAUD, int serialRxBufferSize = 0, void *serialRxBuffer = NULL)
    {
        this->rx =rx;
        this->tx =tx;
        this->cts =cts;
        this->rts =rts;
        this->baud = baud;
        this->serialRxBuffer =serialRxBuffer;
        this->serialRxBufferSize =serialRxBufferSize;
    }

    _SerialConfig(Pin rx, Pin tx, int baud = WICONNECT_DEFAULT_BAUD)
    {
        this->rx =rx;
        this->tx =tx;
        this->cts =PIN_NC;
        this->rts =PIN_NC;
        this->baud = baud;
        this->serialRxBuffer =NULL;
        this->serialRxBufferSize =0;
    }

} SerialConfig;


/**
 * @ingroup api_core_macro
 * @brief Function to stop processor for specified number of milliseconds
 */
#define delayMs(ms) wait_ms(ms)




}