Sub Process_Globals
Public Serial1 As Serial
Private frq As ULong 'ignore
Private timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
timer1.Initialize("timer1_Tick", 20)
timer1.Enabled = True
End Sub
Sub Timer1_Tick
RunNative("FreqCounterStart", Null)
RunNative("FreqCounterGet", Null)
Log(frq)
End Sub
#if C
#include <FreqCounter.h>
void FreqCounterStart(B4R::Object* o) {
FreqCounter::f_comp= 8;
FreqCounter::start(100);
while (FreqCounter::f_ready == 0);
}
void FreqCounterGet(B4R::Object* o) {
b4r_main::_frq = FreqCounter::f_freq;
}
#end if