Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
2d3db21c
Commit
2d3db21c
authored
Dec 15, 2014
by
Jeroen Vreeken
Browse files
Merge branch 'beaglebone' of msi-wl:shared/src/dt_ctrl into beaglebone
parents
073bfe4b
bd366c55
Changes
3
Hide whitespace changes
Inline
Side-by-side
controller/block/block_command_bool.c
0 → 100644
View file @
2d3db21c
/*
Copyright Jeroen Vreeken (jeroen@vreken.net), 2014
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<log/log.h>
#include
<controller/controller_block.h>
//#include <controller/controller_sample.h>
#include
<controller/controller_command.h>
struct
controller_block_private
{
bool
value
;
struct
controller_command
*
command
;
};
static
void
command_calculate
(
struct
controller_block
*
cmd
)
{
struct
controller_block_private
*
priv
=
cmd
->
private
;
struct
command_entry
c_entry
;
if
(
!
controller_command_queue_read
(
priv
->
command
,
&
c_entry
))
{
priv
->
value
=
c_entry
.
value
.
b
;
}
}
static
struct
controller_block_outterm_list
outterms
[]
=
{
{
"value"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
value
)
},
{
NULL
},
};
struct
controller_block
*
block_command_bool_create
(
char
*
name
)
{
struct
controller_block
*
cmd
;
if
(
!
(
cmd
=
controller_block_alloc
(
"command_bool"
,
name
,
sizeof
(
struct
controller_block_private
))))
return
NULL
;
cmd
->
private
->
value
=
false
;
if
(
controller_block_outterm_list_init
(
cmd
,
outterms
))
goto
err_block
;
cmd
->
calculate
=
command_calculate
;
controller_block_add
(
cmd
);
cmd
->
private
->
command
=
controller_command_create
(
cmd
,
name
,
"Boolean"
);
cmd
->
private
->
command
->
value_type
=
COMMAND_VALUE_TYPE_BOOL
;
cmd
->
private
->
command
->
command_types
[
0
]
=
COMMAND_PTYPE_SETPOINT
;
return
cmd
;
err_block:
controller_block_free
(
cmd
);
return
NULL
;
}
controller/block/build.mk
View file @
2d3db21c
...
...
@@ -6,6 +6,7 @@ $(eval $(call SUBDIR,il2c))
BLOCKS
:=
\
add
\
bridge_pwm
\
command_bool
\
counter
\
debug
\
decoder_uint32_bool
\
...
...
controller/dt_ctrl.ctrl
View file @
2d3db21c
...
...
@@ -77,6 +77,9 @@ blocks {
{ "add", "elevation_position_offset_r_sum" }
{ "add", "elevation_position_offset_l_sum" }
{ "command_bool", "focusbox_plus" }
{ "command_bool", "focusbox_min" }
{ "value_bool", "false" }
}
...
...
@@ -168,8 +171,8 @@ links {
{ "elevation_safety", "torque_out_l","dt_el_l", "torque" , true }
{ "elevation_servo_state", "enable", "dt_el_r", "enable" , true }
{ "elevation_servo_state", "enable", "dt_el_l", "enable" , true }
{ "f
alse",
"value", "dt_el_r", "ba1" , true }
{ "f
alse
",
"value", "dt_el_r", "ba2" , true }
{ "f
ocusbox_plus",
"value", "dt_el_r", "ba1" , true }
{ "f
ocusbox_min
", "value", "dt_el_r", "ba2" , true }
{ "false", "value", "dt_el_l", "ba1" , true }
{ "false", "value", "dt_el_l", "ba2" , true }
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment