Files
hsb/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/inc/gpio.h
dvl 20885c64e8 More doxygen documentation
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@419 05563f52-14a8-4384-a975-3d1654cca0fa
2018-01-11 14:56:48 +00:00

124 lines
3.9 KiB
C

// -----------------------------------------------------------------------------
/// @file gpio.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
// -----------------------------------------------------------------------------
/**
* GPIO implementation
* \defgroup GPIO Package GPIO
* \ingroup Platform
* @{
*/
#ifndef INC_GPIO_H_
#define INC_GPIO_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#include "platform.h"
#include "IODevice.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
typedef enum
{
INPUT = 0,
OUTPUT = !INPUT
} GpioDirection;
struct Gpio
{
struct IODevice device;
T_PL_GPIO gpio;
GpioDirection direction;
bool status;
bool initialized;
};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* GPIO_construct
* Constructs a GPIO as IODevice
*
* @param self The GPIO instance
* @param direction Direction of the GPIO
* - INPUT or OUTPUT
* @param io The Input/Output to use
*
* @return ErrorStatus SUCCESS if construction was successful
* ERROR otherwise
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus GPIO_construct(struct Gpio* self, GpioDirection direction, T_PL_GPIO io);
/** ----------------------------------------------------------------------------
* GPIO_setValue
* Sets value to GPIO self
*
* @param self The GPIO instance
* @param value the value to use
* 0 => Output LOW
* 1 => Output HIGH
*
* @return ErrorStatus SUCCESS if construction was successful
* ERROR otherwise
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus GPIO_setValue(struct Gpio* self, bool value);
/** ----------------------------------------------------------------------------
* GPIO_getValue
* Gets value from GPIO self
*
* @param self The GPIO instance
* @param value the value that has been read
* 0 => Output LOW
* 1 => Output HIGH
*
* @return ErrorStatus SUCCESS if construction was successful
* ERROR otherwise
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus GPIO_getValue(struct Gpio* self, bool* value);
#endif /* INC_GPIO_H_ */
/** @} */