Fix and test I2C/Wire, works now

This commit is contained in:
Earle F. Philhower, III 2021-03-12 17:39:57 -08:00
parent 42347d6bdc
commit f785f360a9
3 changed files with 7 additions and 4 deletions

View file

@ -25,10 +25,11 @@ python3 ./get.py
`````
Lots of things are working now!
* digitalWrite/Read
* shiftIn/Out (tested using Nokia5110 https://github.com/ionpan/Nokia5110.git)
* SPI/Wire (tested using SdFat 2.0 https://github.com/greiman/SdFat.git ... note that the Pico voltage regulator can't reliably supply enough power for a SD Card so use external power)
* digitalWrite/Read (basic sanity tested)
* shiftIn/Out (tested using Nokia5110 https://github.com/ionpan/Nokia5110)
* SPI (tested using SdFat 2.0 https://github.com/greiman/SdFat ... note that the Pico voltage regulator can't reliably supply enough power for a SD Card so use external power)
* analogWrite/PWM (tested using Fade.ino)
* Wire/I2C (tested using DS3231 https://github.com/rodan/ds3231)
If you want to contribute or have bugfixes, drop me a note at <earlephilhower@yahoo.com> or open an issue/PR here.

View file

@ -22,9 +22,9 @@
*/
#include <Arduino.h>
#include "Wire.h"
#include <hardware/gpio.h>
#include <hardware/i2c.h>
#include "Wire.h"
TwoWireRP2040::TwoWireRP2040(i2c_inst_t *i2c, pin_size_t sda, pin_size_t scl) {
_sda = sda;
@ -169,6 +169,7 @@ size_t TwoWireRP2040::requestFrom(uint8_t address, size_t quantity, bool stopBit
size_t byteRead = 0;
_buffLen = i2c_read_blocking(_i2c, address, _buff, quantity, !stopBit);
_buffOff = 0;
return _buffLen;
}

View file

@ -24,6 +24,7 @@
#ifndef TwoWire_h
#define TwoWire_h
#include <Arduino.h>
#include "api/HardwareI2C.h"
#include <hardware/i2c.h>