Karl Urban
/
SPI_setup_practice
WORK please
main.cpp@0:b183b7569045, 2020-10-05 (annotated)
- Committer:
- kurba005
- Date:
- Mon Oct 05 22:06:06 2020 +0000
- Revision:
- 0:b183b7569045
hoping this works, can not view documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kurba005 | 0:b183b7569045 | 1 | /* Program Example: Set up the mbed as SPI master*/ |
kurba005 | 0:b183b7569045 | 2 | |
kurba005 | 0:b183b7569045 | 3 | #include "mbed.h" |
kurba005 | 0:b183b7569045 | 4 | SPI ser_port(p11, p12, p13); // mosi, miso, sclk |
kurba005 | 0:b183b7569045 | 5 | char switch_word; //word we will send |
kurba005 | 0:b183b7569045 | 6 | |
kurba005 | 0:b183b7569045 | 7 | int main() |
kurba005 | 0:b183b7569045 | 8 | { |
kurba005 | 0:b183b7569045 | 9 | |
kurba005 | 0:b183b7569045 | 10 | ser_port.format(12,1); // Setup the SPI for 12 bit data, Mode 1 operation |
kurba005 | 0:b183b7569045 | 11 | ser_port.frequency(4000000); // Clock frequency is 4MHz |
kurba005 | 0:b183b7569045 | 12 | } |