38 lines
1.3 KiB
Markdown
38 lines
1.3 KiB
Markdown
# Classic Snake game for the STM32 board
|
|
## Hardware prerequisities
|
|
* stm32duino (should work on generic Arduino boards)
|
|
* Philips PCD8544 (Nokia 3310) LCD
|
|
|
|
## Software prerequisities
|
|
* Arduino Software
|
|
* [Arduino Core for STM32](https://github.com/balux33/Arduino_STM32)
|
|
* [Adafruit PCD8544 Library](https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library)
|
|
* [Adafruit GFX Library](https://github.com/adafruit/Adafruit-GFX-Library)
|
|
* [SimpleTimer Library for Arduino](https://playground.arduino.cc/Code/SimpleTimer#Download)
|
|
* [Standard C++ for Arduino](https://github.com/maniacbug/StandardCplusplus)
|
|
|
|
## Building and flashing
|
|
Just as with normal Arduino codes, build and flash it from the Arduino Software.
|
|
* Board: Generic STM32F103C series
|
|
* Variant: STM32F103C8 (20K RAM. 64K Flash)
|
|
* CPU Speed: 72MHz
|
|
|
|
## Note
|
|
If using a different board, then change the configuration and modify the pins accordingly.
|
|
For the STM32 board the following changes are necessary:
|
|
|
|
Adafruit_PCD8544.h:
|
|
```
|
|
#define PCD8544_SPI_CLOCK_DIV SPI_CLOCK_DIV4 -> #define PCD8544_SPI_CLOCK_DIV SPI_CLOCK_DIV8
|
|
```
|
|
|
|
```
|
|
#ifdef __SAM3X8E__
|
|
typedef volatile RwReg PortReg;
|
|
typedef uint8_t PortMask; -> typedef uint32_t PortMask;
|
|
#else
|
|
typedef volatile uint32_t PortReg;
|
|
typedef uint8_t PortMask; -> typedef uint32_t PortMask;
|
|
#endif
|
|
```
|