Is there any way to put flowcode macros witch are written on c?
For exsample i have macro witch sends byte in 1-wire bus,and it calls macro witch sends 1 bit...
the first macro is oo_tx_byte:
void oo_tx_byte(char data){
char counter = 0;
while (counter < {
if (data & 0x01){
oo_tx_bit(1);
} else {
oo_tx_bit(0);
}
data = data >> 1;
counter++;
}
}
And the bit sent macro is oo_tx_bit:
void oo_tx_bit(bit value){
// Pull bus low
oo_bus = 0;
oo_writemode;
// Start the write slot
#warning "Assuming clock frequency of 8 MHz, adjust nr. of nop() to obtain a delay of 1us".
nop();
nop();
if (value == 0){
// Write a '0' (hold the bus for another 60 us)
delay_10us(6);
}
// Release the bus
oo_readmode;
// Final wait for the bus to stabilise
delay_10us(1);
// Make sure a write 0 and a write 1 take the same time to complete
if (value == 1){
delay_10us(6);
}
return;
}
So is there way to put that oo_tx_bit macro in flowcode,that the oo_tx_byte macro works...
C functions within Flowcode
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Hello Mika,
You need to put all the function code into the "implementation" box of the "Supplementary code" window (i.e. the bottom box).
You will also need to put the "prototypes" of these functions into the "definitions" box (i.e. the top box):
I hope this helps.
You need to put all the function code into the "implementation" box of the "Supplementary code" window (i.e. the bottom box).
You will also need to put the "prototypes" of these functions into the "definitions" box (i.e. the top box):
Code: Select all
void oo_tx_byte(char data);
void oo_tx_bit(bit value);