![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
FINAL PROJECT isn't it
Fork of ELEC351 by
Diff: main.cpp
- Revision:
- 57:aba1296e51b1
- Parent:
- 56:bc5345bc6650
--- a/main.cpp Mon Jul 16 10:51:47 2018 +0000 +++ b/main.cpp Wed Aug 15 21:34:59 2018 +0000 @@ -12,14 +12,28 @@ 5 = Green 6 = Yellow */ - -//Colours Cubelet_Colours_string[]; +int SPI_RX_DATA = 0; void Serial_Commands(){while(1){Serial_Commands_Output();}}//Enable Serial Commands void LED_Logging(){while(1){Log_Leds();}} //Flashes the yellow led to indicate the logging mode -void SPI_INTERFACE(){while(1){SPI_INTERFACE_SERIAL();}} //Outputs SPI data to serial - +//void SPI_INTERFACE(){while(1){SPI_INTERFACE_SERIAL();}} //Outputs SPI data to serial +void SPI_INTERFACE() +{ + //pc.printf("SPI Test \n"); + Thread::wait(1000); + while(1) + { + cs= 0; + SPI_RX_DATA = spi.write(0xF0); + wait_us(3); + cs= 1; + colour_data = SPI_RX_DATA; + if(Log_Value == 1){pc.printf("Received data = %d\n", SPI_RX_DATA);} + + Thread::wait(1000); + } +} void Motor_Control() { while(1) @@ -72,7 +86,8 @@ spi.format(16,1); // 8 Data bits phase 0 polarity 0 //CHECK THIS spi.frequency(1000000);//Output clock frequency 1Mhz //post(); //Power on Self Test - + memset(Move_list, 0, sizeof(Move_list)); + Move_list_pointer = 0; //Start Threads t1.start(Motor_Control); t2.start(SPI_INTERFACE);