1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Statically allocating buffers in Wire library (issue #351).

This commit is contained in:
David A. Mellis
2010-09-16 00:50:43 +00:00
parent 27cfd22066
commit bf88db8484
3 changed files with 7 additions and 16 deletions

View File

@ -28,12 +28,12 @@ extern "C" {
// Initialize Class Variables //////////////////////////////////////////////////
uint8_t* TwoWire::rxBuffer = 0;
uint8_t TwoWire::rxBuffer[BUFFER_LENGTH];
uint8_t TwoWire::rxBufferIndex = 0;
uint8_t TwoWire::rxBufferLength = 0;
uint8_t TwoWire::txAddress = 0;
uint8_t* TwoWire::txBuffer = 0;
uint8_t TwoWire::txBuffer[BUFFER_LENGTH];
uint8_t TwoWire::txBufferIndex = 0;
uint8_t TwoWire::txBufferLength = 0;
@ -51,13 +51,9 @@ TwoWire::TwoWire()
void TwoWire::begin(void)
{
// init buffer for reads
rxBuffer = (uint8_t*) calloc(BUFFER_LENGTH, sizeof(uint8_t));
rxBufferIndex = 0;
rxBufferLength = 0;
// init buffer for writes
txBuffer = (uint8_t*) calloc(BUFFER_LENGTH, sizeof(uint8_t));
txBufferIndex = 0;
txBufferLength = 0;