Browse Source

Renamed spi_ methods to match other libs

Thomas Buck 8 years ago
parent
commit
10cbeb7bce
3 changed files with 15 additions and 15 deletions
  1. 3
    3
      include/spi.h
  2. 9
    9
      src/cc2500.c
  3. 3
    3
      src/spi.c

+ 3
- 3
include/spi.h View File

@@ -25,9 +25,9 @@
25 25
 
26 26
 #define NOP() __asm__ __volatile__("nop")
27 27
 
28
-void spi_init(void);
29
-void spi_write(uint8_t command);
30
-uint8_t spi_read(void);
28
+void spiInit(void);
29
+void spiWrite(uint8_t command);
30
+uint8_t spiRead(void);
31 31
 
32 32
 #endif
33 33
 

+ 9
- 9
src/cc2500.c View File

@@ -12,18 +12,18 @@ void cc2500ReadFifo(uint8_t *dpbuffer, int len) {
12 12
 
13 13
 void cc2500ReadRegisterMulti(uint8_t address, uint8_t data[], uint8_t length) {
14 14
     CS_off;
15
-    spi_write(address);
15
+    spiWrite(address);
16 16
     for (uint8_t i = 0; i < length; i++) {
17
-        data[i] = spi_read();
17
+        data[i] = spiRead();
18 18
     }
19 19
     CS_on;
20 20
 }
21 21
 
22 22
 void cc2500WriteRegisterMulti(uint8_t address, const uint8_t data[], uint8_t length) {
23 23
     CS_off;
24
-    spi_write(CC2500_WRITE_BURST | address);
24
+    spiWrite(CC2500_WRITE_BURST | address);
25 25
     for (uint8_t i = 0; i < length; i++) {
26
-        spi_write(data[i]);
26
+        spiWrite(data[i]);
27 27
     }
28 28
     CS_on;
29 29
 }
@@ -36,9 +36,9 @@ void cc2500WriteFifo(uint8_t *dpbuffer, uint8_t len) {
36 36
 
37 37
 void cc2500WriteReg(uint8_t address, uint8_t data) {
38 38
     CS_off;
39
-    spi_write(address);
39
+    spiWrite(address);
40 40
     NOP();
41
-    spi_write(data);
41
+    spiWrite(data);
42 42
     CS_on;
43 43
 }
44 44
 
@@ -46,15 +46,15 @@ unsigned char cc2500ReadReg(unsigned char address) {
46 46
     uint8_t result;
47 47
     CS_off;
48 48
     address |= 0x80; // bit 7 =1 for reading
49
-    spi_write(address);
50
-    result = spi_read();
49
+    spiWrite(address);
50
+    result = spiRead();
51 51
     CS_on;
52 52
     return result;
53 53
 }
54 54
 
55 55
 void cc2500Strobe(uint8_t address) {
56 56
     CS_off;
57
-    spi_write(address);
57
+    spiWrite(address);
58 58
     CS_on;
59 59
 }
60 60
 

+ 3
- 3
src/spi.c View File

@@ -4,7 +4,7 @@
4 4
 
5 5
 #include "spi.h"
6 6
 
7
-void spi_init(void) {
7
+void spiInit(void) {
8 8
     DDRB |= (1 << PB2);  // SI output
9 9
     DDRB &= ~(1 << PB3); // SO input
10 10
     DDRB |= (1 << PB4);  // SCLK output
@@ -16,7 +16,7 @@ void spi_init(void) {
16 16
     CS_on;
17 17
 }
18 18
 
19
-void spi_write(uint8_t command) {
19
+void spiWrite(uint8_t command) {
20 20
     SCK_off; //SCK start low
21 21
     MO_off;
22 22
 
@@ -38,7 +38,7 @@ void spi_write(uint8_t command) {
38 38
     MO_on;
39 39
 }
40 40
 
41
-uint8_t spi_read(void) {
41
+uint8_t spiRead(void) {
42 42
     uint8_t result = 0;
43 43
 
44 44
     for (uint8_t i = 0; i < 8; i++) {

Loading…
Cancel
Save