Skip to content

Instantly share code, notes, and snippets.

@qdk0901
qdk0901 / i2c_stm.c
Last active January 15, 2019 20:25
i2c slave with PMS150C
#define I2C_SLAVE_ADDRESS (0xA0 >> 1)
#define BUF_SIZE 16
enum {
IDLE,
START,
STOP,
ADDR,
OP,
READDATA,
@qdk0901
qdk0901 / thread.h
Last active September 14, 2018 09:39
pthread wrapper
#ifndef _THREAD_H_
#define _THREAD_H_
#include <pthread.h>
#include <string>
template<typename Tobject>
class CallProxy
{
typedef void (Tobject::*Function)();
public:
@qdk0901
qdk0901 / get_ip_from_mac.cpp
Last active March 20, 2021 03:20
get ip from mac address
#include <string>
#include <iostream>
extern "C" {
#include <netlink/cli/utils.h>
#include <netlink/cli/neigh.h>
#include <netlink/cli/link.h>
}
std::string get_ip_from_mac(std::string mac)