Welcome to mirror list, hosted at ThFree Co, Russian Federation.

misc.h « avr « src - github.com/Klipper3d/klipper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 244cd5bc80eba1a830818fa8851baecc20344f4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef __AVR_MISC_H
#define __AVR_MISC_H

#include <stdint.h>
#include <util/crc16.h>

// alloc.c
size_t alloc_maxsize(size_t reqsize);

// console.c
char *console_get_input(uint8_t *plen);
void console_pop_input(uint8_t len);
char *console_get_output(uint8_t len);
void console_push_output(uint8_t len);

// Optimized crc16_ccitt for the avr processor
#define HAVE_OPTIMIZED_CRC 1
static inline uint16_t _crc16_ccitt(char *buf, uint8_t len) {
    uint16_t crc = 0xFFFF;
    while (len--)
        crc = _crc_ccitt_update(crc, *buf++);
    return crc;
}

#endif // misc.h