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.
Fork of mbed-dev by
Diff: drivers/SPISlave.cpp
- Revision:
- 187:0387e8f68319
- Parent:
- 149:156823d33999
--- a/drivers/SPISlave.cpp Fri Jun 22 16:45:37 2018 +0100
+++ b/drivers/SPISlave.cpp Thu Sep 06 13:40:20 2018 +0100
@@ -24,32 +24,37 @@
_bits(8),
_mode(0),
_hz(1000000)
- {
+{
spi_init(&_spi, mosi, miso, sclk, ssel);
spi_format(&_spi, _bits, _mode, 1);
spi_frequency(&_spi, _hz);
}
-void SPISlave::format(int bits, int mode) {
+void SPISlave::format(int bits, int mode)
+{
_bits = bits;
_mode = mode;
spi_format(&_spi, _bits, _mode, 1);
}
-void SPISlave::frequency(int hz) {
+void SPISlave::frequency(int hz)
+{
_hz = hz;
spi_frequency(&_spi, _hz);
}
-int SPISlave::receive(void) {
- return(spi_slave_receive(&_spi));
+int SPISlave::receive(void)
+{
+ return (spi_slave_receive(&_spi));
}
-int SPISlave::read(void) {
- return(spi_slave_read(&_spi));
+int SPISlave::read(void)
+{
+ return (spi_slave_read(&_spi));
}
-void SPISlave::reply(int value) {
+void SPISlave::reply(int value)
+{
spi_slave_write(&_spi, value);
}
