mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
mcp2515 C examples: add default config for Arduino 101
Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
parent
e765dcf57b
commit
6a4f06d51b
@ -64,7 +64,15 @@ int main(int argc, char **argv)
|
|||||||
// able to transmit a message.
|
// able to transmit a message.
|
||||||
|
|
||||||
// Instantiate a MCP2515 on SPI bus 0 using a hw CS pin (-1).
|
// Instantiate a MCP2515 on SPI bus 0 using a hw CS pin (-1).
|
||||||
|
|
||||||
|
#if defined(CONFIG_BOARD_ARDUINO_101)
|
||||||
|
// ARDUINO_101 (Quark core) where you must use SPI
|
||||||
|
// Instantiate a MCP2515 instance using default SPI bus and pin 10 as CS
|
||||||
|
mcp2515_context sensor = mcp2515_init(0, 10);
|
||||||
|
#else
|
||||||
|
// Instantiate a MCP2515 on SPI bus 0 using a hw CS pin (-1).
|
||||||
mcp2515_context sensor = mcp2515_init(0, -1);
|
mcp2515_context sensor = mcp2515_init(0, -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!sensor)
|
if (!sensor)
|
||||||
{
|
{
|
||||||
|
@ -31,8 +31,14 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
|
|
||||||
|
#if defined(CONFIG_BOARD_ARDUINO_101)
|
||||||
|
// ARDUINO_101 (Quark core) where you must use SPI
|
||||||
|
// Instantiate a MCP2515 instance using default SPI bus and pin 10 as CS
|
||||||
|
mcp2515_context sensor = mcp2515_init(0, 10);
|
||||||
|
#else
|
||||||
// Instantiate a MCP2515 on SPI bus 0 using a hw CS pin (-1).
|
// Instantiate a MCP2515 on SPI bus 0 using a hw CS pin (-1).
|
||||||
mcp2515_context sensor = mcp2515_init(0, -1);
|
mcp2515_context sensor = mcp2515_init(0, -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!sensor)
|
if (!sensor)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user