B4R Question Inline C

whcir

Member
Licensed User
Longtime User
How do you access a sub routine in b4r from inline C? The second argument (led_Tick) in the third line requires a sub routine as a parameter, what syntax do you use

B4X:
#if C
#include <RTClock.h>
void RTCinit (B4R::Object* o) {
    rtc_init(RTCSEL_LSI);
    rtc_set_prescaler_load(0x7fff);
    rtc_attach_interrupt(RTC_SECONDS_INTERRUPT,  led_Tick);
}
#End if
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

try as example, if the sub routine led_Tick is defined in the main class:
B4X:
b4r_main::_led_tick

To explore the B4R generated code, lookup the <project>/objects/src folder ... checkout like b4r_main.h and b4r_main.cpp ... and others if more classes.
In the b4r_main.h, there should be an entry like
B4X:
static void _led_tick();
Please note that the functions are in lowercase!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…