Browse Source

Don't default build Wire1 on LC & Wire3 on 3.6 (saves memory)

main
PaulStoffregen 7 years ago
parent
commit
45fd91166b
2 changed files with 8 additions and 30 deletions
  1. +4
    -28
      WireKinetis.cpp
  2. +4
    -2
      WireKinetis.h

+ 4
- 28
WireKinetis.cpp View File

@@ -313,34 +313,6 @@ void TwoWire::end()
hardware.clock_gate_register &= ~hardware.clock_gate_mask;
}

#ifdef WIRE_IMPLEMENT_WIRE
void i2c0_isr(void)
{
Wire.isr();
}
#endif

#ifdef WIRE_IMPLEMENT_WIRE1
void i2c1_isr(void)
{
Wire1.isr();
}
#endif

#ifdef WIRE_IMPLEMENT_WIRE2
void i2c2_isr(void)
{
Wire2.isr();
}
#endif

#ifdef WIRE_IMPLEMENT_WIRE3
void i2c3_isr(void)
{
Wire3.isr();
}
#endif


void TwoWire::isr(void)
{
@@ -758,15 +730,19 @@ const TwoWire::I2C_Hardware_t TwoWire::i2c3_hardware = {

#ifdef WIRE_IMPLEMENT_WIRE
TwoWire Wire(KINETIS_I2C0, TwoWire::i2c0_hardware);
void i2c0_isr(void) { Wire.isr(); }
#endif
#ifdef WIRE_IMPLEMENT_WIRE1
TwoWire Wire1(KINETIS_I2C1, TwoWire::i2c1_hardware);
void i2c1_isr(void) { Wire1.isr(); }
#endif
#ifdef WIRE_IMPLEMENT_WIRE2
TwoWire Wire2(KINETIS_I2C2, TwoWire::i2c2_hardware);
void i2c2_isr(void) { Wire2.isr(); }
#endif
#ifdef WIRE_IMPLEMENT_WIRE3
TwoWire Wire3(KINETIS_I2C3, TwoWire::i2c3_hardware);
void i2c3_isr(void) { Wire3.isr(); }
#endif



+ 4
- 2
WireKinetis.h View File

@@ -39,7 +39,8 @@
// Teensy LC
#if defined(__MKL26Z64__)
#define WIRE_IMPLEMENT_WIRE
#define WIRE_IMPLEMENT_WIRE1
//Wire1 consumes precious memory on Teensy LC
//#define WIRE_IMPLEMENT_WIRE1
#define WIRE_HAS_STOP_INTERRUPT

// Teensy 3.0
@@ -64,7 +65,8 @@
#define WIRE_IMPLEMENT_WIRE
#define WIRE_IMPLEMENT_WIRE1
#define WIRE_IMPLEMENT_WIRE2
#define WIRE_IMPLEMENT_WIRE3
//Wire3 is seldom used on Teensy 3.6
//#define WIRE_IMPLEMENT_WIRE3
#define WIRE_HAS_START_INTERRUPT
#define WIRE_HAS_STOP_INTERRUPT


Loading…
Cancel
Save