summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2022-01-05 02:18:16 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2022-01-05 02:18:16 +0100
commitd9b9b3e71397a2da9e16cbee75c4954105237363 (patch)
tree79d4be62e5357868b5af75301017553d3e8b692c /src/main.c
parent01227e76785845dae377a8808146ff51209f727a (diff)
downloadanalog_instruments-d9b9b3e71397a2da9e16cbee75c4954105237363.tar.gz
p command working to change PWM
refactgored pwm code
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c44
1 files changed, 3 insertions, 41 deletions
diff --git a/src/main.c b/src/main.c
index 131b483..7e1939c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -10,53 +10,14 @@
#include "uart.h"
#include "cmd.h"
-
-uint8_t t0_ovf_cnt = 0;
-
-uint8_t pb0_thresh = 128;
-
-ISR(TIMER0_OVF_vect) {
- cli();
- /*TCNT0 = (1<<7);*/ /* Hack-increase Interrupt trigger freq */
-
- t0_ovf_cnt ++;
-
- if ( t0_ovf_cnt >= pb0_thresh )
- PORTB &= ~(1<<PINB0);
- else
- PORTB |= (1<<PINB0);
-
- sei();
-}
-
-ISR(TIMER2_OVF_vect) {
- cli();
- pb0_thresh ++;
- sei();
-}
+#include "pwm.h"
int main(void) {
- char c;
-
cli();
- /* Pins */
- DDRB |= (1<<PINB0);
-
- /* Enable TIMER0 with interrupt, no prescaler */
- TCCR0 |= (1<<CS00);
- TIMSK |= (1<<TOIE0);
-
- /* Enable TIMER2 with interrupt, Clk divide by 1024 */
- /*
- TCCR2 |= (7<<CS20);
- TIMSK |= (1<<TOIE2);
- */
-
- /* Uart */
uart_init();
-
cmd_init();
+ pwm_init();
/* Go! */
sei();
@@ -64,6 +25,7 @@ int main(void) {
uart_putstring("START\r\n");
while(1){
+ char c;
if( uart_getchar(&c) )
continue;