Skip to content

Instantly share code, notes, and snippets.

View FabianInostroza's full-sized avatar

FabianInostroza

View GitHub Profile
@FabianInostroza
FabianInostroza / socketcan-golang.go
Last active August 21, 2023 13:25
SocketCan in Golang
package main
import "fmt"
import "golang.org/x/sys/unix"
import "net"
import "log"
import "encoding/binary"
import "flag"
// CANMsg almacena un mensaje de la red CAN
#!/usr/bin/env python
with open("microchip_pic18mcu.dcm", "r") as fi, open("microchip_pic18mcu2.dcm", "w") as fo:
nextpart = ''
copypart = False
for line in fi.readlines():
fields = line.split(' ')
if fields[0] == '$CMP' and fields[1].startswith('PIC18(L)'):
part = fields[1].strip().split('(L)')
fo.write('$CMP PIC18' +part[1] + '\n')
@FabianInostroza
FabianInostroza / test.ino
Created October 1, 2016 18:08
two complement and endianness test
long read1(uint32_t raw) {
// Byte: 0 1 2 3
// Bits: 76543210 76543210 76543210 76543210
// Data: |--------|--------|--------|--------|
// Bit#: 33222222 22221111 11111100 00000000
// 10987654 32109876 54321098 76543210
union DataBuffer {
byte data[4];
long value;
} data_buffer;
#rfkill unblock bluetooth
#bluetooth off
bluetooth = off (software)
#rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
Soft blocked: yes
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no