Skip to content

Instantly share code, notes, and snippets.

View TiNredmc's full-sized avatar
💚

TinLethax TiNredmc

💚
View GitHub Profile
@TiNredmc
TiNredmc / 30-pwm.rules
Created August 22, 2023 12:10
PWM Udev rule for Orange Pi Zero 3
# PWM udev rule
SUBSYSTEM=="pwm", ACTION=="add|change", \
RUN+="/bin/chgrp -R gpio '/sys%p'", \
RUN+="/bin/chmod -R g=u '/sys%p'"
@TiNredmc
TiNredmc / 10-usb-for-ros2.rules
Created August 6, 2023 16:42
Rpi_robot Udev rule
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="YDLIDAR", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="ESP32", MODE="0666"
@TiNredmc
TiNredmc / 10-gpio.rules
Last active August 22, 2023 12:11
Orange Pi Prime and Orange Pi Zero 3 UDEV rule for GPIO on Armbian 23.05.1 Jammy or Orange Pi OS (Ubuntu)
# Don't forget to "sudo groupadd gpio" and "sudo usermod -aG gpio $USER"
SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 660 /sys/class/gpio/export /sys/class/gpio/unexport'"
SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"
@TiNredmc
TiNredmc / point_cloud_xyz_xtion.launch.py
Created July 28, 2023 05:18
Remote Point cloud depth_image_proc launch file for ROS2
# ROS2 Remote Point Cloud Processing launch file using depth_image_proc
# Using this with Asus Xtion (no RGB) camera. Orange Pi Prime running Openni2 camera node.
# Original code by 808brick https://github.com/ros-perception/image_pipeline/issues/823
# Modified by TinLethax 2023/07/28 +7
import launch
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
def generate_launch_description():
@TiNredmc
TiNredmc / ardu_step_isr.ino
Last active June 17, 2022 07:22
control 2-phase stepper motor with Timer interrupt.
// 500us Timer interrupt to drive stepper motor.
// Coded by TinLethax 2022/6/17 +7
#define full_rev_step 200
#define motor_pulse 2
volatile uint8_t pulse_tog = 0;
volatile uint16_t pulse_cnt = 0;
#define motor_dir 3
uint8_t dir = 0;
@TiNredmc
TiNredmc / Scanner.c
Created March 20, 2022 07:11
Keyboard scanner using Arduino Mega 2560 to reverse engineer Blackberry Passport Keyboard.
/* Key scanner to reverse engineer Blackberry Passport keyboard pinout.
* Coded By TinLethax (Can't remember the date, probably 2022/03/17).
*/
// https://tinlethax.wordpress.com/2022/03/20/reverse-engineering-blackberry-passport-keyboard-pinout-part-2/
// using Arduino Mega's pin 22 to 38
// I updated the Conversion array (from arduino pin to actual connector pin).
// I sacrificed the keyboard (by taking it apart and bought a new one).
// to probe and get ~70% done with some left to probe with new kerboard (to replace the first one I took apart).
uint8_t toffcpin[16]={
2, 3, 4, 5, 6, 7,
@TiNredmc
TiNredmc / .bashrc
Last active February 2, 2022 08:28
Bashrc setting for F1C100s Buildroot. Just make it more colorful UwU
# Bashrc setting for F1C100s Buildroot. Just make it more colorful UwU
PS1='\[\e[0;38;5;161m\]\h\[\e[0m\]@\[\e[0;38;5;49m\]\u\[\e[0m\]:\[\e[0;38;5;39m\]\w\[\e[0m\]#'
@TiNredmc
TiNredmc / bq2754x_seal.sh
Last active February 2, 2022 07:27
Reseal the Fuel gauge protection of BQ27541/BQ27542 via i2ctransfer on Linux
#!/bin/bash
# Simple Script to re-seal the BQ27541 or BQ27542
# Coded by TinLethax 2021/06/02 +7
# structure [Control_command0x00][lower byte][higher byte]
# Sending SEAL subcommand cause it to reseal (Sending Big endian )
i2ctransfer -y -f 0 w3@0x55 0x00 0x20 0x00
sleep 1
i2ctransfer -y -f 0 w3@0x55 0x00 0x00 0x00
i2ctransfer -y -f 0 w1@0x55 0x00 r2
@TiNredmc
TiNredmc / bq2754x_chkseal.sh
Last active February 2, 2022 07:27
check seal status of the Fuel gauge protection of BQ27541/BQ27542 via i2ctransfer on Linux
#!/bin/bash
# Simple Script to check SEAL status of the BQ27541 or BQ27542
# Coded by TinLethax 2021/06/02 +7
# structure [Control_command0x00][lower byte][higher byte]
# Sending 0x00 subcommand (Sending Big endian )
i2ctransfer -y -f 0 w3@0x55 0x00 0x00 0x00
i2ctransfer -y -f 0 w1@0x55 0x00 r2
echo Done!
@TiNredmc
TiNredmc / bq2754x_unseal.sh
Last active February 2, 2022 07:27
Unseal the Fuel gauge protection of BQ27541/BQ27542 via i2ctransfer on Linux
#!/bin/bash
# Simple Script to Fully Unseal the BQ27541 or BQ27542
# Coded by TinLethax 2021/06/02 +7
# structure [Control_command0x00][lower byte][higher byte]
# Unseal first by writing 0x0414 (Sending Big endian )
i2ctransfer -y -f -a 0 w3@0x55 0x00 0x14 0x04
# Then writing 0x3672 (again, Big endian first)
i2ctransfer -y -f -a 0 w3@0x55 0x00 0x72 0x36
sleep 1