git clone -b [TAG] --recursive https://github.com/espressif/esp-idf.git esp-idf-[TAG]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upload_arduino_hex() { | |
avrdude -p $1 -c avrisp2 -P usb -e -U flash:w:$2 -v | |
} | |
# upload_arduino_hex m328p avrisp_mk2_test.ino.with_bootloader.standard.hex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#define PM2008_I2C_ADDRESS 0x28 | |
// Control modes | |
#define PM2008_I2C_CTRL_CLOSE_MEASUREMENT 0x1 | |
#define PM2008_I2C_CTRL_OPEN_SINGLE_MEASUREMENT 0x2 | |
#define PM2008_I2C_CTRL_SET_UP_CONTINUOUSLY_MEASUREMENT 0x3 | |
#define PM2008_I2C_CTRL_SET_UP_TIMING_MEASUREMENT 0x4 | |
#define PM2008_I2C_CTRL_SET_UP_DYNAMIC_MEASUREMENT 0x5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "sdk_common.h" | |
#include "gpio_uart.h" | |
#include "nrf_gpio.h" | |
#include "nrf_delay.h" | |
#include "nrf.h" | |
static uint8_t gpio_tx_pin; | |
void gpio_uart_init(uint8_t tx_pin){ | |
gpio_tx_pin = tx_pin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cm1106_i2c.h> | |
CM1106_I2C cm1106_i2c; | |
void setup() { | |
cm1106_i2c.begin(); | |
Serial.begin(9600); | |
delay(1000); | |
cm1106_i2c.read_serial_number(); | |
delay(1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
typedef union | |
{ | |
uint8_t command; | |
struct | |
{ | |
uint8_t a:1; | |
uint8_t b:1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set AppleScript's text item delimiters to ".pdf" | |
repeat while true | |
tell application "System Events" | |
tell process "Your Application" | |
if exists window "Print" then | |
tell window "Print" | |
if not (exists sheet 1) then | |
click menu button "PDF" | |
repeat until exists menu item "Save as PDF…" of menu 1 of menu button "PDF" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "packet.h" | |
void PACKET_generate(uint8_t cmd, uint8_t length, uint8_t *data) { | |
// STX | |
*data = PACKET_STX; | |
// LEN | |
*(data + PACKET_POS_LEN) = length - 2; | |
// CMD | |
*(data + 2) = cmd; | |
// CS : STX ^ LEN ^ CMD ^ D... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
class Packet { | |
static final int PACKET_STX = 0xAB; | |
static final int PACKET_ETX = 0x7D; | |
static final int PACKET_CMD_GET_PM2008 = 0; | |
static final int PACKET_POS_STX = 0; | |
static final int PACKET_POS_LEN = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
class Packet { | |
static final int PACKET_STX = 0xAB; | |
static final int PACKET_ETX = 0x7D; | |
static final int PACKET_CMD_GET_PM2008 = 0; | |
static final int PACKET_POS_STX = 0; | |
static final int PACKET_POS_LEN = 1; |