summaryrefslogtreecommitdiffstats
path: root/pressure_control/firmware/util.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-10-18 23:47:05 +0200
committerMichael Buesch <mb@bu3sch.de>2008-10-18 23:47:05 +0200
commit4b0babc1b1daaece0d8de672f98adaf6cff5cdac (patch)
tree58c4bbac00ca8a76af06b006a392279ae6729907 /pressure_control/firmware/util.c
parent4a914e8c559cd48173bed088e2122d1d35c8de9b (diff)
downloadcnc-4b0babc1b1daaece0d8de672f98adaf6cff5cdac.tar.xz
cnc-4b0babc1b1daaece0d8de672f98adaf6cff5cdac.zip
Add a loooot of stuff to pressure_control
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Diffstat (limited to 'pressure_control/firmware/util.c')
-rw-r--r--pressure_control/firmware/util.c37
1 files changed, 27 insertions, 10 deletions
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 <mb@bu3sch.de>
+ * Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
*
- * 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 <http://www.gnu.org/licenses/>.
*/
#include "util.h"
#include "calibration.h"
+#include <util/crc16.h>
#include <avr/io.h>
#include <avr/sleep.h>
@@ -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;
+}
bues.ch cgit interface