diff --git a/prosjekt.X/i2c.c b/prosjekt.X/i2c.c index 43f65ab..aff2ac4 100644 --- a/prosjekt.X/i2c.c +++ b/prosjekt.X/i2c.c @@ -53,6 +53,11 @@ void i2c_reset_recv() { void i2c_write_handler(uint8_t data) { last_action_write = true; + + // Validate that we are not overflowing the buffer + if (i2c_recv_len >= I2C_RECV_BUF_SIZE) { return; } + + // Write the data to the receive buffer i2c_recv[i2c_recv_len] = data; i2c_recv_len++; } diff --git a/prosjekt.X/nbproject/configurations.xml b/prosjekt.X/nbproject/configurations.xml index 22bd261..af7016b 100644 --- a/prosjekt.X/nbproject/configurations.xml +++ b/prosjekt.X/nbproject/configurations.xml @@ -42,7 +42,7 @@ nEdbgTool XC8 - 2.45 + 2.46 2