Fixed line endings and SVN props with fixup.sh script
This commit is contained in:
@@ -1,72 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2010 by Cristian Maglie <c.maglie@bug.st>
|
||||
* SPI Master library for arduino.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of either the GNU General Public License version 2
|
||||
* or the GNU Lesser General Public License version 2.1, both as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _SPI_H_INCLUDED
|
||||
#define _SPI_H_INCLUDED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Arduino.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define SPI_CLOCK_DIV4 0x00
|
||||
#define SPI_CLOCK_DIV16 0x01
|
||||
#define SPI_CLOCK_DIV64 0x02
|
||||
#define SPI_CLOCK_DIV128 0x03
|
||||
#define SPI_CLOCK_DIV2 0x04
|
||||
#define SPI_CLOCK_DIV8 0x05
|
||||
#define SPI_CLOCK_DIV32 0x06
|
||||
//#define SPI_CLOCK_DIV64 0x07
|
||||
|
||||
#define SPI_MODE0 0x00
|
||||
#define SPI_MODE1 0x04
|
||||
#define SPI_MODE2 0x08
|
||||
#define SPI_MODE3 0x0C
|
||||
|
||||
#define SPI_MODE_MASK 0x0C // CPOL = bit 3, CPHA = bit 2 on SPCR
|
||||
#define SPI_CLOCK_MASK 0x03 // SPR1 = bit 1, SPR0 = bit 0 on SPCR
|
||||
#define SPI_2XCLOCK_MASK 0x01 // SPI2X = bit 0 on SPSR
|
||||
|
||||
class SPIClass {
|
||||
public:
|
||||
inline static byte transfer(byte _data);
|
||||
|
||||
// SPI Configuration methods
|
||||
|
||||
inline static void attachInterrupt();
|
||||
inline static void detachInterrupt(); // Default
|
||||
|
||||
static void begin(); // Default
|
||||
static void end();
|
||||
|
||||
static void setBitOrder(uint8_t);
|
||||
static void setDataMode(uint8_t);
|
||||
static void setClockDivider(uint8_t);
|
||||
};
|
||||
|
||||
extern SPIClass SPI;
|
||||
|
||||
byte SPIClass::transfer(byte _data)
|
||||
{
|
||||
SPDR = _data;
|
||||
while (!(SPSR & _BV(SPIF)));
|
||||
return SPDR;
|
||||
}
|
||||
|
||||
void SPIClass::attachInterrupt()
|
||||
{
|
||||
SPCR |= _BV(SPIE);
|
||||
}
|
||||
|
||||
void SPIClass::detachInterrupt()
|
||||
{
|
||||
SPCR &= ~_BV(SPIE);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Copyright (c) 2010 by Cristian Maglie <c.maglie@bug.st>
|
||||
* SPI Master library for arduino.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of either the GNU General Public License version 2
|
||||
* or the GNU Lesser General Public License version 2.1, both as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _SPI_H_INCLUDED
|
||||
#define _SPI_H_INCLUDED
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Arduino.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define SPI_CLOCK_DIV4 0x00
|
||||
#define SPI_CLOCK_DIV16 0x01
|
||||
#define SPI_CLOCK_DIV64 0x02
|
||||
#define SPI_CLOCK_DIV128 0x03
|
||||
#define SPI_CLOCK_DIV2 0x04
|
||||
#define SPI_CLOCK_DIV8 0x05
|
||||
#define SPI_CLOCK_DIV32 0x06
|
||||
//#define SPI_CLOCK_DIV64 0x07
|
||||
|
||||
#define SPI_MODE0 0x00
|
||||
#define SPI_MODE1 0x04
|
||||
#define SPI_MODE2 0x08
|
||||
#define SPI_MODE3 0x0C
|
||||
|
||||
#define SPI_MODE_MASK 0x0C // CPOL = bit 3, CPHA = bit 2 on SPCR
|
||||
#define SPI_CLOCK_MASK 0x03 // SPR1 = bit 1, SPR0 = bit 0 on SPCR
|
||||
#define SPI_2XCLOCK_MASK 0x01 // SPI2X = bit 0 on SPSR
|
||||
|
||||
class SPIClass {
|
||||
public:
|
||||
inline static byte transfer(byte _data);
|
||||
|
||||
// SPI Configuration methods
|
||||
|
||||
inline static void attachInterrupt();
|
||||
inline static void detachInterrupt(); // Default
|
||||
|
||||
static void begin(); // Default
|
||||
static void end();
|
||||
|
||||
static void setBitOrder(uint8_t);
|
||||
static void setDataMode(uint8_t);
|
||||
static void setClockDivider(uint8_t);
|
||||
};
|
||||
|
||||
extern SPIClass SPI;
|
||||
|
||||
byte SPIClass::transfer(byte _data)
|
||||
{
|
||||
SPDR = _data;
|
||||
while (!(SPSR & _BV(SPIF)));
|
||||
return SPDR;
|
||||
}
|
||||
|
||||
void SPIClass::attachInterrupt()
|
||||
{
|
||||
SPCR |= _BV(SPIE);
|
||||
}
|
||||
|
||||
void SPIClass::detachInterrupt()
|
||||
{
|
||||
SPCR &= ~_BV(SPIE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )
|
||||
#define ntohs(x) htons(x)
|
||||
|
||||
#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \
|
||||
((x)<< 8 & 0x00FF0000UL) | \
|
||||
((x)>> 8 & 0x0000FF00UL) | \
|
||||
((x)>>24 & 0x000000FFUL) )
|
||||
#define ntohl(x) htonl(x)
|
||||
|
||||
#endif
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )
|
||||
#define ntohs(x) htons(x)
|
||||
|
||||
#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \
|
||||
((x)<< 8 & 0x00FF0000UL) | \
|
||||
((x)>> 8 & 0x0000FF00UL) | \
|
||||
((x)>>24 & 0x000000FFUL) )
|
||||
#define ntohl(x) htonl(x)
|
||||
|
||||
#endif
|
||||
|
||||
+515
-515
File diff suppressed because it is too large
Load Diff
+139
-139
@@ -1,139 +1,139 @@
|
||||
/*
|
||||
* w5100Wrapper.h
|
||||
*
|
||||
* Created on: 26 de Mai de 2013
|
||||
* Author: mgf
|
||||
*/
|
||||
|
||||
#ifndef W5100WRAPPER_H_
|
||||
#define W5100WRAPPER_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
typedef uint8_t SOCKET;
|
||||
typedef void CSnMR;
|
||||
typedef void CSnIR;
|
||||
typedef void CSnSR;
|
||||
typedef void CIPPROTO;
|
||||
typedef void CW5100Class;
|
||||
|
||||
#define MAX_SOCK_NUM 4
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CSnMR *CSnMR_new();
|
||||
void CSnMR_delete(const CSnMR * obj);
|
||||
uint8_t SnMR_CLOSE();
|
||||
uint8_t SnMR_UDP();
|
||||
uint8_t SnMR_TCP();
|
||||
uint8_t SnMR_IPRAW();
|
||||
uint8_t SnMR_MACRAW();
|
||||
uint8_t SnMR_PPPOE();
|
||||
uint8_t SnMR_ND();
|
||||
uint8_t SnMR_MULTI();
|
||||
|
||||
CSnIR *CSnIR_new();
|
||||
void CSnIR_delete(const CSnIR * obj);
|
||||
uint8_t SnIR_SEND_OK();
|
||||
uint8_t SnIR_TIMEOUT();
|
||||
uint8_t SnIR_RECV();
|
||||
uint8_t SnIR_DISCON();
|
||||
uint8_t SnIR_CON();
|
||||
|
||||
|
||||
CSnSR *CSnSR_new();
|
||||
void CSnSR_delete(const CSnSR * obj);
|
||||
uint8_t SnSR_CLOSED();
|
||||
uint8_t SnSR_INIT();
|
||||
uint8_t SnSR_LISTEN();
|
||||
uint8_t SnSR_SYNSENT();
|
||||
uint8_t SnSR_SYNRECV();
|
||||
uint8_t SnSR_ESTABLISHED();
|
||||
uint8_t SnSR_FIN_WAIT();
|
||||
uint8_t SnSR_CLOSING();
|
||||
uint8_t SnSR_TIME_WAIT();
|
||||
uint8_t SnSR_CLOSE_WAIT();
|
||||
uint8_t SnSR_LAST_ACK();
|
||||
uint8_t SnSR_UDP();
|
||||
uint8_t SnSR_IPRAW();
|
||||
uint8_t SnSR_MACRAW();
|
||||
uint8_t SnSR_PPPOE();
|
||||
|
||||
CIPPROTO *CIPPROTO_new();
|
||||
void CIPPROTO_delete(const CIPPROTO * obj);
|
||||
uint8_t IPPROTO_IP();
|
||||
uint8_t IPPROTO_ICMP();
|
||||
uint8_t IPPROTO_IGMP();
|
||||
uint8_t IPPROTO_GGP();
|
||||
uint8_t IPPROTO_TCP();
|
||||
uint8_t IPPROTO_PUP();
|
||||
uint8_t IPPROTO_UDP();
|
||||
uint8_t IPPROTO_IDP();
|
||||
uint8_t IPPROTO_ND();
|
||||
uint8_t IPPROTO_RAW();
|
||||
|
||||
CW5100Class *CW5100Class_new();
|
||||
void init_func(const CW5100Class * obj);
|
||||
void CW5100Class_delete(const CW5100Class * obj);
|
||||
|
||||
void read_data_func(const CW5100Class * obj,
|
||||
SOCKET s,
|
||||
volatile uint8_t * src,
|
||||
volatile uint8_t * dst,
|
||||
uint16_t len);
|
||||
|
||||
void send_data_processing_func(const CW5100Class * obj,
|
||||
SOCKET s,
|
||||
const uint8_t * data,
|
||||
uint16_t len);
|
||||
void send_data_processing_offset_func(const CW5100Class * obj,
|
||||
SOCKET s,
|
||||
uint16_t data_offset,
|
||||
const uint8_t * data,
|
||||
uint16_t len);
|
||||
//FIXME: Removed defaul value of 0(zero) from the peek argument
|
||||
void recv_data_processing_func(const CW5100Class * obj,
|
||||
SOCKET s,
|
||||
uint8_t * data,
|
||||
uint16_t len,
|
||||
uint8_t peek);
|
||||
void setGatewayIp_func(const CW5100Class * obj,
|
||||
uint8_t * _addr);
|
||||
void getGatewayIp_func(const CW5100Class * obj,
|
||||
uint8_t * _addr);
|
||||
//
|
||||
void setSubnetMask_func(const CW5100Class * obj,
|
||||
uint8_t * _addr);
|
||||
void getSubnetMask_func(const CW5100Class * obj,
|
||||
uint8_t * _addr);
|
||||
//
|
||||
void setMACAddress_func(const CW5100Class * obj,
|
||||
uint8_t * addr);
|
||||
void getMACAddress_func(const CW5100Class * obj,
|
||||
uint8_t * addr);
|
||||
//
|
||||
void setIPAddress_func(const CW5100Class * obj,
|
||||
uint8_t * addr);
|
||||
void getIPAddress_func(const CW5100Class * obj,
|
||||
uint8_t * addr);
|
||||
//
|
||||
void setRetransmissionTime_func(const CW5100Class * obj,
|
||||
uint16_t timeout);
|
||||
void setRetransmissionCount_func(const CW5100Class * obj,
|
||||
uint8_t _retry);
|
||||
//
|
||||
|
||||
uint16_t getTXFreeSize_func(const CW5100Class * obj,
|
||||
SOCKET s);
|
||||
uint16_t getRXReceivedSize_func(const CW5100Class * obj,
|
||||
SOCKET s);
|
||||
|
||||
uint8_t readSnSR_func(const CW5100Class * obj,
|
||||
SOCKET s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* W5100WRAPPER_H_ */
|
||||
/*
|
||||
* w5100Wrapper.h
|
||||
*
|
||||
* Created on: 26 de Mai de 2013
|
||||
* Author: mgf
|
||||
*/
|
||||
|
||||
#ifndef W5100WRAPPER_H_
|
||||
#define W5100WRAPPER_H_
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
typedef uint8_t SOCKET;
|
||||
typedef void CSnMR;
|
||||
typedef void CSnIR;
|
||||
typedef void CSnSR;
|
||||
typedef void CIPPROTO;
|
||||
typedef void CW5100Class;
|
||||
|
||||
#define MAX_SOCK_NUM 4
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CSnMR *CSnMR_new();
|
||||
void CSnMR_delete(const CSnMR * obj);
|
||||
uint8_t SnMR_CLOSE();
|
||||
uint8_t SnMR_UDP();
|
||||
uint8_t SnMR_TCP();
|
||||
uint8_t SnMR_IPRAW();
|
||||
uint8_t SnMR_MACRAW();
|
||||
uint8_t SnMR_PPPOE();
|
||||
uint8_t SnMR_ND();
|
||||
uint8_t SnMR_MULTI();
|
||||
|
||||
CSnIR *CSnIR_new();
|
||||
void CSnIR_delete(const CSnIR * obj);
|
||||
uint8_t SnIR_SEND_OK();
|
||||
uint8_t SnIR_TIMEOUT();
|
||||
uint8_t SnIR_RECV();
|
||||
uint8_t SnIR_DISCON();
|
||||
uint8_t SnIR_CON();
|
||||
|
||||
|
||||
CSnSR *CSnSR_new();
|
||||
void CSnSR_delete(const CSnSR * obj);
|
||||
uint8_t SnSR_CLOSED();
|
||||
uint8_t SnSR_INIT();
|
||||
uint8_t SnSR_LISTEN();
|
||||
uint8_t SnSR_SYNSENT();
|
||||
uint8_t SnSR_SYNRECV();
|
||||
uint8_t SnSR_ESTABLISHED();
|
||||
uint8_t SnSR_FIN_WAIT();
|
||||
uint8_t SnSR_CLOSING();
|
||||
uint8_t SnSR_TIME_WAIT();
|
||||
uint8_t SnSR_CLOSE_WAIT();
|
||||
uint8_t SnSR_LAST_ACK();
|
||||
uint8_t SnSR_UDP();
|
||||
uint8_t SnSR_IPRAW();
|
||||
uint8_t SnSR_MACRAW();
|
||||
uint8_t SnSR_PPPOE();
|
||||
|
||||
CIPPROTO *CIPPROTO_new();
|
||||
void CIPPROTO_delete(const CIPPROTO * obj);
|
||||
uint8_t IPPROTO_IP();
|
||||
uint8_t IPPROTO_ICMP();
|
||||
uint8_t IPPROTO_IGMP();
|
||||
uint8_t IPPROTO_GGP();
|
||||
uint8_t IPPROTO_TCP();
|
||||
uint8_t IPPROTO_PUP();
|
||||
uint8_t IPPROTO_UDP();
|
||||
uint8_t IPPROTO_IDP();
|
||||
uint8_t IPPROTO_ND();
|
||||
uint8_t IPPROTO_RAW();
|
||||
|
||||
CW5100Class *CW5100Class_new();
|
||||
void init_func(const CW5100Class * obj);
|
||||
void CW5100Class_delete(const CW5100Class * obj);
|
||||
|
||||
void read_data_func(const CW5100Class * obj,
|
||||
SOCKET s,
|
||||
volatile uint8_t * src,
|
||||
volatile uint8_t * dst,
|
||||
uint16_t len);
|
||||
|
||||
void send_data_processing_func(const CW5100Class * obj,
|
||||
SOCKET s,
|
||||
const uint8_t * data,
|
||||
uint16_t len);
|
||||
void send_data_processing_offset_func(const CW5100Class * obj,
|
||||
SOCKET s,
|
||||
uint16_t data_offset,
|
||||
const uint8_t * data,
|
||||
uint16_t len);
|
||||
//FIXME: Removed defaul value of 0(zero) from the peek argument
|
||||
void recv_data_processing_func(const CW5100Class * obj,
|
||||
SOCKET s,
|
||||
uint8_t * data,
|
||||
uint16_t len,
|
||||
uint8_t peek);
|
||||
void setGatewayIp_func(const CW5100Class * obj,
|
||||
uint8_t * _addr);
|
||||
void getGatewayIp_func(const CW5100Class * obj,
|
||||
uint8_t * _addr);
|
||||
//
|
||||
void setSubnetMask_func(const CW5100Class * obj,
|
||||
uint8_t * _addr);
|
||||
void getSubnetMask_func(const CW5100Class * obj,
|
||||
uint8_t * _addr);
|
||||
//
|
||||
void setMACAddress_func(const CW5100Class * obj,
|
||||
uint8_t * addr);
|
||||
void getMACAddress_func(const CW5100Class * obj,
|
||||
uint8_t * addr);
|
||||
//
|
||||
void setIPAddress_func(const CW5100Class * obj,
|
||||
uint8_t * addr);
|
||||
void getIPAddress_func(const CW5100Class * obj,
|
||||
uint8_t * addr);
|
||||
//
|
||||
void setRetransmissionTime_func(const CW5100Class * obj,
|
||||
uint16_t timeout);
|
||||
void setRetransmissionCount_func(const CW5100Class * obj,
|
||||
uint8_t _retry);
|
||||
//
|
||||
|
||||
uint16_t getTXFreeSize_func(const CW5100Class * obj,
|
||||
SOCKET s);
|
||||
uint16_t getRXReceivedSize_func(const CW5100Class * obj,
|
||||
SOCKET s);
|
||||
|
||||
uint8_t readSnSR_func(const CW5100Class * obj,
|
||||
SOCKET s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* W5100WRAPPER_H_ */
|
||||
|
||||
Reference in New Issue
Block a user