extmod/modmachine: Clean up decls of machine types to use common ones.

The machine_i2c_type, machine_spi_type and machine_timer_type symbols are
already declared in extmod/modmachine.h and should not be declared anywhere
else.

Also move declarations of machine_pin_type and machine_rtc_type to the
common header in extmod.

Signed-off-by: Damien George <damien@micropython.org>
pull/12804/head
Damien George 2023-10-26 11:39:40 +11:00
rodzic 5b4a2baff6
commit 90023b4dcf
59 zmienionych plików z 44 dodań i 87 usunięć

Wyświetl plik

@ -34,9 +34,8 @@
#include <string.h>
#include "py/runtime.h"
#include "modmachine.h"
#include "extmod/machine_spi.h"
#include "mpconfigboard.h"
#include "extmod/modmachine.h"
#ifdef MICROPY_HW_WIFI_LED
#include "led.h"
#endif

Wyświetl plik

@ -35,9 +35,8 @@
#include <string.h>
#include "py/runtime.h"
#include "modmachine.h"
#include "extmod/machine_spi.h"
#include "mpconfigboard.h"
#include "extmod/modmachine.h"
#include "nina_bsp.h"
#include "nina_wifi_drv.h"

Wyświetl plik

@ -96,7 +96,9 @@ typedef struct _machine_wdt_obj_t machine_wdt_obj_t;
extern const mp_obj_type_t machine_adc_type;
extern const mp_obj_type_t machine_i2c_type;
extern const mp_obj_type_t machine_i2s_type;
extern const mp_obj_type_t machine_pin_type;
extern const mp_obj_type_t machine_pwm_type;
extern const mp_obj_type_t machine_rtc_type;
extern const mp_obj_type_t machine_spi_type;
extern const mp_obj_type_t machine_timer_type;
extern const mp_obj_type_t machine_uart_type;

Wyświetl plik

@ -1,4 +1,4 @@
#include "py/obj.h"
#include "extmod/modmachine.h"
#include "machine_pin.h"
#include "modmachine.h"
#include "genhdr/pins.h"

Wyświetl plik

@ -32,7 +32,7 @@
#include "py/stream.h"
#include "py/mphal.h"
#include "extmod/machine_spi.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#include "driver/spi_master.h"
#include "soc/gpio_sig_map.h"

Wyświetl plik

@ -28,7 +28,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_i2c.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#include "driver/i2c.h"
#include "hal/i2c_ll.h"

Wyświetl plik

@ -35,9 +35,10 @@
#include "py/runtime.h"
#include "py/mphal.h"
#include "extmod/modmachine.h"
#include "extmod/virtpin.h"
#include "mphalport.h"
#include "modmachine.h"
#include "extmod/virtpin.h"
#include "machine_pin.h"
#include "machine_rtc.h"
#include "modesp32.h"

Wyświetl plik

@ -36,8 +36,8 @@
#include "py/obj.h"
#include "py/runtime.h"
#include "py/mphal.h"
#include "extmod/modmachine.h"
#include "shared/timeutils/timeutils.h"
#include "modmachine.h"
#include "machine_rtc.h"
typedef struct _machine_rtc_obj_t {

Wyświetl plik

@ -9,14 +9,9 @@ typedef enum {
MACHINE_WAKE_DEEPSLEEP=0x04
} wake_type_t;
extern const mp_obj_type_t machine_timer_type;
extern const mp_obj_type_t machine_pin_type;
extern const mp_obj_type_t machine_touchpad_type;
extern const mp_obj_type_t machine_adcblock_type;
extern const mp_obj_type_t machine_dac_type;
extern const mp_obj_type_t machine_i2c_type;
extern const mp_obj_type_t machine_spi_type;
extern const mp_obj_type_t machine_rtc_type;
extern const mp_obj_type_t machine_sdcard_type;
void machine_init(void);

Wyświetl plik

@ -5,7 +5,6 @@
extern const mp_obj_type_t pyb_pin_type;
extern const mp_obj_type_t pyb_rtc_type;
extern const mp_obj_type_t pyb_i2c_type;
extern const mp_obj_type_t machine_hspi_type;
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj);

Wyświetl plik

@ -2,6 +2,7 @@
#include "py/obj.h"
#include "py/mphal.h"
#include "extmod/modmachine.h"
#include "pin.h"
#define PIN_AF(_name, _af_mode, _input_daisy, _instance, _input_register, _pad_config) \

Wyświetl plik

@ -28,7 +28,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_i2c.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#include CLOCK_CONFIG_H
#include "pin.h"

Wyświetl plik

@ -29,6 +29,7 @@
#include "py/runtime.h"
#include "shared/runtime/mpirq.h"
#include "shared/timeutils/timeutils.h"
#include "extmod/modmachine.h"
#include "modmachine.h"
#include "ticks.h"
#include "fsl_snvs_lp.h"

Wyświetl plik

@ -29,7 +29,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_spi.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#include CLOCK_CONFIG_H
#include "fsl_cache.h"

Wyświetl plik

@ -73,8 +73,6 @@ typedef struct _iomux_table_t {
uint32_t configRegister;
} iomux_table_t;
extern const mp_obj_type_t machine_uart_type;
STATIC const uint8_t uart_index_table[] = MICROPY_HW_UART_INDEX;
STATIC LPUART_Type *uart_base_ptr_table[] = LPUART_BASE_PTRS;
static const iomux_table_t iomux_table_uart[] = {

Wyświetl plik

@ -29,11 +29,7 @@
#include "py/obj.h"
extern const mp_obj_type_t machine_i2c_type;
extern const mp_obj_type_t machine_rtc_type;
extern const mp_obj_type_t machine_sdcard_type;
extern const mp_obj_type_t machine_spi_type;
extern const mp_obj_type_t machine_timer_type;
void machine_adc_init(void);
void machine_pin_irq_deinit(void);

Wyświetl plik

@ -25,6 +25,7 @@
*/
#include "py/runtime.h"
#include "extmod/modmachine.h"
#include "pin.h"

Wyświetl plik

@ -140,7 +140,6 @@ typedef struct _machine_pin_irq_obj_t {
// ------------------------------------------------------------------------------------------------------------------ //
extern const mp_obj_type_t machine_pin_type;
extern const mp_obj_type_t machine_pin_af_type;
// ------------------------------------------------------------------------------------------------------------------ //

Wyświetl plik

@ -35,6 +35,7 @@
#if MICROPY_PY_MACHINE_I2C
#include "extmod/machine_i2c.h"
#include "extmod/modmachine.h"
#include "i2c.h"
#if NRFX_TWI_ENABLED
#include "nrfx_twi.h"

Wyświetl plik

@ -29,8 +29,6 @@
#include "extmod/machine_i2c.h"
extern const mp_obj_type_t machine_i2c_type;
void i2c_init0(void);
#endif // I2C_H__

Wyświetl plik

@ -28,8 +28,6 @@
#ifndef __MICROPY_INCLUDED_NRF5_MODMACHINE_H__
#define __MICROPY_INCLUDED_NRF5_MODMACHINE_H__
#include "py/mpstate.h"
#include "py/nlr.h"
#include "py/obj.h"
void machine_init(void);

Wyświetl plik

@ -36,6 +36,7 @@
#include "py/nlr.h"
#include "py/mphal.h"
#include "extmod/machine_spi.h"
#include "extmod/modmachine.h"
#include "pin.h"
#include "genhdr/pins.h"
#include "spi.h"

Wyświetl plik

@ -27,7 +27,6 @@
#include "py/obj.h"
typedef struct _machine_hard_spi_obj_t machine_hard_spi_obj_t;
extern const mp_obj_type_t machine_spi_type;
void spi_init0(void);
void spi_transfer(const machine_hard_spi_obj_t * self,

Wyświetl plik

@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
#include "py/nlr.h"
#include "py/runtime.h"
#include "extmod/modmachine.h"
#include "timer.h"
#include "nrfx_timer.h"

Wyświetl plik

@ -27,8 +27,6 @@
#ifndef TIMER_H__
#define TIMER_H__
extern const mp_obj_type_t machine_timer_type;
void timer_init0(void);
#endif // TIMER_H__

Wyświetl plik

@ -4,6 +4,7 @@
#include "py/obj.h"
#include "py/mphal.h"
#include "extmod/modmachine.h"
#include "pin.h"
#define PIN_AD(p_name, p_pin, ad_bit, ad_channel) \

Wyświetl plik

@ -32,7 +32,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_i2c.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#include "ra_i2c.h"

Wyświetl plik

@ -31,9 +31,10 @@
#include "py/runtime.h"
#include "py/mphal.h"
#include "extmod/modmachine.h"
#include "extmod/virtpin.h"
#include "shared/runtime/mpirq.h"
#include "modmachine.h"
#include "extmod/virtpin.h"
#include "pin.h"
#include "extint.h"

Wyświetl plik

@ -28,6 +28,7 @@
#include <stdio.h>
#include "py/runtime.h"
#include "extmod/modmachine.h"
#include "shared/timeutils/timeutils.h"
#include "extint.h"
#include "rtc.h"

Wyświetl plik

@ -32,10 +32,10 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_spi.h"
#include "extmod/modmachine.h"
#include "pin.h"
#include "spi.h"
#include "ra/ra_spi.h"
#include "modmachine.h"
typedef struct _machine_hard_spi_obj_t {
mp_obj_base_t base;

Wyświetl plik

@ -41,6 +41,7 @@
#include "lib/littlefs/lfs1_util.h"
#include "lib/littlefs/lfs2.h"
#include "lib/littlefs/lfs2_util.h"
#include "extmod/modmachine.h"
#include "extmod/vfs.h"
#include "extmod/vfs_fat.h"
#include "extmod/vfs_lfs.h"

Wyświetl plik

@ -29,15 +29,9 @@
#include "py/obj.h"
extern const mp_obj_type_t machine_timer_type;
extern const mp_obj_type_t machine_pin_type;
extern const mp_obj_type_t machine_touchpad_type;
extern const mp_obj_type_t machine_adcblock_type;
extern const mp_obj_type_t machine_dac_type;
extern const mp_obj_type_t machine_i2c_type;
extern const mp_obj_type_t machine_spi_type;
extern const mp_obj_type_t machine_i2s_type;
extern const mp_obj_type_t machine_rtc_type;
extern const mp_obj_type_t machine_sdcard_type;

Wyświetl plik

@ -26,6 +26,7 @@
*/
#include "py/runtime.h"
#include "extmod/modmachine.h"
#include "uart.h"
#include "rng.h"

Wyświetl plik

@ -29,9 +29,9 @@
#include "py/stream.h"
#include "py/mphal.h"
#include "extmod/modbluetooth.h"
#include "extmod/modmachine.h"
#include "extmod/mpbthci.h"
#include "shared/runtime/softtimer.h"
#include "modmachine.h"
#include "mpbthciport.h"
#include "uart.h"

Wyświetl plik

@ -58,7 +58,6 @@ typedef struct {
const pin_ad_obj_t *ad;
} machine_pin_obj_t;
extern const mp_obj_type_t machine_pin_type;
extern const mp_obj_type_t pin_af_type;
// Include all of the individual pin objects

Wyświetl plik

@ -28,7 +28,6 @@
#define MICROPY_INCLUDED_RA_RTC_H
#include "py/obj.h"
extern const mp_obj_type_t machine_rtc_type;
typedef struct
{

Wyświetl plik

@ -89,7 +89,6 @@ typedef struct _machine_uart_obj_t {
mp_irq_obj_t *mp_irq_obj; // user IRQ object
} machine_uart_obj_t;
extern const mp_obj_type_t machine_uart_type;
extern const mp_irq_methods_t uart_irq_methods;
void uart_init0(void);

Wyświetl plik

@ -1,6 +1,7 @@
#include <stdint.h>
#include "py/obj.h"
#include "py/mphal.h"
#include "extmod/modmachine.h"
#include "machine_pin.h"
#define AF(af_idx, af_fn, af_unit) \

Wyświetl plik

@ -28,7 +28,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_i2c.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#include "hardware/i2c.h"

Wyświetl plik

@ -29,10 +29,11 @@
#include "py/runtime.h"
#include "py/mphal.h"
#include "extmod/modmachine.h"
#include "extmod/virtpin.h"
#include "shared/runtime/mpirq.h"
#include "modmachine.h"
#include "machine_pin.h"
#include "extmod/virtpin.h"
#include "hardware/irq.h"
#include "hardware/regs/intctrl.h"

Wyświetl plik

@ -59,7 +59,6 @@ typedef struct _machine_pin_obj_t {
const machine_pin_af_obj_t *af;
} machine_pin_obj_t;
extern const mp_obj_type_t machine_pin_type;
extern const mp_obj_type_t machine_pin_af_type;
// Include all of the individual pin objects

Wyświetl plik

@ -35,10 +35,10 @@
#include "py/runtime.h"
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/modmachine.h"
#include "shared/timeutils/timeutils.h"
#include "hardware/rtc.h"
#include "pico/util/datetime.h"
#include "modmachine.h"
typedef struct _machine_rtc_obj_t {
mp_obj_base_t base;

Wyświetl plik

@ -28,7 +28,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_spi.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#include "hardware/spi.h"
#include "hardware/dma.h"

Wyświetl plik

@ -3,12 +3,6 @@
#include "py/obj.h"
extern const mp_obj_type_t machine_i2c_type;
extern const mp_obj_type_t machine_pin_type;
extern const mp_obj_type_t machine_rtc_type;
extern const mp_obj_type_t machine_spi_type;
extern const mp_obj_type_t machine_timer_type;
void machine_pin_init(void);
void machine_pin_deinit(void);
void machine_i2s_init0(void);

Wyświetl plik

@ -32,7 +32,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_i2c.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#include "samd_soc.h"
#include "pin_af.h"
#include "clock_config.h"

Wyświetl plik

@ -27,8 +27,8 @@
#include "py/runtime.h"
#include "shared/timeutils/timeutils.h"
#include "modmachine.h"
#include "py/mphal.h"
#include "extmod/modmachine.h"
#include "sam.h"
#if MICROPY_PY_MACHINE_RTC

Wyświetl plik

@ -31,7 +31,7 @@
#include "py/mphal.h"
#include "extmod/machine_spi.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#include "samd_soc.h"
#include "pin_af.h"
#include "clock_config.h"

Wyświetl plik

@ -32,17 +32,6 @@
#if MICROPY_PY_MACHINE_DAC
extern const mp_obj_type_t machine_dac_type;
#endif
#if MICROPY_PY_MACHINE_I2C
extern const mp_obj_type_t machine_i2c_type;
#endif
extern const mp_obj_type_t machine_pin_type;
#if MICROPY_PY_MACHINE_SPI
extern const mp_obj_type_t machine_spi_type;
#endif
extern const mp_obj_type_t machine_timer_type;
#if MICROPY_PY_MACHINE_RTC
extern const mp_obj_type_t machine_rtc_type;
#endif
NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args);

Wyświetl plik

@ -31,9 +31,9 @@
#include <stdint.h>
#include "string.h"
#include "modmachine.h"
#include "py/runtime.h"
#include "py/misc.h"
#include "extmod/modmachine.h"
#include "pin_af.h"
#include "sam.h"

Wyświetl plik

@ -31,8 +31,8 @@
#include "py/runtime.h"
#include "py/mphal.h"
#include "extmod/machine_spi.h"
#include "extmod/modmachine.h"
#include "extmod/vfs.h"
#include "modmachine.h"
#include "pin_af.h"
#if MICROPY_HW_SPIFLASH

Wyświetl plik

@ -24,15 +24,12 @@
* THE SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
#include "py/runtime.h"
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_i2c.h"
#include "extmod/modmachine.h"
#include "i2c.h"
#include "modmachine.h"
#if MICROPY_HW_ENABLE_HW_I2C

Wyświetl plik

@ -26,6 +26,7 @@
#include "py/runtime.h"
#include "extmod/machine_spi.h"
#include "extmod/modmachine.h"
#include "spi.h"
/******************************************************************************/

Wyświetl plik

@ -28,10 +28,6 @@
#include "py/obj.h"
extern const mp_obj_type_t machine_i2c_type;
extern const mp_obj_type_t machine_spi_type;
extern const mp_obj_type_t machine_timer_type;
void machine_init(void);
void machine_deinit(void);
void machine_i2s_init0();

Wyświetl plik

@ -29,6 +29,7 @@
#include "py/mphal.h"
#include "spi.h"
#include "extmod/machine_spi.h"
#include "extmod/modmachine.h"
// Possible DMA configurations for SPI buses:
// SPI1_TX: DMA2_Stream3.CHANNEL_3 or DMA2_Stream5.CHANNEL_3

Wyświetl plik

@ -58,7 +58,6 @@ extern const spi_t spi_obj[6];
extern const mp_spi_proto_t spi_proto;
extern const mp_obj_type_t pyb_spi_type;
extern const mp_obj_type_t machine_spi_type;
// A transfer of "len" bytes should take len*8*1000/baudrate milliseconds.
// To simplify the calculation we assume the baudrate is never less than 8kHz

Wyświetl plik

@ -37,7 +37,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_i2c.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#if MICROPY_PY_MACHINE_I2C

Wyświetl plik

@ -35,6 +35,7 @@
#include "py/runtime.h"
#include "py/gc.h"
#include "py/mphal.h"
#include "extmod/modmachine.h"
#include "shared/runtime/mpirq.h"
#include "modmachine.h"

Wyświetl plik

@ -36,7 +36,7 @@
#include "py/mphal.h"
#include "py/mperrno.h"
#include "extmod/machine_spi.h"
#include "modmachine.h"
#include "extmod/modmachine.h"
#if MICROPY_PY_MACHINE_SPI

Wyświetl plik

@ -3,10 +3,6 @@
#include "py/obj.h"
extern const mp_obj_type_t machine_pin_type;
extern const mp_obj_type_t machine_i2c_type;
extern const mp_obj_type_t machine_spi_type;
MP_DECLARE_CONST_FUN_OBJ_0(machine_info_obj);
typedef struct _machine_pin_obj_t {