Dokuwiki/GeSHi Doxycode
The following example shows some C code from our custom library. Unfortunately the doxygen instance is not publicly available.
test.c
#include "canopen_dictionary.h"
 
 
/**
 * @brief Intialize the configuration and check that no error is in the OD.
 * 
 */
void test_demo_init() {
    CANopenDictionary_enum_errors error = CANOPEN_DICTIONARY_LIB_ERROR_NONE;
 
    size_t length = sizeof(dictionary_storage)/sizeof(dictionary_storage[0]);
    error = canopen_dictionary_init(&col_conf,dictionary_storage,length);
 
    if(error != CANOPEN_DICTIONARY_LIB_ERROR_NONE) {
        // error handling
        TEST_FAIL_MESSAGE("library could not be initialized!");
    }
 
    error = canopen_dictionary_registerCallbackFind(&col_conf,CANOPEN_IDX_LOW_NUMBER_001,CANOPEN_SUBIDX_LOW_NUMBER_001,&write_callback);
 
    TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");
}
test.c
#include "canopen_dictionary.h"
 
 
/**
 * @brief Intialize the configuration and check that no error is in the OD.
 * 
 */
void test_demo_init() {
    CANopenDictionary_enum_errors error = CANOPEN_DICTIONARY_LIB_ERROR_NONE;
 
    size_t length = sizeof(dictionary_storage)/sizeof(dictionary_storage[0]);
    error = canopen_dictionary_init(&col_conf,dictionary_storage,length);
 
    if(error != CANOPEN_DICTIONARY_LIB_ERROR_NONE) {
        // error handling
        TEST_FAIL_MESSAGE("library could not be initialized!");
    }
 
    error = canopen_dictionary_registerCallbackFind(&col_conf,CANOPEN_IDX_LOW_NUMBER_001,CANOPEN_SUBIDX_LOW_NUMBER_001,&write_callback);
 
    TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");
}
Here the same example - but with linenumbers enabled. The doxycode code snippet uses the same XML cache file as the example above.
test2.c
  1. #include "canopen_dictionary.h"
  2.  
  3.  
  4. /**
  5.  * @brief Intialize the configuration and check that no error is in the OD.
  6.  *
  7.  */
  8. void test_demo_init() {
  9. CANopenDictionary_enum_errors error = CANOPEN_DICTIONARY_LIB_ERROR_NONE;
  10.  
  11. size_t length = sizeof(dictionary_storage)/sizeof(dictionary_storage[0]);
  12. error = canopen_dictionary_init(&col_conf,dictionary_storage,length);
  13.  
  14. if(error != CANOPEN_DICTIONARY_LIB_ERROR_NONE) {
  15. // error handling
  16. TEST_FAIL_MESSAGE("library could not be initialized!");
  17. }
  18.  
  19. error = canopen_dictionary_registerCallbackFind(&col_conf,CANOPEN_IDX_LOW_NUMBER_001,CANOPEN_SUBIDX_LOW_NUMBER_001,&write_callback);
  20.  
  21. TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");
  22. }
test2.c
  1. /**
  2. * @brief Intialize the configuration and check that no error is in the OD.
  3. *
  4. */
  5. size_t length = sizeof(dictionary_storage)/sizeof(dictionary_storage[0]);
  6. error = canopen_dictionary_init(&col_conf,dictionary_storage,length);
  7. // error handling
  8. TEST_FAIL_MESSAGE("library could not be initialized!");
  9. }
  10. error = canopen_dictionary_registerCallbackFind(&col_conf,CANOPEN_IDX_LOW_NUMBER_001,CANOPEN_SUBIDX_LOW_NUMBER_001,&write_callback);
  11. TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");
  12. }

The following example is taken from https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html.
The tag file from https://docs.opencv.org/4.8.0/opencv.tag is used for referencing the documentation.
Building the snippet through the task runner is enabled globally for the tag file.

#include <opencv2/aruco.hpp>
cv::VideoCapture inputVideo;
inputVideo.open(0);
cv::aruco::DetectorParameters detectorParams = cv::aruco::DetectorParameters();
cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250);
cv::aruco::ArucoDetector detector(dictionary, detectorParams);
 
while (inputVideo.grab()) {
    cv::Mat image, imageCopy;
    inputVideo.retrieve(image);
    image.copyTo(imageCopy);
    std::vector<int> ids;
    std::vector<std::vector<cv::Point2f>> corners, rejected;
    detector.detectMarkers(image, corners, ids, rejected);
    // if at least one marker detected
    if (ids.size() > 0)
        cv::aruco::drawDetectedMarkers(imageCopy, corners, ids);
    cv::imshow("out", imageCopy);
    char key = (char) cv::waitKey(waitTime);
    if (key == 27)
        break;
}
#include <opencv2/aruco.hpp>
cv::VideoCapture inputVideo;
inputVideo.open(0);
cv::aruco::DetectorParameters detectorParams = cv::aruco::DetectorParameters();
cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250);
cv::aruco::ArucoDetector detector(dictionary, detectorParams);

while (inputVideo.grab()) {
    cv::Mat image, imageCopy;
    inputVideo.retrieve(image);
    image.copyTo(imageCopy);
    std::vector ids;
    std::vector> corners, rejected;
    detector.detectMarkers(image, corners, ids, rejected);
    // if at least one marker detected
    if (ids.size() > 0)
        cv::aruco::drawDetectedMarkers(imageCopy, corners, ids);
    cv::imshow("out", imageCopy);
    char key = (char) cv::waitKey(waitTime);
    if (key == 27)
        break;
}
QR Code
QR Code playground:doxycode (generated for current page)