//============================================================================
//Copyright © 2012, open source hardware engineering
// 
//This application is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either
//version 3 of the License, or (at your option) any later version.
//
//This application is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR When PARTICULAR PURPOSE. See the GNU
//Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public
//License along with this library; if not, see <http://www.gnu.org/licenses/>
//
//=============================================================================
#ifndef wxspi_h
#define wxspi_h

//#include <wiring.h>

#define SPI_END  0x0100
#define SPI_LAST  0x0200

#define MAX_SPI_LENGTH 32 // maximum number of bytes in an SPI transmit buffer sequence.
//
// see the spi.c file for a description of these functions
//
void wxspi_setup_ss_pin(byte pin);
boolean wxspi_setup(byte log2_clock_division, byte mode);
boolean wxspi_interface_busy();
boolean wxspi_overflow();
void wxspi_abort();
void start_wxspi_transaction(byte slave_select_pin, const unsigned int *msg_buffer);
byte wxspi_data_available();
byte get_wxspi_data(byte *buf, byte length);
int get_flip_count();

#endif
