Sorry in advanced - I'm new here so I don't really know if this has been posted in the right place - so apologize if I've made any mistakes in asking this in the wrong place.
Basically - what I'm doing is converting USART0 into an SPI for the due. However the issue that I've run into is pretty basic. I don't know how to actually include the defines for the Sam3 chip, or even Atmel studio ext. (Sorry this is a basic question - but I'm really not familiar with the Arduino IDE - and I am using windows 10 so symbolic links are out of the question).
The exact code to do this more or less covered in this topic and was posted by [ard_newbie] - though it's just pointing it towards a different register group. The code is the conversion a little ways down in the post.
The code is this:
void USART0Init(void) { // SPI Master
// Output lines driven by the peripheral (MOSI, CS, SCK)
PIOB->PIO_PDR |= PIO_PB25A_RTS0; // CS
PIOA->PIO_PDR |= PIO_PA17B_SCK0 // SCK
| PIO_PA11A_TXD0; // MOSI
PIOA->PIO_ABSR |= PIO_PA17B_SCK0; // Peripheral type B
// USART0 SPI Master
PMC->PMC_PCER0 |= PMC_PCER0_PID17; // USART0 power ON
USART0->US_MR |= US_MR_USART_MODE_SPI_MASTER
| US_MR_CPOL // CPOL = 1
| US_MR_CPHA // CPHA = 1
| US_MR_CHRL_8_BIT
| US_MR_CLKO;
USART0->US_BRGR = US_BRGR_CD(6); // Baud rate = 84MHz/6 = 14 MHz < 20 MHz
USART0->US_CR = US_CR_RXEN // Enable Receiver and Transmitter
| US_CR_TXEN;
}
I know that define tree comes from specifically the #include <component_pdc.h> and the <component_usart.h> that are found in atmel studio, and it's basic and straight forward. However the issue is I have no idea how to point my IDE towards this folder - or even the proper way to do it - or even if I should (the question is so simple that it's probably common sense in the community - so I've been unable to find how to actually do it).
obviously there's the brute force way of copy/pasting everything over to the libraries folder, however I'd like to avoid that if at all possible - and I'm sure that the community already has a library or something that handles this.
Basically - how do I include the standard defines for the hardware into the IDE in the proper way?