summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorKevin Matocha <kmatocha@icloud.com>2020-08-21 19:08:25 -0500
committerKevin Matocha <kmatocha@icloud.com>2020-08-21 19:08:25 -0500
commitdc502a5f26fdf5514eb835fae5f523c1b15c23b5 (patch)
tree8e69e1004fe9ac1b5ddb5d0778c22007a61ba211 /shared-bindings
parent5b6313e642f90be13351a58e9a8d0ef325bdeb35 (diff)
remove extraneous files
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/_typing/__init__ 2.pyi54
-rw-r--r--shared-bindings/gnss/GNSS 2.c205
-rw-r--r--shared-bindings/gnss/GNSS 2.h27
-rw-r--r--shared-bindings/gnss/PositionFix 2.c80
-rw-r--r--shared-bindings/gnss/PositionFix 2.h28
-rw-r--r--shared-bindings/gnss/SatelliteSystem 2.c113
-rw-r--r--shared-bindings/gnss/SatelliteSystem 2.h33
-rw-r--r--shared-bindings/gnss/__init__ 2.c31
-rw-r--r--shared-bindings/i2cperipheral/I2CPeripheral 2.c436
-rw-r--r--shared-bindings/i2cperipheral/I2CPeripheral 2.h60
-rw-r--r--shared-bindings/i2cperipheral/__init__ 2.c106
-rw-r--r--shared-bindings/memorymonitor/AllocationAlarm 2.c137
-rw-r--r--shared-bindings/memorymonitor/AllocationAlarm 2.h39
-rw-r--r--shared-bindings/memorymonitor/AllocationSize 2.c183
-rw-r--r--shared-bindings/memorymonitor/AllocationSize 2.h42
-rw-r--r--shared-bindings/memorymonitor/__init__ 2.c76
-rw-r--r--shared-bindings/memorymonitor/__init__ 2.h49
-rw-r--r--shared-bindings/sdcardio/SDCard 2.c183
-rw-r--r--shared-bindings/sdcardio/SDCard 2.h30
-rw-r--r--shared-bindings/sdcardio/__init__ 2.c47
-rw-r--r--shared-bindings/sdcardio/__init__ 2.h0
21 files changed, 0 insertions, 1959 deletions
diff --git a/shared-bindings/_typing/__init__ 2.pyi b/shared-bindings/_typing/__init__ 2.pyi
deleted file mode 100644
index 48e68a8d5..000000000
--- a/shared-bindings/_typing/__init__ 2.pyi
+++ /dev/null
@@ -1,54 +0,0 @@
-"""Types for the C-level protocols"""
-
-from typing import Union
-
-import array
-import audiocore
-import audiomixer
-import audiomp3
-import rgbmatrix
-import ulab
-
-ReadableBuffer = Union[
- bytes, bytearray, memoryview, array.array, ulab.array, rgbmatrix.RGBMatrix
-]
-"""Classes that implement the readable buffer protocol
-
- - `bytes`
- - `bytearray`
- - `memoryview`
- - `array.array`
- - `ulab.array`
- - `rgbmatrix.RGBMatrix`
-"""
-
-WriteableBuffer = Union[
- bytearray, memoryview, array.array, ulab.array, rgbmatrix.RGBMatrix
-]
-"""Classes that implement the writeable buffer protocol
-
- - `bytearray`
- - `memoryview`
- - `array.array`
- - `ulab.array`
- - `rgbmatrix.RGBMatrix`
-"""
-
-AudioSample = Union[
- audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer, audiomp3.MP3Decoder
-]
-"""Classes that implement the audiosample protocol
-
- - `audiocore.WaveFile`
- - `audiocore.RawSample`
- - `audiomixer.Mixer`
- - `audiomp3.MP3Decoder`
-
- You can play these back with `audioio.AudioOut`, `audiobusio.I2SOut` or `audiopwmio.PWMAudioOut`.
-"""
-
-FrameBuffer = Union[rgbmatrix.RGBMatrix]
-"""Classes that implement the framebuffer protocol
-
- - `rgbmatrix.RGBMatrix`
-"""
diff --git a/shared-bindings/gnss/GNSS 2.c b/shared-bindings/gnss/GNSS 2.c
deleted file mode 100644
index 087c35395..000000000
--- a/shared-bindings/gnss/GNSS 2.c
+++ /dev/null
@@ -1,205 +0,0 @@
-// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation
-//
-// SPDX-License-Identifier: MIT
-
-#include "shared-bindings/gnss/GNSS.h"
-#include "shared-bindings/time/__init__.h"
-#include "shared-bindings/util.h"
-
-#include "py/objproperty.h"
-#include "py/runtime.h"
-
-//| class GNSS:
-//| """Get updated positioning information from Global Navigation Satellite System (GNSS)
-//|
-//| Usage::
-//|
-//| import gnss
-//| import time
-//|
-//| nav = gnss.GNSS([gnss.SatelliteSystem.GPS, gnss.SatelliteSystem.GLONASS])
-//| last_print = time.monotonic()
-//| while True:
-//| nav.update()
-//| current = time.monotonic()
-//| if current - last_print >= 1.0:
-//| last_print = current
-//| if nav.fix is gnss.PositionFix.INVALID:
-//| print("Waiting for fix...")
-//| continue
-//| print("Latitude: {0:.6f} degrees".format(nav.latitude))
-//| print("Longitude: {0:.6f} degrees".format(nav.longitude))"""
-//|
-
-//| def __init__(self, system: Union[SatelliteSystem, List[SatelliteSystem]]) -> None:
-//| """Turn on the GNSS.
-//|
-//| :param system: satellite system to use"""
-//| ...
-//|
-STATIC mp_obj_t gnss_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- gnss_obj_t *self = m_new_obj(gnss_obj_t);
- self->base.type = &gnss_type;
- enum { ARG_system };
- static const mp_arg_t allowed_args[] = {
- { MP_QSTR_system, MP_ARG_REQUIRED | MP_ARG_OBJ },
- };
- 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);
-
- unsigned long selection = 0;
- if (MP_OBJ_IS_TYPE(args[ARG_system].u_obj, &gnss_satellitesystem_type)) {
- selection |= gnss_satellitesystem_obj_to_type(args[ARG_system].u_obj);
- } else if (MP_OBJ_IS_TYPE(args[ARG_system].u_obj, &mp_type_list)) {
- size_t systems_size = 0;
- mp_obj_t *systems;
- mp_obj_list_get(args[ARG_system].u_obj, &systems_size, &systems);
- for (size_t i = 0; i < systems_size; ++i) {
- if (!MP_OBJ_IS_TYPE(systems[i], &gnss_satellitesystem_type)) {
- mp_raise_TypeError(translate("System entry must be gnss.SatelliteSystem"));
- }
- selection |= gnss_satellitesystem_obj_to_type(systems[i]);
- }
- } else {
- mp_raise_TypeError(translate("System entry must be gnss.SatelliteSystem"));
- }
-
- common_hal_gnss_construct(self, selection);
- return MP_OBJ_FROM_PTR(self);
-}
-
-//| def deinit(self) -> None:
-//| """Turn off the GNSS."""
-//| ...
-//|
-STATIC mp_obj_t gnss_obj_deinit(mp_obj_t self_in) {
- gnss_obj_t *self = MP_OBJ_TO_PTR(self_in);
- common_hal_gnss_deinit(self);
- return mp_const_none;
-}
-MP_DEFINE_CONST_FUN_OBJ_1(gnss_deinit_obj, gnss_obj_deinit);
-
-STATIC void check_for_deinit(gnss_obj_t *self) {
- if (common_hal_gnss_deinited(self)) {
- raise_deinited_error();
- }
-}
-
-//| def update(self) -> None:
-//| """Update GNSS positioning information."""
-//| ...
-//|
-STATIC mp_obj_t gnss_obj_update(mp_obj_t self_in) {
- gnss_obj_t *self = MP_OBJ_TO_PTR(self_in);
- check_for_deinit(self);
-
- common_hal_gnss_update(self);
- return mp_const_none;
-}
-MP_DEFINE_CONST_FUN_OBJ_1(gnss_update_obj, gnss_obj_update);
-
-//| latitude: float
-//| """Latitude of current position in degrees (float)."""
-//|
-STATIC mp_obj_t gnss_obj_get_latitude(mp_obj_t self_in) {
- gnss_obj_t *self = MP_OBJ_TO_PTR(self_in);
- check_for_deinit(self);
- return mp_obj_new_float(common_hal_gnss_get_latitude(self));
-}
-MP_DEFINE_CONST_FUN_OBJ_1(gnss_get_latitude_obj, gnss_obj_get_latitude);
-
-const mp_obj_property_t gnss_latitude_obj = {
- .base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&gnss_get_latitude_obj,
- (mp_obj_t)&mp_const_none_obj,
- (mp_obj_t)&mp_const_none_obj},
-};
-
-//| longitude: float
-//| """Longitude of current position in degrees (float)."""
-//|
-STATIC mp_obj_t gnss_obj_get_longitude(mp_obj_t self_in) {
- gnss_obj_t *self = MP_OBJ_TO_PTR(self_in);
- check_for_deinit(self);
- return mp_obj_new_float(common_hal_gnss_get_longitude(self));
-}
-MP_DEFINE_CONST_FUN_OBJ_1(gnss_get_longitude_obj, gnss_obj_get_longitude);
-
-const mp_obj_property_t gnss_longitude_obj = {
- .base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&gnss_get_longitude_obj,
- (mp_obj_t)&mp_const_none_obj,
- (mp_obj_t)&mp_const_none_obj},
-};
-
-//| altitude: float
-//| """Altitude of current position in meters (float)."""
-//|
-STATIC mp_obj_t gnss_obj_get_altitude(mp_obj_t self_in) {
- gnss_obj_t *self = MP_OBJ_TO_PTR(self_in);
- check_for_deinit(self);
- return mp_obj_new_float(common_hal_gnss_get_altitude(self));
-}
-MP_DEFINE_CONST_FUN_OBJ_1(gnss_get_altitude_obj, gnss_obj_get_altitude);
-
-const mp_obj_property_t gnss_altitude_obj = {
- .base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&gnss_get_altitude_obj,
- (mp_obj_t)&mp_const_none_obj,
- (mp_obj_t)&mp_const_none_obj},
-};
-
-//| timestamp: time.struct_time
-//| """Time when the position data was updated."""
-//|
-STATIC mp_obj_t gnss_obj_get_timestamp(mp_obj_t self_in) {
- gnss_obj_t *self = MP_OBJ_TO_PTR(self_in);
- check_for_deinit(self);
- timeutils_struct_time_t tm;
- common_hal_gnss_get_timestamp(self, &tm);
- return struct_time_from_tm(&tm);
-}
-MP_DEFINE_CONST_FUN_OBJ_1(gnss_get_timestamp_obj, gnss_obj_get_timestamp);
-
-const mp_obj_property_t gnss_timestamp_obj = {
- .base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&gnss_get_timestamp_obj,
- (mp_obj_t)&mp_const_none_obj,
- (mp_obj_t)&mp_const_none_obj},
-};
-
-//| fix: PositionFix
-//| """Fix mode."""
-//|
-STATIC mp_obj_t gnss_obj_get_fix(mp_obj_t self_in) {
- gnss_obj_t *self = MP_OBJ_TO_PTR(self_in);
- check_for_deinit(self);
- return gnss_positionfix_type_to_obj(common_hal_gnss_get_fix(self));
-}
-MP_DEFINE_CONST_FUN_OBJ_1(gnss_get_fix_obj, gnss_obj_get_fix);
-
-const mp_obj_property_t gnss_fix_obj = {
- .base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&gnss_get_fix_obj,
- (mp_obj_t)&mp_const_none_obj,
- (mp_obj_t)&mp_const_none_obj},
-};
-
-STATIC const mp_rom_map_elem_t gnss_locals_dict_table[] = {
- { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&gnss_deinit_obj) },
- { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&gnss_update_obj) },
-
- { MP_ROM_QSTR(MP_QSTR_latitude), MP_ROM_PTR(&gnss_latitude_obj) },
- { MP_ROM_QSTR(MP_QSTR_longitude), MP_ROM_PTR(&gnss_longitude_obj) },
- { MP_ROM_QSTR(MP_QSTR_altitude), MP_ROM_PTR(&gnss_altitude_obj) },
- { MP_ROM_QSTR(MP_QSTR_timestamp), MP_ROM_PTR(&gnss_timestamp_obj) },
- { MP_ROM_QSTR(MP_QSTR_fix), MP_ROM_PTR(&gnss_fix_obj) }
-};
-STATIC MP_DEFINE_CONST_DICT(gnss_locals_dict, gnss_locals_dict_table);
-
-const mp_obj_type_t gnss_type = {
- { &mp_type_type },
- .name = MP_QSTR_GNSS,
- .make_new = gnss_make_new,
- .locals_dict = (mp_obj_dict_t*)&gnss_locals_dict,
-};
diff --git a/shared-bindings/gnss/GNSS 2.h b/shared-bindings/gnss/GNSS 2.h
deleted file mode 100644
index 60069a90a..000000000
--- a/shared-bindings/gnss/GNSS 2.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation
-//
-// SPDX-License-Identifier: MIT
-
-#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_GNSS_H
-#define MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_GNSS_H
-
-#include "common-hal/gnss/GNSS.h"
-#include "shared-bindings/gnss/SatelliteSystem.h"
-#include "shared-bindings/gnss/PositionFix.h"
-
-#include "lib/timeutils/timeutils.h"
-
-extern const mp_obj_type_t gnss_type;
-
-void common_hal_gnss_construct(gnss_obj_t *self, unsigned long selection);
-void common_hal_gnss_deinit(gnss_obj_t *self);
-bool common_hal_gnss_deinited(gnss_obj_t *self);
-void common_hal_gnss_update(gnss_obj_t *self);
-
-mp_float_t common_hal_gnss_get_latitude(gnss_obj_t *self);
-mp_float_t common_hal_gnss_get_longitude(gnss_obj_t *self);
-mp_float_t common_hal_gnss_get_altitude(gnss_obj_t *self);
-void common_hal_gnss_get_timestamp(gnss_obj_t *self, timeutils_struct_time_t *tm);
-gnss_positionfix_t common_hal_gnss_get_fix(gnss_obj_t *self);
-
-#endif // MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_GNSS_H
diff --git a/shared-bindings/gnss/PositionFix 2.c b/shared-bindings/gnss/PositionFix 2.c
deleted file mode 100644
index e60611d70..000000000
--- a/shared-bindings/gnss/PositionFix 2.c
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation
-//
-// SPDX-License-Identifier: MIT
-
-#include "shared-bindings/gnss/PositionFix.h"
-
-//| class PositionFix:
-//| """Position fix mode"""
-//|
-//| def __init__(self) -> None:
-//| """Enum-like class to define the position fix mode."""
-//|
-//| INVALID: PositionFix
-//| """No measurement."""
-//|
-//| FIX_2D: PositionFix
-//| """2D fix."""
-//|
-//| FIX_3D: PositionFix
-//| """3D fix."""
-//|
-const mp_obj_type_t gnss_positionfix_type;
-
-const gnss_positionfix_obj_t gnss_positionfix_invalid_obj = {
- { &gnss_positionfix_type },
-};
-
-const gnss_positionfix_obj_t gnss_positionfix_fix2d_obj = {
- { &gnss_positionfix_type },
-};
-
-const gnss_positionfix_obj_t gnss_positionfix_fix3d_obj = {
- { &gnss_positionfix_type },
-};
-
-gnss_positionfix_t gnss_positionfix_obj_to_type(mp_obj_t obj) {
- gnss_positionfix_t posfix = POSITIONFIX_INVALID;
- if (obj == MP_ROM_PTR(&gnss_positionfix_fix2d_obj)) {
- posfix = POSITIONFIX_2D;
- } else if (obj == MP_ROM_PTR(&gnss_positionfix_fix3d_obj)) {
- posfix = POSITIONFIX_3D;
- }
- return posfix;
-}
-
-mp_obj_t gnss_positionfix_type_to_obj(gnss_positionfix_t posfix) {
- switch (posfix) {
- case POSITIONFIX_2D:
- return (mp_obj_t)MP_ROM_PTR(&gnss_positionfix_fix2d_obj);
- case POSITIONFIX_3D:
- return (mp_obj_t)MP_ROM_PTR(&gnss_positionfix_fix3d_obj);
- case POSITIONFIX_INVALID:
- default:
- return (mp_obj_t)MP_ROM_PTR(&gnss_positionfix_invalid_obj);
- }
-}
-
-STATIC const mp_rom_map_elem_t gnss_positionfix_locals_dict_table[] = {
- {MP_ROM_QSTR(MP_QSTR_INVALID), MP_ROM_PTR(&gnss_positionfix_invalid_obj)},
- {MP_ROM_QSTR(MP_QSTR_FIX_2D), MP_ROM_PTR(&gnss_positionfix_fix2d_obj)},
- {MP_ROM_QSTR(MP_QSTR_FIX_3D), MP_ROM_PTR(&gnss_positionfix_fix3d_obj)},
-};
-STATIC MP_DEFINE_CONST_DICT(gnss_positionfix_locals_dict, gnss_positionfix_locals_dict_table);
-
-STATIC void gnss_positionfix_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
- qstr posfix = MP_QSTR_INVALID;
- if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&gnss_positionfix_fix2d_obj)) {
- posfix = MP_QSTR_FIX_2D;
- } else if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&gnss_positionfix_fix3d_obj)) {
- posfix = MP_QSTR_FIX_3D;
- }
- mp_printf(print, "%q.%q.%q", MP_QSTR_gnss, MP_QSTR_PositionFix, posfix);
-}
-
-const mp_obj_type_t gnss_positionfix_type = {
- { &mp_type_type },
- .name = MP_QSTR_PositionFix,
- .print = gnss_positionfix_print,
- .locals_dict = (mp_obj_t)&gnss_positionfix_locals_dict,
-};
diff --git a/shared-bindings/gnss/PositionFix 2.h b/shared-bindings/gnss/PositionFix 2.h
deleted file mode 100644
index 34090872c..000000000
--- a/shared-bindings/gnss/PositionFix 2.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation
-//
-// SPDX-License-Identifier: MIT
-
-#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_POSITIONFIX_H
-#define MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_POSITIONFIX_H
-
-#include "py/obj.h"
-
-typedef enum {
- POSITIONFIX_INVALID,
- POSITIONFIX_2D,
- POSITIONFIX_3D,
-} gnss_positionfix_t;
-
-const mp_obj_type_t gnss_positionfix_type;
-
-gnss_positionfix_t gnss_positionfix_obj_to_type(mp_obj_t obj);
-mp_obj_t gnss_positionfix_type_to_obj(gnss_positionfix_t mode);
-
-typedef struct {
- mp_obj_base_t base;
-} gnss_positionfix_obj_t;
-extern const gnss_positionfix_obj_t gnss_positionfix_invalid_obj;
-extern const gnss_positionfix_obj_t gnss_positionfix_fix2d_obj;
-extern const gnss_positionfix_obj_t gnss_positionfix_fix3d_obj;
-
-#endif // MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_POSITIONFIX_H
diff --git a/shared-bindings/gnss/SatelliteSystem 2.c b/shared-bindings/gnss/SatelliteSystem 2.c
deleted file mode 100644
index 7d66727b8..000000000
--- a/shared-bindings/gnss/SatelliteSystem 2.c
+++ /dev/null
@@ -1,113 +0,0 @@
-// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation
-//
-// SPDX-License-Identifier: MIT
-
-#include "shared-bindings/gnss/SatelliteSystem.h"
-
-//| class SatelliteSystem:
-//| """Satellite system type"""
-//|
-//| def __init__(self) -> None:
-//| """Enum-like class to define the satellite system type."""
-//|
-//| GPS: SatelliteSystem
-//| """Global Positioning System."""
-//|
-//| GLONASS: SatelliteSystem
-//| """GLObal NAvigation Satellite System."""
-//|
-//| SBAS: SatelliteSystem
-//| """Satellite Based Augmentation System."""
-//|
-//| QZSS_L1CA: SatelliteSystem
-//| """Quasi-Zenith Satellite System L1C/A."""
-//|
-//| QZSS_L1S: SatelliteSystem
-//| """Quasi-Zenith Satellite System L1S."""
-//|
-const mp_obj_type_t gnss_satellitesystem_type;
-
-const gnss_satellitesystem_obj_t gnss_satellitesystem_gps_obj = {
- { &gnss_satellitesystem_type },
-};
-
-const gnss_satellitesystem_obj_t gnss_satellitesystem_glonass_obj = {
- { &gnss_satellitesystem_type },
-};
-
-const gnss_satellitesystem_obj_t gnss_satellitesystem_sbas_obj = {
- { &gnss_satellitesystem_type },
-};
-
-const gnss_satellitesystem_obj_t gnss_satellitesystem_qzss_l1ca_obj = {
- { &gnss_satellitesystem_type },
-};
-
-const gnss_satellitesystem_obj_t gnss_satellitesystem_qzss_l1s_obj = {
- { &gnss_satellitesystem_type },
-};
-
-gnss_satellitesystem_t gnss_satellitesystem_obj_to_type(mp_obj_t obj) {
- if (obj == MP_ROM_PTR(&gnss_satellitesystem_gps_obj)) {
- return SATELLITESYSTEM_GPS;
- } else if (obj == MP_ROM_PTR(&gnss_satellitesystem_glonass_obj)) {
- return SATELLITESYSTEM_GLONASS;
- } else if (obj == MP_ROM_PTR(&gnss_satellitesystem_sbas_obj)) {
- return SATELLITESYSTEM_SBAS;
- } else if (obj == MP_ROM_PTR(&gnss_satellitesystem_qzss_l1ca_obj)) {
- return SATELLITESYSTEM_QZSS_L1CA;
- } else if (obj == MP_ROM_PTR(&gnss_satellitesystem_qzss_l1s_obj)) {
- return SATELLITESYSTEM_QZSS_L1S;
- }
- return SATELLITESYSTEM_NONE;
-}
-
-mp_obj_t gnss_satellitesystem_type_to_obj(gnss_satellitesystem_t system) {
- switch (system) {
- case SATELLITESYSTEM_GPS:
- return (mp_obj_t)MP_ROM_PTR(&gnss_satellitesystem_gps_obj);
- case SATELLITESYSTEM_GLONASS:
- return (mp_obj_t)MP_ROM_PTR(&gnss_satellitesystem_glonass_obj);
- case SATELLITESYSTEM_SBAS:
- return (mp_obj_t)MP_ROM_PTR(&gnss_satellitesystem_sbas_obj);
- case SATELLITESYSTEM_QZSS_L1CA:
- return (mp_obj_t)MP_ROM_PTR(&gnss_satellitesystem_qzss_l1ca_obj);
- case SATELLITESYSTEM_QZSS_L1S:
- return (mp_obj_t)MP_ROM_PTR(&gnss_satellitesystem_qzss_l1s_obj);
- case SATELLITESYSTEM_NONE:
- default:
- return (mp_obj_t)MP_ROM_PTR(&mp_const_none_obj);
- }
-}
-
-STATIC const mp_rom_map_elem_t gnss_satellitesystem_locals_dict_table[] = {
- {MP_ROM_QSTR(MP_QSTR_GPS), MP_ROM_PTR(&gnss_satellitesystem_gps_obj)},
- {MP_ROM_QSTR(MP_QSTR_GLONASS), MP_ROM_PTR(&gnss_satellitesystem_glonass_obj)},
- {MP_ROM_QSTR(MP_QSTR_SBAS), MP_ROM_PTR(&gnss_satellitesystem_sbas_obj)},
- {MP_ROM_QSTR(MP_QSTR_QZSS_L1CA), MP_ROM_PTR(&gnss_satellitesystem_qzss_l1ca_obj)},
- {MP_ROM_QSTR(MP_QSTR_QZSS_L1S), MP_ROM_PTR(&gnss_satellitesystem_qzss_l1s_obj)},
-};
-STATIC MP_DEFINE_CONST_DICT(gnss_satellitesystem_locals_dict, gnss_satellitesystem_locals_dict_table);
-
-STATIC void gnss_satellitesystem_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
- qstr system = MP_QSTR_None;
- if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&gnss_satellitesystem_gps_obj)) {
- system = MP_QSTR_GPS;
- } else if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&gnss_satellitesystem_glonass_obj)) {
- system = MP_QSTR_GLONASS;
- } else if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&gnss_satellitesystem_sbas_obj)) {
- system = MP_QSTR_SBAS;
- } else if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&gnss_satellitesystem_qzss_l1ca_obj)) {
- system = MP_QSTR_QZSS_L1CA;
- } else if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&gnss_satellitesystem_qzss_l1s_obj)) {
- system = MP_QSTR_QZSS_L1S;
- }
- mp_printf(print, "%q.%q.%q", MP_QSTR_gnss, MP_QSTR_SatelliteSystem, system);
-}
-
-const mp_obj_type_t gnss_satellitesystem_type = {
- { &mp_type_type },
- .name = MP_QSTR_SatelliteSystem,
- .print = gnss_satellitesystem_print,
- .locals_dict = (mp_obj_t)&gnss_satellitesystem_locals_dict,
-};
diff --git a/shared-bindings/gnss/SatelliteSystem 2.h b/shared-bindings/gnss/SatelliteSystem 2.h
deleted file mode 100644
index 17f155002..000000000
--- a/shared-bindings/gnss/SatelliteSystem 2.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation
-//
-// SPDX-License-Identifier: MIT
-
-#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_SATELLITESYSTEM_H
-#define MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_SATELLITESYSTEM_H
-
-#include "py/obj.h"
-
-typedef enum {
- SATELLITESYSTEM_NONE = 0,
- SATELLITESYSTEM_GPS = (1U << 0),
- SATELLITESYSTEM_GLONASS = (1U << 1),
- SATELLITESYSTEM_SBAS = (1U << 2),
- SATELLITESYSTEM_QZSS_L1CA = (1U << 3),
- SATELLITESYSTEM_QZSS_L1S = (1U << 4),
-} gnss_satellitesystem_t;
-
-const mp_obj_type_t gnss_satellitesystem_type;
-
-gnss_satellitesystem_t gnss_satellitesystem_obj_to_type(mp_obj_t obj);
-mp_obj_t gnss_satellitesystem_type_to_obj(gnss_satellitesystem_t mode);
-
-typedef struct {
- mp_obj_base_t base;
-} gnss_satellitesystem_obj_t;
-extern const gnss_satellitesystem_obj_t gnss_satellitesystem_gps_obj;
-extern const gnss_satellitesystem_obj_t gnss_satellitesystem_glonass_obj;
-extern const gnss_satellitesystem_obj_t gnss_satellitesystem_sbas_obj;
-extern const gnss_satellitesystem_obj_t gnss_satellitesystem_qzss_l1ca_obj;
-extern const gnss_satellitesystem_obj_t gnss_satellitesystem_qzss_l1s_obj;
-
-#endif // MICROPY_INCLUDED_SHARED_BINDINGS_GNSS_SATELLITESYSTEM_H
diff --git a/shared-bindings/gnss/__init__ 2.c b/shared-bindings/gnss/__init__ 2.c
deleted file mode 100644
index 4b0d312ae..000000000
--- a/shared-bindings/gnss/__init__ 2.c
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-FileCopyrightText: Sony Semiconductor Solutions Corporation
-//
-// SPDX-License-Identifier: MIT
-
-#include "py/obj.h"
-#include "py/runtime.h"
-#include "py/mphal.h"
-#include "shared-bindings/gnss/GNSS.h"
-#include "shared-bindings/gnss/SatelliteSystem.h"
-#include "shared-bindings/gnss/PositionFix.h"
-#include "shared-bindings/util.h"
-
-//| """Global Navigation Satellite System
-//|
-//| The `gnss` module contains classes to control the GNSS and acquire positioning information."""
-//|
-STATIC const mp_rom_map_elem_t gnss_module_globals_table[] = {
- { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gnss) },
- { MP_ROM_QSTR(MP_QSTR_GNSS), MP_ROM_PTR(&gnss_type) },
-
- // Enum-like Classes.
- { MP_ROM_QSTR(MP_QSTR_SatelliteSystem), MP_ROM_PTR(&gnss_satellitesystem_type) },
- { MP_ROM_QSTR(MP_QSTR_PositionFix), MP_ROM_PTR(&gnss_positionfix_type) },
-};
-
-STATIC MP_DEFINE_CONST_DICT(gnss_module_globals, gnss_module_globals_table);
-
-const mp_obj_module_t gnss_module = {
- .base = { &mp_type_module },
- .globals = (mp_obj_dict_t*)&gnss_module_globals,
-};
diff --git a/shared-bindings/i2cperipheral/I2CPeripheral 2.c b/shared-bindings/i2cperipheral/I2CPeripheral 2.c
deleted file mode 100644
index b5ac861b4..000000000
--- a/shared-bindings/i2cperipheral/I2CPeripheral 2.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2018 Noralf Trønnes
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "shared-bindings/microcontroller/Pin.h"
-#include "shared-bindings/i2cperipheral/I2CPeripheral.h"
-#include "shared-bindings/time/__init__.h"
-#include "shared-bindings/util.h"
-
-#include "lib/utils/buffer_helper.h"
-#include "lib/utils/context_manager_helpers.h"
-#include "lib/utils/interrupt_char.h"
-
-#include "py/mperrno.h"
-#include "py/mphal.h"
-#include "py/obj.h"
-#include "py/objproperty.h"
-#include "py/runtime.h"
-
-STATIC mp_obj_t mp_obj_new_i2cperipheral_i2c_peripheral_request(i2cperipheral_i2c_peripheral_obj_t *peripheral, uint8_t address, bool is_read, bool is_restart) {
- i2cperipheral_i2c_peripheral_request_obj_t *self = m_new_obj(i2cperipheral_i2c_peripheral_request_obj_t);
- self->base.type = &i2cperipheral_i2c_peripheral_request_type;
- self->peripheral = peripheral;
- self->address = address;
- self->is_read = is_read;
- self->is_restart = is_restart;
- return (mp_obj_t)self;
-}
-
-//| class I2CPeripheral:
-//| """Two wire serial protocol peripheral"""
-//|
-//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: Sequence[int], smbus: bool = False) -> None:
-//| """I2C is a two-wire protocol for communicating between devices.
-//| This implements the peripheral (sensor, secondary) side.
-//|
-//| :param ~microcontroller.Pin scl: The clock pin
-//| :param ~microcontroller.Pin sda: The data pin
-//| :param addresses: The I2C addresses to respond to (how many is hw dependent).
-//| :type addresses: list[int]
-//| :param bool smbus: Use SMBUS timings if the hardware supports it"""
-//| ...
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- i2cperipheral_i2c_peripheral_obj_t *self = m_new_obj(i2cperipheral_i2c_peripheral_obj_t);
- self->base.type = &i2cperipheral_i2c_peripheral_type;
- enum { ARG_scl, ARG_sda, ARG_addresses, ARG_smbus };
- static const mp_arg_t allowed_args[] = {
- { MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ },
- { MP_QSTR_sda, MP_ARG_REQUIRED | MP_ARG_OBJ },
- { MP_QSTR_addresses, MP_ARG_REQUIRED | MP_ARG_OBJ },
- { MP_QSTR_smbus, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
- };
- 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);
-
- const mcu_pin_obj_t* scl = validate_obj_is_free_pin(args[ARG_scl].u_obj);
- const mcu_pin_obj_t* sda = validate_obj_is_free_pin(args[ARG_sda].u_obj);
-
- mp_obj_iter_buf_t iter_buf;
- mp_obj_t iterable = mp_getiter(args[ARG_addresses].u_obj, &iter_buf);
- mp_obj_t item;
- uint8_t *addresses = NULL;
- unsigned int i = 0;
- while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
- mp_int_t value;
- if (!mp_obj_get_int_maybe(item, &value)) {
- mp_raise_TypeError_varg(translate("can't convert %q to %q"), MP_QSTR_address, MP_QSTR_int);
- }
- if (value < 0x00 || value > 0x7f) {
- mp_raise_ValueError(translate("address out of bounds"));
- }
- addresses = m_renew(uint8_t, addresses, i, i + 1);
- addresses[i++] = value;
- }
- if (i == 0) {
- mp_raise_ValueError(translate("addresses is empty"));
- }
-
- common_hal_i2cperipheral_i2c_peripheral_construct(self, scl, sda, addresses, i, args[ARG_smbus].u_bool);
- return (mp_obj_t)self;
-}
-
-//| def deinit(self) -> None:
-//| """Releases control of the underlying hardware so other classes can use it."""
-//| ...
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj_deinit(mp_obj_t self_in) {
- mp_check_self(MP_OBJ_IS_TYPE(self_in, &i2cperipheral_i2c_peripheral_type));
- i2cperipheral_i2c_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
- common_hal_i2cperipheral_i2c_peripheral_deinit(self);
- return mp_const_none;
-}
-MP_DEFINE_CONST_FUN_OBJ_1(i2cperipheral_i2c_peripheral_deinit_obj, i2cperipheral_i2c_peripheral_obj_deinit);
-
-//| def __enter__(self) -> I2CPeripheral:
-//| """No-op used in Context Managers."""
-//| ...
-//|
-// Provided by context manager helper.
-
-//| def __exit__(self) -> None:
-//| """Automatically deinitializes the hardware on context exit. See
-//| :ref:`lifetime-and-contextmanagers` for more info."""
-//| ...
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj___exit__(size_t n_args, const mp_obj_t *args) {
- mp_check_self(MP_OBJ_IS_TYPE(args[0], &i2cperipheral_i2c_peripheral_type));
- i2cperipheral_i2c_peripheral_obj_t *self = MP_OBJ_TO_PTR(args[0]);
- common_hal_i2cperipheral_i2c_peripheral_deinit(self);
- return mp_const_none;
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_obj___exit__);
-
-//| def request(self, timeout: float = -1) -> I2CPeripheralRequest:
-//| """Wait for an I2C request.
-//|
-//| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once
-//| :return: I2C Slave Request or None if timeout=-1 and there's no request
-//| :rtype: ~i2cperipheral.I2CPeripheralRequest"""
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- mp_check_self(MP_OBJ_IS_TYPE(pos_args[0], &i2cperipheral_i2c_peripheral_type));
- i2cperipheral_i2c_peripheral_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
- if(common_hal_i2cperipheral_i2c_peripheral_deinited(self)) {
- raise_deinited_error();
- }
- enum { ARG_timeout };
- static const mp_arg_t allowed_args[] = {
- { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1)} },
- };
- mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
- mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
-
- #if MICROPY_PY_BUILTINS_FLOAT
- float f = mp_obj_get_float(args[ARG_timeout].u_obj) * 1000;
- int timeout_ms = (int)f;
- #else
- int timeout_ms = mp_obj_get_int(args[ARG_timeout].u_obj) * 1000;
- #endif
-
- bool forever = false;
- uint64_t timeout_end = 0;
- if (timeout_ms == 0) {
- forever = true;
- } else if (timeout_ms > 0) {
- timeout_end = common_hal_time_monotonic() + timeout_ms;
- }
-
- int last_error = 0;
-
- do {
- uint8_t address;
- bool is_read;
- bool is_restart;
-
- RUN_BACKGROUND_TASKS;
- if (mp_hal_is_interrupted()) {
- return mp_const_none;
- }
-
- int status = common_hal_i2cperipheral_i2c_peripheral_is_addressed(self, &address, &is_read, &is_restart);
- if (status < 0) {
- // On error try one more time before bailing out
- if (last_error) {
- mp_raise_OSError(last_error);
- }
- last_error = -status;
- mp_hal_delay_ms(10);
- continue;
- }
-
- last_error = 0;
-
- if (status == 0) {
- mp_hal_delay_us(10);
- continue;
- }
-
- return mp_obj_new_i2cperipheral_i2c_peripheral_request(self, address, is_read, is_restart);
- } while (forever || common_hal_time_monotonic() < timeout_end);
-
- if (timeout_ms > 0) {
- mp_raise_OSError(MP_ETIMEDOUT);
- }
- return mp_const_none;
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_KW(i2cperipheral_i2c_peripheral_request_obj, 1, i2cperipheral_i2c_peripheral_request);
-
-STATIC const mp_rom_map_elem_t i2cperipheral_i2c_peripheral_locals_dict_table[] = {
- { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_deinit_obj) },
- { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
- { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&i2cperipheral_i2c_peripheral___exit___obj) },
- { MP_ROM_QSTR(MP_QSTR_request), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_obj) },
-
-};
-
-STATIC MP_DEFINE_CONST_DICT(i2cperipheral_i2c_peripheral_locals_dict, i2cperipheral_i2c_peripheral_locals_dict_table);
-
-const mp_obj_type_t i2cperipheral_i2c_peripheral_type = {
- { &mp_type_type },
- .name = MP_QSTR_I2CPeripheral,
- .make_new = i2cperipheral_i2c_peripheral_make_new,
- .locals_dict = (mp_obj_dict_t*)&i2cperipheral_i2c_peripheral_locals_dict,
-};
-
-//| class I2CPeripheralRequest:
-//|
-//| def __init__(self, peripheral: i2cperipheral.I2CPeripheral, address: int, is_read: bool, is_restart: bool) -> None:
-//| """Information about an I2C transfer request
-//| This cannot be instantiated directly, but is returned by :py:meth:`I2CPeripheral.request`.
-//|
-//| :param peripheral: The I2CPeripheral object receiving this request
-//| :param address: I2C address
-//| :param is_read: True if the main peripheral is requesting data
-//| :param is_restart: Repeated Start Condition"""
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
- mp_arg_check_num(n_args, kw_args, 4, 4, false);
- return mp_obj_new_i2cperipheral_i2c_peripheral_request(args[0], mp_obj_get_int(args[1]), mp_obj_is_true(args[2]), mp_obj_is_true(args[3]));
-}
-
-//| def __enter__(self) -> I2CPeripheralRequest:
-//| """No-op used in Context Managers."""
-//| ...
-//|
-// Provided by context manager helper.
-
-//| def __exit__(self) -> None:
-//| """Close the request."""
-//| ...
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_obj___exit__(size_t n_args, const mp_obj_t *args) {
- mp_check_self(MP_OBJ_IS_TYPE(args[0], &i2cperipheral_i2c_peripheral_request_type));
- i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(args[0]);
- common_hal_i2cperipheral_i2c_peripheral_close(self->peripheral);
- return mp_const_none;
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral_request___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_request_obj___exit__);
-
-//| address: int
-//| """The I2C address of the request."""
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_address(mp_obj_t self_in) {
- mp_check_self(MP_OBJ_IS_TYPE(self_in, &i2cperipheral_i2c_peripheral_request_type));
- i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in);
- return mp_obj_new_int(self->address);
-}
-MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_address_obj, i2cperipheral_i2c_peripheral_request_get_address);
-
-//| is_read: bool
-//| """The I2C main controller is reading from this peripheral."""
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_read(mp_obj_t self_in) {
- mp_check_self(MP_OBJ_IS_TYPE(self_in, &i2cperipheral_i2c_peripheral_request_type));
- i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in);
- return mp_obj_new_bool(self->is_read);
-}
-MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_is_read_obj, i2cperipheral_i2c_peripheral_request_get_is_read);
-
-//| is_restart: bool
-//| """Is Repeated Start Condition."""
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_restart(mp_obj_t self_in) {
- mp_check_self(MP_OBJ_IS_TYPE(self_in, &i2cperipheral_i2c_peripheral_request_type));
- i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in);
- return mp_obj_new_bool(self->is_restart);
-}
-MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_is_restart_obj, i2cperipheral_i2c_peripheral_request_get_is_restart);
-
-//| def read(self, n: int = -1, ack: bool = True) -> bytearray:
-//| """Read data.
-//| If ack=False, the caller is responsible for calling :py:meth:`I2CPeripheralRequest.ack`.
-//|
-//| :param n: Number of bytes to read (negative means all)
-//| :param ack: Whether or not to send an ACK after the n'th byte
-//| :return: Bytes read"""
-//| ...
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- mp_check_self(MP_OBJ_IS_TYPE(pos_args[0], &i2cperipheral_i2c_peripheral_request_type));
- i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
- enum { ARG_n, ARG_ack };
- static const mp_arg_t allowed_args[] = {
- { MP_QSTR_n, MP_ARG_INT, {.u_int = -1} },
- { MP_QSTR_ack, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} },
- };
- mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
- mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
-
- if (self->is_read) {
- mp_raise_OSError(MP_EACCES);
- }
-
- int n = args[ARG_n].u_int;
- if (n == 0) {
- return mp_obj_new_bytearray(0, NULL);
- }
- bool ack = args[ARG_ack].u_bool;
-
- int i = 0;
- uint8_t *buffer = NULL;
- uint64_t timeout_end = common_hal_time_monotonic() + 10 * 1000;
- while (common_hal_time_monotonic() < timeout_end) {
- RUN_BACKGROUND_TASKS;
- if (mp_hal_is_interrupted()) {
- break;
- }
-
- uint8_t data;
- int num = common_hal_i2cperipheral_i2c_peripheral_read_byte(self->peripheral, &data);
- if (num == 0) {
- break;
- }
-
- buffer = m_renew(uint8_t, buffer, i, i + 1);
- buffer[i++] = data;
- if (i == n) {
- if (ack) {
- common_hal_i2cperipheral_i2c_peripheral_ack(self->peripheral, true);
- }
- break;
- }
- common_hal_i2cperipheral_i2c_peripheral_ack(self->peripheral, true);
- }
-
- return mp_obj_new_bytearray(i, buffer);
-}
-MP_DEFINE_CONST_FUN_OBJ_KW(i2cperipheral_i2c_peripheral_request_read_obj, 1, i2cperipheral_i2c_peripheral_request_read);
-
-//| def write(self, buffer: ReadableBuffer) -> int:
-//| """Write the data contained in buffer.
-//|
-//| :param ~_typing.ReadableBuffer buffer: Write out the data in this buffer
-//| :return: Number of bytes written"""
-//| ...
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_write(mp_obj_t self_in, mp_obj_t buf_in) {
- mp_check_self(MP_OBJ_IS_TYPE(self_in, &i2cperipheral_i2c_peripheral_request_type));
- i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in);
-
- if (!self->is_read) {
- mp_raise_OSError(MP_EACCES);
- }
-
- mp_buffer_info_t bufinfo;
- mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
-
- for (size_t i = 0; i < bufinfo.len; i++) {
- RUN_BACKGROUND_TASKS;
- if (mp_hal_is_interrupted()) {
- break;
- }
-
- int num = common_hal_i2cperipheral_i2c_peripheral_write_byte(self->peripheral, ((uint8_t *)(bufinfo.buf))[i]);
- if (num == 0) {
- return mp_obj_new_int(i);
- }
- }
-
- return mp_obj_new_int(bufinfo.len);
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(i2cperipheral_i2c_peripheral_request_write_obj, i2cperipheral_i2c_peripheral_request_write);
-
-//| def ack(self, ack: bool = True) -> None:
-//| """Acknowledge or Not Acknowledge last byte received.
-//| Use together with :py:meth:`I2CPeripheralRequest.read` ack=False.
-//|
-//| :param ack: Whether to send an ACK or NACK"""
-//| ...
-//|
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_ack(uint n_args, const mp_obj_t *args) {
- mp_check_self(MP_OBJ_IS_TYPE(args[0], &i2cperipheral_i2c_peripheral_request_type));
- i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(args[0]);
- bool ack = (n_args == 1) ? true : mp_obj_is_true(args[1]);
-
- if (self->is_read) {
- mp_raise_OSError(MP_EACCES);
- }
-
- common_hal_i2cperipheral_i2c_peripheral_ack(self->peripheral, ack);
- return mp_const_none;
-}
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral_request_ack_obj, 1, 2, i2cperipheral_i2c_peripheral_request_ack);
-
-STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_close(mp_obj_t self_in) {
- mp_check_self(MP_OBJ_IS_TYPE(self_in, &i2cperipheral_i2c_peripheral_request_type));
- i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in);
-
- common_hal_i2cperipheral_i2c_peripheral_close(self->peripheral);
- return mp_const_none;
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(i2cperipheral_i2c_peripheral_request_close_obj, i2cperipheral_i2c_peripheral_request_close);
-
-STATIC const mp_rom_map_elem_t i2cperipheral_i2c_peripheral_request_locals_dict_table[] = {
- { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
- { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request___exit___obj) },
- { MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_address_obj) },
- { MP_ROM_QSTR(MP_QSTR_is_read), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_is_read_obj) },
- { MP_ROM_QSTR(MP_QSTR_is_restart), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_is_restart_obj) },
- { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_read_obj) },
- { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_write_obj) },
- { MP_ROM_QSTR(MP_QSTR_ack), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_ack_obj) },
- { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_close_obj) },
-};
-
-STATIC MP_DEFINE_CONST_DICT(i2cperipheral_i2c_peripheral_request_locals_dict, i2cperipheral_i2c_peripheral_request_locals_dict_table);
-
-const mp_obj_type_t i2cperipheral_i2c_peripheral_request_type = {
- { &mp_type_type },
- .name = MP_QSTR_I2CPeripheralRequest,
- .make_new = i2cperipheral_i2c_peripheral_request_make_new,
- .locals_dict = (mp_obj_dict_t*)&i2cperipheral_i2c_peripheral_request_locals_dict,
-};
diff --git a/shared-bindings/i2cperipheral/I2CPeripheral 2.h b/shared-bindings/i2cperipheral/I2CPeripheral 2.h
deleted file mode 100644
index 3035cfbfe..000000000
--- a/shared-bindings/i2cperipheral/I2CPeripheral 2.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2018 Noralf Trønnes
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_SLAVE_H
-#define MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_SLAVE_H
-
-#include "py/obj.h"
-
-#include "common-hal/microcontroller/Pin.h"
-#include "common-hal/i2cperipheral/I2CPeripheral.h"
-
-typedef struct {
- mp_obj_base_t base;
- i2cperipheral_i2c_peripheral_obj_t *peripheral;
- uint16_t address;
- bool is_read;
- bool is_restart;
-} i2cperipheral_i2c_peripheral_request_obj_t;
-
-extern const mp_obj_type_t i2cperipheral_i2c_peripheral_request_type;
-
-extern const mp_obj_type_t i2cperipheral_i2c_peripheral_type;
-
-extern void common_hal_i2cperipheral_i2c_peripheral_construct(i2cperipheral_i2c_peripheral_obj_t *self,
- const mcu_pin_obj_t* scl, const mcu_pin_obj_t* sda,
- uint8_t *addresses, unsigned int num_addresses, bool smbus);
-extern void common_hal_i2cperipheral_i2c_peripheral_deinit(i2cperipheral_i2c_peripheral_obj_t *self);
-extern bool common_hal_i2cperipheral_i2c_peripheral_deinited(i2cperipheral_i2c_peripheral_obj_t *self);
-
-extern int common_hal_i2cperipheral_i2c_peripheral_is_addressed(i2cperipheral_i2c_peripheral_obj_t *self,
- uint8_t *address, bool *is_read, bool *is_restart);
-extern int common_hal_i2cperipheral_i2c_peripheral_read_byte(i2cperipheral_i2c_peripheral_obj_t *self, uint8_t *data);
-extern int common_hal_i2cperipheral_i2c_peripheral_write_byte(i2cperipheral_i2c_peripheral_obj_t *self, uint8_t data);
-extern void common_hal_i2cperipheral_i2c_peripheral_ack(i2cperipheral_i2c_peripheral_obj_t *self, bool ack);
-extern void common_hal_i2cperipheral_i2c_peripheral_close(i2cperipheral_i2c_peripheral_obj_t *self);
-
-#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_SLAVE_H
diff --git a/shared-bindings/i2cperipheral/__init__ 2.c b/shared-bindings/i2cperipheral/__init__ 2.c
deleted file mode 100644
index e2cb8509d..000000000
--- a/shared-bindings/i2cperipheral/__init__ 2.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2018 Noralf Trønnes
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdint.h>
-
-#include "py/obj.h"
-#include "py/runtime.h"
-
-#include "shared-bindings/microcontroller/Pin.h"
-//#include "shared-bindings/i2cperipheral/__init__.h"
-#include "shared-bindings/i2cperipheral/I2CPeripheral.h"
-
-#include "py/runtime.h"
-
-//| """Two wire serial protocol peripheral
-//|
-//| The `i2cperipheral` module contains classes to support an I2C peripheral.
-//|
-//| Example emulating a peripheral with 2 addresses (read and write)::
-//|
-//| import board
-//| from i2cperipheral import I2CPeripheral
-//|
-//| regs = [0] * 16
-//| index = 0
-//|
-//| with I2CPeripheral(board.SCL, board.SDA, (0x40, 0x41)) as device:
-//| while True:
-//| r = device.request()
-//| if not r:
-//| # Maybe do some housekeeping
-//| continue
-//| with r: # Closes the transfer if necessary by sending a NACK or feeding dummy bytes
-//| if r.address == 0x40:
-//| if not r.is_read: # Main write which is Selected read
-//| b = r.read(1)
-//| if not b or b[0] > 15:
-//| break
-//| index = b[0]
-//| b = r.read(1)
-//| if b:
-//| regs[index] = b[0]
-//| elif r.is_restart: # Combined transfer: This is the Main read message
-//| n = r.write(bytes([regs[index]]))
-//| #else:
-//| # A read transfer is not supported in this example
-//| # If the microcontroller tries, it will get 0xff byte(s) by the ctx manager (r.close())
-//| elif r.address == 0x41:
-//| if not r.is_read:
-//| b = r.read(1)
-//| if b and b[0] == 0xde:
-//| # do something
-//| pass
-//|
-//| This example sets up an I2C device that can be accessed from Linux like this::
-//|
-//| $ i2cget -y 1 0x40 0x01
-//| 0x00
-//| $ i2cset -y 1 0x40 0x01 0xaa
-//| $ i2cget -y 1 0x40 0x01
-//| 0xaa
-//|
-//| .. warning::
-//| I2CPeripheral makes use of clock stretching in order to slow down
-//| the host.
-//| Make sure the I2C host supports this.
-//|
-//| Raspberry Pi in particular does not support this with its I2C hw block.
-//| This can be worked around by using the ``i2c-gpio`` bit banging driver.
-//| Since the RPi firmware uses the hw i2c, it's not possible to emulate a HAT eeprom."""
-//|
-
-STATIC const mp_rom_map_elem_t i2cperipheral_module_globals_table[] = {
- { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2cperipheral) },
- { MP_ROM_QSTR(MP_QSTR_I2CPeripheral), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_type) },
-};
-
-STATIC MP_DEFINE_CONST_DICT(i2cperipheral_module_globals, i2cperipheral_module_globals_table);
-
-const mp_obj_module_t i2cperipheral_module = {
- .base = { &mp_type_module },
- .globals = (mp_obj_dict_t*)&i2cperipheral_module_globals,
-};
diff --git a/shared-bindings/memorymonitor/AllocationAlarm 2.c b/shared-bindings/memorymonitor/AllocationAlarm 2.c
deleted file mode 100644
index 7de8c1287..000000000
--- a/shared-bindings/memorymonitor/AllocationAlarm 2.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * This file is part of the Micro Python project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdint.h>
-
-#include "py/objproperty.h"
-#include "py/runtime.h"
-#include "py/runtime0.h"
-#include "shared-bindings/memorymonitor/AllocationAlarm.h"
-#include "shared-bindings/util.h"
-#include "supervisor/shared/translate.h"
-
-//| class AllocationAlarm:
-//|
-//| def __init__(self, *, minimum_block_count: int = 1) -> None:
-//| """Throw an exception when an allocation of ``minimum_block_count`` or more blocks
-//| occurs while active.
-//|
-//| Track allocations::
-//|
-//| import memorymonitor
-//|
-//| aa = memorymonitor.AllocationAlarm(minimum_block_count=2)
-//| x = 2
-//| # Should not allocate any blocks.
-//| with aa:
-//| x = 5
-//|
-//| # Should throw an exception when allocating storage for the 20 bytes.
-//| with aa:
-//| x = bytearray(20)
-//|
-//| """
-//| ...
-//|
-STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- enum { ARG_minimum_block_count };
- static const mp_arg_t allowed_args[] = {
- { MP_QSTR_minimum_block_count, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
- };
- 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);
- mp_int_t minimum_block_count = args[ARG_minimum_block_count].u_int;
- if (minimum_block_count < 1) {
- mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_minimum_block_count);
- }
-
- memorymonitor_allocationalarm_obj_t *self = m_new_obj(memorymonitor_allocationalarm_obj_t);
- self->base.type = &memorymonitor_allocationalarm_type;
-
- common_hal_memorymonitor_allocationalarm_construct(self, minimum_block_count);
-
- return MP_OBJ_FROM_PTR(self);
-}
-
-//| def ignore(self, count: int) -> AllocationAlarm:
-//| """Sets the number of applicable allocations to ignore before raising the exception.
-//| Automatically set back to zero at context exit.
-//|
-//| Use it within a ``with`` block::
-//|
-//| # Will not alarm because the bytearray allocation will be ignored.
-//| with aa.ignore(2):
-//| x = bytearray(20)
-//| """
-//| ...
-//|
-STATIC mp_obj_t memorymonitor_allocationalarm_obj_ignore(mp_obj_t self_in, mp_obj_t count_obj) {
- mp_int_t count = mp_obj_get_int(count_obj);
- if (count < 0) {
- mp_raise_ValueError_varg(translate("%q must be >= 0"), MP_QSTR_count);
- }
- common_hal_memorymonitor_allocationalarm_set_ignore(self_in, count);
- return self_in;
-}
-MP_DEFINE_CONST_FUN_OBJ_2(memorymonitor_allocationalarm_ignore_obj, memorymonitor_allocationalarm_obj_ignore);
-
-//| def __enter__(self) -> AllocationAlarm:
-//| """Enables the alarm."""
-//| ...
-//|
-STATIC mp_obj_t memorymonitor_allocationalarm_obj___enter__(mp_obj_t self_in) {
- common_hal_memorymonitor_allocationalarm_resume(self_in);
- return self_in;
-}
-MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationalarm___enter___obj, memorymonitor_allocationalarm_obj___enter__);
-
-//| def __exit__(self) -> None:
-//| """Automatically disables the allocation alarm when exiting a context. See
-//| :ref:`lifetime-and-contextmanagers` for more info."""
-//| ...
-//|
-STATIC mp_obj_t memorymonitor_allocationalarm_obj___exit__(size_t n_args, const mp_obj_t *args) {
- (void)n_args;
- common_hal_memorymonitor_allocationalarm_set_ignore(args[0], 0);
- common_hal_memorymonitor_allocationalarm_pause(args[0]);
- return mp_const_none;
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationalarm___exit___obj, 4, 4, memorymonitor_allocationalarm_obj___exit__);
-
-STATIC const mp_rom_map_elem_t memorymonitor_allocationalarm_locals_dict_table[] = {
- // Methods
- { MP_ROM_QSTR(MP_QSTR_ignore), MP_ROM_PTR(&memorymonitor_allocationalarm_ignore_obj) },
- { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&memorymonitor_allocationalarm___enter___obj) },
- { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&memorymonitor_allocationalarm___exit___obj) },
-};
-STATIC MP_DEFINE_CONST_DICT(memorymonitor_allocationalarm_locals_dict, memorymonitor_allocationalarm_locals_dict_table);
-
-const mp_obj_type_t memorymonitor_allocationalarm_type = {
- { &mp_type_type },
- .name = MP_QSTR_AllocationAlarm,
- .make_new = memorymonitor_allocationalarm_make_new,
- .locals_dict = (mp_obj_dict_t*)&memorymonitor_allocationalarm_locals_dict,
-};
diff --git a/shared-bindings/memorymonitor/AllocationAlarm 2.h b/shared-bindings/memorymonitor/AllocationAlarm 2.h
deleted file mode 100644
index 304b9c5a7..000000000
--- a/shared-bindings/memorymonitor/AllocationAlarm 2.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is part of the Micro Python project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONALARM_H
-#define MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONALARM_H
-
-#include "shared-module/memorymonitor/AllocationAlarm.h"
-
-extern const mp_obj_type_t memorymonitor_allocationalarm_type;
-
-void common_hal_memorymonitor_allocationalarm_construct(memorymonitor_allocationalarm_obj_t* self, size_t minimum_block_count);
-void common_hal_memorymonitor_allocationalarm_pause(memorymonitor_allocationalarm_obj_t* self);
-void common_hal_memorymonitor_allocationalarm_resume(memorymonitor_allocationalarm_obj_t* self);
-void common_hal_memorymonitor_allocationalarm_set_ignore(memorymonitor_allocationalarm_obj_t* self, mp_int_t count);
-
-#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONALARM_H
diff --git a/shared-bindings/memorymonitor/AllocationSize 2.c b/shared-bindings/memorymonitor/AllocationSize 2.c
deleted file mode 100644
index b35bae360..000000000
--- a/shared-bindings/memorymonitor/AllocationSize 2.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * This file is part of the Micro Python project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdint.h>
-
-#include "py/objproperty.h"
-#include "py/runtime.h"
-#include "py/runtime0.h"
-#include "shared-bindings/memorymonitor/AllocationSize.h"
-#include "shared-bindings/util.h"
-#include "supervisor/shared/translate.h"
-
-//| class AllocationSize:
-//|
-//| def __init__(self) -> None:
-//| """Tracks the number of allocations in power of two buckets.
-//|
-//| It will have 16 16-bit buckets to track allocation counts. It is total allocations
-//| meaning frees are ignored. Reallocated memory is counted twice, at allocation and when
-//| reallocated with the larger size.
-//|
-//| The buckets are measured in terms of blocks which is the finest granularity of the heap.
-//| This means bucket 0 will count all allocations less than or equal to the number of bytes
-//| per block, typically 16. Bucket 2 will be less than or equal to 4 blocks. See
-//| `bytes_per_block` to convert blocks to bytes.
-//|
-//| Multiple AllocationSizes can be used to track different code boundaries.
-//|
-//| Track allocations::
-//|
-//| import memorymonitor
-//|
-//| mm = memorymonitor.AllocationSize()
-//| with mm:
-//| print("hello world" * 3)
-//|
-//| for bucket, count in enumerate(mm):
-//| print("<", 2 ** bucket, count)
-//|
-//| """
-//| ...
-//|
-STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- memorymonitor_allocationsize_obj_t *self = m_new_obj(memorymonitor_allocationsize_obj_t);
- self->base.type = &memorymonitor_allocationsize_type;
-
- common_hal_memorymonitor_allocationsize_construct(self);
-
- return MP_OBJ_FROM_PTR(self);
-}
-
-//| def __enter__(self) -> AllocationSize:
-//| """Clears counts and resumes tracking."""
-//| ...
-//|
-STATIC mp_obj_t memorymonitor_allocationsize_obj___enter__(mp_obj_t self_in) {
- common_hal_memorymonitor_allocationsize_clear(self_in);
- common_hal_memorymonitor_allocationsize_resume(self_in);
- return self_in;
-}
-MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize___enter___obj, memorymonitor_allocationsize_obj___enter__);
-
-//| def __exit__(self) -> None:
-//| """Automatically pauses allocation tracking when exiting a context. See
-//| :ref:`lifetime-and-contextmanagers` for more info."""
-//| ...
-//|
-STATIC mp_obj_t memorymonitor_allocationsize_obj___exit__(size_t n_args, const mp_obj_t *args) {
- (void)n_args;
- common_hal_memorymonitor_allocationsize_pause(args[0]);
- return mp_const_none;
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationsize___exit___obj, 4, 4, memorymonitor_allocationsize_obj___exit__);
-
-//| bytes_per_block: int
-//| """Number of bytes per block"""
-//|
-STATIC mp_obj_t memorymonitor_allocationsize_obj_get_bytes_per_block(mp_obj_t self_in) {
- memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in);
-
- return MP_OBJ_NEW_SMALL_INT(common_hal_memorymonitor_allocationsize_get_bytes_per_block(self));
-}
-MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize_get_bytes_per_block_obj, memorymonitor_allocationsize_obj_get_bytes_per_block);
-
-const mp_obj_property_t memorymonitor_allocationsize_bytes_per_block_obj = {
- .base.type = &mp_type_property,
- .proxy = {(mp_obj_t)&memorymonitor_allocationsize_get_bytes_per_block_obj,
- (mp_obj_t)&mp_const_none_obj,
- (mp_obj_t)&mp_const_none_obj},
-};
-
-//| def __len__(self) -> int:
-//| """Returns the number of allocation buckets.
-//|
-//| This allows you to::
-//|
-//| mm = memorymonitor.AllocationSize()
-//| print(len(mm))"""
-//| ...
-//|
-STATIC mp_obj_t memorymonitor_allocationsize_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
- memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in);
- uint16_t len = common_hal_memorymonitor_allocationsize_get_len(self);
- switch (op) {
- case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0);
- case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(len);
- default: return MP_OBJ_NULL; // op not supported
- }
-}
-
-//| def __getitem__(self, index: int) -> Optional[int]:
-//| """Returns the allocation count for the given bucket.
-//|
-//| This allows you to::
-//|
-//| mm = memorymonitor.AllocationSize()
-//| print(mm[0])"""
-//| ...
-//|
-STATIC mp_obj_t memorymonitor_allocationsize_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value) {
- if (value == mp_const_none) {
- // delete item
- mp_raise_AttributeError(translate("Cannot delete values"));
- } else {
- memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in);
-
- if (MP_OBJ_IS_TYPE(index_obj, &mp_type_slice)) {
- mp_raise_NotImplementedError(translate("Slices not supported"));
- } else {
- size_t index = mp_get_index(&memorymonitor_allocationsize_type, common_hal_memorymonitor_allocationsize_get_len(self), index_obj, false);
- if (value == MP_OBJ_SENTINEL) {
- // load
- return MP_OBJ_NEW_SMALL_INT(common_hal_memorymonitor_allocationsize_get_item(self, index));
- } else {
- mp_raise_AttributeError(translate("Read-only"));
- }
- }
- }
- return mp_const_none;
-}
-
-STATIC const mp_rom_map_elem_t memorymonitor_allocationsize_locals_dict_table[] = {
- // Methods
- { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&memorymonitor_allocationsize___enter___obj) },
- { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&memorymonitor_allocationsize___exit___obj) },
-
- // Properties
- { MP_ROM_QSTR(MP_QSTR_bytes_per_block), MP_ROM_PTR(&memorymonitor_allocationsize_bytes_per_block_obj) },
-};
-STATIC MP_DEFINE_CONST_DICT(memorymonitor_allocationsize_locals_dict, memorymonitor_allocationsize_locals_dict_table);
-
-const mp_obj_type_t memorymonitor_allocationsize_type = {
- { &mp_type_type },
- .name = MP_QSTR_AllocationSize,
- .make_new = memorymonitor_allocationsize_make_new,
- .subscr = memorymonitor_allocationsize_subscr,
- .unary_op = memorymonitor_allocationsize_unary_op,
- .getiter = mp_obj_new_generic_iterator,
- .locals_dict = (mp_obj_dict_t*)&memorymonitor_allocationsize_locals_dict,
-};
diff --git a/shared-bindings/memorymonitor/AllocationSize 2.h b/shared-bindings/memorymonitor/AllocationSize 2.h
deleted file mode 100644
index bcd9514bf..000000000
--- a/shared-bindings/memorymonitor/AllocationSize 2.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of the Micro Python project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONSIZE_H
-#define MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONSIZE_H
-
-#include "shared-module/memorymonitor/AllocationSize.h"
-
-extern const mp_obj_type_t memorymonitor_allocationsize_type;
-
-extern void common_hal_memorymonitor_allocationsize_construct(memorymonitor_allocationsize_obj_t* self);
-extern void common_hal_memorymonitor_allocationsize_pause(memorymonitor_allocationsize_obj_t* self);
-extern void common_hal_memorymonitor_allocationsize_resume(memorymonitor_allocationsize_obj_t* self);
-extern void common_hal_memorymonitor_allocationsize_clear(memorymonitor_allocationsize_obj_t* self);
-extern size_t common_hal_memorymonitor_allocationsize_get_bytes_per_block(memorymonitor_allocationsize_obj_t* self);
-extern uint16_t common_hal_memorymonitor_allocationsize_get_len(memorymonitor_allocationsize_obj_t* self);
-extern uint16_t common_hal_memorymonitor_allocationsize_get_item(memorymonitor_allocationsize_obj_t* self, int16_t index);
-
-#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR_ALLOCATIONSIZE_H
diff --git a/shared-bindings/memorymonitor/__init__ 2.c b/shared-bindings/memorymonitor/__init__ 2.c
deleted file mode 100644
index c101ba5e0..000000000
--- a/shared-bindings/memorymonitor/__init__ 2.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2020 Scott Shawcroft
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdint.h>
-
-#include "py/obj.h"
-#include "py/runtime.h"
-
-#include "shared-bindings/memorymonitor/__init__.h"
-#include "shared-bindings/memorymonitor/AllocationAlarm.h"
-#include "shared-bindings/memorymonitor/AllocationSize.h"
-
-//| """Memory monitoring helpers"""
-//|
-
-//| class AllocationError(Exception):
-//| """Catchall exception for allocation related errors."""
-//| ...
-MP_DEFINE_MEMORYMONITOR_EXCEPTION(AllocationError, Exception)
-
-NORETURN void mp_raise_memorymonitor_AllocationError(const compressed_string_t* fmt, ...) {
- va_list argptr;
- va_start(argptr,fmt);
- mp_obj_t exception = mp_obj_new_exception_msg_vlist(&mp_type_memorymonitor_AllocationError, fmt, argptr);
- va_end(argptr);
- nlr_raise(exception);
-}
-
-STATIC const mp_rom_map_elem_t memorymonitor_module_globals_table[] = {
- { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_memorymonitor) },
- { MP_ROM_QSTR(MP_QSTR_AllocationAlarm), MP_ROM_PTR(&memorymonitor_allocationalarm_type) },
- { MP_ROM_QSTR(MP_QSTR_AllocationSize), MP_ROM_PTR(&memorymonitor_allocationsize_type) },
-
- // Errors
- { MP_ROM_QSTR(MP_QSTR_AllocationError), MP_ROM_PTR(&mp_type_memorymonitor_AllocationError) },
-};
-
-STATIC MP_DEFINE_CONST_DICT(memorymonitor_module_globals, memorymonitor_module_globals_table);
-
-void memorymonitor_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
- mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS;
- bool is_subclass = kind & PRINT_EXC_SUBCLASS;
- if (!is_subclass && (k == PRINT_EXC)) {
- mp_print_str(print, qstr_str(MP_OBJ_QSTR_VALUE(memorymonitor_module_globals_table[0].value)));
- mp_print_str(print, ".");
- }
- mp_obj_exception_print(print, o_in, kind);
-}
-
-const mp_obj_module_t memorymonitor_module = {
- .base = { &mp_type_module },
- .globals = (mp_obj_dict_t*)&memorymonitor_module_globals,
-};
diff --git a/shared-bindings/memorymonitor/__init__ 2.h b/shared-bindings/memorymonitor/__init__ 2.h
deleted file mode 100644
index 60fcdc3f6..000000000
--- a/shared-bindings/memorymonitor/__init__ 2.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 Scott Shawcroft
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR___INIT___H
-#define MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR___INIT___H
-
-#include "py/obj.h"
-
-
-void memorymonitor_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
-
-#define MP_DEFINE_MEMORYMONITOR_EXCEPTION(exc_name, base_name) \
-const mp_obj_type_t mp_type_memorymonitor_ ## exc_name = { \
- { &mp_type_type }, \
- .name = MP_QSTR_ ## exc_name, \
- .print = memorymonitor_exception_print, \
- .make_new = mp_obj_exception_make_new, \
- .attr = mp_obj_exception_attr, \
- .parent = &mp_type_ ## base_name, \
-};
-
-extern const mp_obj_type_t mp_type_memorymonitor_AllocationError;
-
-NORETURN void mp_raise_memorymonitor_AllocationError(const compressed_string_t* msg, ...);
-
-#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMONITOR___INIT___H
diff --git a/shared-bindings/sdcardio/SDCard 2.c b/shared-bindings/sdcardio/SDCard 2.c
deleted file mode 100644
index 975f8b095..000000000
--- a/shared-bindings/sdcardio/SDCard 2.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * This file is part of the Micro Python project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2020 Jeff Epler for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "py/obj.h"
-#include "py/objproperty.h"
-#include "py/runtime.h"
-#include "py/objarray.h"
-
-#include "shared-bindings/sdcardio/SDCard.h"
-#include "shared-module/sdcardio/SDCard.h"
-#include "common-hal/busio/SPI.h"
-#include "shared-bindings/busio/SPI.h"
-#include "shared-bindings/microcontroller/Pin.h"
-#include "supervisor/flash.h"
-
-//| class SDCard:
-//| """SD Card Block Interface
-//|
-//| Controls an SD card over SPI. This built-in module has higher read
-//| performance than the library adafruit_sdcard, but it is only compatible with
-//| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used
-//| with ``storage.VfsFat`` to allow file I/O to an SD card."""
-//|
-//| def __init__(self, bus: busio.SPI, cs: microcontroller.Pin, baudrate: int = 8000000) -> None:
-//| """Construct an SPI SD Card object with the given properties
-//|
-//| :param busio.SPI spi: The SPI bus
-//| :param microcontroller.Pin cs: The chip select connected to the card
-//| :param int baudrate: The SPI data rate to use after card setup
-//|
-//| Note that during detection and configuration, a hard-coded low baudrate is used.
-//| Data transfers use the specified baurate (rounded down to one that is supported by
-//| the microcontroller)
-//|
-//| Example usage:
-//|
-//| .. code-block:: python
-//|
-//| import os
-//|
-//| import board
-//| import sdcardio
-//| import storage
-//|
-//| sd = sdcardio.SDCard(board.SPI(), board.SD_CS)
-//| vfs = storage.VfsFat(sd)
-//| storage.mount(vfs, '/sd')
-//| os.listdir('/sd')"""
-
-STATIC mp_obj_t sdcardio_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- enum { ARG_spi, ARG_cs, ARG_baudrate, ARG_sdio, NUM_ARGS };
- static const mp_arg_t allowed_args[] = {
- { MP_QSTR_spi, MP_ARG_OBJ, {.u_obj = mp_const_none } },
- { MP_QSTR_cs, MP_ARG_OBJ, {.u_obj = mp_const_none } },
- { MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 8000000} },
- { MP_QSTR_sdio, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_int = 8000000} },
- };
- MP_STATIC_ASSERT( MP_ARRAY_SIZE(allowed_args) == NUM_ARGS );
- 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);
-
- busio_spi_obj_t *spi = validate_obj_is_spi_bus(args[ARG_spi].u_obj);
- mcu_pin_obj_t *cs = validate_obj_is_free_pin(args[ARG_cs].u_obj);
-
- sdcardio_sdcard_obj_t *self = m_new_obj(sdcardio_sdcard_obj_t);
- self->base.type = &sdcardio_SDCard_type;
-
- common_hal_sdcardio_sdcard_construct(self, spi, cs, args[ARG_baudrate].u_int);
-
- return self;
-}
-
-
-//| def count(self) -> int:
-//| """Returns the total number of sectors
-//|
-//| Due to technical limitations, this is a function and not a property.
-//|
-//| :return: The number of 512-byte blocks, as a number"""
-//|
-mp_obj_t sdcardio_sdcard_count(mp_obj_t self_in) {
- sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t*)self_in;
- return mp_obj_new_int_from_ull(common_hal_sdcardio_sdcard_get_blockcount(self));
-}
-MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_count_obj, sdcardio_sdcard_count);
-
-//| def deinit(self) -> None:
-//| """Disable permanently.
-//|
-//| :return: None"""
-//|
-mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) {
- sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t*)self_in;
- common_hal_sdcardio_sdcard_deinit(self);
- return mp_const_none;
-}
-MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit);
-
-
-//| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None:
-//|
-//| """Read one or more blocks from the card
-//|
-//| :param int start_block: The block to start reading from
-//| :param ~_typing.WriteableBuffer buf: The buffer to write into. Length must be multiple of 512.
-//|
-//| :return: None"""
-//|
-
-mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) {
- uint32_t start_block = mp_obj_get_int(start_block_in);
- mp_buffer_info_t bufinfo;
- mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE);
- sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t*)self_in;
- int result = common_hal_sdcardio_sdcard_readblocks(self, start_block, &bufinfo);
- if (result < 0) {
- mp_raise_OSError(-result);
- }
- return mp_const_none;
-}
-
-MP_DEFINE_CONST_FUN_OBJ_3(sdcardio_sdcard_readblocks_obj, sdcardio_sdcard_readblocks);
-
-//| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None:
-//|
-//| """Write one or more blocks to the card
-//|
-//| :param int start_block: The block to start writing from
-//| :param ~_typing.ReadableBuffer buf: The buffer to read from. Length must be multiple of 512.
-//|
-//| :return: None"""
-//|
-
-mp_obj_t sdcardio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) {
- uint32_t start_block = mp_obj_get_int(start_block_in);
- mp_buffer_info_t bufinfo;
- mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
- sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t*)self_in;
- int result = common_hal_sdcardio_sdcard_writeblocks(self, start_block, &bufinfo);
- if (result < 0) {
- mp_raise_OSError(-result);
- }
- return mp_const_none;
-}
-MP_DEFINE_CONST_FUN_OBJ_3(sdcardio_sdcard_writeblocks_obj, sdcardio_sdcard_writeblocks);
-
-STATIC const mp_rom_map_elem_t sdcardio_sdcard_locals_dict_table[] = {
- { MP_ROM_QSTR(MP_QSTR_count), MP_ROM_PTR(&sdcardio_sdcard_count_obj) },
- { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&sdcardio_sdcard_deinit_obj) },
- { MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&sdcardio_sdcard_readblocks_obj) },
- { MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&sdcardio_sdcard_writeblocks_obj) },
-};
-STATIC MP_DEFINE_CONST_DICT(sdcardio_sdcard_locals_dict, sdcardio_sdcard_locals_dict_table);
-
-const mp_obj_type_t sdcardio_SDCard_type = {
- { &mp_type_type },
- .name = MP_QSTR_SDCard,
- .make_new = sdcardio_sdcard_make_new,
- .locals_dict = (mp_obj_dict_t*)&sdcardio_sdcard_locals_dict,
-};
diff --git a/shared-bindings/sdcardio/SDCard 2.h b/shared-bindings/sdcardio/SDCard 2.h
deleted file mode 100644
index 5986d5b81..000000000
--- a/shared-bindings/sdcardio/SDCard 2.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of the Micro Python project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2017, 2018 Scott Shawcroft for Adafruit Industries
- * Copyright (c) 2020 Jeff Epler for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#pragma once
-
-extern const mp_obj_type_t sdcardio_SDCard_type;
diff --git a/shared-bindings/sdcardio/__init__ 2.c b/shared-bindings/sdcardio/__init__ 2.c
deleted file mode 100644
index 746aa5588..000000000
--- a/shared-bindings/sdcardio/__init__ 2.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2020 Jeff Epler for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-
-#include <stdint.h>
-
-#include "py/obj.h"
-#include "py/runtime.h"
-
-#include "shared-bindings/sdcardio/SDCard.h"
-
-//| """Interface to an SD card via the SPI bus"""
-
-STATIC const mp_rom_map_elem_t sdcardio_module_globals_table[] = {
- { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sdcardio) },
- { MP_ROM_QSTR(MP_QSTR_SDCard), MP_ROM_PTR(&sdcardio_SDCard_type) },
-};
-
-STATIC MP_DEFINE_CONST_DICT(sdcardio_module_globals, sdcardio_module_globals_table);
-
-const mp_obj_module_t sdcardio_module = {
- .base = { &mp_type_module },
- .globals = (mp_obj_dict_t*)&sdcardio_module_globals,
-};
diff --git a/shared-bindings/sdcardio/__init__ 2.h b/shared-bindings/sdcardio/__init__ 2.h
deleted file mode 100644
index e69de29bb..000000000
--- a/shared-bindings/sdcardio/__init__ 2.h
+++ /dev/null