Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 
36 {
39 
40  int nb_err;
41 
43 };
44 
46 
47 void config_mkk_v2_init(void);
50 
52 // MKK Config
53 
54 typedef struct
55 {
65 
67 
68 
69 #define CONFIG_MKK_V2_MASK_SET_PWM_SCALING 0x01
70 #define CONFIG_MKK_V2_MASK_SET_CURRENT_LIMIT 0x02
71 #define CONFIG_MKK_V2_MASK_SET_TEMP_LIMIT 0x04
72 #define CONFIG_MKK_V2_MASK_SET_CURRENT_SCALING 0x08
73 #define CONFIG_MKK_V2_MASK_SET_BITCONFIG 0x10
74 #define CONFIG_MKK_V2_MASK_RESET_CAPCOUNTER 0x20
75 #define CONFIG_MKK_V2_MASK_SET_DEFAULT_PARAMS 0x40
76 #define CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM 0x80
77 
78 #define BITCONF_REVERSE_ROTATION 0x01
79 
80 
81 extern void config_mkk_v2_send_eeprom(void);
82 extern void config_mkk_v2_read_eeprom(void);
83 
84 #define config_mkk_v2_ResetDefault(_v) { \
85  config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_DEFAULT_PARAMS; \
86  config_mkk_v2_send_eeprom(); \
87 }
88 
89 #define config_mkk_v2_SetPwmScaling(_v) { \
90  config_mkk_v2_eeprom.PwmScaling = _v; \
91  config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_PWM_SCALING; \
92  config_mkk_v2_send_eeprom(); \
93 }
94 
95 #define config_mkk_v2_SetCurrentLimit(_v) { \
96  config_mkk_v2_eeprom.CurrentLimit = _v; \
97  config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_CURRENT_LIMIT; \
98  config_mkk_v2_send_eeprom(); \
99 }
100 
101 #define config_mkk_v2_SetTempLimit(_v) { \
102  config_mkk_v2_eeprom.TempLimit = _v; \
103  config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_TEMP_LIMIT; \
104  config_mkk_v2_send_eeprom(); \
105 }
106 
107 #define config_mkk_v2_SetCurrentScaling(_v) { \
108  config_mkk_v2_eeprom.CurrentScaling = _v; \
109  config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_CURRENT_SCALING; \
110  config_mkk_v2_send_eeprom(); \
111 }
112 
113 #define config_mkk_v2_SetBitConfig(_v) { \
114  config_mkk_v2_eeprom.BitConfig = _v; \
115  config_mkk_v2_eeprom.SetMask = CONFIG_MKK_V2_MASK_SET_SAVE_EEPROM | CONFIG_MKK_V2_MASK_SET_BITCONFIG; \
116  config_mkk_v2_send_eeprom(); \
117 }
118 
119 #define config_mkk_v2_GetConfig(_v) { \
120  config_mkk_v2.addr = _v; \
121  config_mkk_v2_read_eeprom(); \
122 }
123 
124 
125 
126 #endif
127 
128 
129 
config_mkk_v2_eeprom_t config_mkk_v2_eeprom
I2C transaction structure.
Definition: i2c.h:93
struct config_mkk_v2_struct config_mkk_v2
Definition: config_mkk_v2.c:29
void config_mkk_v2_periodic_read_status(void)
Definition: config_mkk_v2.c:42
struct i2c_transaction trans
Definition: config_mkk_v2.h:42
void config_mkk_v2_periodic_telemetry(void)
Definition: config_mkk_v2.c:67
void config_mkk_v2_send_eeprom(void)
unsigned char uint8_t
Definition: types.h:14
void config_mkk_v2_init(void)
Definition: config_mkk_v2.c:31
void config_mkk_v2_read_eeprom(void)
Architecture independent I2C (Inter-Integrated Circuit Bus) API.