32ESPecial Version 1.00 (#9)
This release reworked the initialization code to provide more robust initialization, especially when no USB stick is present. It incorporates [Version 1.0 of SystemK](Software/SystemK#9). This is the first release for the [32ESPecial Blaster Kits](https://link.clubk.club/2025002). Co-authored-by: Joe Kearney <joe@clubk.club> Reviewed-on: #9
This commit is contained in:
parent
14ec8fe280
commit
e12ee17973
67 changed files with 1232 additions and 649 deletions
|
|
@ -1,5 +1,27 @@
|
|||
/*
|
||||
* This program source code file is part of the KTag project, a DIY laser tag
|
||||
* game with customizable features and wide interoperability.
|
||||
*
|
||||
* 🛡️ <https://ktag.clubk.club> 🃞
|
||||
*
|
||||
* Copyright © 2024-2025 Joseph P. Kearney and the KTag developers.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* There should be a copy of the GNU Affero General Public License in the LICENSE
|
||||
* file in the root of this repository. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <SystemK.h>
|
||||
#include <System_Events.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
#include <string.h>
|
||||
|
|
@ -18,11 +40,11 @@ static TaskHandle_t xTaskHandle;
|
|||
static muxed_led_strip_handle_t NeoPixel_Out;
|
||||
|
||||
// GPIO assignments
|
||||
#define NEOPIXEL_OUT_GPIO GPIO_NUM_48
|
||||
#define BARREL_ENABLE_GPIO GPIO_NUM_18
|
||||
#define RECEIVER_ENABLE_GPIO GPIO_NUM_45
|
||||
#define DISPLAY_ENABLE_GPIO GPIO_NUM_10
|
||||
#define EFFECTS_ENABLE_GPIO GPIO_NUM_17
|
||||
#define NEOPIXEL_OUT_GPIO GPIO_NUM_48
|
||||
#define BARREL_ENABLE_GPIO GPIO_NUM_18
|
||||
#define RECEIVER_ENABLE_GPIO GPIO_NUM_45
|
||||
#define DISPLAY_ENABLE_GPIO GPIO_NUM_10
|
||||
#define EFFECTS_ENABLE_GPIO GPIO_NUM_17
|
||||
|
||||
// 10MHz resolution, 1 tick = 0.1us (led strip needs a high resolution)
|
||||
#define LED_STRIP_RMT_RES_HZ (10 * 1000 * 1000)
|
||||
|
|
@ -127,12 +149,12 @@ static led_strip_rmt_config_t rmt_config_noDMA = {
|
|||
};
|
||||
|
||||
static led_strip_spi_config_t spi_config_withDMA __attribute__((unused)) = {
|
||||
.clk_src = RMT_CLK_SRC_XTAL, // different clock source can lead to different power consumption
|
||||
.flags.with_dma = true, // Using DMA can improve performance and help drive more LEDs
|
||||
.spi_bus = SPI2_HOST, // SPI bus ID
|
||||
.clk_src = RMT_CLK_SRC_XTAL, // different clock source can lead to different power consumption
|
||||
.flags.with_dma = true, // Using DMA can improve performance and help drive more LEDs
|
||||
.spi_bus = SPI2_HOST, // SPI bus ID
|
||||
};
|
||||
|
||||
void Initialize_SystemK_NeoPixels(SemaphoreHandle_t init_complete)
|
||||
void Initialize_SystemK_NeoPixels(void)
|
||||
{
|
||||
xStack = (uint8_t *)heap_caps_calloc(1, NEOPIXELS_STACK_SIZE, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT | MALLOC_CAP_32BIT);
|
||||
|
||||
|
|
@ -147,13 +169,14 @@ void Initialize_SystemK_NeoPixels(SemaphoreHandle_t init_complete)
|
|||
&xTaskBuffer, // Variable to hold the task's data structure.
|
||||
APP_CPU_NUM); // Specify the task's core affinity.
|
||||
|
||||
xEventGroupSetBits(Get_System_Events(), SYS_NEOPIXELS_READY);
|
||||
KLOG_INFO(TAG, "Initialization complete.");
|
||||
|
||||
xSemaphoreGive(init_complete);
|
||||
}
|
||||
|
||||
SystemKResult_T HW_NeoPixels_Init(void)
|
||||
{
|
||||
KLOG_INFO(TAG, "Initializing NeoPixels...");
|
||||
|
||||
if (CONFIG_KTAG_N_NEOPIXEL_CHANNELS > 0)
|
||||
{
|
||||
// Initialize the NeoPixel Out and the Barrel Enable.
|
||||
|
|
@ -220,11 +243,11 @@ color_t HW_NeoPixels_Get_My_Color(void)
|
|||
uint8_t Player_ID;
|
||||
uint8_t Weapon_ID;
|
||||
|
||||
(void) SETTINGS_get_uint8_t(SYSTEMK_SETTING_TEAMID, &Team_ID);
|
||||
(void) SETTINGS_get_uint8_t(SYSTEMK_SETTING_PLAYERID, &Player_ID);
|
||||
(void) SETTINGS_get_uint8_t(SYSTEMK_SETTING_WEAPONID, &Weapon_ID);
|
||||
(void)SETTINGS_get_uint8_t(SYSTEMK_SETTING_TEAMID, &Team_ID);
|
||||
(void)SETTINGS_get_uint8_t(SYSTEMK_SETTING_PLAYERID, &Player_ID);
|
||||
(void)SETTINGS_get_uint8_t(SYSTEMK_SETTING_WEAPONID, &Weapon_ID);
|
||||
|
||||
result = PROTOCOLS_GetColor(GetWeaponFromID(Weapon_ID).Protocol, Team_ID, Player_ID);
|
||||
result = PROTOCOLS_GetColor(GetWeaponFromID(Weapon_ID).Protocol, Team_ID, Player_ID);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue