Comments (4)
You must handle CS just like hardware SPI. You can have multiple devices with different CS pins. They must all use the same SPI mode.
You only need transfer(). It works like hardware transfer().
spi.send(data);
// same as this transfer call but maybe a bit faster.
spi.transfer(data);
data = spi.receive();
// same as this transfer call but maybe a bit faster.
data = spi.transfer(0xff);
from digitalio.
Hi. Thanks for getting back to me. Did what you said this morning with the transfers just like normal SPI and it worked. Got confused when looking at the example (and working late at night). Now I am trying to get it work from within a 9250 library.
I declared the SoftSPI as spi in the main sketch but now getting spi not defined errors from within the library. How do I get it work? Any ideas. Here's the exact error
`C:\Users\CyberPalin\Documents\Arduino\libraries\MPU9250SPI\mpu9250_spi.cpp: In member function 'unsigned int mpu9250_spi::WriteReg(uint8_t, uint8_t)':
C:\Users\CyberPalin\Documents\Arduino\libraries\MPU9250SPI\mpu9250_spi.cpp:24:3: error: 'spi' was not declared in this scope
spi.transfer(WriteAddr);`
Thanks
Mike
from digitalio.
Modifying a library to work with SoftSPI may not be easy. I can't guess about the structure of your 9250 library.
I really don't have time to help you convert a library from hardware SPI to SoftSPI.
A first step is to add an extern statement to the library.
If spi is define in your sketch like this:
#include "DigitalIO.h"
SoftSPI<7, 8, 9, 0> spi;
You will need something like this to define spi in the library.
#include "DigitalIO.h"
extern SoftSPI<7, 8, 9, 0> spi;
Good luck, sorry I don't have time to help more.
from digitalio.
Bill appreciate any help. Really wasn't looking for you to convert the library, I got that one. Just didn't know how to do the referencing. Think I can go from there.
Thanks again
Mike
UPDATE: Just to let you know I added the extern statement to the library (already did the other part of the conversion :) ) and it work perfectly.
Thanks again.
from digitalio.
Related Issues (9)
- Arduino - DigitalIO Library conflicts with SD Library HOT 6
- i cannot use this code with stm32duino HOT 1
- Please add support for Nano Every (ATmega4809) HOT 1
- Please Add Support to Atmega8 & Atmega8A HOT 2
- compile failure for rp2040 HOT 3
- NoInterrupt without Interrupt() in begin in softwarei2c.cpp HOT 2
- Library manager support. HOT 3
- PlatformIO build fails on espressif8266 platform HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from digitalio.