mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 18:10:40 +02:00
Merge pull request #180 from slsdetectorgroup/serverdoc
Adding auto generated server default #define in documentation
This commit is contained in:
commit
b12ae5d929
@ -38,6 +38,7 @@ set(SPHINX_SOURCE_FILES
|
|||||||
src/pydetector.rst
|
src/pydetector.rst
|
||||||
src/pyenums.rst
|
src/pyenums.rst
|
||||||
src/pyexamples.rst
|
src/pyexamples.rst
|
||||||
|
src/servers.rst
|
||||||
src/receiver.rst
|
src/receiver.rst
|
||||||
src/result.rst
|
src/result.rst
|
||||||
src/type_traits.rst
|
src/type_traits.rst
|
||||||
@ -57,8 +58,21 @@ configure_file(
|
|||||||
"${SPHINX_BUILD}/conf.py"
|
"${SPHINX_BUILD}/conf.py"
|
||||||
@ONLY)
|
@ONLY)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/gen_server_doc.py.in"
|
||||||
|
"${SPHINX_BUILD}/gen_server_doc.py"
|
||||||
|
@ONLY)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/static/extra.css"
|
||||||
|
"${SPHINX_BUILD}/static/css/extra.css"
|
||||||
|
@ONLY)
|
||||||
|
|
||||||
|
add_custom_target(server_rst python gen_server_doc.py)
|
||||||
|
|
||||||
add_custom_target(docs
|
add_custom_target(docs
|
||||||
gendoc
|
gendoc
|
||||||
|
COMMAND python gen_server_doc.py
|
||||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
||||||
COMMAND ${SPHINX_EXECUTABLE} -a -b html
|
COMMAND ${SPHINX_EXECUTABLE} -a -b html
|
||||||
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
|
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
|
||||||
@ -74,3 +88,4 @@ add_custom_target(rst
|
|||||||
${SPHINX_BUILD}/src
|
${SPHINX_BUILD}/src
|
||||||
${SPHINX_BUILD}/html
|
${SPHINX_BUILD}/html
|
||||||
COMMENT "Generating documentation with Sphinx")
|
COMMENT "Generating documentation with Sphinx")
|
||||||
|
|
||||||
|
@ -59,4 +59,8 @@ html_theme = "sphinx_rtd_theme"
|
|||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
#html_static_path = ['_static']
|
html_static_path = ['static']
|
||||||
|
|
||||||
|
|
||||||
|
def setup(app):
|
||||||
|
app.add_stylesheet('css/extra.css') # may also be an URL
|
53
docs/gen_server_doc.py.in
Normal file
53
docs/gen_server_doc.py.in
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import os
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# @CMAKE_CURRENT_BINARY_DIR@
|
||||||
|
|
||||||
|
print('\n\n\n\n SERVER CSV')
|
||||||
|
|
||||||
|
src = Path('@CMAKE_SOURCE_DIR@')/'slsDetectorServers/'
|
||||||
|
detectors = ['Mythen3', 'Gotthard2', 'Eiger',
|
||||||
|
'Jungfrau', 'Moench', 'Gotthard', 'Ctb']
|
||||||
|
|
||||||
|
|
||||||
|
for det in detectors:
|
||||||
|
in_fname = src/f'{det.lower()}DetectorServer/slsDetectorServer_defs.h'
|
||||||
|
print(f'Reading: {in_fname}')
|
||||||
|
with open(in_fname) as f:
|
||||||
|
lines = f.read().replace('\\\n', '')
|
||||||
|
lines = lines.splitlines(keepends = True)
|
||||||
|
|
||||||
|
lines = [l.strip('#define').strip(' ') for l in lines if l.startswith('#define')]
|
||||||
|
output = []
|
||||||
|
signals = []
|
||||||
|
fields = ['Name,', 'Value', 'Comment']
|
||||||
|
excluded = ['DAC_NAMES', 'DEFAULT_DAC_VALS', 'CLK_NAMES', 'ONCHIP_DAC_NAMES']
|
||||||
|
header = f'{fields[0]:35}{fields[1]:35}\n'
|
||||||
|
output.append(header)
|
||||||
|
signals.append(header)
|
||||||
|
for line in lines:
|
||||||
|
name, *parts = line.split()
|
||||||
|
arg = ' '.join(parts)
|
||||||
|
value, *comments = arg.split('//')
|
||||||
|
value = value.strip('() ')
|
||||||
|
# value = value.replace(', ', ' ')
|
||||||
|
value = value.replace('\"', '')
|
||||||
|
if name not in excluded:
|
||||||
|
name += ','
|
||||||
|
if name.startswith('SIGNAL_'):
|
||||||
|
signals.append(f'{name:35}{value}\n')
|
||||||
|
else:
|
||||||
|
output.append(f'{name:35}\"{value}\"\n')
|
||||||
|
|
||||||
|
|
||||||
|
rstpath = Path('@CMAKE_SOURCE_DIR@')/'docs/src/'
|
||||||
|
|
||||||
|
out_fname = Path.cwd()/f'src/{det.lower()}.csv'
|
||||||
|
print(f'Writing: {out_fname}')
|
||||||
|
with open(out_fname, 'w') as f:
|
||||||
|
f.writelines(output)
|
||||||
|
|
||||||
|
print('END\n\n\n\n')
|
@ -50,6 +50,11 @@ Welcome to slsDetectorPackage's documentation!
|
|||||||
type_traits
|
type_traits
|
||||||
ToString
|
ToString
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:caption: Servers
|
||||||
|
|
||||||
|
servers
|
||||||
|
|
||||||
.. Indices and tables
|
.. Indices and tables
|
||||||
.. ==================
|
.. ==================
|
||||||
|
|
||||||
|
60
docs/src/servers.rst
Normal file
60
docs/src/servers.rst
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
Default values
|
||||||
|
==============================================
|
||||||
|
|
||||||
|
Some general intro
|
||||||
|
|
||||||
|
Mythen3
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. csv-table:: Default values
|
||||||
|
:file: mythen3.csv
|
||||||
|
:widths: 35, 35
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
Gotthard2
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. csv-table:: Default values
|
||||||
|
:file: gotthard2.csv
|
||||||
|
:widths: 35, 35
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
Moench
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. csv-table:: Default values
|
||||||
|
:file: moench.csv
|
||||||
|
:widths: 35, 35
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
Ctb
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. csv-table:: Default values
|
||||||
|
:file: ctb.csv
|
||||||
|
:widths: 35, 35
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
Eiger
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. csv-table:: Default values
|
||||||
|
:file: eiger.csv
|
||||||
|
:widths: 35, 35
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
Jungfrau
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. csv-table:: Default values
|
||||||
|
:file: jungfrau.csv
|
||||||
|
:widths: 35, 35
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
Gotthard
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. csv-table:: Default values
|
||||||
|
:file: gotthard.csv
|
||||||
|
:widths: 35, 35
|
||||||
|
:header-rows: 1
|
4
docs/static/extra.css
vendored
Normal file
4
docs/static/extra.css
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/* override table no-wrap */
|
||||||
|
.wy-table-responsive table td, .wy-table-responsive table th {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
@ -95,7 +95,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
|
|||||||
#define NDAC_ONLY (NDAC - NPWR)
|
#define NDAC_ONLY (NDAC - NPWR)
|
||||||
#define DYNAMIC_RANGE (16)
|
#define DYNAMIC_RANGE (16)
|
||||||
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||||
#define CLK_FREQ (156.25) /* MHz */
|
#define CLK_FREQ (156.25) // MHz
|
||||||
#define I2C_POWER_VIO_DEVICE_ID (0x40)
|
#define I2C_POWER_VIO_DEVICE_ID (0x40)
|
||||||
#define I2C_POWER_VA_DEVICE_ID (0x41)
|
#define I2C_POWER_VA_DEVICE_ID (0x41)
|
||||||
#define I2C_POWER_VB_DEVICE_ID (0x42)
|
#define I2C_POWER_VB_DEVICE_ID (0x42)
|
||||||
|
@ -130,7 +130,7 @@ enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
|
|||||||
#define DAC_MAX_STEPS (4096)
|
#define DAC_MAX_STEPS (4096)
|
||||||
|
|
||||||
#define MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS \
|
#define MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS \
|
||||||
(0x1FFFFFFF) /** 29 bit register for max subframe exposure value */
|
(0x1FFFFFFF) // 29 bit register for max subframe exposure value
|
||||||
|
|
||||||
#define SLAVE_HIGH_VOLTAGE_READ_VAL (-999)
|
#define SLAVE_HIGH_VOLTAGE_READ_VAL (-999)
|
||||||
#define HIGH_VOLTAGE_TOLERANCE (5)
|
#define HIGH_VOLTAGE_TOLERANCE (5)
|
||||||
|
@ -41,7 +41,7 @@ enum CLKINDEX { ADC_CLK, NUM_CLOCKS };
|
|||||||
#define DYNAMIC_RANGE (16)
|
#define DYNAMIC_RANGE (16)
|
||||||
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
|
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
|
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
|
||||||
#define CLK_FREQ (32007729) /* Hz */
|
#define CLK_FREQ (32007729) // Hz
|
||||||
#define MAX_EXT_SIGNALS (1)
|
#define MAX_EXT_SIGNALS (1)
|
||||||
|
|
||||||
/** Firmware Definitions */
|
/** Firmware Definitions */
|
||||||
|
@ -69,8 +69,8 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
|||||||
#define DYNAMIC_RANGE (16)
|
#define DYNAMIC_RANGE (16)
|
||||||
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL)
|
#define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL)
|
||||||
#define CLK_RUN (40) /* MHz */
|
#define CLK_RUN (40) // MHz
|
||||||
#define CLK_SYNC (20) /* MHz */
|
#define CLK_SYNC (20) // MHz
|
||||||
#define ADC_CLK_INDEX (1)
|
#define ADC_CLK_INDEX (1)
|
||||||
#define DBIT_CLK_INDEX (0)
|
#define DBIT_CLK_INDEX (0)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user