A library for observing RAM utilization with an oscilloscope.
scope_RAM.cpp
- Committer:
- altasoul
- Date:
- 2013-11-12
- Revision:
- 0:e996e4a4c783
- Child:
- 1:b6905730f836
File content as of revision 0:e996e4a4c783:
#include "mbed.h" #include "scope_RAM.h" RAMscope::RAMscope( PinName trigger_pin, PinName value_pin ) : trigger_output(trigger_pin), value_output(value_pin), scope_ram_timer(&RAMscope::scope_ram, osTimerPeriodic, (void *)this) { } void RAMscope::scope_ram(const void *arg) { RAMscope *instance = (RAMscope*)arg; instance->output_to_scope(); } void RAMscope::output_to_scope(void) { int i; unsigned char *p = start; trigger_output = true; trigger_output = false; for (i=0; i<length; i++) { value_output = *p++ == WATERMARK; } value_output = false; } void RAMscope::watermark(unsigned char *st, int len) { while (len--) *st++ = WATERMARK; } void RAMscope::scope(unsigned char *st, int len, int period) { start = st; length = len; scope_ram_timer.start(period); } void RAMscope::stop() { scope_ram_timer.stop(); }