ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts
1.0
ESP8266ILI9341DisplayProject
|
#include "user_config.h"
#include "mmc_hal.h"
#include "printf/mathio.h"
#include "fatfs.sup/fatfs.h"
Go to the source code of this file.
Macros | |
#define | CS_LOW() mmc_spi_begin() /* Set MMC_CS = low */ |
#define | CS_HIGH() mmc_spi_end() /* Set MMC_CS = high */ |
#define | MMC_CD mmc_ins_status() /* Test if card detected. yes:true, no:false, default:true */ |
#define | MMC_WP mmc_wp_status() /* Test if write protected. yes:true, no:false, default:false */ |
#define | FCLK_SLOW() mmc_slow() /* Set SPI slow clock (100-400kHz) */ |
#define | FCLK_FAST() mmc_fast() /* Set SPI fast clock (20MHz max) */ |
#define | CMD0 (0) /* GO_IDLE_STATE */ |
#define | CMD1 (1) /* SEND_OP_COND (MMC) */ |
#define | ACMD41 (0x80+41) /* SEND_OP_COND (SDC) */ |
#define | CMD8 (8) /* SEND_IF_COND */ |
#define | CMD9 (9) /* SEND_CSD */ |
#define | CMD10 (10) /* SEND_CID */ |
#define | CMD12 (12) /* STOP_TRANSMISSION */ |
#define | ACMD13 (0x80+13) /* SD_STATUS (SDC) */ |
#define | CMD16 (16) /* SET_BLOCKLEN */ |
#define | CMD17 (17) /* READ_SINGLE_BLOCK */ |
#define | CMD18 (18) /* READ_MULTIPLE_BLOCK */ |
#define | CMD23 (23) /* SET_BLOCK_COUNT (MMC) */ |
#define | ACMD23 (0x80+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */ |
#define | CMD24 (24) /* WRITE_BLOCK */ |
#define | CMD25 (25) /* WRITE_MULTIPLE_BLOCK */ |
#define | CMD32 (32) /* ERASE_ER_BLK_START */ |
#define | CMD33 (33) /* ERASE_ER_BLK_END */ |
#define | CMD38 (38) /* ERASE */ |
#define | CMD48 (48) /* READ_EXTR_SINGLE */ |
#define | CMD49 (49) /* WRITE_EXTR_SINGLE */ |
#define | CMD55 (55) /* APP_CMD */ |
#define | CMD58 (58) /* READ_OCR */ |
Functions | |
static MEMSPACE void | power_on (void) |
power on More... | |
static MEMSPACE void | power_off (void) |
power off More... | |
static BYTE | xchg_spi (BYTE dat) |
send/receive a SPI byte More... | |
static void | rcvr_spi_multi (BYTE *p, UINT cnt) |
Receive a data block fast. More... | |
static void | xmit_spi_multi (const BYTE *p, UINT cnt) |
Send a data block fast. More... | |
MEMSPACE int | wait_ready (UINT wt) |
wait for card ready More... | |
static MEMSPACE void | deselect (void) |
Deselect the card and release SPI bus. More... | |
static MEMSPACE int | select (void) |
Select the card and wait for ready. More... | |
static MEMSPACE int | rcvr_datablock (BYTE *buff, UINT btr) |
Receive a data packet from MMC. More... | |
static MEMSPACE BYTE | send_cmd (BYTE cmd, DWORD arg) |
Send a data packet to MMC. More... | |
MEMSPACE DSTATUS | mmc_disk_initialize (void) |
Public Functions. More... | |
MEMSPACE DSTATUS | mmc_disk_status (void) |
Get Disk Status. More... | |
MEMSPACE DRESULT | mmc_disk_read (BYTE *buff, DWORD sector, UINT count) |
Read Sector(s) More... | |
void | mmc_disk_timerproc (void) |
Write Sector(s) More... | |
Variables | |
volatile DSTATUS | Stat = STA_NOINIT |
static volatile BYTE | Timer1 |
static volatile BYTE | Timer2 |
static BYTE | CardType |
#define ACMD13 (0x80+13) /* SD_STATUS (SDC) */ |
Definition at line 61 of file mmc.c.
Referenced by mmc_disk_read().
#define ACMD23 (0x80+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */ |
Definition at line 66 of file mmc.c.
Referenced by mmc_disk_read().
#define ACMD41 (0x80+41) /* SEND_OP_COND (SDC) */ |
Definition at line 56 of file mmc.c.
Referenced by mmc_disk_initialize().
#define CMD0 (0) /* GO_IDLE_STATE */ |
Definition at line 54 of file mmc.c.
Referenced by mmc_disk_initialize(), and send_cmd().
#define CMD1 (1) /* SEND_OP_COND (MMC) */ |
Definition at line 55 of file mmc.c.
Referenced by mmc_disk_initialize().
#define CMD10 (10) /* SEND_CID */ |
Definition at line 59 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD12 (12) /* STOP_TRANSMISSION */ |
Definition at line 60 of file mmc.c.
Referenced by mmc_disk_read(), and send_cmd().
#define CMD16 (16) /* SET_BLOCKLEN */ |
Definition at line 62 of file mmc.c.
Referenced by mmc_disk_initialize().
#define CMD17 (17) /* READ_SINGLE_BLOCK */ |
Definition at line 63 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD18 (18) /* READ_MULTIPLE_BLOCK */ |
Definition at line 64 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD24 (24) /* WRITE_BLOCK */ |
Definition at line 67 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD25 (25) /* WRITE_MULTIPLE_BLOCK */ |
Definition at line 68 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD32 (32) /* ERASE_ER_BLK_START */ |
Definition at line 69 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD33 (33) /* ERASE_ER_BLK_END */ |
Definition at line 70 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD38 (38) /* ERASE */ |
Definition at line 71 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD48 (48) /* READ_EXTR_SINGLE */ |
Definition at line 72 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD49 (49) /* WRITE_EXTR_SINGLE */ |
Definition at line 73 of file mmc.c.
Referenced by mmc_disk_read().
#define CMD55 (55) /* APP_CMD */ |
Definition at line 74 of file mmc.c.
Referenced by send_cmd().
#define CMD58 (58) /* READ_OCR */ |
Definition at line 75 of file mmc.c.
Referenced by mmc_disk_initialize(), and mmc_disk_read().
#define CMD8 (8) /* SEND_IF_COND */ |
Definition at line 57 of file mmc.c.
Referenced by mmc_disk_initialize(), and send_cmd().
#define CMD9 (9) /* SEND_CSD */ |
Definition at line 58 of file mmc.c.
Referenced by mmc_disk_read().
#define CS_HIGH | ( | ) | mmc_spi_end() /* Set MMC_CS = high */ |
Definition at line 40 of file mmc.c.
Referenced by deselect().
#define CS_LOW | ( | ) | mmc_spi_begin() /* Set MMC_CS = low */ |
Definition at line 45 of file mmc.c.
Referenced by mmc_disk_initialize().
Definition at line 44 of file mmc.c.
Referenced by mmc_disk_initialize().
#define MMC_CD mmc_ins_status() /* Test if card detected. yes:true, no:false, default:true */ |
Definition at line 42 of file mmc.c.
Referenced by mmc_disk_timerproc().
#define MMC_WP mmc_wp_status() /* Test if write protected. yes:true, no:false, default:false */ |
Definition at line 43 of file mmc.c.
Referenced by mmc_disk_timerproc().
|
static |
Deselect the card and release SPI bus.
Definition at line 189 of file mmc.c.
Referenced by mmc_disk_initialize(), mmc_disk_read(), select(), and send_cmd().
Public Functions.
Initialize Disk Drive
Definition at line 340 of file mmc.c.
Referenced by disk_initialize().
Read Sector(s)
[in] | buff | read buffer |
[in] | sector | start sector number |
[in] | count | sector count |
Definition at line 433 of file mmc.c.
Referenced by disk_read().
Get Disk Status.
Definition at line 420 of file mmc.c.
Referenced by disk_status().
void mmc_disk_timerproc | ( | void | ) |
Write Sector(s)
[out] | buff | write buffer |
[in] | sector | start sector number |
[in] | count | sector count |
[in] | cmd | Control code |
[in|out] | buff: Send/Receive buffer |
Definition at line 708 of file mmc.c.
Referenced by disk_timerproc(), and mmc_task().
|
static |
power off
Definition at line 110 of file mmc.c.
Referenced by mmc_disk_initialize(), and mmc_disk_read().
|
static |
Receive a data packet from MMC.
[in] | buff | Data buffer to read data into |
[in] | btr | Bytes to read |
Definition at line 224 of file mmc.c.
Referenced by mmc_disk_read().
Receive a data block fast.
[in] | p | Data block to be read |
[in] | cnt | Bytes to read |
Definition at line 139 of file mmc.c.
Referenced by rcvr_datablock().
|
static |
Select the card and wait for ready.
Definition at line 202 of file mmc.c.
Referenced by mmc_disk_read(), and send_cmd().
Send a data packet to MMC.
[in] | buff | Data buffer to write |
[in] | btr | Bytes to write |
[in] | send_cmd | Commend Index |
[in] | cmd | Argument |
Definition at line 288 of file mmc.c.
Referenced by mmc_disk_initialize(), and mmc_disk_read().
wait for card ready
[in] | wt | ms to wait |
Definition at line 169 of file mmc.c.
Referenced by mmc_disk_read(), rcvr_datablock(), and select().
send/receive a SPI byte
[in] | dat | data to send |
Definition at line 126 of file mmc.c.
Referenced by deselect(), mmc_disk_initialize(), mmc_disk_read(), rcvr_datablock(), select(), send_cmd(), and wait_ready().
Send a data block fast.
[out] | p | Data block to be sent |
[in] | cnt | Bytes to send |
Definition at line 152 of file mmc.c.
Referenced by rcvr_datablock().
|
static |
Definition at line 85 of file mmc.c.
Referenced by mmc_disk_initialize(), and mmc_disk_read().
volatile DSTATUS Stat = STA_NOINIT |
Definition at line 79 of file mmc.c.
Referenced by mmc_disk_initialize(), mmc_disk_read(), mmc_disk_status(), mmc_disk_timerproc(), mmc_init(), and mmc_test_timeout().
|
static |
Definition at line 82 of file mmc.c.
Referenced by mmc_disk_timerproc().
|
static |
Definition at line 82 of file mmc.c.
Referenced by mmc_disk_timerproc().