<commit_before>/*
 * Copyright (c) 2010 by <NAME> <<EMAIL>>
 *
 * 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.
 * 
 */

/*Updated  August/3/2011 by <NAME> to be compatable with chipKIT boards */

#include <stdio.h>
#include <string.h>

//#include <avr/interrupt.h>
#include "w5100.h"
#include "WProgram.h"
// W5100 controller instance
W5100Class W5100;

#define TX_RX_MAX_BUF_SIZE 2048
#define TX_BUF 0x1100
#define RX_BUF (TX_BUF + TX_RX_MAX_BUF_SIZE)

#define TXBUF_BASE 0x4000
#define RXBUF_BASE 0x6000

void W5100Class::init(void)
{
  delay(300);
  

  SPI.begin();
  SPI.setClockDivider(SPI_CLOCK_DIV8); //Sets the spi clock rate to around 10Mhz(divide by 4 will work but not recommended due to signal integraty issues) -LSH
  SPI.setDataMode(SPI_MODE0);			//Defines spi to operate in mode 0 -LSH<commit_msg>Issue #123 fix from Gene applied.<commit_after>/*
 * Copyright (c) 2010 by <NAME> <<EMAIL>>
 *
 * 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.
 * 
 */

//* Edit History
//*  Aug  3,  2011 <<NAME>> ported toh chipKIT boards
//*  Sept 13, 2011	<<NAME>> change SPI clock divider from DIV8 to DIV32

#include <stdio.h>
#include <string.h>

//#include <avr/interrupt.h>
#include "w5100.h"
#include "WProgram.h"
// W5100 controller instance
W5100Class W5100;

#define TX_RX_MAX_BUF_SIZE 2048
#define TX_BUF 0x1100
#define RX_BUF (TX_BUF + TX_RX_MAX_BUF_SIZE)

#define TXBUF_BASE 0x4000
#define RXBUF_BASE 0x6000

void W5100Class::init(void)
{
  delay(300);
  

  SPI.begin();
  //Set the SPI clock speed to 2.5Mhz. Setting it to 5Mhz (DIV16) may
  //work for some hardware configurations.
  SPI.setClockDivider(SPI_CLOCK_DIV32);
  //The W5100 chip operates in SPI mode 0. Early versions of the chipKIT
  //SPI library (prior to 20110907) set the modes incorrectly. To work
  //with those early versions use SPI_MODE1.
  SPI.setDataMode(SPI_MODE0);
{'fraction_non_alphanumeric': 0.09673144876325088, 'fraction_numerical': 0.06537102473498234, 'mean_word_length': 4.044543429844098, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4030951', 'n_tokens_mistral': 886, 'n_tokens_neox': 766, 'n_words': 283}