Skip to content

Commit a12a712

Browse files
committed
Moving host source out of lib_device_control folder to host/
Adding cmake to aid build host apps
1 parent 103154d commit a12a712

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2236
-2124
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ doc/README/README.rst
1313
.lock-waf_*
1414
.waf-*/
1515
build/
16-
**/.venv/**
16+
**/.venv*/**

doc/Doxyfile.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
PROJECT_NAME = lib_device_control
44
PROJECT_BRIEF = "Device Control for xcore"
55

6-
INPUT = ../lib_device_control/api ../lib_device_control/src ../lib_device_control/host
6+
INPUT = ../lib_device_control/api ../lib_device_control/inc ../host/api ../host/inc
77

88
EXCLUDE_PATTERNS = libusb.h
99

examples/i2c/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ else()
1212
endif()
1313

1414
# Includes and flags
15-
set(APP_INCLUDES src)
15+
set(APP_INCLUDES src shared)
1616

1717
set(APP_COMPILER_FLAGS
1818
-O2

examples/i2c/host_rpi/CMakeLists.txt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,22 @@ set(CMAKE_BUILD_TYPE "Release")
44
project(i2c_host_app)
55

66
# Define path to lib_device_control
7-
set(DEVICE_CONTROL_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../lib_device_control)
7+
set(HOST_CONTROL_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../host)
88

9-
# Define source files
10-
set(SOURCES
11-
"${DEVICE_CONTROL_PATH}/host/device_access_i2c_rpi.c"
12-
"${DEVICE_CONTROL_PATH}/host/util.c"
9+
include("${HOST_CONTROL_PATH}/host_build_info.cmake")
10+
11+
add_executable(i2c_host_app
12+
"${HOST_CONTROL_PATH}/src/device_access_i2c_rpi.c"
13+
"${HOST_CONTROL_PATH}/src/util.c"
1314
"src/host.c"
1415
)
15-
add_executable(i2c_host_app ${SOURCES})
1616

1717
# Directories
1818
target_include_directories(
19-
i2c_host_app
20-
PRIVATE
21-
src
22-
${DEVICE_CONTROL_PATH}/host
23-
${DEVICE_CONTROL_PATH}/api
24-
${DEVICE_CONTROL_PATH}/src
19+
i2c_host_app PRIVATE
20+
src
21+
../shared
22+
${HOST_CONTROL_INC}
2523
)
2624

2725
# Properties and options

examples/i2c/host_rpi/src/resource.h

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/i2c/host_xcore/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ set(XMOS_SANDBOX_DIR ${CMAKE_SOURCE_DIR}/../../../..)
88
# target: choose the target platform
99
set(APP_HW_TARGET XK-EVK-XU316)
1010

11-
set(APP_INCLUDES src)
11+
set(APP_INCLUDES src ../shared)
1212

1313
# source files
14-
set(APP_C_SRCS ../../../lib_device_control/host/device_access_i2c_xcore.xc ../../../lib_device_control/host/util.c)
14+
set(APP_C_SRCS ../../../host/src/device_access_i2c_xcore.xc ../../../host/src/util.c)
1515

1616
set(APP_COMPILER_FLAGS
17-
-O2
18-
-g
19-
-report
20-
-Wall
21-
-D USE_I2C=1
17+
-O2
18+
-g
19+
-report
20+
-Wall
21+
-D USE_I2C=1
2222
)
2323

24-
set(APP_DEPENDENT_MODULES lib_device_control lib_i2c)
24+
set(APP_DEPENDENT_MODULES lib_device_control "lib_i2c(6.4.1)")
2525
XMOS_REGISTER_APP()

examples/i2c/host_xcore/src/resource.h

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/i2c/src/app.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// Copyright 2016-2025 XMOS LIMITED.
22
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
3-
#ifndef APP_H_
4-
#define APP_H_
53

6-
#include "control.h"
4+
#ifndef APP_H
5+
#define APP_H
76

8-
#define RESOURCE_ID 0x12
7+
#include "control.h"
98

109
void app(server interface control i_control);
1110

12-
#endif // APP_H_
11+
#endif // APP_H

examples/i2c/src/app.xc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
#include <stdio.h>
44
#include <stdint.h>
55
#include <assert.h>
6+
67
#include "control.h"
78
#include "app.h"
9+
#include "resource.h"
810

911
void app(server interface control i_control)
1012
{

0 commit comments

Comments
 (0)