Few clean-up
This commit is contained in:
@@ -132,7 +132,7 @@ extern "C" {
|
||||
#define KBD_BCKL_STEPS 4
|
||||
|
||||
|
||||
// Structure definition ---------------------------------------------------------------
|
||||
// Structure declaration ---------------------------------------------------------------
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
RTC_TimeTypeDef _s;
|
||||
@@ -144,7 +144,7 @@ typedef union {
|
||||
} RTC_DateTypeDef_u;
|
||||
|
||||
|
||||
// Global variables definition --------------------------------------------------------
|
||||
// Global variables declaration --------------------------------------------------------
|
||||
extern volatile uint32_t systicks_counter;
|
||||
extern volatile uint8_t pmu_irq;
|
||||
|
||||
@@ -153,7 +153,7 @@ extern volatile RTC_TimeTypeDef_u rtc_time, rtc_alarm_time;
|
||||
extern volatile RTC_DateTypeDef_u rtc_date, rtc_alarm_date;
|
||||
|
||||
|
||||
// Global functions definition --------------------------------------------------------
|
||||
// Global functions declaration --------------------------------------------------------
|
||||
void SystemClock_Config(void);
|
||||
HAL_StatusTypeDef HAL_Interface_init(void);
|
||||
void HAL_Interface_I2C1_reset(void);
|
||||
@@ -162,6 +162,15 @@ __STATIC_INLINE uint32_t uptime_ms(void) { return systicks_counter; }
|
||||
uint32_t led_blink_configure(const uint8_t blink_nbr, const uint8_t restore_status);
|
||||
void led_blink_refresh(void);
|
||||
|
||||
__STATIC_INLINE void sys_stop_pico(void) {
|
||||
LL_GPIO_ResetOutputPin(SP_AMP_EN_GPIO_Port, SP_AMP_EN_Pin); // Disable speaker Amp. power
|
||||
LL_GPIO_ResetOutputPin(PICO_EN_GPIO_Port, PICO_EN_Pin); // Disable PICO power
|
||||
}
|
||||
__STATIC_INLINE void sys_start_pico(void) {
|
||||
LL_GPIO_SetOutputPin(PICO_EN_GPIO_Port, PICO_EN_Pin); // Enable PICO power
|
||||
LL_GPIO_SetOutputPin(SP_AMP_EN_GPIO_Port, SP_AMP_EN_Pin); // Enable speaker Amp. power
|
||||
}
|
||||
|
||||
void Error_Handler(void);
|
||||
|
||||
#ifdef USE_FULL_ASSERT
|
||||
|
||||
+47
-47
@@ -5,65 +5,65 @@
|
||||
#define REGS_H_
|
||||
|
||||
enum reg_id {
|
||||
REG_ID_TYP = 0x00, //!< firmware type (0=official, others=custom)
|
||||
REG_ID_VER = 0x01, //!< fw version (7:4=Major, 3:0=Minor)
|
||||
REG_ID_TYP = 0x00, //!< firmware type (0=official, others=custom)
|
||||
REG_ID_VER = 0x01, //!< fw version (7:4=Major, 3:0=Minor)
|
||||
|
||||
REG_ID_SYS_CFG = 0x02, // config
|
||||
REG_ID_INT = 0x03, // interrupt status
|
||||
REG_ID_KEY = 0x04, // key status
|
||||
REG_ID_BKL = 0x05, // backlight steps (0-9)
|
||||
REG_ID_DEB = 0x06, // debounce cfg
|
||||
REG_ID_FRQ = 0x07, // poll freq cfg
|
||||
REG_ID_RST = 0x08, // Reset control (0: nop, 1: pico reset, 2: full reset)
|
||||
REG_ID_FIF = 0x09, // fifo
|
||||
REG_ID_BK2 = 0x0A, // keyboard backlight (0-9)
|
||||
REG_ID_BAT = 0x0B, // battery
|
||||
REG_ID_C64_MTX = 0x0C,// read c64 matrix
|
||||
REG_ID_C64_JS = 0x0D, // joystick io bits
|
||||
REG_ID_OFF = 0x0E, // PWR off control b7-6(0: nop, 1: sleep, 2: full-shutdown) b5-0(seconds before sleep/shutdown)
|
||||
REG_ID_SYS_CFG = 0x02, // config
|
||||
REG_ID_INT = 0x03, // interrupt status
|
||||
REG_ID_KEY = 0x04, // key status
|
||||
REG_ID_BKL = 0x05, // backlight steps (0-9)
|
||||
REG_ID_DEB = 0x06, // debounce cfg
|
||||
REG_ID_FRQ = 0x07, // poll freq cfg
|
||||
REG_ID_RST = 0x08, // Reset control b7-6(0: nop, 1: pico reset, 2: full reset)
|
||||
REG_ID_FIF = 0x09, // fifo
|
||||
REG_ID_BK2 = 0x0A, // keyboard backlight (0-9)
|
||||
REG_ID_BAT = 0x0B, // battery
|
||||
REG_ID_C64_MTX = 0x0C, // read c64 matrix
|
||||
REG_ID_C64_JS = 0x0D, // joystick io bits
|
||||
REG_ID_OFF = 0x0E, // PWR off control b7-6(0: nop, 1: sleep, 2: full-shutdown) b5-0(seconds before sleep/shutdown)
|
||||
|
||||
REG_ID_INT_CFG = 0x12, // IRQ config
|
||||
REG_ID_RTC_CFG = 0x13, // RTC general config
|
||||
REG_ID_RTC_DATE = 0x14, // RTC date
|
||||
REG_ID_RTC_TIME = 0x15, // RTC time
|
||||
REG_ID_RTC_ALARM_DATE = 0x16, // RTC alarm date
|
||||
REG_ID_RTC_ALARM_TIME = 0x17, // RTC alarm time
|
||||
REG_ID_INT_CFG = 0x12, // IRQ config
|
||||
REG_ID_RTC_CFG = 0x13, // RTC general config
|
||||
REG_ID_RTC_DATE = 0x14, // RTC date
|
||||
REG_ID_RTC_TIME = 0x15, // RTC time
|
||||
REG_ID_RTC_ALARM_DATE = 0x16, // RTC alarm date
|
||||
REG_ID_RTC_ALARM_TIME = 0x17, // RTC alarm time
|
||||
|
||||
REG_ID_LAST
|
||||
};
|
||||
|
||||
#define CFG_OVERFLOW_ON (1 << 0) //When a FIFO overflow happens, should the new entry still be pushed, overwriting the oldest one. If 0 then new entry is lost.
|
||||
#define CFG_RST_DELAY (3 << 2) // 2 bit config of reset delay.
|
||||
#define CFG_RST_DELAY_200M (0 << 2)
|
||||
#define CFG_RST_DELAY_1S (1 << 2)
|
||||
#define CFG_RST_DELAY_3S (2 << 2)
|
||||
#define CFG_RST_DELAY_5S (3 << 2)
|
||||
#define CFG_REPORT_MODS (1 << 6) // Should Alt, Sym and Shifts be reported as well
|
||||
#define CFG_USE_MODS (1 << 7) // Should Alt, Sym and Shifts modify the keys reported
|
||||
#define CFG_OVERFLOW_ON (1 << 0) //When a FIFO overflow happens, should the new entry still be pushed, overwriting the oldest one. If 0 then new entry is lost.
|
||||
#define CFG_RST_DELAY (3 << 2) // 2 bit config of reset delay.
|
||||
#define CFG_RST_DELAY_200M (0 << 2)
|
||||
#define CFG_RST_DELAY_1S (1 << 2)
|
||||
#define CFG_RST_DELAY_3S (2 << 2)
|
||||
#define CFG_RST_DELAY_5S (3 << 2)
|
||||
#define CFG_EEPROM_SAVE_CFG (1 << 5) // Enable the EEPROM save function (to save flash lifespan)
|
||||
#define CFG_REPORT_MODS (1 << 6) // Should Alt, Sym and Shifts be reported as well
|
||||
#define CFG_USE_MODS (1 << 7) // Should Alt, Sym and Shifts modify the keys reported
|
||||
// CFG_STICKY_MODS // Pressing and releasing a mod affects next key pressed
|
||||
|
||||
#define INT_OVERFLOW (1 << 0)
|
||||
#define INT_CAPSLOCK (1 << 1)
|
||||
#define INT_NUMLOCK (1 << 2)
|
||||
#define INT_KEY (1 << 3)
|
||||
#define INT_RTC (1 << 4)
|
||||
#define INT_PWR_BTN (1 << 5)
|
||||
#define INT_OVERFLOW (1 << 0)
|
||||
#define INT_CAPSLOCK (1 << 1)
|
||||
#define INT_NUMLOCK (1 << 2)
|
||||
#define INT_KEY (1 << 3)
|
||||
#define INT_RTC (1 << 4)
|
||||
#define INT_PWR_BTN (1 << 5)
|
||||
|
||||
#define RST_CTRL_PICO_RST (1 << 6) //!< Request a pico power reset
|
||||
#define RST_CTRL_FULL_RST (1 << 7) //!< Request a full power reset (pico + stm32)
|
||||
#define RST_CTRL_PICO_RST (1 << 6) //!< Request a pico power reset
|
||||
#define RST_CTRL_FULL_RST (1 << 7) //!< Request a full power reset (pico + stm32)
|
||||
|
||||
#define OFF_CTRL_SLEEP (1 << 6) //!< Request a standard power off (stop pico, stm32 in sleep state)
|
||||
#define OFF_CTRL_SHUTDOWN (1 << 7) //!< Request a full shutdown of the picocalc (PMIC shutdown)
|
||||
#define OFF_CTRL_SLEEP (1 << 6) //!< Request a standard power off (stop pico, stm32 in sleep state)
|
||||
#define OFF_CTRL_SHUTDOWN (1 << 7) //!< Request a full shutdown of the picocalc (PMIC shutdown)
|
||||
|
||||
#define KEY_CAPSLOCK (1 << 5)
|
||||
#define KEY_NUMLOCK (1 << 6)
|
||||
#define KEY_COUNT_MASK 0x1F //0x1F == 31
|
||||
#define KEY_CAPSLOCK (1 << 5)
|
||||
#define KEY_NUMLOCK (1 << 6)
|
||||
#define KEY_COUNT_MASK 0x1F //0x1F == 31
|
||||
|
||||
#define RTC_CFG_RUN_ALARM (1 << 0) // b0: Set the RTC alarm active.
|
||||
#define RTC_CFG_REARM (1 << 1) // b1: If set, the RTC alarm will rearm for the next day trigger (if RTC_CFG_DATE_ALARM is set, repeat every day after the target date is reached)
|
||||
#define RTC_CFG_DATE_ALARM (1 << 2) // b2: If set, check when alarm trig for the precise date, otherwise return to normal behavior (or sleep if wake-up)
|
||||
#define RTC_CFG_PBTN_ALARM_IGNORE (1 << 3) // b3: If unset, override the power button shutdown behavior to keep the STM32 "alive" for the RTC to operate.
|
||||
//#define RTC_CFG_SLEEP_MODE (1 << 4) // 0 = normal sleep (pico is shutdown, STM32 enter in low power state ~1.2mA); 1 = deep sleep (pico is shutdown, STM32 enter a stop state ~24uA)
|
||||
#define RTC_CFG_ALARM_ENA (1 << 0) // b0: Set the RTC alarm active. An IRQ will be generated. This will wake-up the device if sleep.
|
||||
#define RTC_CFG_ALARM_REARM (1 << 1) // b1: If set, the RTC alarm will rearm for the next day trigger (if RTC_CFG_DATE_ALARM is set, repeat every day after the target date is reached)
|
||||
//#define RTC_CFG_PBTN_ALARM_IGNORE (1 << 2) // b3: If unset, override the power button shutdown behavior to keep the STM32 "alive" for the RTC to operate.
|
||||
//#define RTC_CFG_SLEEP_MODE (1 << 3) // 0 = normal sleep (pico is shutdown, STM32 enter in low power state ~1.2mA); 1 = deep sleep (pico is shutdown, STM32 enter a stop state ~24uA)
|
||||
|
||||
|
||||
uint8_t reg_get_value(enum reg_id reg);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#ifndef RTC_H_
|
||||
#define RTC_H_
|
||||
|
||||
// Configuration functions ------------------------------------------------------------
|
||||
void force_rtc_bck_load(void);
|
||||
void force_rtc_bck_sync(void);
|
||||
void check_rtc_bck_sync(void);
|
||||
@@ -12,6 +13,7 @@ void i2cs_fill_buffer_RTC_time(uint8_t* const buff, const volatile RTC_TimeTypeD
|
||||
void i2cs_RTC_date_from_buffer(volatile RTC_DateTypeDef* const date_s, const uint8_t* const buff);
|
||||
void i2cs_RTC_time_from_buffer(volatile RTC_TimeTypeDef* const time_s, const uint8_t* const buff);
|
||||
|
||||
// Start-stop functions ---------------------------------------------------------------
|
||||
uint32_t rtc_run_alarm(void);
|
||||
uint32_t rtc_stop_alarm(void);
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ UART_HandleTypeDef huart1;
|
||||
UART_HandleTypeDef huart3;
|
||||
#endif
|
||||
|
||||
volatile uint32_t systicks_counter = 0; // 1 MHz systick counter
|
||||
|
||||
volatile uint8_t rtc_reg_xor_events = 0;
|
||||
volatile RTC_TimeTypeDef_u rtc_time = {.raw = 0x00000000}, rtc_alarm_time = {.raw = 0x00000000};
|
||||
volatile RTC_DateTypeDef_u rtc_date = {.raw = 0x00010101}, rtc_alarm_date = {.raw = 0x00010101};
|
||||
|
||||
+9
-96
@@ -75,12 +75,11 @@ extern UART_HandleTypeDef huart3;
|
||||
#endif
|
||||
|
||||
// Some globals/internals counters
|
||||
volatile uint32_t systicks_counter = 0; // 1 MHz systick counter
|
||||
static uint32_t pmu_check_counter = 0;
|
||||
static uint8_t uninhibit_pwr_button = 0;
|
||||
static volatile uint32_t off_delay_counter = 0;
|
||||
|
||||
// Global status - TODO: Combine status registers, clean up
|
||||
// Global status
|
||||
static uint8_t keycb_start = 0;
|
||||
static uint32_t head_phone_status = 0;
|
||||
volatile uint8_t pmu_irq = 0;
|
||||
@@ -94,17 +93,12 @@ static void lock_cb(const uint8_t caps_changed, const uint8_t num_changed);
|
||||
static void key_cb(char key, enum key_state state);
|
||||
static void hw_check_HP_presence(void);
|
||||
static void sync_bat(void);
|
||||
#ifdef DEBUG
|
||||
static void printPMU(void);
|
||||
#endif
|
||||
static void check_pmu_int(void);
|
||||
static void rtc_ctrl_reg_check(void);
|
||||
static void rst_ctrl_reg_check(void);
|
||||
static void off_ctrl_reg_check(void);
|
||||
static void sys_prepare_sleep(void);
|
||||
static void sys_wake_sleep(void);
|
||||
static void sys_stop_pico(void);
|
||||
static void sys_start_pico(void);
|
||||
|
||||
extern void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
|
||||
if (htim == &htim2) {
|
||||
@@ -158,7 +152,7 @@ int main(void) {
|
||||
if ((uint16_t)result != 0xCA1C) {
|
||||
EEPROM_WriteVariable(EEPROM_VAR_BCKL, (EEPROM_Value)(uint16_t)((DEFAULT_LCD_BL << 8) | DEFAULT_KBD_BL), EEPROM_SIZE16);
|
||||
EEPROM_WriteVariable(EEPROM_VAR_KBD, (EEPROM_Value)(uint32_t)((DEFAULT_KBD_DEB << 16) | DEFAULT_KBD_FREQ), EEPROM_SIZE32);
|
||||
EEPROM_WriteVariable(EEPROM_VAR_CFG, (EEPROM_Value)(uint16_t)(((CFG_USE_MODS | CFG_REPORT_MODS | CFG_RST_DELAY_1S) << 8) | (INT_OVERFLOW | INT_KEY | INT_RTC | INT_PWR_BTN)), EEPROM_SIZE16);
|
||||
EEPROM_WriteVariable(EEPROM_VAR_CFG, (EEPROM_Value)(uint16_t)(((CFG_EEPROM_SAVE_CFG | CFG_USE_MODS | CFG_REPORT_MODS | CFG_RST_DELAY_1S) << 8) | (INT_OVERFLOW | INT_KEY | INT_RTC | INT_PWR_BTN)), EEPROM_SIZE16);
|
||||
EEPROM_WriteVariable(EEPROM_VAR_ID, (EEPROM_Value)(uint16_t)0xCA1C, EEPROM_SIZE16);
|
||||
#ifdef DEBUG
|
||||
DEBUG_UART_MSG("EEPROM first start!\n\r");
|
||||
@@ -320,6 +314,7 @@ int main(void) {
|
||||
sys_stop_pico();
|
||||
keycb_start = 0;
|
||||
AXP2101_setChargingLedMode(XPOWERS_CHG_LED_CTRL_CHG);
|
||||
uninhibit_pwr_button = 0;
|
||||
sys_prepare_sleep();
|
||||
|
||||
// Low-power mode entry
|
||||
@@ -450,77 +445,6 @@ __STATIC_INLINE void sync_bat(void) {
|
||||
reg_set_value(REG_ID_BAT, pcnt);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
__STATIC_INLINE void printPMU(void) {
|
||||
DEBUG_UART_MSG("PMU isCharging: ");
|
||||
if (AXP2101_isCharging())
|
||||
DEBUG_UART_MSG("YES\n\r");
|
||||
else
|
||||
DEBUG_UART_MSG( "NO\n\r");
|
||||
|
||||
DEBUG_UART_MSG("PMU isDischarge: ");
|
||||
if (AXP2101_isDischarge())
|
||||
DEBUG_UART_MSG("YES\n\r");
|
||||
else
|
||||
DEBUG_UART_MSG( "NO\n\r");
|
||||
|
||||
DEBUG_UART_MSG("PMU isStandby: ");
|
||||
if (AXP2101_isStandby())
|
||||
DEBUG_UART_MSG("YES\n\r");
|
||||
else
|
||||
DEBUG_UART_MSG( "NO\n\r");
|
||||
|
||||
DEBUG_UART_MSG("PMU isVbusIn: ");
|
||||
if (AXP2101_isVbusIn())
|
||||
DEBUG_UART_MSG("YES\n\r");
|
||||
else
|
||||
DEBUG_UART_MSG( "NO\n\r");
|
||||
|
||||
DEBUG_UART_MSG("PMU isVbusGood: ");
|
||||
if (AXP2101_isVbusGood())
|
||||
DEBUG_UART_MSG("YES\n\r");
|
||||
else
|
||||
DEBUG_UART_MSG( "NO\n\r");
|
||||
|
||||
DEBUG_UART_MSG("PMU getChargerStatus: ");
|
||||
uint8_t charge_status = AXP2101_getChargerStatus();
|
||||
if (charge_status == XPOWERS_AXP2101_CHG_TRI_STATE) {
|
||||
DEBUG_UART_MSG("tri_charge");
|
||||
} else if (charge_status == XPOWERS_AXP2101_CHG_PRE_STATE) {
|
||||
DEBUG_UART_MSG("pre_charge");
|
||||
} else if (charge_status == XPOWERS_AXP2101_CHG_CC_STATE) {
|
||||
DEBUG_UART_MSG("constant charge");
|
||||
} else if (charge_status == XPOWERS_AXP2101_CHG_CV_STATE) {
|
||||
DEBUG_UART_MSG("constant voltage");
|
||||
} else if (charge_status == XPOWERS_AXP2101_CHG_DONE_STATE) {
|
||||
DEBUG_UART_MSG("charge done");
|
||||
} else if (charge_status == XPOWERS_AXP2101_CHG_STOP_STATE) {
|
||||
DEBUG_UART_MSG("not charging");
|
||||
}
|
||||
|
||||
DEBUG_UART_MSG("PMU getBattVoltage: ");
|
||||
DEBUG_UART_MSG2(AXP2101_getBattVoltage(), 2, 0);
|
||||
DEBUG_UART_MSG("mV\n\r");
|
||||
DEBUG_UART_MSG("PMU getVbusVoltage: ");
|
||||
DEBUG_UART_MSG2(AXP2101_getVbusVoltage(), 2, 0);
|
||||
DEBUG_UART_MSG("mV\n\r");
|
||||
DEBUG_UART_MSG("PMU getSystemVoltage: ");
|
||||
DEBUG_UART_MSG2(AXP2101_getSystemVoltage(), 2, 0);
|
||||
DEBUG_UART_MSG("mV\n\r");
|
||||
|
||||
// The battery percentage may be inaccurate at first use, the PMU will
|
||||
// automatically learn the battery curve and will automatically calibrate the
|
||||
// battery percentage after a charge and discharge cycle
|
||||
if (AXP2101_isBatteryConnect()) {
|
||||
DEBUG_UART_MSG("PMU getBatteryPercent: ");
|
||||
uint8_t pcnt = 0;
|
||||
AXP2101_getBatteryPercent(&pcnt);
|
||||
DEBUG_UART_MSG2(pcnt, 1, 0);
|
||||
DEBUG_UART_MSG("%\n\r");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
__STATIC_INLINE void check_pmu_int(void) {
|
||||
if (!pmu_online)
|
||||
return;
|
||||
@@ -634,7 +558,7 @@ __STATIC_INLINE void check_pmu_int(void) {
|
||||
|
||||
printPMU();
|
||||
#endif
|
||||
if (stop_mode_active == 0) {
|
||||
if (stop_mode_active == 0 && uninhibit_pwr_button == 1) {
|
||||
// Send the special key to keyboard FIFO, as legacy firmware do
|
||||
key_cb(KEY_POWER, KEY_STATE_PRESSED);
|
||||
|
||||
@@ -657,7 +581,6 @@ __STATIC_INLINE void check_pmu_int(void) {
|
||||
//PMU.writeDataBuffer(data, XPOWERS_AXP2101_DATA_BUFFER_SIZE);
|
||||
|
||||
if (stop_mode_active == 0 && uninhibit_pwr_button == 1) {
|
||||
uninhibit_pwr_button = 0;
|
||||
AXP2101_setChargingLedMode(XPOWERS_CHG_LED_CTRL_CHG);
|
||||
stop_mode_active = 1;
|
||||
}
|
||||
@@ -699,16 +622,16 @@ __STATIC_INLINE void check_pmu_int(void) {
|
||||
|
||||
__STATIC_INLINE void rtc_ctrl_reg_check(void) {
|
||||
if (rtc_reg_xor_events != 0) {
|
||||
if ((rtc_reg_xor_events & RTC_CFG_RUN_ALARM) == RTC_CFG_RUN_ALARM) {
|
||||
if (reg_get_value(REG_ID_RTC_CFG) & RTC_CFG_RUN_ALARM) {
|
||||
if ((rtc_reg_xor_events & RTC_CFG_ALARM_ENA) == RTC_CFG_ALARM_ENA) {
|
||||
if (reg_get_value(REG_ID_RTC_CFG) & RTC_CFG_ALARM_ENA) {
|
||||
if (rtc_run_alarm() != HAL_OK)
|
||||
reg_set_value(REG_ID_RTC_CFG, reg_get_value(REG_ID_RTC_CFG) & (uint8_t)~RTC_CFG_RUN_ALARM);
|
||||
reg_set_value(REG_ID_RTC_CFG, reg_get_value(REG_ID_RTC_CFG) & (uint8_t)~RTC_CFG_ALARM_ENA);
|
||||
} else {
|
||||
if (rtc_stop_alarm() != HAL_OK)
|
||||
reg_set_value(REG_ID_RTC_CFG, reg_get_value(REG_ID_RTC_CFG) | RTC_CFG_RUN_ALARM);
|
||||
reg_set_value(REG_ID_RTC_CFG, reg_get_value(REG_ID_RTC_CFG) | RTC_CFG_ALARM_ENA);
|
||||
}
|
||||
|
||||
rtc_reg_xor_events &= (uint8_t)~RTC_CFG_RUN_ALARM;
|
||||
rtc_reg_xor_events &= (uint8_t)~RTC_CFG_ALARM_ENA;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -835,13 +758,3 @@ __STATIC_INLINE void sys_wake_sleep(void) {
|
||||
keycb_start = 1;
|
||||
keyboard_process();
|
||||
}
|
||||
|
||||
__STATIC_INLINE void sys_stop_pico(void) {
|
||||
LL_GPIO_ResetOutputPin(SP_AMP_EN_GPIO_Port, SP_AMP_EN_Pin); // Disable speaker Amp. power
|
||||
LL_GPIO_ResetOutputPin(PICO_EN_GPIO_Port, PICO_EN_Pin); // Disable PICO power
|
||||
}
|
||||
|
||||
__STATIC_INLINE void sys_start_pico(void) {
|
||||
LL_GPIO_SetOutputPin(PICO_EN_GPIO_Port, PICO_EN_Pin); // Enable PICO power
|
||||
LL_GPIO_SetOutputPin(SP_AMP_EN_GPIO_Port, SP_AMP_EN_Pin); // Enable speaker Amp. power
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ extern void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) {
|
||||
// Needed to fetch the good date from wake-up
|
||||
force_rtc_bck_load();
|
||||
|
||||
if ((rtc_conf & RTC_CFG_DATE_ALARM) == RTC_CFG_DATE_ALARM) {
|
||||
if (rtc_alarm_date.raw != 0) {
|
||||
HAL_RTC_GetDate(hrtc, &date_s, RTC_FORMAT_BIN);
|
||||
if (date_s.Year != rtc_alarm_date._s.Year ||
|
||||
date_s.Month != rtc_alarm_date._s.Month ||
|
||||
@@ -26,7 +26,7 @@ extern void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) {
|
||||
|
||||
rtc_stop_alarm();
|
||||
if (date_valid == 1) {
|
||||
if ((rtc_conf & RTC_CFG_REARM) == RTC_CFG_REARM)
|
||||
if ((rtc_conf & RTC_CFG_ALARM_REARM) == RTC_CFG_ALARM_REARM)
|
||||
rtc_run_alarm();
|
||||
} else {
|
||||
rtc_run_alarm();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# PicoCalc "southbridge" custom BIOS
|
||||
# [PicoCalc](https://www.clockworkpi.com/picocalc) "southbridge" custom BIOS
|
||||
|
||||
This is my personnal rewrite of the [original](https://github.com/clockworkpi/PicoCalc/tree/master/Code/picocalc_keyboard)
|
||||
PicoCalc STM32F103R8T6 firmware.
|
||||
@@ -18,11 +18,13 @@ This include:
|
||||
|
||||
## Tools version
|
||||
|
||||
- ARM GNU GCC: 14.3-rel1_arm-none-eabi (but STM32 one can do the job too)
|
||||
- ARM GCC: 14.3-rel1_arm-none-eabi (but STM32 one can do the job too)
|
||||
|
||||
## Compile
|
||||
This source code can be compiled using ARM/STM32 gcc toolchain in path and using make program.
|
||||
|
||||
(Build tested on Windows and Debian based system)
|
||||
|
||||
```
|
||||
git clone --recurse-submodules https://git.jcsmith.fr/jackcartersmith/picocalc_BIOS.git
|
||||
cd picocalc_BIOS
|
||||
|
||||
Reference in New Issue
Block a user