测试MindMotion MM32F3277 MicroPython -2021-11-20新增PWM版本
简 介: 对于初步实现的MicroPython的版本进行了测试。可以看到这个版本在MCU的硬件层面还存在BUG,在实际管脚上尚无法输出对应的PWM波形。
关键词
: MM32,MicroPython,PWM
§01 MM32 Micropython
在今天早上(2021-11-20)MindMotion SuYong发送过来新一版本,增加了PWM的功能。
一、版本介绍
下面是Suyong对于该版本的微信说明。
微蓝[SY]:
这个PWM跟micropython官网上的不一样。官网上用的是rp2的实现, 但micropython代码仓库里还有esp32和esp8266的实现。我选择了后者, 看起来更符合正常的使用习惯
1、SuYong测试结果
▲ 图1.1.1 测试版本的结果
缺少信息: SunYong并没有发送过来的关于PWM的管脚分配信息
后来SuYong将machine_pwm的声明发送过来,如下:
/* for PWM. */
machine_pwm_port_conf_t machine_pwm_port_conf[2];
machine_pwm_ch_conf_t machine_pwm_ch_conf[8];
const machine_pwm_obj_t pwm_0 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PA6,
.pwm_pin_af = GPIO_AF_2, .tim_port = TIM3,
.port_conf = &machine_pwm_port_conf[0],
.tim_ch = 0u, .ch_conf = &machine_pwm_ch_conf[0], .pwm_id = 0u};
const machine_pwm_obj_t pwm_1 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PA7,
.pwm_pin_af = GPIO_AF_2, .tim_port = TIM3,
.port_conf = &machine_pwm_port_conf[0],
.tim_ch = 1u, .ch_conf = &machine_pwm_ch_conf[1], .pwm_id = 1u};
const machine_pwm_obj_t pwm_2 = {.base = { &machine_pwm_type },
.pwm_pin_obj = &pin_PB0, .pwm_pin_af = GPIO_AF_2,
.tim_port = TIM3, .port_conf = &machine_pwm_port_conf[0],
.tim_ch = 2u, .ch_conf = &machine_pwm_ch_conf[2], .pwm_id = 2u};
const machine_pwm_obj_t pwm_3 = {.base = { &machine_pwm_type },
.pwm_pin_obj = &pin_PB1, .pwm_pin_af = GPIO_AF_2,
.tim_port = TIM3, .port_conf = &machine_pwm_port_conf[0],
.tim_ch = 3u, .ch_conf = &machine_pwm_ch_conf[3], .pwm_id = 3u};
const machine_pwm_obj_t pwm_4 = {.base = { &machine_pwm_type },
.pwm_pin_obj = &pin_PB6, .pwm_pin_af = GPIO_AF_2,
.tim_port = TIM4, .port_conf = &machine_pwm_port_conf[1],
.tim_ch = 0u, .ch_conf = &machine_pwm_ch_conf[4], .pwm_id = 4u};
const machine_pwm_obj_t pwm_5 = {.base = { &machine_pwm_type },
.pwm_pin_obj = &pin_PB7, .pwm_pin_af = GPIO_AF_2,
.tim_port = TIM4, .port_conf = &machine_pwm_port_conf[1],
.tim_ch = 1u, .ch_conf = &machine_pwm_ch_conf[5], .pwm_id = 5u};
const machine_pwm_obj_t pwm_6 = {.base = { &machine_pwm_type },
.pwm_pin_obj = &pin_PB8, .pwm_pin_af = GPIO_AF_2,
.tim_port = TIM4, .port_conf = &machine_pwm_port_conf[1],
.tim_ch = 2u, .ch_conf = &machine_pwm_ch_conf[6], .pwm_id = 6u};
const machine_pwm_obj_t pwm_7 = {.base = { &machine_pwm_type },
.pwm_pin_obj = &pin_PB9, .pwm_pin_af = GPIO_AF_2,
.tim_port = TIM4, .port_conf = &machine_pwm_port_conf[1],
.tim_ch = 3u, .ch_conf = &machine_pwm_ch_conf[7], .pwm_id = 7u};
const machine_pwm_obj_t * machine_pwm_
可以看到八个PWM通道的Timer和GPIO的定义如下:
PWM | 定时器 | GPIO |
---|---|---|
PWM0 | TIM3 | PA6 |
PWM1 | TIM3 | PA7 |
PWM2 | TIM3 | PB0 |
PWM3 | TIM3 | PB1 |
PWM4 | TIM4 | PB6 |
PWM5 | TIM4 | PB7 |
PWM6 | TIM4 | PB8 |
PWM7 | TIM4 | PB9 |
PWM8 | TIM2 | PA5 |
PWM9 | TIM2 | PB3 |
PWM10 | TIM2 | PB10 |
PWM11 | TIM2 | PB11 |
PWM12 | TIM5 | PA0 |
PWM13 | TIM5 | PA1 |
PWM14 | TIM5 | PA2 |
PWM15 | TIM5 | PA3 |
这是(2021-11-30)SuYong发送过来的PWM为16个通道,对应的管脚。
▲ 图1.1.2 PWM管脚定义
2、下载链接
下载MicroPython for MM32的测试版本:
二、下载测试
1、下载MicroPython过程
利用 设计带有SD卡的 MM32F3277 MicroPython 实验板 对于 MicroPython进行测试。使用 MM32-Link 将MicroPython的BIN文件下载到测试板上。
▲ 图1.2.1 下载MM32F3277 MicroPython
2、上电MicroPython
利用 STM32 Bootloader 软件作为MicroPython REPL的操作界面。调试MicroPython。
(1)上电显示
上电后,在STM32 Bootloader显示信息窗口显示:
>> Open COM8, baud : 115200
[Y] sdcard ready.
[Y] file system on sdcard ready.
[Y] run the main.py on disk ...
[Y] done. 1
MicroPython v1.16 on 2021-11-19; MB_F3270 with MM32F3277G7P
>>>
(2)REPL初步操作
在STM32 Bootloader 进行REPL 交互式操作。
>>> import machine
>>> dir(machine)
['__name__', 'ADC', 'DAC', 'PWM', 'Pin', 'SDCard', 'SPI', 'SoftSPI', 'UART', 'freq', 'mem16', 'mem32', 'mem8']
>>>
可以看到其中已经包括了 PWM 模块。
§02 编程测试
下面对于PWM功能通过编程来实现它的的功能初步测试。
一、基本测试
1、声明与信息
(1)测试代码
from machine import PWM,Pin
import utime
pwm0 = PWM(0, freq=10000, duty=20)
print(pwm0)
pwm0.duty(50)
print(pwm0)
pwm0.init(freq=12000)
print(pwm0)
pwm0.deinit()
pwm0.init(freq=12000)
print(pwm0)
(2)输出结果
>> Download MicroPython : 29 lines/619 characters.
>> -------------------------------------------------------------------------
PMW(0, freq=10000, duty=20)
PMW(0, freq=10000, duty=50)
PMW(0, freq=10000, duty=0)
PMW(0, freq=12000, duty=0)
>>>
(3)结果解释
通过上述过程,可以看到如果修改PWM的frequency,需要:
- 首先进行 deinit()
- 然后进行 init(freq=…)
直接通过init(freq…)是无法进行修改频率的。
2、测试PWM波形
(1)测试代码
from machine import PWM,Pin
import utime
pwm0 = PWM(0, freq=10000, duty=20)
pwm1 = PWM(1, freq=10000, duty=100)
dir(pwm0)
print(pwm0, pwm1)
REPL 输出结果:
>> Download MicroPython : 24 lines/563 characters.
>> -------------------------------------------------------------------------
['deinit', 'duty', 'freq', 'init']
PMW(0, freq=12000, duty=20) PMW(1, freq=12000, duty=100)
>>>
(2)测试结果
使用示波器在PA6,PA7上只观察到了低电平,并没有观察到输出的PWM波形。
感觉, 现在这个版本只是将MCU的PA6,PA7进行了初始化,但没有开始启动对应的TIM3!
3、其它问题
实际上在【2.1.1.1:测试代码】中最后将PWM的频率初始化为12000之后,然后在【2.1.2.1:测试代码】中本来是声明的时候,为10000。
pwm0 = PWM(0, freq=10000, duty=20)
pwm1 = PWM(1, freq=10000, duty=100
但执行结果为:12000。这是因为在两次MicroPython下载程序之间MCU没有冷启动,MicroPython内部没有对于共享TIM3的四个通道进行初始化,所以后来新的MicroPython就无法直接进行声明和启动了。
基于这种情况,需要对于声明的PWM 通道,特别是使用相同TIM的PWM通道都需要进行 初始化复原(deinit)之后,才能够进行正确设定PWM的频率。
pwm0 = PWM(0, freq=10000, duty=20)
pwm1 = PWM(1, freq=10000, duty=100)
pwm0.deinit()
pwm1.deinit()
pwm0.init(freq=10000)
pwm1.init(freq=10000)
§03 相关文件
一、machine_pwm
1、头文件
/* machine_pwm.h */
#ifndef __MACHINE_PWM_H__
#define __MACHINE_PWM_H__
#include "py/runtime.h"
#include "machine_pin.h"
#include "hal_tim_16b.h"
#define MACHIEN_PWM_CH_NUM 8u
#define MACHINE_PWM_DUTY_NUM 1000u
/* multiple channels share the same tim counter. */
typedef struct
{
uint32_t active_channels; /* mask. */
uint32_t freq; /* pwm freq, the step_freq_hz = freq_hz / MACHINE_PWM_DUTY_NUM. */
} machine_pwm_port_conf_t;
/* for each channel. */
typedef struct
{
uint32_t duty; /* max to MACHINE_PWM_DUTY_NUM. */
} machine_pwm_ch_conf_t;
/* PWM class instance configuration structure. */
typedef struct
{
mp_obj_base_t base; // object base class.
const machine_pin_obj_t * pwm_pin_obj;
uint32_t pwm_pin_af;
TIM_16B_Type * tim_port;
machine_pwm_port_conf_t *port_conf;
uint32_t tim_ch;
machine_pwm_ch_conf_t *ch_conf;
uint32_t pwm_id;
} machine_pwm_obj_t;
extern const machine_pwm_obj_t * machine_pwm_objs[];
const machine_pwm_obj_t *pwm_find(mp_obj_t user_obj);
extern const mp_obj_type_t machine_pwm_type;
#endif /* __MACHINE_PIN_H__ */
2、C文件
/* machine_pwm.c */
#include <stdio.h>
#include "machine_pwm.h"
#include "hal_tim_16b.h"
#include "hal_gpio.h"
#include "board_init.h"
/*
* Declerations.
*/
/* Local functions. */
STATIC mp_obj_t machine_pwm_obj_init_helper(const machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
/* Class method, which would be called by class name. */
STATIC void machine_pwm_obj_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind);
//STATIC mp_obj_t machine_pwm_obj_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args);
mp_obj_t machine_pwm_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
/* Instance methods, which would be called by class instance name. */
STATIC mp_obj_t machine_pwm_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args);
/*
* Functions.
*/
/* init(). */
STATIC mp_obj_t machine_pwm_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args)
{
/* args[0] is machine_pin_obj_t. */
//printf("machine_pwm_init().\r\n");
return machine_pwm_obj_init_helper(args[0], n_args - 1, args + 1, kw_args);
}
MP_DEFINE_CONST_FUN_OBJ_KW(machine_pwm_init_obj, 1, machine_pwm_init);
/* deinit(). */
STATIC mp_obj_t machine_pwm_deinit(mp_obj_t self_in)
{
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in);
// Valid channel?
if (self->tim_ch < 4u)
{
// Mark it unused, and tell the hardware to stop routing
self->port_conf->active_channels &= ~(1u << (self->tim_ch) );
/* disable the pwm output. */
TIM_16B_OutputCompareConf_Type tim_outcmp_conf;
tim_outcmp_conf.ChannelValue = 0u; /* no duty. */
tim_outcmp_conf.EnableFastOutput = false;
tim_outcmp_conf.EnablePreLoadChannelValue = false;
tim_outcmp_conf.RefOutMode =TIM_16B_OutputCompareRefOut_None; /* disable output signal. */
tim_outcmp_conf.ClearRefOutOnFault = false;
tim_outcmp_conf.PinPolaryConf = NULL; /* disable output pin. */
TIM_16B_EnableOutputCompare(self->tim_port, self->tim_ch, &tim_outcmp_conf);
/* stop the timer when necessary. */
if ( 0u == (self->port_conf->active_channels) )
{
TIM_16B_Stop(self->tim_port);
}
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pwm_deinit_obj, machine_pwm_deinit);
/* parameter list. */
typedef enum
{
PWM_INIT_ARG_freq = 0,
PWM_INIT_ARG_duty,
} machine_pwm_init_arg_t;
STATIC mp_obj_t machine_pwm_obj_init_helper (
const machine_pwm_obj_t *self, /* machine_pwm_obj_t类型的变量,包含硬件信息 */
size_t n_args, /* 位置参数数量 */
const mp_obj_t *pos_args, /* 位置参数清单 */
mp_map_t *kw_args ) /* 关键字参数清单结构体 */
{
//printf("%machine_pwm_obj_init_helper().\r\n");
static const mp_arg_t allowed_args[] =
{
//[PWM_INIT_ARG_MODE] { MP_QSTR_init , MP_ARG_REQUIRED | MP_ARG_BOOL, {.u_bool = false} },
[PWM_INIT_ARG_freq] { MP_QSTR_freq , MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
[PWM_INIT_ARG_duty] { MP_QSTR_duty , MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
};
/* 解析参数 */
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
int freq = args[PWM_INIT_ARG_freq].u_int;
//printf("freq = %d\r\n", freq);
//printf("active_channels = %ld\r\n", self->port_conf->active_channels);
if (freq < 0)
{
mp_raise_ValueError(MP_ERROR_TEXT("freq value is not available"));
}
int duty = args[PWM_INIT_ARG_duty].u_int;
if ( (duty < 0) || (duty > MACHINE_PWM_DUTY_NUM) )
{
mp_raise_ValueError(MP_ERROR_TEXT("duty value is not available"));
}
/* setup pinmux. */
GPIO_Init_Type gpio_init;
gpio_init.Speed = GPIO_Speed_50MHz;
gpio_init.Pins = ( 1u << (self->pwm_pin_obj->gpio_pin) );
gpio_init.PinMode = GPIO_PinMode_AF_PushPull;
GPIO_Init(self->pwm_pin_obj->gpio_port, &gpio_init);
/* Init the timer when necessary. */
if ((self->port_conf->active_channels & 0xf) == 0)
{
TIM_16B_Init_Type tim_init;
tim_init.ClockFreqHz = CLOCK_SYS_FREQ;
tim_init.StepFreqHz = MACHINE_PWM_DUTY_NUM * freq;
tim_init.Period = MACHINE_PWM_DUTY_NUM;
tim_init.EnablePreloadPeriod = false;
tim_init.PeriodMode = TIM_16B_PeriodMode_Continuous;
TIM_16B_Init(self->tim_port, &tim_init);
TIM_16B_Start(self->tim_port);
self->port_conf->freq = freq;
//printf("set freq.\r\n");
}
/* add channel. */
TIM_16B_PinPolaryConf_Type tim_pinpol_conf;
tim_pinpol_conf.PinPolary = TIM_16B_PinPolary_High;
tim_pinpol_conf.NPinPolary = TIM_16B_PinPolary_Low;
TIM_16B_OutputCompareConf_Type tim_outcomp_conf;
tim_outcomp_conf.ChannelValue = duty;
tim_outcomp_conf.EnableFastOutput = false;
tim_outcomp_conf.EnablePreLoadChannelValue = false;
tim_outcomp_conf.RefOutMode = TIM_16B_OutputCompareRefOut_FallingEdgeOnMatch;
tim_outcomp_conf.ClearRefOutOnFault = false;
tim_outcomp_conf.PinPolaryConf = &tim_pinpol_conf;
TIM_16B_EnableOutputCompare(self->tim_port, self->tim_ch, &tim_outcomp_conf);
self->ch_conf->duty = duty;
self->port_conf->active_channels |= (1u << (self->tim_ch));
return mp_const_none;
}
/* duty(). */
STATIC mp_obj_t machine_pwm_duty(size_t n_args, const mp_obj_t *args)
{
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) /* get */
{
return MP_OBJ_NEW_SMALL_INT(self->ch_conf->duty);
}
/* set */
int duty = mp_obj_get_int(args[1]);
if ((duty < 0) || (duty > MACHINE_PWM_DUTY_NUM) )
{
mp_raise_ValueError(MP_ERROR_TEXT("freq value is not available"));
}
TIM_16B_PutChannelValue(self->tim_port, self->tim_ch, duty);
self->ch_conf->duty = duty;
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_duty_obj, 1, 2, machine_pwm_duty);
/* freq(). */
STATIC mp_obj_t machine_pwm_freq(size_t n_args, const mp_obj_t *args)
{
machine_pwm_obj_t *self = MP_OBJ_TO_PTR(args[0]);
if (n_args == 1) /* get */
{
return MP_OBJ_NEW_SMALL_INT(self->port_conf->freq);
}
/* set */
int freq = mp_obj_get_int(args[1]);
if (freq < 0)
{
mp_raise_ValueError(MP_ERROR_TEXT("freq value is not available"));
}
if ((self->port_conf->active_channels & 0xf) != 0u)
{
mp_raise_ValueError(MP_ERROR_TEXT("freq can not be changed when the current timer is sharing."));
}
TIM_16B_Stop(self->tim_port);
TIM_16B_Init_Type tim_init;
tim_init.ClockFreqHz = CLOCK_SYS_FREQ;
tim_init.StepFreqHz = MACHINE_PWM_DUTY_NUM * freq;
tim_init.Period = MACHINE_PWM_DUTY_NUM;
tim_init.EnablePreloadPeriod = false;
tim_init.PeriodMode = TIM_16B_PeriodMode_Continuous;
TIM_16B_Init(self->tim_port, &tim_init);
TIM_16B_Start(self->tim_port);
self->port_conf->freq = freq;
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pwm_freq_obj, 1, 2, machine_pwm_freq);
STATIC void machine_pwm_obj_print(const mp_print_t *print, mp_obj_t o, mp_print_kind_t kind)
{
/* o is the machine_pin_obj_t. */
(void)kind;
const machine_pwm_obj_t *self = MP_OBJ_TO_PTR(o);
if ( 0u != (self->port_conf->active_channels & (1u << (self->tim_ch))) )
{
mp_printf(print, "PMW(%d, freq=%d, duty=%d)", self->pwm_id, self->port_conf->freq, self->ch_conf->duty);
}
else
{
mp_printf(print, "PMW(%d)", self->pwm_id);
}
}
#if 0
STATIC mp_obj_t machine_pwm_obj_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args)
{
/* self_in is machine_pin_obj_t. */
mp_arg_check_num(n_args, n_kw, 0, 1, false);
//machine_pin_obj_t *self = self_in;
if ( n_args == 0 ) /* read value. */
{
return machine_pwm_read_u16(self_in);
}
else /* write value. */
{
return mp_const_none;
}
}
#endif
/* return an instance of machine_pin_obj_t. */
mp_obj_t machine_pwm_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args)
{
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
const machine_pwm_obj_t *pwm = pwm_find(args[0]);
if ( (n_args >= 1) || (n_kw >= 0) )
{
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, args + n_args); /* 将关键字参数从总的参数列表中提取出来,单独封装成kw_args。 */
machine_pwm_obj_init_helper(pwm, n_args - 1, args + 1, &kw_args);
}
return (mp_obj_t)pwm;
}
/* class locals_dict_table. */
STATIC const mp_rom_map_elem_t machine_pwm_locals_dict_table[] =
{
/* Class instance methods. */
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_pwm_init_obj ) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_pwm_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_pwm_freq_obj ) },
{ MP_ROM_QSTR(MP_QSTR_duty), MP_ROM_PTR(&machine_pwm_duty_obj ) },
};
STATIC MP_DEFINE_CONST_DICT(machine_pwm_locals_dict, machine_pwm_locals_dict_table);
const mp_obj_type_t machine_pwm_type =
{
{ &mp_type_type },
.name = MP_QSTR_PWM,
.print = machine_pwm_obj_print, /* __repr__(), which would be called by print(<ClassName>). */
//.call = machine_pwm_obj_call, /* __call__(), which can be called as <ClassName>(). */
.make_new = machine_pwm_obj_make_new, /* create new class instance. */
.locals_dict = (mp_obj_dict_t *)&machine_pwm_locals_dict,
};
/*
* User functions.
*/
/* 格式化PMW对象,传入参数无论是已经初始化好的PWM对象,还是一个表示PWM清单中的索引编号,通过本函数都返回一个期望的pwm对象。 */
const machine_pwm_obj_t *pwm_find(mp_obj_t user_obj)
{
//const machine_pin_obj_t *pin_obj;
/* 如果传入参数本身就是一个PWM的实例,则直接送出这个PWM。 */
if ( mp_obj_is_type(user_obj, &machine_pwm_type) )
{
return user_obj;
}
/* 如果传入参数本身就是一个Pin的实例,则通过倒排查询找到包含这个Pin对象的PWM通道。 */
if ( mp_obj_is_type(user_obj, &machine_pin_type) )
{
for (uint32_t i = 0u; i < MACHIEN_PWM_CH_NUM; i++)
{
machine_pin_obj_t * pin_obj = (machine_pin_obj_t *)(user_obj);
if ( (pin_obj->gpio_port == machine_pwm_objs[i]->pwm_pin_obj->gpio_port)
&& (pin_obj->gpio_pin == machine_pwm_objs[i]->pwm_pin_obj->gpio_pin) )
{
return machine_pwm_objs[i];
}
}
}
/* 如果传入参数是一个PWM通道号,则通过索引在PWM清单中找到这个通道,然后送出这个通道。 */
if ( mp_obj_is_small_int(user_obj) )
{
uint8_t pwm_idx = MP_OBJ_SMALL_INT_VALUE(user_obj);
if ( pwm_idx < MACHIEN_PWM_CH_NUM )
{
return machine_pwm_objs[pwm_idx];
}
}
mp_raise_ValueError(MP_ERROR_TEXT("PWM doesn't exist"));
}
/* EOF. */
二、machine管脚配置
/* machine_pin_board_pins.c */
#include "machine_pin.h"
#include "machine_adc.h"
#include "machine_dac.h"
#include "machine_uart.h"
#include "machine_spi.h"
#include "machine_pwm.h"
#include "hal_common.h"
#include "hal_gpio.h"
extern const mp_obj_type_t machine_pin_type;
const uint32_t machine_pin_board_pins_num = 144;
const machine_pin_obj_t pin_PE2 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE2, .gpio_port = GPIOE, .gpio_pin = 2 };
const machine_pin_obj_t pin_PE3 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE3, .gpio_port = GPIOE, .gpio_pin = 3 };
const machine_pin_obj_t pin_PE4 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE4, .gpio_port = GPIOE, .gpio_pin = 4 };
const machine_pin_obj_t pin_PE5 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE5, .gpio_port = GPIOE, .gpio_pin = 5 };
const machine_pin_obj_t pin_PE6 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE6, .gpio_port = GPIOE, .gpio_pin = 6 };
const machine_pin_obj_t pin_PC13 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC13, .gpio_port = GPIOC, .gpio_pin = 13 };
const machine_pin_obj_t pin_PC14 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC14, .gpio_port = GPIOC, .gpio_pin = 14 };
const machine_pin_obj_t pin_PC15 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC15, .gpio_port = GPIOC, .gpio_pin = 15 };
const machine_pin_obj_t pin_PF0 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF0, .gpio_port = GPIOF, .gpio_pin = 0 };
const machine_pin_obj_t pin_PF1 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF1, .gpio_port = GPIOF, .gpio_pin = 1 };
const machine_pin_obj_t pin_PF2 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF2, .gpio_port = GPIOF, .gpio_pin = 2 };
const machine_pin_obj_t pin_PF3 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF3, .gpio_port = GPIOF, .gpio_pin = 3 };
const machine_pin_obj_t pin_PF4 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF4, .gpio_port = GPIOF, .gpio_pin = 4 };
const machine_pin_obj_t pin_PF5 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF5, .gpio_port = GPIOF, .gpio_pin = 5 };
const machine_pin_obj_t pin_PF6 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF6, .gpio_port = GPIOF, .gpio_pin = 6 };
const machine_pin_obj_t pin_PF7 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF7, .gpio_port = GPIOF, .gpio_pin = 7 };
const machine_pin_obj_t pin_PF8 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF8, .gpio_port = GPIOF, .gpio_pin = 8 };
const machine_pin_obj_t pin_PF9 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF9, .gpio_port = GPIOF, .gpio_pin = 9 };
const machine_pin_obj_t pin_PF10 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF10, .gpio_port = GPIOF, .gpio_pin = 10 };
const machine_pin_obj_t pin_PH0 = { .base = { &machine_pin_type }, .name = MP_QSTR_PH0, .gpio_port = GPIOH, .gpio_pin = 0 };
const machine_pin_obj_t pin_PH1 = { .base = { &machine_pin_type }, .name = MP_QSTR_PH1, .gpio_port = GPIOH, .gpio_pin = 1 };
const machine_pin_obj_t pin_PC0 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC0, .gpio_port = GPIOC, .gpio_pin = 0 };
const machine_pin_obj_t pin_PC1 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC1, .gpio_port = GPIOC, .gpio_pin = 1 };
const machine_pin_obj_t pin_PC2 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC2, .gpio_port = GPIOC, .gpio_pin = 2 };
const machine_pin_obj_t pin_PC3 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC3, .gpio_port = GPIOC, .gpio_pin = 3 };
const machine_pin_obj_t pin_PA0 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA0, .gpio_port = GPIOA, .gpio_pin = 0 };
const machine_pin_obj_t pin_PA1 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA1, .gpio_port = GPIOA, .gpio_pin = 1 };
const machine_pin_obj_t pin_PA2 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA2, .gpio_port = GPIOA, .gpio_pin = 2 };
const machine_pin_obj_t pin_PA3 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA3, .gpio_port = GPIOA, .gpio_pin = 3 };
const machine_pin_obj_t pin_PA4 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA4, .gpio_port = GPIOA, .gpio_pin = 4 };
const machine_pin_obj_t pin_PA5 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA5, .gpio_port = GPIOA, .gpio_pin = 5 };
const machine_pin_obj_t pin_PA6 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA6, .gpio_port = GPIOA, .gpio_pin = 6 };
const machine_pin_obj_t pin_PA7 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA7, .gpio_port = GPIOA, .gpio_pin = 7 };
const machine_pin_obj_t pin_PC4 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC4, .gpio_port = GPIOC, .gpio_pin = 4 };
const machine_pin_obj_t pin_PC5 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC5, .gpio_port = GPIOC, .gpio_pin = 5 };
const machine_pin_obj_t pin_PB0 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB0, .gpio_port = GPIOB, .gpio_pin = 0 };
const machine_pin_obj_t pin_PB1 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB1, .gpio_port = GPIOB, .gpio_pin = 1 };
const machine_pin_obj_t pin_PB2 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB2, .gpio_port = GPIOB, .gpio_pin = 2 };
const machine_pin_obj_t pin_PF11 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF11, .gpio_port = GPIOF, .gpio_pin = 11 };
const machine_pin_obj_t pin_PF12 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF12, .gpio_port = GPIOF, .gpio_pin = 12 };
const machine_pin_obj_t pin_PF13 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF13, .gpio_port = GPIOF, .gpio_pin = 13 };
const machine_pin_obj_t pin_PF14 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF14, .gpio_port = GPIOF, .gpio_pin = 14 };
const machine_pin_obj_t pin_PF15 = { .base = { &machine_pin_type }, .name = MP_QSTR_PF15, .gpio_port = GPIOF, .gpio_pin = 15 };
const machine_pin_obj_t pin_PG0 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG0, .gpio_port = GPIOG, .gpio_pin = 0 };
const machine_pin_obj_t pin_PG1 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG1, .gpio_port = GPIOG, .gpio_pin = 1 };
const machine_pin_obj_t pin_PE7 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE7, .gpio_port = GPIOE, .gpio_pin = 7 };
const machine_pin_obj_t pin_PE8 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE8, .gpio_port = GPIOE, .gpio_pin = 8 };
const machine_pin_obj_t pin_PE9 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE9, .gpio_port = GPIOE, .gpio_pin = 9 };
const machine_pin_obj_t pin_PE10 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE10, .gpio_port = GPIOE, .gpio_pin = 10 };
const machine_pin_obj_t pin_PE11 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE11, .gpio_port = GPIOE, .gpio_pin = 11 };
const machine_pin_obj_t pin_PE12 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE12, .gpio_port = GPIOE, .gpio_pin = 12 };
const machine_pin_obj_t pin_PE13 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE13, .gpio_port = GPIOE, .gpio_pin = 13 };
const machine_pin_obj_t pin_PE14 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE14, .gpio_port = GPIOE, .gpio_pin = 14 };
const machine_pin_obj_t pin_PE15 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE15, .gpio_port = GPIOE, .gpio_pin = 15 };
const machine_pin_obj_t pin_PB10 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB10, .gpio_port = GPIOB, .gpio_pin = 10 };
const machine_pin_obj_t pin_PB11 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB11, .gpio_port = GPIOB, .gpio_pin = 11 };
const machine_pin_obj_t pin_PB12 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB12, .gpio_port = GPIOB, .gpio_pin = 12 };
const machine_pin_obj_t pin_PB13 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB13, .gpio_port = GPIOB, .gpio_pin = 13 };
const machine_pin_obj_t pin_PB14 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB14, .gpio_port = GPIOB, .gpio_pin = 14 };
const machine_pin_obj_t pin_PB15 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB15, .gpio_port = GPIOB, .gpio_pin = 15 };
const machine_pin_obj_t pin_PD8 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD8, .gpio_port = GPIOD, .gpio_pin = 8 };
const machine_pin_obj_t pin_PD9 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD9, .gpio_port = GPIOD, .gpio_pin = 9 };
const machine_pin_obj_t pin_PD10 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD10, .gpio_port = GPIOD, .gpio_pin = 10 };
const machine_pin_obj_t pin_PD11 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD11, .gpio_port = GPIOD, .gpio_pin = 11 };
const machine_pin_obj_t pin_PD12 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD12, .gpio_port = GPIOD, .gpio_pin = 12 };
const machine_pin_obj_t pin_PD13 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD13, .gpio_port = GPIOD, .gpio_pin = 13 };
const machine_pin_obj_t pin_PD14 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD14, .gpio_port = GPIOD, .gpio_pin = 14 };
const machine_pin_obj_t pin_PD15 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD15, .gpio_port = GPIOD, .gpio_pin = 15 };
const machine_pin_obj_t pin_PG2 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG2, .gpio_port = GPIOG, .gpio_pin = 2 };
const machine_pin_obj_t pin_PG3 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG3, .gpio_port = GPIOG, .gpio_pin = 3 };
const machine_pin_obj_t pin_PG4 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG4, .gpio_port = GPIOG, .gpio_pin = 4 };
const machine_pin_obj_t pin_PG5 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG5, .gpio_port = GPIOG, .gpio_pin = 5 };
const machine_pin_obj_t pin_PG6 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG6, .gpio_port = GPIOG, .gpio_pin = 6 };
const machine_pin_obj_t pin_PG7 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG7, .gpio_port = GPIOG, .gpio_pin = 7 };
const machine_pin_obj_t pin_PG8 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG8, .gpio_port = GPIOG, .gpio_pin = 8 };
const machine_pin_obj_t pin_PC6 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC6, .gpio_port = GPIOC, .gpio_pin = 6 };
const machine_pin_obj_t pin_PC7 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC7, .gpio_port = GPIOC, .gpio_pin = 7 };
const machine_pin_obj_t pin_PC8 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC8, .gpio_port = GPIOC, .gpio_pin = 8 };
const machine_pin_obj_t pin_PC9 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC9, .gpio_port = GPIOC, .gpio_pin = 9 };
const machine_pin_obj_t pin_PA8 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA8, .gpio_port = GPIOA, .gpio_pin = 8 };
const machine_pin_obj_t pin_PA9 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA9, .gpio_port = GPIOA, .gpio_pin = 9 };
const machine_pin_obj_t pin_PA10 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA10, .gpio_port = GPIOA, .gpio_pin = 10 };
const machine_pin_obj_t pin_PA11 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA11, .gpio_port = GPIOA, .gpio_pin = 11 };
const machine_pin_obj_t pin_PA12 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA12, .gpio_port = GPIOA, .gpio_pin = 12 };
const machine_pin_obj_t pin_PA13 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA13, .gpio_port = GPIOA, .gpio_pin = 13 };
const machine_pin_obj_t pin_PH2 = { .base = { &machine_pin_type }, .name = MP_QSTR_PH2, .gpio_port = GPIOH, .gpio_pin = 2 };
const machine_pin_obj_t pin_PA14 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA14, .gpio_port = GPIOA, .gpio_pin = 14 };
const machine_pin_obj_t pin_PA15 = { .base = { &machine_pin_type }, .name = MP_QSTR_PA15, .gpio_port = GPIOA, .gpio_pin = 15 };
const machine_pin_obj_t pin_PC10 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC10, .gpio_port = GPIOC, .gpio_pin = 10 };
const machine_pin_obj_t pin_PC11 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC11, .gpio_port = GPIOC, .gpio_pin = 11 };
const machine_pin_obj_t pin_PC12 = { .base = { &machine_pin_type }, .name = MP_QSTR_PC12, .gpio_port = GPIOC, .gpio_pin = 12 };
const machine_pin_obj_t pin_PD0 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD0, .gpio_port = GPIOD, .gpio_pin = 0 };
const machine_pin_obj_t pin_PD1 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD1, .gpio_port = GPIOD, .gpio_pin = 1 };
const machine_pin_obj_t pin_PD2 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD2, .gpio_port = GPIOD, .gpio_pin = 2 };
const machine_pin_obj_t pin_PD3 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD3, .gpio_port = GPIOD, .gpio_pin = 3 };
const machine_pin_obj_t pin_PD4 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD4, .gpio_port = GPIOD, .gpio_pin = 4 };
const machine_pin_obj_t pin_PD5 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD5, .gpio_port = GPIOD, .gpio_pin = 5 };
const machine_pin_obj_t pin_PD6 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD6, .gpio_port = GPIOD, .gpio_pin = 6 };
const machine_pin_obj_t pin_PD7 = { .base = { &machine_pin_type }, .name = MP_QSTR_PD7, .gpio_port = GPIOD, .gpio_pin = 7 };
const machine_pin_obj_t pin_PG9 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG9, .gpio_port = GPIOG, .gpio_pin = 9 };
const machine_pin_obj_t pin_PG10 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG10, .gpio_port = GPIOG, .gpio_pin = 10 };
const machine_pin_obj_t pin_PG11 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG11, .gpio_port = GPIOG, .gpio_pin = 11 };
const machine_pin_obj_t pin_PG12 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG12, .gpio_port = GPIOG, .gpio_pin = 12 };
const machine_pin_obj_t pin_PG13 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG13, .gpio_port = GPIOG, .gpio_pin = 13 };
const machine_pin_obj_t pin_PG14 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG14, .gpio_port = GPIOG, .gpio_pin = 14 };
const machine_pin_obj_t pin_PG15 = { .base = { &machine_pin_type }, .name = MP_QSTR_PG15, .gpio_port = GPIOG, .gpio_pin = 15 };
const machine_pin_obj_t pin_PB3 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB3, .gpio_port = GPIOB, .gpio_pin = 3 };
const machine_pin_obj_t pin_PB4 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB4, .gpio_port = GPIOB, .gpio_pin = 4 };
const machine_pin_obj_t pin_PB5 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB5, .gpio_port = GPIOB, .gpio_pin = 5 };
const machine_pin_obj_t pin_PB6 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB6, .gpio_port = GPIOB, .gpio_pin = 6 };
const machine_pin_obj_t pin_PB7 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB7, .gpio_port = GPIOB, .gpio_pin = 7 };
const machine_pin_obj_t pin_PH3 = { .base = { &machine_pin_type }, .name = MP_QSTR_PH3, .gpio_port = GPIOH, .gpio_pin = 3 };
const machine_pin_obj_t pin_PB8 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB8, .gpio_port = GPIOB, .gpio_pin = 8 };
const machine_pin_obj_t pin_PB9 = { .base = { &machine_pin_type }, .name = MP_QSTR_PB9, .gpio_port = GPIOB, .gpio_pin = 9 };
const machine_pin_obj_t pin_PE0 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE0, .gpio_port = GPIOE, .gpio_pin = 0 };
const machine_pin_obj_t pin_PE1 = { .base = { &machine_pin_type }, .name = MP_QSTR_PE1, .gpio_port = GPIOE, .gpio_pin = 1 };
const machine_pin_obj_t* machine_pin_board_pins[] =
{
&pin_PE2,
&pin_PE3,
&pin_PE4,
&pin_PE5,
&pin_PE6,
NULL, /* VBAT */
&pin_PC13,
&pin_PC14,
&pin_PC15,
&pin_PF0,
&pin_PF1,
&pin_PF2,
&pin_PF3,
&pin_PF4,
&pin_PF5,
NULL, /* VSS_5 */
NULL, /* VDD_5 */
&pin_PF6,
&pin_PF7,
&pin_PF8,
&pin_PF9,
&pin_PF10,
&pin_PH0,
&pin_PH1,
NULL, /* NRST */
&pin_PC0,
&pin_PC1,
&pin_PC2,
&pin_PC3,
NULL, /* VSSA */
NULL, /* VREF_N */
NULL, /* VREF_P */
NULL, /* VDDA */
&pin_PA0,
&pin_PA1,
&pin_PA2,
&pin_PA3,
NULL, /* VSS_4 */
NULL, /* VDD_4 */
&pin_PA4,
&pin_PA5,
&pin_PA6,
&pin_PA7,
&pin_PC4,
&pin_PC5,
&pin_PB0,
&pin_PB1,
&pin_PB2,
&pin_PF11,
&pin_PF12,
NULL, /* VSS_6 */
NULL, /* VDD_6 */
&pin_PF13,
&pin_PF14,
&pin_PF15,
&pin_PG0,
&pin_PG1,
&pin_PE7,
&pin_PE8,
&pin_PE9,
NULL, /* VSS_7 */
NULL, /* VDD_7 */
&pin_PE10,
&pin_PE11,
&pin_PE12,
&pin_PE13,
&pin_PE14,
&pin_PE15,
&pin_PB10,
&pin_PB11,
NULL, /* VSS_1 */
NULL, /* VDD_1 */
&pin_PB12,
&pin_PB13,
&pin_PB14,
&pin_PB15,
&pin_PD8,
&pin_PD9,
&pin_PD10,
&pin_PD11,
&pin_PD12,
&pin_PD13,
NULL, /* VSS_8 */
NULL, /* VDD_8 */
&pin_PD14,
&pin_PD15,
&pin_PG2,
&pin_PG3,
&pin_PG4,
&pin_PG5,
&pin_PG6,
&pin_PG7,
&pin_PG8,
NULL, /* VSS_9 */
NULL, /* VDD_9 */
&pin_PC6,
&pin_PC7,
&pin_PC8,
&pin_PC9,
&pin_PA8,
&pin_PA9,
&pin_PA10,
&pin_PA11,
&pin_PA12,
&pin_PA13,
&pin_PH2,
NULL, /* VSS_2 */
NULL, /* VDD_2 */
&pin_PA14,
&pin_PA15,
&pin_PC10,
&pin_PC11,
&pin_PC12,
&pin_PD0,
&pin_PD1,
&pin_PD2,
&pin_PD3,
&pin_PD4,
&pin_PD5,
NULL, /* VSS_10 */
NULL, /* VDD_10 */
&pin_PD6,
&pin_PD7,
&pin_PG9,
&pin_PG10,
&pin_PG11,
&pin_PG12,
&pin_PG13,
&pin_PG14,
NULL, /* VSS_11 */
NULL, /* VDD_11 */
&pin_PG15,
&pin_PB3,
&pin_PB4,
&pin_PB5,
&pin_PB6,
&pin_PB7,
&pin_PH3,
&pin_PB8,
&pin_PB9,
&pin_PE0,
&pin_PE1,
NULL, /* VSS_3 */
NULL, /* VDD_3 */
};
STATIC const mp_rom_map_elem_t machine_pin_board_pins_locals_dict_table[] =
{
{ MP_ROM_QSTR(MP_QSTR_PE2), MP_ROM_PTR(&pin_PE2) },
{ MP_ROM_QSTR(MP_QSTR_PE3), MP_ROM_PTR(&pin_PE3) },
{ MP_ROM_QSTR(MP_QSTR_PE4), MP_ROM_PTR(&pin_PE4) },
{ MP_ROM_QSTR(MP_QSTR_PE5), MP_ROM_PTR(&pin_PE5) },
{ MP_ROM_QSTR(MP_QSTR_PE6), MP_ROM_PTR(&pin_PE6) },
{ MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13) },
{ MP_ROM_QSTR(MP_QSTR_PC14), MP_ROM_PTR(&pin_PC14) },
{ MP_ROM_QSTR(MP_QSTR_PC15), MP_ROM_PTR(&pin_PC15) },
{ MP_ROM_QSTR(MP_QSTR_PF0), MP_ROM_PTR(&pin_PF0) },
{ MP_ROM_QSTR(MP_QSTR_PF1), MP_ROM_PTR(&pin_PF1) },
{ MP_ROM_QSTR(MP_QSTR_PF2), MP_ROM_PTR(&pin_PF2) },
{ MP_ROM_QSTR(MP_QSTR_PF3), MP_ROM_PTR(&pin_PF3) },
{ MP_ROM_QSTR(MP_QSTR_PF4), MP_ROM_PTR(&pin_PF4) },
{ MP_ROM_QSTR(MP_QSTR_PF5), MP_ROM_PTR(&pin_PF5) },
{ MP_ROM_QSTR(MP_QSTR_PF6), MP_ROM_PTR(&pin_PF6) },
{ MP_ROM_QSTR(MP_QSTR_PF7), MP_ROM_PTR(&pin_PF7) },
{ MP_ROM_QSTR(MP_QSTR_PF8), MP_ROM_PTR(&pin_PF8) },
{ MP_ROM_QSTR(MP_QSTR_PF9), MP_ROM_PTR(&pin_PF9) },
{ MP_ROM_QSTR(MP_QSTR_PF10), MP_ROM_PTR(&pin_PF10) },
{ MP_ROM_QSTR(MP_QSTR_PH0), MP_ROM_PTR(&pin_PH0) },
{ MP_ROM_QSTR(MP_QSTR_PH1), MP_ROM_PTR(&pin_PH1) },
{ MP_ROM_QSTR(MP_QSTR_PC0), MP_ROM_PTR(&pin_PC0) },
{ MP_ROM_QSTR(MP_QSTR_PC1), MP_ROM_PTR(&pin_PC1) },
{ MP_ROM_QSTR(MP_QSTR_PC2), MP_ROM_PTR(&pin_PC2) },
{ MP_ROM_QSTR(MP_QSTR_PC3), MP_ROM_PTR(&pin_PC3) },
{ MP_ROM_QSTR(MP_QSTR_PA0), MP_ROM_PTR(&pin_PA0) },
{ MP_ROM_QSTR(MP_QSTR_PA1), MP_ROM_PTR(&pin_PA1) },
{ MP_ROM_QSTR(MP_QSTR_PA2), MP_ROM_PTR(&pin_PA2) },
{ MP_ROM_QSTR(MP_QSTR_PA3), MP_ROM_PTR(&pin_PA3) },
{ MP_ROM_QSTR(MP_QSTR_PA4), MP_ROM_PTR(&pin_PA4) },
{ MP_ROM_QSTR(MP_QSTR_PA5), MP_ROM_PTR(&pin_PA5) },
{ MP_ROM_QSTR(MP_QSTR_PA6), MP_ROM_PTR(&pin_PA6) },
{ MP_ROM_QSTR(MP_QSTR_PA7), MP_ROM_PTR(&pin_PA7) },
{ MP_ROM_QSTR(MP_QSTR_PC4), MP_ROM_PTR(&pin_PC4) },
{ MP_ROM_QSTR(MP_QSTR_PC5), MP_ROM_PTR(&pin_PC5) },
{ MP_ROM_QSTR(MP_QSTR_PB0), MP_ROM_PTR(&pin_PB0) },
{ MP_ROM_QSTR(MP_QSTR_PB1), MP_ROM_PTR(&pin_PB1) },
{ MP_ROM_QSTR(MP_QSTR_PB2), MP_ROM_PTR(&pin_PB2) },
{ MP_ROM_QSTR(MP_QSTR_PF11), MP_ROM_PTR(&pin_PF11) },
{ MP_ROM_QSTR(MP_QSTR_PF12), MP_ROM_PTR(&pin_PF12) },
{ MP_ROM_QSTR(MP_QSTR_PF13), MP_ROM_PTR(&pin_PF13) },
{ MP_ROM_QSTR(MP_QSTR_PF14), MP_ROM_PTR(&pin_PF14) },
{ MP_ROM_QSTR(MP_QSTR_PF15), MP_ROM_PTR(&pin_PF15) },
{ MP_ROM_QSTR(MP_QSTR_PG0), MP_ROM_PTR(&pin_PG0) },
{ MP_ROM_QSTR(MP_QSTR_PG1), MP_ROM_PTR(&pin_PG1) },
{ MP_ROM_QSTR(MP_QSTR_PE7), MP_ROM_PTR(&pin_PE7) },
{ MP_ROM_QSTR(MP_QSTR_PE8), MP_ROM_PTR(&pin_PE8) },
{ MP_ROM_QSTR(MP_QSTR_PE9), MP_ROM_PTR(&pin_PE9) },
{ MP_ROM_QSTR(MP_QSTR_PE10), MP_ROM_PTR(&pin_PE10) },
{ MP_ROM_QSTR(MP_QSTR_PE11), MP_ROM_PTR(&pin_PE11) },
{ MP_ROM_QSTR(MP_QSTR_PE12), MP_ROM_PTR(&pin_PE12) },
{ MP_ROM_QSTR(MP_QSTR_PE13), MP_ROM_PTR(&pin_PE13) },
{ MP_ROM_QSTR(MP_QSTR_PE14), MP_ROM_PTR(&pin_PE14) },
{ MP_ROM_QSTR(MP_QSTR_PE15), MP_ROM_PTR(&pin_PE15) },
{ MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) },
{ MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },
{ MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13) },
{ MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15) },
{ MP_ROM_QSTR(MP_QSTR_PD8), MP_ROM_PTR(&pin_PD8) },
{ MP_ROM_QSTR(MP_QSTR_PD9), MP_ROM_PTR(&pin_PD9) },
{ MP_ROM_QSTR(MP_QSTR_PD10), MP_ROM_PTR(&pin_PD10) },
{ MP_ROM_QSTR(MP_QSTR_PD11), MP_ROM_PTR(&pin_PD11) },
{ MP_ROM_QSTR(MP_QSTR_PD12), MP_ROM_PTR(&pin_PD12) },
{ MP_ROM_QSTR(MP_QSTR_PD13), MP_ROM_PTR(&pin_PD13) },
{ MP_ROM_QSTR(MP_QSTR_PD14), MP_ROM_PTR(&pin_PD14) },
{ MP_ROM_QSTR(MP_QSTR_PD15), MP_ROM_PTR(&pin_PD15) },
{ MP_ROM_QSTR(MP_QSTR_PG2), MP_ROM_PTR(&pin_PG2) },
{ MP_ROM_QSTR(MP_QSTR_PG3), MP_ROM_PTR(&pin_PG3) },
{ MP_ROM_QSTR(MP_QSTR_PG4), MP_ROM_PTR(&pin_PG4) },
{ MP_ROM_QSTR(MP_QSTR_PG5), MP_ROM_PTR(&pin_PG5) },
{ MP_ROM_QSTR(MP_QSTR_PG6), MP_ROM_PTR(&pin_PG6) },
{ MP_ROM_QSTR(MP_QSTR_PG7), MP_ROM_PTR(&pin_PG7) },
{ MP_ROM_QSTR(MP_QSTR_PG8), MP_ROM_PTR(&pin_PG8) },
{ MP_ROM_QSTR(MP_QSTR_PC6), MP_ROM_PTR(&pin_PC6) },
{ MP_ROM_QSTR(MP_QSTR_PC7), MP_ROM_PTR(&pin_PC7) },
{ MP_ROM_QSTR(MP_QSTR_PC8), MP_ROM_PTR(&pin_PC8) },
{ MP_ROM_QSTR(MP_QSTR_PC9), MP_ROM_PTR(&pin_PC9) },
{ MP_ROM_QSTR(MP_QSTR_PA8), MP_ROM_PTR(&pin_PA8) },
{ MP_ROM_QSTR(MP_QSTR_PA9), MP_ROM_PTR(&pin_PA9) },
{ MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12) },
{ MP_ROM_QSTR(MP_QSTR_PA13), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_PH2), MP_ROM_PTR(&pin_PH2) },
{ MP_ROM_QSTR(MP_QSTR_PA14), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10) },
{ MP_ROM_QSTR(MP_QSTR_PC11), MP_ROM_PTR(&pin_PC11) },
{ MP_ROM_QSTR(MP_QSTR_PC12), MP_ROM_PTR(&pin_PC12) },
{ MP_ROM_QSTR(MP_QSTR_PD0), MP_ROM_PTR(&pin_PD0) },
{ MP_ROM_QSTR(MP_QSTR_PD1), MP_ROM_PTR(&pin_PD1) },
{ MP_ROM_QSTR(MP_QSTR_PD2), MP_ROM_PTR(&pin_PD2) },
{ MP_ROM_QSTR(MP_QSTR_PD3), MP_ROM_PTR(&pin_PD3) },
{ MP_ROM_QSTR(MP_QSTR_PD4), MP_ROM_PTR(&pin_PD4) },
{ MP_ROM_QSTR(MP_QSTR_PD5), MP_ROM_PTR(&pin_PD5) },
{ MP_ROM_QSTR(MP_QSTR_PD6), MP_ROM_PTR(&pin_PD6) },
{ MP_ROM_QSTR(MP_QSTR_PD7), MP_ROM_PTR(&pin_PD7) },
{ MP_ROM_QSTR(MP_QSTR_PG9), MP_ROM_PTR(&pin_PG9) },
{ MP_ROM_QSTR(MP_QSTR_PG10), MP_ROM_PTR(&pin_PG10) },
{ MP_ROM_QSTR(MP_QSTR_PG11), MP_ROM_PTR(&pin_PG11) },
{ MP_ROM_QSTR(MP_QSTR_PG12), MP_ROM_PTR(&pin_PG12) },
{ MP_ROM_QSTR(MP_QSTR_PG13), MP_ROM_PTR(&pin_PG13) },
{ MP_ROM_QSTR(MP_QSTR_PG14), MP_ROM_PTR(&pin_PG14) },
{ MP_ROM_QSTR(MP_QSTR_PG15), MP_ROM_PTR(&pin_PG15) },
{ MP_ROM_QSTR(MP_QSTR_PB3), MP_ROM_PTR(&pin_PB3) },
{ MP_ROM_QSTR(MP_QSTR_PB4), MP_ROM_PTR(&pin_PB4) },
{ MP_ROM_QSTR(MP_QSTR_PB5), MP_ROM_PTR(&pin_PB5) },
{ MP_ROM_QSTR(MP_QSTR_PB6), MP_ROM_PTR(&pin_PB6) },
{ MP_ROM_QSTR(MP_QSTR_PB7), MP_ROM_PTR(&pin_PB7) },
{ MP_ROM_QSTR(MP_QSTR_PH3), MP_ROM_PTR(&pin_PH3) },
{ MP_ROM_QSTR(MP_QSTR_PB8), MP_ROM_PTR(&pin_PB8) },
{ MP_ROM_QSTR(MP_QSTR_PB9), MP_ROM_PTR(&pin_PB9) },
{ MP_ROM_QSTR(MP_QSTR_PE0), MP_ROM_PTR(&pin_PE0) },
{ MP_ROM_QSTR(MP_QSTR_PE1), MP_ROM_PTR(&pin_PE1) },
};
MP_DEFINE_CONST_DICT(machine_pin_board_pins_locals_dict, machine_pin_board_pins_locals_dict_table);
/* for ADC pin. */
const machine_pin_obj_t pin_NUL = { .base = { &machine_pin_type } };
const uint32_t machine_adc_num = 16u;
const machine_adc_obj_t adc_CH0 = { .base = { &machine_adc_type }, .pin_obj = &pin_PA0, .adc_port = ADC1, .adc_channel = 0 };
const machine_adc_obj_t adc_CH1 = { .base = { &machine_adc_type }, .pin_obj = &pin_PA1, .adc_port = ADC1, .adc_channel = 1 };
const machine_adc_obj_t adc_CH2 = { .base = { &machine_adc_type }, .pin_obj = &pin_PA2, .adc_port = ADC1, .adc_channel = 2 };
const machine_adc_obj_t adc_CH3 = { .base = { &machine_adc_type }, .pin_obj = &pin_PA3, .adc_port = ADC1, .adc_channel = 3 };
const machine_adc_obj_t adc_CH4 = { .base = { &machine_adc_type }, .pin_obj = &pin_PA4, .adc_port = ADC1, .adc_channel = 4 };
const machine_adc_obj_t adc_CH5 = { .base = { &machine_adc_type }, .pin_obj = &pin_PA5, .adc_port = ADC1, .adc_channel = 5 };
const machine_adc_obj_t adc_CH6 = { .base = { &machine_adc_type }, .pin_obj = &pin_PA6, .adc_port = ADC1, .adc_channel = 6 };
const machine_adc_obj_t adc_CH7 = { .base = { &machine_adc_type }, .pin_obj = &pin_PA7, .adc_port = ADC1, .adc_channel = 7 };
const machine_adc_obj_t adc_CH8 = { .base = { &machine_adc_type }, .pin_obj = &pin_PB0, .adc_port = ADC1, .adc_channel = 8 };
const machine_adc_obj_t adc_CH9 = { .base = { &machine_adc_type }, .pin_obj = &pin_PB1, .adc_port = ADC1, .adc_channel = 9 };
const machine_adc_obj_t adc_CH10 = { .base = { &machine_adc_type }, .pin_obj = &pin_PC0, .adc_port = ADC1, .adc_channel = 10 };
const machine_adc_obj_t adc_CH11 = { .base = { &machine_adc_type }, .pin_obj = &pin_PC1, .adc_port = ADC1, .adc_channel = 11 };
const machine_adc_obj_t adc_CH12 = { .base = { &machine_adc_type }, .pin_obj = &pin_PC2, .adc_port = ADC1, .adc_channel = 12 };
const machine_adc_obj_t adc_CH13 = { .base = { &machine_adc_type }, .pin_obj = &pin_PC3, .adc_port = ADC1, .adc_channel = 13 };
const machine_adc_obj_t adc_CH14 = { .base = { &machine_adc_type }, .pin_obj = &pin_NUL, .adc_port = ADC1, .adc_channel = 14 };
const machine_adc_obj_t adc_CH15 = { .base = { &machine_adc_type }, .pin_obj = &pin_NUL, .adc_port = ADC1, .adc_channel = 15 };
const machine_adc_obj_t * machine_adc_objs[] =
{
&adc_CH0 ,
&adc_CH1 ,
&adc_CH2 ,
&adc_CH3 ,
&adc_CH4 ,
&adc_CH5 ,
&adc_CH6 ,
&adc_CH7 ,
&adc_CH8 ,
&adc_CH9 ,
&adc_CH10,
&adc_CH11,
&adc_CH12,
&adc_CH13,
&adc_CH14,
&adc_CH15,
};
/* CH14 & CH15 are for internal sensors. */
/* for DAC pin. */
const uint32_t machine_dac_num = 2u;
machine_dac_conf_t machine_dac_conf[2]; /* static mamory instead of malloc(). */
const machine_dac_obj_t dac_CH0 = { .base = { &machine_dac_type }, .pin_obj = &pin_PA4, .dac_port = DAC, .dac_channel = 0, .conf = &machine_dac_conf[0] };
const machine_dac_obj_t dac_CH1 = { .base = { &machine_dac_type }, .pin_obj = &pin_PA5, .dac_port = DAC, .dac_channel = 1, .conf = &machine_dac_conf[1] };
const machine_dac_obj_t * machine_dac_objs[] =
{
&dac_CH0 ,
&dac_CH1 ,
};
/* for UART. */
const uint32_t machine_uart_num = 8u;
machine_uart_conf_t machine_uart_conf[8]; /* static mamory instead of malloc(). */
const machine_uart_obj_t uart_0 = { .base = { &machine_uart_type }, .rx_pin_obj = &pin_PA10, .rx_pin_af = GPIO_AF_7, .tx_pin_obj = &pin_PA9 , .tx_pin_af = GPIO_AF_7, .uart_port = UART1, .uart_irqn = UART1_IRQn, .uart_id = 0u, .conf = &machine_uart_conf[0]};
const machine_uart_obj_t uart_1 = { .base = { &machine_uart_type }, .rx_pin_obj = &pin_PA3 , .rx_pin_af = GPIO_AF_7, .tx_pin_obj = &pin_PA2 , .tx_pin_af = GPIO_AF_7, .uart_port = UART2, .uart_irqn = UART2_IRQn, .uart_id = 1u, .conf = &machine_uart_conf[1]};
const machine_uart_obj_t uart_2 = { .base = { &machine_uart_type }, .rx_pin_obj = &pin_PB11, .rx_pin_af = GPIO_AF_7, .tx_pin_obj = &pin_PB10, .tx_pin_af = GPIO_AF_7, .uart_port = UART3, .uart_irqn = UART3_IRQn, .uart_id = 2u, .conf = &machine_uart_conf[2]};
const machine_uart_obj_t uart_3 = { .base = { &machine_uart_type }, .rx_pin_obj = &pin_PC11, .rx_pin_af = GPIO_AF_8, .tx_pin_obj = &pin_PC10, .tx_pin_af = GPIO_AF_8, .uart_port = UART4, .uart_irqn = UART4_IRQn, .uart_id = 3u, .conf = &machine_uart_conf[3]};
const machine_uart_obj_t uart_4 = { .base = { &machine_uart_type }, .rx_pin_obj = &pin_PD2 , .rx_pin_af = GPIO_AF_8, .tx_pin_obj = &pin_PC12, .tx_pin_af = GPIO_AF_8, .uart_port = UART5, .uart_irqn = UART5_IRQn, .uart_id = 4u, .conf = &machine_uart_conf[4]};
const machine_uart_obj_t uart_5 = { .base = { &machine_uart_type }, .rx_pin_obj = &pin_PC7 , .rx_pin_af = GPIO_AF_8, .tx_pin_obj = &pin_PC6 , .tx_pin_af = GPIO_AF_8, .uart_port = UART6, .uart_irqn = UART6_IRQn, .uart_id = 5u, .conf = &machine_uart_conf[5]};
const machine_uart_obj_t uart_6 = { .base = { &machine_uart_type }, .rx_pin_obj = &pin_PE7 , .rx_pin_af = GPIO_AF_8, .tx_pin_obj = &pin_PE8 , .tx_pin_af = GPIO_AF_8, .uart_port = UART7, .uart_irqn = UART7_IRQn, .uart_id = 6u, .conf = &machine_uart_conf[6]};
const machine_uart_obj_t uart_7 = { .base = { &machine_uart_type }, .rx_pin_obj = &pin_PD1 , .rx_pin_af = GPIO_AF_8, .tx_pin_obj = &pin_PD0 , .tx_pin_af = GPIO_AF_8, .uart_port = UART8, .uart_irqn = UART8_IRQn, .uart_id = 7u, .conf = &machine_uart_conf[7]};
const machine_uart_obj_t * machine_uart_objs[] =
{
&uart_0,
&uart_1,
&uart_2,
&uart_3,
&uart_4,
&uart_5,
&uart_6,
&uart_7,
};
/* for SPI. */
STATIC machine_hw_spi_conf_t machine_hw_spi_conf[MACHINE_HW_SPI_NUM]; /* static mamory instead of malloc(). */
const machine_hw_spi_obj_t hw_spi_0 = {.base = { &machine_hw_spi_type }, .sck_pin_obj = &pin_PA5, .sck_pin_af = GPIO_AF_5, .mosi_pin_obj = &pin_PA7, .mosi_pin_af = GPIO_AF_5, .miso_pin_obj = &pin_PA6, .miso_pin_af = GPIO_AF_5, .spi_port = SPI1, .spi_irqn = SPI1_IRQn, .spi_id = 0u, .conf = &machine_hw_spi_conf[0]};
const machine_hw_spi_obj_t hw_spi_1 = {.base = { &machine_hw_spi_type }, .sck_pin_obj = &pin_PA3, .sck_pin_af = GPIO_AF_5, .mosi_pin_obj = &pin_PB4, .mosi_pin_af = GPIO_AF_5, .miso_pin_obj = &pin_PB3, .miso_pin_af = GPIO_AF_5, .spi_port = SPI2, .spi_irqn = SPI2_IRQn, .spi_id = 1u, .conf = &machine_hw_spi_conf[1]};
const machine_hw_spi_obj_t hw_spi_2 = {.base = { &machine_hw_spi_type }, .sck_pin_obj = &pin_PC9, .sck_pin_af = GPIO_AF_5, .mosi_pin_obj = &pin_PA8, .mosi_pin_af = GPIO_AF_5, .miso_pin_obj = &pin_PB9, .miso_pin_af = GPIO_AF_5, .spi_port = SPI3, .spi_irqn = SPI3_IRQn, .spi_id = 2u, .conf = &machine_hw_spi_conf[2]};
const machine_hw_spi_obj_t * machine_hw_spi_objs[] =
{
&hw_spi_0,
&hw_spi_1,
&hw_spi_2,
};
/* for PWM. */
machine_pwm_port_conf_t machine_pwm_port_conf[2];
machine_pwm_ch_conf_t machine_pwm_ch_conf[8];
const machine_pwm_obj_t pwm_0 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PA6, .pwm_pin_af = GPIO_AF_2, .tim_port = TIM3, .port_conf = &machine_pwm_port_conf[0], .tim_ch = 0u, .ch_conf = &machine_pwm_ch_conf[0], .pwm_id = 0u};
const machine_pwm_obj_t pwm_1 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PA7, .pwm_pin_af = GPIO_AF_2, .tim_port = TIM3, .port_conf = &machine_pwm_port_conf[0], .tim_ch = 1u, .ch_conf = &machine_pwm_ch_conf[1], .pwm_id = 1u};
const machine_pwm_obj_t pwm_2 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PB0, .pwm_pin_af = GPIO_AF_2, .tim_port = TIM3, .port_conf = &machine_pwm_port_conf[0], .tim_ch = 2u, .ch_conf = &machine_pwm_ch_conf[2], .pwm_id = 2u};
const machine_pwm_obj_t pwm_3 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PB1, .pwm_pin_af = GPIO_AF_2, .tim_port = TIM3, .port_conf = &machine_pwm_port_conf[0], .tim_ch = 3u, .ch_conf = &machine_pwm_ch_conf[3], .pwm_id = 3u};
const machine_pwm_obj_t pwm_4 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PB6, .pwm_pin_af = GPIO_AF_2, .tim_port = TIM4, .port_conf = &machine_pwm_port_conf[1], .tim_ch = 0u, .ch_conf = &machine_pwm_ch_conf[4], .pwm_id = 4u};
const machine_pwm_obj_t pwm_5 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PB7, .pwm_pin_af = GPIO_AF_2, .tim_port = TIM4, .port_conf = &machine_pwm_port_conf[1], .tim_ch = 1u, .ch_conf = &machine_pwm_ch_conf[5], .pwm_id = 5u};
const machine_pwm_obj_t pwm_6 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PB8, .pwm_pin_af = GPIO_AF_2, .tim_port = TIM4, .port_conf = &machine_pwm_port_conf[1], .tim_ch = 2u, .ch_conf = &machine_pwm_ch_conf[6], .pwm_id = 6u};
const machine_pwm_obj_t pwm_7 = {.base = { &machine_pwm_type }, .pwm_pin_obj = &pin_PB9, .pwm_pin_af = GPIO_AF_2, .tim_port = TIM4, .port_conf = &machine_pwm_port_conf[1], .tim_ch = 3u, .ch_conf = &machine_pwm_ch_conf[7], .pwm_id = 7u};
const machine_pwm_obj_t * machine_pwm_objs[] =
{
&pwm_0,
&pwm_1,
&pwm_2,
&pwm_3,
&pwm_4,
&pwm_5,
&pwm_6,
&pwm_7,
};
/* EOF. */
※ 测试总结 ※
对于初步实现的MicroPython的版本进行了测试。可以看到这个版本在MCU的硬件层面还存在BUG,在实际管脚上尚无法输出对应的PWM波形。
● 需要修改内容
- 输出管脚上没有实际PWM输出;
- 增加PWM通道数,最好能够达到16;
- 增加PWM通道支撑的后期TIM数量,使得PWM的频率能够更多的选择。
■ 相关文献链接:
● 相关图表链接:
相关文章
- 树莓派Pico + MicroPython驱动2.4寸SPI串口屏(ST7789)
- MicroPython 特定的库 (MicroPython-specific)-ntptime
- MicroPython 特定的库 (MicroPython-specific)-network
- MicroPython 特定的库 (MicroPython-specific) - machine
- MicroPython 标准库和微型库 - _thread
- MicroPython 标准库和微型库 - time
- MicroPython 标准库和微型库 - os
- MicroPython 标准库和微型库 - io
- MicroPython 交互式解释器模式(REPL)
- 安装 MicroPython 到 ESP32-CAM - 使用esptool (Windows)
- ESP32-CAM 使用 MicroPython 进行开发 - 使用图形化工具 Thonny (Windows)
- 安装 MicroPython 到 ESP32-CAM - 使用esptool.py (Mac)
- ESP32-CAM 使用 MicroPython 进行开发 - 使用图形化工具 Thonny (Mac)