// ----------------------------------------------------------------------------- /// @file Power6V5Supply.c /// @brief 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 // ----------------------------------------------------------------------------- /// @file Power6V5Supply.c /// @ingroup {group_name} // ----------------------------------------------------------------------------- // Include files // ----------------------------------------------------------------------------- #include "Power6V5Supply.h" // ----------------------------------------------------------------------------- // Constant and macro definitions // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // Type definitions // ----------------------------------------------------------------------------- struct Power6V5Supply { bool initialized; struct Gpio* gpio; }; // ----------------------------------------------------------------------------- // File-scope variables // ----------------------------------------------------------------------------- static struct Power6V5Supply self = {.initialized = false}; // ----------------------------------------------------------------------------- // Function declarations // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // Function definitions // ----------------------------------------------------------------------------- ErrorStatus Power6V5Supply_construct(struct Gpio* gpio) { ErrorStatus returnValue = SUCCESS; if (!self.initialized) { self.gpio = gpio; self.initialized = true; } else { returnValue = ERROR; } return returnValue; } void Power6V5Supply_destruct(void) { if (self.initialized) { self.initialized = false; } } ErrorStatus Power6V5Supply_off(void) { ErrorStatus returnValue = SUCCESS; if (self.initialized) { returnValue = GPIO_setValue(self.gpio, true); } else { returnValue = ERROR; } return returnValue; } ErrorStatus Power6V5Supply_on(void) { ErrorStatus returnValue = SUCCESS; if (self.initialized) { returnValue = GPIO_setValue(self.gpio, false); } else { returnValue = ERROR; } return returnValue; }