Implemented TactilityKernel and DevicetreeCompiler, updated licenses & copyrights (#452)
**New features** - Created a devicetree DTS and YAML parser in Python - Created new modules: - TactilityKernel (LGPL v3.0 license) - Platforms/PlatformEsp32 (LGPL v3.0 license) - Platforms/PlatformPosix (LGPL v3.0 license) - Tests/TactilityKernelTests Most boards have a placeholder DTS file, while T-Lora Pager has a few devices attached. **Licenses** Clarified licenses and copyrights better. - Add explanation about the intent behind them. - Added explanation about licenses for past and future subprojects - Added more details explanations with regards to the logo usage - Copied licenses to subprojects to make it more explicit
This commit is contained in:
committed by
GitHub
parent
0d16eb606f
commit
4b6ed871a9
@@ -0,0 +1,90 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <Tactility/Device.h>
|
||||
|
||||
#define GPIO_OPTIONS_MASK 0x1f
|
||||
|
||||
#define GPIO_ACTIVE_HIGH (0 << 0)
|
||||
#define GPIO_ACTIVE_LOW (1 << 0)
|
||||
|
||||
#define GPIO_DIRECTION_INPUT (1 << 1)
|
||||
#define GPIO_DIRECTION_OUTPUT (1 << 2)
|
||||
#define GPIO_DIRECTION_INPUT_OUTPUT (GPIO_DIRECTION_INPUT | GPIO_DIRECTION_OUTPUT)
|
||||
|
||||
#define GPIO_PULL_UP (0 << 3)
|
||||
#define GPIO_PULL_DOWN (1 << 4)
|
||||
|
||||
#define GPIO_INTERRUPT_BITMASK (0b111 << 5) // 3 bits to hold the values [0, 5]
|
||||
#define GPIO_INTERRUPT_FROM_OPTIONS(options) (gpio_int_type_t)((options & GPIO_INTERRUPT_BITMASK) >> 5)
|
||||
#define GPIO_INTERRUPT_TO_OPTIONS(options, interrupt) (options | (interrupt << 5))
|
||||
|
||||
typedef enum {
|
||||
GPIO_INTERRUPT_DISABLE = 0,
|
||||
GPIO_INTERRUPT_POS_EDGE = 1,
|
||||
GPIO_INTERRUPT_NEG_EDGE = 2,
|
||||
GPIO_INTERRUPT_ANY_EDGE = 3,
|
||||
GPIO_INTERRUPT_LOW_LEVEL = 4,
|
||||
GPIO_INTERRUPT_HIGH_LEVEL = 5,
|
||||
GPIO__MAX,
|
||||
} GpioInterruptType;
|
||||
|
||||
/**
|
||||
* @brief Provides a type to hold a GPIO pin index.
|
||||
*
|
||||
* This reduced-size type is sufficient to record a pin number,
|
||||
* e.g. from a devicetree GPIOS property.
|
||||
*/
|
||||
typedef uint8_t gpio_pin_t;
|
||||
|
||||
/**
|
||||
* @brief Identifies a set of pins associated with a port.
|
||||
*
|
||||
* The pin with index n is present in the set if and only if the bit
|
||||
* identified by (1U << n) is set.
|
||||
*/
|
||||
typedef uint32_t gpio_pinset_t;
|
||||
|
||||
/**
|
||||
* @brief Provides a type to hold GPIO devicetree flags.
|
||||
*
|
||||
* All GPIO flags that can be expressed in devicetree fit in the low 16
|
||||
* bits of the full flags field, so use a reduced-size type to record
|
||||
* that part of a GPIOS property.
|
||||
*
|
||||
* The lower 8 bits are used for standard flags. The upper 8 bits are reserved
|
||||
* for SoC specific flags.
|
||||
*/
|
||||
typedef uint16_t gpio_flags_t;
|
||||
|
||||
/**
|
||||
* @brief Container for GPIO pin information specified in dts files
|
||||
*
|
||||
* This type contains a pointer to a GPIO device, pin identifier for a pin
|
||||
* controlled by that device, and the subset of pin configuration
|
||||
* flags which may be given in devicetree.
|
||||
*/
|
||||
struct GpioPinConfig {
|
||||
/** GPIO device controlling the pin */
|
||||
const struct Device* port;
|
||||
/** The pin's number on the device */
|
||||
gpio_pin_t pin;
|
||||
/** The pin's configuration flags as specified in devicetree */
|
||||
gpio_flags_t dt_flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the pin is ready to be used.
|
||||
* @param pin_config the specifications of the pin
|
||||
* @return true if the pin is ready to be used
|
||||
*/
|
||||
static inline bool gpio_is_ready(const struct GpioPinConfig* pin_config) {
|
||||
return device_is_ready(pin_config->port);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "Gpio.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
struct GpioControllerApi {
|
||||
bool (*set_level)(struct Device* device, gpio_pin_t pin, bool high);
|
||||
bool (*get_level)(struct Device* device, gpio_pin_t pin, bool* high);
|
||||
bool (*set_options)(struct Device* device, gpio_pin_t pin, gpio_flags_t options);
|
||||
bool (*get_options)(struct Device* device, gpio_pin_t pin, gpio_flags_t* options);
|
||||
};
|
||||
|
||||
bool gpio_controller_set_level(struct Device* device, gpio_pin_t pin, bool high);
|
||||
bool gpio_controller_get_level(struct Device* device, gpio_pin_t pin, bool* high);
|
||||
bool gpio_controller_set_options(struct Device* device, gpio_pin_t pin, gpio_flags_t options);
|
||||
bool gpio_controller_get_options(struct Device* device, gpio_pin_t pin, gpio_flags_t* options);
|
||||
|
||||
inline bool gpio_set_options_config(struct Device* device, struct GpioPinConfig* config) {
|
||||
return gpio_controller_set_options(device, config->pin, config->dt_flags);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "Gpio.h"
|
||||
#include <Tactility/FreeRTOS/FreeRTOS.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
struct I2cControllerApi {
|
||||
bool (*read)(struct Device* device, uint8_t address, uint8_t* data, size_t dataSize, TickType_t timeout);
|
||||
bool (*write)(struct Device* device, uint8_t address, const uint8_t* data, uint16_t dataSize, TickType_t timeout);
|
||||
bool (*write_read)(struct Device* device, uint8_t address, const uint8_t* write_data, size_t write_data_size, uint8_t* read_data, size_t read_data_size, TickType_t timeout);
|
||||
};
|
||||
|
||||
bool i2c_controller_read(struct Device* device, uint8_t address, uint8_t* data, size_t dataSize, TickType_t timeout);
|
||||
|
||||
bool i2c_controller_write(struct Device* device, uint8_t address, const uint8_t* data, uint16_t dataSize, TickType_t timeout);
|
||||
|
||||
bool i2c_controller_write_read(struct Device* device, uint8_t address, const uint8_t* write_data, size_t write_data_size, uint8_t* read_data, size_t read_data_size, TickType_t timeout);
|
||||
|
||||
extern const struct DeviceType I2C_CONTROLLER_TYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct RootConfig {
|
||||
const char* model;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user