LCOV - code coverage report
Current view: top level - include/ethercat_master/ethercatcpp/beckhoff_terminals - KL2284.h (source / functions) Hit Total Coverage
Test: ethercatcpp-core_coverage Lines: 0 1 0.0 %
Date: 2026-10-13 18:08:40 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /*      File: KL2284.h
       2             :  *       This file is part of the program ethercatcpp-core
       3             :  *       Program description : EtherCAT driver libraries for UNIX
       4             :  *       Copyright (C) 2017-2024 -  Robin Passama (LIRMM / CNRS) Arnaud Meline
       5             :  * (LIRMM / CNRS) Benjamin Navarro (LIRMM / CNRS). All Right reserved.
       6             :  *
       7             :  *       This software is free software: you can redistribute it and/or modify
       8             :  *       it under the terms of the CeCILL-C license as published by
       9             :  *       the CEA CNRS INRIA, either version 1
      10             :  *       of the License, or (at your option) any later version.
      11             :  *       This software is distributed in the hope that it will be useful,
      12             :  *       but WITHOUT ANY WARRANTY without even the implied warranty of
      13             :  *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      14             :  *       CeCILL-C License for more details.
      15             :  *
      16             :  *       You should have received a copy of the CeCILL-C License
      17             :  *       along with this software. If not, it can be found on the official
      18             :  * website of the CeCILL licenses family (http://www.cecill.info/index.en.html).
      19             :  */
      20             : /**
      21             :  * @file beckhoff_terminals/KL2284.h
      22             :  * @author Robin Passama
      23             :  * @brief EtherCAT driver for beckhoff KL2284 module mounted on a BK1150.
      24             :  * @date February 2020.
      25             :  * @ingroup ethercatcpp-core
      26             :  * @example beckhoff_BK1150_KL2284_example.cpp
      27             :  */
      28             : #pragma once
      29             : 
      30             : #include <ethercatcpp/beckhoff_terminals/KL_extensions.h>
      31             : 
      32             : /*! \namespace ethercatcpp
      33             :  *
      34             :  */
      35             : namespace ethercatcpp {
      36             : 
      37             : /** @brief This class describe the driver for a beckhoff KL2284 device
      38             :  *
      39             :  * @details KL2284 driver allows to communicate with a beckhoff KL2284 module
      40             :  * that can be plugged on a BK1150 ethercat slave in order to communicate
      41             :  * through an EtherCAT bus. The KL2284 is a Hbridge used to control 4 DC motors
      42             :  * with rotation direction switching.
      43             :  * @see BK1150
      44             :  */
      45             : class KL2284 : public KLExtensionCard {
      46             : public:
      47             :     /**
      48             :      * @brief Constructor of KL2284 class
      49             :      */
      50             :     KL2284();
      51             :     /**
      52             :      * @brief Destructor of KL2284 class
      53             :      */
      54           0 :     ~KL2284() = default;
      55             :     /**
      56             :      * @brief Copy Constructor of KL2284 class
      57             :      */
      58             :     KL2284(const KL2284&) = default;
      59             :     /**
      60             :      * @brief Move Constructor of KL2284 class
      61             :      */
      62             :     KL2284(KL2284&&) = default;
      63             :     /**
      64             :      * @brief assignement operator of KL2284 class
      65             :      */
      66             :     KL2284& operator=(const KL2284&) = default;
      67             :     /**
      68             :      * @brief Move assignement operator of KL2284 class
      69             :      */
      70             :     KL2284& operator=(KL2284&&) = default;
      71             : 
      72             :     /**
      73             :      * @brief Defines internal indexes of controllable motors
      74             :      *
      75             :      */
      76             :     enum motor_seletion_t {
      77             :         motor_1 = 0, //!< Motor 1 (A1)
      78             :         motor_2 = 2, //!< Motor 2 (A2)
      79             :         motor_3 = 4, //!< Motor 3 (A3)
      80             :         motor_4 = 6  //!< Motor 4 (A4)
      81             :     };
      82             : 
      83             :     /**
      84             :      * @brief Defines h-bridge state
      85             :      *
      86             :      */
      87             :     enum motor_rotation_t { direct, reverse, stopped, error };
      88             : 
      89             :     /**
      90             :      * @brief Activate a motor in direct or reverse directions
      91             :      * @details The rotation direction depend on connection on device Ax and Ax'
      92             :      * not a standardize clokcwise or trigonometric rotation
      93             :      * @param [in] motor to move (choose in motor_seletion_t)
      94             :      * @param [in] rotation: rotation direction
      95             :      */
      96             :     void control_motor(motor_seletion_t motor, motor_rotation_t rotation);
      97             : 
      98             :     /**
      99             :      * @brief get state of a motor
     100             :      *
     101             :      * @param motor index of the motor (from 0 to 4)
     102             :      * @return motor_rotation_t the direction of rotation for the motor
     103             :      */
     104             :     motor_rotation_t motor_state(motor_seletion_t motor) const;
     105             : 
     106             :     /**
     107             :      * @brief Tell whether the module is a digital or non digital module.
     108             :      * @return always true
     109             :      */
     110             :     bool digital() const final;
     111             : 
     112             : protected:
     113             :     virtual void update_command_buffer();
     114             :     virtual uint16_t size_out();
     115             : 
     116             : private:
     117             :     // Command variable
     118             :     uint8_t command_word_;
     119             : };
     120             : } // namespace ethercatcpp

Generated by: LCOV version 1.14