Skip to content

Commit

Permalink
Version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarins committed Nov 22, 2021
1 parent 2b28549 commit e97d112
Show file tree
Hide file tree
Showing 38 changed files with 1,105,366 additions and 9,248 deletions.
552,937 changes: 552,937 additions & 0 deletions STL/SolderPasteAxial.bak

Large diffs are not rendered by default.

551,198 changes: 551,198 additions & 0 deletions STL/SolderPasteAxial.gcode

Large diffs are not rendered by default.

Binary file added STL/SwitchRing.STL
Binary file not shown.
3 changes: 3 additions & 0 deletions Software/CubeMX/.cproject
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1530675267">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1530675267" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<macros>
<stringMacro name="current_date" type="VALUE_TEXT" value="20211121_1734"/>
</macros>
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
Expand Down
77 changes: 77 additions & 0 deletions Software/CubeMX/Application/ButtonBeep.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* ButtonBeep.c
*
* Created on: Nov 25, 2019
* Author: Standa
* reprogrammed Nov 22, 2021
* Author Jarin
*/

#include <ButtonBeep.h>
#include "stm32f1xx_it.h"
#include <stdint.h>
#include "measurement.h"
#include "tim.h"
#include "main.h"
#include "utility.h"

static BtnState BtnPUSH = {false,But_None,BPUSH_GPIO_Port, BPUSH_Pin};
static BtnState BtnPULL = {false,But_None,BPULL_GPIO_Port, BPULL_Pin};
static BtnState BtnCFG = {false,But_None,BCFG_GPIO_Port, BCFG_Pin};
BtnState* ButList[] = {&BtnPUSH, &BtnPULL, &BtnCFG};

static uint8_t BuzzerActive = 0;

/*
* Beeps the buzzer with specified tone (0 = off, 1=low, 2=medium, 3=high) for specified time in ms
* tone 0 with time is just delay
*/
void bbb_Beep(uint8_t tone, uint8_t time){
volatile uint32_t Stop = HAL_GetTick() + time;

BuzzerActive = 1;
if(tone > 4) tone = 4;

if(tone > 0){
//Start timer
__HAL_TIM_SET_AUTORELOAD(&htim1, 1200 - tone * 200);
__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_3,(1200 - tone * 200)>>1);
HAL_TIMEx_PWMN_Start (&htim1, TIM_CHANNEL_3);
}

while(1) if(HAL_GetTick() > Stop) break;

if(tone > 0){
//Stop timer
HAL_TIMEx_PWMN_Stop (&htim1, TIM_CHANNEL_3);
}


BuzzerActive = 0;
}


void bbb_Melody2(uint8_t tone1, uint8_t tone2, uint16_t time){
bbb_Beep(tone1, time);
bbb_Beep(0, time);
bbb_Beep(tone2, time);
bbb_Beep(0, time);
}
void bbb_Melody3(uint8_t tone1, uint8_t tone2, uint8_t tone3, uint16_t time){
bbb_Beep(tone1, time);
bbb_Beep(0, time);
bbb_Beep(tone2, time);
bbb_Beep(0, time);
bbb_Beep(tone3, time);
bbb_Beep(0, time);
}
void bbb_Melody4(uint8_t tone1, uint8_t tone2, uint8_t tone3, uint8_t tone4, uint16_t time){
bbb_Beep(tone1, time);
bbb_Beep(0, time);
bbb_Beep(tone2, time);
bbb_Beep(0, time);
bbb_Beep(tone3, time);
bbb_Beep(0, time);
bbb_Beep(tone4, time);
bbb_Beep(0, time);
}
54 changes: 54 additions & 0 deletions Software/CubeMX/Application/ButtonBeep.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* ButtonBeep.c
*
* Created on: Nov 25, 2019
* Author: Standa
* reprogrammed Nov 22, 2021
* Author Jarin
*/

#ifndef BUTTONBEEP_H_
#define BUTTONBEEP_H_

#include <stdint.h>
#include <stdbool.h>
#include "stm32f1xx_hal.h"


enum Buttons {
PUSH = 0,
PULL,
CFG,
CountButtons // is not in the set of active elements, only for element count in ENUM
};

typedef enum{
But_None = 0,
But_Pressed,
But_Released,
//EvtTd_LongReleased,
}BtnEvtTd;

typedef struct{
bool IntStart;
uint8_t LastState;
GPIO_TypeDef* Port;
uint16_t Pin;
}BtnState;

typedef enum{
bbb_ToneTd_None = 0,
bbb_ToneTd_Low = 1,
bbb_ToneTd_Med = 2,
bbb_ToneTd_High = 3,
bbb_ToneTd_VeryHigh = 4
}bbb_ToneTd;

extern BtnState* ButList[CountButtons];

extern void bbb_Beep(uint8_t tone, uint8_t time);
extern void bbb_Melody2(uint8_t tone1, uint8_t tone2, uint16_t time);
extern void bbb_Melody3(uint8_t tone1, uint8_t tone2, uint8_t tone3, uint16_t time);
extern void bbb_Melody4(uint8_t tone1, uint8_t tone2, uint8_t tone3, uint8_t tone4, uint16_t time);

#endif /* BUTTONBEEP_H_ */
6 changes: 3 additions & 3 deletions Software/CubeMX/Application/EEPROM.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ uint16_t EE_Erases(uint16_t *Erases)
//Returns the last stored variable data, if found,
uint16_t EE_ReadAddr (uint16_t Address)
{
uint16_t data;
int16_t data;
EE_Read(Address, &data);
return data;
}

//Returns the last stored variable data, if found, which correspond to the passed virtual address
uint16_t EE_Read(uint16_t Address, uint16_t *Data)
uint16_t EE_Read(uint16_t Address, int16_t *Data)
{
uint32_t pageBase, pageEnd;

Expand Down Expand Up @@ -312,7 +312,7 @@ uint16_t EE_Read(uint16_t Address, uint16_t *Data)
}

//Writes/updates variable data in EEPROM.
uint16_t EE_Write(uint16_t Address, uint16_t Data)
uint16_t EE_Write(uint16_t Address, int16_t Data)
{
if (Status == EEPROM_NOT_INIT)
if (EE_Init() != EEPROM_OK)
Expand Down
4 changes: 2 additions & 2 deletions Software/CubeMX/Application/EEPROM.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ uint16_t EE_Init(void);
uint16_t EE_Format(void);
uint16_t EE_Erases(uint16_t *);
uint16_t EE_ReadAddr (uint16_t address);
uint16_t EE_Read(uint16_t address, uint16_t *data);
uint16_t EE_Write(uint16_t address, uint16_t data);
uint16_t EE_Read(uint16_t address, int16_t *data);
uint16_t EE_Write(uint16_t address, int16_t data);
uint16_t EE_Count(uint16_t *);
uint16_t EE_Maxcount(void);
uint16_t EE_CheckPage(uint32_t, uint16_t);
Expand Down
Loading

0 comments on commit e97d112

Please sign in to comment.