File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 11
22#include " ./SC60228.h"
3-
3+ # include " Arduino.h "
44
55SC60228::SC60228 (SPISettings settings, int nCS) : settings(settings), nCS(nCS) {
66 // nix
@@ -13,6 +13,7 @@ void SC60228::init(SPIClass* _spi) {
1313 if (nCS>=0 )
1414 pinMode (nCS, OUTPUT);
1515 digitalWrite (nCS, HIGH);
16+ delay (1 );
1617 spi->begin ();
1718 readRawAngle ();
1819};
@@ -41,15 +42,15 @@ bool SC60228::isError() {
4142
4243uint16_t SC60228::spi_transfer16 (uint16_t outdata){
4344 uint16_t result;
45+ spi->beginTransaction (settings);
4446 if (nCS>=0 )
4547 digitalWrite (nCS, LOW);
4648 // min delay here: 250ns
47- spi->beginTransaction (settings);
4849 result = spi->transfer16 (outdata);
4950 // min delay here: clock period / 2
50- spi->endTransaction ();
5151 if (nCS>=0 )
5252 digitalWrite (nCS, HIGH);
53+ spi->endTransaction ();
5354 // min delay until next read: 250ns
5455 return result;
5556};
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ typedef union {
2121#define SC60228_CPR 4096
2222#define SC60228_BITORDER MSBFIRST
2323
24- static SPISettings SC60228SPISettings (8000000 , SC60228_BITORDER, SPI_MODE0 ); // @suppress("Invalid arguments")
24+ static SPISettings SC60228SPISettings (8000000 , SC60228_BITORDER, SPI_MODE1 ); // @suppress("Invalid arguments")
2525
2626
2727
You can’t perform that action at this time.
0 commit comments