wip:
This commit is contained in:
		
							
								
								
									
										35
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								src/main.c
									
									
									
									
									
								
							@@ -3,6 +3,12 @@
 | 
			
		||||
#include "avr/io.h"
 | 
			
		||||
#include "zh_avr_160x_i2c.h"
 | 
			
		||||
 | 
			
		||||
const static uint8_t triac_delay[100] PROGMEM = {0, 155, 153, 152, 150, 148, 147, 145, 144, 142,
 | 
			
		||||
                                                 141, 139, 137, 136, 134, 133, 131, 130, 128, 127,
 | 
			
		||||
                                                 125};
 | 
			
		||||
 | 
			
		||||
uint8_t count = 0;
 | 
			
		||||
 | 
			
		||||
// #define DEBUG
 | 
			
		||||
 | 
			
		||||
#define BUTTON_I2C_ADDRESS 0x00
 | 
			
		||||
@@ -59,9 +65,25 @@ int main(void)
 | 
			
		||||
    stdout = &uart;
 | 
			
		||||
    xTaskCreate(system_setup_task, "system_setup_task", 107, NULL, tskIDLE_PRIORITY, &system_setup_task_handle);
 | 
			
		||||
#else
 | 
			
		||||
    xTaskCreate(system_setup_task, NULL, 107, NULL, tskIDLE_PRIORITY, NULL);
 | 
			
		||||
    // xTaskCreate(system_setup_task, NULL, 107, NULL, tskIDLE_PRIORITY, NULL);
 | 
			
		||||
#endif
 | 
			
		||||
    vTaskStartScheduler();
 | 
			
		||||
    // TCCR0A = 0x00;
 | 
			
		||||
    // TCCR0B = 0x00;
 | 
			
		||||
    // OCR1A = 53332;
 | 
			
		||||
    // TCCR1B |= (1 << WGM12) | (1 << CS10);
 | 
			
		||||
    // TIMSK1 |= (1 << OCIE1A);
 | 
			
		||||
 | 
			
		||||
    DDRB |= (1 << PORTB5);
 | 
			
		||||
 | 
			
		||||
    TCCR0A = (1 << WGM01);
 | 
			
		||||
    TCCR0B = (1 << CS00) | (1 << CS02);
 | 
			
		||||
    OCR0A = 200;
 | 
			
		||||
    TIMSK0 = (1 << OCIE0A);
 | 
			
		||||
    sei();
 | 
			
		||||
    // vTaskStartScheduler();
 | 
			
		||||
    for (;;)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -128,4 +150,13 @@ ISR(PCINT2_vect)
 | 
			
		||||
    {
 | 
			
		||||
        portYIELD();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ISR(TIMER0_COMPA_vect)
 | 
			
		||||
{
 | 
			
		||||
    if (++count == 78)
 | 
			
		||||
    {
 | 
			
		||||
        PORTB ^= (1 << PORTB5);
 | 
			
		||||
        count = 0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user