Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
blaar
bapps
Commits
0cb07be7
Commit
0cb07be7
authored
Jul 11, 2019
by
Arnaud Blanchard
Browse files
Add function to display channel in terminal
parent
d6e413bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
o_display/CMakeLists.txt
0 → 100644
View file @
0cb07be7
# Set the minimum version of cmake required to build this project
cmake_minimum_required
(
VERSION 2.6
)
# Set the name of the project as the directory basename
project
(
o_display
)
find_package
(
blc_channel
)
find_package
(
blc_program
)
add_definitions
(
${
BL_DEFINITIONS
}
-std=c++11
)
include_directories
(
${
BL_INCLUDE_DIRS
}
)
add_executable
(
o_display o_display.cpp
)
target_link_libraries
(
o_display
${
BL_LIBRARIES
}
)
o_display/o_display.cpp
0 → 100644
View file @
0cb07be7
//
// Created by Arnaud Blanchard on 22/12/15.
// Copyright ETIS 2015. All rights reserved.
//
#include
"blc_core.h"
#include
"blc_channel.h"
#include
"blc_program.h"
#include
<unistd.h>
#include
<math.h>
int
columns_nb
=
64
;
int
rows_nb
=
16
;
int
main
(
int
argc
,
char
**
argv
){
blc_channel
input
;
char
const
*
channel_name
,
*
period_str
;
int
period
;
blc_program_add_parameter
(
&
channel_name
,
"blc_channel-in"
,
1
,
"channel name"
,
NULL
);
blc_program_add_option
(
&
period_str
,
'p'
,
"period"
,
"integer "
,
"refresh period in ms"
,
"100"
);
//-2 executes one and wait for return
blc_program_init
(
&
argc
,
&
argv
,
blc_quit
);
// period=strtol(period_str, NULL, 10);
SSCANF
(
1
,
period_str
,
"%d"
,
&
period
);
period
*=
1000
;
//convert ms
input
.
open
(
channel_name
,
BLC_CHANNEL_READ
);
blc_loop_try_add_waiting_semaphore
(
input
.
sem_new_data
);
blc_loop_try_add_posting_semaphore
(
input
.
sem_ack_data
);
BLC_COMMAND_LOOP
(
period
){
if
(
blc_loop_iteration
)
blc_eprint_cursor_down
(
rows_nb
);
input
.
fprint_tsv
(
stderr
);
}
return
EXIT_SUCCESS
;
}
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