Commit 5d35d963 authored by Robin Frund's avatar Robin Frund
Browse files

init commit

parents
Loading
Loading
Loading
Loading

.gitattributes

0 → 100644
+2 −0
Original line number Diff line number Diff line
# Auto detect text files and perform LF normalization
* text=auto

.vscode/arduino.json

0 → 100644
+9 −0
Original line number Diff line number Diff line
{
    "programmer": "AVR ISP",
    "board": "arduino:megaavr:nona4809",
    "configuration": "mode=off",
    "port": "COM2",
    "sketch": "Console_Kids.ino",
    "output": "./VsCodeArduinoBuilds"
}
 No newline at end of file
+0 −0

File added.

Preview size limit exceeded, changes collapsed.

.vscode/settings.json

0 → 100644
+7 −0
Original line number Diff line number Diff line
{
    "files.associations": {
        "console_kids.h": "c",
        "arduino.h": "c"
    }
}
 No newline at end of file

Console_Kids.h

0 → 100644
+116 −0
Original line number Diff line number Diff line

#include "Led.h"
#include "serial.h"
#include <Arduino.h>

#ifndef Console_Kids_h
#define Console_Kids_h

#define NB_LEDS 4
#define LED_RED_PIN A0
#define LED_GREEN_PIN 11 
#define LED_YELLOW_PIN 2
#define LED_BLUE_PIN 3

#define BTN_A_PIN 12 
#define BTN_B_PIN A1
#define BTN_C_PIN 4
#define BTN_D_PIN 5

#define SDA A4
#define SCL A5

#define MIC_PIN 7

#define OFF 0
#define RED 1
#define YELLOW 2
#define GREEN 3

#define MATRIX_ROWS 8

typedef enum
{
  SEQUENCE,
  TIC_TAC_TOE,
  FOUR_IN_A_ROW
} GameEnum;

typedef enum
{
  BTN_A = 0,
  BTN_B = 1,
  BTN_C = 2,
  BTN_D = 3,
  NONE
} ButtonPressedEnum;

typedef enum
{
  ANTI_REBOND
} TimerEnum;

typedef enum
{
  SELECTING,
  PLAYING
} ConsoleStateEnum;

typedef enum
{
  CONTINUE,
  QUIT,
  RESTART
} GameProgressEnum;

const uint8_t GAME_PREVIEW_ARR[4][8][8] =
    {
        {{1, 1, 2, 0, 0, 2, 0, 0},
         {1, 1, 2, 0, 0, 2, 0, 0},
         {2, 2, 2, 2, 2, 2, 2, 2},
         {0, 0, 2, 3, 3, 2, 0, 0},
         {0, 0, 2, 3, 3, 2, 0, 0},
         {2, 2, 2, 2, 2, 2, 2, 2},
         {0, 0, 2, 0, 0, 2, 1, 1},
         {0, 0, 2, 0, 0, 2, 1, 1}},
        {{0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0, 3, 0, 0},
         {0, 0, 3, 0, 0, 3, 0, 0},
         {0, 0, 3, 0, 0, 3, 0, 0},
         {0, 0, 1, 1, 1, 1, 0, 0},
         {0, 0, 1, 0, 0, 0, 0, 0},
         {0, 0, 1, 0, 0, 0, 0, 0},
         {0, 0, 1, 0, 0, 0, 0, 0}},
        {{0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 3, 3, 3, 3, 0, 0},
         {0, 0, 0, 0, 0, 3, 0, 0},
         {0, 0, 0, 0, 0, 3, 0, 0},
         {0, 0, 3, 3, 3, 3, 0, 0},
         {0, 0, 3, 0, 0, 0, 0, 0},
         {0, 0, 3, 0, 0, 0, 0, 0},
         {0, 0, 3, 3, 3, 3, 0, 0}},
        {{0, 0, 0, 0, 0, 0, 0, 0},
         {0, 0, 1, 1, 1, 1, 0, 0},
         {0, 1, 0, 0, 0, 1, 0, 0},
         {0, 1, 0, 0, 0, 1, 0, 0},
         {0, 0, 1, 1, 1, 1, 0, 0},
         {0, 0, 0, 1, 0, 1, 0, 0},
         {0, 0, 1, 0, 0, 1, 0, 0},
         {0, 1, 0, 0, 0, 1, 0, 0}}};

void init_();
ButtonPressedEnum getButtonPressed();
void update_leds();
void set_matrix(uint8_t data[8][8]);
void set_crown(uint8_t data[8][8]);
void set_all_leds_off();
void set_all_leds_on();
void set_all_leds_on(int);
void turn_on_player_leds(uint8_t player);
extern Led led_red;
extern Led led_green;
extern Led led_yellow;
extern Led led_blue;
extern Led *led_arr[NB_LEDS];
extern PC_APP pc;
#endif