wip:
This commit is contained in:
		
							
								
								
									
										45
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								src/main.c
									
									
									
									
									
								
							@@ -3,19 +3,6 @@
 | 
			
		||||
#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, 123, 122, 120, 119, 117, 116, 114, 112, 111,
 | 
			
		||||
                                                 109, 108, 106, 105, 103, 102, 100, 98, 97, 95,
 | 
			
		||||
                                                 94, 92, 91, 89, 87, 86, 84, 83, 81, 80,
 | 
			
		||||
                                                 78, 77, 75, 73, 72, 70, 69, 67, 66, 64,
 | 
			
		||||
                                                 62, 61, 59, 58, 56, 55, 53, 52, 50, 48,
 | 
			
		||||
                                                 47, 45, 44, 42, 41, 39, 37, 36, 34, 33,
 | 
			
		||||
                                                 31, 30, 28, 27, 25, 23, 22, 20, 19, 17,
 | 
			
		||||
                                                 16, 14, 12, 11, 9, 8, 6, 5, 3, 2};
 | 
			
		||||
 | 
			
		||||
uint8_t count = 0;
 | 
			
		||||
 | 
			
		||||
// #define DEBUG
 | 
			
		||||
 | 
			
		||||
#define BUTTON_I2C_ADDRESS 0x00
 | 
			
		||||
@@ -51,17 +38,6 @@ zh_avr_pcf8574_handle_t led2_handle = {0};
 | 
			
		||||
zh_avr_pcf8574_handle_t relay_handle = {0};
 | 
			
		||||
zh_avr_pcf8574_handle_t lcd_handle = {0};
 | 
			
		||||
 | 
			
		||||
// void led_flash_task(void *pvParameters)
 | 
			
		||||
// {
 | 
			
		||||
//     DDRB |= (1 << PORTB5);
 | 
			
		||||
//     for (;;)
 | 
			
		||||
//     {
 | 
			
		||||
//         PORTB ^= (1 << PORTB5);
 | 
			
		||||
//         vTaskDelay(1000 / portTICK_PERIOD_MS);
 | 
			
		||||
//     }
 | 
			
		||||
//     vTaskDelete(NULL);
 | 
			
		||||
// }
 | 
			
		||||
 | 
			
		||||
int main(void)
 | 
			
		||||
{
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
@@ -72,17 +48,9 @@ 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
 | 
			
		||||
 | 
			
		||||
    DDRB |= (1 << PORTB5);
 | 
			
		||||
 | 
			
		||||
    TCCR0A = (1 << WGM01);
 | 
			
		||||
    TCCR0B = (1 << CS00) | (1 << CS02);
 | 
			
		||||
    OCR0A = 200;
 | 
			
		||||
    TIMSK0 = (1 << OCIE0A);
 | 
			
		||||
    sei();
 | 
			
		||||
    // vTaskStartScheduler();
 | 
			
		||||
    vTaskStartScheduler();
 | 
			
		||||
    for (;;)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
@@ -152,13 +120,4 @@ ISR(PCINT2_vect)
 | 
			
		||||
    {
 | 
			
		||||
        portYIELD();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ISR(TIMER0_COMPA_vect)
 | 
			
		||||
{
 | 
			
		||||
    if (++count == 78)
 | 
			
		||||
    {
 | 
			
		||||
        PORTB ^= (1 << PORTB5);
 | 
			
		||||
        count = 0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user