Manually inline sbi/cbi macros

This commit is contained in:
Allen Hill
2026-05-15 22:27:09 +00:00
parent 877e88fcd0
commit f68fa5ab60
2 changed files with 6 additions and 9 deletions
+6 -6
View File
@@ -176,15 +176,15 @@ uint8_t cdloading_resp[] = {dev_CD_CHANGER,
/* Disable serial and periodic interrupts during AVCLAN reads. /* Disable serial and periodic interrupts during AVCLAN reads.
Not using cli() because AVCLAN reads depend on other interrupts. */ Not using cli() because AVCLAN reads depend on other interrupts. */
static inline void stopEvent() { static inline void stopEvent() {
cbi(RTC.PITINTCTRL, RTC_PI_bp); RTC.PITINTCTRL &= ~(1 << RTC_PI_bp);
cbi(USART0.CTRLA, USART_RXCIE_bp); USART0.CTRLA &= ~(1 << USART_RXCIE_bp);
} }
// Re-enable serial and periodic interrupts. // Re-enable serial and periodic interrupts.
static inline void startEvent() { static inline void startEvent() {
if (AVCLAN_isPlaying()) // Reenable PIT interrupt if currently playing if (AVCLAN_isPlaying()) // Reenable PIT interrupt if currently playing
sbi(RTC.PITINTCTRL, RTC_PI_bp); RTC.PITINTCTRL |= (1 << RTC_PI_bp);
sbi(USART0.CTRLA, USART_RXCIE_bp); USART0.CTRLA |= (1 << USART_RXCIE_bp);
} }
// clang-format off // clang-format off
@@ -237,7 +237,7 @@ void AVCLAN_startPlaying() {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
loop_until_bit_is_clear(RTC_PITSTATUS, RTC_CNTBUSY_bp); loop_until_bit_is_clear(RTC_PITSTATUS, RTC_CNTBUSY_bp);
RTC.CNT = 0; RTC.CNT = 0;
sbi(RTC.PITINTCTRL, RTC_PI_bp); RTC.PITINTCTRL |= (1 << RTC_PI_bp);
} }
} }
@@ -245,7 +245,7 @@ void AVCLAN_startPlaying() {
// 1 sec) // 1 sec)
void AVCLAN_stopPlaying() { void AVCLAN_stopPlaying() {
CD_Mode = stStop; CD_Mode = stStop;
cbi(RTC.PITINTCTRL, RTC_PI_bp); RTC.PITINTCTRL &= ~(1 << RTC_PI_bp);
} }
void AVCLAN_init() { void AVCLAN_init() {
-3
View File
@@ -28,9 +28,6 @@
// PA7 AINN1 - // PA7 AINN1 -
#define BUS_IS_IDLE (bit_is_clear(AC2_STATUS, AC_STATE_bp)) #define BUS_IS_IDLE (bit_is_clear(AC2_STATUS, AC_STATE_bp))
#define sbi(port, bit) (port) |= (1 << (bit)) // Set bit (i.e. to 1)
#define cbi(port, bit) (port) &= ~(1 << (bit)) // Clear bit (i.e. set bit to 0)
#define MAXMSGLEN 32 #define MAXMSGLEN 32
#define DEVICE_ADDR 0x360 // CD Changer address #define DEVICE_ADDR 0x360 // CD Changer address