mirror of
https://github.com/whowechina/chu_pico.git
synced 2024-11-11 22:47:09 +01:00
Fix minor buffer over read issue
This commit is contained in:
parent
2452fcc480
commit
8f37d9f991
Binary file not shown.
@ -189,10 +189,10 @@ void mpr121_filter(uint8_t addr, uint8_t ffi, uint8_t sfi, uint8_t esi)
|
||||
mpr121_resume(addr, ecr);
|
||||
}
|
||||
|
||||
void mpr121_sense(uint8_t addr, int8_t sense, int8_t *sense_keys)
|
||||
void mpr121_sense(uint8_t addr, int8_t sense, int8_t *sense_keys, int num)
|
||||
{
|
||||
uint8_t ecr = mpr121_stop(addr);
|
||||
for (int i = 0; i < 12; i++) {
|
||||
for (int i = 0; (i < num) && (i < 12); i++) {
|
||||
int8_t delta = sense + sense_keys[i];
|
||||
write_reg(addr, MPR121_TOUCH_THRESHOLD_REG + i * 2,
|
||||
TOUCH_THRESHOLD_BASE - delta);
|
||||
|
@ -12,7 +12,7 @@ void mpr121_init(uint8_t addr);
|
||||
uint16_t mpr121_touched(uint8_t addr);
|
||||
void mpr121_raw(uint8_t addr, uint16_t *raw, int num);
|
||||
void mpr121_filter(uint8_t addr, uint8_t ffi, uint8_t sfi, uint8_t esi);
|
||||
void mpr121_sense(uint8_t addr, int8_t sense, int8_t *sense_keys);
|
||||
void mpr121_sense(uint8_t addr, int8_t sense, int8_t *sense_keys, int num);
|
||||
void mpr121_debounce(uint8_t addr, uint8_t touch, uint8_t release);
|
||||
|
||||
#endif
|
||||
|
@ -94,7 +94,8 @@ void slider_update_config()
|
||||
mpr121_debounce(MPR121_ADDR + m, chu_cfg->sense.debounce_touch,
|
||||
chu_cfg->sense.debounce_release);
|
||||
mpr121_sense(MPR121_ADDR + m, chu_cfg->sense.global,
|
||||
chu_cfg->sense.keys + m * 12);
|
||||
chu_cfg->sense.keys + m * 12,
|
||||
m != 2 ? 12 : 8);
|
||||
mpr121_filter(MPR121_ADDR + m, chu_cfg->sense.filter >> 6,
|
||||
(chu_cfg->sense.filter >> 4) & 0x03,
|
||||
chu_cfg->sense.filter & 0x07);
|
||||
|
Loading…
Reference in New Issue
Block a user