Initial compiling version of the bronkhorst driver
Test And Build / Format (push) Failing after 3s
Test And Build / Lint (push) Failing after 14s

This commit is contained in:
2026-07-24 15:24:08 +02:00
commit 2966a33233
8 changed files with 3445 additions and 0 deletions
+246
View File
@@ -0,0 +1,246 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: ".*"
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: "(Test)?$"
IncludeIsMainSourceRegex: ""
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
---
+18
View File
@@ -0,0 +1,18 @@
name: Test And Build
on: [push]
jobs:
Format:
runs-on: linepics
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: formatting
run: clang-format --style=file --Werror --dry-run device/* frontends/*
Lint:
runs-on: linepics
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: cppcheck
run: cppcheck --std=c++17 --addon=cert --addon=misc --error-exitcode=1 device/ frontends/
+1
View File
@@ -0,0 +1 @@
build
+135
View File
@@ -0,0 +1,135 @@
cmake_minimum_required(VERSION 3.03)
project(keller_dv2ps VERSION 0.1)
add_compile_options(
-Wall
-Wformat=2
-Wno-format-nonliteral
-Wno-strict-aliasing
-Wuninitialized
-Wno-unused-function
)
option(
BUILD_FRONTEND
"If ON, build the default frontend executable"
OFF
)
set(CMAKE_PREFIX_PATH "$ENV{MIDASSYS}")
find_package(Midas REQUIRED)
set(
TCPIP_DRIVER_DIR
$ENV{MIDASSYS}/drivers/bus/tcpip.cxx
CACHE STRING
"path to tcpip driver that should be used"
)
set(
DRIVERS
$ENV{MIDASSYS}/drivers/class/multi.cxx
)
set(SYS_LIBS
pthread
util
rt
dl
)
set(MIDAS_LIBS
midas::mfe
midas::midas
midas::mscb
)
set(LIBS ${SYS_LIBS} ${MIDAS_LIBS})
################################################################################
## make tcpip library configurable
################################################################################
if(IS_DIRECTORY ${TCPIP_DRIVER_DIR})
add_subdirectory(
# TODO not sure, should it be a submodule? does it really make sense to
# separate everything?
${TCPIP_DRIVER_DIR} ./bus/tcpip
)
set(
LIBS
${LIBS}
tcpip
)
else()
set(
DRIVERS
${DRIVERS}
${TCPIP_DRIVER_DIR}
)
endif()
################################################################################
## Device Library
################################################################################
add_library(
bronkhorst_flowmeter
device/bronkhorst_flowmeter.cxx
${DRIVERS}
)
set_property(
TARGET
bronkhorst_flowmeter
PROPERTY
CXX_STANDARD 11
)
target_include_directories(
bronkhorst_flowmeter
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/device>
$<INSTALL_INTERFACE:include>
PRIVATE
$ENV{MIDASSYS}/drivers
)
target_link_libraries(
bronkhorst_flowmeter
${LIBS}
)
################################################################################
## Test Frontend
################################################################################
if(${BUILD_FRONTEND})
add_executable(
bronkhorst_flowmeter_fe
frontend/bronkhorst_flowmeter_fe.cxx
)
set_property(
TARGET
bronkhorst_flowmeter_fe
PROPERTY
CXX_STANDARD 11
)
target_include_directories(
bronkhorst_flowmeter_fe
PRIVATE
$ENV{MIDASSYS}/drivers
)
target_link_libraries(
bronkhorst_flowmeter_fe
bronkhorst_flowmeter
)
endif()
+69
View File
@@ -0,0 +1,69 @@
# Bronkhorst gas flowmeter / flow controller
This repository contains the driver code and Midas frontend for the Bronkhorst
gas flowmeter / flow controller.
## Requirements
Requires a Midas installation with the environment variable `MIDASSYS` pointing
to the built Midas artifacts and headers.
## Build
Clone this repository, enter the cloned directory, and then build via CMake.
```bash
cmake -S "$(pwd)" -B <directory-to-build-in> -DBUILD_FRONTEND=ON
cmake --build <directory-to-build-in> --clean-first -- -j8
```
## Run
```bash
/build/driver/bronkhorst_flowmeter_fe -e flame
```
## Including in Custom Frontend
To include this driver in a custom frontend, you should ensure the environment
variable `MIDASSYS` points to your system install and include a snippet in your
`CMakeLists.txt` similar to the following:
```CMake
# If the path to the bronkhorst_flowmeter repository is outside of the frontend
# repository, you also need to provide a location for the bronkhorst_flowmeter
# artifacts as a second argument to `add_subdirectory`
# e.g. `./device/bronkhorst_flowmeter`
add_subdirectory(
<path-to-bronkhorst_flowmeter-repository>
)
add_executable(
<frontend-name>
<frontend-code-path-1>
<frontend-code-path-2>
:
)
set_property(
TARGET
<frontend-name>
PROPERTY
CXX_STANDARD 11
)
target_include_directories(
<frontend-name>
PRIVATE
$ENV{MIDASSYS}/drivers
$ENV{MIDASSYS}/include
)
target_link_libraries(
<frontend-name>
bronkhorst_flowmeter
<additional-library-1>
<additional-library-2>
:
)
```
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
/********************************************************************\
Name: bronkhorst.h
Created by: Andreas Suter 2003/09/12
Contents: bronkhorst He flowmeter driver
\********************************************************************/
/*---- device driver declaration -----------------------------------*/
/*!
* <p>bronkhorst device driver (DD) for <b>reading</b>. It is handling the communication
* between the bronkhorst mass flow meter and midas.
*/
INT bronkhorst_flowmeter_in(INT cmd, ...);
/*!
* <p> bronkhorst device driver (DD) for <b>setting values</b>. It is handling the
* communication between the bronkhorst mass flow meter and midas.
*/
INT bronkhorst_flowmeter_out(INT cmd, ...);
+164
View File
@@ -0,0 +1,164 @@
/********************************************************************\
Name: BRONKHGFC_gfclowc0.c (modified bronkhorst_test.c of SA35)
Created by: Andreas Suter
Contents: Midas frontend to readout/set the Bronkhorst gas flow
controller.
$Log: BRONKHGFC_gfcflowc0.c,v $
Revision 1.3 2024/06/30 09:38:01 raselli
New version setting flow [l/min] instead of scaled DAC
Revision 1.2 2023/07/11 14:17:18 raselli
Increased number of Input channels
Revision 1.1 2022/11/15 13:34:09 raselli
Adapted version of Bronkhorst flow controller originally from LEM (A. Suter)
Revision 1.3 2004/05/11 15:54:22 nemu
adopted to new CVS structure
Revision 1.2 2003/10/01 08:53:23 nemu
adopted to the changes in the bronkhorst device driver
Revision 1.1 2003/09/15 10:16:26 nemu
add bronkhorst test slowcontrol frontend files
\********************************************************************/
#include <stdio.h>
#include "midas.h"
#include "class/multi.h"
#include "bronkhorst_flowmeter.h"
#include "bus/tcpip.h"
/*-- Globals -------------------------------------------------------*/
/* The frontend name (client name) as seen by other MIDAS clients */
char *frontend_name = "BRONKHGFC gfcflowc0";
/* The frontend file name, don't change it */
char *frontend_file_name = __FILE__;
/* frontend_loop is called periodically if this variable is TRUE */
BOOL frontend_call_loop = FALSE;
/* a frontend status page is displayed with this frequency in ms */
INT display_period = 1000;
/* maximum event size produced by this frontend */
INT max_event_size = 10000;
/* maximum event size for fragmented events (EQ_FRAGMENTED) */
INT max_event_size_frag = 5*1024*1024;
/* buffer size to hold events */
INT event_buffer_size = 10*10000;
extern BOOL should_exit;
/*!
* equipment_common_overwrite:
*
* - If that flag is TRUE, then the contents of the "equipment" structure is
* copied to the ODB on each start of the front-end.
*
* - If the flag is FALSE, then the ODB values are kept on the start of the
* front-end
*/
BOOL equipment_common_overwrite = FALSE;
/*-- Equipment list ------------------------------------------------*/
/* device driver list */
DEVICE_DRIVER bh_driver[] = {
{ "BHFCin", bronkhorst_flowmeter_in, 7, tcpip, DF_INPUT },
{ "BHFCout", bronkhorst_flowmeter_out, 2, tcpip, DF_OUTPUT },
{ "" }
};
EQUIPMENT equipment[] = {
{ "gfcflowc0", /* equipment name */
{212, 0, /* event ID, trigger mask */
"SYSTEM", /* event buffer */
EQ_SLOW, /* equipment type */
0, /* event source */
"FIXED", /* format */
TRUE, /* enabled */
RO_RUNNING |
RO_TRANSITIONS, /* read when running and on transitions */
30000, /* read every 30 sec */
0, /* stop run after this event limit */
0, /* number of sub events */
1, /* log history every event */
"", "", ""},
cd_multi_read, /* readout routine */
cd_multi, /* class driver main routine */
bh_driver, /* device driver list */
NULL, /* init string */
},
{ "" }
};
/*-- Dummy routines ------------------------------------------------*/
INT poll_event(INT source, INT count, BOOL test) {return 1;};
INT interrupt_configure(INT cmd, INT source, PTYPE adr) {return 1;};
/*-- Frontend Init -------------------------------------------------*/
INT frontend_init()
{
return CM_SUCCESS;
}
/*-- Frontend Exit -------------------------------------------------*/
INT frontend_exit()
{
return CM_SUCCESS;
}
/*-- Frontend Loop -------------------------------------------------*/
INT frontend_loop()
{
return CM_SUCCESS;
}
/*-- Begin of Run --------------------------------------------------*/
INT begin_of_run(INT run_number, char *error)
{
return CM_SUCCESS;
}
/*-- End of Run ----------------------------------------------------*/
INT end_of_run(INT run_number, char *error)
{
return CM_SUCCESS;
}
/*-- Pause Run -----------------------------------------------------*/
INT pause_run(INT run_number, char *error)
{
return CM_SUCCESS;
}
/*-- Resuem Run ----------------------------------------------------*/
INT resume_run(INT run_number, char *error)
{
return CM_SUCCESS;
}
/*------------------------------------------------------------------*/