Skip to content

Commit

Permalink
Merge branch 'dev'. Version 1.3.4
Browse files Browse the repository at this point in the history
# Conflicts:
#	Inc/common_defines.h
#	Inc/main.h
#	MDK-ARM/FreeJoy.bin
#	MDK-ARM/FreeJoy.uvoptx
#	Src/analog.c
#	Src/buttons.c
#	Src/stm32f10x_it.c
  • Loading branch information
Yury Vostrenkov committed Feb 23, 2020
2 parents 30b9be1 + 16896e5 commit fe891d5
Show file tree
Hide file tree
Showing 35 changed files with 928 additions and 464 deletions.
13 changes: 7 additions & 6 deletions Inc/analog.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
#include "common_types.h"
#include "periphery.h"

#define FILTER_LOW_SIZE 5
#define FILTER_MED_SIZE 10
#define FILTER_HIGH_SIZE 20
#define FILTER_LOW_SIZE 5
#define FILTER_MED_SIZE 10
#define FILTER_HIGH_SIZE 20
#define FILTER_VERY_HIGH_SIZE 20

extern tle_t sensors[MAX_AXIS_NUM];

Expand All @@ -28,9 +29,9 @@ typedef struct



void AxesInit (app_config_t * p_config);
void AxesProcess (app_config_t * p_config);
void AxisResetCalibration (app_config_t * p_config, uint8_t axis_num);
void AxesInit (dev_config_t * p_dev_config);
void AxesProcess (dev_config_t * p_dev_config);
void AxisResetCalibration (dev_config_t * p_dev_config, uint8_t axis_num);
void AnalogGet (analog_data_t * out_data, analog_data_t * scaled_data, analog_data_t * raw_data);

#endif /* __ANALOG_H__ */
Expand Down
2 changes: 1 addition & 1 deletion Inc/axis_to_buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "analog.h"


void AxesToButtonsGet (uint8_t * raw_button_data_buf, app_config_t * p_config, uint8_t * pos);
void AxesToButtonsGet (uint8_t * raw_button_data_buf, dev_config_t * p_dev_config, uint8_t * pos);

#endif /* __AXIS_TO_BUTTONS_H__ */

10 changes: 5 additions & 5 deletions Inc/buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ extern buttons_state_t buttons_state[MAX_BUTTONS_NUM];
typedef uint8_t button_data_t;
typedef uint8_t pov_data_t;

void LogicalButtonProcessState (buttons_state_t * p_button_state, uint8_t * pov_buf, app_config_t * p_config, uint8_t pos);
void RadioButtons_Init (app_config_t * p_config);
uint8_t ButtonsReadPhysical(app_config_t * p_config, uint8_t * p_buf);
void ButtonsReadLogical (app_config_t * p_config);
void ButtonsGet (uint8_t * raw_data, button_data_t * data);
void LogicalButtonProcessState (buttons_state_t * p_button_state, uint8_t * pov_buf, dev_config_t * p_dev_config, uint8_t pos);
void RadioButtons_Init (dev_config_t * p_dev_config);
uint8_t ButtonsReadPhysical(dev_config_t * p_dev_config, uint8_t * p_buf);
void ButtonsReadLogical (dev_config_t * p_dev_config);
void ButtonsGet (uint8_t * raw_data, button_data_t * data, uint8_t * shift_data);
void POVsGet (pov_data_t * data);


Expand Down
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 0x1335 // v1.3.3b5
#define FIRMWARE_VERSION 0x1341 // v1.3.4b1
#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
26 changes: 19 additions & 7 deletions Inc/common_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum
FILTER_LOW,
FILTER_MEDIUM,
FILTER_HIGH,

FILTER_VERY_HIGH,
};
typedef uint8_t filter_t;

Expand Down Expand Up @@ -228,18 +228,30 @@ typedef struct
// config 12
shift_reg_config_t shift_registers[4];
shift_modificator_t shift_config[5];
uint8_t reserved_10[31];
}app_config_t;
uint16_t vid;
uint16_t pid;
uint8_t is_dynamic_config;
uint8_t reserved_10[26];
}dev_config_t;

typedef struct
{
uint8_t axes;
uint8_t buttons_cnt;
uint8_t povs;

} app_config_t;

typedef struct
{
uint8_t dummy;
uint8_t dummy; // alighning
uint8_t id;
uint8_t button_data[MAX_BUTTONS_NUM/8];
int16_t axis_data[MAX_AXIS_NUM];
uint8_t pov_data[MAX_POVS_NUM];
int16_t raw_axis_data[MAX_AXIS_NUM];
uint8_t raw_button_data[9];
uint8_t shift_button_data;
int16_t axis_data[MAX_AXIS_NUM];
uint8_t pov_data[MAX_POVS_NUM];
uint8_t button_data[MAX_BUTTONS_NUM/8];

} joy_report_t;

Expand Down
20 changes: 20 additions & 0 deletions Inc/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
******************************************************************************
* @file : config.h
* @brief : Header for config.c file.
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CONFIG_H__
#define __CONFIG_H__


#include "periphery.h"
#include "common_types.h"

void DevConfigSet (dev_config_t * p_dev_config);
void DevConfigGet (dev_config_t * p_dev_config);
void AppConfigInit (dev_config_t * p_dev_config);
void AppConfigGet (app_config_t * p_app_config);

#endif /* __CONFIG_H__ */
4 changes: 2 additions & 2 deletions Inc/encoders.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define ENC_COUNT 1


void EncoderProcess (buttons_state_t * button_state_buf, app_config_t * p_config);
void EncodersInit (app_config_t * p_config);
void EncoderProcess (buttons_state_t * button_state_buf, dev_config_t * p_dev_config);
void EncodersInit (dev_config_t * p_dev_config);

#endif /* __BUTTONS_H__ */

19 changes: 0 additions & 19 deletions Inc/flash.h

This file was deleted.

8 changes: 6 additions & 2 deletions Inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include "common_types.h"


static const app_config_t init_config =
static const dev_config_t init_config =
{
.firmware_version = 0x1335, // do not change
.firmware_version = 0x1341, // do not change

/*
Name of device in devices dispatcher
Expand Down Expand Up @@ -664,6 +664,10 @@ static const app_config_t init_config =
.shift_config[2].button = -1,
.shift_config[3].button = -1,
.shift_config[4].button = -1,

.vid = 0x0483,
.pid = 0x5750,
.is_dynamic_config = 0,

};

Expand Down
2 changes: 1 addition & 1 deletion Inc/periphery.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ uint64_t GetTick(void);
void Delay_ms(__IO uint32_t nTime);
void Delay_us(__IO uint32_t nTime);

void IO_Init (app_config_t * p_config);
void IO_Init (dev_config_t * p_dev_config);



Expand Down
4 changes: 2 additions & 2 deletions Inc/shift_registers.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#define SHIFTREG_TICK_DELAY 10

void ShiftRegistersInit(app_config_t * p_config);
void ShiftRegistersGet (uint8_t * raw_button_data_buf, app_config_t * p_config, uint8_t * pos);
void ShiftRegistersInit(dev_config_t * p_dev_config);
void ShiftRegistersGet (uint8_t * raw_button_data_buf, dev_config_t * p_dev_config, uint8_t * pos);

#endif /* __SHIFT_REGISTERS_H__ */

12 changes: 6 additions & 6 deletions Inc/usb_desc.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

#define CUSTOMHID_SIZ_DEVICE_DESC 18
#define CUSTOMHID_SIZ_CONFIG_DESC 41
#define CUSTOMHID_SIZ_REPORT_DESC 175
#define CUSTOMHID_SIZ_REPORT_DESC 178
#define CUSTOMHID_SIZ_STRING_LANGID 4
#define CUSTOMHID_SIZ_STRING_VENDOR 38
#define CUSTOMHID_SIZ_STRING_PRODUCT 32
Expand All @@ -66,11 +66,11 @@
#define STANDARD_ENDPOINT_DESC_SIZE 0x09

/* Exported functions ------------------------------------------------------- */
extern const uint8_t CustomHID_DeviceDescriptor[CUSTOMHID_SIZ_DEVICE_DESC];
extern const uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC];
extern const uint8_t CustomHID_ReportDescriptor[CUSTOMHID_SIZ_REPORT_DESC];
extern const uint8_t CustomHID_StringLangID[CUSTOMHID_SIZ_STRING_LANGID];
extern const uint8_t CustomHID_StringVendor[CUSTOMHID_SIZ_STRING_VENDOR];
extern uint8_t CustomHID_DeviceDescriptor[CUSTOMHID_SIZ_DEVICE_DESC];
extern uint8_t CustomHID_ConfigDescriptor[CUSTOMHID_SIZ_CONFIG_DESC];
extern uint8_t CustomHID_ReportDescriptor[CUSTOMHID_SIZ_REPORT_DESC];
extern uint8_t CustomHID_StringLangID[CUSTOMHID_SIZ_STRING_LANGID];
extern uint8_t CustomHID_StringVendor[CUSTOMHID_SIZ_STRING_VENDOR];
extern uint8_t CustomHID_StringProduct[CUSTOMHID_SIZ_STRING_PRODUCT];
extern uint8_t CustomHID_StringSerial[CUSTOMHID_SIZ_STRING_SERIAL];

Expand Down
5 changes: 4 additions & 1 deletion Inc/usb_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "common_types.h"
#include "usb_type.h"

/* Exported types ------------------------------------------------------------*/
Expand All @@ -51,7 +52,9 @@
/* Exported functions ------------------------------------------------------- */
void Get_SerialNum(void);
void Get_ProductStr(void);
void USB_HW_Init(void);
void Get_VidPid(void);
void Get_ReportDesc(void);
void USB_HW_Init(dev_config_t * p_dev_config);

#endif /*__USB_HW_H*/

Expand Down
Binary file modified MDK-ARM/FreeJoy.bin
Binary file not shown.
Loading

0 comments on commit fe891d5

Please sign in to comment.