RocketLogger  2.0.1
meter.c File Reference
#include <stdint.h>
#include <ncurses.h>
#include "pru.h"
#include "rl.h"
#include "util.h"
#include "meter.h"
+ Include dependency graph for meter.c:

Go to the source code of this file.

Functions

void meter_init (void)
 
void meter_deinit (void)
 
void meter_print_buffer (int32_t const *analog_buffer, uint32_t const *digital_buffer, size_t buffer_size, rl_timestamp_t const *const timestamp_realtime, rl_timestamp_t const *const timestamp_monotonic, rl_config_t const *const config)
 

Variables

char const *const RL_CHANNEL_UNITS [RL_CHANNEL_COUNT]
 Analog channel units. More...
 
double const RL_CHANNEL_SCALES [RL_CHANNEL_COUNT]
 Analog channel scales. More...
 
uint32_t const DIGITAL_INPUT_BITS [RL_CHANNEL_DIGITAL_COUNT]
 Digital input bit location in binary data. More...
 

Function Documentation

◆ meter_deinit()

void meter_deinit ( void  )

Deinitialize interactive console window.

Definition at line 66 of file meter.c.

Referenced by pru_sample().

◆ meter_init()

void meter_init ( void  )

Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Initialize interactive console window.

Definition at line 56 of file meter.c.

Referenced by pru_sample().

◆ meter_print_buffer()

void meter_print_buffer ( int32_t const *  analog_buffer,
uint32_t const *  digital_buffer,
size_t  buffer_size,
rl_timestamp_t const *const  timestamp_realtime,
rl_timestamp_t const *const  timestamp_monotonic,
rl_config_t const *const  config 
)

Print data buffer in interactive console window.

Parameters
analog_bufferAnalog data buffer to process
digital_bufferDigital data buffer to process
buffer_sizeNumber of samples in the buffer
timestamp_realtimeTimestamp sampled from realtime clock
timestamp_monotonicTimestamp sampled from monotonic clock
configCurrent measurement configuration

Definition at line 68 of file meter.c.

References rl_config::aggregation_mode, rl_config::digital_enable, DIGITAL_INPUT_BITS, is_current(), rl_timestamp::nsec, PRU_DIGITAL_I1L_VALID_MASK, PRU_DIGITAL_I2L_VALID_MASK, RL_AGGREGATION_MODE_AVERAGE, RL_AGGREGATION_MODE_DOWNSAMPLE, RL_CHANNEL_COUNT, RL_CHANNEL_DIGITAL_NAMES, RL_CHANNEL_NAMES, RL_CHANNEL_SCALES, RL_CHANNEL_UNITS, and rl_timestamp::sec.

Referenced by pru_sample().

+ Here is the call graph for this function:

Variable Documentation

◆ DIGITAL_INPUT_BITS

uint32_t const DIGITAL_INPUT_BITS[RL_CHANNEL_DIGITAL_COUNT]
Initial value:
= {
#define PRU_DIGITAL_INPUT1_MASK
Definition: pru.h:54
#define PRU_DIGITAL_INPUT5_MASK
Definition: pru.h:58
#define PRU_DIGITAL_INPUT3_MASK
Definition: pru.h:56
#define PRU_DIGITAL_INPUT6_MASK
Definition: pru.h:59
#define PRU_DIGITAL_INPUT4_MASK
Definition: pru.h:57
#define PRU_DIGITAL_INPUT2_MASK
Definition: pru.h:55

Digital input bit location in binary data.

Definition at line 52 of file meter.c.

Referenced by meter_print_buffer().

◆ RL_CHANNEL_SCALES

double const RL_CHANNEL_SCALES[RL_CHANNEL_COUNT]
Initial value:
= {
100000000, 100000000, 100000000, 100000000, 100000,
1000000, 100000, 1000000, 1000000}

Analog channel scales.

Definition at line 47 of file meter.c.

Referenced by meter_print_buffer().

◆ RL_CHANNEL_UNITS

char const* const RL_CHANNEL_UNITS[RL_CHANNEL_COUNT]
Initial value:
= {
"V", "V", "V", "V", "uA", "mA", "uA", "mA", "ms"}

Analog channel units.

Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 43 of file meter.c.

Referenced by meter_print_buffer().