Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ms2100.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
3 * Copyright (C) 2012 Gautier Hattenberger
4 *
5 * This file is part of paparazzi.
6 *
7 * paparazzi is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * paparazzi is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with paparazzi; see the file COPYING. If not, write to
19 * the Free Software Foundation, 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
22
28#ifndef MS2100_H
29#define MS2100_H
30
31#include "std.h"
32#include "mcu_periph/spi.h"
34
35
43
44struct Ms2100 {
48 volatile uint8_t req_buf[1];
49 volatile uint8_t read_buf[2];
50 volatile enum Ms2100Status status;
51 volatile uint8_t cur_axe;
52 union {
53 struct Int16Vect3 vect;
54 int16_t value[3];
56};
57
58// keep gobal var for now...
59extern struct Ms2100 ms2100;
60
61extern void ms2100_init(struct Ms2100 *ms, struct spi_periph *spi_p, uint8_t slave_idx);
62extern void ms2100_read(struct Ms2100 *ms);
63extern void ms2100_event(struct Ms2100 *ms);
64
65static inline void ms2100_periodic(struct Ms2100 *ms)
66{
67 if (ms->status == MS2100_IDLE) {
69 }
70}
71
72/* underlying architecture */
74/* must be implemented by underlying architecture */
75extern void ms2100_arch_init(void);
76
77#endif /* MS2100_H */
SPI peripheral structure.
Definition spi.h:174
SPI transaction structure.
Definition spi.h:148
uint16_t foo
Definition main_demo5.c:58
struct Ms2100 ms2100
Definition ms2100.c:44
union Ms2100::@349 data
Ms2100Status
Definition ms2100.h:36
@ MS2100_DATA_AVAILABLE
Definition ms2100.h:41
@ MS2100_IDLE
Definition ms2100.h:37
@ MS2100_SENDING_REQ
Definition ms2100.h:38
@ MS2100_READING_RES
Definition ms2100.h:40
@ MS2100_GOT_EOC
Definition ms2100.h:39
static void ms2100_periodic(struct Ms2100 *ms)
Definition ms2100.h:65
enum Ms2100Status status
Definition ms2100.h:50
volatile uint8_t req_buf[1]
SPI buffer for the command byte.
Definition ms2100.h:48
struct spi_transaction read_trans
Definition ms2100.h:47
volatile uint8_t cur_axe
Definition ms2100.h:51
void ms2100_arch_init(void)
Definition ms2100_arch.c:40
volatile uint8_t read_buf[2]
SPI buffer for reading a single axis.
Definition ms2100.h:49
void ms2100_event(struct Ms2100 *ms)
Definition ms2100.c:105
struct spi_transaction req_trans
Definition ms2100.h:46
struct spi_periph * spi_p
Definition ms2100.h:45
void ms2100_init(struct Ms2100 *ms, struct spi_periph *spi_p, uint8_t slave_idx)
Definition ms2100.c:47
void ms2100_read(struct Ms2100 *ms)
send request to read next axis
Definition ms2100.c:96
STM32 specific functions for the ms2100 magnetic sensor from PNI.
Paparazzi fixed point algebra.
Architecture independent SPI (Serial Peripheral Interface) API.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.