/firmware/src/Extruder/EepromMap.hh

http://github.com/makerbot/G3Firmware · C++ Header · 128 lines · 53 code · 29 blank · 46 comment · 0 complexity · 1111640f689df649dec694a1c80294cb MD5 · raw file

  1. /*
  2. * Copyright 2010 by Adam Mayer <adam@makerbot.com>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>
  16. */
  17. #ifndef EEPROM_MAP_HH_
  18. #define EEPROM_MAP_HH_
  19. #include <stdint.h>
  20. #include "Thermistor.hh"
  21. /// Describe the EEPROM map.
  22. /// Why are we not describing this as a packed struct? Because the
  23. /// information needs to be shared with external applications (currently
  24. /// java, etc.
  25. namespace eeprom {
  26. const static uint16_t EEPROM_SIZE = 0x0200;
  27. //// Start of map
  28. //// Uninitialized memory is 0xff. 0xff should never
  29. //// be used as a valid value for initialized memory!
  30. /// Version, low byte: 1 byte
  31. const static uint16_t VERSION_LOW = 0x0000;
  32. /// Version, high byte: 1 byte
  33. const static uint16_t VERSION_HIGH = 0x0001;
  34. //// Feature map: 2 bytes
  35. const static uint16_t FEATURES = 0x0002;
  36. enum {
  37. HEATER_0_PRESENT = 1 << 0,
  38. HEATER_0_THERMISTOR = 1 << 1,
  39. HEATER_0_THERMOCOUPLE = 1 << 2,
  40. HEATER_1_PRESENT = 1 << 3,
  41. HEATER_1_THERMISTOR = 1 << 4,
  42. HEATER_1_THERMOCOUPLE = 1 << 5,
  43. DC_MOTOR_PRESENT = 1 << 6,
  44. HBRIDGE_STEPPER = 1 << 8,
  45. EXTERNAL_STEPPER = 1 << 9,
  46. RELAY_BOARD = 1 << 10,
  47. MK5_HEAD = 1 << 11
  48. };
  49. /// Backoff stop time, in ms: 2 bytes
  50. const static uint16_t BACKOFF_STOP_TIME = 0x0004;
  51. /// Backoff reverse time, in ms: 2 bytes
  52. const static uint16_t BACKOFF_REVERSE_TIME = 0x0006;
  53. /// Backoff forward time, in ms: 2 bytes
  54. const static uint16_t BACKOFF_FORWARD_TIME = 0x0008;
  55. /// Backoff trigger time, in ms: 2 bytes
  56. const static uint16_t BACKOFF_TRIGGER_TIME = 0x000A;
  57. /// Extruder heater base location
  58. const static uint16_t EXTRUDER_PID_BASE = 0x000C;
  59. /// HBP heater base location
  60. const static uint16_t HBP_PID_BASE = 0x0012;
  61. /// Extra features word: 2 bytes
  62. const static uint16_t EXTRA_FEATURES = 0x0018;
  63. enum {
  64. EF_SWAP_MOTOR_CONTROLLERS = 1 << 0,
  65. EF_USE_BACKOFF = 1 << 1,
  66. // Two bits to indicate mosfet channel.
  67. // Channel A = 0
  68. // Channel B = 1
  69. // Channel C = 2
  70. // Defaults:
  71. // A - HBP heater
  72. // B - extruder heater
  73. // C - ABP motor
  74. EF_EX_HEATER_0 = 1 << 2,
  75. EF_EX_HEATER_1 = 1 << 3,
  76. EF_HBP_HEATER_0 = 1 << 4,
  77. EF_HBP_HEATER_1 = 1 << 5,
  78. EF_ABP_MOTOR_0 = 1 << 6,
  79. EF_ABP_MOTOR_1 = 1 << 7,
  80. // These are necessary to deal with horrible "all 0/all 1" problems
  81. // we introduced back in the day
  82. EF_ACTIVE_0 = 1 << 14, // Set to 1 if EF word is valid
  83. EF_ACTIVE_1 = 1 << 15 // Set to 0 if EF word is valid
  84. };
  85. const static uint16_t EF_DEFAULT = 0x4084;
  86. /// Extruder identifier; defaults to 0: 1 byte
  87. const static uint16_t SLAVE_ID = 0x001a;
  88. const static uint16_t COOLING_FAN_BASE = 0x001c;
  89. const static uint16_t THERM_R0_OFFSET = 0x00;
  90. const static uint16_t THERM_T0_OFFSET = 0x04;
  91. const static uint16_t THERM_BETA_OFFSET = 0x08;
  92. const static uint16_t THERM_DATA_OFFSET = 0x10;
  93. /// Thermistor table 0
  94. const static uint16_t THERM_TABLE_0 = 0x00f0;
  95. /// Thermistor table 1
  96. const static uint16_t THERM_TABLE_1 = 0x0170;
  97. void setDefaults();
  98. } // namespace eeprom
  99. #endif // EEPROM_MAP_HH_