Skip to content

Instantly share code, notes, and snippets.

View futurejones's full-sized avatar

Neil Jones futurejones

View GitHub Profile
@user890104
user890104 / si7021.c
Last active September 5, 2017 08:06
Si7021 Linux app
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/i2c-dev.h>
#define BYTES2SHORT(X) (X[0] << 8 | X[1])
// gcc -o pwrstat pwrstat.c
// display C.H.I.P power and battery status
// AXP209-internal-temperature USB-voltage USB-current battery-voltage [+-]battery-current
// https://bbs.nextthing.co/t/pwrstat-c-talk-to-axp209-over-i2c-in-c/6710?u=yoursunny
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdlib.h>