From 4b0babc1b1daaece0d8de672f98adaf6cff5cdac Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Sat, 18 Oct 2008 23:47:05 +0200 Subject: Add a loooot of stuff to pressure_control Signed-off-by: Michael Buesch --- pressure_control/firmware/util.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'pressure_control/firmware/util.c') diff --git a/pressure_control/firmware/util.c b/pressure_control/firmware/util.c index 3cecc46..0056cbd 100644 --- a/pressure_control/firmware/util.c +++ b/pressure_control/firmware/util.c @@ -1,22 +1,26 @@ /* - * Utility functions + * Utility functions. * - * Copyright (C) 2008 Michael Buesch + * Copyright (C) 2008 Michael Buesch * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include "util.h" #include "calibration.h" +#include #include #include @@ -76,3 +80,16 @@ void infinite_sleep(void) while (1) sleep_mode(); } + +uint16_t crc16_block_update(uint16_t crc, const void *_data, uint16_t size) +{ + const uint8_t *data = _data; + + while (size) { + crc = _crc16_update(crc, *data); + data++; + size--; + } + + return crc; +} -- cgit v1.2.3