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_arch.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 Antoine Drouin <poinix@gmail.com>
3 *
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, write to
18 * the Free Software Foundation, 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
28#include "peripherals/ms2100.h"
29#include "mcu_periph/sys_time.h"
30
31#include <libopencm3/stm32/rcc.h>
32#include <libopencm3/stm32/gpio.h>
33#include <libopencm3/stm32/exti.h>
34#include <libopencm3/cm3/nvic.h>
35
36#ifndef STM32F1
37#error "MS2100 arch currently only implemented for STM32F1"
38#endif
39
62
64{
65 // set RESET pin high for at least 100 nsec
66 // busy wait should not harm
67 Ms2100Set();
68
69 // FIXME, make nanosleep funcion
72 if (end_cpu_ticks < 0) {
74 }
76 ;
77
79}
80
static void gpio_set(ioportid_t port, uint16_t pin)
Set a gpio output to high level.
Definition gpio_arch.h:104
#define GPIO5
Definition gpio_def.h:36
#define GPIO13
Definition gpio_def.h:44
SPI transaction structure.
Definition spi.h:148
uint16_t foo
Definition main_demo5.c:58
struct Ms2100 ms2100
Definition ms2100.c:44
Driver for the ms2100 magnetic sensor from PNI.
@ MS2100_GOT_EOC
Definition ms2100.h:39
enum Ms2100Status status
Definition ms2100.h:50
void ms2100_arch_init(void)
Definition ms2100_arch.c:40
void exti9_5_isr(void)
Definition ms2100_arch.c:81
void ms2100_reset_cb(struct spi_transaction *t)
Reset callback.
Definition ms2100_arch.c:63
static void Ms2100Set(void)
Here Set indicates the Ms2100 is in reset state, i.e.
Definition ms2100_arch.h:47
static void Ms2100Reset(void)
Here Reset indicates the Ms2100 is in normal state, i.e.
Definition ms2100_arch.h:38
#define GPIOC
Definition gpio_arch.h:36
#define GPIOB
Definition gpio_arch.h:35
Architecture independent timing functions.
static uint32_t cpu_ticks_of_nsec(uint32_t nsec)
Definition sys_time.h:197
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.