/* * Author: Zion Orent * Copyright (c) 2015 Intel Corporation. * * This program and the accompanying materials are made available under the * terms of the The MIT License which is available at * https://opensource.org/licenses/MIT. * * SPDX-License-Identifier: MIT */ #include #include #include #include "flex.hpp" using namespace upm; using namespace std; Flex::Flex(int pin) { if ( !(m_aio = mraa_aio_init(pin)) ) { throw std::invalid_argument(std::string(__FUNCTION__) + ": mraa_aio_init() failed, invalid pin?"); return; } } Flex::~Flex() { mraa_aio_close(m_aio); } int Flex::value() { return mraa_aio_read(m_aio); }