- 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:
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "hardware/gpio.h"
|
||||
|
||||
#include "USB_Serial.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
@@ -26,11 +28,10 @@
|
||||
#define LEDG_OFF gpio_put(LEDG_PIN, 1)
|
||||
|
||||
|
||||
|
||||
#define LED_PWR_EN_GPIO 0
|
||||
#define INA260_ALERT_GPIO 13
|
||||
|
||||
#define ENABLE_LED_POWER() gpio_put(LED_PWR_EN_GPIO, 1); LEDG_ON; _Power_Was_Enabled_Before = true
|
||||
#define ENABLE_LED_POWER() gpio_put(LED_PWR_EN_GPIO, 1); LEDG_ON; _Power_Was_Enabled_Before = true
|
||||
#define DISABLE_LED_POWER() gpio_put(LED_PWR_EN_GPIO, 0); LEDG_OFF
|
||||
|
||||
|
||||
@@ -54,13 +55,17 @@ void Core1_LED_Enable_Set_Error(LED_Power_Error error);
|
||||
*******************************************************************/
|
||||
void Core1_LED_Enable_Init()
|
||||
{
|
||||
gpio_init(LED_PWR_EN_GPIO);
|
||||
gpio_set_dir(LED_PWR_EN_GPIO, GPIO_OUT);
|
||||
DISABLE_LED_POWER();
|
||||
|
||||
gpio_init(INA260_ALERT_GPIO);
|
||||
gpio_set_dir(INA260_ALERT_GPIO, GPIO_IN);
|
||||
|
||||
_LED_Power_Error = UNDEFINED;
|
||||
_Power_Was_Enabled_Before = false;
|
||||
_INA260_Alert_Last_State = gpio_get(INA260_ALERT_GPIO);
|
||||
|
||||
Core1_LED_Enable_Update_Alert_Status();
|
||||
}
|
||||
|
||||
@@ -92,11 +97,16 @@ void Core1_LED_Enable_Update_INA260_BusVoltage(uint16_t voltage_mV)
|
||||
_INA260_BusVoltage_mV = voltage_mV;
|
||||
}
|
||||
|
||||
bool Core1_LED_Enable_Get_Status()
|
||||
bool Core1_LED_Enable_Get_Enable_Pin()
|
||||
{
|
||||
return gpio_get(LED_PWR_EN_GPIO);
|
||||
}
|
||||
|
||||
bool Core1_LED_Enable_Get_Alert_Pin()
|
||||
{
|
||||
return gpio_get(INA260_ALERT_GPIO);
|
||||
}
|
||||
|
||||
LED_Power_Error Core1_LED_Enable_Get_Error()
|
||||
{
|
||||
return _LED_Power_Error;
|
||||
@@ -108,11 +118,14 @@ LED_Power_Error Core1_LED_Enable_Get_Error()
|
||||
*******************************************************************/
|
||||
void Core1_LED_Enable_Update_Alert_Status()
|
||||
{
|
||||
if(_INA260_Alert_Last_State == true && gpio_get(LED_PWR_EN_GPIO) == false) {
|
||||
// Falling edge detection if Alert pin -> Falling edge means Overcurrent detection triggered
|
||||
bool Current_Alert_State = gpio_get(INA260_ALERT_GPIO);
|
||||
if(_INA260_Alert_Last_State == true && Current_Alert_State == false) {
|
||||
Core1_LED_Enable_Set_Error(OVERCURRENT);
|
||||
USB_SERIAL_SEND_STRING("OVERCURRENT"); USB_SERIAL_SEND_TERMINATOR();
|
||||
}
|
||||
|
||||
_INA260_Alert_Last_State = gpio_get(LED_PWR_EN_GPIO);
|
||||
_INA260_Alert_Last_State = Current_Alert_State;
|
||||
}
|
||||
|
||||
void Core1_LED_Enable_Set_Error(LED_Power_Error error)
|
||||
|
||||
Reference in New Issue
Block a user