STM32F10x library
Macros | Functions
ee_95.c File Reference

ST95P08 EEPROM routines. More...

#include <inttypes.h>
#include <string.h>
#include "spi.h"

Macros

#define EE95_CS_HIGH   ee95_cs(n, 1)
 
#define EE95_CS_LOW   ee95_cs(n, 0)
 

Functions

void ee95_cs (uint8_t devnum, uint8_t nss)
 extern
 
void _delay_ms (uint32_t)
 extern
 
uint8_t ee95_rdsr (uint8_t n)
 Read status register. More...
 
void ee95_init (uint8_t n)
 Init EE. More...
 
uint8_t ee95_rd (uint8_t n, uint32_t adr, uint8_t *buf, uint16_t len)
 Read from EE. More...
 
void ee95_wren (uint8_t n)
 EE write enable. More...
 
uint8_t ee95_wr (uint8_t n, uint32_t adr, uint8_t *buf, uint16_t len)
 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-stm32f1-lib
Written for ST95P08. Compatibility with other SPI EE devices unknown.

Macro Definition Documentation

#define EE95_CS_HIGH   ee95_cs(n, 1)

Set NSS macro

#define EE95_CS_LOW   ee95_cs(n, 0)

Clear NSS macro

Function Documentation

void ee95_init ( uint8_t  n)

Init EE.

Parameters
[in]nSPI peripheral number
uint8_t ee95_rd ( uint8_t  n,
uint32_t  adr,
uint8_t *  buf,
uint16_t  len 
)

Read from EE.

Parameters
[in]nSPI peripheral number
[in]adrStarting byte address
[out]bufCaller provided buffer for data
[in]lenNumber of bytes to read (len <= sizeof(buf))
Returns
Always returns 0.
uint8_t ee95_rdsr ( uint8_t  n)

Read status register.

Parameters
[in]nSPI peripheral number
Returns
SR
uint8_t ee95_wr ( uint8_t  n,
uint32_t  adr,
uint8_t *  buf,
uint16_t  len 
)

Write to EE.

Parameters
[in]nSPI peripheral number
[in]adrStarting byte address
[in]bufCaller provided buffer with data
[in]lenNumber of bytes to write (len <= sizeof(buf))
Returns
Always returns 0
Warning
Can hang waiting for correct SR.
void ee95_wren ( uint8_t  n)

EE write enable.

Parameters
[in]nSPI peripheral number