little rook chess port

This commit is contained in:
olikraus 2016-06-18 12:10:41 +02:00
parent a27a5cb3a4
commit b8e06537e1
3 changed files with 24 additions and 35 deletions

View File

@ -148,14 +148,15 @@ U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 4, /*
// End of constructor list
u8g2_t *lrc_u8g; /* pointer to the C object of u8g2 lib, this is used by the chess engine */
void chess_Init(u8g2_t *u8g, uint8_t body_color);
/* This is the main setup. Please provide the pin numbers for the buttons */
/* Up/Down pins are not used in little rook chess */
void setup(void) {
//u8g2.begin(/*Select=*/ A0, /*Right/Next=*/ 5, /*Left/Prev=*/ 9, /*Up=*/ 8, /*Down=*/ 10, /*Home/Cancel=*/ A1); // Arduboy DevKit
u8g2.begin(/*Select=*/ 7, /*Right/Next=*/ A1, /*Left/Prev=*/ A2, /*Up=*/ A0, /*Down=*/ A3, /*Home/Cancel=*/ 8); // Arduboy 10 (Production)
lrc_u8g = u8g2.getU8g2();
chess_Init(u8g2.getU8g2(), 0);
}
/* Ignore PROGMEM for now */
@ -361,6 +362,7 @@ typedef struct _lrc_struct lrc_t;
/*==============================================================*/
lrc_t lrc_obj;
u8g2_t *lrc_u8g; /* pointer to the C object of u8g2 lib, this is used by the chess engine */
/*==============================================================*/
@ -410,7 +412,7 @@ void ce_LoopPieces(void);
/*==============================================================*/
/* get current element from stack */
stack_element_p stack_GetCurrElement(void)
struct _stack_element_struct *stack_GetCurrElement(void)
{
return lrc_obj.curr_element;
}
@ -1342,8 +1344,8 @@ void ce_LoopKing(void)
/*==============================================================*/
/*
doppelschritt: nur von der grundlinie aus, beide (!) felder vor dem bauern müssen frei sein
en passant: nur unmittelbar nachdem ein doppelschritt ausgeführt wurde.
doppelschritt: nur von der grundlinie aus, beide (!) felder vor dem bauern m<EFBFBD>ssen frei sein
en passant: nur unmittelbar nachdem ein doppelschritt ausgef<EFBFBD>hrt wurde.
*/
void ce_LoopPawnSideCapture(uint8_t loop_pos)
{
@ -2298,11 +2300,19 @@ void chess_Step(uint8_t keycode)
#endif /* UNIX_MAIN */
void loop(void) {
static uint8_t keycode = 0;
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(0,24,"Hello World!");
chess_Draw();
if ( keycode == 0 )
keycode = u8g2.getMenuEvent();
} while ( u8g2.nextPage() );
//delay(1000);
}
if ( keycode == 0 )
keycode = u8g2.getMenuEvent();
chess_Step(keycode);
keycode = 0;
delay(1);
}

View File

@ -43,32 +43,8 @@
#include <SPI.h>
#endif
// Please UNCOMMENT one of the contructor lines below
// U8x8 Contructor List
// The complete list is available here: https://github.com/olikraus/u8g2/wiki/u8x8setupcpp
// Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected
//U8X8_SSD1306_128X64_NONAME_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
U8X8_SSD1306_128X64_NONAME_4W_HW_SPI u8x8(/* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6); // Arduboy 10 (Production, Kickstarter Edition)
//U8X8_SSD1306_128X64_NONAME_4W_HW_SPI u8x8(/* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8X8_SSD1306_128X64_NONAME_3W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* reset=*/ 8);
//U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ 2, /* data=*/ 0, /* reset=*/ U8X8_PIN_NONE); // Digispark ATTiny85
//U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display
//U8X8_SSD1306_128X32_UNIVISION_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); // Adafruit Feather ESP8266/32u4 Boards + FeatherWing OLED
//U8X8_SSD1306_128X32_UNIVISION_SW_I2C u8x8(/* clock=*/ 21, /* data=*/ 20, /* reset=*/ U8X8_PIN_NONE); // Adafruit Feather M0 Basic Proto + FeatherWing OLED
//U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE); // Adafruit ESP8266/32u4/ARM Boards + FeatherWing OLED
//U8X8_SSD1306_128X64_NONAME_6800 u8x8(13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
//U8X8_SSD1306_128X64_NONAME_8080 u8x8(13, 11, 2, 3, 4, 5, 6, A4, /*enable=*/ 7, /*cs=*/ 10, /*dc=*/ 9, /*reset=*/ 8);
//U8X8_ST7920_192X32_8080 u8x8(8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ U8X8_PIN_NONE, /*dc=*/ 17, /*reset=*/ U8X8_PIN_NONE);
//U8X8_ST7920_192X32_6800 u8x8(8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ U8X8_PIN_NONE, /*dc=*/ 17, /*reset=*/ U8X8_PIN_NONE);
//U8X8_UC1701_EA_DOGS102_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8X8_UC1701_EA_DOGS102_4W_HW_SPI u8x8(/* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8X8_ST7565_EA_DOGM128_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8X8_ST7565_EA_DOGM128_4W_HW_SPI u8x8(/* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8X8_ST7565_NHD_C12832_4W_SW_SPI u8x8(/* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8X8_ST7565_NHD_C12832_4W_HW_SPI u8x8(/* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
// End of constructor list
// Arduboy 10 (Production, Kickstarter Edition)
U8X8_SSD1306_128X64_NONAME_4W_HW_SPI u8x8(/* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6);
ArduboyCore arduboyCore;
ArduboyAudio arduboyAudio;

View File

@ -29,6 +29,9 @@ cp ../../../sys/arduino/u8g2_page_buffer/PrintUTF8/*.ino ../../../../U8g2_Arduin
mkdir ../../../../U8g2_Arduino/examples/page_buffer/U8g2Logo
cp ../../../sys/arduino/u8g2_page_buffer/U8g2Logo/*.ino ../../../../U8g2_Arduino/examples/page_buffer/U8g2Logo/.
mkdir ../../../../U8g2_Arduino/examples/page_buffer/LittleRookChess
cp ../../../sys/arduino/u8g2_page_buffer/LittleRookChess/*.ino ../../../../U8g2_Arduino/examples/page_buffer/LittleRookChess/.
# full buffer
mkdir ../../../../U8g2_Arduino/examples/full_buffer/HelloWorld