Skip to content

Instantly share code, notes, and snippets.

View andresv's full-sized avatar

Andres Vahter andresv

View GitHub Profile
@andresv
andresv / gist:2252378
Created March 30, 2012 15:47
Matrix memmove
#include <stdio.h>
#include <string.h>
#include <stdint.h> //uint8_t and friends
#define ROWS 3
#define COLS 4
int main(void){
uint8_t m[ROWS][COLS] = {{1,2,3,4}, {5,6,7,8}, {9,10,11,12}};
@andresv
andresv / BridgeStation.h
Created July 31, 2012 12:21
ccbee uart test application
/*
* Copyright (c) 2012 Andres Vahter.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
@andresv
andresv / leddisplay.py
Created August 8, 2012 08:37
LED display test
import serial
import struct
import time
s = serial.Serial('/dev/tty.KeySerial1', 9600, stopbits=serial.STOPBITS_TWO, timeout=1.)
class Display(object):
def __init__(self, serial, receiver='00'):
self.s = serial
@andresv
andresv / memcpyexample.c
Created August 9, 2012 09:55
memcpy example
#include <stdio.h>
#include <string.h>
#include <stdint.h> //uint8_t and friends
int main(void){
uint8_t settings[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; // preamble, stx and other stuff must be defined here
char text[] = "hello world";
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
uint32_t d_shift_register = 0;
uint32_t d_taps[32];
uint32_t d_tap_count;
@andresv
andresv / ax25_crc16.c
Last active July 16, 2024 15:59
AX25 CRC16 implementation
uint16_t ax25crc16(unsigned char *data_p, uint16_t length) {
uint16_t crc = 0xFFFF;
uint32_t data;
uint16_t crc16_table[] = {
0x0000, 0x1081, 0x2102, 0x3183,
0x4204, 0x5285, 0x6306, 0x7387,
0x8408, 0x9489, 0xa50a, 0xb58b,
0xc60c, 0xd68d, 0xe70e, 0xf78f
};
@andresv
andresv / sys_bios_uart_example.c
Last active March 14, 2022 15:11
Demonstration how to use UART with SYS/BIOS.
/*
* uartSample_main.c
*
* This file contains the test / demo code to demonstrate the UART driver
* functionality on SYS/BIOS 6
*
* Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
@andresv
andresv / sys_bios_i2c_example.c
Created February 4, 2013 14:30
Demonstrates how to use I2C with SYS/BIOS. It is actually little bit buggy.
EDMA3_DRV_Handle* hi2cEdma;
GIO_Handle i2c_outHandle;
GIO_Handle i2c_inHandle;
I2c_Params i2cParams;
//----------------------------------------------------------------
// Setup I2C
//----------------------------------------------------------------
void I2C_init(EDMA3_DRV_Handle* hEdma) {
I2c_ChanParams chanParams;
@andresv
andresv / vpif-conf-for-raw-capture-mode.c
Last active December 12, 2015 07:48
Demonstrates how to configure SYS/BIOS VPIF driver for RAW capture mode on C6748LCDK
#include "vpiftransfer.h"
// this must be defined here otherwise there will be Uint32 etc redefine errors
#define _TI_STD_TYPES
#include <cslr/soc_C6748.h>
#include <cslr/cslr_syscfg0_C6748.h>
#include <vpif/include/Fvid.h>
#include <vpif/include/Vpif.h>
@andresv
andresv / Configuration.h
Last active December 15, 2015 08:29
My reprap Marlin firmware configuration.
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
// This configurtion file contains the basic settings.
// Advanced settings can be found in Configuration_adv.h
// BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
//User specified version info of this build to display in [Pronterface, etc] terminal window during startup.
//Implementation of an idea by Prof Braino to inform user that any changes made
//to this build by the user have been successfully uploaded into firmware.