Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove SPI class for ATTiny: provided by ATTinyCore #646

Merged
merged 2 commits into from
Oct 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1568,43 +1568,3 @@ void RF24::stopConstCarrier()
write_register(RF_SETUP, (read_register(RF_SETUP)) & ~_BV(PLL_LOCK));
ce(LOW);
}

//ATTiny support code pulled in from https://github.com/jscrane/RF24
#if defined(RF24_TINY)

void SPIClass::begin() {
// set USCK and DO for output
// set DI for input
#if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
DDRB |= (1 << PB2) | (1 << PB1);
DDRB &= ~(1 << PB0);
#elif defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
DDRA |= (1 << PA4) | (1 << PA5);
DDRA &= ~(1 << PA6);
#elif defined(__AVR_ATtiny2313__) || defined(__AVR_ATtiny4313__)
DDRB |= (1 << PB7) | (1 << PB6);
DDRB &= ~(1 << PB5);
#elif defined(__AVR_ATtiny861__)
DDRB |= (1 << PB2) | (1 << PB1);
DDRB &= ~(1 << PB0);
#endif // defined(__AVR_ATtiny861__)
USICR = _BV(USIWM0);
}

byte SPIClass::transfer(byte b)
{
USIDR = b;
USISR = _BV(USIOIF);
do {
USICR = _BV(USIWM0) | _BV(USICS1) | _BV(USICLK) | _BV(USITC);
}
while ((USISR & _BV(USIOIF)) == 0);
return USIDR;
}

void SPIClass::end() {}
void SPIClass::setDataMode(uint8_t mode){}
void SPIClass::setBitOrder(uint8_t bitOrder){}
void SPIClass::setClockDivider(uint8_t rate){}

#endif
8 changes: 3 additions & 5 deletions utility/ATTiny/RF24_arch_config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
TMRh20 2015
ATTiny Configuration File
Expand All @@ -15,17 +16,14 @@
#define rf24_min(a, b) (a<b?a:b)

#if ARDUINO < 100

#include <WProgram.h>

#else
#include <Arduino.h>
#endif

#include <stddef.h>
#include <stddef.h>

// Include the header file for SPI functions ( Main SPI code is contained in RF24.cpp for simplicity )
#include "spi.h"
#include <SPI.h>

#define _SPI SPI

Expand Down
55 changes: 0 additions & 55 deletions utility/ATTiny/spi.h

This file was deleted.