LoRaWAN demo.

Dependencies:   DebouncedInterrupt modem_ref_helper

files.cpp

Committer:
Jeej
Date:
5 weeks ago
Revision:
12:18ab0181d584
Parent:
10:79ad72acf6cb

File content as of revision 12:18ab0181d584:

#include "files.h"
#include "hwcfg.h"

#include "kal_fs.h"

#define __DEVICE_ID__               0x00000017

alp_file_header_t h_rev = {
    .perm = RWR_R_,
    .prop = FS_PERMANENT_NOTIF,
    .afid = FID_ACTP_RPT_FULL,
    .ifid = IFID_REPORT,
    .size = HAL_U32_BYTE_SWAP((uint32_t)sizeof(revision_t)),
    .alloc= HAL_U32_BYTE_SWAP((uint32_t)sizeof(revision_t))
};

revision_t f_rev = {
    .manufacturer_id     = __MANUFACTURER_ID__,
    /// Device ID: Arbitrary number, at user/customer choice
    .device_id           = __DEVICE_ID__,
    /// Hardware Board ID:
    .hw_version          = __HW_VERSION__,
    /// Firmware Version: made of
    ///  - major,minor and patch indexes
    ///  - fw_id : "build-flavour"
    ///  FW_ID | MAJOR | MINOR | PATCH | HASH |
    //     1B  |  1B   |  1B   |   2B  |  4B  |
    .fw_version.id       = 0,
    .fw_version.major    = 1,
    .fw_version.minor    = 0,
    .fw_version.patch    = 2,
    .fw_version.hash     = 0x00000000,
    /// Not used
    .cup_max_size        = 0x00000000
};

alp_file_header_t h_sensor_config = {
    .perm = RWRWRW,
    .prop = FS_VOLATILE,
    .afid = 0,
    .ifid = 0,
    .size = HAL_U32_BYTE_SWAP((uint32_t)sizeof(sensor_config_t)),
    .alloc= HAL_U32_BYTE_SWAP((uint32_t)sizeof(sensor_config_t))
};

sensor_config_t f_sensor_config = {
    .report_type     = REPORT_ON_DIFFERENCE, // Type of report asked
    .read_period     = 5000,                 // Measure period (ms)
    .max_period      = 60*30,                // Maximum time between reports (s)
    .max_diff        = 100,                  // Maximum difference allowed between two reported values
    .threshold_high  = 900,                  // High threshold value triggering a report
    .threshold_low   = 100,                  // Low threshold value triggering a report
};

alp_file_header_t h_sensor_light = {
    .perm = RWRWR_,
    .prop = FS_VOLATILE_NOTIF,
    .afid = FID_ACTP_RPT_FULL,
    .ifid = IFID_REPORT,
    .size = HAL_U32_BYTE_SWAP((uint32_t)sizeof(light_value_t)),
    .alloc= HAL_U32_BYTE_SWAP((uint32_t)sizeof(light_value_t))
};

alp_file_header_t h_alarm = {
    .perm = RWRWR_,
    .prop = FS_VOLATILE,
    .afid = 0,
    .ifid = 0,
    .size = HAL_U32_BYTE_SWAP((uint32_t)sizeof(alarm_t)),
    .alloc= HAL_U32_BYTE_SWAP((uint32_t)sizeof(alarm_t))
};

alarm_t f_alarm = 255;