nrf5/pwm: Moving out object types to header file so that it can be resused by other modules.

This commit is contained in:
Glenn Ruben Bakke 2017-01-06 23:40:23 +01:00
parent 67683722c8
commit ad4149cc80
2 changed files with 12 additions and 10 deletions

View File

@ -42,11 +42,6 @@
#include "hal_pwm.h"
#endif
typedef struct _pyb_pwm_obj_t {
mp_obj_base_t base;
PWM_HandleTypeDef *pwm;
} pyb_pwm_obj_t;
#ifdef MICROPY_HW_PWM0_NAME
PWM_HandleTypeDef PWMHandle0 = {.instance = NULL};
#endif
@ -236,11 +231,6 @@ STATIC MP_DEFINE_CONST_DICT(machine_pwm_locals_dict, machine_pwm_locals_dict_tab
/* code for hard implementation ***********************************************/
typedef struct _machine_hard_pwm_obj_t {
mp_obj_base_t base;
const pyb_pwm_obj_t *pyb;
} machine_hard_pwm_obj_t;
STATIC const machine_hard_pwm_obj_t machine_hard_pwm_obj[] = {
{{&machine_hard_pwm_type}, &machine_pwm_obj[0]},
};

View File

@ -24,6 +24,18 @@
* THE SOFTWARE.
*/
#include "hal_pwm.h"
typedef struct _pyb_pwm_obj_t {
mp_obj_base_t base;
PWM_HandleTypeDef *pwm;
} pyb_pwm_obj_t;
typedef struct _machine_hard_pwm_obj_t {
mp_obj_base_t base;
const pyb_pwm_obj_t *pyb;
} machine_hard_pwm_obj_t;
void pwm_init0(void);
extern const mp_obj_type_t machine_hard_pwm_type;