Compare commits

...

2 Commits

Author SHA1 Message Date
true cd0cfa1d40 minor cleanup in V003 code 2024-11-16 13:29:40 -08:00
true 4db0f9e343 minor fixes and cleanups
fixed rgb_waving to correct LED count.

change some LED program defaults.
2024-11-16 13:28:51 -08:00
10 changed files with 30 additions and 34 deletions

View File

@ -159,9 +159,5 @@
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="build_softi2c">
<resource resourceType="PROJECT" workspacePath="/nametag8_CH592"/>
</configuration>
</storageModule>
<storageModule moduleId="refreshScope"/>
</cproject>

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-83964059827239915" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="498546753104804359" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -290,7 +290,7 @@ void rgb_waving(uint8_t *a, uint16_t tick)
uint8_t desatfade = a[1] & 0x20;
rgb_waving_divider++;
rgb_waving_divider %= 10;
rgb_waving_divider %= RGBLED_COUNT;
if (!rgb_waving_divider && (a[1] & 0x02)) {
for (i = 0; i < RGBLED_COUNT; i++) {
if (hsv_out[i].v <= trailfade) {
@ -342,16 +342,16 @@ void rgb_waving(uint8_t *a, uint16_t tick)
break;
}
case 1: { // moving down
hsv_out[rgb_map[ a[6]]].h = uconf.favcolor_hue * 6;
hsv_out[rgb_map[ a[6]]].s = uconf.favcolor_sat;
hsv_out[rgb_map[ a[6]]].v = uconf.favcolor_val;
hsv_out[rgb_map[ a[6]]].h = uconf.favcolor_hue * 6;
hsv_out[rgb_map[ a[6]]].s = uconf.favcolor_sat;
hsv_out[rgb_map[ a[6]]].v = uconf.favcolor_val;
hsv_out[rgb_map[9 - a[6]]].h = uconf.favcolor_hue * 6;
hsv_out[rgb_map[9 - a[6]]].s = uconf.favcolor_sat;
hsv_out[rgb_map[9 - a[6]]].v = uconf.favcolor_val;
hsv_out[rgb_map[RGBLED_COUNT - 1 - a[6]]].h = uconf.favcolor_hue * 6;
hsv_out[rgb_map[RGBLED_COUNT - 1 - a[6]]].s = uconf.favcolor_sat;
hsv_out[rgb_map[RGBLED_COUNT - 1 - a[6]]].v = uconf.favcolor_val;
a[6]++;
if (a[6] >= 5) {
if (a[6] >= (RGBLED_COUNT >> 1) - 1) {
a[5] = stall;
a[4]++;
break;
@ -360,16 +360,16 @@ void rgb_waving(uint8_t *a, uint16_t tick)
break;
}
case 3: { // moving up
hsv_out[rgb_map[4 - a[6]]].h = uconf.favcolor_hue * 6;
hsv_out[rgb_map[4 - a[6]]].s = uconf.favcolor_sat;
hsv_out[rgb_map[4 - a[6]]].v = uconf.favcolor_val;
hsv_out[rgb_map[(RGBLED_COUNT >> 1) + 0 - a[6]]].h = uconf.favcolor_hue * 6;
hsv_out[rgb_map[(RGBLED_COUNT >> 1) + 0 - a[6]]].s = uconf.favcolor_sat;
hsv_out[rgb_map[(RGBLED_COUNT >> 1) + 0 - a[6]]].v = uconf.favcolor_val;
hsv_out[rgb_map[5 + a[6]]].h = uconf.favcolor_hue * 6;
hsv_out[rgb_map[5 + a[6]]].s = uconf.favcolor_sat;
hsv_out[rgb_map[5 + a[6]]].v = uconf.favcolor_val;
hsv_out[rgb_map[(RGBLED_COUNT >> 1) + 1 + a[6]]].h = uconf.favcolor_hue * 6;
hsv_out[rgb_map[(RGBLED_COUNT >> 1) + 1 + a[6]]].s = uconf.favcolor_sat;
hsv_out[rgb_map[(RGBLED_COUNT >> 1) + 1 + a[6]]].v = uconf.favcolor_val;
a[6]++;
if (a[6] >= 5) {
if (a[6] >= (RGBLED_COUNT >> 1) - 1) {
a[5] = stall;
a[4]++;
break;

View File

@ -21,8 +21,6 @@
*
* todo:
* - decouple oled render routine from interrupt off time. not an issue for now...
* - shrink main tick interrupt routine to incrementing a flag
* - implement better CPU usage statistics
*
*/
@ -60,7 +58,7 @@
#define PROG_TICK_RATE ((32768-8192-4096) / 256) // not sure why this value can't be 32768/256
// this was checked with a stopwatch and is close enough
// this value IS FRAMERATE DEPENDENT... todo: fix this and make this accurate
// this value IS FRAMERATE DEPENDENT for some reason... figure it out later
#define IDLE_SLEEP_START (1 << 0)
#define IDLE_MENU_START (1 << 1)
#define IDLE_DIM_START (1 << 2)
@ -70,7 +68,7 @@
const uint8_t vers[] = "241109a";
const uint8_t vers[] = "241116a";
uint32_t cpu_use = 0;
uint32_t cpu_max = 0;

View File

@ -22,8 +22,8 @@ uint16_t uconf_flash_offset;
static const uint8_t uconf_edge_defaults[8][8] = {
{0x03, 0x10, 0x04, 0x00, 0x00, 0x00, 0xff, 0xa0}, // solid color
{0x03, 0x10, 0x04, 0x00, 0x00, 0x00, 0xff, 0xa0}, // flicker
{0x15, 0x42, 0x50, 0x00, 0xa0, 0x30, 0xff, 0x20}, // circles
{0x03, 0x1f, 0x04, 0x00, 0x00, 0x00, 0xff, 0xa0}, // flicker
{0x15, 0x42, 0x0b, 0x00, 0xa0, 0x30, 0xff, 0x20}, // circles
{0x03, 0x10, 0x04, 0x00, 0x00, 0x00, 0xff, 0xa0}, // waving
{0x03, 0x11, 0x05, 0x00, 0x00, 0x00, 0xff, 0x80}, // rainbow
{0x00, 0x01, 0x01, 0x00, 0x00, 0x66, 0x46, 0x80}, // cop mode

View File

@ -64,7 +64,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths.1567947810" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Debug}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Core}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/User}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/user}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Peripheral/inc}&quot;"/>
</option>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.2020844713" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.gnu99" valueType="enumerated"/>

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-16790866626903596" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="472368321955700908" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -23,11 +23,11 @@
#include <ch32v00x_misc.h>
#include <ch32v00x_pwr.h>
#include <ch32v00x_rcc.h>
#include <ch32v00x_spi.h>
//#include <ch32v00x_spi.h>
#include <ch32v00x_tim.h>
#include <ch32v00x_usart.h>
#include <ch32v00x_wwdg.h>
#include <ch32v00x_opa.h>
//#include <ch32v00x_opa.h>
#include "ch32v00x_it.h"

View File

@ -26,7 +26,7 @@
#include "irda.h"
#include "intr_out.h"
#include "../i2c_slave.h"
#include "i2c_slave.h"
@ -106,6 +106,7 @@ void irda_ena_rx()
USART1->CTLR2 &= ~USART_CTLR1_TE;
USART1->CTLR2 |= USART_CTLR1_RE;
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
}
@ -255,6 +256,7 @@ void irda_process()
}
irda_timeout--;
i2cs_reg[REG_IRDA_TIMER] = irda_timeout;
switch (irda_state) {
case IRDA_STATE_TX_HEADER:

View File

@ -25,8 +25,8 @@ enum {
#define IRDA_HEADER_01 0x5a
#define IRDA_HEADER_02 0xa5
#define IRDA_HEADER_01 0x5a
#define IRDA_HEADER_02 0xa5
#define IRDA_SD_PORT GPIOA