AVR library
Macros | Functions
ee_95.c File Reference

ST95P08 EEPROM routines. More...

#include <inttypes.h>
#include <avr/io.h>
#include <util/delay.h>
#include "spi.h"
#include "ee95.h"
#include "hwdefs.h"

Macros

#define EE95_DELAY   asm("nop\nnop\nnop\nnop\nnop\n")
 

Functions

void ee95_init (uint8_t fdiv)
 Initializes SPI, CS and EE write protect pin. More...
 
void ee95_rd (uint16_t adr, uint8_t *buf, uint16_t len)
 Read from EE. More...
 
void ee95_wr (uint16_t adr, uint8_t d)
 Write to EE. More...
 

Detailed Description

ST95P08 EEPROM routines.

Author
Matej Kogovsek (matej.nosp@m.@ham.nosp@m.radio.nosp@m..si)
Note
This file is part of mat-avr-lib
Written for ST95P08. Compatibility with other SPI EE devices unknown.

Function Documentation

void ee95_init ( uint8_t  fdiv)

Initializes SPI, CS and EE write protect pin.

Parameters
[in]fdivSPI fdiv
void ee95_rd ( uint16_t  adr,
uint8_t *  buf,
uint16_t  len 
)

Read from EE.

Parameters
[in]adrStarting byte address
[out]bufCaller provided buffer for data
[in]lenNumber of bytes to read (len <= sizeof(buf))
void ee95_wr ( uint16_t  adr,
uint8_t  d 
)

Write to EE.

Parameters
[in]adrByte address
[in]dData byte
Warning
Can hang waiting for correct SR.