MAkeFile bits

This commit is contained in:
Paul Warren 2023-07-10 20:33:47 +10:00
parent 11cd368a80
commit 454c5607e4
14 changed files with 4227 additions and 0 deletions

View File

@ -0,0 +1,264 @@
/* hal.h
*/
#ifndef HAL_H_
#define HAL_H_
#include <main.h>
#include <stdint.h>
#include <stdbool.h>
//#include <stm32f10x.h>
//#include <stm32f415xx.h>
#ifdef PSDR2
#include "stm32f429xx.h"
#include <stm32f4xx_hal_gpio.h>
#include "stm32f4xx_hal_dma.h"
#include "stm32f4xx_hal_usart.h"
#include "stm32f4xx_hal_i2c.h"
#endif
// #include <stm32f10x_gpio.h>
#ifdef PSDR257
#include "stm32f7xx_hal.h"
//#include "stm32f746xx.h"
//#include <stm32f7xx_hal_gpio.h>
//#include "stm32f7xx_hal_dma.h"
//#include "stm32f7xx_hal_dma2d.h"
//#include "stm32f7xx_hal_dma_ex.h"
//#include "stm32f7xx_hal_usart.h"
//#include "stm32f7xx_hal_i2c.h"
#endif
//#include <uart.h>
typedef struct _Gpio_Pin
{
GPIO_TypeDef* port;
uint16_t pin;
} Gpio_Pin;
// a timer with which channel of the timer specified
typedef struct _Timer_Channel
{
uint8_t channel;
TIM_TypeDef* timer;
} Timer_Channel;
// a Timer_Pin is a gpio pin that is connected to an internal timer
typedef struct _Timer_Pin
{
Gpio_Pin gpioPin;
Timer_Channel timer;
} Timer_Pin;
typedef void
(*hal_sysTickCallback) (void);
// hal wrappers for GPIO
// gpioPin must be a Gpio_Pin struct
// val must be either a 0 or a 1
#define hal_writeGpio(gpioPin, val) (GPIO_WriteBit((gpioPin).port, (gpioPin).pin, (val))) // returns void
#define hal_readGpio(gpioPin) (GPIO_ReadInputDataBit((gpioPin).port, (gpioPin).pin)) // returns uint8_t
// // power macros
// #define hal_isPlugged(powerState) (!((powerState) & hal_externalPower))
__IO uint32_t timingDelay;
#define MEDIATEK_MODULE
#define hal_gpsUart USART1
// gpio pins
// extern const Gpio_Pin RX_TO_GSM;
// extern const Gpio_Pin TX_FROM_GSM;
// extern const Gpio_Pin FINGER_PRINT_POWER;
// extern const Gpio_Pin USER_BUTTON;
// extern const Gpio_Pin FPR_RX;
// extern const Gpio_Pin FPR_TX;
// extern const Gpio_Pin BUZZER;
// extern const Gpio_Pin RFID_INT;
// extern const Gpio_Pin FINGER_PRINT_BUTTON;
extern const Gpio_Pin LCD_NSS;
// extern const Gpio_Pin LOW_BAT;
extern const Gpio_Pin RX_TO_GPS;
extern const Gpio_Pin TX_FROM_GPS;
extern const Gpio_Pin GPS_RESET;
//extern const Gpio_Pin GPS_FIX_LED;
extern const Gpio_Pin GPS_PPS;
extern const Gpio_Pin GPS_POWER;
extern const Gpio_Pin LCD_SCK;
extern const Gpio_Pin LCD_MISO;
extern const Gpio_Pin LCD_MOSI;
extern const Gpio_Pin SPI2_SCK;
extern const Gpio_Pin SPI2_MISO;
extern const Gpio_Pin SPI2_MOSI;
extern const Gpio_Pin LCD_RESET;
extern const Gpio_Pin LCD_DC;
extern const Gpio_Pin RX_Q;
extern const Gpio_Pin RX_I;
// extern const Gpio_Pin OLED_RESET;
// extern const Gpio_Pin OLED_DC;
// extern const Gpio_Pin OLED_NSS;
//CORRECT FOR PSDR1
//extern const Gpio_Pin ddsReset;
//extern const Gpio_Pin ddsSleep;
//extern const Gpio_Pin dds1Mosi;
//extern const Gpio_Pin dds1Nss;
//extern const Gpio_Pin dds1Sck;
//extern const Gpio_Pin dds2Mosi;
//extern const Gpio_Pin dds2Nss;
//extern const Gpio_Pin dds2Sck;
extern const Gpio_Pin encoderBee;
extern const Gpio_Pin encoderB;
extern const Gpio_Pin encoderP;
extern const Gpio_Pin dac1;
extern const Gpio_Pin dac2;
//extern const Gpio_Pin REF_CLOCK_ENABLE;
//extern const Gpio_Pin DDS_FSEL;
//extern const Gpio_Pin DDS_PSEL;
//extern const Gpio_Pin RX_MUX;
//extern const Gpio_Pin TX_MUX;
extern const Gpio_Pin AMP_SWITCH_A;
extern const Gpio_Pin AMP_SWITCH_B;
extern const Gpio_Pin IMP_BRIDGE_SWITCH_A;
extern const Gpio_Pin IMP_BRIDGE_SWITCH_B;
//extern const Gpio_Pin MIXER_SWITCH_A;
//extern const Gpio_Pin MIXER_SWITCH_B;
extern const Gpio_Pin TX_RF_SWITCH_A;
extern const Gpio_Pin TX_RF_SWITCH_B;
extern const Gpio_Pin AMP_POWER;
//extern const Gpio_Pin MIXER_POWER;
extern const Gpio_Pin FILTER_GAIN_POT_SCLK;
extern const Gpio_Pin FILTER_GAIN_POT_MOSI;
extern const Gpio_Pin GAIN_POT_NSS;
extern const Gpio_Pin IN_AMP_ENABLE;
extern const Gpio_Pin DAC_MUX;
extern const Gpio_Pin AUDIO_AMP_NSHTDWN;
extern const Gpio_Pin EARPHONE_NOT_INSERTED;
extern const Gpio_Pin SIDETONE; //Should be a timer pin.
extern const Gpio_Pin MIC_IN;
extern const Gpio_Pin MIC_SWITCH;
extern const Gpio_Pin PREAMP_POWER;
extern const Gpio_Pin MIC_BUTTON;
extern const Gpio_Pin PADDLE_THUMB_NO;
extern const Gpio_Pin PADDLE_INDEX_NO;
extern const Gpio_Pin PADDLE_THUMB_NC;
extern const Gpio_Pin PADDLE_INDEX_NC;
extern const Gpio_Pin FILTER_S0;
extern const Gpio_Pin FILTER_S1;
extern const Gpio_Pin TRX_SWITCH;
extern const Gpio_Pin I2C_SCL;
extern const Gpio_Pin I2C_SDA;
extern const Gpio_Pin FLIP_FLOP_ENABLE;
extern const Gpio_Pin RED_LED;
extern const Gpio_Pin CHARGE_POWER_SOURCE;
extern const Gpio_Pin FIVE_VOLT_REGULATOR_ENABLE;
// extern const Gpio_Pin NC_1;
// extern const Gpio_Pin DAC_SWITCHES;
// extern const Gpio_Pin GSM_PWRKEY;
// extern const Gpio_Pin GSM_STATUS;
// extern const Gpio_Pin GSM_NRST;
// extern const Gpio_Pin SERVO_PWR;
// extern const Gpio_Pin CHARGE_STATUS2;
// extern const Gpio_Pin POWER_GOOD;
// extern const Gpio_Pin POWER_SWITCH;
// extern const Gpio_Pin ACCEL_NSS;
// timer pins
// extern const Timer_Pin LED_G;
// extern const Timer_Pin LED_R;
// extern const Timer_Pin LED_B;
// extern const Timer_Pin SERVO1;
// extern const Timer_Pin SERVO2;
//extern inline bool
//hal_checkTimeout (uint32_t startTime_ms, uint32_t interval_ms);
// returns true if the interval has timed out
int
hal_acquireSemaphore (uint8_t sem);
void
hal_releaseSemaphore (uint8_t sem);
void
hal_getBatteryVoltage (float* battVoltage);
// reads power voltage level
void
hal_delay_ms (uint32_t ms);
// busy wait for ms milliseconds
void
hal_setupPins (void);
// Setup gpio pins and timer pins.
void
hal_timerSetCompare (const Timer_Channel* timer, uint16_t value);
// set the timer compare register for timer
void
hal_setupTimers (void);
// Setup TIM3 and TIM4 for controlling the LEDs and Servos
uint32_t
hal_getCurrentTime_ms (void);
// get the current system millisecond count
void
hal_setupUart1 (void);
// setup usart 1 and its pins
void
hal_setupUart2 (void);
// setup usart 2 and its pins
void
hal_setupUart3 (unsigned int baudRate);
// setup usart 3 and its pins
void
hal_resetUart1 (void);
// resets usart 1 and its pins
void
hal_resetUart2 (void);
// resets usart 2 and its pins
void
hal_resetUart3 (void);
// resets usart 3 and its pins
void
hal_adcConfigure (void);
// configure and enable used ADC(s)
uint16_t
hal_readAdc1 (uint8_t channel);
// read a value on a channel of ADC1
// returns value read
void
hal_setSysTickCallback (hal_sysTickCallback callback);
//void hal_blinkLed(uint8_t led, uint8_t blinkCount, uint16_t onTime, uint16_t offTime);
// blink the given LED blinkCount times
#endif /* HAL_H_ */

View File

@ -0,0 +1,8 @@
target extended-remote :4242
set mem inaccessible-by-default off
set print pretty
b HardFault_Handler
set confirm off

View File

@ -0,0 +1,28 @@
# How to flash
Install st-flash:
```
sudo apt install stlink-tools
```
flash your PSDR:
```
st-flash --reset --format ihex write PSDR.hex
```
If you have flashed a bad firmware, and nothing seems to work and st-flash complains about an 'Unkown memory region", and hitting reset appears to do nothing, try adding --flash=1024k:
```
st-flash --flash=1024k --reset --format ihex write PSDR.hex
```
If done with a known good PSDR.hex, that should get you back up and running.
md5sums for various versions:
753d9dcba118c7a37a19853c742e8760 PSDR.hex from Debug in 'master' branch
d236d21e599071596ffeef3bd60a4d60 PSDR.hex from Source/Debug in PSDR_F7 branch
8762b368d656326193e6dde2f9b6f9d0 PSDR.hex from pwarren's 'off menu item' branch
955d64600c512d47362ecee6ad57c892 PSDR.hex from pwarren's rebuild in Makefile style

View File

@ -0,0 +1,102 @@
#ifndef _ADAFRUIT_GFX_H
#define _ADAFRUIT_GFX_H
#ifdef PSDR2
#include "stm32f4xx.h"
#include "stm32f429xx.h"
#endif
//#ifdef PSDR257
#include "stm32f7xx.h"
#include "stm32f746xx.h"
//#endif
#include <stdbool.h>
#include <Adafruit_ILI9340.h>
//#include <Adafruit_SSD1306.h>
#define swap(a, b) { int16_t t = a; a = b; b = t; }
//class Adafruit_GFX : public Print {
// public:
void Adafruit_GFX(int16_t w, int16_t h); // Constructor
// This MUST be defined by the subclass:
/*virtual*/ void drawPixel(int16_t x, int16_t y, uint16_t color); // = 0;
// These MAY be overridden by the subclass to provide device-specific
// optimized code. Otherwise 'generic' versions are used.
/*virtual*/ void
drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color),
drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color),
fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color),
fillScreen(uint16_t color),
invertDisplay(bool i);
// These exist only with Adafruit_GFX (no subclass overrides)
void
Adafruit_GFX_drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
Adafruit_GFX_drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
uint16_t color),
Adafruit_GFX_fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color),
Adafruit_GFX_fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername,
int16_t delta, uint16_t color),
Adafruit_GFX_drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
int16_t x2, int16_t y2, uint16_t color),
Adafruit_GFX_fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
int16_t x2, int16_t y2, uint16_t color),
Adafruit_GFX_drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
int16_t radius, uint16_t color),
Adafruit_GFX_fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h,
int16_t radius, uint16_t color),
Adafruit_GFX_drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap,
int16_t w, int16_t h, uint16_t color),
Adafruit_GFX_drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
uint16_t bg, uint8_t size),
Adafruit_GFX_setCursor(int16_t x, int16_t y),
// setTextColor(uint16_t c),
Adafruit_GFX_setTextColor(uint16_t c, uint16_t bg),
Adafruit_GFX_setTextSize(uint8_t s),
Adafruit_GFX_setTextWrap(bool w),
Adafruit_GFX_setRotation(uint8_t r);
#if ARDUINO >= 100
virtual size_t write(uint8_t);
#else
/*virtual*/ void Adafruit_GFX_write(uint8_t);
#endif
int16_t
Adafruit_GFX_height(void),
Adafruit_GFX_width(void);
uint8_t Adafruit_GFX_getRotation(void);
//protected:
int16_t
WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes
int16_t
_width, _height, // Display w/h as modified by current rotation
cursor_x, cursor_y;
uint16_t
textcolor, textbgcolor;
uint8_t
textsize,
rotation;
bool
wrap; // If set, 'wrap' text at right edge of display
//};
#endif // _ADAFRUIT_GFX_H
/* function declerations to help the compiler */
void Adafruit_GFX_drawColorBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h, uint16_t tintMask);
void Adafruit_GFX_fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
uint16_t color);
void Adafruit_GFX_fillScreen(uint16_t color);

View File

@ -0,0 +1,187 @@
/***************************************************
This is an Arduino Library for the Adafruit 2.2" SPI display.
This library works with the Adafruit 2.2" TFT Breakout w/SD card
----> http://www.adafruit.com/products/1480
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#ifndef _ADAFRUIT_ILI9340H_
#define _ADAFRUIT_ILI9340H_
//#include <stm32f10x.h>
//#include <stm32f415xx.h>
#ifdef PSDR2
#include "stm32f429xx.h"
#endif
#ifdef PSDR257
#include "stm32f746xx.h"
#endif
#include <stdbool.h>
#include <Adafruit_GFX.h>
#include <main.h>
#define ILI9340_TFTWIDTH 240
#define ILI9340_TFTHEIGHT 320
#define ILI9340_NOP 0x00
#define ILI9340_SWRESET 0x01
#define ILI9340_RDDID 0x04
#define ILI9340_RDDST 0x09
#define ILI9340_SLPIN 0x10
#define ILI9340_SLPOUT 0x11
#define ILI9340_PTLON 0x12
#define ILI9340_NORON 0x13
#define ILI9340_RDMODE 0x0A
#define ILI9340_RDMADCTL 0x0B
#define ILI9340_RDPIXFMT 0x0C
#define ILI9340_RDIMGFMT 0x0A
#define ILI9340_RDSELFDIAG 0x0F
#define ILI9340_INVOFF 0x20
#define ILI9340_INVON 0x21
#define ILI9340_GAMMASET 0x26
#define ILI9340_DISPOFF 0x28
#define ILI9340_DISPON 0x29
#define ILI9340_CASET 0x2A
#define ILI9340_PASET 0x2B
#define ILI9340_RAMWR 0x2C
#define ILI9340_RAMRD 0x2E
#define ILI9340_RAMWRCNT 0x3C
#define ILI9340_PTLAR 0x30
#define ILI9340_MADCTL 0x36
#define ILI9340_MADCTL_MY 0x80
#define ILI9340_MADCTL_MX 0x40
#define ILI9340_MADCTL_MV 0x20
#define ILI9340_MADCTL_ML 0x10
#define ILI9340_MADCTL_RGB 0x00
#define ILI9340_MADCTL_BGR 0x08
#define ILI9340_MADCTL_MH 0x04
#define ILI9340_PIXFMT 0x3A
#define ILI9340_FRMCTR1 0xB1
#define ILI9340_FRMCTR2 0xB2
#define ILI9340_FRMCTR3 0xB3
#define ILI9340_INVCTR 0xB4
#define ILI9340_DFUNCTR 0xB6
#define ILI9340_PWCTR1 0xC0
#define ILI9340_PWCTR2 0xC1
#define ILI9340_PWCTR3 0xC2
#define ILI9340_PWCTR4 0xC3
#define ILI9340_PWCTR5 0xC4
#define ILI9340_VMCTR1 0xC5
#define ILI9340_VMCTR2 0xC7
#define ILI9340_RDID1 0xDA
#define ILI9340_RDID2 0xDB
#define ILI9340_RDID3 0xDC
#define ILI9340_RDID4 0xDD
#define ILI9340_GMCTRP1 0xE0
#define ILI9340_GMCTRN1 0xE1
#define ILI9340_VSCRDEF 0x33
#define ILI9340_VSCRSADD 0x37
/*
#define ILI9340_PWCTR6 0xFC
*/
// Color definitions
#define ILI9340_BLACK 0x0000
#define ILI9340_BLUE 0x001F
#define ILI9340_RED 0xF800
#define ILI9340_GREEN 0x07E0
#define ILI9340_CYAN 0x07FF
#define ILI9340_MAGENTA 0xF81F
#define ILI9340_YELLOW 0xFFE0
#define ILI9340_WHITE 0xFFFF
//class Adafruit_ILI9340 : public Adafruit_GFX {
//
// public:
// Adafruit_ILI9340(uint8_t CS, uint8_t RS, uint8_t MOSI, uint8_t SCLK,
// uint8_t RST, uint8_t MISO);
void Adafruit_ILI9340(uint8_t CS, uint8_t RS, uint8_t RST);
void Adafruit_ILI9340_begin(void),
Adafruit_ILI9340_setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1),
Adafruit_ILI9340_pushColor(uint16_t color),
Adafruit_ILI9340_fillScreen(uint16_t color),
Adafruit_ILI9340_drawPixel(int16_t x, int16_t y, uint16_t color),
Adafruit_ILI9340_drawNextPixel(uint16_t color),
Adafruit_ILI9340_drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
Adafruit_ILI9340_drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
Adafruit_ILI9340_fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
uint16_t color),
Adafruit_ILI9340_setRotation(uint8_t r),
Adafruit_ILI9340_invertDisplay(bool i);
uint16_t Adafruit_ILI9340_Color565(uint8_t r, uint8_t g, uint8_t b);
/* These are not for current use, 8-bit protocol only! */
uint8_t Adafruit_ILI9340_readdata(void),
Adafruit_ILI9340_readcommand8(uint8_t);
/*
uint16_t readcommand16(uint8_t);
uint32_t readcommand32(uint8_t);
void dummyclock(void);
*/
void Adafruit_ILI9340_spiwrite(uint8_t),
Adafruit_ILI9340_writecommand(uint16_t c),
Adafruit_ILI9340_writedata(uint16_t d),
Adafruit_ILI9340_commandList(uint8_t *addr);
uint8_t Adafruit_ILI9340_spiread(void);
// private:
// uint8_t tabcolor;
bool hwSPI;
#ifdef __AVR__
volatile uint8_t *mosiport, *clkport, *dcport, *rsport, *csport;
uint8_t _cs, _dc, _rst, _mosi, _miso, _sclk,
mosipinmask, clkpinmask, cspinmask, dcpinmask;
#endif // #ifdef __AVR__
#if defined(__SAM3X8E__)
Pio *mosiport, *clkport, *dcport, *rsport, *csport;
uint32_t _cs, _dc, _rst, _mosi, _miso, _sclk,
mosipinmask, clkpinmask, cspinmask, dcpinmask;
#endif // #if defined(__SAM3X8E__)
#if defined(__arm__) && defined(CORE_TEENSY)
volatile uint8_t *mosiport, *clkport, *dcport, *rsport, *csport;
uint8_t _cs, _dc, _rst, _mosi, _miso, _sclk,
mosipinmask, clkpinmask, cspinmask, dcpinmask;
#endif
//};
#endif
/* Function declarations to keep the compiler happy */
void Adafruit_ILI9340_setVerticalScrollDefinition(uint16_t topFixedArea,
uint16_t verticalScrollArea, uint16_t bottomFixedArea);
void Adafruit_ILI9340_setVerticalScrollStartAddress(uint16_t address);

View File

@ -0,0 +1,144 @@
/* Paul Warren 2021-02-11 */
/* This is to provide some 'nice' names for the GPIO pins */
/* As used by the Adafruit libraries, and no doubt a bunch of other things we get along. */
#include "stm32f7xx.h"
typedef struct _Gpio_Pin
{
GPIO_TypeDef* port;
uint16_t pin;
} Gpio_Pin;
// a timer with which channel of the timer specified
typedef struct _Timer_Channel
{
uint8_t channel;
TIM_TypeDef* timer;
} Timer_Channel;
// a Timer_Pin is a gpio pin that is connected to an internal timer
typedef struct _Timer_Pin
{
Gpio_Pin gpioPin;
Timer_Channel timer;
} Timer_Pin;
typedef void
(*hal_sysTickCallback) (void);
// hal wrappers for GPIO
// gpioPin must be a Gpio_Pin struct
// val must be either a 0 or a 1
#define hal_writeGpio(gpioPin, val) (GPIO_WriteBit((gpioPin).port, (gpioPin).pin, (val))) // returns void
#define hal_readGpio(gpioPin) (GPIO_ReadInputDataBit((gpioPin).port, (gpioPin).pin)) // returns uint8_t
// // power macros
// #define hal_isPlugged(powerState) (!((powerState) & hal_externalPower))
__IO uint32_t timingDelay;
#define MEDIATEK_MODULE
#define hal_gpsUart USART1
// gpio pins
// extern const Gpio_Pin RX_TO_GSM;
// extern const Gpio_Pin TX_FROM_GSM;
// extern const Gpio_Pin FINGER_PRINT_POWER;
// extern const Gpio_Pin USER_BUTTON;
// extern const Gpio_Pin FPR_RX;
// extern const Gpio_Pin FPR_TX;
// extern const Gpio_Pin BUZZER;
// extern const Gpio_Pin RFID_INT;
// extern const Gpio_Pin FINGER_PRINT_BUTTON;
extern const Gpio_Pin LCD_NSS;
// extern const Gpio_Pin LOW_BAT;
extern const Gpio_Pin RX_TO_GPS;
extern const Gpio_Pin TX_FROM_GPS;
extern const Gpio_Pin GPS_RESET;
//extern const Gpio_Pin GPS_FIX_LED;
extern const Gpio_Pin GPS_PPS;
extern const Gpio_Pin GPS_POWER;
extern const Gpio_Pin LCD_SCK;
extern const Gpio_Pin LCD_MISO;
extern const Gpio_Pin LCD_MOSI;
extern const Gpio_Pin SPI2_SCK;
extern const Gpio_Pin SPI2_MISO;
extern const Gpio_Pin SPI2_MOSI;
extern const Gpio_Pin LCD_RESET;
extern const Gpio_Pin LCD_DC;
extern const Gpio_Pin RX_Q;
extern const Gpio_Pin RX_I;
// extern const Gpio_Pin OLED_RESET;
// extern const Gpio_Pin OLED_DC;
// extern const Gpio_Pin OLED_NSS;
//CORRECT FOR PSDR1
//extern const Gpio_Pin ddsReset;
//extern const Gpio_Pin ddsSleep;
//extern const Gpio_Pin dds1Mosi;
//extern const Gpio_Pin dds1Nss;
//extern const Gpio_Pin dds1Sck;
//extern const Gpio_Pin dds2Mosi;
//extern const Gpio_Pin dds2Nss;
//extern const Gpio_Pin dds2Sck;
extern const Gpio_Pin encoderBee;
extern const Gpio_Pin encoderB;
extern const Gpio_Pin encoderP;
extern const Gpio_Pin dac1;
extern const Gpio_Pin dac2;
//extern const Gpio_Pin REF_CLOCK_ENABLE;
//extern const Gpio_Pin DDS_FSEL;
//extern const Gpio_Pin DDS_PSEL;
//extern const Gpio_Pin RX_MUX;
//extern const Gpio_Pin TX_MUX;
extern const Gpio_Pin AMP_SWITCH_A;
extern const Gpio_Pin AMP_SWITCH_B;
extern const Gpio_Pin IMP_BRIDGE_SWITCH_A;
extern const Gpio_Pin IMP_BRIDGE_SWITCH_B;
//extern const Gpio_Pin MIXER_SWITCH_A;
//extern const Gpio_Pin MIXER_SWITCH_B;
extern const Gpio_Pin TX_RF_SWITCH_A;
extern const Gpio_Pin TX_RF_SWITCH_B;
extern const Gpio_Pin AMP_POWER;
//extern const Gpio_Pin MIXER_POWER;
extern const Gpio_Pin FILTER_GAIN_POT_SCLK;
extern const Gpio_Pin FILTER_GAIN_POT_MOSI;
extern const Gpio_Pin GAIN_POT_NSS;
extern const Gpio_Pin IN_AMP_ENABLE;
extern const Gpio_Pin DAC_MUX;
extern const Gpio_Pin AUDIO_AMP_NSHTDWN;
extern const Gpio_Pin EARPHONE_NOT_INSERTED;
extern const Gpio_Pin SIDETONE; //Should be a timer pin.
extern const Gpio_Pin MIC_IN;
extern const Gpio_Pin MIC_SWITCH;
extern const Gpio_Pin PREAMP_POWER;
extern const Gpio_Pin MIC_BUTTON;
extern const Gpio_Pin PADDLE_THUMB_NO;
extern const Gpio_Pin PADDLE_INDEX_NO;
extern const Gpio_Pin PADDLE_THUMB_NC;
extern const Gpio_Pin PADDLE_INDEX_NC;
extern const Gpio_Pin FILTER_S0;
extern const Gpio_Pin FILTER_S1;
extern const Gpio_Pin TRX_SWITCH;
extern const Gpio_Pin I2C_SCL;
extern const Gpio_Pin I2C_SDA;
extern const Gpio_Pin FLIP_FLOP_ENABLE;
extern const Gpio_Pin RED_LED;
extern const Gpio_Pin CHARGE_POWER_SOURCE;
extern const Gpio_Pin FIVE_VOLT_REGULATOR_ENABLE;

View File

@ -0,0 +1,578 @@
/*
This is the core graphics library for all our displays, providing a common
set of graphics primitives (points, lines, circles, etc.). It needs to be
paired with a hardware-specific library for each display device we carry
(to handle the lower-level functions).
Adafruit invests time and resources providing this open source code, please
support Adafruit & open-source hardware by purchasing products from Adafruit!
Copyright (c) 2013 Adafruit Industries. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include <stdbool.h>
#include "Adafruit_GFX.h"
#include "glcdfont.c"
#include "pins.h"
#ifdef __AVR__
//#include <avr/pgmspace.h>
#else
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#endif
//#include "stm32f10x.h"
//#include <stm32f415xx.h>
#ifdef PSDR2
//#include "stm32f429xx.h"
#endif
#include "spi.h"
//void Adafruit_GFX_Adafruit_GFX(int16_t w, int16_t h)
// WIDTH(w), HEIGHT(h)
//{
// _width = WIDTH;
// _height = HEIGHT;
// rotation = 0;
// cursor_y = cursor_x = 0;
// textsize = 1;
// textcolor = textbgcolor = 0xFFFF;
// wrap = true;
//}
// Draw a circle outline
void Adafruit_GFX_drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color) {
int16_t f = 1 - r;
int16_t ddF_x = 1;
int16_t ddF_y = -2 * r;
int16_t x = 0;
int16_t y = r;
Adafruit_ILI9340_drawPixel(x0 , y0+r, color);
Adafruit_ILI9340_drawPixel(x0 , y0-r, color);
Adafruit_ILI9340_drawPixel(x0+r, y0 , color);
Adafruit_ILI9340_drawPixel(x0-r, y0 , color);
while (x<y) {
if (f >= 0) {
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x;
Adafruit_ILI9340_drawPixel(x0 + x, y0 + y, color);
Adafruit_ILI9340_drawPixel(x0 - x, y0 + y, color);
Adafruit_ILI9340_drawPixel(x0 + x, y0 - y, color);
Adafruit_ILI9340_drawPixel(x0 - x, y0 - y, color);
Adafruit_ILI9340_drawPixel(x0 + y, y0 + x, color);
Adafruit_ILI9340_drawPixel(x0 - y, y0 + x, color);
Adafruit_ILI9340_drawPixel(x0 + y, y0 - x, color);
Adafruit_ILI9340_drawPixel(x0 - y, y0 - x, color);
}
}
void Adafruit_GFX_drawCircleHelper( int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color) {
int16_t f = 1 - r;
int16_t ddF_x = 1;
int16_t ddF_y = -2 * r;
int16_t x = 0;
int16_t y = r;
while (x<y) {
if (f >= 0) {
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x;
if (cornername & 0x4) {
Adafruit_ILI9340_drawPixel(x0 + x, y0 + y, color);
Adafruit_ILI9340_drawPixel(x0 + y, y0 + x, color);
}
if (cornername & 0x2) {
Adafruit_ILI9340_drawPixel(x0 + x, y0 - y, color);
Adafruit_ILI9340_drawPixel(x0 + y, y0 - x, color);
}
if (cornername & 0x8) {
Adafruit_ILI9340_drawPixel(x0 - y, y0 + x, color);
Adafruit_ILI9340_drawPixel(x0 - x, y0 + y, color);
}
if (cornername & 0x1) {
Adafruit_ILI9340_drawPixel(x0 - y, y0 - x, color);
Adafruit_ILI9340_drawPixel(x0 - x, y0 - y, color);
}
}
}
void Adafruit_GFX_fillCircle(int16_t x0, int16_t y0, int16_t r,
uint16_t color) {
Adafruit_ILI9340_drawFastVLine(x0, y0-r, 2*r+1, color);
Adafruit_GFX_fillCircleHelper(x0, y0, r, 3, 0, color);
}
// Used to do circles and roundrects
void Adafruit_GFX_fillCircleHelper(int16_t x0, int16_t y0, int16_t r,
uint8_t cornername, int16_t delta, uint16_t color) {
int16_t f = 1 - r;
int16_t ddF_x = 1;
int16_t ddF_y = -2 * r;
int16_t x = 0;
int16_t y = r;
while (x<y) {
if (f >= 0) {
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x;
if (cornername & 0x1) {
Adafruit_ILI9340_drawFastVLine(x0+x, y0-y, 2*y+1+delta, color);
Adafruit_ILI9340_drawFastVLine(x0+y, y0-x, 2*x+1+delta, color);
}
if (cornername & 0x2) {
Adafruit_ILI9340_drawFastVLine(x0-x, y0-y, 2*y+1+delta, color);
Adafruit_ILI9340_drawFastVLine(x0-y, y0-x, 2*x+1+delta, color);
}
}
}
//int16_t abs(int16_t n)
//{
// if (n < 0) return n;
// else return n * -1;
//}
// Bresenham's algorithm - thx wikpedia
void Adafruit_GFX_drawLine(int16_t x0, int16_t y0,
int16_t x1, int16_t y1,
uint16_t color) {
int16_t steep = abs(y1 - y0) > abs(x1 - x0);
if (steep) {
swap(x0, y0);
swap(x1, y1);
}
if (x0 > x1) {
swap(x0, x1);
swap(y0, y1);
}
int16_t dx, dy;
dx = x1 - x0;
dy = abs(y1 - y0);
int16_t err = dx / 2;
int16_t ystep;
if (y0 < y1) {
ystep = 1;
} else {
ystep = -1;
}
for (; x0<=x1; x0++) {
if (steep) {
Adafruit_ILI9340_drawPixel(y0, x0, color);
} else {
Adafruit_ILI9340_drawPixel(x0, y0, color);
}
err -= dy;
if (err < 0) {
y0 += ystep;
err += dx;
}
}
}
// Draw a rectangle
void Adafruit_GFX_drawRect(int16_t x, int16_t y,
int16_t w, int16_t h,
uint16_t color) {
Adafruit_ILI9340_drawFastHLine(x, y, w, color);
Adafruit_ILI9340_drawFastHLine(x, y+h-1, w, color);
Adafruit_ILI9340_drawFastVLine(x, y, h, color);
Adafruit_ILI9340_drawFastVLine(x+w-1, y, h, color);
}
void Adafruit_GFX_drawFastVLine(int16_t x, int16_t y,
int16_t h, uint16_t color) {
// Update in subclasses if desired!
Adafruit_GFX_drawLine(x, y, x, y+h-1, color);
}
void Adafruit_GFX_drawFastHLine(int16_t x, int16_t y,
int16_t w, uint16_t color) {
// Update in subclasses if desired!
Adafruit_GFX_drawLine(x, y, x+w-1, y, color);
}
void Adafruit_GFX_fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
uint16_t color) {
// Update in subclasses if desired!
// int16_t i;
// for ( i=x; i<x+w; i++) {
// Adafruit_ILI9340_drawFastVLine(i, y, h, color);
// }
Adafruit_ILI9340_fillRect(x, y, w, h, color);
}
void Adafruit_GFX_fillScreen(uint16_t color) {
Adafruit_ILI9340_fillRect(0, 0, _width, _height, color);
}
// Draw a rounded rectangle
void Adafruit_GFX_drawRoundRect(int16_t x, int16_t y, int16_t w,
int16_t h, int16_t r, uint16_t color) {
// smarter version
Adafruit_ILI9340_drawFastHLine(x+r , y , w-2*r, color); // Top
Adafruit_ILI9340_drawFastHLine(x+r , y+h-1, w-2*r, color); // Bottom
Adafruit_ILI9340_drawFastVLine(x , y+r , h-2*r, color); // Left
Adafruit_ILI9340_drawFastVLine(x+w-1, y+r , h-2*r, color); // Right
// draw four corners
Adafruit_GFX_drawCircleHelper(x+r , y+r , r, 1, color);
Adafruit_GFX_drawCircleHelper(x+w-r-1, y+r , r, 2, color);
Adafruit_GFX_drawCircleHelper(x+w-r-1, y+h-r-1, r, 4, color);
Adafruit_GFX_drawCircleHelper(x+r , y+h-r-1, r, 8, color);
}
// Fill a rounded rectangle
void Adafruit_GFX_fillRoundRect(int16_t x, int16_t y, int16_t w,
int16_t h, int16_t r, uint16_t color) {
// smarter version
Adafruit_ILI9340_fillRect(x+r, y, w-2*r, h, color);
// draw four corners
Adafruit_GFX_fillCircleHelper(x+w-r-1, y+r, r, 1, h-2*r-1, color);
Adafruit_GFX_fillCircleHelper(x+r , y+r, r, 2, h-2*r-1, color);
}
// Draw a triangle
void Adafruit_GFX_drawTriangle(int16_t x0, int16_t y0,
int16_t x1, int16_t y1,
int16_t x2, int16_t y2, uint16_t color) {
Adafruit_GFX_drawLine(x0, y0, x1, y1, color);
Adafruit_GFX_drawLine(x1, y1, x2, y2, color);
Adafruit_GFX_drawLine(x2, y2, x0, y0, color);
}
// Fill a triangle
void Adafruit_GFX_fillTriangle ( int16_t x0, int16_t y0,
int16_t x1, int16_t y1,
int16_t x2, int16_t y2, uint16_t color) {
int16_t a, b, y, last;
// Sort coordinates by Y order (y2 >= y1 >= y0)
if (y0 > y1) {
swap(y0, y1); swap(x0, x1);
}
if (y1 > y2) {
swap(y2, y1); swap(x2, x1);
}
if (y0 > y1) {
swap(y0, y1); swap(x0, x1);
}
if(y0 == y2) { // Handle awkward all-on-same-line case as its own thing
a = b = x0;
if(x1 < a) a = x1;
else if(x1 > b) b = x1;
if(x2 < a) a = x2;
else if(x2 > b) b = x2;
Adafruit_ILI9340_drawFastHLine(a, y0, b-a+1, color);
return;
}
int16_t
dx01 = x1 - x0,
dy01 = y1 - y0,
dx02 = x2 - x0,
dy02 = y2 - y0,
dx12 = x2 - x1,
dy12 = y2 - y1,
sa = 0,
sb = 0;
// For upper part of triangle, find scanline crossings for segments
// 0-1 and 0-2. If y1=y2 (flat-bottomed triangle), the scanline y1
// is included here (and second loop will be skipped, avoiding a /0
// error there), otherwise scanline y1 is skipped here and handled
// in the second loop...which also avoids a /0 error here if y0=y1
// (flat-topped triangle).
if(y1 == y2) last = y1; // Include y1 scanline
else last = y1-1; // Skip it
for(y=y0; y<=last; y++) {
a = x0 + sa / dy01;
b = x0 + sb / dy02;
sa += dx01;
sb += dx02;
/* longhand:
a = x0 + (x1 - x0) * (y - y0) / (y1 - y0);
b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
*/
if(a > b) swap(a,b);
Adafruit_ILI9340_drawFastHLine(a, y, b-a+1, color);
}
// For lower part of triangle, find scanline crossings for segments
// 0-2 and 1-2. This loop is skipped if y1=y2.
sa = dx12 * (y - y1);
sb = dx02 * (y - y0);
for(; y<=y2; y++) {
a = x1 + sa / dy12;
b = x0 + sb / dy02;
sa += dx12;
sb += dx02;
/* longhand:
a = x1 + (x2 - x1) * (y - y1) / (y2 - y1);
b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
*/
if(a > b) swap(a,b);
Adafruit_ILI9340_drawFastHLine(a, y, b-a+1, color);
}
}
void Adafruit_GFX_drawBitmap(int16_t x, int16_t y,
const uint8_t *bitmap, int16_t w, int16_t h,
uint16_t color) {
int16_t i, j, byteWidth = (w + 7) / 8;
for(j=0; j<h; j++) {
for(i=0; i<w; i++ ) {
if(pgm_read_byte(bitmap + j * byteWidth + i / 8) & (128 >> (i & 7))) {
Adafruit_ILI9340_drawPixel(x+i, y+j, color);
}
}
}
}
//#include "Adafruit_ILI9340.h"
//#include "spi.h"
//#include "hal.h"
//#ifdef PSDR2
//#include "stm32f4xx_hal_spi.h"
//#endif
//#ifdef PSDR257
//#include "stm32f7xx_hal_spi.h"
//#endif
void Adafruit_GFX_drawColorBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h, uint16_t tintMask)
{
int16_t i; //, j, bmIndex;
Adafruit_ILI9340_setAddrWindow(x,y,x+w-1, y+h-1);
//i = 0;
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 1);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
// if(tintMask == 0xFFFF)
// {
// HAL_SPI_Transmit(&hspi1, bitmap, h*w*2, 1); //When you do it this way, the bytes are swapped. Hmmm
// //So it looks weird.
// } else {
{
uint8_t txBuf[10];
//HAL_SPI_Transmit(&hspi1, bitmap, 1 /*cnt * 2*/, 1);
//Using DMA is going to mean that I can't alter the image, so for now we'll
//use different code when using the tintMask
if(tintMask == 0xFFFF)
{
HAL_SPI_Transmit_DMA(&hspi1, bitmap, w*h*2);
while(hspi1.State != HAL_SPI_STATE_READY);
}
else
{
for(i = 0; i < w*h; i++)
{
txBuf[0] = (bitmap[i] & tintMask ) >> 8;
txBuf[1] = (bitmap[i] & tintMask ) & 0xFF;
//spi_readWrite(hspi1, rxBuf, bitmap, w*h);
//HAL_SPI_Transmit(&hspi1, txBuf, 2 /*cnt * 2*/, 1);
HAL_SPI_Transmit_DMA(&hspi1, txBuf, 2);
//HAL_SPI_Transmit(&hspi1, bitmap[i+1], 1 /*cnt * 2*/, 1);
//}
//SET_BIT(csport, cspinmask);
}
}
}
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
// for(j=0; j<h; j++) {
// for(i=0; i<w; i++) {
// bmIndex = i+w*j;
// Adafruit_ILI9340_drawPixel(x+i, y+j, bitmap[bmIndex] & tintMask);
// }
// }
}
#if ARDUINO >= 100
size_t Adafruit_GFX_write(uint8_t c) {
#else
void Adafruit_GFX_write(uint8_t c) {
#endif
if (c == '\n') {
cursor_y += textsize*8;
cursor_x = 0;
} else if (c == '\r') {
// skip em
} else {
Adafruit_GFX_drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize);
cursor_x += textsize*6;
if (wrap && (cursor_x > (_width - textsize*6))) {
cursor_y += textsize*8;
cursor_x = 0;
}
}
#if ARDUINO >= 100
return 1;
#endif
}
// Draw a character
void Adafruit_GFX_drawChar(int16_t x, int16_t y, unsigned char c,
uint16_t color, uint16_t bg, uint8_t size) {
// if((x >= _width) || // Clip right
// (y >= _height) || // Clip bottom
// ((x + 6 * size - 1) < 0) || // Clip left
// ((y + 8 * size - 1) < 0)) // Clip top
// return;
int8_t i;
for (i=0; i<6; i++ ) {
uint8_t line;
if (i == 5)
line = 0x0;
else
line = pgm_read_byte(font+(c*5)+i);
int8_t j;
for (j = 0; j<8; j++) {
if (line & 0x1) {
if (size == 1) // default size
Adafruit_ILI9340_drawPixel(x+i, y+j, color);
//Adafruit_SSD1306_drawPixel(x+i, y+j, color);
else { // big size
//Adafruit_ILI9340_fillRect(x+(i*size), y+(j*size), size, size, color);
Adafruit_GFX_fillRect(x+(i*size), y+(j*size), size, size, color);
}
} else if (bg != color) {
if (size == 1) // default size
{
Adafruit_ILI9340_drawPixel(x+i, y+j, bg);
//Adafruit_SSD1306_drawPixel(x+i, y+j, bg);
}
else { // big size
//Adafruit_ILI9340_fillRect(x+i*size, y+j*size, size, size, bg);
Adafruit_GFX_fillRect(x+i*size, y+j*size, size, size, bg);
}
}
line >>= 1;
}
}
}
void Adafruit_GFX_setCursor(int16_t x, int16_t y) {
cursor_x = x;
cursor_y = y;
}
void Adafruit_GFX_setTextSize(uint8_t s) {
textsize = (s > 0) ? s : 1;
}
//void Adafruit_GFX_setTextColor(uint16_t c) {
// // For 'transparent' background, we'll set the bg
// // to the same as fg instead of using a flag
// textcolor = textbgcolor = c;
//}
void Adafruit_GFX_setTextColor(uint16_t c, uint16_t b) {
textcolor = c;
textbgcolor = b;
}
void Adafruit_GFX_setTextWrap(bool w) {
wrap = w;
}
uint8_t Adafruit_GFX_getRotation(void) {
return rotation;
}
void Adafruit_GFX_setRotation(uint8_t x) {
rotation = (x & 3);
switch(rotation) {
case 0:
case 2:
_width = WIDTH;
_height = HEIGHT;
break;
case 1:
case 3:
_width = HEIGHT;
_height = WIDTH;
break;
}
}
// Return the size of the display (per current rotation)
int16_t Adafruit_GFX_width(void) {
return _width;
}
int16_t Adafruit_GFX_height(void) {
return _height;
}
void Adafruit_GFX_invertDisplay(bool i) {
// Do nothing, must be subclassed if supported
}

View File

@ -0,0 +1,844 @@
/***************************************************
This is an Arduino Library for the Adafruit 2.2" SPI display.
This library works with the Adafruit 2.2" TFT Breakout w/SD card
----> http://www.adafruit.com/products/1480
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include "Adafruit_ILI9340.h"
//#include <avr/pgmspace.h>
//#include <limits.h>
//#include "pins_arduino.h"
//#include "wiring_private.h"
#include <spi.h>
#include <pins.h>
#include <stdbool.h>
//#include <stm32f4xx_hal.h>
#ifdef PSDR2
#include "stm32f4xx.h"
#endif
#ifdef PSDR257
#include "stm32f7xx.h"
#endif
#if defined(__SAM3X8E__)
#include <include/pio.h>
#define SET_BIT(port, bitMask) (port)->PIO_SODR |= (bitMask)
#define CLEAR_BIT(port, bitMask) (port)->PIO_CODR |= (bitMask)
#define USE_SPI_LIBRARY
#endif
#ifdef __AVR__
#define SET_BIT(port, bitMask) *(port) |= (bitMask)
#define CLEAR_BIT(port, bitMask) *(port) &= ~(bitMask)
#endif
#if defined(__arm__) && defined(CORE_TEENSY)
#define USE_SPI_LIBRARY
#define SET_BIT(port, bitMask) digitalWrite(*(port), HIGH);
#define CLEAR_BIT(port, bitMask) digitalWrite(*(port), LOW);
#endif
// Constructor when using software SPI. All output pins are configurable.
//Adafruit_ILI9340_Adafruit_ILI9340(uint8_t cs, uint8_t dc, uint8_t mosi,
// uint8_t sclk, uint8_t rst, uint8_t miso) : Adafruit_GFX(ILI9340_TFTWIDTH, ILI9340_TFTHEIGHT) {
// _cs = cs;
// _dc = dc;
// _mosi = mosi;
// _miso = miso;
// _sclk = sclk;
// _rst = rst;
// hwSPI = false;
//}
// int _width = ILI9340_TFTWIDTH; //240;
// int _height = ILI9340_TFTHEIGHT; //320
uint16_t rxBuf[10];
uint16_t txBuf[2];
//uint8_t txBuf2[320 * 240 * 2];
// Constructor when using hardware SPI. Faster, but must use SPI pins
// specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.)
void Adafruit_ILI9340_Adafruit_ILI9340(uint8_t cs, uint8_t dc, uint8_t rst) /*: Adafruit_GFX(ILI9340_TFTWIDTH, ILI9340_TFTHEIGHT) */ {
//_cs = cs;
//_dc = dc;
//_rst = rst;
hwSPI = true;
//_mosi = _sclk = 0;
}
void Adafruit_ILI9340_spiwrite(uint8_t c) {
//Serial.print("0x"); Serial.print(c, HEX); Serial.print(", ");
if (hwSPI) {
#ifdef __AVR__
SPDR = c;
while(!(SPSR & _BV(SPIF)));
#endif
#if defined(USE_SPI_LIBRARY)
SPI.transfer(c);
#endif
} else {
// Fast SPI bitbang swiped from LPD8806 library
uint8_t bit;
for(bit = 0x80; bit; bit >>= 1) {
if(c & bit) {
//digitalWrite(_mosi, HIGH);
//SET_BIT(mosiport, mosipinmask);
HAL_GPIO_WritePin(LCD_MOSI.port, LCD_MOSI.pin, 1);
} else {
//digitalWrite(_mosi, LOW);
//CLEAR_BIT(mosiport, mosipinmask);
HAL_GPIO_WritePin(LCD_MOSI.port, LCD_MOSI.pin, 0);
}
//digitalWrite(_sclk, HIGH);
//SET_BIT(clkport, clkpinmask);
HAL_GPIO_WritePin(LCD_SCK.port, LCD_SCK.pin, 1);
//digitalWrite(_sclk, LOW);
//CLEAR_BIT(clkport, clkpinmask);
HAL_GPIO_WritePin(LCD_SCK.port, LCD_SCK.pin, 0);
}
}
}
void Adafruit_ILI9340_writecommand(uint16_t c) {
//CLEAR_BIT(dcport, dcpinmask);
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 0);
//digitalWrite(_dc, LOW);
//CLEAR_BIT(clkport, clkpinmask);
HAL_GPIO_WritePin(LCD_SCK.port, LCD_SCK.pin, 0);
//digitalWrite(_sclk, LOW);
//CLEAR_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
//digitalWrite(_cs, LOW);
//spiwrite(c);
txBuf[0] = c; // & 0xFF;
//spi_readWrite(hspi1, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&hspi1, txBuf, 1 /*cnt * 2*/, 1);
//HAL_SPI_Transmit_DMA(&hspi1, txBuf, 1);
//while(hspi1.State == HAL_SPI_STATE_BUSY_TX);
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
//digitalWrite(_cs, HIGH);
}
void Adafruit_ILI9340_writedata(uint16_t c) {
//SET_BIT(dcport, dcpinmask);
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 1);
//digitalWrite(_dc, HIGH);
//CLEAR_BIT(clkport, clkpinmask);
HAL_GPIO_WritePin(LCD_SCK.port, LCD_SCK.pin, 0);
//digitalWrite(_sclk, LOW);
//CLEAR_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
//digitalWrite(_cs, LOW);
//spiwrite(c);
txBuf[0] = c; // & 0xFF;
//spi_readWrite(hspi1, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&hspi1, txBuf, 1 /*cnt * 2*/, 1);
//HAL_SPI_Transmit_DMA(&hspi1, txBuf, 1);
//while(hspi1.State == HAL_SPI_STATE_BUSY_TX);
//digitalWrite(_cs, HIGH);
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
}
// Rather than a bazillion writecommand() and writedata() calls, screen
// initialization commands and arguments are organized in these tables
// stored in PROGMEM. The table may look bulky, but that's mostly the
// formatting -- storage-wise this is hundreds of bytes more compact
// than the equivalent code. Companion function follows.
#define DELAY 0x80
// Companion code to the above tables. Reads and issues
// a series of LCD commands stored in PROGMEM byte array.
//void Adafruit_ILI9340_commandList(uint8_t *addr) {
//
// uint8_t numCommands, numArgs;
// uint16_t ms;
//
// numCommands = pgm_read_byte(addr++); // Number of commands to follow
// while(numCommands--) { // For each command...
// writecommand(pgm_read_byte(addr++)); // Read, issue command
// numArgs = pgm_read_byte(addr++); // Number of args to follow
// ms = numArgs & DELAY; // If hibit set, delay follows args
// numArgs &= ~DELAY; // Mask out delay bit
// while(numArgs--) { // For each argument...
// writedata(pgm_read_byte(addr++)); // Read, issue argument
// }
//
// if(ms) {
// ms = pgm_read_byte(addr++); // Read post-command delay time (ms)
// if(ms == 255) ms = 500; // If 255, delay for 500 ms
// hal_delay_ms(ms);
// }
// }
//}
void Adafruit_ILI9340_begin(void) {
//pinMode(_rst, OUTPUT);
//digitalWrite(_rst, LOW);
//pinMode(_dc, OUTPUT);
//pinMode(_cs, OUTPUT);
//#ifdef __AVR__
// csport = portOutputRegister(digitalPinToPort(_cs));
// dcport = portOutputRegister(digitalPinToPort(_dc));
//#endif
//#if defined(__SAM3X8E__)
// csport = digitalPinToPort(_cs);
// dcport = digitalPinToPort(_dc);
//#endif
//#if defined(__arm__) && defined(CORE_TEENSY)
// mosiport = &_mosi;
// clkport = &_sclk;
// rsport = &_rst;
// csport = &_cs;
// dcport = &_dc;
//#endif
//cspinmask = digitalPinToBitMask(_cs);
//dcpinmask = digitalPinToBitMask(_dc);
// if(hwSPI) { // Using hardware SPI
// SPI.begin();
//#ifdef __AVR__
// SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (full! speed!)
//#endif
//#if defined(__SAM3X8E__)
// SPI.setClockDivider(11); // 85MHz / 11 = 7.6 MHz (full! speed!)
//#endif SPI.setBitOrder(MSBFIRST);
// SPI.setBitOrder(MSBFIRST);
// SPI.setDataMode(SPI_MODE0);
// } else {
// pinMode(_sclk, OUTPUT);
// pinMode(_mosi, OUTPUT);
// pinMode(_miso, INPUT);
//#ifdef __AVR__
// clkport = portOutputRegister(digitalPinToPort(_sclk));
// mosiport = portOutputRegister(digitalPinToPort(_mosi));
//#endif
//#if defined(__SAM3X8E__)
// clkport = digitalPinToPort(_sclk);
// mosiport = digitalPinToPort(_mosi);
//#endif
// clkpinmask = digitalPinToBitMask(_sclk);
// mosipinmask = digitalPinToBitMask(_mosi);
// CLEAR_BIT(clkport, clkpinmask);
// CLEAR_BIT(mosiport, mosipinmask);
//}
// toggle RST low to reset
//digitalWrite(_rst, HIGH);
HAL_GPIO_WritePin(LCD_RESET.port, LCD_RESET.pin, 1);
hal_delay_ms(5);
//digitalWrite(_rst, LOW);
HAL_GPIO_WritePin(LCD_RESET.port, LCD_RESET.pin, 0);
hal_delay_ms(20);
//digitalWrite(_rst, HIGH);
HAL_GPIO_WritePin(LCD_RESET.port, LCD_RESET.pin, 1);
hal_delay_ms(150);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0); //I'm going to try leaving this low the WHOLE TIME!
/*
uint8_t x = readcommand8(ILI9340_RDMODE);
Serial.print("\nDisplay Power Mode: 0x"); Serial.println(x, HEX);
x = readcommand8(ILI9340_RDMADCTL);
Serial.print("\nMADCTL Mode: 0x"); Serial.println(x, HEX);
x = readcommand8(ILI9340_RDPIXFMT);
Serial.print("\nPixel Format: 0x"); Serial.println(x, HEX);
x = readcommand8(ILI9340_RDIMGFMT);
Serial.print("\nImage Format: 0x"); Serial.println(x, HEX);
x = readcommand8(ILI9340_RDSELFDIAG);
Serial.print("\nSelf Diagnostic: 0x"); Serial.println(x, HEX);
*/
//if(cmdList) commandList(cmdList);
Adafruit_ILI9340_writecommand(0xEF);
Adafruit_ILI9340_writedata(0x03);
Adafruit_ILI9340_writedata(0x80);
Adafruit_ILI9340_writedata(0x02);
Adafruit_ILI9340_writecommand(0xCF);
Adafruit_ILI9340_writedata(0x00);
Adafruit_ILI9340_writedata(0XC1);
Adafruit_ILI9340_writedata(0X30);
Adafruit_ILI9340_writecommand(0xED);
Adafruit_ILI9340_writedata(0x64);
Adafruit_ILI9340_writedata(0x03);
Adafruit_ILI9340_writedata(0X12);
Adafruit_ILI9340_writedata(0X81);
Adafruit_ILI9340_writecommand(0xE8);
Adafruit_ILI9340_writedata(0x85);
Adafruit_ILI9340_writedata(0x00);
Adafruit_ILI9340_writedata(0x78);
Adafruit_ILI9340_writecommand(0xCB);
Adafruit_ILI9340_writedata(0x39);
Adafruit_ILI9340_writedata(0x2C);
Adafruit_ILI9340_writedata(0x00);
Adafruit_ILI9340_writedata(0x34);
Adafruit_ILI9340_writedata(0x02);
Adafruit_ILI9340_writecommand(0xF7);
Adafruit_ILI9340_writedata(0x20);
Adafruit_ILI9340_writecommand(0xEA);
Adafruit_ILI9340_writedata(0x00);
Adafruit_ILI9340_writedata(0x00);
Adafruit_ILI9340_writecommand(ILI9340_PWCTR1); //Power control
Adafruit_ILI9340_writedata(0x23); //VRH[5:0]
Adafruit_ILI9340_writecommand(ILI9340_PWCTR2); //Power control
Adafruit_ILI9340_writedata(0x10); //SAP[2:0];BT[3:0]
Adafruit_ILI9340_writecommand(ILI9340_VMCTR1); //VCM control
Adafruit_ILI9340_writedata(0x3e); //<2F>Աȶȵ<C8B6><C8B5><EFBFBD>
Adafruit_ILI9340_writedata(0x28);
Adafruit_ILI9340_writecommand(ILI9340_VMCTR2); //VCM control2
Adafruit_ILI9340_writedata(0x86); //--
Adafruit_ILI9340_writecommand(ILI9340_MADCTL); // Memory Access Control
Adafruit_ILI9340_writedata(ILI9340_MADCTL_MX | ILI9340_MADCTL_BGR);
Adafruit_ILI9340_writecommand(ILI9340_PIXFMT);
Adafruit_ILI9340_writedata(0x55);
Adafruit_ILI9340_writecommand(ILI9340_FRMCTR1);
Adafruit_ILI9340_writedata(0x00);
Adafruit_ILI9340_writedata(0x18);
Adafruit_ILI9340_writecommand(ILI9340_DFUNCTR); // Display Function Control
Adafruit_ILI9340_writedata(0x08);
Adafruit_ILI9340_writedata(0x82);
Adafruit_ILI9340_writedata(0x27);
Adafruit_ILI9340_writecommand(0xF2); // 3Gamma Function Disable
Adafruit_ILI9340_writedata(0x00);
Adafruit_ILI9340_writecommand(ILI9340_GAMMASET); //Gamma curve selected
Adafruit_ILI9340_writedata(0x01);
Adafruit_ILI9340_writecommand(ILI9340_GMCTRP1); //Set Gamma
Adafruit_ILI9340_writedata(0x0F);
Adafruit_ILI9340_writedata(0x31);
Adafruit_ILI9340_writedata(0x2B);
Adafruit_ILI9340_writedata(0x0C);
Adafruit_ILI9340_writedata(0x0E);
Adafruit_ILI9340_writedata(0x08);
Adafruit_ILI9340_writedata(0x4E);
Adafruit_ILI9340_writedata(0xF1);
Adafruit_ILI9340_writedata(0x37);
Adafruit_ILI9340_writedata(0x07);
Adafruit_ILI9340_writedata(0x10);
Adafruit_ILI9340_writedata(0x03);
Adafruit_ILI9340_writedata(0x0E);
Adafruit_ILI9340_writedata(0x09);
Adafruit_ILI9340_writedata(0x00);
Adafruit_ILI9340_writecommand(ILI9340_GMCTRN1); //Set Gamma
Adafruit_ILI9340_writedata(0x00);
Adafruit_ILI9340_writedata(0x0E);
Adafruit_ILI9340_writedata(0x14);
Adafruit_ILI9340_writedata(0x03);
Adafruit_ILI9340_writedata(0x11);
Adafruit_ILI9340_writedata(0x07);
Adafruit_ILI9340_writedata(0x31);
Adafruit_ILI9340_writedata(0xC1);
Adafruit_ILI9340_writedata(0x48);
Adafruit_ILI9340_writedata(0x08);
Adafruit_ILI9340_writedata(0x0F);
Adafruit_ILI9340_writedata(0x0C);
Adafruit_ILI9340_writedata(0x31);
Adafruit_ILI9340_writedata(0x36);
Adafruit_ILI9340_writedata(0x0F);
Adafruit_ILI9340_writecommand(ILI9340_SLPOUT); //Exit Sleep
hal_delay_ms(120);
Adafruit_ILI9340_writecommand(ILI9340_DISPON); //Display on
}
void Adafruit_ILI9340_setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1,
uint16_t y1) {
Adafruit_ILI9340_writecommand(ILI9340_CASET); // Column addr set
Adafruit_ILI9340_writedata(x0 >> 8);
Adafruit_ILI9340_writedata(x0 & 0xFF); // XSTART
Adafruit_ILI9340_writedata(x1 >> 8);
Adafruit_ILI9340_writedata(x1 & 0xFF); // XEND
Adafruit_ILI9340_writecommand(ILI9340_PASET); // Row addr set
Adafruit_ILI9340_writedata(y0>>8);
Adafruit_ILI9340_writedata(y0); // YSTART
Adafruit_ILI9340_writedata(y1>>8);
Adafruit_ILI9340_writedata(y1); // YEND
Adafruit_ILI9340_writecommand(ILI9340_RAMWR); // write to RAM
}
void Adafruit_ILI9340_pushColor(uint16_t color) {
//digitalWrite(_dc, HIGH);
//SET_BIT(dcport, dcpinmask);
//GPIO_WriteBit(LCD_DC.port, LCD_DC.pin, 1);
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 1);
//digitalWrite(_cs, LOW);
//CLEAR_BIT(csport, cspinmask);
// GPIO_WriteBit(LCD_NSS.port, LCD_NSS.pin, 0);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
//spiwrite(color >> 8);
//spiwrite(color);
//uint16_t rxBuf[10];
//uint16_t txBuf[2] = {color >> 8, color};
txBuf[0] = color;
uint8_t txBuf3[2];
txBuf3[1] = color & 0xFF;
txBuf3[0] = color >> 8;
//spi_readWrite(hspi1, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&hspi1, txBuf3, 2 /*cnt * 2*/, 1);
//while(hspi1.State != HAL_SPI_STATE_READY);
//SET_BIT(csport, cspinmask);
//GPIO_WriteBit(LCD_NSS.port, LCD_NSS.pin, 1);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
//digitalWrite(_cs, HIGH);
}
void Adafruit_ILI9340_drawPixel(int16_t x, int16_t y, uint16_t color) {
if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return;
Adafruit_ILI9340_setAddrWindow(x,y,x+1,y+1);
//digitalWrite(_dc, HIGH);
//SET_BIT(dcport, dcpinmask);
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 1);
//digitalWrite(_cs, LOW);
//CLEAR_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
//spiwrite(color >> 8);
//spiwrite(color);
//uint8_t rxBuf[10];
//uint8_t txBuf[2] = {color >> 8, color};
txBuf[0] = color;
//spi_readWrite(hspi1, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&hspi1, txBuf, 1 /*cnt * 2*/, 1);
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
//digitalWrite(_cs, HIGH);
}
void Adafruit_ILI9340_drawNextPixel(uint16_t color) {
Adafruit_ILI9340_writecommand(ILI9340_RAMWRCNT);
//digitalWrite(_dc, HIGH);
//SET_BIT(dcport, dcpinmask);
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 1);
//digitalWrite(_cs, LOW);
//CLEAR_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
//spiwrite(color >> 8);
//spiwrite(color);
//uint8_t rxBuf[10];
//uint8_t txBuf[2] = {color >> 8, color};
txBuf[0] = color;
//spi_readWrite(hspi1, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&hspi1, txBuf, 1 /*cnt * 2*/, 1);
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
//digitalWrite(_cs, HIGH);
}
void Adafruit_ILI9340_drawFastVLine(int16_t x, int16_t y, int16_t h,
uint16_t color) {
// Rudimentary clipping
if((x >= _width) || (y >= _height)) return;
if((y+h-1) >= _height)
h = _height-y;
Adafruit_ILI9340_setAddrWindow(x, y, x, y+h-1);
//uint8_t hi = color >> 8, lo = color;
//SET_BIT(dcport, dcpinmask);
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 1);
//digitalWrite(_dc, HIGH);
//CLEAR_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
//digitalWrite(_cs, LOW);
//uint8_t rxBuf[10];
//uint8_t txBuf[2];
while (h--) {
//spiwrite(hi);
//spiwrite(lo);
//txBuf[0] = hi;
//txBuf[1] = lo;
txBuf[0] = color;
//spi_readWrite(hspi1, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&hspi1, txBuf, 1 /*cnt * 2*/, 1);
}
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
//digitalWrite(_cs, HIGH);
}
void Adafruit_ILI9340_drawFastHLine(int16_t x, int16_t y, int16_t w,
uint16_t color) {
// Rudimentary clipping
if((x >= _width) || (y >= _height)) return;
if((x+w-1) >= _width) w = _width-x;
Adafruit_ILI9340_setAddrWindow(x, y, x+w-1, y);
//uint8_t hi = color >> 8, lo = color;
//SET_BIT(dcport, dcpinmask);
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 1);
//CLEAR_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
//digitalWrite(_dc, HIGH);
//digitalWrite(_cs, LOW);
while (w--) {
//spiwrite(hi);
//spiwrite(lo);
//txBuf[0] = hi;
//txBuf[1] = lo;
txBuf[0] = color;
//spi_readWrite(hspi1, rxBuf, txBuf, 1);
HAL_SPI_Transmit(&hspi1, txBuf, 1 /*cnt * 2*/, 1);
}
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
//digitalWrite(_cs, HIGH);
}
void Adafruit_ILI9340_fillScreen(uint16_t color) {
Adafruit_ILI9340_fillRect(0, 0, _width, _height, color);
}
// fill a rectangle
void Adafruit_ILI9340_fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
uint16_t color) {
// rudimentary clipping (drawChar w/big text requires this)
if((x >= _width) || (y >= _height)) return;
if((x + w - 1) >= _width) w = _width - x;
if((y + h - 1) >= _height) h = _height - y;
Adafruit_ILI9340_setAddrWindow(x, y, x+w-1, y+h-1);
// uint8_t hi = color >> 8, lo = color;
//SET_BIT(dcport, dcpinmask);
HAL_GPIO_WritePin(LCD_DC.port, LCD_DC.pin, 1);
//digitalWrite(_dc, HIGH);
//CLEAR_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 0);
//digitalWrite(_cs, LOW);
//for(y=h; y>0; y--) {
// for(x=w; x>0; x--) {
//spiwrite(hi);
//spiwrite(lo);
//txBuf[0] = hi;
//txBuf[1] = lo;
uint32_t totalPixels = h * w;
uint8_t txBuf2[totalPixels * 2];
//uint16_t txBuf2[totalPixels];
//while(hspi1.State != HAL_SPI_STATE_READY);
for(uint32_t i = (totalPixels * 2); i > 0; i-=2)
{
//txBuf2[i] = color;
txBuf2[i] = (color & 0xFF00) >> 8;
txBuf2[i + 1] = color & 0xFF;
}
static int errors = 0;
for(uint32_t i = (totalPixels * 2); i > 0; i-=2)
{
//txBuf2[i] = color;
if (txBuf2[i] != ((color & 0xFF00) >> 8) || txBuf2[i + 1] != (color & 0xFF))
errors++;
}
// for(uint32_t i = totalPixels; i > 0; i--)
// {
// //txBuf2[i] = color;
// txBuf2[i] = color; // & 0xFF00) >> 8;
// //txBuf2[i + 1] = color & 0xFF;
// }
// for(uint32_t i = (totalPixels * 2); i > 0; i--)
// {
// if txBuf2[i] != color
// }
//uint32_t txBuf2Address = &txBuf2;
//uint32_t txBuf2AddressEnd = txBuf2Address + (320 * 240* 2);
//for()= color;
//txBuf2[153000] = 0xFF;
//txBuf2[150000] = 0xFF;
//spi_readWrite(hspi1, rxBuf, txBuf, 1);
//hdma_tx.Init.MemInc = DMA_MINC_DISABLE;
//HAL_DMA_Init(&hdma_tx);
//uint32_t pixelsWritten = 0;
//utin16_t pixelsInBurst = 0;
//uint16_t fullPasses = (totalPixels * 2) / 0xFFFF;
//uint16_t partialPass = (totalPixels * 2) % 0xFFFF;
uint16_t fullPasses = sizeof(txBuf2) / 0xFFFF;
uint16_t partialPass = sizeof(txBuf2) % 0xFFFF;
uint32_t offset = 0;
while(fullPasses > 0)
{
for(uint32_t i = (totalPixels * 2); i > 0; i-=2)
{
//txBuf2[i] = color;
if (txBuf2[i] != ((color & 0xFF00) >> 8) || txBuf2[i + 1] != (color & 0xFF))
errors++;
}
while(HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY);
HAL_SPI_Transmit_DMA(&hspi1, txBuf2 + offset, 0xFFFF); //txBuf2 or &txBuf2 doesn't seem to make a difference
fullPasses--;
offset+=0xFFFF;
//__IO HAL_DMA_StateTypeDef dmaState = HAL_DMA_GetState(&hdma_tx);
//if(dmaState = 0x01) dmaState++;
//while(HAL_DMA_GetState(&hspi1) !=
//while(hspi1.State != HAL_SPI_STATE_READY);
//hal_delay_ms(1000);
// int temp = millis;
// while (millis < temp + 1000);
}
if(partialPass > 0)
{
while(hspi1.State != HAL_SPI_STATE_READY);
for(uint32_t i = (totalPixels * 2); i > 0; i-=2)
{
//txBuf2[i] = color;
if (txBuf2[i] != ((color & 0xFF00) >> 8) || txBuf2[i + 1] != (color & 0xFF))
errors++;
}
HAL_SPI_Transmit_DMA(&hspi1, txBuf2 + offset, partialPass); //txBuf2 or &txBuf2 doesn't seem to make a difference
while(hspi1.State != HAL_SPI_STATE_READY);
// int temp = millis;
// while (millis < temp + 1000);
}
//HAL_Delay(1000);
//hdma_tx.Init.MemInc = DMA_MINC_ENABLE;
//HAL_DMA_Init(&hdma_tx);
//}
//}
//digitalWrite(_cs, HIGH);
//SET_BIT(csport, cspinmask);
HAL_GPIO_WritePin(LCD_NSS.port, LCD_NSS.pin, 1);
}
// Pass 8-bit (each) R,G,B, get back 16-bit packed color
uint16_t Adafruit_ILI9340_Color565(uint8_t r, uint8_t g, uint8_t b) {
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
}
void Adafruit_ILI9340_setVerticalScrollStartAddress(uint16_t address)
{
Adafruit_ILI9340_writecommand(ILI9340_VSCRSADD);
Adafruit_ILI9340_writedata((address >> 8) & 0xFF);
Adafruit_ILI9340_writedata(address & 0xFF);
}
void Adafruit_ILI9340_setVerticalScrollDefinition(uint16_t topFixedArea,
uint16_t verticalScrollArea, uint16_t bottomFixedArea)
{
if (topFixedArea + verticalScrollArea + bottomFixedArea != 320) return;
Adafruit_ILI9340_writecommand(ILI9340_VSCRDEF);
Adafruit_ILI9340_writedata((topFixedArea >> 8) & 0xFF);
Adafruit_ILI9340_writedata(topFixedArea & 0xFF);
Adafruit_ILI9340_writedata((verticalScrollArea >> 8) & 0xFF);
Adafruit_ILI9340_writedata(verticalScrollArea & 0xFF);
Adafruit_ILI9340_writedata((bottomFixedArea >> 8) & 0xFF);
Adafruit_ILI9340_writedata(bottomFixedArea & 0xFF);
}
void Adafruit_ILI9340_setRotation(uint8_t m) {
Adafruit_ILI9340_writecommand(ILI9340_MADCTL);
int rotation = m % 4; // can't be higher than 3
switch (rotation) {
case 0:
Adafruit_ILI9340_writedata(ILI9340_MADCTL_MX | ILI9340_MADCTL_BGR);
_width = ILI9340_TFTWIDTH;
_height = ILI9340_TFTHEIGHT;
break;
case 1:
Adafruit_ILI9340_writedata(ILI9340_MADCTL_MV | ILI9340_MADCTL_BGR);
_width = ILI9340_TFTHEIGHT;
_height = ILI9340_TFTWIDTH;
break;
case 2:
Adafruit_ILI9340_writedata(ILI9340_MADCTL_MY | ILI9340_MADCTL_BGR);
_width = ILI9340_TFTWIDTH;
_height = ILI9340_TFTHEIGHT;
break;
case 3:
Adafruit_ILI9340_writedata(ILI9340_MADCTL_MV | ILI9340_MADCTL_MY | ILI9340_MADCTL_MX | ILI9340_MADCTL_BGR);
_width = ILI9340_TFTHEIGHT;
_height = ILI9340_TFTWIDTH;
break;
}
}
void Adafruit_ILI9340_invertDisplay(bool i) {
Adafruit_ILI9340_writecommand(i ? ILI9340_INVON : ILI9340_INVOFF);
}
////////// stuff not actively being used, but kept for posterity
//uint8_t Adafruit_ILI9340_spiread(void) {
// uint8_t r = 0;
//
// if (hwSPI) {
//#ifdef __AVR__
// SPDR = 0x00;
// while(!(SPSR & _BV(SPIF)));
// r = SPDR;
//#endif
//#if defined(USE_SPI_LIBRARY)
// r = SPI.transfer(0x00);
//#endif
// } else {
//
// for (uint8_t i=0; i<8; i++) {
// digitalWrite(_sclk, LOW);
// digitalWrite(_sclk, HIGH);
// r <<= 1;
// if (digitalRead(_miso))
// r |= 0x1;
// }
// }
// //Serial.print("read: 0x"); Serial.print(r, HEX);
//
// return r;
//}
//
// uint8_t Adafruit_ILI9340_readdata(void) {
// digitalWrite(_dc, HIGH);
// digitalWrite(_cs, LOW);
// uint8_t r = spiread();
// digitalWrite(_cs, HIGH);
//
// return r;
//}
//
//
// uint8_t Adafruit_ILI9340_readcommand8(uint8_t c) {
// digitalWrite(_dc, LOW);
// digitalWrite(_sclk, LOW);
// digitalWrite(_cs, LOW);
// spiwrite(c);
//
// digitalWrite(_dc, HIGH);
// uint8_t r = spiread();
// digitalWrite(_cs, HIGH);
// return r;
//}
/*
uint16_t Adafruit_ILI9340::readcommand16(uint8_t c) {
digitalWrite(_dc, LOW);
if (_cs)
digitalWrite(_cs, LOW);
spiwrite(c);
pinMode(_sid, INPUT); // input!
uint16_t r = spiread();
r <<= 8;
r |= spiread();
if (_cs)
digitalWrite(_cs, HIGH);
pinMode(_sid, OUTPUT); // back to output
return r;
}
uint32_t Adafruit_ILI9340::readcommand32(uint8_t c) {
digitalWrite(_dc, LOW);
if (_cs)
digitalWrite(_cs, LOW);
spiwrite(c);
pinMode(_sid, INPUT); // input!
dummyclock();
dummyclock();
uint32_t r = spiread();
r <<= 8;
r |= spiread();
r <<= 8;
r |= spiread();
r <<= 8;
r |= spiread();
if (_cs)
digitalWrite(_cs, HIGH);
pinMode(_sid, OUTPUT); // back to output
return r;
}
*/

View File

@ -0,0 +1,270 @@
#ifndef FONT5X7_H
#define FONT5X7_H
#ifdef __AVR__
#include <avr/io.h>
#include <avr/pgmspace.h>
#else
#define PROGMEM
#endif
// Standard ASCII 5x7 font
static const unsigned char font[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
0x18, 0x3C, 0x7E, 0x3C, 0x18,
0x1C, 0x57, 0x7D, 0x57, 0x1C,
0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
0x00, 0x18, 0x3C, 0x18, 0x00,
0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
0x00, 0x18, 0x24, 0x18, 0x00,
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
0x30, 0x48, 0x3A, 0x06, 0x0E,
0x26, 0x29, 0x79, 0x29, 0x26,
0x40, 0x7F, 0x05, 0x05, 0x07,
0x40, 0x7F, 0x05, 0x25, 0x3F,
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
0x14, 0x22, 0x7F, 0x22, 0x14,
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
0x06, 0x09, 0x7F, 0x01, 0x7F,
0x00, 0x66, 0x89, 0x95, 0x6A,
0x60, 0x60, 0x60, 0x60, 0x60,
0x94, 0xA2, 0xFF, 0xA2, 0x94,
0x08, 0x04, 0x7E, 0x04, 0x08,
0x10, 0x20, 0x7E, 0x20, 0x10,
0x08, 0x08, 0x2A, 0x1C, 0x08,
0x08, 0x1C, 0x2A, 0x08, 0x08,
0x1E, 0x10, 0x10, 0x10, 0x10,
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
0x30, 0x38, 0x3E, 0x38, 0x30,
0x06, 0x0E, 0x3E, 0x0E, 0x06,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14,
0x24, 0x2A, 0x7F, 0x2A, 0x12,
0x23, 0x13, 0x08, 0x64, 0x62,
0x36, 0x49, 0x56, 0x20, 0x50,
0x00, 0x08, 0x07, 0x03, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00,
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x80, 0x70, 0x30, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x60, 0x60, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02,
0x3E, 0x51, 0x49, 0x45, 0x3E,
0x00, 0x42, 0x7F, 0x40, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46,
0x21, 0x41, 0x49, 0x4D, 0x33,
0x18, 0x14, 0x12, 0x7F, 0x10,
0x27, 0x45, 0x45, 0x45, 0x39,
0x3C, 0x4A, 0x49, 0x49, 0x31,
0x41, 0x21, 0x11, 0x09, 0x07,
0x36, 0x49, 0x49, 0x49, 0x36,
0x46, 0x49, 0x49, 0x29, 0x1E,
0x00, 0x00, 0x14, 0x00, 0x00,
0x00, 0x40, 0x34, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41,
0x14, 0x14, 0x14, 0x14, 0x14,
0x00, 0x41, 0x22, 0x14, 0x08,
0x02, 0x01, 0x59, 0x09, 0x06,
0x3E, 0x41, 0x5D, 0x59, 0x4E,
0x7C, 0x12, 0x11, 0x12, 0x7C,
0x7F, 0x49, 0x49, 0x49, 0x36,
0x3E, 0x41, 0x41, 0x41, 0x22,
0x7F, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x49, 0x49, 0x49, 0x41,
0x7F, 0x09, 0x09, 0x09, 0x01,
0x3E, 0x41, 0x41, 0x51, 0x73,
0x7F, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x41, 0x7F, 0x41, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01,
0x7F, 0x08, 0x14, 0x22, 0x41,
0x7F, 0x40, 0x40, 0x40, 0x40,
0x7F, 0x02, 0x1C, 0x02, 0x7F,
0x7F, 0x04, 0x08, 0x10, 0x7F,
0x3E, 0x41, 0x41, 0x41, 0x3E,
0x7F, 0x09, 0x09, 0x09, 0x06,
0x3E, 0x41, 0x51, 0x21, 0x5E,
0x7F, 0x09, 0x19, 0x29, 0x46,
0x26, 0x49, 0x49, 0x49, 0x32,
0x03, 0x01, 0x7F, 0x01, 0x03,
0x3F, 0x40, 0x40, 0x40, 0x3F,
0x1F, 0x20, 0x40, 0x20, 0x1F,
0x3F, 0x40, 0x38, 0x40, 0x3F,
0x63, 0x14, 0x08, 0x14, 0x63,
0x03, 0x04, 0x78, 0x04, 0x03,
0x61, 0x59, 0x49, 0x4D, 0x43,
0x00, 0x7F, 0x41, 0x41, 0x41,
0x02, 0x04, 0x08, 0x10, 0x20,
0x00, 0x41, 0x41, 0x41, 0x7F,
0x04, 0x02, 0x01, 0x02, 0x04,
0x40, 0x40, 0x40, 0x40, 0x40,
0x00, 0x03, 0x07, 0x08, 0x00,
0x20, 0x54, 0x54, 0x78, 0x40,
0x7F, 0x28, 0x44, 0x44, 0x38,
0x38, 0x44, 0x44, 0x44, 0x28,
0x38, 0x44, 0x44, 0x28, 0x7F,
0x38, 0x54, 0x54, 0x54, 0x18,
0x00, 0x08, 0x7E, 0x09, 0x02,
0x18, 0xA4, 0xA4, 0x9C, 0x78,
0x7F, 0x08, 0x04, 0x04, 0x78,
0x00, 0x44, 0x7D, 0x40, 0x00,
0x20, 0x40, 0x40, 0x3D, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78,
0x7C, 0x08, 0x04, 0x04, 0x78,
0x38, 0x44, 0x44, 0x44, 0x38,
0xFC, 0x18, 0x24, 0x24, 0x18,
0x18, 0x24, 0x24, 0x18, 0xFC,
0x7C, 0x08, 0x04, 0x04, 0x08,
0x48, 0x54, 0x54, 0x54, 0x24,
0x04, 0x04, 0x3F, 0x44, 0x24,
0x3C, 0x40, 0x40, 0x20, 0x7C,
0x1C, 0x20, 0x40, 0x20, 0x1C,
0x3C, 0x40, 0x30, 0x40, 0x3C,
0x44, 0x28, 0x10, 0x28, 0x44,
0x4C, 0x90, 0x90, 0x90, 0x7C,
0x44, 0x64, 0x54, 0x4C, 0x44,
0x00, 0x08, 0x36, 0x41, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00,
0x02, 0x01, 0x02, 0x04, 0x02,
0x3C, 0x26, 0x23, 0x26, 0x3C,
0x1E, 0xA1, 0xA1, 0x61, 0x12,
0x3A, 0x40, 0x40, 0x20, 0x7A,
0x38, 0x54, 0x54, 0x55, 0x59,
0x21, 0x55, 0x55, 0x79, 0x41,
0x21, 0x54, 0x54, 0x78, 0x41,
0x21, 0x55, 0x54, 0x78, 0x40,
0x20, 0x54, 0x55, 0x79, 0x40,
0x0C, 0x1E, 0x52, 0x72, 0x12,
0x39, 0x55, 0x55, 0x55, 0x59,
0x39, 0x54, 0x54, 0x54, 0x59,
0x39, 0x55, 0x54, 0x54, 0x58,
0x00, 0x00, 0x45, 0x7C, 0x41,
0x00, 0x02, 0x45, 0x7D, 0x42,
0x00, 0x01, 0x45, 0x7C, 0x40,
0xF0, 0x29, 0x24, 0x29, 0xF0,
0xF0, 0x28, 0x25, 0x28, 0xF0,
0x7C, 0x54, 0x55, 0x45, 0x00,
0x20, 0x54, 0x54, 0x7C, 0x54,
0x7C, 0x0A, 0x09, 0x7F, 0x49,
0x32, 0x49, 0x49, 0x49, 0x32,
0x32, 0x48, 0x48, 0x48, 0x32,
0x32, 0x4A, 0x48, 0x48, 0x30,
0x3A, 0x41, 0x41, 0x21, 0x7A,
0x3A, 0x42, 0x40, 0x20, 0x78,
0x00, 0x9D, 0xA0, 0xA0, 0x7D,
0x39, 0x44, 0x44, 0x44, 0x39,
0x3D, 0x40, 0x40, 0x40, 0x3D,
0x3C, 0x24, 0xFF, 0x24, 0x24,
0x48, 0x7E, 0x49, 0x43, 0x66,
0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
0xFF, 0x09, 0x29, 0xF6, 0x20,
0xC0, 0x88, 0x7E, 0x09, 0x03,
0x20, 0x54, 0x54, 0x79, 0x41,
0x00, 0x00, 0x44, 0x7D, 0x41,
0x30, 0x48, 0x48, 0x4A, 0x32,
0x38, 0x40, 0x40, 0x22, 0x7A,
0x00, 0x7A, 0x0A, 0x0A, 0x72,
0x7D, 0x0D, 0x19, 0x31, 0x7D,
0x26, 0x29, 0x29, 0x2F, 0x28,
0x26, 0x29, 0x29, 0x29, 0x26,
0x30, 0x48, 0x4D, 0x40, 0x20,
0x38, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x38,
0x2F, 0x10, 0xC8, 0xAC, 0xBA,
0x2F, 0x10, 0x28, 0x34, 0xFA,
0x00, 0x00, 0x7B, 0x00, 0x00,
0x08, 0x14, 0x2A, 0x14, 0x22,
0x22, 0x14, 0x2A, 0x14, 0x08,
0xAA, 0x00, 0x55, 0x00, 0xAA,
0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x00, 0x00, 0x00, 0xFF, 0x00,
0x10, 0x10, 0x10, 0xFF, 0x00,
0x14, 0x14, 0x14, 0xFF, 0x00,
0x10, 0x10, 0xFF, 0x00, 0xFF,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x14, 0x14, 0x14, 0xFC, 0x00,
0x14, 0x14, 0xF7, 0x00, 0xFF,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x14, 0x14, 0xF4, 0x04, 0xFC,
0x14, 0x14, 0x17, 0x10, 0x1F,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0x1F, 0x00,
0x10, 0x10, 0x10, 0xF0, 0x00,
0x00, 0x00, 0x00, 0x1F, 0x10,
0x10, 0x10, 0x10, 0x1F, 0x10,
0x10, 0x10, 0x10, 0xF0, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0xFF, 0x10,
0x00, 0x00, 0x00, 0xFF, 0x14,
0x00, 0x00, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x1F, 0x10, 0x17,
0x00, 0x00, 0xFC, 0x04, 0xF4,
0x14, 0x14, 0x17, 0x10, 0x17,
0x14, 0x14, 0xF4, 0x04, 0xF4,
0x00, 0x00, 0xFF, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0xF7, 0x00, 0xF7,
0x14, 0x14, 0x14, 0x17, 0x14,
0x10, 0x10, 0x1F, 0x10, 0x1F,
0x14, 0x14, 0x14, 0xF4, 0x14,
0x10, 0x10, 0xF0, 0x10, 0xF0,
0x00, 0x00, 0x1F, 0x10, 0x1F,
0x00, 0x00, 0x00, 0x1F, 0x14,
0x00, 0x00, 0x00, 0xFC, 0x14,
0x00, 0x00, 0xF0, 0x10, 0xF0,
0x10, 0x10, 0xFF, 0x10, 0xFF,
0x14, 0x14, 0x14, 0xFF, 0x14,
0x10, 0x10, 0x10, 0x1F, 0x00,
0x00, 0x00, 0x00, 0xF0, 0x10,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
0xFF, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF, 0xFF,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x38, 0x44, 0x44, 0x38, 0x44,
0x7C, 0x2A, 0x2A, 0x3E, 0x14,
0x7E, 0x02, 0x02, 0x06, 0x06,
0x02, 0x7E, 0x02, 0x7E, 0x02,
0x63, 0x55, 0x49, 0x41, 0x63,
0x38, 0x44, 0x44, 0x3C, 0x04,
0x40, 0x7E, 0x20, 0x1E, 0x20,
0x06, 0x02, 0x7E, 0x02, 0x02,
0x99, 0xA5, 0xE7, 0xA5, 0x99,
0x1C, 0x2A, 0x49, 0x2A, 0x1C,
0x4C, 0x72, 0x01, 0x72, 0x4C,
0x30, 0x4A, 0x4D, 0x4D, 0x30,
0x30, 0x48, 0x78, 0x48, 0x30,
0xBC, 0x62, 0x5A, 0x46, 0x3D,
0x3E, 0x49, 0x49, 0x49, 0x00,
0x7E, 0x01, 0x01, 0x01, 0x7E,
0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
0x44, 0x44, 0x5F, 0x44, 0x44,
0x40, 0x51, 0x4A, 0x44, 0x40,
0x40, 0x44, 0x4A, 0x51, 0x40,
0x00, 0x00, 0xFF, 0x01, 0x03,
0xE0, 0x80, 0xFF, 0x00, 0x00,
0x08, 0x08, 0x6B, 0x6B, 0x08,
0x36, 0x12, 0x36, 0x24, 0x36,
0x06, 0x0F, 0x09, 0x0F, 0x06,
0x00, 0x00, 0x18, 0x18, 0x00,
0x00, 0x00, 0x10, 0x10, 0x00,
0x30, 0x40, 0xFF, 0x01, 0x01,
0x00, 0x1F, 0x01, 0x01, 0x1E,
0x00, 0x19, 0x1D, 0x17, 0x12,
0x00, 0x3C, 0x3C, 0x3C, 0x3C,
0x00, 0x00, 0x00, 0x00, 0x00
};
#endif // FONT5X7_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,131 @@
build/Adafruit_GFX.o: Src/Adafruit_GFX.c Inc/Adafruit_GFX.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h \
Drivers/CMSIS/Include/core_cm7.h Drivers/CMSIS/Include/core_cmInstr.h \
Drivers/CMSIS/Include/cmsis_gcc.h Drivers/CMSIS/Include/core_cmFunc.h \
Drivers/CMSIS/Include/core_cmSimd.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h \
Inc/stm32f7xx_hal_conf.h Inc/main.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h \
Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_mmc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_ll_sdmmc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_spi.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h \
Inc/Adafruit_ILI9340.h Inc/main.h Src/glcdfont.c Inc/pins.h Inc/spi.h
Inc/Adafruit_GFX.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h:
Drivers/CMSIS/Include/core_cm7.h:
Drivers/CMSIS/Include/core_cmInstr.h:
Drivers/CMSIS/Include/cmsis_gcc.h:
Drivers/CMSIS/Include/core_cmFunc.h:
Drivers/CMSIS/Include/core_cmSimd.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:
Inc/stm32f7xx_hal_conf.h:
Inc/main.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h:
Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_mmc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_ll_sdmmc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_spi.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h:
Inc/Adafruit_ILI9340.h:
Inc/main.h:
Src/glcdfont.c:
Inc/pins.h:
Inc/spi.h:

View File

@ -0,0 +1,129 @@
build/Adafruit_ILI9340.o: Src/Adafruit_ILI9340.c Inc/Adafruit_ILI9340.h \
Inc/Adafruit_GFX.h Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h \
Drivers/CMSIS/Include/core_cm7.h Drivers/CMSIS/Include/core_cmInstr.h \
Drivers/CMSIS/Include/cmsis_gcc.h Drivers/CMSIS/Include/core_cmFunc.h \
Drivers/CMSIS/Include/core_cmSimd.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h \
Inc/stm32f7xx_hal_conf.h Inc/main.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h \
Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_mmc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_ll_sdmmc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_spi.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h Inc/main.h \
Inc/spi.h Inc/pins.h
Inc/Adafruit_ILI9340.h:
Inc/Adafruit_GFX.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h:
Drivers/CMSIS/Include/core_cm7.h:
Drivers/CMSIS/Include/core_cmInstr.h:
Drivers/CMSIS/Include/cmsis_gcc.h:
Drivers/CMSIS/Include/core_cmFunc.h:
Drivers/CMSIS/Include/core_cmSimd.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:
Inc/stm32f7xx_hal_conf.h:
Inc/main.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h:
Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_mmc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_ll_sdmmc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_spi.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h:
Inc/main.h:
Inc/spi.h:
Inc/pins.h:

View File

@ -0,0 +1,117 @@
build/pins.o: Src/pins.c Inc/pins.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h \
Drivers/CMSIS/Include/core_cm7.h Drivers/CMSIS/Include/core_cmInstr.h \
Drivers/CMSIS/Include/cmsis_gcc.h Drivers/CMSIS/Include/core_cmFunc.h \
Drivers/CMSIS/Include/core_cmSimd.h \
Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h \
Inc/stm32f7xx_hal_conf.h Inc/main.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h \
Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_mmc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_ll_sdmmc.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_spi.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h \
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h
Inc/pins.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f746xx.h:
Drivers/CMSIS/Include/core_cm7.h:
Drivers/CMSIS/Include/core_cmInstr.h:
Drivers/CMSIS/Include/cmsis_gcc.h:
Drivers/CMSIS/Include/core_cmFunc.h:
Drivers/CMSIS/Include/core_cmSimd.h:
Drivers/CMSIS/Device/ST/STM32F7xx/Include/system_stm32f7xx.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h:
Inc/stm32f7xx_hal_conf.h:
Inc/main.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_def.h:
Drivers/STM32F7xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rcc_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_gpio_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dma_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_cortex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_adc_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_dac_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_flash_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_i2c_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_pwr_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_rtc_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_mmc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_ll_sdmmc.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_spi.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_tim_ex.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart.h:
Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal_uart_ex.h:

View File

@ -0,0 +1,9 @@
target extended-remote :4242
set mem inaccessible-by-default off
set print pretty
b AP_HAL::panic
b HardFault_Handler
b chSysHalt
set confirm off