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 {
|
|
|
|
|
2024-11-04 23:09:47 +01:00
|
|
|
const usb_mode_t usb_mode = USB_MODE_SWITCH_TATACON;
|
2023-07-05 19:58:04 +02:00
|
|
|
|
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-12-03 17:17:01 +01:00
|
|
|
// Trigger thresholds
|
2023-07-02 23:48:33 +02:00
|
|
|
{
|
2024-11-04 23:09:47 +01:00
|
|
|
30, // Don Left
|
|
|
|
10, // Ka Left
|
|
|
|
30, // Don Right
|
|
|
|
10, // Ka Right
|
2023-07-02 23:48:33 +02:00
|
|
|
},
|
2023-07-16 18:00:55 +02:00
|
|
|
|
2024-10-12 12:18:03 +02:00
|
|
|
16, // ADC sample count
|
2023-12-03 17:17:01 +01:00
|
|
|
25, // Debounce delay in milliseconds
|
|
|
|
500, // Roll Counter Timeout in Milliseconds
|
2023-08-12 09:41:16 +02:00
|
|
|
|
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
|
2024-11-13 21:05:49 +01:00
|
|
|
0, // Level Shifter Enable Pin
|
2023-08-09 22:29:27 +02:00
|
|
|
spi0, // Block
|
2024-11-13 21:05:49 +01:00
|
|
|
2000000, // Speed
|
2023-08-09 22:29:27 +02:00
|
|
|
},
|
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 17:17:01 +01:00
|
|
|
{128, 128, 128}, // Idle Color
|
|
|
|
{255, 0, 0}, // Don Left Color
|
|
|
|
{0, 0, 255}, // Ka Left Color
|
|
|
|
{255, 255, 0}, // Don Right Color
|
|
|
|
{0, 255, 255}, // Ka Right Color
|
2023-04-22 17:16:33 +02:00
|
|
|
|
|
|
|
11, // LED Enable Pin,
|
|
|
|
12, // LED Pin
|
|
|
|
false, // Is RGBW
|
2024-11-04 23:09:47 +01:00
|
|
|
|
|
|
|
255, // Brightness
|
|
|
|
true, // Idle Color is DS4 light bar color
|
2023-04-22 17:16:33 +02:00
|
|
|
};
|
|
|
|
|
2023-05-22 00:08:23 +02:00
|
|
|
const Peripherals::Display::Config display_config = {
|
|
|
|
i2c_config.block, // Block
|
|
|
|
0x3C, // Address
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Default
|
|
|
|
} // namespace Doncon::Config
|
2023-04-10 13:04:38 +02:00
|
|
|
|
|
|
|
#endif // _GLOBALCONFIGURATION_H_
|