MotionLib  1.0.0
SamBuCa motion library
MFEPlatformData.hpp
1 /*
2 ** Copyright (C) 2023 CERN
3 **
4 ** This software is provided 'as-is', without any express or implied
5 ** warranty. In no event will the authors be held liable for any damages
6 ** arising from the use of this software.
7 **
8 ** Permission is granted to anyone to use this software for any purpose,
9 ** including commercial applications, and to alter it and redistribute it
10 ** freely, subject to the following restrictions:
11 **
12 ** 1. The origin of this software must not be misrepresented; you must not
13 ** claim that you wrote the original software. If you use this software
14 ** in a product, an acknowledgment in the product documentation would be
15 ** appreciated but is not required.
16 ** 2. Altered source versions must be plainly marked as such, and must not be
17 ** misrepresented as being the original software.
18 ** 3. This notice may not be removed or altered from any source distribution.
19 **
20 ** Created on: 2023-06-19T10:10:32
21 ** Author: Sylvain Fargier <sylvain.fargier@cern.ch>
22 */
23 
24 #ifndef MFEPLATFORMDATA_HPP__
25 #define MFEPLATFORMDATA_HPP__
26 
27 #if !defined(GCC_LINT)
28 #pragma once
29 #endif
30 
31 #include "MFEPlatform.hpp"
32 #include "device/AxisPositionMonitor.hpp"
33 #include "util/edge/EdgeGrblDeviceBase.hpp"
34 #include "util/grbl/GrblTypes.hpp"
35 
36 namespace smc {
37 namespace internal {
44 {
45  explicit RegInfo(struct edge_reg *reg = nullptr,
46  size_t shift = 0,
47  uint32_t mask = 0xFFFFFFFF,
48  size_t size = 32) :
49  reg{reg},
50  shift{shift},
51  mask{mask},
52  size{size}
53  {}
54 
55  struct edge_reg *reg;
56  size_t shift;
57  uint32_t mask;
58  size_t size;
59 };
60 
62 {
63  explicit ResolverInfo(grbl::Axis grblAxis,
64  grbl::SettingId modeSettingId,
65  const units::Value &mode) :
66  grblAxis{grblAxis},
67  modeSettingId{modeSettingId},
68  mode{mode}
69  {}
70 
71  grbl::Axis grblAxis;
72  grbl::SettingId modeSettingId;
75  uint32_t angleReg = 0;
76  uint32_t stepReg = 0;
77  uint32_t diffReg = 0;
78 
79  AxisPositionMonitor::State monitorState = AxisPositionMonitor::State::UNKNOWN;
80 };
81 
83 {
84  explicit Context(const ccut::yml::NodeRef &ref);
85 
86  std::shared_ptr<edge::EdgeGrblDeviceBase> edge;
87  std::map<std::string, RegInfo> registers;
88 
96  bool getRegInfo(const std::string &uid, RegInfo &info) const;
97 };
98 
101 } // namespace internal
102 } // namespace smc
103 
104 #endif
main motion-lib namespace
Definition: Client.cpp:30
bool getRegInfo(const std::string &uid, RegInfo &info) const
Get the RegInfo object.
units::Value mode
mode in steps_per_turn