*/
GPIOD_API void request(const line_request& config, int default_val = 0) const;
+ /**
+ * @brief Release the line if it was previously requested.
+ */
+ GPIOD_API void release(void) const;
+
/**
* @brief Check if this user has ownership of this line.
* @return True if the user has ownership of this line, false otherwise.
GPIOD_API void request(const line_request& config,
const std::vector<int> default_vals = std::vector<int>()) const;
+ /**
+ * @brief Release all lines held by this object.
+ */
+ GPIOD_API void release(void) const;
+
/**
* @brief Read values from all lines held by this object.
* @return Vector containing line values the order of which corresponds
bulk.request(config, { default_val });
}
+void line::release(void) const
+{
+ this->throw_if_null();
+
+ line_bulk bulk({ *this });
+
+ bulk.release();
+}
+
bool line::is_requested(void) const
{
this->throw_if_null();
"error requesting GPIO lines");
}
+void line_bulk::release(void) const
+{
+ this->throw_if_empty();
+
+ ::gpiod_line_bulk bulk;
+
+ this->to_line_bulk(::std::addressof(bulk));
+
+ ::gpiod_line_release_bulk(::std::addressof(bulk));
+}
+
::std::vector<int> line_bulk::get_values(void) const
{
this->throw_if_empty();