SPI pinout in avrlibc

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SPI pinout in avrlibc

Aurélien Vallée
I wondered if the SPI pinout is available somewhere in avrlibc headers. The reason is that I need some code initializing SPI that should be portable across AVRs with different pins for SPI, e.g. atmega328 and atmega2560.

It looks to me that these pins are partially mapped currently, as I can find things like:

/usr/avr/include/avr/iom324pa.h:#define MOSI_DDR   DDRB
/usr/avr/include/avr/iom324pa.h:#define MOSI_PORT  PORTB
/usr/avr/include/avr/iom324pa.h:#define MOSI_PIN   PINB
/usr/avr/include/avr/iom324pa.h:#define MOSI_BIT   5

But that does not seems to be defined for all cores.

Are these macros what I think they are?
Is it expected that they are not defined for all cores?
Should we map the missing ones?


_______________________________________________
AVR-GCC-list mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Reply | Threaded
Open this post in threaded view
|

Re: SPI pinout in avrlibc

Aurélien Vallée
I create the mappings and submit the patch if necessary. Just want to be sure that’s the way to go.

On Wed, 21 Nov 2018 at 11:59 AM, Aurélien Vallée <[hidden email]> wrote:
I wondered if the SPI pinout is available somewhere in avrlibc headers. The reason is that I need some code initializing SPI that should be portable across AVRs with different pins for SPI, e.g. atmega328 and atmega2560.

It looks to me that these pins are partially mapped currently, as I can find things like:

/usr/avr/include/avr/iom324pa.h:#define MOSI_DDR   DDRB
/usr/avr/include/avr/iom324pa.h:#define MOSI_PORT  PORTB
/usr/avr/include/avr/iom324pa.h:#define MOSI_PIN   PINB
/usr/avr/include/avr/iom324pa.h:#define MOSI_BIT   5

But that does not seems to be defined for all cores.

Are these macros what I think they are?
Is it expected that they are not defined for all cores?
Should we map the missing ones?

--
Aurélien Vallée
Phone +33 9 77 19 85 61

_______________________________________________
AVR-GCC-list mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list