Skip to content

Commit 9bfc782

Browse files
committed
Fixed single leds operation and raw buttons output
1 parent a06c2d9 commit 9bfc782

File tree

6 files changed

+56
-5
lines changed

6 files changed

+56
-5
lines changed

Inc/common_defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
//#define DEBUG
1313

14-
#define FIRMWARE_VERSION 0x1516 // v1.5.1b6
14+
#define FIRMWARE_VERSION 0x1517 // v1.5.1b7
1515
#define USED_PINS_NUM 30 // constant for BluePill and BlackPill boards
1616
#define MAX_AXIS_NUM 8 // max 8
1717
#define MAX_BUTTONS_NUM 128 // power of 2, max 128

Inc/main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
static const dev_config_t init_config =
2020
{
21-
.firmware_version = 0x1516, // do not change
21+
.firmware_version = 0x1517, // do not change
2222

2323
/*
2424
Name of device in devices dispatcher

MDK-ARM/FreeJoy.bin

16 Bytes
Binary file not shown.

MDK-ARM/FreeJoy.uvoptx

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,24 @@
148148
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM))</Name>
149149
</SetRegEntry>
150150
</TargetDriverDllRegistry>
151-
<Breakpoint/>
151+
<Breakpoint>
152+
<Bp>
153+
<Number>0</Number>
154+
<Type>0</Type>
155+
<LineNumber>80</LineNumber>
156+
<EnabledFlag>1</EnabledFlag>
157+
<Address>134246376</Address>
158+
<ByteObject>0</ByteObject>
159+
<HtxType>0</HtxType>
160+
<ManyObjects>0</ManyObjects>
161+
<SizeOfObject>0</SizeOfObject>
162+
<BreakByAccess>0</BreakByAccess>
163+
<BreakIfRCount>1</BreakIfRCount>
164+
<Filename>../Src/main.c</Filename>
165+
<ExecCommand></ExecCommand>
166+
<Expression>\\FreeJoy\../Src/main.c\80</Expression>
167+
</Bp>
168+
</Breakpoint>
152169
<WatchWindow1>
153170
<Ww>
154171
<count>0</count>
@@ -205,6 +222,11 @@
205222
<WinNumber>1</WinNumber>
206223
<ItemText>shift_registers,0x0A</ItemText>
207224
</Ww>
225+
<Ww>
226+
<count>11</count>
227+
<WinNumber>1</WinNumber>
228+
<ItemText>leds_state</ItemText>
229+
</Ww>
208230
</WatchWindow1>
209231
<Tracepoint>
210232
<THDelay>0</THDelay>
@@ -248,6 +270,12 @@
248270
<pszMrulep></pszMrulep>
249271
<pSingCmdsp></pSingCmdsp>
250272
<pMultCmdsp></pMultCmdsp>
273+
<SystemViewers>
274+
<Entry>
275+
<Name>System Viewer\GPIOB</Name>
276+
<WinId>35905</WinId>
277+
</Entry>
278+
</SystemViewers>
251279
<DebugDescription>
252280
<Enable>1</Enable>
253281
<EnableFlashSeq>1</EnableFlashSeq>
@@ -594,6 +622,22 @@
594622
<ExecCommand></ExecCommand>
595623
<Expression></Expression>
596624
</Bp>
625+
<Bp>
626+
<Number>13</Number>
627+
<Type>0</Type>
628+
<LineNumber>80</LineNumber>
629+
<EnabledFlag>1</EnabledFlag>
630+
<Address>0</Address>
631+
<ByteObject>0</ByteObject>
632+
<HtxType>0</HtxType>
633+
<ManyObjects>0</ManyObjects>
634+
<SizeOfObject>0</SizeOfObject>
635+
<BreakByAccess>0</BreakByAccess>
636+
<BreakIfRCount>0</BreakIfRCount>
637+
<Filename>../Src/main.c</Filename>
638+
<ExecCommand></ExecCommand>
639+
<Expression></Expression>
640+
</Bp>
597641
</Breakpoint>
598642
<MemoryWindow1>
599643
<Mm>

Src/leds.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ void LED_SetSingle(uint8_t * state_buf, dev_config_t * p_dev_config, uint8_t * p
5454
{
5555
if (p_dev_config->pins[i] == LED_SINGLE)
5656
{
57-
leds_state[(*pos)] ? (pin_config[i].port->ODR |= pin_config[i].pin) : (pin_config[i].port->ODR &= !pin_config[i].pin);
57+
if (leds_state[*pos])
58+
{
59+
pin_config[i].port->ODR |= pin_config[i].pin;
60+
}
61+
else
62+
{
63+
pin_config[i].port->ODR &= ~pin_config[i].pin;
64+
}
5865
(*pos)++;
5966
}
6067
}

Src/stm32f10x_it.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ void SysTick_Handler(void)
173173

174174
void TIM1_UP_IRQHandler(void)
175175
{
176-
uint8_t btn_num = 0;
176+
static uint8_t btn_num = 0;
177177
uint8_t physical_buttons_data[MAX_BUTTONS_NUM];
178178
joy_report_t joy_report;
179179

0 commit comments

Comments
 (0)