Skip to content

Commit

Permalink
Reimplemented tone using timer interrupts in output compare toggle mode
Browse files Browse the repository at this point in the history
  • Loading branch information
satishgn committed Apr 20, 2014
1 parent edd2293 commit 6c8ac53
Show file tree
Hide file tree
Showing 4 changed files with 358 additions and 38 deletions.
5 changes: 4 additions & 1 deletion inc/spark_wiring.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "spark_macros.h"
#include "debug.h"
#include "platform_config.h"
#include "stm32_it.h"
#include "spark_utilities.h"
#include "spark_wiring_stream.h"
#include "spark_wiring_printable.h"
Expand Down Expand Up @@ -150,6 +151,8 @@ typedef struct STM32_Pin_Info {
TIM_TypeDef* timer_peripheral;
uint16_t timer_ch;
PinMode pin_mode;
uint16_t timer_ccr;
int32_t user_property;
} STM32_Pin_Info;

extern STM32_Pin_Info PIN_MAP[];
Expand Down Expand Up @@ -184,7 +187,7 @@ long map(long value, long fromStart, long fromEnd, long toStart, long toEnd);
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);

void tone(uint8_t pin, unsigned int frequency);
void tone(uint8_t pin, unsigned int frequency, unsigned long duration = 0);
void noTone(uint8_t pin);

#ifdef __cplusplus
Expand Down
6 changes: 6 additions & 0 deletions inc/stm32_it.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,17 @@ void EXTI4_IRQHandler(void);
void EXTI9_5_IRQHandler(void);
void EXTI15_10_IRQHandler(void);
void TIM1_CC_IRQHandler(void);
void TIM2_IRQHandler(void);
void TIM3_IRQHandler(void);
void TIM4_IRQHandler(void);
void RTC_IRQHandler(void);
void RTCAlarm_IRQHandler(void);
void DMA1_Channel5_IRQHandler(void);
void USB_LP_CAN1_RX0_IRQHandler(void);

extern void (*Wiring_TIM2_Interrupt_Handler)(void);
extern void (*Wiring_TIM3_Interrupt_Handler)(void);
extern void (*Wiring_TIM4_Interrupt_Handler)(void);
}

#endif /* __STM32_IT_H */
Expand Down
Loading

0 comments on commit 6c8ac53

Please sign in to comment.