Commit e551e961 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Add functions to display graph in text mode

parent b8149f2e
# Copyright ETIS — ENSEA, Université de Cergy-Pontoise, CNRS
# Author: Arnaud Blanchard (November 2016)
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cmake_minimum_required(VERSION 2.6)
#The name of the project is the basename of the directory
find_package(blc_channel REQUIRED)
find_package(blc_program REQUIRED)
add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp)
target_link_libraries(${PROJECT_NAME} ${BL_LIBRARIES})
#include "blc_core.h"
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
#include <termios.h>
#include <libgen.h> //basename
int fprint_spikes_uchars(blc_mem *mem, FILE *file, const char *title, int width){
char c;
int i, j;
fprintf(file, "[%s]\n", title);
FOR(j, 8){
FOR(i, mem->size){
c=((1<<j) & mem->uchars[i])?'.':' ';
fputc(c, file);
fputc('\n', file);
return 9;
int main(int argc, char** argv){
blc_channel channel;
char const *period_str;
char const *channel_name, *filename, *time_str;
char const *number_str;
char const *ext;
FILE *file;
int number;
int period;
struct timeval timer;
blc_program_set_description("Display a text graph of blc_channel in the terminal");
blc_program_add_option(&period_str, 'p', "period", "integer", "Period in ms to refresh the graph", "0");
blc_program_add_parameter(&channel_name, "blc_channel-in", 1, "channel to graph", NULL);
blc_program_init(&argc, &argv, blc_quit);
period=strtol(period_str, NULL,10)*1000;, BLC_CHANNEL_READ);
//if (blc_loop_iteration!=0);
fprint_spikes_uchars(&channel, stderr, channel_name, 16);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment