Viktor Zhezher / Mbed 2 deprecated SI570_VFO_F746NG

Dependencies:   mbed

Fork of SI570 by Gerrit Polder

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "SI570.h"
00003 #include "QEI.h"
00004 #include "LCD_DISCO_F746NG.h"
00005 
00006 LCD_DISCO_F746NG lcd;
00007 SI570 si570(D14, D15, 0xAA);
00008 QEI wheel (A4, A5, NC, 360);
00009 
00010  
00011 int main() {
00012     int wp,swp=0;
00013     float startfreq=7.0;
00014     float freq;
00015  
00016     while (1) {
00017            lcd.Clear(LCD_COLOR_BLUE);
00018       lcd.SetBackColor(LCD_COLOR_BLUE);
00019       lcd.SetTextColor(LCD_COLOR_WHITE);
00020       
00021         wp =  wheel.getPulses();
00022         freq=startfreq+wp*0.00001;
00023         if (swp != wp) {
00024             si570.set_frequency(freq);
00025             swp = wp;
00026         }                
00027    lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"%f Mhz", CENTER_MODE);
00028     }
00029 }