zl程序教程

您现在的位置是:首页 >  其他

当前栏目

MM32F3277 MicroPython移植过程中对应的接口文件

文件MicroPython接口 过程 对应 移植
2023-09-11 14:15:18 时间

简 介: 给出了在MM32移植MicroPython过程中基础语法中Pin相关的内容。

关键词 MM32F3277machinePin

 

§01 MacinePin


/* machine_pin.h */

#ifndef __MACHINE_PIN_H__
#define __MACHINE_PIN_H__

#include "py/runtime.h"

#include "hal_gpio.h"

typedef enum
{
    PIN_MODE_IN_ANALOG = 0u,
    PIN_MODE_IN_FLOATING,
    PIN_MODE_IN_PULLDOWN,
    PIN_MODE_IN_PULLUP,
    PIN_MODE_OUT_OPENDRAIN,
    PIN_MODE_OUT_PUSHPULL,
    PIN_MODE_AF_OPENDRAIN,
    PIN_MODE_AF_PUSHPULL,
} machine_pin_mode_t;

/* Pin class instance configuration structure. */
typedef struct
{
    mp_obj_base_t base;      // object base class.
    qstr          name;      // pad name
    GPIO_Type   * gpio_port; // gpio instance for pin
    uint32_t      gpio_pin;  // pin number

} machine_pin_obj_t;

extern const machine_pin_obj_t * machine_pin_board_pins[];
extern const uint32_t            machine_pin_board_pins_num;
extern const mp_obj_dict_t       machine_pin_board_pins_locals_dict;

/* for all the module to bind the pins. */
const machine_pin_obj_t *pin_find(mp_obj_t user_obj);
const machine_pin_obj_t *pin_find_by_name(const mp_obj_dict_t *name_dict, mp_obj_t name);

extern const mp_obj_type_t machine_pin_type;

#endif /* __MACHINE_PIN_H__ */

 

§02 BoardPin


/* machine_pin_board_pins.c */

#include "machine_pin.h"
#include "machine_adc.h"
#include "machine_uart.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 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,   
};
/* EOF. */