|
ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts
1.0
ESP8266ILI9341DisplayProject
|
HAL layer SPI, GPIO, address and chip select. More...
#include "user_config.h"#include "hal.h"#include <stdint.h>#include <stdarg.h>#include <string.h>#include <math.h>Go to the source code of this file.
Functions | |
| void | gpio_pin_sfr_mode (int pin) |
| GPIO HAL. More... | |
| void | gpio_pin_out (uint8_t pin, uint8_t val) |
| set GPIO pin state HI or LOW More... | |
| uint8_t | gpio_pin_rd (uint8_t pin) |
| read GPIO pin More... | |
| void | chip_select_init (uint8_t pin) |
| CHIP select HAL. More... | |
| void | chip_select (uint8_t pin) |
| set GPIO to select - LOW More... | |
| void | chip_deselect (uint8_t pin) |
| set GPIO to deselect - HI More... | |
| void | chip_addr_init () |
| ADDRESS select HAL. More... | |
| void | chip_addr (int addr) |
| set address on GPIO lines More... | |
| void | spi_waitReady () |
| SPI bus wrapper functions for multiple device support. More... | |
| void | spi_init (uint32_t clock, int pin) |
| void | spi_begin (uint32_t clock, int pin) |
| SPI chip enable function Function waits for current tranaction to finish before proceeding. More... | |
| void | spi_end (uint8_t pin) |
| SPI chip disable function wait for current tranaction to finish! More... | |
| uint8_t | spi_chip_select_status () |
| SPI CS pin status return CS GPIO pin number or 0xff. More... | |
| void | spi_TX_buffer (const uint8_t *data, int count) |
| SPI write buffer. More... | |
| void | spi_RX_buffer (const uint8_t *data, int count) |
| SPI read buffer. More... | |
| void | spi_TXRX_buffer (const uint8_t *data, int count) |
| SPI write/read buffer. More... | |
| uint8_t | spi_RX () |
| SPI read 1 byte. More... | |
| void | spi_TX (uint8_t data) |
| SPI write 1 byte. More... | |
| uint8_t | spi_TXRX (uint8_t data) |
| SPI read and write 1 byte. More... | |
Variables | |
| uint8_t | _cs_pin = 0xff |
| SPI init function Function waits for current tranaction to finish before proceeding. More... | |
| uint32_t | _spi_clock = -1L |
HAL layer SPI, GPIO, address and chip select.
This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file hal.c.
| void chip_addr | ( | int | addr | ) |
| void chip_addr_init | ( | void | ) |
ADDRESS select HAL.
initialize GPIO pin as address lines for a device
Definition at line 242 of file hal.c.
Referenced by setup(), and tft_addr_init().
| void chip_deselect | ( | uint8_t | pin | ) |
set GPIO to deselect - HI
| [in] | pin | GPIO pin number |
Definition at line 227 of file hal.c.
Referenced by spi_end(), and spi_init().
| void chip_select | ( | uint8_t | pin | ) |
set GPIO to select - LOW
| [in] | pin | GPIO pin number |
Definition at line 213 of file hal.c.
Referenced by spi_begin().
| void chip_select_init | ( | uint8_t | pin | ) |
CHIP select HAL.
initilize GPIO as an active HI chip select
| [in] | pin | GPIO pin number |
Definition at line 198 of file hal.c.
Referenced by mmc_spi_init(), setup(), tft_reset_init(), tft_spi_init_fast(), and tft_spi_init_slow().
| void gpio_pin_sfr_mode | ( | int | pin | ) |
| void spi_begin | ( | uint32_t | clock, |
| int | pin | ||
| ) |
SPI chip enable function Function waits for current tranaction to finish before proceeding.
| [in] | clock | SPI clock rate |
| [in] | pin | GPIO CS pin |
initialize pin in case it has not been done yet @ we cache the clock frequency seeting for multiple device support
Definition at line 355 of file hal.c.
Referenced by mmc_spi_begin(), and tft_spi_begin().
| uint8_t spi_chip_select_status | ( | void | ) |
| void spi_end | ( | uint8_t | pin | ) |
SPI chip disable function wait for current tranaction to finish!
| [in] | pin | GPIO CS pin |
Definition at line 388 of file hal.c.
Referenced by loop(), mmc_spi_end(), and tft_spi_end().
| void spi_init | ( | uint32_t | clock, |
| int | pin | ||
| ) |
Definition at line 327 of file hal.c.
Referenced by spi_begin().
| void spi_RX_buffer | ( | const uint8_t * | data, |
| int | count | ||
| ) |
SPI read buffer.
| [in] | *data | transmit buffer |
| [in] | count | number of bytes to write |
Definition at line 428 of file hal.c.
Referenced by mmc_spi_RX_buffer(), and tft_spi_RX().
| void spi_TX | ( | uint8_t | data | ) |
SPI write 1 byte.
| [in] | data | value to transmit |
Definition at line 469 of file hal.c.
Referenced by spi_init().
| void spi_TX_buffer | ( | const uint8_t * | data, |
| int | count | ||
| ) |
SPI write buffer.
| [in] | *data | transmit buffer |
| [in] | count | number of bytes to write |
Definition at line 414 of file hal.c.
Referenced by mmc_spi_TX_buffer(), and tft_spi_TX().
SPI read and write 1 byte.
| [in] | data | value to transmit |
Definition at line 483 of file hal.c.
Referenced by mmc_spi_TXRX().
| void spi_TXRX_buffer | ( | const uint8_t * | data, |
| int | count | ||
| ) |
SPI write/read buffer.
| [in] | *data | transmit/receive buffer |
| [in] | count | number of bytes to write |
Definition at line 442 of file hal.c.
Referenced by tft_spi_TXRX().
| void spi_waitReady | ( | void | ) |
SPI bus wrapper functions for multiple device support.
Function waits for current SPI tranaction to finish before proceeding
Definition at line 306 of file hal.c.
Referenced by spi_begin(), spi_end(), spi_init(), tft_spi_RX(), tft_spi_TX(), and tft_spi_TXRX().
| uint8_t _cs_pin = 0xff |
SPI init function Function waits for current tranaction to finish before proceeding.
| [in] | clock | SPI clock rate |
| [in] | pin | GPIO CS pin |
Definition at line 325 of file hal.c.
Referenced by spi_begin(), spi_chip_select_status(), spi_end(), and spi_init().
| uint32_t _spi_clock = -1L |
Definition at line 326 of file hal.c.
Referenced by spi_begin(), and spi_init().
1.8.11