Skip to content

Instantly share code, notes, and snippets.

View gamaral's full-sized avatar

Guillermo A. Amaral gamaral

View GitHub Profile
@gamaral
gamaral / calculate_crc_j1850.c
Created December 10, 2017 08:39
CRC-8 for J1850
uint8_t
calculate_crc(const uint8_t *data, const size_t n)
{
const uint8_t poly = 0b00011101;
int datai, biti;
uint8_t crc = ~0;
for (datai = 0; datai < n; ++datai, ++data) {
crc ^= *data;
for (biti = 0; biti < 8; ++biti)
@gamaral
gamaral / env
Created April 21, 2014 19:05
Buildroot generic environment file
#!/bin/bash
# find base
export BUILDROOT_BASE_DIR=`readlink -f \`dirname ${BASH_SOURCE}\``
# host lib path
export LD_LIBRARY_PATH="${BUILDROOT_BASE_DIR}/host/usr/lib:${LD_LIBRARY_PATH}"
# exports
export BUILDROOT_SYSTEM_PROCESSOR=arm
@gamaral
gamaral / keybase.md
Last active September 30, 2016 17:39
KeyBase.IO
{
    "body": {
        "key": {
            "eldest_kid": "0120ea7cfd363e4bbbdf5485f00f8aa2542e814a6b50ff4acce78c0dd4fb0d79c5950a",
            "host": "keybase.io",
            "kid": "0120ea7cfd363e4bbbdf5485f00f8aa2542e814a6b50ff4acce78c0dd4fb0d79c5950a",
            "uid": "723273b0fd8fc109e394b3a6ccc57800",
            "username": "gamaral"
        },
@gamaral
gamaral / delay_ms.inc.asm
Created September 24, 2012 00:10
AVR Assembler Includes (AVRA)
;*****************************************************************************
; Copyright 2012 Guillermo A. Amaral B. All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright