Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces 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 
38 
39  int nb_err;
40 
42 };
43 
45 
46 void config_mkk_v2_init(void);
49 
51 // MKK Config
52 
53 typedef struct {
63 
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_eeprom_t config_mkk_v2_eeprom
struct i2c_transaction trans
Definition: config_mkk_v2.h:41
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
void config_mkk_v2_periodic_telemetry(void)
Definition: config_mkk_v2.c:66
void config_mkk_v2_send_eeprom(void)
I2C transaction structure.
Definition: i2c.h:93
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.