-
-
Notifications
You must be signed in to change notification settings - Fork 80
Create hal-device module #471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
04dfe1d
Create hal-devices module
KenVanHoeylandt c8330d8
Created hal-devices module, fix GPIO
KenVanHoeylandt 901b386
Fixes
KenVanHoeylandt 9c3d42d
Fixes
KenVanHoeylandt 6b0c21d
Fixes
KenVanHoeylandt 1639349
Fixes
KenVanHoeylandt f7b0dba
Fix for tests
KenVanHoeylandt 32cb599
Fix
KenVanHoeylandt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| cmake_minimum_required(VERSION 3.20) | ||
|
|
||
| if (DEFINED ENV{ESP_IDF_VERSION}) | ||
| file(GLOB_RECURSE SOURCE_FILES Source/*.c*) | ||
|
|
||
| list(APPEND REQUIRES_LIST | ||
| TactilityKernel | ||
| TactilityCore | ||
| TactilityFreeRtos | ||
| ) | ||
|
|
||
| idf_component_register( | ||
| SRCS ${SOURCE_FILES} | ||
| INCLUDE_DIRS "Include/" | ||
| REQUIRES ${REQUIRES_LIST} | ||
| ) | ||
|
|
||
| if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
| target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-unused-variable) | ||
| endif () | ||
|
|
||
| else () | ||
|
|
||
| file(GLOB_RECURSE SOURCES "Source/*.c*") | ||
|
|
||
| add_library(hal-device OBJECT) | ||
|
|
||
| target_sources(hal-device PRIVATE ${SOURCES}) | ||
|
|
||
| target_include_directories(hal-device | ||
| PRIVATE Private/ | ||
| PUBLIC Include/ | ||
| ) | ||
|
|
||
| add_definitions(-D_Nullable=) | ||
| add_definitions(-D_Nonnull=) | ||
|
|
||
| target_link_libraries(hal-device PUBLIC | ||
| TactilityFreeRtos | ||
| TactilityCore | ||
| TactilityKernel | ||
| freertos_kernel | ||
| ) | ||
|
|
||
| endif () | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| #pragma once | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| enum class HalDeviceType { | ||
| HAL_DEVICE_TYPE_I2C, | ||
| HAL_DEVICE_TYPE_DISPLAY, | ||
| HAL_DEVICE_TYPE_TOUCH, | ||
| HAL_DEVICE_TYPE_SDCARD, | ||
| HAL_DEVICE_TYPE_KEYBOARD, | ||
| HAL_DEVICE_TYPE_ENCODER, | ||
| HAL_DEVICE_TYPE_POWER, | ||
| HAL_DEVICE_TYPE_GPS, | ||
| HAL_DEVICE_TYPE_OTHER | ||
| }; | ||
|
|
||
| HalDeviceType hal_device_get_type(struct Device* device); | ||
|
|
||
| void hal_device_for_each_of_type(HalDeviceType type, void* context, bool(*onDevice)(struct Device* device, void* context)); | ||
|
|
||
| extern const struct DeviceType HAL_DEVICE_TYPE; | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
21 changes: 21 additions & 0 deletions
21
Modules/hal-device/Include/tactility/drivers/hal_device.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| #pragma once | ||
|
|
||
| #include "hal_device.h" | ||
|
|
||
| #include <memory> | ||
| #include <tactility/hal/Device.h> | ||
|
|
||
| namespace tt::hal { | ||
|
|
||
| /** | ||
| * @brief Get a tt::hal::Device object from a Kernel device. | ||
| * @warning The input device must be of type HAL_DEVICE_TYPE | ||
| * @param kernelDevice The kernel device | ||
| * @return std::shared_ptr<Device> | ||
| */ | ||
| std::shared_ptr<Device> hal_device_get_device(::Device* kernelDevice); | ||
|
|
||
| void hal_device_set_device(::Device* kernelDevice, std::shared_ptr<Device> halDevice); | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| #pragma once | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| extern struct Module hal_device_module; | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.