Hello Jérôme and all,

Thanks a lot for your previous post.
Please come forward with suggestions to patch e-puck BTcom/ sercom code.

I would like to call init_lvd() inside main function of main_com.c.
But at this moment I have no idea how your code fragment can be linked
with main_com.c :

static void init_lvd(){
>
on_low_battery->check_function=always_true;
set_action(on_low_battery,lowBattery);

//set interrupt prority  ->  1

IPC10=(IPC10 & 0xFF1F) + 0x0020;
_LVDIE=0;
_LVDEN=1;

//set voltage threshold  -> 7 (<3.1 V, see datasheet p. 184)

RCON=(RCON & 0xF0FF) +0x0700;
while(!_BGST);
_LVDIF=0;
_LVDIE=1;
}

void __attribute__((interrupt, auto_psv)) _LVDInterrupt(void)
{
_LVDIF=0;
_LVDEN=0;
_LVDIE=0;
check(on_low_battery);
}

//An example action

void lowBattery(Event *e,void *arg){
e_set_led(9,1);
}


Could you please explain me where/when to use _LVDInterrupt(void)  and
link the above code properly with main_com.c?

Thanks in advance and best regards,
Faruque

--
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
Md Omar Faruque Sarker
PhD Student,
Robotic Intelligence Lab,
Department of Computing,
University of Wales, Newport,
Allt-yr-yn Campus, Newport, NP20 5XR, UK
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬

_______________________________________________
E-puck-user mailing list
[email protected]
https://mail.gna.org/listinfo/e-puck-user

Reply via email to