test4
Dependencies: mbed BufferedSerial LS7366LIB2 FastPWM
Diff: spi_setup.h
- Revision:
- 0:7cff999a7f5c
diff -r 000000000000 -r 7cff999a7f5c spi_setup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spi_setup.h Mon May 11 08:47:18 2020 +0000 @@ -0,0 +1,32 @@ +#ifndef _SPI_SETUP_H_ +#define _SPI_SETUP_H_ + +#include "LS7366.h" + +SPI spi1(SPI_MOSI, SPI_MISO, SPI_SCK); + +LS7366 encoder1(spi1, ENCODER_CS1); +LS7366 encoder2(spi1, ENCODER_CS2); +LS7366 encoder3(spi1, ENCODER_CS3); +LS7366 encoder4(spi1, ENCODER_CS4); +LS7366 encoder5(spi1, ENCODER_CS5); +LS7366 encoder6(spi1, ENCODER_CS6); +DigitalOut at_spi_cs(PB_4); +DigitalOut st16_spi_cs(PB_5); + +DigitalOut seg_cs(PA_0); +DigitalOut btn1_cs(PA_11); +DigitalOut btn2_cs(PA_12); + + + +void spi_init() +{ + spi1.format(8,0); + spi1.frequency(2000000); + seg_cs = 0; + btn1_cs = 0; + btn2_cs = 0; +} + +#endif