Create GPIO HAL (#344)
This commit is contained in:
committed by
GitHub
parent
bab3eb19bc
commit
7ad0a3cb04
@@ -63,9 +63,6 @@ struct AppManifest {
|
||||
constexpr static uint32_t Hidden = 1 << 1;
|
||||
};
|
||||
|
||||
/** The version of the manifest file format */
|
||||
std::string manifestVersion = {};
|
||||
|
||||
/** The SDK version that was used to compile this app. (e.g. "0.6.0") */
|
||||
std::string targetSdk = {};
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <driver/gpio.h>
|
||||
#else
|
||||
typedef unsigned int gpio_num_t;
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace tt::hal::gpio {
|
||||
|
||||
typedef unsigned int Pin;
|
||||
constexpr Pin NO_PIN = -1;
|
||||
|
||||
/** @warning The order must match GpioMode from tt_hal_gpio.h */
|
||||
enum class Mode {
|
||||
Disable = 0,
|
||||
Input,
|
||||
Output,
|
||||
OutputOpenDrain,
|
||||
InputOutput,
|
||||
InputOutputOpenDrain
|
||||
};
|
||||
|
||||
/** Configure a single pin */
|
||||
bool configure(Pin pin, Mode mode, bool pullUp, bool pullDown);
|
||||
|
||||
/** Configure a set of pins defined by their bit index */
|
||||
bool configureWithPinBitmask(uint64_t pinBitMask, Mode mode, bool pullUp, bool pullDown);
|
||||
|
||||
bool setMode(Pin pin, Mode mode);
|
||||
|
||||
bool getLevel(Pin pin);
|
||||
|
||||
bool setLevel(Pin pin, bool level);
|
||||
|
||||
int getPinCount();
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Gpio.h"
|
||||
#include "../gpio/Gpio.h"
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <driver/spi_common.h>
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#define SPI_HOST_MAX 3
|
||||
|
||||
typedef tt::hal::gpio::Pin gpio_num_t;
|
||||
|
||||
typedef int spi_host_device_t;
|
||||
struct spi_bus_config_t {
|
||||
gpio_num_t miso_io_num;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <Tactility/RtosCompat.h>
|
||||
|
||||
#include "../Gpio.h"
|
||||
#include "../gpio/Gpio.h"
|
||||
#include "Tactility/Lock.h"
|
||||
#include "UartCompat.h"
|
||||
#include "Tactility/hal/uart/Configuration.h"
|
||||
|
||||
Reference in New Issue
Block a user