Compile SPIN code from Flexprop
Hello,
How can I call SPIN function in CPP file in Flexprop?
How to compile any sample SPIN code in Flexprop?
I'm trying to compile sample code given in below link.
https://github.com/totalspectrum/flexprop/blob/master/samples/blink1.spin2

Comments
That demo you cite is Spin2, and works as-is (I just tested). Here's a similar program for the P1 -- if you have a FLiP or PAB you can run without any other hardware.
con _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 CLK_FREQ = (_clkmode >> 6) * _xinfreq DELAY = CLK_FREQ / 4 con LED2 = 27 LED1 = 26 pub main | t outa[LED2..LED1] := %01 dira[LED2..LED1] := true t := cnt repeat outa[LED2..LED1] ^= true waitcnt(t += DELAY)Load the Spin file into a C struct, something like:
// create C structure from the Spin2 blink demo struct __using("blink1.spin2") my_blink; void main() { // call the demo() function from blink1.spin2 my_blink.demo(); }Just use File > Open to open the Spin file in the editor, and then Compile & Run (for P1 or P2 as appropriate). The language used is based on the file extension: .spin for Spin1, .spin2 for Spin2, .bas for BASIC, .c for C, .cpp for C++ (which is only partly supported).
Thank you.
I think flexprop can compile spin2 code for P1, is that right?
Yes, as long as no P2 specific hardware features are used.