Skip to content
Permalink
Browse files

Fix ATtiny25 compilation issue (port definitions) (#728)

* Fix ATtiny25 compilation issue

The ATtiny25 does not have PORTA. It would give compilation errors.

Also, because the ATtiny25 has a very small storage capacity, a compilation message will be presented warning the user.

* Update fastpin_avr.h

* Fix char type
  • Loading branch information...
hugopilot authored and focalintent committed Feb 21, 2019
1 parent 84f6820 commit 6fafed5114e9e3b6d38c1b0d9c59ac29a008d649
Showing with 6 additions and 2 deletions.
  1. +6 −2 platforms/avr/fastpin_avr.h
@@ -51,9 +51,13 @@ typedef volatile uint8_t & reg8_t;
#define _IO(L) _RD8(DDR ## L); _RD8(PORT ## L); _RD8(PIN ## L);
#define _DEFPIN_AVR(_PIN, MASK, L) template<> class FastPin<_PIN> : public _AVRPIN<_PIN, MASK, _R(PORT ## L), _R(DDR ## L), _R(PIN ## L)> {};

#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny45__)
#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny25__)
_IO(B);

#if defined(__AVR_ATtiny25__)
#pragma message "ATtiny25 has very limited storage. This library could use up to more than 100% of its flash size"
#endif

#define MAX_PIN 5

_DEFPIN_AVR(0, 0x01, B); _DEFPIN_AVR(1, 0x02, B); _DEFPIN_AVR(2, 0x04, B); _DEFPIN_AVR(3, 0x08, B);
@@ -80,7 +84,7 @@ _IO(A); _IO(B);
_DEFPIN_AVR(0, 0x01, B); _DEFPIN_AVR(1, 0x02, B); _DEFPIN_AVR(2, 0x04, B);
_DEFPIN_AVR(3, 0x80, A); _DEFPIN_AVR(4, 0x40, A); _DEFPIN_AVR(5, 0x20, A);

#elif defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__)
#elif defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
_IO(A); _IO(B);

#define MAX_PIN 10

0 comments on commit 6fafed5

Please sign in to comment.
You can’t perform that action at this time.