Cristian Castro
/
Nucleo_spi_master
Uso del periférico SPI en modo Master.
main.cpp@0:54a0a19988e4, 2021-09-03 (annotated)
- Committer:
- CCastrop1012
- Date:
- Fri Sep 03 05:33:15 2021 +0000
- Revision:
- 0:54a0a19988e4
Uso del periferico SPI en modo Master
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CCastrop1012 | 0:54a0a19988e4 | 1 | #include "mbed.h" |
CCastrop1012 | 0:54a0a19988e4 | 2 | |
CCastrop1012 | 0:54a0a19988e4 | 3 | SPI device(SPI_MOSI, SPI_MISO, SPI_SCK); |
CCastrop1012 | 0:54a0a19988e4 | 4 | |
CCastrop1012 | 0:54a0a19988e4 | 5 | int main() { |
CCastrop1012 | 0:54a0a19988e4 | 6 | int i = 0; |
CCastrop1012 | 0:54a0a19988e4 | 7 | while(1) { |
CCastrop1012 | 0:54a0a19988e4 | 8 | device.write(0x55); |
CCastrop1012 | 0:54a0a19988e4 | 9 | device.write(i++); |
CCastrop1012 | 0:54a0a19988e4 | 10 | device.write(0xE0); |
CCastrop1012 | 0:54a0a19988e4 | 11 | wait_us(50); |
CCastrop1012 | 0:54a0a19988e4 | 12 | } |
CCastrop1012 | 0:54a0a19988e4 | 13 | } |
CCastrop1012 | 0:54a0a19988e4 | 14 |