PageRenderTime 25ms CodeModel.GetById 18ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 18#ifndef EEPROM_MAP_HH_
 19#define EEPROM_MAP_HH_
 20
 21#include <stdint.h>
 22#include "Thermistor.hh"
 23
 24/// Describe the EEPROM map.
 25/// Why are we not describing this as a packed struct?  Because the
 26/// information needs to be shared with external applications (currently
 27/// java, etc.
 28
 29namespace eeprom {
 30
 31const static uint16_t EEPROM_SIZE				= 0x0200;
 32
 33//// Start of map
 34//// Uninitialized memory is 0xff.  0xff should never
 35//// be used as a valid value for initialized memory!
 36
 37/// Version, low byte: 1 byte
 38const static uint16_t VERSION_LOW				= 0x0000;
 39/// Version, high byte: 1 byte
 40const static uint16_t VERSION_HIGH				= 0x0001;
 41
 42//// Feature map: 2 bytes
 43const static uint16_t FEATURES					= 0x0002;
 44enum {
 45	HEATER_0_PRESENT		= 1 << 0,
 46	HEATER_0_THERMISTOR 	= 1 << 1,
 47	HEATER_0_THERMOCOUPLE	= 1 << 2,
 48
 49	HEATER_1_PRESENT		= 1 << 3,
 50	HEATER_1_THERMISTOR 	= 1 << 4,
 51	HEATER_1_THERMOCOUPLE 	= 1 << 5,
 52
 53	DC_MOTOR_PRESENT		= 1 << 6,
 54
 55	HBRIDGE_STEPPER			= 1 << 8,
 56	EXTERNAL_STEPPER		= 1 << 9,
 57	RELAY_BOARD				= 1 << 10,
 58	MK5_HEAD				= 1 << 11
 59};
 60
 61/// Backoff stop time, in ms: 2 bytes
 62const static uint16_t BACKOFF_STOP_TIME         = 0x0004;
 63/// Backoff reverse time, in ms: 2 bytes
 64const static uint16_t BACKOFF_REVERSE_TIME      = 0x0006;
 65/// Backoff forward time, in ms: 2 bytes
 66const static uint16_t BACKOFF_FORWARD_TIME      = 0x0008;
 67/// Backoff trigger time, in ms: 2 bytes
 68const static uint16_t BACKOFF_TRIGGER_TIME      = 0x000A;
 69
 70
 71/// Extruder heater base location
 72const static uint16_t EXTRUDER_PID_BASE		= 0x000C;
 73
 74
 75/// HBP heater base location
 76const static uint16_t HBP_PID_BASE		= 0x0012;
 77
 78
 79/// Extra features word: 2 bytes
 80const static uint16_t EXTRA_FEATURES			= 0x0018;
 81enum {
 82	EF_SWAP_MOTOR_CONTROLLERS	= 1 << 0,
 83	EF_USE_BACKOFF				= 1 << 1,
 84
 85	// Two bits to indicate mosfet channel.
 86	// Channel A = 0
 87	// Channel B = 1
 88	// Channel C = 2
 89	// Defaults:
 90	//   A - HBP heater
 91	//   B - extruder heater
 92	//   C - ABP motor
 93	EF_EX_HEATER_0			= 1 << 2,
 94	EF_EX_HEATER_1			= 1 << 3,
 95	EF_HBP_HEATER_0			= 1 << 4,
 96	EF_HBP_HEATER_1			= 1 << 5,
 97	EF_ABP_MOTOR_0			= 1 << 6,
 98	EF_ABP_MOTOR_1			= 1 << 7,
 99
100	// These are necessary to deal with horrible "all 0/all 1" problems
101	// we introduced back in the day
102	EF_ACTIVE_0				= 1 << 14,  // Set to 1 if EF word is valid
103	EF_ACTIVE_1				= 1 << 15	// Set to 0 if EF word is valid
104};
105
106const static uint16_t EF_DEFAULT = 0x4084;
107
108/// Extruder identifier; defaults to 0: 1 byte
109const static uint16_t SLAVE_ID					= 0x001a;
110
111const static uint16_t COOLING_FAN_BASE      = 0x001c;
112
113const static uint16_t THERM_R0_OFFSET			= 0x00;
114const static uint16_t THERM_T0_OFFSET			= 0x04;
115const static uint16_t THERM_BETA_OFFSET			= 0x08;
116const static uint16_t THERM_DATA_OFFSET			= 0x10;
117
118/// Thermistor table 0
119const static uint16_t THERM_TABLE_0             = 0x00f0;
120
121/// Thermistor table 1
122const static uint16_t THERM_TABLE_1   			= 0x0170;
123
124void setDefaults();
125
126} // namespace eeprom
127
128#endif // EEPROM_MAP_HH_