#include "device.h"

#define BITMAP_GAS_ADDR  (0x080A0000)
#define BITMAP_MAIN_ADDR (BITMAP_GAS_ADDR + 20 * 1024 * 4)

#define OFFSET_DATA (0x0000 * 2)

struct device_data_s device_data __attribute__((section(".bss_ccm")));

const uint8_t * const modbus_map_ro[] = {
    [OFFSET_DATA + 0] = (uint8_t *)&(device_data.peak[0]) + 1,
    [OFFSET_DATA + 1] = (uint8_t *)&(device_data.peak[0]) + 0,
    [OFFSET_DATA + 2] = (uint8_t *)&(device_data.peak[1]) + 1,
    [OFFSET_DATA + 3] = (uint8_t *)&(device_data.peak[1]) + 0,
    [OFFSET_DATA + 4] = (uint8_t *)&(device_data.peak[2]) + 1,
    [OFFSET_DATA + 5] = (uint8_t *)&(device_data.peak[2]) + 0,
    [OFFSET_DATA + 6] = (uint8_t *)&(device_data.peak[3]) + 1,
    [OFFSET_DATA + 7] = (uint8_t *)&(device_data.peak[3]) + 0,
    [OFFSET_DATA + 8] = (uint8_t *)&(device_data.freq[0]) + 1,
    [OFFSET_DATA + 9] = (uint8_t *)&(device_data.freq[0]) + 0,
    [OFFSET_DATA + 10] = (uint8_t *)&(device_data.freq[1]) + 1,
    [OFFSET_DATA + 11] = (uint8_t *)&(device_data.freq[1]) + 0,
    [OFFSET_DATA + 12] = (uint8_t *)&(device_data.freq[2]) + 1,
    [OFFSET_DATA + 13] = (uint8_t *)&(device_data.freq[2]) + 0,
    [OFFSET_DATA + 14] = (uint8_t *)&(device_data.freq[3]) + 1,
    [OFFSET_DATA + 15] = (uint8_t *)&(device_data.freq[3]) + 0,
    [OFFSET_DATA + 16] = (uint8_t *)&(device_data.button) + 0,
    [OFFSET_DATA + 17] = (uint8_t *)&(device_data.sd) + 0,
};
