- First complete version of firmware. Currently being tested in the rehearsal room
- Added bunch of screens, fonts and images - Added script to read out frame buffer (function currently disabled in Firmware)
This commit is contained in:
@@ -32,6 +32,9 @@
|
||||
#define DEBOUNCE_TIME_ENCODER_MS 50
|
||||
#define DEBOUNCE_TIME_SWITCH_MS 300
|
||||
|
||||
// Separate Switch Define
|
||||
#define SWITCH_GPIO 23
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
@@ -40,7 +43,10 @@ static volatile uint32_t _Debounce_Time_Switch_ms = 0;
|
||||
|
||||
static volatile bool _Rotation_CW_Occurred;
|
||||
static volatile bool _Rotation_CCW_Occurred;
|
||||
static volatile bool _Switch_Press_Occurred;
|
||||
static volatile bool _Rotary_Encoder_Switch_Press_Occurred;
|
||||
|
||||
extern volatile uint32_t _Debounce_Time_Switch_ms;
|
||||
extern volatile bool _Switch_Press_Occurred; // Other switch - not from the Rotary Encoder
|
||||
|
||||
static volatile uint8_t _Rotary_Encoder_Previous_NextCode = 0;
|
||||
static volatile uint16_t _Rotary_Encoder_Store_State = 0;
|
||||
@@ -74,6 +80,19 @@ void ISR_Rotary_Encoder(uint gpio, uint32_t events)
|
||||
}
|
||||
}
|
||||
else if(gpio == ENCODER_SWITCH_GPIO)
|
||||
{
|
||||
uint32_t Current_Time_ms = to_ms_since_boot(get_absolute_time());
|
||||
|
||||
if(Current_Time_ms < _Debounce_Time_Switch_ms)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_Rotary_Encoder_Switch_Press_Occurred = true;
|
||||
|
||||
_Debounce_Time_Switch_ms = Current_Time_ms + DEBOUNCE_TIME_SWITCH_MS;
|
||||
}
|
||||
else if(gpio == SWITCH_GPIO)
|
||||
{
|
||||
uint32_t Current_Time_ms = to_ms_since_boot(get_absolute_time());
|
||||
|
||||
@@ -94,9 +113,9 @@ void ISR_Rotary_Encoder(uint gpio, uint32_t events)
|
||||
*******************************************************************/
|
||||
void Rotary_Encoder_Init(void)
|
||||
{
|
||||
_Rotation_CW_Occurred = false;
|
||||
_Rotation_CCW_Occurred = false;
|
||||
_Switch_Press_Occurred = false;
|
||||
_Rotation_CW_Occurred = false;
|
||||
_Rotation_CCW_Occurred = false;
|
||||
_Rotary_Encoder_Switch_Press_Occurred = false;
|
||||
|
||||
|
||||
gpio_init(ENCODER_PIN_A_GPIO); gpio_set_dir(ENCODER_PIN_A_GPIO, false);
|
||||
@@ -128,9 +147,9 @@ bool Rotary_Encoder_Rotation_CCW_Occurred(void)
|
||||
|
||||
bool Rotary_Encoder_Switch_Press_Occurred(void)
|
||||
{
|
||||
bool Return_Value = _Switch_Press_Occurred;
|
||||
bool Return_Value = _Rotary_Encoder_Switch_Press_Occurred;
|
||||
|
||||
_Switch_Press_Occurred = false;
|
||||
_Rotary_Encoder_Switch_Press_Occurred = false;
|
||||
|
||||
return Return_Value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user