File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -39,13 +39,13 @@ uint32_t MT6835::readRawAngle21(){
3939 data[3 ] = 0 ;
4040 data[4 ] = 0 ;
4141 data[5 ] = 0 ;
42+ spi->beginTransaction (settings);
4243 if (nCS >= 0 )
4344 digitalWrite (nCS, LOW);
44- spi->beginTransaction (settings);
4545 spi->transfer (data, 6 );
46- spi->endTransaction ();
4746 if (nCS >= 0 )
4847 digitalWrite (nCS, HIGH);
48+ spi->endTransaction ();
4949 laststatus = data[4 ]&0x07 ;
5050 return (data[2 ] << 13 ) | (data[3 ] << 5 ) | (data[4 ] >> 3 );
5151};
@@ -252,13 +252,13 @@ uint32_t swap_bytes(uint32_t net)
252252
253253void MT6835::transfer24 (MT6835Command* outValue) {
254254 uint32_t buff = swap_bytes (outValue->val );
255+ spi->beginTransaction (settings);
255256 if (nCS >= 0 )
256257 digitalWrite (nCS, LOW);
257- spi->beginTransaction (settings);
258258 spi->transfer (&buff, 3 );
259- spi->endTransaction ();
260259 if (nCS >= 0 )
261260 digitalWrite (nCS, HIGH);
261+ spi->endTransaction ();
262262 outValue->val = swap_bytes (buff);
263263};
264264uint8_t MT6835::readRegister (uint16_t reg) {
You can’t perform that action at this time.
0 commit comments