Yanni Coroneos
/
mbed_4396_test
bleh
main.cpp
- Committer:
- sandwich
- Date:
- 2015-11-15
- Revision:
- 0:256c7510d40e
File content as of revision 0:256c7510d40e:
#include "mbed.h" SPI spi(p5, p6, p7); // mosi, miso, sclk DigitalOut cs(p8); DigitalOut pdn(p9); DigitalOut myled(LED1); uint16_t control_2=0b0010000110011010; uint16_t control_1_rst=0b0010000010001110; uint16_t control_1_running=0b0010000010001111; int main() { // Chip must be deselected cs = 1; pdn=0; //power down wait_ms(1); pdn=1; wait_ms(1); // Setup the spi for 16 bit data, high steady state clock, // second edge capture, with a 1MHz clock rate spi.format(16,3); spi.frequency(9600); //while (1) // { // Select the device by seting chip select low cs = 0; // turn on zero_detect spi.write(control_2); // Deselect the device cs = 1; wait_ms(1); cs=0; spi.write(control_1_rst); cs=1; wait_ms(1); cs=0; spi.write(control_1_running); cs=1; wait_ms(1); //} while(1) { myled = 1; wait(0.2); myled = 0; wait(0.2); } }