E1.3 0-10V support
This commit is contained in:
parent
3ef5e0498b
commit
2c72607dc3
|
@ -41,7 +41,7 @@ may not be inherited from sibling `PDU` in the data.
|
|||
|
||||
| Protocol Name | Standard | Implementation Status |
|
||||
| :- | :-: | :-: |
|
||||
| 0 to 10 V Analog Control | E1.3 | |
|
||||
| 0 to 10 V Analog Control | E1.3 | ✓ |
|
||||
| USITT DMX512-A | E1.11 | Data Abstraction |
|
||||
| ACN Root Layer Protocol (RLP) | E1.17 | ✓ |
|
||||
| ACN Session Data Transport Protocol (SDT) | E1.17 | i/o |
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# E1.3
|
||||
add_subdirectory(analog)
|
||||
# E1.11
|
||||
add_subdirectory(dmx)
|
||||
# E1.17
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
@String{ESTA.org = "Entertainment Services and Technology Association"}
|
||||
|
||||
@manual{ANALOG,
|
||||
key = "Analog 0-10v",
|
||||
title = "ANSI E1.3 - 2001 (R2016),
|
||||
Entertainment Technology—Lighting Control Systems
|
||||
- 0 to 10 V Analog Control Specification",
|
||||
organization = ESTA.org,
|
||||
year = 2016,
|
||||
address = "New York City",
|
||||
note = "CP/1997-1003r11"
|
||||
}
|
||||
|
||||
|
||||
@manual{DMX,
|
||||
key = "DMX",
|
||||
title = "American National Standard ANSI E1.11 – 2008 (R2018)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
project(${PROJECT_NAME}_analog VERSION 0.3.1 LANGUAGES CXX)
|
||||
|
||||
add_library(${PROJECT_NAME} INTERFACE)
|
||||
|
||||
target_sources(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
receiver.h
|
||||
transmitter.h
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} INTERFACE ${PROJECT_NAME}_LIBRARY)
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
receiver.h
|
||||
|
||||
Copyright (c) 2023 Kevin Matz (kevin.matz@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace ANALOG {
|
||||
|
||||
/**
|
||||
* @brief A single-channel 0-10V receiver.
|
||||
*/
|
||||
struct Receiver
|
||||
{
|
||||
/**
|
||||
* \cite ANALOG 6.2.1 Amplitude (Receiver)
|
||||
* The dimmer or other receiving device shall be at “zero” (its specified minimum state,
|
||||
* position, speed, etc.) with any control signal below 0.3 volts. The dimmer or other
|
||||
* receiving device shall be at “full” (its specified maximum state, position, speed, etc.)
|
||||
* with any control signal above 9.8 volts.
|
||||
*/
|
||||
const int16_t zero = 300; //!< upper "Zero" threshold as mV, 0.3 V
|
||||
const int16_t full = 9800; //!< lower "Full" threshold as mV, 9.8 V
|
||||
|
||||
/**
|
||||
* @brief Convert millivolts to an 8-bit level.
|
||||
* @param mV
|
||||
* @return
|
||||
*/
|
||||
uint8_t level(const int16_t mV) const
|
||||
{
|
||||
if (mV <= zero)
|
||||
return 0;
|
||||
else if ( mV >= full)
|
||||
return UINT8_MAX;
|
||||
else
|
||||
return (mV - zero) / (full - zero);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ANALOG
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
transmitter.h
|
||||
|
||||
Copyright (c) 2023 Kevin Matz (kevin.matz@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace ANALOG {
|
||||
|
||||
/**
|
||||
* @brief A single-channel 0-10V controller.
|
||||
*/
|
||||
struct Transmitter
|
||||
{
|
||||
/**
|
||||
* \cite ANALOG 6.1.1 Amplitude (Transmitter)
|
||||
* Zero volts shall represent the full off condition and ten volts shall represent the
|
||||
* full on condition.
|
||||
*/
|
||||
const int16_t zero = 0; //!< mV, 0.0 V
|
||||
const int16_t full = 10000; //!< mV, 10.0 V
|
||||
|
||||
/**
|
||||
* @brief Convert an 8-bit level to millivolts.
|
||||
* @param level
|
||||
* @return
|
||||
*/
|
||||
int16_t millivolts(uint8_t level) const {
|
||||
return full * (level / UINT8_MAX);
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace ANALOG
|
Loading…
Reference in New Issue