Bladeren bron

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

main
PaulStoffregen 8 jaren geleden
bovenliggende
commit
45fd91166b
2 gewijzigde bestanden met toevoegingen van 8 en 30 verwijderingen
  1. +4
    -28
      WireKinetis.cpp
  2. +4
    -2
      WireKinetis.h

+ 4
- 28
WireKinetis.cpp Bestand weergeven

hardware.clock_gate_register &= ~hardware.clock_gate_mask; 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) void TwoWire::isr(void)
{ {


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





+ 4
- 2
WireKinetis.h Bestand weergeven

// Teensy LC // Teensy LC
#if defined(__MKL26Z64__) #if defined(__MKL26Z64__)
#define WIRE_IMPLEMENT_WIRE #define WIRE_IMPLEMENT_WIRE
#define WIRE_IMPLEMENT_WIRE1
//Wire1 consumes precious memory on Teensy LC
//#define WIRE_IMPLEMENT_WIRE1
#define WIRE_HAS_STOP_INTERRUPT #define WIRE_HAS_STOP_INTERRUPT


// Teensy 3.0 // Teensy 3.0
#define WIRE_IMPLEMENT_WIRE #define WIRE_IMPLEMENT_WIRE
#define WIRE_IMPLEMENT_WIRE1 #define WIRE_IMPLEMENT_WIRE1
#define WIRE_IMPLEMENT_WIRE2 #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_START_INTERRUPT
#define WIRE_HAS_STOP_INTERRUPT #define WIRE_HAS_STOP_INTERRUPT



Laden…
Annuleren
Opslaan