Skip to content

Instantly share code, notes, and snippets.

#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
#define TPC_PIN_INPUT() DDRD &= ~_BV(6)
#define TPC_PIN_OUTPUT() DDRD |= _BV(6)
#define TPC_PIN_ON() PORTD |= _BV(6)
#define TPC_PIN_OFF() PORTD &= ~_BV(6)
#define TPC_PIN_IS_ON() bit_is_set(PIND, 6)
#define TPC_PIN_IS_OFF() bit_is_clear(PIND, 6)
//use bitlash fork from https://github.com/murix/bitlash
#include "bitlash.h"
#include <stdio.h>
//
#include <SPI.h>
#include <AIR430BoostFCC.h>
#define ADDRESS_LOCAL 0x02
#define ADDRESS_REMOTE 0x01
//use bitlash fork from https://github.com/murix/bitlash
#include "bitlash.h"
//
#include <SPI.h>
#include <AIR430BoostFCC.h>
#define ADDRESS_LOCAL 0x01
#define ADDRESS_REMOTE 0x02
#include <SPI.h>
#include <AIR430BoostFCC.h>
// -----------------------------------------------------------------------------
/**
* Defines, enumerations, and structure definitions
*/
#define ADDRESS_LOCAL 0x02
#include <SPI.h>
#include <AIR430BoostFCC.h>
// -----------------------------------------------------------------------------
/**
* Defines, enumerations, and structure definitions
*/
#define ADDRESS_LOCAL 0x01
#define HCSR04_TRIG PD_3
#define HCSR04_ECHO PD_2
void setup()
{
Serial.begin(115200);
pinMode(HCSR04_TRIG,OUTPUT);
pinMode(HCSR04_ECHO,INPUT);
}
//i2c lib
#include <Wire.h>
TwoWire i2c_port(2);
#include <stdarg.h>
void debug(char *fmt, ... ){
char buf[128]; // resulting string limited to 128 chars
va_list args;
/*
Arduino Nano V3
SDA ---> A4
SCL ---> A5
*/
//I2C lib
#include <Wire.h>
////////////////////////////////////
/*
Tiva C / Stellaris LM4F120XL
SCA ---> PA6
SDA ---> PA7
*/
//I2C lib
#include <Wire.h>
////////////////////////////////////////////
uint32_t ulUser0, ulUser1;
ROM_FlashUserGet(&ulUser0, &ulUser1);
uint8_t* p_mac0;
uint8_t* p_mac1;
p_mac0 = (uint8_t*) &ulUser0;
p_mac1 = (uint8_t*) &ulUser1;
UARTprintf("mac=%02x-%02x-%02x-%02x-%02x-%02x\n",p_mac0[0],p_mac0[1],p_mac0[2],p_mac1[0],p_mac1[1],p_mac1[2]);