Motoo Tanaka / Mbed 2 deprecated ticker_test_180226

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Rhyme
Date:
Mon Mar 12 05:34:14 2018 +0000
Commit message:
commit before publishing

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 12 05:34:14 2018 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+Ticker *tokei ;
+uint32_t edge_time = 0 ;
+
+void inc_sec(void)
+{
+    __disable_irq() ; // Disable Interrupts
+    edge_time++ ;
+    __enable_irq() ; // Enable Interrupts
+}
+
+void init_timer(void)
+{
+    tokei = new Ticker() ;
+    tokei->attach(inc_sec, 1.0) ;
+}
+
+int main() {
+    uint32_t count = 0 ;
+    init_timer() ;
+    
+    printf("Ticker test program\n") ;
+    while(1) {
+        printf("%d: %d\n", count++, edge_time) ;
+        wait(1.0) ;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 12 05:34:14 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e
\ No newline at end of file