diff --git a/etl.ico b/etl.ico new file mode 100644 index 00000000..fe0e3665 Binary files /dev/null and b/etl.ico differ diff --git a/etl.png b/etl.png index 39882ffb..ca5e3de9 100644 Binary files a/etl.png and b/etl.png differ diff --git a/etl.xar b/etl.xar new file mode 100644 index 00000000..cbfaa863 Binary files /dev/null and b/etl.xar differ diff --git a/etl16.png b/etl16.png new file mode 100644 index 00000000..44cad996 Binary files /dev/null and b/etl16.png differ diff --git a/etl32.png b/etl32.png new file mode 100644 index 00000000..3d5f9369 Binary files /dev/null and b/etl32.png differ diff --git a/etl48.png b/etl48.png new file mode 100644 index 00000000..03dcffbb Binary files /dev/null and b/etl48.png differ diff --git a/examples/BlinkList/BlinkList.ino b/examples/BlinkList/BlinkList.ino index aea00bd4..af93b104 100644 --- a/examples/BlinkList/BlinkList.ino +++ b/examples/BlinkList/BlinkList.ino @@ -7,6 +7,7 @@ #include // Contains platform macros for Arduino. #include +#include void setup() { @@ -14,43 +15,40 @@ void setup() pinMode(13, OUTPUT); } +void iterate(const etl::ilist& delays) +{ + etl::ilist::const_iterator itr; + + // Iterate through the list. + itr = delays.begin(); + + while (itr != delays.end()) + { + digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) + delay(100); // wait + digitalWrite(13, LOW); // turn the LED off by making the voltage LOW + delay(*itr++); // wait + } +} + void loop() { int delay_times1[] = { 900, 800, 700, 600, 500, 400, 300, 200, 100 }; int delay_times2[] = { 400, 300, 200, 100 }; // Fill the first delay list, then reverse it. - etl::list delays1(etl::begin(delay_times1), etl::end(delay_times1)); + // Notice how we don't have to know the size of the array! + const size_t size1 = sizeof(etl::array_size(delay_times1)); + etl::list delays1(etl::begin(delay_times1), etl::end(delay_times1)); delays1.reverse(); // Fill the second delay list, - etl::list delays2(etl::begin(delay_times2), etl::end(delay_times2)); + const size_t size2 = sizeof(etl::array_size(delay_times2)); + etl::list delays2(etl::begin(delay_times2), etl::end(delay_times2)); while (true) { - // Common iterator for both lists; - etl::ilist::const_iterator itr; - - // Iterate through the first list. - itr = delays1.begin(); - - while (itr != delays1.end()) - { - digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) - delay(100); // wait - digitalWrite(13, LOW); // turn the LED off by making the voltage LOW - delay(*itr++); // wait - } - - // Iterate through the second list. - itr = delays2.begin(); - - while (itr != delays2.end()) - { - digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) - delay(100); // wait - digitalWrite(13, LOW); // turn the LED off by making the voltage LOW - delay(*itr++); // wait - } + iterate(delays1); + iterate(delays2); } } diff --git a/favicon.ico b/favicon.ico index 1a20e372..2cf75c1d 100644 Binary files a/favicon.ico and b/favicon.ico differ diff --git a/src/ivector.h b/src/ivector.h index 2245a027..5c09e66a 100644 --- a/src/ivector.h +++ b/src/ivector.h @@ -193,7 +193,7 @@ namespace etl //********************************************************************* void resize(size_t new_size) { - //ETL_ASSERT(new_size <= MAX_SIZE, ETL_ERROR(vector_full)); + ETL_ASSERT(new_size <= MAX_SIZE, ETL_ERROR(vector_full)); // Size up or size down? if (new_size > current_size)