2023-01-27 20:49:11ladle

LMIC Run-Time

2.2.3 void os_setcallback(osjob_t* job, osjobcb_t cb)

預備一個可立即執行的 job. 可隨時call os_setcallback, 即使是從 interrupt handler

( e.g 感測值更新)

2.2.4 void os_settTimedcallback( osjob_t*, ostime_t time, osjobcb_t cb)

在指定的 timestamp call callback

exp

os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);

sendjob :  job control struct osjob_t 指標,  typedef osjob_t osjob_t

do_send  : callback

struct osjob_t {
    struct osjob_t* next;
    ostime_t deadline;
    osjobcb_t  func;
};

typedef int32_t ostime_t;

#define DEFINE_LMIC  struct lmic_t LMIC

#define DECLARE_LMIC extern struct lmic_t LMIC

struct lmic_t {

    // client setup data, survives LMIC_reset().

    lmic_client_data_t  client;

    // the OS job object. pointer alignment.

    osjob_t     osjob;

#if !defined(DISABLE_BEACONS)

    bcninfo_t   bcninfo;      // Last received beacon info

#endif

#if !defined(DISABLE_PING)

    rxsched_t   ping;         // pingable setup

#endif

    // the radio driver portable context

    lmic_radio_data_t   radio;

    /* (u)int32_t things */

    // Radio settings TX/RX (also accessed by HAL)

    ostime_t    txend;

    ostime_t    rxtime;

    等等

}

我要回應(本篇僅限會員/好友回應,請先登入)