test4

Dependencies:   mbed BufferedSerial LS7366LIB2 FastPWM

Committer:
lsh3146
Date:
Tue Dec 08 01:25:06 2020 +0000
Revision:
4:bf278ddb8504
Parent:
0:7cff999a7f5c
aaaaaqqqqq

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gohgwaja 0:7cff999a7f5c 1 #ifndef _SPI_SETUP_H_
gohgwaja 0:7cff999a7f5c 2 #define _SPI_SETUP_H_
gohgwaja 0:7cff999a7f5c 3
gohgwaja 0:7cff999a7f5c 4 #include "LS7366.h"
gohgwaja 0:7cff999a7f5c 5
gohgwaja 0:7cff999a7f5c 6 SPI spi1(SPI_MOSI, SPI_MISO, SPI_SCK);
gohgwaja 0:7cff999a7f5c 7
gohgwaja 0:7cff999a7f5c 8 LS7366 encoder1(spi1, ENCODER_CS1);
gohgwaja 0:7cff999a7f5c 9 LS7366 encoder2(spi1, ENCODER_CS2);
gohgwaja 0:7cff999a7f5c 10 LS7366 encoder3(spi1, ENCODER_CS3);
gohgwaja 0:7cff999a7f5c 11 LS7366 encoder4(spi1, ENCODER_CS4);
gohgwaja 0:7cff999a7f5c 12 LS7366 encoder5(spi1, ENCODER_CS5);
gohgwaja 0:7cff999a7f5c 13 LS7366 encoder6(spi1, ENCODER_CS6);
gohgwaja 0:7cff999a7f5c 14 DigitalOut at_spi_cs(PB_4);
gohgwaja 0:7cff999a7f5c 15 DigitalOut st16_spi_cs(PB_5);
gohgwaja 0:7cff999a7f5c 16
gohgwaja 0:7cff999a7f5c 17 DigitalOut seg_cs(PA_0);
gohgwaja 0:7cff999a7f5c 18 DigitalOut btn1_cs(PA_11);
gohgwaja 0:7cff999a7f5c 19 DigitalOut btn2_cs(PA_12);
gohgwaja 0:7cff999a7f5c 20
gohgwaja 0:7cff999a7f5c 21
gohgwaja 0:7cff999a7f5c 22
gohgwaja 0:7cff999a7f5c 23 void spi_init()
gohgwaja 0:7cff999a7f5c 24 {
gohgwaja 0:7cff999a7f5c 25 spi1.format(8,0);
gohgwaja 0:7cff999a7f5c 26 spi1.frequency(2000000);
gohgwaja 0:7cff999a7f5c 27 seg_cs = 0;
gohgwaja 0:7cff999a7f5c 28 btn1_cs = 0;
gohgwaja 0:7cff999a7f5c 29 btn2_cs = 0;
gohgwaja 0:7cff999a7f5c 30 }
gohgwaja 0:7cff999a7f5c 31
gohgwaja 0:7cff999a7f5c 32 #endif