mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-25 06:15:43 +08:00
Update fms_spi_autopilot_msg to new CRC api
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# $Id: lisa_test_progs.makefile 4982 2010-06-18 13:51:00Z poine $
|
||||
# Copyright (C) 2010 Antoine Drouin
|
||||
#
|
||||
# This file is part of Paparazzi.
|
||||
#
|
||||
# Paparazzi 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# Paparazzi 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 Paparazzi; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
ap.CFLAGS += -DUSE_SPI_LINK -DOVERO_LINK_MSG_UP=AutopilotMessagePTUp -DOVERO_LINK_MSG_DOWN=AutopilotMessagePTDown
|
||||
ap.srcs += $(SRC_FMS)/fms_spi_autopilot_msg.c
|
||||
ap.srcs += $(SRC_FMS)/fms_spi_link.c
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "fms_spi_link.h"
|
||||
#include "fms_autopilot_msg.h"
|
||||
#include "fms_spi_autopilot_msg.h"
|
||||
#include "fms_crc.h"
|
||||
|
||||
/* all these for telemetry */
|
||||
#include "messages2.h"
|
||||
@@ -152,17 +151,14 @@ void spi_ap_link_periodic()
|
||||
static struct AutopilotMessageCRCFrame msg_up;
|
||||
static struct AutopilotMessageCRCFrame msg_down;
|
||||
static uint32_t crc_errors = 0;
|
||||
static uint32_t foo = 0;
|
||||
crc_t crc_in;
|
||||
uint8_t crc_valid;
|
||||
|
||||
passthrough_down_fill(&msg_down.payload.msg_down);
|
||||
msg_down.crc = crc__calc_block_crc8(&msg_down, sizeof(union AutopilotMessage));
|
||||
|
||||
// SPI transcieve
|
||||
spi_link_send(&msg_down, sizeof(struct AutopilotMessageCRCFrame), &msg_up);
|
||||
crc_in = crc__calc_block_crc8(&msg_up, sizeof(union AutopilotMessage));
|
||||
spi_link_send(&msg_down, sizeof(struct AutopilotMessageCRCFrame), &msg_up, &crc_valid);
|
||||
|
||||
if(msg_up.crc != crc_in) {
|
||||
if(crc_valid) {
|
||||
crc_errors++;
|
||||
} else {
|
||||
passthrough_up_parse(&msg_up.payload.msg_up);
|
||||
|
||||
Reference in New Issue
Block a user