1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-10 21:24:12 +01:00

Disable PDC controller during TWI init.

This commit is contained in:
Cristian Maglie 2012-01-09 18:53:46 +01:00
parent 668345cdf3
commit 742f59ac98

View File

@ -89,6 +89,10 @@ TwoWire::TwoWire(Twi *_twi, void(*_beginCb)(void)) :
void TwoWire::begin(void) { void TwoWire::begin(void) {
if (onBeginCallback) if (onBeginCallback)
onBeginCallback(); onBeginCallback();
// Disable PDC channel
twi->TWI_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;
TWI_ConfigureMaster(twi, TWI_CLOCK, VARIANT_MCK); TWI_ConfigureMaster(twi, TWI_CLOCK, VARIANT_MCK);
status = MASTER_IDLE; status = MASTER_IDLE;
} }
@ -96,6 +100,10 @@ void TwoWire::begin(void) {
void TwoWire::begin(uint8_t address) { void TwoWire::begin(uint8_t address) {
if (onBeginCallback) if (onBeginCallback)
onBeginCallback(); onBeginCallback();
// Disable PDC channel
twi->TWI_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;
TWI_ConfigureSlave(twi, address); TWI_ConfigureSlave(twi, address);
status = SLAVE_IDLE; status = SLAVE_IDLE;
TWI_EnableIt(twi, TWI_IER_SVACC); TWI_EnableIt(twi, TWI_IER_SVACC);