mirror of
https://github.com/whowechina/mai_pico.git
synced 2024-11-11 23:27:10 +01:00
Fix: Use dependent buffer as readout buffer, then copy to readout array
This commit is contained in:
parent
1db54985c6
commit
ef7336734c
@ -6,8 +6,8 @@
|
||||
#if defined BOARD_MAI_PICO
|
||||
|
||||
#define I2C_PORT i2c1
|
||||
#define I2C_SDA 6
|
||||
#define I2C_SCL 7
|
||||
#define I2C_SDA 16
|
||||
#define I2C_SCL 17
|
||||
#define I2C_FREQ 400*1000
|
||||
|
||||
#define RGB_PIN 13
|
||||
|
@ -156,10 +156,13 @@ bool touch_sensor_ok(unsigned i)
|
||||
const uint16_t *touch_raw()
|
||||
{
|
||||
static uint16_t readout[36] = {0};
|
||||
// Do not use readout as buffer directly, update readout with buffer when operation finishes
|
||||
uint16_t buf[36] = {0};
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
sensor_ok[i] = mpr121_raw(MPR121_BASE_ADDR + i, readout + i * 12, 12);
|
||||
sensor_ok[i] = mpr121_raw(MPR121_BASE_ADDR + i, buf + i * 12, 12);
|
||||
}
|
||||
memcpy(readout, buf, sizeof(readout));
|
||||
|
||||
return readout;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user