KEIS
Dependencies: C12832_lcd mbed-rtos mbed
Fork of rtos_queue by
Revision 5:2ac137a5448d, committed 2013-09-25
- Comitter:
- khayakawa
- Date:
- Wed Sep 25 05:09:24 2013 +0000
- Parent:
- 4:c980920b5e22
- Commit message:
- KEIS;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Wed Sep 25 05:09:24 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af
--- a/main.cpp Tue Jun 04 16:03:43 2013 +0100 +++ b/main.cpp Wed Sep 25 05:09:24 2013 +0000 @@ -1,41 +1,33 @@ #include "mbed.h" #include "rtos.h" +#include "C12832_lcd.h" -typedef struct { - float voltage; /* AD result of measured voltage */ - float current; /* AD result of measured current */ - uint32_t counter; /* A counter value */ -} message_t; +C12832_LCD lcd; -MemoryPool<message_t, 16> mpool; -Queue<message_t, 16> queue; +/* send int by queue */ + +Queue<int, 16> queue; /* Send Thread */ void send_thread (void const *args) { - uint32_t i = 0; + int message_s = 0 ; while (true) { - i++; // fake data update - message_t *message = mpool.alloc(); - message->voltage = (i * 0.1) * 33; - message->current = (i * 0.1) * 11; - message->counter = i; - queue.put(message); + message_s++; + queue.put(&message_s); Thread::wait(1000); } } int main (void) { + int *message_r; + Thread thread(send_thread); while (true) { osEvent evt = queue.get(); if (evt.status == osEventMessage) { - message_t *message = (message_t*)evt.value.p; - printf("\nVoltage: %.2f V\n\r" , message->voltage); - printf("Current: %.2f A\n\r" , message->current); - printf("Number of cycles: %u\n\r", message->counter); - - mpool.free(message); + message_r = (int*)evt.value.p; + lcd.printf("%d ", *message_r); } } }
--- a/mbed-rtos.lib Tue Jun 04 16:03:43 2013 +0100 +++ b/mbed-rtos.lib Wed Sep 25 05:09:24 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed-rtos/#58b30ac3f00e
--- a/mbed.bld Tue Jun 04 16:03:43 2013 +0100 +++ b/mbed.bld Wed Sep 25 05:09:24 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file