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

Add 4 pin mode for ATTINY85 (much less power and still one pin free) #387

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void RF24::csn(bool mode)
{

#if defined (RF24_TINY)
if (ce_pin != csn_pin) {
if ((ce_pin != csn_pin) && (csn_pin != 0)) {
digitalWrite(csn_pin,mode);
}
else {
Expand Down Expand Up @@ -614,7 +614,7 @@ bool RF24::begin(void)
if (ce_pin != csn_pin) pinMode(ce_pin,OUTPUT);

#if ! defined(LITTLEWIRE)
if (ce_pin != csn_pin)
if ((ce_pin != csn_pin) && (csn_pin != 0))
#endif
pinMode(csn_pin,OUTPUT);

Expand Down
15 changes: 14 additions & 1 deletion examples/rf24_ATTiny/rf24ping85/rf24ping85.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ version 2 as published by the Free Software Foundation.
| +----+ |
|-----------------------------------------------||----x-- nRF24L01 CSN, pin4
10nF
ATtiny25/45/85 Pin map with CE_PIN 3 and CSN_PIN 0 => PB4 is free to use for application and you can use ackPayload funtionallity
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: funtionallity -> funtionality

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"functionality" even better ;)

and you will save power as RF24 could get into sleep between writings as we control CE_PIN

^^
+-\/-+ //
PB5 1|o |8 Vcc --- nRF24L01 VCC, pin2 -----------------x--|<|-- 5V
nRF24L01 CE, pin3 --- PB3 2| |7 PB2 --- nRF24L01 SCK, pin5 --|<|---x-[22k]--| LED
NC PB4 3| |6 PB1 --- nRF24L01 MOSI, pin7 1n4148 |
nRF24L01 GND, pin1 -x- GND 4| |5 PB0 --- nRF24L01 MISO, pin6 |
| +----+ |
|-----------------------------------------------||----x-- nRF24L01 CSN, pin4
10nF

ATtiny24/44/84 Pin map with CE_PIN 8 and CSN_PIN 7
Schematic provided and successfully tested by Carmine Pastore (https://github.com/Carminepz)
Expand All @@ -54,6 +66,7 @@ version 2 as published by the Free Software Foundation.
#define CE_PIN 3
#define CSN_PIN 4
//#define CSN_PIN 3 // uncomment for ATtiny85 3 pins solution
//#define CSN_PIN 0 // uncomment for ATtiny85 4 pins solution

#include "RF24.h"

Expand Down Expand Up @@ -98,4 +111,4 @@ void loop(void){

// Try again 1s later
delay(1000);
}
}