summaryrefslogtreecommitdiff
path: root/components/external/espruino/src/jswrap_spi_i2c.h
blob: d9326d86493f5bdb2643b4a0c2634daf7ecd2623 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * This file is part of Espruino, a JavaScript interpreter for Microcontrollers
 *
 * Copyright (C) 2013 Gordon Williams <[email protected]>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * ----------------------------------------------------------------------------
 * JavaScript SPI and I2C Functions
 * ----------------------------------------------------------------------------
 */
#include "jsvar.h"
#include "jspin.h"

void jswrap_spi_setup(JsVar *parent, JsVar *options);
JsVar *jswrap_spi_send(JsVar *parent, JsVar *data, Pin nss_pin);
void jswrap_spi_send4bit(JsVar *parent, JsVar *srcdata, int bit0, int bit1, Pin nss_pin);
void jswrap_spi_send8bit(JsVar *parent, JsVar *srcdata, int bit0, int bit1, Pin nss_pin);

void jswrap_i2c_setup(JsVar *parent, JsVar *options);
void jswrap_i2c_writeTo(JsVar *parent, int address, JsVar *data);
JsVar *jswrap_i2c_readFrom(JsVar *parent, int address, int nBytes);