-
been tinkering with some F030F4P6 boards because they were cheap and I was curious and... 16k of flash - I rarely use up half that in my Sketches on AVRs, but I'm routinely running up against the size limit just by the inclusion of Hardware Serial or hardware I2C Wire. it is impossible to use I2C, Serial AND an analogRead() - a single analogRead alone adds 3k to the compiled size, and HWSerial adds 4k, while the presence of any user code puts it at nearly 4k, and doing anything worth doing bumps up to around 8k without any serial activity. this really strikes me as severely off I just want to read 10 buttons and an ADC input and send them over Wire Targetting a Pro Mini compiles to just over 2k
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi,
|
Beta Was this translation helpful? Give feedback.
-
As example for your sketch and generic F030F4Px:
With:
#include <Wire.h>
uint8_t buffered[3] = {0, 0, 0};
const PinMap PinMap_ADC[] = {
{PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC_IN0
{NC, NP, 0}
};
void setup()
{
Wire.begin(9);
Wire.onRequest(requestEvent);
}
void loop()
{
buffered[0] = 0;
for (char i = 0; i < 8; i++)
{
buffered[0] |= digitalRead(i + 1) << i;
}
uint16_t analog0temp = analogRead(A0);
buffered[1] = lowByte(analog0temp);
buffered[2] = highByte(analog0temp);
delay(1);
}
void requestEvent()
{
Wire.write(buffered, 3 );
} |
Beta Was this translation helpful? Give feedback.
As example for your sketch and generic F030F4Px:
With:
build_opt.h
with this inside: