Skip to content

Instantly share code, notes, and snippets.

View yplam's full-sized avatar
🎯
Focusing

Bruce Lam yplam

🎯
Focusing
View GitHub Profile
@yplam
yplam / BME280.md
Created April 8, 2026 11:27
BME280 - Software Debugging Reference

BME280 - Software Debugging Reference

1. Communication Quick-Start

  • Device Type: Digital humidity, pressure, and temperature sensor.
  • Interfaces:
    • I2C: Up to 3.4 MHz. Slave addresses: 0x76 (SDO pin to GND) or 0x77 (SDO pin to VDDIO).
    • SPI: 3-wire and 4-wire support, up to 10 MHz. Supports SPI modes '00' (CPOL=0, CPHA=0) and '11' (CPOL=1, CPHA=1).
  • SPI Address Format: The 7-bit register address is shifted. Bit 7 is the Read/Write bit (0 for Write, 1 for Read). Example: To write to 0xF4, use SPI address 0x74. To read 0xF4, use 0xF4.
  • I2C Transaction:
  • Write: [Slave Addr + W] -> [Reg Addr] -> [Data].
@yplam
yplam / OpencvTemplateScaleMatch.py
Created June 2, 2017 09:48
Opencv Template Matching with template scale
import numpy as np
import cv2
import imutils
template = cv2.imread('template.jpg') # template image
image_o = cv2.imread('image.jpg') # image
template = cv2.cvtColor(template, cv2.COLOR_BGR2GRAY)
image = cv2.cvtColor(image_o, cv2.COLOR_BGR2GRAY)
@yplam
yplam / WeiXinResourceOwner.php
Created May 21, 2015 03:19
HWIOAuthBundle提供微信登录服务
<?php
/*
* Connect weixin with HWIOAuthBundle package.
*
* Yplam <yplam@yplam.com>
*
*/
namespace AppBundle\OAuth\ResourceOwner;