PageRenderTime 17ms CodeModel.GetById 10ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/firmware/src/Motherboard/EepromMap.cc

http://github.com/makerbot/G3Firmware
C++ | 35 lines | 12 code | 4 blank | 19 comment | 0 complexity | 0964e9ae6377689b7fd65fb75a8478d6 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#include "EepromMap.hh"
19#include "Eeprom.hh"
20#include <avr/eeprom.h>
21
22namespace eeprom {
23
24// TODO: Shouldn't this just reset everything to an uninitialized state?
25void setDefaults() {
26    // Initialize eeprom map
27    // Default: enstops inverted, Y axis inverted
28    uint8_t axis_invert = 1<<1; // Y axis = 1
29    uint8_t endstop_invert = 0b00011111; // all endstops inverted
30    eeprom_write_byte((uint8_t*)eeprom::AXIS_INVERSION,axis_invert);
31    eeprom_write_byte((uint8_t*)eeprom::ENDSTOP_INVERSION,endstop_invert);
32    eeprom_write_byte((uint8_t*)eeprom::MACHINE_NAME,0); // name is null
33}
34
35}