2023-04-10 13:04:38 +02:00
|
|
|
#ifndef _GLOBALCONFIGURATION_H_
|
|
|
|
#define _GLOBALCONFIGURATION_H_
|
|
|
|
|
2023-05-21 22:02:24 +02:00
|
|
|
#include "peripherals/Controller.h"
|
2023-05-22 00:08:23 +02:00
|
|
|
#include "peripherals/Display.h"
|
2023-04-10 13:04:38 +02:00
|
|
|
#include "peripherals/Drum.h"
|
2023-04-22 17:16:33 +02:00
|
|
|
#include "peripherals/StatusLed.h"
|
2023-04-10 13:04:38 +02:00
|
|
|
|
2023-05-20 20:17:26 +02:00
|
|
|
#include "hardware/i2c.h"
|
2023-08-09 22:29:27 +02:00
|
|
|
#include "hardware/spi.h"
|
2023-05-20 20:17:26 +02:00
|
|
|
|
2023-05-22 00:08:23 +02:00
|
|
|
namespace Doncon::Config {
|
|
|
|
|
|
|
|
struct I2c {
|
|
|
|
uint8_t sda_pin;
|
|
|
|
uint8_t scl_pin;
|
|
|
|
i2c_inst_t *block;
|
|
|
|
uint speed_hz;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace Default {
|
|
|
|
|
2023-07-05 19:58:04 +02:00
|
|
|
const usb_mode_t usb_mode = USB_MODE_XBOX360;
|
|
|
|
|
2023-05-22 00:08:23 +02:00
|
|
|
const I2c i2c_config = {
|
|
|
|
6, // SDA Pin
|
|
|
|
7, // SCL Pin
|
|
|
|
i2c1, // Block
|
|
|
|
1000000, // Speed
|
|
|
|
};
|
2023-04-10 13:04:38 +02:00
|
|
|
|
|
|
|
const Peripherals::Drum::Config drum_config = {
|
|
|
|
// Pin config
|
|
|
|
{
|
2023-12-02 21:44:55 +01:00
|
|
|
1, // Don Left
|
|
|
|
0, // Ka Left
|
|
|
|
2, // Don Right
|
|
|
|
3, // Ka Right
|
2023-04-10 13:04:38 +02:00
|
|
|
},
|
2023-07-02 23:48:33 +02:00
|
|
|
// Trigger thresholds soft
|
|
|
|
{
|
|
|
|
80, // Don Left
|
2023-12-03 16:30:36 +01:00
|
|
|
50, // Ka Left
|
2023-07-02 23:48:33 +02:00
|
|
|
80, // Don Right
|
2023-12-03 16:30:36 +01:00
|
|
|
50, // Ka Right
|
2023-07-02 23:48:33 +02:00
|
|
|
},
|
2023-07-16 18:00:55 +02:00
|
|
|
|
2023-12-03 15:34:57 +01:00
|
|
|
10, // ADC sample count
|
2023-08-12 09:41:16 +02:00
|
|
|
25, // Debounce delay in milliseconds
|
|
|
|
|
2023-08-09 22:29:27 +02:00
|
|
|
true, // Use external ADC
|
|
|
|
// SPI config for external ADC, unused if above is false
|
|
|
|
{
|
|
|
|
3, // MOSI Pin
|
|
|
|
4, // MISO Pin
|
|
|
|
2, // SCLK Pin
|
|
|
|
1, // SCSn Pin
|
|
|
|
spi0, // Block
|
|
|
|
2000000, // Speed
|
|
|
|
},
|
2023-04-10 13:04:38 +02:00
|
|
|
};
|
|
|
|
|
2023-05-20 20:17:26 +02:00
|
|
|
const Peripherals::Buttons::Config button_config = {
|
2023-05-22 00:08:23 +02:00
|
|
|
// I2c config
|
2023-05-20 20:17:26 +02:00
|
|
|
{
|
2023-05-22 00:08:23 +02:00
|
|
|
i2c_config.block, // Block
|
|
|
|
0x20, // Address
|
2023-05-20 20:17:26 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
// Pins
|
|
|
|
{{
|
2023-08-12 09:44:27 +02:00
|
|
|
8, // Up
|
|
|
|
9, // Down
|
|
|
|
10, // Left
|
|
|
|
11, // Right
|
2023-05-20 20:17:26 +02:00
|
|
|
},
|
|
|
|
{
|
2023-08-12 09:44:27 +02:00
|
|
|
0, // North
|
|
|
|
3, // East
|
|
|
|
1, // South
|
|
|
|
2, // West
|
|
|
|
|
|
|
|
12, // L
|
|
|
|
4, // R
|
|
|
|
|
|
|
|
5, // Start
|
|
|
|
13, // Select
|
|
|
|
6, // Home
|
|
|
|
14, // Share
|
2023-05-20 20:17:26 +02:00
|
|
|
}},
|
|
|
|
|
2023-12-02 21:44:55 +01:00
|
|
|
25, // Debounce delay in milliseconds
|
2023-05-20 20:17:26 +02:00
|
|
|
};
|
|
|
|
|
2023-04-22 17:16:33 +02:00
|
|
|
const Peripherals::StatusLed::Config led_config = {
|
2023-12-03 16:30:36 +01:00
|
|
|
{128, 128, 128}, // Idle Color
|
2023-04-22 17:16:33 +02:00
|
|
|
{255, 0, 0}, // Don Left Color
|
|
|
|
{0, 0, 255}, // Ka Left Color
|
|
|
|
{255, 255, 0}, // Don Right Color
|
|
|
|
{0, 255, 255}, // Ka Right Color
|
|
|
|
|
|
|
|
11, // LED Enable Pin,
|
|
|
|
12, // LED Pin
|
|
|
|
false, // Is RGBW
|
|
|
|
255, // Brightness
|
|
|
|
};
|
|
|
|
|
2023-05-22 00:08:23 +02:00
|
|
|
const Peripherals::Display::Config display_config = {
|
|
|
|
i2c_config.block, // Block
|
|
|
|
0x3C, // Address
|
2023-07-16 16:48:08 +02:00
|
|
|
|
|
|
|
500, // Roll Counter Timeout in Milliseconds
|
2023-05-22 00:08:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Default
|
|
|
|
} // namespace Doncon::Config
|
2023-04-10 13:04:38 +02:00
|
|
|
|
|
|
|
#endif // _GLOBALCONFIGURATION_H_
|