Test program for LS7366 expansion board for the WSE SBC for quad encoder interfaces. Uses the LS7366LIB device class.
mbed WSE SBC LS7366 quadrature encoder interface expansion board using the LS7366LIB library
This printed circuit board connects 2 LS7366 SPI encoder interface IC's to the mbed WSE SBC. The LS7366LIB library allows the user to instantiate encoder objects with chip selects on p27 and p28 to expand the two encoder interfaces on the WSE SBC to 4.
main.cpp@0:58fb3f040295, 2014-12-10 (annotated)
- Committer:
- jebradshaw
- Date:
- Wed Dec 10 13:53:41 2014 +0000
- Revision:
- 0:58fb3f040295
mbed WSE SBC encoder expansion board using LS7366LIB device class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jebradshaw | 0:58fb3f040295 | 1 | // Test program for WSE-PROJ-SBC encoder expander board |
jebradshaw | 0:58fb3f040295 | 2 | // J Bradshaw 2014-12-10 |
jebradshaw | 0:58fb3f040295 | 3 | #include "mbed.h" |
jebradshaw | 0:58fb3f040295 | 4 | #include "LS7366.h" |
jebradshaw | 0:58fb3f040295 | 5 | |
jebradshaw | 0:58fb3f040295 | 6 | SPI spi(p5, p6, p7); |
jebradshaw | 0:58fb3f040295 | 7 | LS7366 enc1(spi, p19); |
jebradshaw | 0:58fb3f040295 | 8 | LS7366 enc2(spi, p20); |
jebradshaw | 0:58fb3f040295 | 9 | LS7366 enc3(spi, p28); |
jebradshaw | 0:58fb3f040295 | 10 | LS7366 enc4(spi, p27); |
jebradshaw | 0:58fb3f040295 | 11 | Serial pc(USBTX, USBRX); // tx, rx for serial USB interface to pc |
jebradshaw | 0:58fb3f040295 | 12 | |
jebradshaw | 0:58fb3f040295 | 13 | //------------------- MAIN -------------------------------- |
jebradshaw | 0:58fb3f040295 | 14 | int main() |
jebradshaw | 0:58fb3f040295 | 15 | { |
jebradshaw | 0:58fb3f040295 | 16 | while(1){ |
jebradshaw | 0:58fb3f040295 | 17 | pc.printf("enc1 = %ld enc2 = %ld enc3 = %ld enc4 = %ld\r\n",enc1.read(), enc2.read(),enc3.read(), enc4.read()); |
jebradshaw | 0:58fb3f040295 | 18 | wait(.02); |
jebradshaw | 0:58fb3f040295 | 19 | }//while(1) |
jebradshaw | 0:58fb3f040295 | 20 | }//main |