Skip to content
Snippets Groups Projects
Commit 1ffba79e authored by Sergey Musikhin's avatar Sergey Musikhin
Browse files

show power in form

parent a612e8e8
Branches
No related tags found
No related merge requests found
...@@ -41,7 +41,7 @@ blocks: ...@@ -41,7 +41,7 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [312, 4.0] coordinate: [280, 12.0]
rotation: 0 rotation: 0
state: true state: true
- name: freq - name: freq
...@@ -62,7 +62,23 @@ blocks: ...@@ -62,7 +62,23 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [512, 12.0] coordinate: [568, 12.0]
rotation: 0
state: true
- name: power
id: variable_qtgui_label
parameters:
comment: ''
formatter: None
gui_hint: ''
label: ''
type: real
value: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [456, 12.0]
rotation: 0 rotation: 0
state: true state: true
- name: samp_rate - name: samp_rate
...@@ -86,7 +102,7 @@ blocks: ...@@ -86,7 +102,7 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [416, 4.0] coordinate: [368, 12.0]
rotation: 0 rotation: 0
state: true state: true
- name: volume - name: volume
...@@ -107,7 +123,7 @@ blocks: ...@@ -107,7 +123,7 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [712, 4.0] coordinate: [704, 12.0]
rotation: 0 rotation: 0
state: true state: true
- name: analog_fm_demod_cf_0 - name: analog_fm_demod_cf_0
...@@ -197,35 +213,35 @@ blocks: ...@@ -197,35 +213,35 @@ blocks:
coordinate: [88, 100.0] coordinate: [88, 100.0]
rotation: 0 rotation: 0
state: true state: true
- name: blocks_message_debug_0 - name: blocks_message_strobe_0
id: blocks_message_debug id: blocks_message_strobe
parameters: parameters:
affinity: '' affinity: ''
alias: '' alias: ''
comment: '' comment: ''
en_uvec: 'True' maxoutbuf: '0'
minoutbuf: '0'
msg: pmt.intern("POWER")
period: '1000'
states: states:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [576, 440.0] coordinate: [88, 540.0]
rotation: 0 rotation: 0
state: true state: true
- name: blocks_message_strobe_0 - name: blocks_msgpair_to_var_0
id: blocks_message_strobe id: blocks_msgpair_to_var
parameters: parameters:
affinity: '' affinity: ''
alias: '' alias: ''
comment: '' comment: ''
maxoutbuf: '0' target: power
minoutbuf: '0'
msg: pmt.intern("TEST")
period: '1000'
states: states:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [64, 532.0] coordinate: [408, 140.0]
rotation: 0 rotation: 0
state: true state: true
- name: blocks_multiply_const_vxx_0 - name: blocks_multiply_const_vxx_0
...@@ -263,14 +279,14 @@ blocks: ...@@ -263,14 +279,14 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [384, 188.0] coordinate: [408, 228.0]
rotation: 0 rotation: 0
state: true state: true
connections: connections:
- [analog_fm_demod_cf_0, '0', blocks_multiply_const_vxx_0, '0'] - [analog_fm_demod_cf_0, '0', blocks_multiply_const_vxx_0, '0']
- [bladeRF_source_0, '0', rational_resampler_xxx_0, '0'] - [bladeRF_source_0, '0', rational_resampler_xxx_0, '0']
- [bladeRF_source_0, pmic_out, blocks_message_debug_0, print] - [bladeRF_source_0, pmic_out, blocks_msgpair_to_var_0, inpair]
- [blocks_message_strobe_0, strobe, bladeRF_source_0, pmic_in] - [blocks_message_strobe_0, strobe, bladeRF_source_0, pmic_in]
- [blocks_multiply_const_vxx_0, '0', audio_sink_0, '0'] - [blocks_multiply_const_vxx_0, '0', audio_sink_0, '0']
- [rational_resampler_xxx_0, '0', analog_fm_demod_cf_0, '0'] - [rational_resampler_xxx_0, '0', analog_fm_demod_cf_0, '0']
......
...@@ -429,6 +429,36 @@ bool bladerf_common::get_channel_enable(bladerf_channel ch) ...@@ -429,6 +429,36 @@ bool bladerf_common::get_channel_enable(bladerf_channel ch)
return _enables[ch]; return _enables[ch];
} }
std::string bladerf_common::get_pmic_value(const std::string &reg_name)
{
bladerf_pmic_register reg;
if(reg_name == "CONFIGURATION")
reg = BLADERF_PMIC_CONFIGURATION;
else if(reg_name == "VOLTAGE_SHUNT")
reg = BLADERF_PMIC_VOLTAGE_SHUNT;
else if(reg_name == "VOLTAGE_BUS")
reg = BLADERF_PMIC_VOLTAGE_BUS;
else if(reg_name == "POWER")
reg = BLADERF_PMIC_POWER;
else if(reg_name == "CURRENT")
reg = BLADERF_PMIC_CURRENT;
else if(reg_name == "CALIBRATION")
reg = BLADERF_PMIC_CALIBRATION;
else return {};
if(reg == BLADERF_PMIC_CONFIGURATION || reg == BLADERF_PMIC_CALIBRATION)
{
//https://github.com/Nuand/bladeRF/blob/master/host/libraries/libbladeRF/src/board/bladerf2/bladerf2.c#L3581
//while not supported
//return std::to_string(get_pmic<uint16_t>(reg));
return {};
}
else
{
return std::to_string(get_pmic<float>(reg));
}
}
void bladerf_common::set_verbosity(std::string const &verbosity) void bladerf_common::set_verbosity(std::string const &verbosity)
{ {
bladerf_log_level l; bladerf_log_level l;
......
...@@ -162,6 +162,7 @@ protected: ...@@ -162,6 +162,7 @@ protected:
void set_channel_enable(bladerf_channel ch, bool enable); void set_channel_enable(bladerf_channel ch, bool enable);
bool get_channel_enable(bladerf_channel ch); bool get_channel_enable(bladerf_channel ch);
std::string get_pmic_value(const std::string & reg_name);
template<typename T> template<typename T>
T get_pmic(bladerf_pmic_register reg) T get_pmic(bladerf_pmic_register reg)
......
...@@ -84,7 +84,11 @@ bladerf_source_c::bladerf_source_c(const std::string &args) : ...@@ -84,7 +84,11 @@ bladerf_source_c::bladerf_source_c(const std::string &args) :
set_msg_handler(pmt::mp("pmic_in"),[=](const pmt::pmt_t & msg) set_msg_handler(pmt::mp("pmic_in"),[=](const pmt::pmt_t & msg)
{ {
message_port_pub(pmt::mp("pmic_out"), msg); auto type = pmt::symbol_to_string(msg);
auto value = get_pmic_value(type);
auto pair = pmt::cons(msg,pmt::string_to_symbol(value));
message_port_pub(pmt::mp("pmic_out"), pair);
}); });
/* Handle setting of sampling mode */ /* Handle setting of sampling mode */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment