Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 1:eaf79a9d2939
- Parent:
- 0:77155d68f532
- Child:
- 2:56fbeac9ddc8
--- a/main.cpp Fri Jan 28 10:04:43 2011 +0000
+++ b/main.cpp Fri Jan 28 10:56:45 2011 +0000
@@ -91,6 +91,23 @@
DigitalOut myled3(LED3);
DigitalOut myled4(LED4);
+PortOut ledport(Port1, ALLLEDS);
+
+// creating the mask values before writing them to registers
+void binc6(int value) {
+ uint32_t set = 0;
+ for(int i=0; i<4; i++) {
+ if((value >> i) & 1) {
+ set |= masks[i];
+ }
+ }
+ ledport = set;
+}
+
+void binc7(int value) {
+ ledport = masks2[value];
+}
+
// timing functions
Timer t;
@@ -138,4 +155,16 @@
binc3(i & 0xF);
}
STOP();
+
+ START("PortOut");
+ for(int i=0; i<LOOPS; i++) {
+ binc6(i & 0xF);
+ }
+ STOP();
+
+ START("PortOut lookup");
+ for(int i=0; i<LOOPS; i++) {
+ binc7(i & 0xF);
+ }
+ STOP();
}