Replaced LED with more generic class GPIO
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@233 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @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
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file gpio.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#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;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// 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_ */
|
||||
Reference in New Issue
Block a user