jswrap_spi_i2c.h 1.0 KB

123456789101112131415161718192021222324
  1. /*
  2. * This file is part of Espruino, a JavaScript interpreter for Microcontrollers
  3. *
  4. * Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
  5. *
  6. * This Source Code Form is subject to the terms of the Mozilla Public
  7. * License, v. 2.0. If a copy of the MPL was not distributed with this
  8. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  9. *
  10. * ----------------------------------------------------------------------------
  11. * JavaScript SPI and I2C Functions
  12. * ----------------------------------------------------------------------------
  13. */
  14. #include "jsvar.h"
  15. #include "jspin.h"
  16. void jswrap_spi_setup(JsVar *parent, JsVar *options);
  17. JsVar *jswrap_spi_send(JsVar *parent, JsVar *data, Pin nss_pin);
  18. void jswrap_spi_send4bit(JsVar *parent, JsVar *srcdata, int bit0, int bit1, Pin nss_pin);
  19. void jswrap_spi_send8bit(JsVar *parent, JsVar *srcdata, int bit0, int bit1, Pin nss_pin);
  20. void jswrap_i2c_setup(JsVar *parent, JsVar *options);
  21. void jswrap_i2c_writeTo(JsVar *parent, int address, JsVar *data);
  22. JsVar *jswrap_i2c_readFrom(JsVar *parent, int address, int nBytes);