Esempio n. 1
0
int main(void) {
    rts__init();
    rts__set(1);

    uint8_t counter = 0;
    uint8_t c = 'a';

    // display
    display__init();
    display__render_packed(0);

    USART0_REG_C |= (1<<usart0__stop_bits__BIT);
    usart0__rate__set(USART0__BAUD_RATE);
    usart0__tx__enabled__set(1);    

    for(;;) {
        usart0__out__write(c++);
        loop_until_bit_is_set(usart0__tx__complete__value__HOST, usart0__tx__complete__value__BIT);
        if (c == ('z' + 1)) {
            usart0__out__write(13);
            loop_until_bit_is_set(usart0__tx__complete__value__HOST, usart0__tx__complete__value__BIT);
            usart0__out__write(10);
            loop_until_bit_is_set(usart0__tx__complete__value__HOST, usart0__tx__complete__value__BIT);
 
            c = 'a';
            _delay_ms(1000);
            display__render_packed(++counter);
        }
    }

    return 0;
}
Esempio n. 2
0
    static void init(void) {
        usart0__rate__set(BAUD_RATE);
        usart0__tx__enabled__set(1);
        usart0__rx__enabled__set(1);

        usart_out = fdevopen(usart_putchar, NULL);
        stdout = stdin = usart_out;
    }
Esempio n. 3
0
int main(void) {
    rts__init();

    display__init();
    display__render_packed(0);

    usart0__init();
    usart0__rx__enabled__set(1);    
    usart0__tx__enabled__set(1);    

    for(;;) {
        uint8_t c = usart0__in__read();
        display__render_packed(c);
    }

    return 0;
}
Esempio n. 4
0
int main(void) {
    display__init();

    rts__init();
    rts__set(1);

    usart0__rate__set(USART0__BAUD_RATE);
    usart0__tx__enabled__set(1);

//    FILE usart_out = FDEV_SETUP_STREAM(usart_putchar, NULL, _FDEV_SETUP_WRITE);
//    stdout = &usart_out;

    onewire__bus__init();

    // sleeping
    set_sleep_mode(SLEEP_MODE_IDLE);
    sleep_enable();

    display__init();

    sei();

#if !defined(__AVR_ARCH__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
#endif
    for(;;) {
        main__thread__run();
    }
#if !defined(__AVR_ARCH__)
#pragma clang diagnostic pop
#endif

#if !defined(__AVR_ARCH__)
#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCDFAInspection"
#endif
    return 0;
#if !defined(__AVR_ARCH__)
#pragma clang diagnostic pop
#endif
    return 0;
}
Esempio n. 5
0
inline static void application__init(void) {
    // Output drivers
    amplifier_relay__init();
    siren1__init();
    siren2__init();
    water_valve__init();
    unused1__init();
    unused2__init();
    unused3__init();
    unused4__init();
    unused5__init();
    unused6__init();
    unused7__init();
    unused8__init();
    unused9__init();
    unused10__init();
    unused11__init();

    // Input drivers
    water_leak_sensors__init();
    motion_sensors__init();

    // Other drivers
    system_timer__init();
    water_leak_sensors_scanner__init();
    motion_sensors_scanner__init();
    usart0__rate__set(USART_BAUD_RATE);
    usart0__tx__enabled__set(1);
    usart0__rx__enabled__set(1);
    usart0__rx__complete__interrupt__enabled__set(1);

    // Services
    alarm__init();
    alarm__auth__init();
    alarm_handler__init();
    water_leak_handler__init();
    console__init();
}
void console__out__init(void) {
    usart0__tx__enabled__set(1);
}
Esempio n. 7
0
void usart0__tx__stop(void) {
    usart0__tx__data_register_empty__interrupt__enabled__set(0);
    usart0__tx__enabled__set(0);
}
Esempio n. 8
0
static void application__start(void) {
    usart0__tx__enabled__set(1);
    system_timer__start();
}
void modbus_rtu_driver__usart_tx__stop(void) {
    usart0__tx__enabled__set(0);    
}
void modbus_rtu_driver__usart_tx__start(void) {
    usart0__tx__enabled__set(1);    
}