-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage_spi_flash.cpp
117 lines (88 loc) · 1.65 KB
/
storage_spi_flash.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/**
* storage_spi_flash.cpp
*
* Created on: Jun 9, 2019
* Author: Christian Adams <[email protected]>
*/
#ifdef USE_SPI_FLASH
#include <Streaming.h>
#include "storage_spi_flash.hpp"
#include "Maschinentuer.hpp"
#include "rfid.hpp"
/**
*
*/
void storage_init(void) {
card_count = storage_read_card_count();
if (card_count > 0) {
storage_read_card(&master);
master.valid = false;
}
Serial << F("initializing SPI-Flash") << endl;
if (!SerialFlash.begin(FLASH_CS)) {
Serial << F("unable to initialize SPI-Flash") << endl;
} else {
Serial << F(".. SPI-Flash init done ..") << endl;
uint8_t id;
SerialFlash.readID(&id);
Serial << F("id: ") << id << endl;
uint32_t capacity = SerialFlash.capacity(&id);
Serial << F("capacity: ") << capacity << endl;
unsigned char serialnumber[8];
SerialFlash.readSerialNumber(serialnumber);
char tmp[2];
Serial << F("SerialNumber: ");
for (uint8_t i = 0; i < 8; i++) {
sprintf(tmp, "%.2X", serialnumber[i]);
Serial << tmp << " ";
}
Serial << endl;
}
}
/**
*
*/
void storage_write_card_count(uint8_t count) {
// TODO: implement
}
/**
*
*/
uint8_t storage_read_card_count(void) {
// TODO: implement
return 0;
}
/**
*
*/
void storage_write_card(rfid_card_t* rfid_card) {
// TODO: implement
}
/**
*
*/
bool storage_read_card(rfid_card_t* rfid_card) {
// TODO: implement
return false;
}
/**
*
*/
bool storage_find_card(rfid_card_t* rfid_card) {
// TODO: implement
return false;
}
/**
*
*/
void storage_list_cards_serial(void) {
// TODO: implement
}
/**
*
*/
uint8_t storage_get_next_card_id(void) {
// TODO: implement
return 0;
}
#endif /* USE_SPI_FLASH */