Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
firmware
boards
breezy
breezystm32
drv_mb1030.c
Go to the documentation of this file.
1
#include <stdint.h>
2
#include <stdbool.h>
3
#include <stdlib.h>
4
5
#include "
stm32f10x_conf.h
"
6
#include "core_cm3.h"
7
8
#include "
drv_gpio.h
"
9
#include "
drv_timer.h
"
10
#include "
drv_pwm.h
"
11
12
typedef
struct
{
13
TIM_TypeDef
*
tim
;
14
GPIO_TypeDef
*
gpio
;
15
uint32_t
pin
;
16
uint8_t
channel
;
17
uint8_t
irq
;
18
}
sonar_t
;
19
20
static
sonar_t
sonar_hardware
[6] = {
21
{
TIM2
,
GPIOA
,
Pin_1
,
TIM_Channel_2
, TIM2_IRQn },
// RC2
22
{
TIM2
,
GPIOA
,
Pin_2
,
TIM_Channel_3
, TIM2_IRQn },
// RC3
23
{
TIM2
,
GPIOA
,
Pin_3
,
TIM_Channel_4
, TIM2_IRQn },
// RC4
24
{
TIM3
,
GPIOA
,
Pin_6
,
TIM_Channel_1
, TIM3_IRQn },
// RC5
25
{
TIM3
,
GPIOA
,
Pin_7
,
TIM_Channel_2
, TIM3_IRQn },
// RC6
26
{
TIM3
,
GPIOB
,
Pin_0
,
TIM_Channel_3
, TIM3_IRQn },
// RC7
27
};
28
29
void
mb1030_init
()
30
{
31
for
(
int
i
= 0;
i
< 6;
i
++)
32
{
33
pwmGPIOConfig
(sonar_hardware[
i
].gpio, sonar_hardware[
i
].pin,
Mode_IPD
);
34
pwmICConfig
(sonar_hardware[
i
].tim, sonar_hardware[
i
].channel,
TIM_ICPolarity_Rising
);
35
}
Pin_2
Definition:
drv_gpio.h:44
Mode_IPD
Definition:
drv_gpio.h:27
sonar_t
Definition:
drv_mb1030.c:12
sonar_t::pin
uint32_t pin
Definition:
drv_mb1030.c:15
drv_pwm.h
TIM_Channel_3
#define TIM_Channel_3
Definition:
stm32f4xx_tim.h:282
GPIOA
#define GPIOA
Definition:
stm32f4xx.h:2110
TIM3
#define TIM3
Definition:
stm32f4xx.h:2038
TIM2
#define TIM2
Definition:
stm32f4xx.h:2037
GPIOB
#define GPIOB
Definition:
stm32f4xx.h:2111
TIM_Channel_2
#define TIM_Channel_2
Definition:
stm32f4xx_tim.h:281
pwmICConfig
static void pwmICConfig(TIM_TypeDef *tim, uint8_t channel, uint16_t polarity)
Definition:
drv_pwm.c:114
TIM_Channel_4
#define TIM_Channel_4
Definition:
stm32f4xx_tim.h:283
pwmGPIOConfig
static void pwmGPIOConfig(GPIO_TypeDef *gpio, uint32_t pin, GPIO_Mode mode)
Definition:
drv_pwm.c:128
Pin_6
Definition:
drv_gpio.h:48
sonar_t::gpio
GPIO_TypeDef * gpio
Definition:
drv_mb1030.c:14
sonar_hardware
static sonar_t sonar_hardware[6]
Definition:
drv_mb1030.c:20
sonar_t::tim
TIM_TypeDef * tim
Definition:
drv_mb1030.c:13
GPIO_TypeDef
General Purpose I/O.
Definition:
stm32f4xx.h:1281
mb1030_init
void mb1030_init()
Definition:
drv_mb1030.c:29
Pin_3
Definition:
drv_gpio.h:45
stm32f10x_conf.h
drv_gpio.h
TIM_Channel_1
#define TIM_Channel_1
Definition:
stm32f4xx_tim.h:280
TIM_ICPolarity_Rising
#define TIM_ICPolarity_Rising
Definition:
stm32f4xx_tim.h:507
Pin_1
Definition:
drv_gpio.h:43
param_parser.i
int i
Definition:
param_parser.py:19
sonar_t::channel
uint8_t channel
Definition:
drv_mb1030.c:16
TIM_TypeDef
TIM.
Definition:
stm32f4xx.h:1666
drv_timer.h
sonar_t::irq
uint8_t irq
Definition:
drv_mb1030.c:17
Pin_0
Definition:
drv_gpio.h:42
Pin_7
Definition:
drv_gpio.h:49
rosflight_firmware
Author(s): Daniel Koch
, James Jackson
autogenerated on Thu Apr 15 2021 05:07:46