Removed ScreenConfig, SDCardConfig and PinMapping. They are now replaced by a single object : BoardConfig
This commit is contained in:
parent
bd3d17c5c2
commit
6be6c7256d
91
src/app/BoardConfig.cpp
Normal file
91
src/app/BoardConfig.cpp
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#include "BoardConfig.h"
|
||||||
|
|
||||||
|
BoardConfig::BoardConfig(const uint16_t I2C_screenAddress,
|
||||||
|
const uint16_t screenWidth,
|
||||||
|
const uint16_t screenHeight,
|
||||||
|
const uint16_t I2C_IOExpanderAddress,
|
||||||
|
const uint16_t _I2C_RTCFlashAddress,
|
||||||
|
const Pin SPI_SDCard_cs,
|
||||||
|
const Pin I2C_sda,
|
||||||
|
const Pin I2C_scl,
|
||||||
|
const Pin SPI_mosi,
|
||||||
|
const Pin SPI_miso,
|
||||||
|
const Pin SPI_clk//,
|
||||||
|
//const SPISettings spiSpeed
|
||||||
|
):
|
||||||
|
_I2C_sda(I2C_sda == DEFAULT_PIN ? GPIO_4_SDA : I2C_sda),
|
||||||
|
_I2C_scl(I2C_scl == DEFAULT_PIN ? GPIO_5_SCL : I2C_scl),
|
||||||
|
_SPI_mosi(SPI_mosi == DEFAULT_PIN ? GPIO_13_MOSI : SPI_mosi),
|
||||||
|
_SPI_miso(SPI_miso == DEFAULT_PIN ? GPIO_12_MISO : SPI_miso),
|
||||||
|
_SPI_clk(SPI_clk == DEFAULT_PIN ? GPIO_14_CLK : SPI_clk),
|
||||||
|
_SPI_SDCard_cs(_SPI_SDCard_cs == DEFAULT_PIN ? GPIO_2 : SPI_SDCard_cs),
|
||||||
|
_I2C_screenAddress(I2C_screenAddress),
|
||||||
|
_I2C_IOExpanderAddress(I2C_IOExpanderAddress),
|
||||||
|
_I2C_RTCFlashAddress(_I2C_RTCFlashAddress),
|
||||||
|
//_SPISpeed(spiSpeed),
|
||||||
|
_screenWidth(screenWidth),
|
||||||
|
_screenHeight(screenHeight)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Pin BoardConfig::getI2C_sda() const
|
||||||
|
{
|
||||||
|
return _I2C_sda;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pin BoardConfig::getI2C_scl() const
|
||||||
|
{
|
||||||
|
return _I2C_scl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pin BoardConfig::getSPI_mosi() const
|
||||||
|
{
|
||||||
|
return _SPI_mosi;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pin BoardConfig::getSPI_miso() const
|
||||||
|
{
|
||||||
|
return _SPI_miso;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pin BoardConfig::getSPI_clk() const
|
||||||
|
{
|
||||||
|
return _SPI_clk;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pin BoardConfig::getSPI_SDCard_cs() const
|
||||||
|
{
|
||||||
|
return _SPI_SDCard_cs;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t BoardConfig::getI2C_screenAddress() const
|
||||||
|
{
|
||||||
|
return _I2C_screenAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t BoardConfig::getI2C_IOExpanderAddress() const
|
||||||
|
{
|
||||||
|
return _I2C_IOExpanderAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t BoardConfig::getRTCFlashAddress() const
|
||||||
|
{
|
||||||
|
return _I2C_RTCFlashAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*SPISettings BoardConfig::getSPISpeed() const
|
||||||
|
{
|
||||||
|
return _SPISpeed;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
uint16_t BoardConfig::getScreenWidth() const
|
||||||
|
{
|
||||||
|
return _screenWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t BoardConfig::getScreenHeight() const
|
||||||
|
{
|
||||||
|
return _screenHeight;
|
||||||
|
}
|
68
src/app/BoardConfig.h
Normal file
68
src/app/BoardConfig.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
This file is used to define the hardware parameters of the whole board and thus replacing the following files :
|
||||||
|
ScreenConfig.h, SDcardConfig.h, PinMapping.h
|
||||||
|
It contains parameters Pins parameters, I2C addresses and more.
|
||||||
|
**/
|
||||||
|
#ifndef BOARDCONFIG_H
|
||||||
|
#define BOARDCONFIG_H
|
||||||
|
#include "definition.h"
|
||||||
|
//#include <SdFat.h>
|
||||||
|
|
||||||
|
class BoardConfig
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BoardConfig(const uint16_t I2C_screenAddress = 0x3C,
|
||||||
|
const uint16_t screenWidth = 128,
|
||||||
|
const uint16_t screenHeight = 64,
|
||||||
|
const uint16_t I2C_IOExpanderAddress = 0x27,
|
||||||
|
const uint16_t _I2C_RTCFlashAddress = 0x0,
|
||||||
|
const Pin SPI_SDCard_cs = GPIO_2,
|
||||||
|
const Pin I2C_sda = GPIO_4_SDA,
|
||||||
|
const Pin I2C_scl = GPIO_5_SCL,
|
||||||
|
const Pin SPI_mosi = GPIO_13_MOSI,
|
||||||
|
const Pin SPI_miso = GPIO_12_MISO,
|
||||||
|
const Pin SPI_clk = GPIO_14_CLK//,
|
||||||
|
//const SPISettings spiSpeed = SPI_FULL_SPEED
|
||||||
|
);
|
||||||
|
|
||||||
|
Pin getI2C_sda() const;
|
||||||
|
Pin getI2C_scl() const;
|
||||||
|
|
||||||
|
Pin getSPI_mosi() const;
|
||||||
|
Pin getSPI_miso() const;
|
||||||
|
Pin getSPI_clk() const;
|
||||||
|
Pin getSPI_SDCard_cs() const;
|
||||||
|
|
||||||
|
uint16_t getI2C_screenAddress() const;
|
||||||
|
uint16_t getI2C_IOExpanderAddress() const;
|
||||||
|
uint16_t getRTCFlashAddress() const;
|
||||||
|
|
||||||
|
//SPISettings getSPISpeed() const;
|
||||||
|
|
||||||
|
uint16_t getScreenWidth() const;
|
||||||
|
uint16_t getScreenHeight() const;
|
||||||
|
protected:
|
||||||
|
|
||||||
|
private:
|
||||||
|
//1) Pins
|
||||||
|
const Pin _I2C_sda;
|
||||||
|
const Pin _I2C_scl;
|
||||||
|
const Pin _SPI_mosi;
|
||||||
|
const Pin _SPI_miso;
|
||||||
|
const Pin _SPI_clk;
|
||||||
|
const Pin _SPI_SDCard_cs;
|
||||||
|
|
||||||
|
//2) I2C Addresses
|
||||||
|
const uint16_t _I2C_screenAddress;
|
||||||
|
const uint16_t _I2C_IOExpanderAddress;
|
||||||
|
const uint16_t _I2C_RTCFlashAddress;
|
||||||
|
|
||||||
|
//3) SPI Speed
|
||||||
|
//const SPISettings _SPISpeed;
|
||||||
|
|
||||||
|
//4) Miscellaneous
|
||||||
|
const uint16_t _screenWidth;
|
||||||
|
const uint16_t _screenHeight;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //BOARDCONFIG_H
|
@ -1,59 +0,0 @@
|
|||||||
#include "PinMapping.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper class to define the pin mapping
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Default pin mapping
|
|
||||||
PinMapping::PinMapping() :
|
|
||||||
_I2C_sda(GPIO_4_SDA),
|
|
||||||
_I2C_scl(GPIO_5_SCL),
|
|
||||||
_SPI_mosi(GPIO_13_MOSI),
|
|
||||||
_SPI_miso(GPIO_12_MISO),
|
|
||||||
_SPI_clk(GPIO_14_CLK),
|
|
||||||
_SPI_sdCard_cs(GPIO_2)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//Custom pin mapping
|
|
||||||
PinMapping::PinMapping(const Pin I2C_sda, const Pin I2C_scl, const Pin SPI_mosi, const Pin SPI_miso, const Pin SPI_clk, const Pin SPI_sdCard_cs) :
|
|
||||||
_I2C_sda(I2C_sda == DEFAULT_PIN ? GPIO_4_SDA : I2C_sda),
|
|
||||||
_I2C_scl(I2C_scl == DEFAULT_PIN ? GPIO_5_SCL : I2C_scl),
|
|
||||||
_SPI_mosi(SPI_mosi == DEFAULT_PIN ? GPIO_13_MOSI : SPI_mosi),
|
|
||||||
_SPI_miso(SPI_miso == DEFAULT_PIN ? GPIO_12_MISO : SPI_miso),
|
|
||||||
_SPI_clk(SPI_clk == DEFAULT_PIN ? GPIO_14_CLK : SPI_clk),
|
|
||||||
_SPI_sdCard_cs(SPI_sdCard_cs == DEFAULT_PIN ? GPIO_2 : SPI_sdCard_cs)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//Accessors
|
|
||||||
Pin PinMapping::getI2C_sda() const
|
|
||||||
{
|
|
||||||
return _I2C_sda;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pin PinMapping::getI2C_scl() const
|
|
||||||
{
|
|
||||||
return _I2C_scl;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pin PinMapping::getSPI_mosi() const
|
|
||||||
{
|
|
||||||
return _SPI_mosi;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pin PinMapping::getSPI_miso() const
|
|
||||||
{
|
|
||||||
return _SPI_miso;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pin PinMapping::getSPI_clk() const
|
|
||||||
{
|
|
||||||
return _SPI_clk;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pin PinMapping::getSPI_sdCard_cs() const
|
|
||||||
{
|
|
||||||
return _SPI_sdCard_cs;
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
#ifndef PINMAPPING_H
|
|
||||||
#define PINMAPPING_H
|
|
||||||
#include "definition.h"
|
|
||||||
|
|
||||||
class PinMapping
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PinMapping();
|
|
||||||
PinMapping(const Pin I2C_sda, const Pin I2C_scl, const Pin SPI_mosi, const Pin SPI_miso, const Pin SPI_clk, const Pin SPI_sdCard_cs);
|
|
||||||
|
|
||||||
Pin getI2C_sda() const;
|
|
||||||
Pin getI2C_scl() const;
|
|
||||||
|
|
||||||
Pin getSPI_mosi() const;
|
|
||||||
Pin getSPI_miso() const;
|
|
||||||
Pin getSPI_clk() const;
|
|
||||||
Pin getSPI_sdCard_cs() const;
|
|
||||||
private:
|
|
||||||
const Pin _I2C_sda;
|
|
||||||
const Pin _I2C_scl;
|
|
||||||
const Pin _SPI_mosi;
|
|
||||||
const Pin _SPI_miso;
|
|
||||||
const Pin _SPI_clk;
|
|
||||||
const Pin _SPI_sdCard_cs;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //PINMAPPING_H
|
|
@ -1,16 +1,13 @@
|
|||||||
#include "SAB.h"
|
#include "SAB.h"
|
||||||
|
|
||||||
SAB::SAB() : _screenConfig(128, 64, 0x3C),
|
SAB::SAB() : _display(_boardConfig.getScreenWidth(), _boardConfig.getScreenHeight(), &Wire),
|
||||||
_sdCardConfig(SPI_FULL_SPEED),
|
|
||||||
_display(_screenConfig.getWidth(),
|
|
||||||
_screenConfig.getHeight(), &Wire),
|
|
||||||
_screenManager(_display), _rtc(),
|
_screenManager(_display), _rtc(),
|
||||||
_rtcManager(_rtc), _sdCardManager(),
|
_rtcManager(_rtc), _sdCardManager(),
|
||||||
_connectivityManager(NULL),
|
_connectivityManager(NULL),
|
||||||
//_webServerManager(80, &_sdCardManager),
|
//_webServerManager(80, &_sdCardManager),
|
||||||
_webServer(80, &_sdCardManager),
|
_webServer(80, &_sdCardManager),
|
||||||
_ftpServer(21, &_sdCardManager, "ESP8266", "12345678"),
|
_ftpServer(21, &_sdCardManager, "ESP8266", "12345678"),
|
||||||
_pcf(0x27, Wire),
|
_pcf(_boardConfig.getI2C_IOExpanderAddress(), Wire),
|
||||||
_ioManager(_pcf),
|
_ioManager(_pcf),
|
||||||
_taskSchedulerManager(_rtcManager),
|
_taskSchedulerManager(_rtcManager),
|
||||||
_error(0)
|
_error(0)
|
||||||
@ -22,18 +19,16 @@ _error(0)
|
|||||||
delay(200);
|
delay(200);
|
||||||
|
|
||||||
//We initialize the pins for the I2C communication
|
//We initialize the pins for the I2C communication
|
||||||
Wire.begin(_pinConfig.getI2C_sda(), _pinConfig.getI2C_scl());
|
Wire.begin(_boardConfig.getI2C_sda(), _boardConfig.getI2C_scl());
|
||||||
if(!_rtc.begin()) _error |= RTC_BEGIN_ERR;
|
if(!_rtc.begin()) _error |= RTC_BEGIN_ERR;
|
||||||
if(!_display.begin(SSD1306_SWITCHCAPVCC, _screenConfig.getAddress())){ _error |= DISP_BEGIN_ERR; }
|
if(!_display.begin(SSD1306_SWITCHCAPVCC, _boardConfig.getI2C_screenAddress())){ _error |= DISP_BEGIN_ERR; }
|
||||||
if(!_sdCardManager.begin(_pinConfig.getSPI_sdCard_cs(), _sdCardConfig.getSPISpeed())){ _error |= SDCARD_INIT_ERR; Serial.print("Failed to init SDCard : SPI_SPEED : "); Serial.print(_sdCardConfig.getSPISpeed()); Serial.print(" CS PIN : "); Serial.println(_pinConfig.getSPI_sdCard_cs());}
|
if(!_sdCardManager.begin(_boardConfig.getSPI_SDCard_cs(), 8000000)){ _error |= SDCARD_INIT_ERR; Serial.print("Failed to init SDCard : SPI_SPEED : "); Serial.print(8000000); Serial.print(" CS PIN : "); Serial.println(_boardConfig.getSPI_SDCard_cs());}
|
||||||
_connectivityManager = new ConnectivityManager(_sdCardManager);
|
_connectivityManager = new ConnectivityManager(_sdCardManager);
|
||||||
if(!_pcf.begin()){_error |= IO_INIT_ERR;}
|
if(!_pcf.begin()){_error |= IO_INIT_ERR;}
|
||||||
}
|
}
|
||||||
|
|
||||||
SAB::SAB(const PinMapping pinConfig, const ScreenConfig screenConfig, const SDCardConfig sdCardConfig, const unsigned int webServerPort) : _pinConfig(pinConfig),
|
SAB::SAB(const BoardConfig boardConfig, const unsigned int webServerPort, const unsigned int ftpServerPort) : _boardConfig(boardConfig),
|
||||||
_screenConfig(screenConfig),
|
_display(_boardConfig.getScreenWidth(), _boardConfig.getScreenHeight(), &Wire),
|
||||||
_sdCardConfig(sdCardConfig),
|
|
||||||
_display(_screenConfig.getWidth(), _screenConfig.getHeight(), &Wire),
|
|
||||||
_screenManager(_display),
|
_screenManager(_display),
|
||||||
_rtc(),
|
_rtc(),
|
||||||
_rtcManager(_rtc),
|
_rtcManager(_rtc),
|
||||||
@ -41,8 +36,8 @@ _sdCardManager(),
|
|||||||
_connectivityManager(NULL),
|
_connectivityManager(NULL),
|
||||||
//_webServerManager(webServerPort, &_sdCardManager),
|
//_webServerManager(webServerPort, &_sdCardManager),
|
||||||
_webServer(webServerPort, &_sdCardManager),
|
_webServer(webServerPort, &_sdCardManager),
|
||||||
_ftpServer(21, &_sdCardManager, "ESP8266", "12345678"),
|
_ftpServer(ftpServerPort, &_sdCardManager, "ESP8266", "12345678"),
|
||||||
_pcf(0x27, Wire),
|
_pcf(_boardConfig.getI2C_IOExpanderAddress(), Wire),
|
||||||
_ioManager(_pcf),
|
_ioManager(_pcf),
|
||||||
_taskSchedulerManager(_rtcManager),
|
_taskSchedulerManager(_rtcManager),
|
||||||
_error(0)
|
_error(0)
|
||||||
@ -53,10 +48,10 @@ _error(0)
|
|||||||
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
|
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
|
||||||
delay(200);
|
delay(200);
|
||||||
//We initialize the pins for the I2C communication
|
//We initialize the pins for the I2C communication
|
||||||
Wire.begin(_pinConfig.getI2C_sda(), _pinConfig.getI2C_scl());
|
Wire.begin(_boardConfig.getI2C_sda(), _boardConfig.getI2C_scl());
|
||||||
if(!_rtc.begin()) _error |= RTC_BEGIN_ERR;
|
if(!_rtc.begin()) _error |= RTC_BEGIN_ERR;
|
||||||
if(!_display.begin(SSD1306_SWITCHCAPVCC, _screenConfig.getAddress())) _error |= DISP_BEGIN_ERR;
|
if(!_display.begin(SSD1306_SWITCHCAPVCC, _boardConfig.getI2C_screenAddress())) _error |= DISP_BEGIN_ERR;
|
||||||
if(!_sdCardManager.begin(_pinConfig.getSPI_sdCard_cs(), _sdCardConfig.getSPISpeed())){ _error |= SDCARD_INIT_ERR; Serial.print("Failed to init SDCard : SPI_SPEED : "); Serial.print(_sdCardConfig.getSPISpeed()); Serial.print(" CS PIN : "); Serial.println(_pinConfig.getSPI_sdCard_cs());}
|
if(!_sdCardManager.begin(_boardConfig.getSPI_SDCard_cs(), 8000000)){ _error |= SDCARD_INIT_ERR; Serial.print("Failed to init SDCard : SPI_SPEED : "); Serial.print(8000000); Serial.print(" CS PIN : "); Serial.println(_boardConfig.getSPI_SDCard_cs());}
|
||||||
_connectivityManager = new ConnectivityManager(_sdCardManager);
|
_connectivityManager = new ConnectivityManager(_sdCardManager);
|
||||||
if(!_pcf.begin()){_error |= IO_INIT_ERR;}
|
if(!_pcf.begin()){_error |= IO_INIT_ERR;}
|
||||||
}
|
}
|
||||||
@ -116,19 +111,9 @@ PowerManager& SAB::getPowerManager()
|
|||||||
return _powerManager;
|
return _powerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenConfig SAB::getScreenConfig() const
|
BoardConfig SAB::getBoardConfig() const
|
||||||
{
|
{
|
||||||
return _screenConfig;
|
return _boardConfig;
|
||||||
}
|
|
||||||
|
|
||||||
PinMapping SAB::getPinConfig() const
|
|
||||||
{
|
|
||||||
return _pinConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDCardConfig SAB::getSdCardConfig() const
|
|
||||||
{
|
|
||||||
return _sdCardConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *SAB::getSoftVersion() const
|
const char *SAB::getSoftVersion() const
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#ifndef SAB_H
|
#ifndef SAB_H
|
||||||
#define SAB_H
|
#define SAB_H
|
||||||
#include "PinMapping.h"
|
|
||||||
#include "ScreenConfig.h"
|
#include "BoardConfig.h"
|
||||||
#include "SDCardConfig.h"
|
|
||||||
#include "RtcManager.h"
|
#include "RtcManager.h"
|
||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "SDCardManager.h"
|
#include "SDCardManager.h"
|
||||||
@ -24,7 +23,7 @@ class SAB
|
|||||||
enum Error {RTC_BEGIN_ERR = 1, DISP_BEGIN_ERR = 2, SDCARD_INIT_ERR = 4, IO_INIT_ERR = 8};
|
enum Error {RTC_BEGIN_ERR = 1, DISP_BEGIN_ERR = 2, SDCARD_INIT_ERR = 4, IO_INIT_ERR = 8};
|
||||||
|
|
||||||
SAB();
|
SAB();
|
||||||
SAB(const PinMapping pinConfig, const ScreenConfig screenConfig, const SDCardConfig sdCardConfig, const unsigned int webServerPort);
|
SAB(const BoardConfig boardConfig, const unsigned int webServerPort = 80, const unsigned int ftpServerPort = 21);
|
||||||
~SAB()
|
~SAB()
|
||||||
{
|
{
|
||||||
delete _connectivityManager;
|
delete _connectivityManager;
|
||||||
@ -40,16 +39,12 @@ class SAB
|
|||||||
IOManager& getIoManager();
|
IOManager& getIoManager();
|
||||||
TaskSchedulerManager& getTaskSchedulerManager();
|
TaskSchedulerManager& getTaskSchedulerManager();
|
||||||
PowerManager& getPowerManager();
|
PowerManager& getPowerManager();
|
||||||
ScreenConfig getScreenConfig() const;
|
BoardConfig getBoardConfig() const;
|
||||||
PinMapping getPinConfig() const;
|
|
||||||
SDCardConfig getSdCardConfig() const;
|
|
||||||
const char *getSoftVersion() const;
|
const char *getSoftVersion() const;
|
||||||
unsigned char getError() const;
|
unsigned char getError() const;
|
||||||
private:
|
private:
|
||||||
void initGPIO();
|
void initGPIO();
|
||||||
const PinMapping _pinConfig;
|
const BoardConfig _boardConfig;
|
||||||
const ScreenConfig _screenConfig;
|
|
||||||
const SDCardConfig _sdCardConfig;
|
|
||||||
|
|
||||||
Adafruit_SSD1306 _display;
|
Adafruit_SSD1306 _display;
|
||||||
ScreenManager _screenManager;
|
ScreenManager _screenManager;
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
#include <Arduino.h>
|
|
||||||
#include "SDCardConfig.h"
|
|
||||||
|
|
||||||
SDCardConfig::SDCardConfig(const uint32_t spiSpeed) : _spiSpeed(spiSpeed)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint32_t SDCardConfig::getSPISpeed() const
|
|
||||||
{
|
|
||||||
return _spiSpeed;
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
#ifndef SDCARDCONFIG_H
|
|
||||||
#define SDCARDCONFIG_H
|
|
||||||
|
|
||||||
class SDCardConfig
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SDCardConfig(const uint32_t spiSpeed);
|
|
||||||
const uint32_t getSPISpeed() const;
|
|
||||||
private:
|
|
||||||
const uint32_t _spiSpeed;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //SDCARDCONFIG_H
|
|
@ -1,24 +0,0 @@
|
|||||||
#include "ScreenConfig.h"
|
|
||||||
|
|
||||||
ScreenConfig::ScreenConfig(const unsigned char width, const unsigned char height, const unsigned char address) :
|
|
||||||
_width(width),
|
|
||||||
_height(height),
|
|
||||||
_address(address)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char ScreenConfig::getWidth() const
|
|
||||||
{
|
|
||||||
return _width;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char ScreenConfig::getHeight() const
|
|
||||||
{
|
|
||||||
return _height;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char ScreenConfig::getAddress() const
|
|
||||||
{
|
|
||||||
return _address;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
#ifndef SCREENCONFIG_H
|
|
||||||
#define SCREENCONFIG_H
|
|
||||||
|
|
||||||
class ScreenConfig
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ScreenConfig(const unsigned char width, const unsigned char height, const unsigned char address);
|
|
||||||
unsigned char getWidth() const;
|
|
||||||
unsigned char getHeight() const;
|
|
||||||
unsigned char getAddress() const;
|
|
||||||
private:
|
|
||||||
const unsigned char _width;
|
|
||||||
const unsigned char _height;
|
|
||||||
const unsigned char _address;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //SCREENCONFIG_H
|
|
@ -1,5 +1,4 @@
|
|||||||
#include "definition.h"
|
#include "definition.h"
|
||||||
#include "PinMapping.h"
|
|
||||||
#include "SAB.h"
|
#include "SAB.h"
|
||||||
#include "views.h"
|
#include "views.h"
|
||||||
#include "webApi.h"
|
#include "webApi.h"
|
||||||
|
@ -121,7 +121,7 @@ boolean sdCardMountApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *w
|
|||||||
float *sdCardSize = (float *) &pV->pView->sdCardSize;
|
float *sdCardSize = (float *) &pV->pView->sdCardSize;
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
|
|
||||||
if(p->getSdCardManager().begin(p->getPinConfig().getSPI_sdCard_cs(), p->getSdCardConfig().getSPISpeed()))
|
if(p->getSdCardManager().begin(p->getBoardConfig().getSPI_SDCard_cs(), 8000000))
|
||||||
{
|
{
|
||||||
sprintf(buffer,"HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{ \"status\" : \"ok\", \"card\" : \"mounted\" }");
|
sprintf(buffer,"HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{ \"status\" : \"ok\", \"card\" : \"mounted\" }");
|
||||||
*sdCardSize = p->getSdCardManager().getSize(GBYTE);
|
*sdCardSize = p->getSdCardManager().getSize(GBYTE);
|
||||||
|
Loading…
Reference in New Issue
Block a user