-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patholedSignalStrength.cpp
More file actions
32 lines (25 loc) · 926 Bytes
/
oledSignalStrength.cpp
File metadata and controls
32 lines (25 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "hwlib.hpp"
#include "TEA5767.hpp"
int main( void ){
namespace target = hwlib::target;
auto scl = target::pin_oc( target::pins::d8 );
auto sda = target::pin_oc( target::pins::d9 );
auto i2c_bus = hwlib::i2c_bus_bit_banged_scl_sda(scl, sda);
auto oled = hwlib::glcd_oled( i2c_bus, 0x3c );
auto font = hwlib::font_default_8x8();
auto display = hwlib::terminal_from(oled, font);
auto radio = TEA5767(i2c_bus);
oled.clear();
radio.setStereo(true);
radio.audioSettings(true, true, true);
radio.setFrequency(100.7);
for(;;){
radio.setFrequency(100.7);
display << "\f" << int(radio.getFrequency()) << " " << radio.signalStrength() << hwlib::flush;
hwlib::wait_ms(10000);
radio.setFrequency(102.1);
hwlib::wait_ms(1000);
display << "\f" << int(radio.getFrequency()) << " " << radio.signalStrength() << hwlib::flush;
hwlib::wait_ms(10000);
}
}