amiro-os / include / amiro / FileSystemInputOutput / FSIODiWheelDrive.hpp @ 753ccd04
History | View | Annotate | Download (2.912 KB)
| 1 |
#ifndef AMIRO_FSIODIWHEELDRIVE_H_
|
|---|---|
| 2 |
#define AMIRO_FSIODIWHEELDRIVE_H_
|
| 3 |
|
| 4 |
/*! \brief memory layout for the eeproms
|
| 5 |
*
|
| 6 |
* This header defines the memory layout of the
|
| 7 |
* at24c01 on the CiWheelDrive board.
|
| 8 |
*/
|
| 9 |
|
| 10 |
#include <amiro/eeprom/at24.hpp> |
| 11 |
#include <amiro/FileSystemInputOutput/FileSystemInputOutputBase.hpp> |
| 12 |
|
| 13 |
// using namespace chibios_rt;
|
| 14 |
|
| 15 |
namespace amiro {
|
| 16 |
namespace fileSystemIo {
|
| 17 |
|
| 18 |
class FSIODiWheelDrive : public FileSystemIoBase { |
| 19 |
private:
|
| 20 |
|
| 21 |
/** \brief Layout for FSIODiWheelDrive with BSMV 1 and bsmv 1*/
|
| 22 |
struct DiWheelDrive_1_1 {
|
| 23 |
uint8_t reserved_0x00_0x14[20];
|
| 24 |
uint16_t vcnl4020offset[4]; // U [12, 13, 15, 16] |
| 25 |
uint8_t generalPurpose[96]; // 1Cx_7Cx |
| 26 |
uint8_t reserved_0x7D_0x80[4];
|
| 27 |
}; |
| 28 |
|
| 29 |
/** \brief Layout for FSIODiWheelDrive with BSMV 1 and bsmv 2*/
|
| 30 |
struct DiWheelDrive_1_2 {
|
| 31 |
uint8_t reserved_0x00_0x14[28];
|
| 32 |
float Ed;
|
| 33 |
float Eb;
|
| 34 |
uint8_t generalPurpose[88]; // 24x_7Cx |
| 35 |
uint8_t reserved_0x7D_0x80[4];
|
| 36 |
}; |
| 37 |
|
| 38 |
/** \brief Layout for FSIODiWheelDrive with BSMV 1 and bsmv 3*/
|
| 39 |
struct DiWheelDrive_1_3 {
|
| 40 |
uint8_t reserved_0x00_0x14[36];
|
| 41 |
float wheelfactor;
|
| 42 |
float igain;
|
| 43 |
int pgain;
|
| 44 |
float dgain;
|
| 45 |
uint8_t generalPurpose[72]; // 24x_7Cx |
| 46 |
uint8_t reserved_0x7D_0x80[4];
|
| 47 |
}; |
| 48 |
|
| 49 |
public:
|
| 50 |
FSIODiWheelDrive(AT24 &at24c01, uint8_t BSMV, uint8_t bsmv, uint8_t HMV, uint8_t hmv) |
| 51 |
: FileSystemIoBase(at24c01, BSMV, bsmv, HMV, hmv) {}
|
| 52 |
|
| 53 |
/**
|
| 54 |
* \brief Read the VCNL4020 offset from memory
|
| 55 |
* @param buffer Content to write in from the memory
|
| 56 |
* @param idx Index of the VCNL4020 sensor
|
| 57 |
* @return FSIO return types
|
| 58 |
*/
|
| 59 |
msg_t getVcnl4020Offset (uint16_t *buffer, uint8_t idx); |
| 60 |
|
| 61 |
/**
|
| 62 |
* \brief Write new data to the VCNL4020 offset
|
| 63 |
* @param buffer Content to write to the memory
|
| 64 |
* @param idx Index of the VCNL4020 sensor
|
| 65 |
* @return FSIO return types
|
| 66 |
*/
|
| 67 |
msg_t setVcnl4020Offset (uint16_t buffer, uint8_t idx); |
| 68 |
|
| 69 |
/**
|
| 70 |
* \brief Read the Ed ratio from memory
|
| 71 |
* @return FSIO return types
|
| 72 |
*/
|
| 73 |
msg_t getEd (float *buffer);
|
| 74 |
|
| 75 |
/**
|
| 76 |
* \brief Write new data to the Ed ratio value
|
| 77 |
* @param buffer Content to write to the memory
|
| 78 |
* @return FSIO return types
|
| 79 |
*/
|
| 80 |
msg_t setEd (float buffer);
|
| 81 |
|
| 82 |
/**
|
| 83 |
* \brief Read the Eb ratio from memory
|
| 84 |
* @return FSIO return types
|
| 85 |
*/
|
| 86 |
msg_t getEb (float *buffer);
|
| 87 |
|
| 88 |
/**
|
| 89 |
* \brief Write new data to the Eb ratio value
|
| 90 |
* @param buffer Content to write to the memory
|
| 91 |
* @return FSIO return types
|
| 92 |
*/
|
| 93 |
msg_t setEb (float buffer);
|
| 94 |
|
| 95 |
msg_t setwheelfactor (float buffer);
|
| 96 |
msg_t getWheelFactor (float *buffer);
|
| 97 |
|
| 98 |
msg_t setiGain (float buffer);
|
| 99 |
msg_t getiGain (float *buffer);
|
| 100 |
|
| 101 |
msg_t setdGain (float buffer);
|
| 102 |
msg_t getdGain (float *buffer);
|
| 103 |
|
| 104 |
msg_t setpGain (int buffer);
|
| 105 |
msg_t getpGain (int *buffer);
|
| 106 |
}; |
| 107 |
|
| 108 |
} |
| 109 |
} |
| 110 |
|
| 111 |
#endif /* AMIRO_FSIODIWHEELDRIVE_H_ */ |