Rockbox Development > Starting Development and Compiling

ADC_read to plugin API

(1/1)

Angyman:
Hi everybody. For testing purposes i would like to get the adc_scan() or adc_read() into the plugin api. I tried it by including the necessary stuff in the plugin.c and plugin.h files as followed (Last try was to do that by including adc.h instead of adc-target.h"

The problem is that the adc readout seems to stop sending values after the very first one. I did the same procedure half a year ago and had no problems with that.

Any advice what could be my mistake?


--- Code: ---smoothadc.c (plugin):
-----------------------
...
    while (true)
    {
        rb->sleep(1);
        rb->lcd_clear_display();

/* Only do this if no pause*/
if (pause == false)
{
data = rb->adc_read(ADC_SCROLLPAD);
}

rb->snprintf(str, sizeof(str), "ADC: %x", data);
rb->lcd_puts(0, 0 ,str);
    }
...

plugin.c
------------------------
#include "adc.h"
...
static const struct plugin_api rockbox_api = {
...
adc_read,
}

plugin.h
------------------------
#include "adc.h"
...
struct plugin_api {
...
unsigned short (*adc_read)(int channel);
}
--- End code ---

Navigation

[0] Message Index

Go to full version