Skip to content

Commit

Permalink
Fixed single leds operation and raw buttons output
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury Vostrenkov committed May 30, 2020
1 parent a06c2d9 commit 9bfc782
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Inc/common_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

//#define DEBUG

#define FIRMWARE_VERSION 0x1516 // v1.5.1b6
#define FIRMWARE_VERSION 0x1517 // v1.5.1b7
#define USED_PINS_NUM 30 // constant for BluePill and BlackPill boards
#define MAX_AXIS_NUM 8 // max 8
#define MAX_BUTTONS_NUM 128 // power of 2, max 128
Expand Down
2 changes: 1 addition & 1 deletion Inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

static const dev_config_t init_config =
{
.firmware_version = 0x1516, // do not change
.firmware_version = 0x1517, // do not change

/*
Name of device in devices dispatcher
Expand Down
Binary file modified MDK-ARM/FreeJoy.bin
Binary file not shown.
46 changes: 45 additions & 1 deletion MDK-ARM/FreeJoy.uvoptx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,24 @@
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM))</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<Breakpoint>
<Bp>
<Number>0</Number>
<Type>0</Type>
<LineNumber>80</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134246376</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>../Src/main.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\FreeJoy\../Src/main.c\80</Expression>
</Bp>
</Breakpoint>
<WatchWindow1>
<Ww>
<count>0</count>
Expand Down Expand Up @@ -205,6 +222,11 @@
<WinNumber>1</WinNumber>
<ItemText>shift_registers,0x0A</ItemText>
</Ww>
<Ww>
<count>11</count>
<WinNumber>1</WinNumber>
<ItemText>leds_state</ItemText>
</Ww>
</WatchWindow1>
<Tracepoint>
<THDelay>0</THDelay>
Expand Down Expand Up @@ -248,6 +270,12 @@
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
<SystemViewers>
<Entry>
<Name>System Viewer\GPIOB</Name>
<WinId>35905</WinId>
</Entry>
</SystemViewers>
<DebugDescription>
<Enable>1</Enable>
<EnableFlashSeq>1</EnableFlashSeq>
Expand Down Expand Up @@ -594,6 +622,22 @@
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>13</Number>
<Type>0</Type>
<LineNumber>80</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>../Src/main.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
</Breakpoint>
<MemoryWindow1>
<Mm>
Expand Down
9 changes: 8 additions & 1 deletion Src/leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ void LED_SetSingle(uint8_t * state_buf, dev_config_t * p_dev_config, uint8_t * p
{
if (p_dev_config->pins[i] == LED_SINGLE)
{
leds_state[(*pos)] ? (pin_config[i].port->ODR |= pin_config[i].pin) : (pin_config[i].port->ODR &= !pin_config[i].pin);
if (leds_state[*pos])
{
pin_config[i].port->ODR |= pin_config[i].pin;
}
else
{
pin_config[i].port->ODR &= ~pin_config[i].pin;
}
(*pos)++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Src/stm32f10x_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void SysTick_Handler(void)

void TIM1_UP_IRQHandler(void)
{
uint8_t btn_num = 0;
static uint8_t btn_num = 0;
uint8_t physical_buttons_data[MAX_BUTTONS_NUM];
joy_report_t joy_report;

Expand Down

0 comments on commit 9bfc782

Please sign in to comment.