Skip to content

Commit 2fa35dc

Browse files
committed
make sure the interrupt number does not get shifted out of the valid range
1 parent d91ff72 commit 2fa35dc

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • sduino/hardware/sduino/stm8/cores/sduino

sduino/hardware/sduino/stm8/cores/sduino/Arduino.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,14 @@ inline unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8)
288288
* The new interrupt numbers are a combination of the position in the
289289
* internal jump table (value in LSB) and the real STM8S-Interrupt number (MSB)
290290
*/
291-
#define INT_PORTA (0 | (ITC_IRQ_PORTA << 8))
292-
#define INT_PORTB (1 | (ITC_IRQ_PORTB << 8))
293-
#define INT_PORTC (2 | (ITC_IRQ_PORTC << 8))
294-
#define INT_PORTD (3 | (ITC_IRQ_PORTD << 8))
295-
#define INT_TIM1_CAPCOM (4 | (ITC_IRQ_TIM1_CAPCOM << 8))
296-
#define INT_TIM1_OVF (5 | (ITC_IRQ_TIM1_OVF << 8))
297-
#define INT_TIM2_CAPCOM (6 | (ITC_IRQ_TIM2_CAPCOM << 8))
298-
#define INT_TIM2_OVF (7 | (ITC_IRQ_TIM2_OVF << 8))
291+
#define INT_PORTA (0 | (uint16_t)(ITC_IRQ_PORTA << 8))
292+
#define INT_PORTB (1 | (uint16_t)(ITC_IRQ_PORTB << 8))
293+
#define INT_PORTC (2 | (uint16_t)(ITC_IRQ_PORTC << 8))
294+
#define INT_PORTD (3 | (uint16_t)(ITC_IRQ_PORTD << 8))
295+
#define INT_TIM1_CAPCOM (4 | (uint16_t)(ITC_IRQ_TIM1_CAPCOM << 8))
296+
#define INT_TIM1_OVF (5 | (uint16_t)(ITC_IRQ_TIM1_OVF << 8))
297+
#define INT_TIM2_CAPCOM (6 | (uint16_t)(ITC_IRQ_TIM2_CAPCOM << 8))
298+
#define INT_TIM2_OVF (7 | (uint16_t)(ITC_IRQ_TIM2_OVF << 8))
299299

300300

301301

0 commit comments

Comments
 (0)