24 #define MAX_READING 1000 28 void callback(
int gpio,
int level, uint32_t tick)
30 static uint32_t smooth = 0;
31 static int reading = 0;
47 smooth = (raw + (4 * smooth)) / 5;
49 printf(
"%d %d %d\n", reading, raw, smooth);
54 printf(
"%d %d %d\n", reading, 40, smooth);
60 printf(
"%d %d %d\n", reading, 20, smooth);
65 int main (
int argc,
char *argv[])
int gpioSetAlertFunc(unsigned gpio, gpioAlertFunc_t f)
static uint32_t rechargeTick
int gpioSetMode(unsigned gpio, unsigned mode)
uint32_t gpioDelay(uint32_t micros)
void callback(int gpio, int level, uint32_t tick)
int gpioWrite(unsigned gpio, unsigned level)
int main(int argc, char *argv[])