Esempio n. 1
0
static void process_ltm(void)
{
    static uint8_t ltm_scheduler;
    uint8_t current_schedule = ltm_schedule[ltm_scheduler];

    if (current_schedule & LTM_BIT_AFRAME)
        ltm_aframe();

#if defined(GPS)
    if (current_schedule & LTM_BIT_GFRAME)
        ltm_gframe();

    if (current_schedule & LTM_BIT_OFRAME)
        ltm_oframe();

    if (current_schedule & LTM_BIT_XFRAME && ltm_shouldSendXFrame())
        ltm_xframe();
#endif

    if (current_schedule & LTM_BIT_SFRAME)
        ltm_sframe();

#if defined(NAV)
    if (current_schedule & LTM_BIT_NFRAME)
        ltm_nframe();
#endif

    ltm_scheduler = (ltm_scheduler + 1) % 10;
}
Esempio n. 2
0
static void process_ltm(void)
{
    static uint8_t ltm_scheduler;
    ltm_aframe();
    if (ltm_scheduler & 1)
        ltm_gframe();
    else
        ltm_sframe();
    if (ltm_scheduler == 0)
        ltm_oframe();
    ltm_scheduler++;
    ltm_scheduler %= 10;
}
Esempio n. 3
0
static void process_ltm(void)
{
    static uint8_t ltm_scheduler = 0;
    uint8_t current_schedule = ltm_schedule[ltm_scheduler];

    sbuf_t ltmPayloadBuf;
    sbuf_t *dst = &ltmPayloadBuf;

    if (current_schedule & LTM_BIT_AFRAME) {
        ltm_initialise_packet(dst);
        ltm_aframe(dst);
        ltm_finalise(dst);
    }

#if defined(GPS)
    if (current_schedule & LTM_BIT_GFRAME) {
        ltm_initialise_packet(dst);
        ltm_gframe(dst);
        ltm_finalise(dst);
    }

    if (current_schedule & LTM_BIT_OFRAME) {
        ltm_initialise_packet(dst);
        ltm_oframe(dst);
        ltm_finalise(dst);
    }

    if (current_schedule & LTM_BIT_XFRAME) {
        ltm_initialise_packet(dst);
        ltm_xframe(dst);
        ltm_finalise(dst);
    }
#endif

    if (current_schedule & LTM_BIT_SFRAME) {
        ltm_initialise_packet(dst);
        ltm_sframe(dst);
        ltm_finalise(dst);
    }

#if defined(NAV)
    if (current_schedule & LTM_BIT_NFRAME) {
        ltm_initialise_packet(dst);
        ltm_nframe(dst);
        ltm_finalise(dst);
    }
#endif

    ltm_scheduler = (ltm_scheduler + 1) % 10;
}
Esempio n. 4
0
int getLtmFrame(uint8_t *frame, ltm_frame_e ltmFrameType)
{
    static uint8_t ltmPayload[LTM_MAX_MESSAGE_SIZE];

    sbuf_t ltmPayloadBuf = { .ptr = ltmPayload, .end =ARRAYEND(ltmPayload) };
    sbuf_t * const sbuf = &ltmPayloadBuf;

    switch (ltmFrameType) {
    default:
    case LTM_AFRAME:
        ltm_aframe(sbuf);
        break;
    case LTM_SFRAME:
        ltm_sframe(sbuf);
        break;
#if defined(GPS)
    case LTM_GFRAME:
        ltm_gframe(sbuf);
        break;
    case LTM_OFRAME:
        ltm_oframe(sbuf);
        break;
    case LTM_XFRAME:
        ltm_xframe(sbuf);
        break;
#endif
#if defined(NAV)
    case LTM_NFRAME:
        ltm_nframe(sbuf);
        break;
#endif
    }
    sbufSwitchToReader(sbuf, ltmPayload);
    const int frameSize = sbufBytesRemaining(sbuf);
    for (int ii = 0; sbufBytesRemaining(sbuf); ++ii) {
        frame[ii] = sbufReadU8(sbuf);
    }
    return frameSize;
}