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

Teensy 3.0 and above support is needed #55

Closed
vamsee227 opened this issue Oct 23, 2020 · 5 comments
Closed

Teensy 3.0 and above support is needed #55

vamsee227 opened this issue Oct 23, 2020 · 5 comments

Comments

@vamsee227
Copy link

Error compiling the test code for teensy board
Adafruit_PCD8544.cpp: In member function 'void Adafruit_PCD8544::begin(uint8_t, uint8_t)':
Adafruit_PCD8544.cpp:287:13: error: cannot convert 'volatile uint8_t* {aka volatile unsigned char*}' to 'PortReg* {aka volatile long unsigned int*}' in assignment clkport = portOutputRegister(digitalPinToPort(_sclk));
Adafruit_PCD8544.cpp:289:14: error: cannot convert 'volatile uint8_t* {aka volatile unsigned char*}' to 'PortReg* {aka volatile long unsigned int*}' in assignment mosiport = portOutputRegister(digitalPinToPort(_din));
Error compiling for board Teensy 3.2 / 3.1.

  • Teensy board used: Teensy 3.2

  • Arduino IDE version **Arduino IDE ver. 1.8.13

@vamsee227
Copy link
Author

It worked after editing the header file (H file). After changing "uint32_t" in these lines
#else
typedef volatile uint32_t PortReg; ///< PortReg for other chips
typedef uint32_t PortMask; ///< PortMask for other chips
#endif

Changed to "uint8_t"
#else
typedef volatile uint8_t PortReg; ///< PortReg for other chips
typedef uint8_t PortMask; ///< PortMask for other chips
#endif

I request you to update the library by providing the support for Teensy 3.0 and above boards

Thanks
Vamsee

@drak7
Copy link
Contributor

drak7 commented Oct 23, 2020

By default the example uses software SPI, switching to hardware SPI should fix it.

The port registers on the Teensy 3 are emulated as 8-bit for compatibility with Arduino so we could check for that board and use the 8-bit defines. The actual port registers for the teensy are 32-bit and can be used directly, that would be the better way to handle it. See this teensy forum post and this one for more info.

@vamsee227
Copy link
Author

Okay, thanks.

@FerGT50
Copy link

FerGT50 commented Apr 19, 2021

Same problem here. Applying @vamsee227 corrections worked!
An update to the library to automatically account for 32 bit Teensies would be nice indeed!

Like:

#if defined(SAM3X8E) || defined(ARDUINO_ARCH_SAMD)
typedef volatile RwReg PortReg; ///< PortReg for SAMD
typedef uint32_t PortMask; ///< PortMask for SAMD
#elif defined(AVR) || defined (TEENSYDUINO)
typedef volatile uint8_t PortReg; ///< PortReg for AVR
typedef uint8_t PortMask; ///< PortMask for AVR
#else
typedef volatile uint32_t PortReg; ///< PortReg for other chips
typedef uint32_t PortMask; ///< PortMask for other chips
#endif

@ladyada
Copy link
Member

ladyada commented May 29, 2021

this should be fixed now with the move to busio!

@ladyada ladyada closed this as completed May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants