Demo fro training

Dependencies:   X_NUCLEO_IKS01A1 d7a_1x mbed-rtos mbed wizzi-utils

Committer:
mikl_andre
Date:
Mon Nov 21 07:24:34 2016 +0000
Revision:
0:429446fe396d
Initial Revision

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mikl_andre 0:429446fe396d 1 #ifndef _FILES_H_
mikl_andre 0:429446fe396d 2 #define _FILES_H_
mikl_andre 0:429446fe396d 3
mikl_andre 0:429446fe396d 4 #include "mbed.h"
mikl_andre 0:429446fe396d 5 #include "d7a.h"
mikl_andre 0:429446fe396d 6 #include "sensors.h"
mikl_andre 0:429446fe396d 7
mikl_andre 0:429446fe396d 8
mikl_andre 0:429446fe396d 9 enum {
mikl_andre 0:429446fe396d 10 ALARM_FILE_ID = 224,
mikl_andre 0:429446fe396d 11 SIMUL_FILE_ID,
mikl_andre 0:429446fe396d 12
mikl_andre 0:429446fe396d 13 MAG_CFG_FILE_ID = 240,
mikl_andre 0:429446fe396d 14 ACC_CFG_FILE_ID,
mikl_andre 0:429446fe396d 15 GYR_CFG_FILE_ID,
mikl_andre 0:429446fe396d 16 PRE_CFG_FILE_ID, // 243
mikl_andre 0:429446fe396d 17 HUM_CFG_FILE_ID,
mikl_andre 0:429446fe396d 18 TEM1_CFG_FILE_ID,
mikl_andre 0:429446fe396d 19 TEM2_CFG_FILE_ID,
mikl_andre 0:429446fe396d 20 MAG_VALUE_FILE_ID, // 247
mikl_andre 0:429446fe396d 21 ACC_VALUE_FILE_ID,
mikl_andre 0:429446fe396d 22 GYR_VALUE_FILE_ID,
mikl_andre 0:429446fe396d 23 PRE_VALUE_FILE_ID, // 250
mikl_andre 0:429446fe396d 24 HUM_VALUE_FILE_ID,
mikl_andre 0:429446fe396d 25 TEM1_VALUE_FILE_ID,
mikl_andre 0:429446fe396d 26 TEM2_VALUE_FILE_ID, // 253
mikl_andre 0:429446fe396d 27 };
mikl_andre 0:429446fe396d 28
mikl_andre 0:429446fe396d 29
mikl_andre 0:429446fe396d 30 #define GENERIC_FILE(name,data) TYPEDEF_STRUCT_PACKED{\
mikl_andre 0:429446fe396d 31 data\
mikl_andre 0:429446fe396d 32 } name##_t;\
mikl_andre 0:429446fe396d 33 extern name##_t f_##name;
mikl_andre 0:429446fe396d 34
mikl_andre 0:429446fe396d 35 #define GENERIC_FILE_INIT(name,...) name##_t f_##name = {\
mikl_andre 0:429446fe396d 36 __VA_ARGS__\
mikl_andre 0:429446fe396d 37 }
mikl_andre 0:429446fe396d 38
mikl_andre 0:429446fe396d 39 #define GENERIC_FILE_MAP(fid,name) { (void*)fid, (void*)&f_##name }
mikl_andre 0:429446fe396d 40
mikl_andre 0:429446fe396d 41
mikl_andre 0:429446fe396d 42
mikl_andre 0:429446fe396d 43 // Firmware revision for the Dash7board
mikl_andre 0:429446fe396d 44 GENERIC_FILE(dev_rev, d7a_revision_t rev;);
mikl_andre 0:429446fe396d 45
mikl_andre 0:429446fe396d 46 GENERIC_FILE(simul, uint32_t divider;);
mikl_andre 0:429446fe396d 47
mikl_andre 0:429446fe396d 48 GENERIC_FILE(mag_cfg, sensor_config_t cfg;);
mikl_andre 0:429446fe396d 49 GENERIC_FILE(acc_cfg, sensor_config_t cfg;);
mikl_andre 0:429446fe396d 50 GENERIC_FILE(gyr_cfg, sensor_config_t cfg;);
mikl_andre 0:429446fe396d 51 GENERIC_FILE(pre_cfg, sensor_config_t cfg;);
mikl_andre 0:429446fe396d 52 GENERIC_FILE(hum_cfg, sensor_config_t cfg;);
mikl_andre 0:429446fe396d 53 GENERIC_FILE(tem1_cfg, sensor_config_t cfg;);
mikl_andre 0:429446fe396d 54 GENERIC_FILE(tem2_cfg, sensor_config_t cfg;);
mikl_andre 0:429446fe396d 55
mikl_andre 0:429446fe396d 56 uint32_t fs_write_file(const uint8_t file_id,
mikl_andre 0:429446fe396d 57 const uint16_t offset,
mikl_andre 0:429446fe396d 58 const uint16_t size,
mikl_andre 0:429446fe396d 59 const uint8_t* const content);
mikl_andre 0:429446fe396d 60
mikl_andre 0:429446fe396d 61 uint32_t fs_read_file( const uint8_t file_id,
mikl_andre 0:429446fe396d 62 const uint16_t offset,
mikl_andre 0:429446fe396d 63 const uint16_t size,
mikl_andre 0:429446fe396d 64 uint8_t* buf);
mikl_andre 0:429446fe396d 65
mikl_andre 0:429446fe396d 66 #endif // _FILE_SYS_H_