snake_compiler git · main
Snake compiled to a bare-metal RISC-V microcontroller
C 95.2% Markdown 3.3%git clone https://git.christianimmanuel.de/embedded/snake_compiler.gitwget https://git.christianimmanuel.de/embedded/snake_compiler/archive/snake_compiler.tar.gzsnake_SDL/src/defaults.h raw
#ifndef DEFAULTS_H
#define DEFAULTS_H
#define WS2812_PIN 8
#define MATRIX_WIDTH 16
#define MATRIX_HEIGHT 16
#define NUM_PIXELS MATRIX_WIDTH*MATRIX_HEIGHT
#define MAX_SNAKE_LENGTH 1024
// down right left up
// #define PIN_BUTTON_LEFT 4 down
// #define PIN_BUTTON_DOWN 5 right
// #define PIN_BUTTON_UP 9 left
// #define PIN_BUTTON_RIGHT 10 up
#define PIN_BUTTON_LEFT 4
#define PIN_BUTTON_DOWN 5
#define PIN_BUTTON_UP 9
#define PIN_BUTTON_RIGHT 10
#ifndef WALL_COLLISION
#define WALL_COLLISION 0
#endif
#ifndef SNAKE_START_LENGTH
#define SNAKE_START_LENGTH 2
#endif
#ifndef MAX_BRIGHTNESS
#define MAX_BRIGHTNESS 7
#endif
#ifndef SNAKE_COLOR_R
#define SNAKE_COLOR_R SNAKE_MAX_BRIGHTNESS
#endif
#ifndef SNAKE_COLOR_G
#define SNAKE_COLOR_G 0
#endif
#ifndef SNAKE_COLOR_B
#define SNAKE_COLOR_B 0
#endif
#define SNAKE_COLOR ((Color){ SNAKE_COLOR_G, SNAKE_COLOR_R, SNAKE_COLOR_B })
#define GREEN ((Color){ MAX_BRIGHTNESS,0,0 })
#define RED ((Color){ 0,MAX_BRIGHTNESS,0 })
#define BLUE ((Color){ 0,0,MAX_BRIGHTNESS })
#define BLACK ((Color){ 0,0,0 })
#endif