Move MAX6675 initialisation from mendel.c to temp.c.

Also note a misplaced and misnamed pin.
This commit is contained in:
Markus Hitter 2014-11-03 15:43:49 +01:00
parent b66ba4629a
commit a9f1d00865
8 changed files with 31 additions and 7 deletions

View File

@ -6,6 +6,10 @@
#define SCK DIO52
#define MISO DIO50
#define MOSI DIO51
// TODO: This depends on the board, so this definition is misplaced here,
// should be more appropriately named and go to config.h. It's used in
// temp.c and simulator.h and defines the Chip Select pin for an eventual
// MAX6675 temperature sensor.
#define SS DIO53
// TWI (I2C)

View File

@ -6,6 +6,10 @@
#define SCK DIO13
#define MISO DIO12
#define MOSI DIO11
// TODO: This depends on the board, so this definition is misplaced here,
// should be more appropriately named and go to config.h. It's used in
// temp.c and simulator.h and defines the Chip Select pin for an eventual
// MAX6675 temperature sensor.
#define SS DIO10
// TWI (I2C)

View File

@ -30,6 +30,10 @@
#define SCK DIO1
#define MISO DIO3
#define MOSI DIO2
// TODO: This depends on the board, so this definition is misplaced here,
// should be more appropriately named and go to config.h. It's used in
// temp.c and simulator.h and defines the Chip Select pin for an eventual
// MAX6675 temperature sensor.
#define SS DIO0
// TWI (I2C)

View File

@ -11,6 +11,10 @@
#define SCK DIO7
#define MISO DIO6
#define MOSI DIO5
// TODO: This depends on the board, so this definition is misplaced here,
// should be more appropriately named and go to config.h. It's used in
// temp.c and simulator.h and defines the Chip Select pin for an eventual
// MAX6675 temperature sensor.
#define SS DIO4
// TWI (I2C)

View File

@ -11,6 +11,10 @@
#define SCK DIO9
#define MISO DIO11
#define MOSI DIO10
// TODO: This depends on the board, so this definition is misplaced here,
// should be more appropriately named and go to config.h. It's used in
// temp.c and simulator.h and defines the Chip Select pin for an eventual
// MAX6675 temperature sensor.
#define SS DIO8

View File

@ -2,6 +2,10 @@
#define SCK DIO9
#define MISO DIO11
#define MOSI DIO10
// TODO: This depends on the board, so this definition is misplaced here,
// should be more appropriately named and go to config.h. It's used in
// temp.c and simulator.h and defines the Chip Select pin for an eventual
// MAX6675 temperature sensor.
#define SS DIO8

View File

@ -184,7 +184,6 @@ void io_init(void) {
WRITE(SCK, 0); SET_OUTPUT(SCK);
WRITE(MOSI, 1); SET_OUTPUT(MOSI);
WRITE(MISO, 1); SET_INPUT(MISO);
WRITE(SS, 1); SET_OUTPUT(SS);
#endif
#ifdef TEMP_INTERCOM

13
temp.c
View File

@ -73,16 +73,17 @@ struct {
uint16_t next_read_time; ///< how long until we can read this sensor again?
} temp_sensors_runtime[NUM_TEMP_SENSORS];
/// set up temp sensors. Currently only the 'intercom' sensor needs initialisation.
/// Set up temp sensors.
void temp_init() {
temp_sensor_t i;
for (i = 0; i < NUM_TEMP_SENSORS; i++) {
switch(temp_sensors[i].temp_type) {
#ifdef TEMP_MAX6675
// initialised when read
/* case TT_MAX6675:
break;*/
#endif
#ifdef TEMP_MAX6675
case TT_MAX6675:
WRITE(SS, 1); // Turn sensor off.
SET_OUTPUT(SS);
// Intentionally no break, we might have more than one sensor type.
#endif
#ifdef TEMP_THERMISTOR
// handled by analog_init()