git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@427 05563f52-14a8-4384-a975-3d1654cca0fa
89 lines
2.7 KiB
C
89 lines
2.7 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file spiDevice.h
|
|
/// @brief File description
|
|
// -----------------------------------------------------------------------------
|
|
// Micro-Key bv
|
|
// Industrieweg 28, 9804 TG Noordhorn
|
|
// Postbus 92, 9800 AB Zuidhorn
|
|
// The Netherlands
|
|
// Tel: +31 594 503020
|
|
// Fax: +31 594 505825
|
|
// Email: support@microkey.nl
|
|
// Web: www.microkey.nl
|
|
// -----------------------------------------------------------------------------
|
|
/// $Revision$
|
|
/// $Author$
|
|
/// $Date$
|
|
// (c) 2015 Micro-Key bv
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/**
|
|
* %SpiDevice implementation
|
|
* \defgroup SpiDevice Package SpiDevice
|
|
* \ingroup Platform
|
|
* @{
|
|
*/
|
|
|
|
#ifndef PLATFORM_INC_SPIDEVICE_H_
|
|
#define PLATFORM_INC_SPIDEVICE_H_
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "IODevice.h"
|
|
#include "spi.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions.
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/**
|
|
* \class SpiDevice
|
|
* \extends IODevice
|
|
*/
|
|
struct SpiDevice
|
|
{
|
|
struct IODevice device; //!< \private
|
|
struct Spi* spi;
|
|
struct SpiParameters parameters;
|
|
T_PL_GPIO SPI_CE;
|
|
bool initialized;
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
extern ErrorStatus SpiDevice_construct(struct SpiDevice* self, struct Spi* spi, const struct SpiParameters* parameters);
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* Spi_Write
|
|
* Write the data in buffer to the SPI in argument self
|
|
*
|
|
* @param self The UART class object
|
|
* @param buffer Message string to send
|
|
* @parm length Message length
|
|
*
|
|
* @return ErrorStatus SUCCESS if writing message was successful
|
|
* ERROR otherwise
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus SpiDevice_write (const struct SpiDevice* self, const char* buffer, int length);
|
|
|
|
#endif /* PLATFORM_INC_SPIDEVICE_H_ */
|
|
|
|
/** @} */
|