Scan example on D7-LoRa

Dependencies:   modem_ref_helper DebouncedInterrupt

modem_callbacks.cpp

Committer:
Jeej
Date:
2021-02-19
Revision:
8:afc331e53b7d
Parent:
5:8c7ce9a28169

File content as of revision 8:afc331e53b7d:

#include "modem_d7a.h"

// ============================================================}}}

// Callbacks to MODEM's ALP requests
// ============================================================{{{
void my_read(u8 action, u8 fid, u32 offset, u32 length, int id)
{
    modem_ref_respond(action, ALP_ERR_FILE_NOT_FOUND, id);
}

void my_write(u8 action, u8 fid, void *data, u32 offset, u32 length, int id)
{
    modem_ref_respond(action, ALP_ERR_FILE_NOT_FOUND, id);
}

void my_read_fprop(u8 action, u8 fid, int id)
{
    modem_ref_respond(action, ALP_ERR_FILE_NOT_FOUND, id);
}

void my_flush(u8 action, u8 fid, int id)
{
    modem_ref_respond(action, ALP_ERR_FILE_NOT_FOUND, id);
}

void my_delete(u8 action, u8 fid, int id)
{
    modem_ref_respond(action, ALP_ERR_FILE_NOT_FOUND, id);
}

void my_udata(alp_payload_t* alp)
{    
    alp_payload_print(alp);
}

void my_lqual(u8 ifid, int per)
{
    PRINT("Interface File [%3d] LQUAL : %d%% PER\r\n", ifid, per);
}

void my_ldown(u8 ifid)
{
    PRINT("Interface File [%3d] LDOWN\r\n", ifid);
}

void my_reset(void)
{
    PRINT("Restarting application...\r\n");
    FLUSH();
    NVIC_SystemReset();
}

void my_boot(u8 cause, u16 number)
{
    PRINT("Modem BOOT[%c] #%d\r\n", cause, number);
    
    // Modem re-booted, restart APP
    my_reset();
}

void my_busy(u8 busy)
{
    if (busy)
    {
        PRINT("Modem Busy\r\n");
        
        /* Stop report, do not use modem */
        /* Wait for modem reboot or modem not busy */
    }
    else
    {
        PRINT("Modem not Busy\r\n");
        
        /* Resume reports */
    }
}