You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
1.7 KiB
98 lines
1.7 KiB
#include "main.h"
|
|
#include "delay.h"
|
|
#include "deviceSetup.h"
|
|
#include "usart.h"
|
|
#include "ascii.h"
|
|
#include "timer.h"
|
|
#include "spi.h"
|
|
#include "max7219.h"
|
|
#include "ad9833.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
uint8_t i = 0;
|
|
uint8_t j = 0;
|
|
|
|
spi_ch_t spi_test_channel;
|
|
|
|
// making array with all available timers
|
|
delayInitMs(8000000, 1000); // Clock Freq and Divider for ARM library
|
|
|
|
pinConfig(pinB3, output, pushPull, output, def_speed);
|
|
pinConfig(pinA0, input, def_stage, pullDown, def_speed);
|
|
|
|
setupInit(); // This is the sescond call of System init the assebly start code is calling it before the main.
|
|
|
|
|
|
usartInit( usart2,
|
|
pinA2,
|
|
pinA15,
|
|
115200,
|
|
eight,
|
|
NO_PARITY_CTRL,
|
|
noFlowControl);
|
|
|
|
//clears screen and send the wellcome messgae
|
|
print_Usart(usart2, ASCII_clear);
|
|
print_Usart(usart2, "HEllooo to our KED project\n\r");
|
|
|
|
|
|
for(i = 0 ; i < 5 ; i++) {
|
|
delayMs(100);
|
|
pinToggle(pinB3);
|
|
delayMs(100);
|
|
}
|
|
|
|
pinWrite(pinB3,0);
|
|
|
|
pinInit(pinA3);
|
|
|
|
//pinConfig(pinA6, alternate, floating, pullDown, veryFast);
|
|
pinConfig(pinA3, output, pushPull, output, veryFast);
|
|
|
|
// spi hardware channel setup
|
|
spiInitMaster(SPI_CH_1,
|
|
SPI_NONINVERTED,
|
|
SPI_CAPTURE_ON_FIRST_CLK_TRANSITION,
|
|
SPI_MSB_FIRST,
|
|
SPI_DOUPLEX,
|
|
7,
|
|
pinA5,
|
|
0,
|
|
pinA7,
|
|
0,
|
|
pinA6,
|
|
0);
|
|
|
|
spiSetupCH(&spi_test_channel, SPI_CH_1, pinA3);
|
|
|
|
spiEnable(SPI_CH_1);
|
|
/*
|
|
* SPI hoockup for this example
|
|
*
|
|
* Signal pin nucleo
|
|
* --------------------------
|
|
* MOSI pinA7 A6
|
|
* MISO pinA6 A5
|
|
* CLK pinA5 A4
|
|
* CS pinA4 A3
|
|
*/
|
|
|
|
|
|
for(i = 0 ; i < 10 ; i++) {
|
|
delayMs(50);
|
|
pinToggle(pinB3);
|
|
delayMs(50);
|
|
}
|
|
|
|
|
|
while(1)
|
|
{
|
|
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
|