tenbaht / sduino

An Arduino-like programming API for the STM8
http://tenbaht.github.io/sduino/
GNU Lesser General Public License v2.1
349 stars 213 forks source link

SPI library #110

Closed kriswiner closed 3 years ago

kriswiner commented 3 years ago

On the README frontpage is mentioned hardware SPI but I don;t see an SPI.h/SPI.cc library in the latest release. Is such a library necessary (I would think so)? And do you have an example of using hardware SPI with the S103F? Thanks...

Edit: I found an SPI.c file in ./test. If this works then I can figure out how to use SPI.

tenbaht commented 3 years ago

The SPI library is part of the core files in sduino/stm8/cores/sduino A simple #include "SPI.h" is enough to use it. And you are right, there is no proper SPI example except for the one you already found. I am open for suggestions. Is there any common SPI device that could be used for a demonstration?

kriswiner commented 3 years ago

PMW3901 https://www.tindie.com/products/onehorse/pmw3901-optical-flow-sensor/ is a good SPI sensor for an example. Once I get my boards from China I will give it a try.

On Tue, Oct 13, 2020 at 1:33 PM Michael Mayer notifications@github.com wrote:

The SPI library is part of the core files in sduino/stm8/cores/sduino A simple #include "SPI.h" is enough to use it. And you are right, there is no proper SPI example except for the one you already found. I am open for suggestions. Is there any common SPI device that could be used for a demonstration?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tenbaht/sduino/issues/110#issuecomment-707992558, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKQQWC5HLMVDTQDT3K3SKS2P5ANCNFSM4SA3YBXA .

tenbaht commented 3 years ago

Oh, nice sensor. But not very common, I am afraid. The most common thing I can think of are displays like the classic Nokia 5110. But they require quite complex communication before they can do anything useful - not so good for a compact example. The PCD8544 library includes some examples, but it uses bitbanged SPI instead of the real thing.

kriswiner commented 3 years ago

The PMW3901 is used by bitcraze in their CrazyFlie offering, and both Sparkfun and Adafruit have breakout I believe. So not too uncommon...

On Tue, Oct 13, 2020 at 1:50 PM Michael Mayer notifications@github.com wrote:

Oh, nice sensor. But not very common, I am afraid. The most common thing I can think of are displays like the classic Nokia 5110. But they require quite complex communication before they can do anything useful - not so good for a compact example. The PCD8544 library includes some examples, but it uses bitbanged SPI instead of the real thing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tenbaht/sduino/issues/110#issuecomment-708001131, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKQ7T6QTGLXUEWS2LHLSKS4QDANCNFSM4SA3YBXA .