Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
config_mkk_v2.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2013 Christophe De Wagter
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
*/
22
28
#ifndef config_mkk_v2_MODULE_H
29
#define config_mkk_v2_MODULE_H
30
31
#include "
std.h
"
32
33
#include "
mcu_periph/i2c.h
"
34
35
struct
config_mkk_v2_struct
{
36
uint8_t
read_config
;
37
uint8_t
addr
;
38
39
int
nb_err
;
40
41
struct
i2c_transaction
trans
;
42
};
43
44
extern
struct
config_mkk_v2_struct
config_mkk_v2
;
45
46
void
config_mkk_v2_init
(
void
);
47
void
config_mkk_v2_periodic_read_status
(
void
);
48
void
config_mkk_v2_periodic_telemetry
(
void
);
49
51
// MKK Config
52
53
typedef
struct
{
54
uint8_t
revision
;
55
uint8_t
SetMask
;
56
uint8_t
PwmScaling
;
57
uint8_t
CurrentLimit
;
58
uint8_t
TempLimit
;
59
uint8_t
CurrentScaling
;
60
uint8_t
BitConfig
;
61
uint8_t
crc
;
62
}
config_mkk_v2_eeprom_t
;
63
64
extern
config_mkk_v2_eeprom_t
config_mkk_v2_eeprom
;
65
66
67
#define CONFIG_MKK_V2_MASK_SET_PWM_SCALING 0x01
68
#define CONFIG_MKK_V2_MASK_SET_CURRENT_LIMIT 0x02
69
#define CONFIG_MKK_V2_MASK_SET_TEMP_LIMIT 0x04
70
#define CONFIG_MKK_V2_MASK_SET_CURRENT_SCALING 0x08
71
#define CONFIG_MKK_V2_MASK_SET_BITCONFIG 0x10
72
#define CONFIG_MKK_V2_MASK_RESET_CAPCOUNTER 0x20
73
#define CONFIG_MKK_V2_MASK_SET_DEFAULT_PARAMS 0x40
74
#define CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM 0x80
75
76
#define BITCONF_REVERSE_ROTATION 0x01
77
78
79
extern
void
config_mkk_v2_send_eeprom
(
void
);
80
extern
void
config_mkk_v2_read_eeprom
(
void
);
81
82
#define config_mkk_v2_ResetDefault(_v) { \
83
config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_DEFAULT_PARAMS; \
84
config_mkk_v2_send_eeprom(); \
85
}
86
87
#define config_mkk_v2_SetPwmScaling(_v) { \
88
config_mkk_v2_eeprom.PwmScaling = _v; \
89
config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_PWM_SCALING; \
90
config_mkk_v2_send_eeprom(); \
91
}
92
93
#define config_mkk_v2_SetCurrentLimit(_v) { \
94
config_mkk_v2_eeprom.CurrentLimit = _v; \
95
config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_CURRENT_LIMIT; \
96
config_mkk_v2_send_eeprom(); \
97
}
98
99
#define config_mkk_v2_SetTempLimit(_v) { \
100
config_mkk_v2_eeprom.TempLimit = _v; \
101
config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_TEMP_LIMIT; \
102
config_mkk_v2_send_eeprom(); \
103
}
104
105
#define config_mkk_v2_SetCurrentScaling(_v) { \
106
config_mkk_v2_eeprom.CurrentScaling = _v; \
107
config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_CURRENT_SCALING; \
108
config_mkk_v2_send_eeprom(); \
109
}
110
111
#define config_mkk_v2_SetBitConfig(_v) { \
112
config_mkk_v2_eeprom.BitConfig = _v; \
113
config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_BITCONFIG; \
114
config_mkk_v2_send_eeprom(); \
115
}
116
117
#define config_mkk_v2_GetConfig(_v) { \
118
config_mkk_v2.addr = _v; \
119
config_mkk_v2_read_eeprom(); \
120
}
121
122
123
124
#endif
125
126
127
config_mkk_v2_send_eeprom
void config_mkk_v2_send_eeprom(void)
Definition:
config_mkk_v2.c:163
config_mkk_v2
struct config_mkk_v2_struct config_mkk_v2
Definition:
config_mkk_v2.c:29
config_mkk_v2_eeprom_t::BitConfig
uint8_t BitConfig
Definition:
config_mkk_v2.h:60
config_mkk_v2_struct::nb_err
int nb_err
Definition:
config_mkk_v2.h:39
config_mkk_v2_init
void config_mkk_v2_init(void)
Definition:
config_mkk_v2.c:31
config_mkk_v2_eeprom_t::CurrentLimit
uint8_t CurrentLimit
Definition:
config_mkk_v2.h:57
config_mkk_v2_periodic_read_status
void config_mkk_v2_periodic_read_status(void)
Definition:
config_mkk_v2.c:42
config_mkk_v2_eeprom_t::crc
uint8_t crc
Definition:
config_mkk_v2.h:61
config_mkk_v2_periodic_telemetry
void config_mkk_v2_periodic_telemetry(void)
Definition:
config_mkk_v2.c:66
config_mkk_v2_eeprom_t::TempLimit
uint8_t TempLimit
Definition:
config_mkk_v2.h:58
config_mkk_v2_read_eeprom
void config_mkk_v2_read_eeprom(void)
Definition:
config_mkk_v2.c:127
config_mkk_v2_eeprom_t::revision
uint8_t revision
Definition:
config_mkk_v2.h:54
std.h
config_mkk_v2_eeprom_t
Definition:
config_mkk_v2.h:53
config_mkk_v2_struct::trans
struct i2c_transaction trans
Definition:
config_mkk_v2.h:41
uint8_t
unsigned char uint8_t
Definition:
types.h:14
config_mkk_v2_eeprom_t::PwmScaling
uint8_t PwmScaling
Definition:
config_mkk_v2.h:56
config_mkk_v2_struct::read_config
uint8_t read_config
Definition:
config_mkk_v2.h:36
i2c_transaction
I2C transaction structure.
Definition:
i2c.h:93
config_mkk_v2_eeprom_t::SetMask
uint8_t SetMask
Definition:
config_mkk_v2.h:55
config_mkk_v2_eeprom_t::CurrentScaling
uint8_t CurrentScaling
Definition:
config_mkk_v2.h:59
i2c.h
config_mkk_v2_eeprom
config_mkk_v2_eeprom_t config_mkk_v2_eeprom
Definition:
config_mkk_v2.c:114
config_mkk_v2_struct
Definition:
config_mkk_v2.h:35
config_mkk_v2_struct::addr
uint8_t addr
Definition:
config_mkk_v2.h:37
sw
airborne
modules
config
config_mkk_v2.h
Generated on Tue Feb 1 2022 13:51:15 for Paparazzi UAS by
1.8.17