kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Fix AS7262 constructor and example
rodzic
66f6983290
commit
0bda2abd2a
|
@ -79,12 +79,12 @@ namespace pimoroni {
|
||||||
// Constructors/Destructor
|
// Constructors/Destructor
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public:
|
public:
|
||||||
AS7262(uint8_t address = DEFAULT_I2C_ADDRESS, uint interrupt = PIN_UNUSED) : AS7262(new I2C(), address, interrupt) {};
|
AS7262(uint interrupt = PIN_UNUSED) : AS7262(new I2C(), interrupt) {};
|
||||||
|
|
||||||
AS7262(I2C *i2c, uint8_t address = DEFAULT_I2C_ADDRESS, uint interrupt = PIN_UNUSED) : i2c(i2c), address(address), interrupt(interrupt) {}
|
AS7262(I2C *i2c, uint interrupt = PIN_UNUSED) : i2c(i2c), interrupt(interrupt) {}
|
||||||
|
|
||||||
// TODO remove MicroPython-binding compatibility constructors
|
// TODO remove MicroPython-binding compatibility constructors
|
||||||
AS7262(uint8_t address, uint sda, uint scl, uint interrupt = PIN_UNUSED) : AS7262(new I2C(), address, interrupt) {}
|
AS7262(uint sda, uint scl, uint interrupt = PIN_UNUSED) : AS7262(new I2C(), interrupt) {}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from pimoroni_i2c import PimoroniI2C
|
||||||
from breakout_as7262 import BreakoutAS7262
|
from breakout_as7262 import BreakoutAS7262
|
||||||
import picoexplorer as display
|
import picoexplorer as display
|
||||||
import time
|
import time
|
||||||
|
@ -11,7 +12,8 @@ bar_height = height
|
||||||
display_buffer = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)
|
display_buffer = bytearray(width * height * 2) # 2-bytes per pixel (RGB565)
|
||||||
display.init(display_buffer)
|
display.init(display_buffer)
|
||||||
|
|
||||||
as7 = BreakoutAS7262()
|
i2c = PimoroniI2C(20, 21)
|
||||||
|
as7 = BreakoutAS7262(i2c)
|
||||||
|
|
||||||
integration_time = 10 # integration time in milliseconds, max ~90ms
|
integration_time = 10 # integration time in milliseconds, max ~90ms
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue