Files
hsb/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/IODevice.h
mmi 291d17b9d8 re-organized HAL
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@220 05563f52-14a8-4384-a975-3d1654cca0fa
2017-09-28 17:49:02 +00:00

71 lines
2.3 KiB
C

// -----------------------------------------------------------------------------
/// @file IODevice.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) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file IODevice.h
/// @ingroup {group_name}
#ifndef MISC_INC_IODEVICE_H_
#define MISC_INC_IODEVICE_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <stdio.h>
#include "stm32f10x.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
struct IODevice;
typedef ErrorStatus (*ReadFunction)(const struct IODevice* self, char* buffer, size_t length, size_t* actualLength);
typedef ErrorStatus (*WriteFunction)(const struct IODevice* self, const char* buffer, size_t length);
struct IODevice
{
ReadFunction _read;
WriteFunction _write;
};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
extern ErrorStatus IODevice_construct (struct IODevice* self, ReadFunction read, WriteFunction write);
extern ErrorStatus IODevice_write(const struct IODevice* self, const char* buffer, size_t length);
extern ErrorStatus IODevice_read(const struct IODevice* self, char* buffer, size_t length, size_t* actualLength);
#endif /* MISC_INC_IODEVICE_H_ */