Project

General

Profile

Revision 1461

Added by Brad Neuman over 14 years ago

updated all the library code to have sensible _init behavior.
Almost all of the library components have a global variable which gets set after init and the functions inside will fail with an error code if init has not been called. Also, the init functions themselves check this variable and will bail out without doing any damage if that init has already been called

View differences:

spi.h
12 12
#ifndef __SPI_H__
13 13
#define __SPI_H__
14 14

  
15
#include<dragonfly_lib.h>
16

  
15 17
#define DOUBLE_SCK 1
16 18
#define SPR0_BIT 1
17 19

  
......
32 34
* @param spi_fun_recv_t The function that handles SPI data, byte for byte.
33 35
* @param spi_fun_recv_complete_t  Called on a completed transmission - typically for cleaning up.
34 36
*/
35
void spi_init (spi_fun_recv_t, spi_fun_recv_complete_t);
37
int spi_init (spi_fun_recv_t, spi_fun_recv_complete_t);
36 38

  
37 39
/** 
38 40
* @brief Initialize SPI transfer.
39 41
* 
40 42
* @param char The number of bytes to transfer.
41 43
*/
42
void spi_transfer (char);
44
int spi_transfer (char);
43 45

  
44 46
/**@}**/ //end group
45 47

  

Also available in: Unified diff