tutorial: dummy subsystem

This commit is contained in:
martin 2023-07-07 09:55:36 +02:00
parent c665b64966
commit 6772c7bfc8
4 changed files with 82 additions and 0 deletions

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
.DS_Store
.idea
thumbs.db
*.zip
*.pyc
*_pb2.py
*.bak
*.hex
*.[oa]
*.pb.go
.vscode/ipch/**
!.gitkeep
_build
build
artifacts
doc/**
.unison*
node_modules
go.sum
**/_build
**/parking
test/**/build/
# test/unittest/generated
compile_commands.json

25
CMakeLists.txt Normal file
View File

@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.18)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(
Dummy
VERSION 0.1
DESCRIPTION "Dummy - A dummy library"
LANGUAGES C
)
set_property(
TARGET ${PROJECT}
PROPERTY C_STANDARD 11
)
add_library(
${PROJECT_NAME}
src/dummy.c
)
target_include_directories(
${PROJECT_NAME}
PUBLIC
include
)

19
include/dummy/dummy.h Normal file
View File

@ -0,0 +1,19 @@
/**
* \file dummy.h
*
* \brief A dummy subsystem.
*/
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
uint8_t dummy_random(void);
#ifdef __cplusplus
}
#endif

10
src/dummy.c Normal file
View File

@ -0,0 +1,10 @@
/**
* \file dummy.c
*/
#include "dummy/dummy.h"
uint8_t dummy_random(void)
{
return 4U; // determined by fair dice roll.
}