diff --git a/CMakeLists.txt b/CMakeLists.txt index 481cb3d50913ef8bca5ae0dbfcad55a960559b96..0c45cd6ce9608b461d0f95320bd38c7d0ccfcc26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ target_link_libraries(${PROJECT_NAME} ${LIBUSB_LIBRARIES}) target_include_directories(${PROJECT_NAME} PUBLIC ${LIBUSB_INCLUDE_DIRS}) add_definitions("-std=c17 -Wall -O2 -fno-strict-aliasing") install(TARGETS ${PROJECT_NAME} DESTINATION lib) -install(FILES ./coincellhell.c DESTINATION include) +install(FILES ./coincellhell/coincellhell.h ./coincellhell/usbcommands.h DESTINATION include/${PROJECT_NAME}) link_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(${PROJECT_NAME}_cli main.c) @@ -36,12 +36,12 @@ target_link_libraries( ${PROJECT_NAME}_cli ${PROJECT_NAME}) add_definitions("-std=c17 -Wall -O2 -fno-strict-aliasing") install(TARGETS ${PROJECT_NAME}_cli DESTINATION bin) -configure_file(pkgconfig/eismuliplexer.pc.in pkgconfig/eismuliplexer.pc @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/eismuliplexer.pc DESTINATION lib/pkgconfig) +configure_file(pkgconfig/libcoincellhell.pc.in pkgconfig/libcoincellhell.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libcoincellhell.pc DESTINATION lib/pkgconfig) if (DOXYGEN_FOUND) - set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/libeismulitplexer.doxygen.in) - set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/doc/libeismulitplexer.doxygen) + set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/libcoincellhell.doxygen.in) + set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/doc/libcoincellhell.doxygen) configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) message("Doxygen build started") diff --git a/coincellhell.c b/coincellhell.c index 62d61cfb57c4f373cbe9bf19ba6ef0742cb3f1f2..0701e007ec5130fb9b1d9b6cf68dd8a75d30f073 100644 --- a/coincellhell.c +++ b/coincellhell.c @@ -33,7 +33,7 @@ #include <stdio.h> #include <assert.h> -#include "coincellhell.h" +#include "coincellhell/coincellhell.h" #include "usbshm.h" #include "usbcommands.h" diff --git a/coincellhell.h b/coincellhell/coincellhell.h similarity index 90% rename from coincellhell.h rename to coincellhell/coincellhell.h index 061ab157ed4fb01d295abfad80c5b308ac6791f2..698a5f04a68c2c740763858a8059e7a73bc097c2 100644 --- a/coincellhell.h +++ b/coincellhell/coincellhell.h @@ -51,15 +51,24 @@ struct coincellhell struct heater_state { + /** true if heater is enabled*/ bool enabled; + /** true if heater is close to its setpoint*/ bool ready; + /** true if heater is currently exectueting a ramp*/ bool ramp; + /** true if the system has detected a fault with this heater*/ bool fault; + /** current command (0-255) that is being sent to the dac for this heater*/ uint8_t dacCommand; + /** current target temperature for this heater*/ float setpoint; + /** if a ramp is currently being executed, its final temperature will be set here*/ float rampTarget; + /** if a ramp is currently being executed, the unix timestamp at which it was started*/ time_t rampStartTime; + /** if a ramp is currently being executed, the unix timestamp at it will complete*/ time_t rampStopTime; }; diff --git a/usbcommands.h b/coincellhell/usbcommands.h similarity index 78% rename from usbcommands.h rename to coincellhell/usbcommands.h index 6695cb1670435fdb11e079fb4415b28bdb9fe1d7..6bced32ec696d02bb39f8bbdbb20dddae04ee0da 100644 --- a/usbcommands.h +++ b/coincellhell/usbcommands.h @@ -1,5 +1,12 @@ #pragma once +/** +Api to controll EISmultiplexer devices. +* @addtogroup API User API +* This api allows you to controll the EISmultiplexer device. +* @{ +*/ + typedef enum { COMMAND_LED_ON = 0, COMMAND_LED_OFF, @@ -23,3 +30,7 @@ typedef enum { TEMP_LOCATION_SIDE, TEMP_LOCATION_INVALID, } temperature_sensor_location_t; + +/* +* @} +*/ diff --git a/usbshm.c b/usbshm.c index 5b329f0a5eb67b558fc92d1c1716cefdfa18623e..42ed24866c1c31b0eded03384bb58ac5a5428ba0 100644 --- a/usbshm.c +++ b/usbshm.c @@ -234,7 +234,8 @@ int usbshm_readControlTransfer(struct usbshm* instance, const uint8_t request, c libusb_fill_control_setup(instance->priv->buffer, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, request, wValue, wIndex, length); instance->priv->transfer = libusb_alloc_transfer(0); - libusb_fill_control_transfer(instance->priv->transfer, instance->priv->handle, instance->priv->buffer, &usbshm_transferCallBack, instance, 100); + libusb_fill_control_transfer(instance->priv->transfer, instance->priv->handle, instance->priv->buffer, + &usbshm_transferCallBack, instance, 100); int ret = libusb_submit_transfer(instance->priv->transfer); pthread_mutex_unlock(libusbDataMutex); if(ret < 0)