This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What is the proper way to stop Ant-FS?

I have an application using N5150 SOC with S210 softdevice and using softdevice_handler, SDK 10.0.0.0, and I'm using Ant-FS to gather data from this device. I only want to do this at specific times so I need to shut down Ant-FS >99% of the time.

It's easy to start up Ant-FS and use it, but I don't see any way that antfs.c provides to shut down. Now, when I want to shut down, I block Ant Events to the antfs handler and simply close, then unassign the channel. It seems that there is more state within antfs that should be reset, but the state_machine_reset() function is local with no external interface so that doesn't appear to be an intentional interface.

What's the right way to do this?

Tom

Parents
  • We have started a refactoring the ANT examples to ease operations like this, unfortuneately we haven't got to the ANT FS example yet.

    In addition to closing and unassigning, you can call sd_ant_burst_handler_wait_flag_disable().

    When you start you should call antfs_init() and antfs_channel_setup().

    Have you experienced that state of the variables antfs affects operation after reinit?

  • One additional piece of information, I had to add a function to antfs.c:

    void antfs_stop(void) // TWS, added to provide clean up on stop { state_machine_reset(); }

    because the timer used by antfs was still running if I called antfs soon after shutting it down and antfs would fail in antfs_init() on the app_timer_create() call.

    Tom

Reply
  • One additional piece of information, I had to add a function to antfs.c:

    void antfs_stop(void) // TWS, added to provide clean up on stop { state_machine_reset(); }

    because the timer used by antfs was still running if I called antfs soon after shutting it down and antfs would fail in antfs_init() on the app_timer_create() call.

    Tom

Children
No Data