1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Merge pull request #19 from esp8266/esp8266

pull latest changes
This commit is contained in:
ficeto
2015-05-14 11:48:36 +03:00
12 changed files with 368 additions and 40 deletions

View File

@ -55,7 +55,6 @@ void returnOK(){
message += "Access-Control-Allow-Origin: *\r\n";
message += "\r\n";
client.print(message);
message = 0;
client.stop();
}
@ -69,7 +68,6 @@ void returnFail(String msg){
message += msg;
message += "\r\n";
client.print(message);
message = 0;
client.stop();
}
@ -108,8 +106,8 @@ bool loadFromSdCard(String path){
head += "\r\nAccess-Control-Allow-Origin: *";
head += "\r\n\r\n";
client.print(head);
dataType = 0;
path = 0;
dataType = String();
path = String();
if(client.write(dataFile) != dataFile.size()){
DBG_OUTPUT_PORT.println("Sent less data than expected!");
@ -159,11 +157,11 @@ void deleteRecursive(String path){
entry.close();
SD.remove((char *)entryPath.c_str());
}
entryPath = 0;
entryPath = String();
yield();
}
SD.rmdir((char *)path.c_str());
path = 0;
path = String();
file.close();
}
@ -173,7 +171,7 @@ void handleDelete(){
if(path == "/" || !SD.exists((char *)path.c_str())) return returnFail("BAD PATH");
deleteRecursive(path);
returnOK();
path = 0;
path = String();
}
void handleCreate(){
@ -190,7 +188,7 @@ void handleCreate(){
SD.mkdir((char *)path.c_str());
}
returnOK();
path = 0;
path = String();
}
void printDirectory() {
@ -198,7 +196,7 @@ void printDirectory() {
String path = server.arg("dir");
if(path != "/" && !SD.exists((char *)path.c_str())) return returnFail("BAD PATH");
File dir = SD.open((char *)path.c_str());
path = 0;
path = String();
if(!dir.isDirectory()){
dir.close();
return returnFail("NOT DIR");
@ -229,7 +227,7 @@ void printDirectory() {
output += "]";
client.write(output.c_str(), output.length());
client.stop();
output = 0;
output = String();
}
void handleNotFound(){

View File

@ -308,6 +308,13 @@ void SPIClass::write32(uint32_t data, bool msb) {
while(SPI1CMD & SPIBUSY) {}
}
/**
* Note:
* data need to be aligned to 32Bit
* or you get an Fatal exception (9)
* @param data uint8_t *
* @param size uint32_t
*/
void SPIClass::writeBytes(uint8_t * data, uint32_t size) {
while(size) {
if(size > 64) {
@ -340,6 +347,15 @@ void SPIClass::writeBytes_(uint8_t * data, uint8_t size) {
while(SPI1CMD & SPIBUSY) {}
}
/**
* Note:
* data need to be aligned to 32Bit
* or you get an Fatal exception (9)
* @param data uint8_t *
* @param size uint8_t max for size is 64Byte
* @param repeat uint32_t
*/
void SPIClass::writePattern(uint8_t * data, uint8_t size, uint32_t repeat) {
if(size > 64) return; //max Hardware FIFO
@ -376,6 +392,14 @@ void SPIClass::writePattern_(uint8_t * data, uint8_t size, uint8_t repeat) {
writeBytes(&buffer[0], bytes);
}
/**
* Note:
* in and out need to be aligned to 32Bit
* or you get an Fatal exception (9)
* @param out uint8_t *
* @param in uint8_t *
* @param size uint32_t
*/
void SPIClass::transferBytes(uint8_t * out, uint8_t * in, uint32_t size) {
while(size) {
if(size > 64) {