turn off SPI if not needed, also start analog system

This commit is contained in:
Michael Moon 2010-09-16 21:43:13 +10:00
parent 92eb4c97ca
commit 1a2753ebfb
2 changed files with 12 additions and 2 deletions

View File

@ -16,14 +16,15 @@
#include "debug.h" #include "debug.h"
#include "sersendf.h" #include "sersendf.h"
#include "heater.h" #include "heater.h"
#include "analog.h"
void io_init(void) { void io_init(void) {
// disable modules we don't use // disable modules we don't use
#ifdef PRR #ifdef PRR
PRR = MASK(PRTWI) | MASK(PRADC); PRR = MASK(PRTWI) | MASK(PRADC) | MASK(PRSPI);
#endif #endif
#ifdef PRR0 #ifdef PRR0
PRR0 = MASK(PRTWI) | MASK(PRADC); PRR0 = MASK(PRTWI) | MASK(PRADC) | MASK(PRSPI);
#ifdef PRR1 #ifdef PRR1
PRR1 = 0xFF; PRR1 = 0xFF;
#endif #endif
@ -97,6 +98,9 @@ void init(void) {
// set up default feedrate // set up default feedrate
current_position.F = startpoint.F = next_target.target.F = SEARCH_FEEDRATE_Z; current_position.F = startpoint.F = next_target.target.F = SEARCH_FEEDRATE_Z;
// start up analog read interrupt loop, if anything uses analog as determined by ANALOG_MASK in your machine.h
analog_init();
// enable interrupts // enable interrupts
sei(); sei();

6
temp.c
View File

@ -88,6 +88,12 @@ uint16_t temp_read() {
uint16_t temp; uint16_t temp;
#ifdef TEMP_MAX6675 #ifdef TEMP_MAX6675
#ifdef PRR
PRR &= ~MASK(PRSPI);
#elif defined PRR0
PRR0 &= ~MASK(PRSPI);
#endif
SPCR = MASK(MSTR) | MASK(SPE) | MASK(SPR0); SPCR = MASK(MSTR) | MASK(SPE) | MASK(SPR0);
// enable MAX6675 // enable MAX6675