;SPI test example
;Tested using CY3214 - PSoC Eval USB REV B board with CY8C24894-24LXFI
;Pin Description:
;  Port2[0] - LED1
;  Port2[1] - LED2
;  Port2[2] - LED3
;  Port2[3] - LED4
;  Port0[0] - Button1(S1)
;  Port0[1] - Button2(S2)
;  Port0[4] - Potentiometer 2 (VR2)
;  Port0[5] - Potentiometer 1 (VR1)
;  Port4    - LCD

;--->Protocol Configuration Settings
; Shift Direction: MSB First
; Mode: 00
; Frequency: 1 MHz

;--->Print message on LCD
; 0x10 - command byte
; Command prints message on the LCD screen
; 0x00 - LCD row position
; 0x01 - LCD collumn position
spi 10 0 1 "Hello from BCP"

;--->Reads voltage values of potentiometer 1,2 into Var1 and Var2
; Shows these values on the Chart component

; 0x30 - command byte
; Command calculate voltage values for potentiometer 1,2 and save these 
; values in slave tx_buffer
; Also, updates button s1/s2 values in slave tx_buffer

; 0x40 command byte
; Command reads values from slave tx_buffer in to Var1 and Var2
; Then shows these values in the chart component
spi 30 p [delay=4] spi 40:@0Var1 @1Var1 @0Var2 @1Var2 x x p

;--->Switch LEDs 1,2,3,4 On/Off
; 0x20 command byte
; After command byte, follows LED number and 
; LED value (0 - Off, 1 - On) for each LEDs

; LED 1 On, LEDs 2,3,4 OFF
spi 20 1 1 2 0 3 0 4 0 p [delay=200]
; LED 2 On, LEDs 1,3,4 OFF
spi 20 1 0 2 1 3 0 4 0 p [delay=200]
; LED 3 On, LEDs 1,2,4 OFF
spi 20 1 0 2 0 3 1 4 0 p [delay=200]
; LED 4 On, LEDs 1,2,3 OFF
spi 20 1 0 2 0 3 0 4 1 p [delay=200]