mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-06-19 12:25:05 +00:00
56 lines
1.2 KiB
C
56 lines
1.2 KiB
C
// SPDX-License-Identifier: Apache-2.0
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <tactility/device.h>
|
|
#include <tactility/error.h>
|
|
|
|
/**
|
|
* @brief Grove Port modes
|
|
*/
|
|
enum GroveMode {
|
|
GROVE_MODE_DISABLED = 0,
|
|
GROVE_MODE_UART = 1,
|
|
GROVE_MODE_I2C = 2
|
|
};
|
|
|
|
/**
|
|
* @brief API for Grove drivers.
|
|
*/
|
|
struct GroveApi {
|
|
/**
|
|
* @brief Sets the Grove port mode.
|
|
* @param[in] device the Grove device
|
|
* @param[in] mode the new mode
|
|
* @return ERROR_NONE on success
|
|
*/
|
|
error_t (*set_mode)(struct Device* device, enum GroveMode mode);
|
|
|
|
/**
|
|
* @brief Gets the current Grove port mode.
|
|
* @param[in] device the Grove device
|
|
* @param[out] mode pointer to store the current mode
|
|
* @return ERROR_NONE on success
|
|
*/
|
|
error_t (*get_mode)(struct Device* device, enum GroveMode* mode);
|
|
};
|
|
|
|
/**
|
|
* @brief Sets the Grove port mode using the specified device.
|
|
*/
|
|
error_t grove_set_mode(struct Device* device, enum GroveMode mode);
|
|
|
|
/**
|
|
* @brief Gets the current Grove port mode using the specified device.
|
|
*/
|
|
error_t grove_get_mode(struct Device* device, enum GroveMode* mode);
|
|
|
|
extern const struct DeviceType GROVE_TYPE;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|