Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
spi.h
- Committer:
- bfotak
- Date:
- 2020-06-08
- Revision:
- 4:e360384c268b
File content as of revision 4:e360384c268b:
//master program
SPI spi_port(D11, D12, D13); // mosi, miso, sclk
DigitalOut ss(D10); //slave select pin
Serial pc(USBTX, USBRX);
int main()
{
char podatak;
int i = 0;
led = 0;
int vrijeme = 0.005;
spi_port.format(8,1); // 8 bitni okvir, mod rada 0
spi_port.frequency(1000000); // frekvencija takta 1MHz
while (1) {
ss = 1; //digni SS pin u jedinici, aktivan je u jedinici (oznaci slave)
podatak = spi_port.write(0xFF & i); //posalji podatak
ss = 0; //spusti SS pin u nulu (odznaci slave)
wait(vrijeme);
}
}