Skip to content

Commit deda980

Browse files
committed
Cleanup copy-paste comments in MAX32 busio files
Signed-off-by: Brandon Hurst <[email protected]>
1 parent 5cf0305 commit deda980

File tree

6 files changed

+5
-54
lines changed

6 files changed

+5
-54
lines changed

ports/analog/common-hal/busio/I2C.c

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,14 @@ typedef enum {
4040
I2C_NEVER_RESET,
4141
} i2c_status_t;
4242

43-
// Set each bit to indicate an active UART
44-
// will be checked by ISR Handler for which ones to call
43+
// Set each bit to indicate an active I2c
4544
static uint8_t i2c_active = 0;
4645
static i2c_status_t i2c_status[NUM_I2C];
4746
static volatile int i2c_err;
4847

4948
// I2C struct for configuring GPIO pins
5049
extern const mxc_gpio_cfg_t i2c_maps[NUM_I2C];
5150

52-
// I2C Interrupt Handler
53-
void i2c_isr(void) {
54-
for (int i = 0; i < NUM_I2C; i++) {
55-
if (i2c_active & (1 << i)) {
56-
// NOTE: I2C_GET_TMR actually returns the I2C registers
57-
MXC_I2C_AsyncHandler(MXC_I2C_GET_I2C(i));
58-
}
59-
}
60-
}
61-
62-
// Callback gets called when AsyncRequest is COMPLETE
63-
// (e.g. txLen == txCnt)
64-
// static volatile void i2cCallback(mxc_i2c_req_t *req, int error) {
65-
// i2c_status[MXC_I2C_GET_IDX(req->i2c)] = I2C_FREE;
66-
// i2c_err = error;
67-
// }
68-
6951
// Construct I2C protocol, this function init i2c peripheral
7052
void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
7153
const mcu_pin_obj_t *scl,
@@ -80,7 +62,6 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
8062
// Assign I2C ID based on pins
8163
temp = pinsToI2c(sda, scl);
8264
if (temp == -1) {
83-
// Error will be indicated by pinsToUart(tx, rx) function
8465
return;
8566
} else {
8667
self->i2c_id = temp;
@@ -124,12 +105,6 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
124105
self->timeout = timeout;
125106
}
126107

127-
/* Setup I2C interrupt */
128-
NVIC_ClearPendingIRQ(MXC_I2C_GET_IRQ(self->i2c_id));
129-
NVIC_DisableIRQ(MXC_I2C_GET_IRQ(self->i2c_id));
130-
NVIC_SetPriority(MXC_I2C_GET_IRQ(self->i2c_id), I2C_PRIORITY);
131-
NVIC_SetVector(MXC_I2C_GET_IRQ(self->i2c_id), (uint32_t)i2c_isr);
132-
133108
return;
134109
}
135110

ports/analog/common-hal/busio/I2C.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#pragma once
88

99
#include "common-hal/microcontroller/Pin.h"
10-
// FIXME: Silabs includes "peripherals/periph.h. Figure out what's in this file. "
1110
#include "py/obj.h"
1211

1312
// HAL-specific

ports/analog/common-hal/busio/SPI.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,36 +46,24 @@ typedef enum {
4646
} spi_status_t;
4747

4848
// Set each bit to indicate an active SPI
49-
// will be checked by ISR Handler for which ones to call
5049
static uint8_t spi_active = 0;
5150
static spi_status_t spi_status[NUM_SPI];
5251
static volatile int spi_err;
5352

54-
// SPI Interrupt Handler
55-
void spi_isr(void) {
56-
for (int i = 0; i < NUM_SPI; i++) {
57-
if (spi_active & (1 << i)) {
58-
MXC_SPI_AsyncHandler(MXC_SPI_GET_SPI(i));
59-
}
60-
}
61-
}
62-
6353
// Construct SPI protocol, this function init SPI peripheral
64-
// todo: figure out Chip select behavior
6554
void common_hal_busio_spi_construct(busio_spi_obj_t *self,
6655
const mcu_pin_obj_t *sck,
6756
const mcu_pin_obj_t *mosi,
6857
const mcu_pin_obj_t *miso,
6958
bool half_duplex) {
7059
int temp, err = 0;
7160

72-
// Check for NULL Pointers && valid I2C settings
61+
// Check for NULL Pointer
7362
assert(self);
7463

75-
// Assign I2C ID based on pins
64+
// Assign SPI ID based on pins
7665
temp = pinsToSpi(mosi, miso, sck);
7766
if (temp == -1) {
78-
// Error will be indicated by pinsToUart(tx, rx) function
7967
return;
8068
} else {
8169
self->spi_id = temp;
@@ -120,12 +108,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
120108
// Indicate to this module that the SPI is active
121109
spi_active |= (1 << self->spi_id);
122110

123-
/* Setup I2C interrupt */
124-
NVIC_ClearPendingIRQ(MXC_SPI_GET_IRQ(self->spi_id));
125-
NVIC_DisableIRQ(MXC_SPI_GET_IRQ(self->spi_id));
126-
NVIC_SetPriority(MXC_SPI_GET_IRQ(self->spi_id), SPI_PRIORITY);
127-
NVIC_SetVector(MXC_SPI_GET_IRQ(self->spi_id), (uint32_t)spi_isr);
128-
129111
return;
130112
}
131113

ports/analog/common-hal/busio/SPI.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#define MICROPY_INCLUDED_MAX32_COMMON_HAL_BUSIO_SPI_H
99

1010
#include "common-hal/microcontroller/Pin.h"
11-
// FIXME: Silabs includes "peripherals/periph.h. Figure out what's in this file. "
1211
#include "py/obj.h"
1312

1413
// HAL-specific

ports/analog/common-hal/busio/UART.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
167167
const mcu_pin_obj_t *rts, const mcu_pin_obj_t *cts,
168168
const mcu_pin_obj_t *rs485_dir, bool rs485_invert,
169169
uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop,
170-
mp_float_t timeout, bool sigint_enabled) {
170+
mp_float_t timeout, uint16_t receiver_buffer_size, byte *receiver_buffer,
171+
bool sigint_enabled) {
171172
int err, temp;
172173

173174
// Check for NULL Pointers && valid UART settings

ports/analog/common-hal/busio/UART.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99

1010
#include "common-hal/microcontroller/Pin.h"
1111
#include "py/obj.h"
12-
#include "py/ringbuf.h"
13-
14-
// #include "uart.h"
15-
// #include "uart_regs.h"
16-
// #include "mxc_sys.h"
1712

1813
#include "max32_port.h"
1914

0 commit comments

Comments
 (0)