summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal')
-rw-r--r--stmhal/dac.c4
-rw-r--r--stmhal/extint.c10
-rw-r--r--stmhal/file.c10
-rw-r--r--stmhal/gccollect.c8
-rw-r--r--stmhal/i2c.c16
-rw-r--r--stmhal/led.c8
-rw-r--r--stmhal/modos.c2
-rw-r--r--stmhal/modpyb.c4
-rw-r--r--stmhal/mpconfigport.h4
-rw-r--r--stmhal/pin.c4
-rw-r--r--stmhal/pybstdio.c4
-rw-r--r--stmhal/rtc.c6
-rw-r--r--stmhal/servo.c2
-rw-r--r--stmhal/spi.c2
-rw-r--r--stmhal/timer.c2
-rw-r--r--stmhal/uart.c2
16 files changed, 44 insertions, 44 deletions
diff --git a/stmhal/dac.c b/stmhal/dac.c
index 725e14e906..df46d24904 100644
--- a/stmhal/dac.c
+++ b/stmhal/dac.c
@@ -97,7 +97,7 @@ typedef struct _pyb_dac_obj_t {
mp_obj_base_t base;
uint32_t dac_channel; // DAC_CHANNEL_1 or DAC_CHANNEL_2
DMA_Stream_TypeDef *dma_stream; // DMA1_Stream5 or DMA1_Stream6
- machine_uint_t state;
+ mp_uint_t state;
} pyb_dac_obj_t;
// create the dac object
@@ -114,7 +114,7 @@ STATIC mp_obj_t pyb_dac_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
pyb_dac_obj_t *dac = m_new_obj(pyb_dac_obj_t);
dac->base.type = &pyb_dac_type;
- machine_int_t dac_id = mp_obj_get_int(args[0]);
+ mp_int_t dac_id = mp_obj_get_int(args[0]);
uint32_t pin;
if (dac_id == 1) {
pin = GPIO_PIN_4;
diff --git a/stmhal/extint.c b/stmhal/extint.c
index 591246cdd1..d2eace5745 100644
--- a/stmhal/extint.c
+++ b/stmhal/extint.c
@@ -101,14 +101,14 @@
#define EXTI_SWIER_BB(line) (*(__IO uint32_t *)(PERIPH_BB_BASE + ((EXTI_OFFSET + offsetof(EXTI_TypeDef, SWIER)) * 32) + ((line) * 4)))
typedef struct {
- mp_obj_base_t base;
- mp_small_int_t line;
+ mp_obj_base_t base;
+ mp_int_t line;
} extint_obj_t;
typedef struct {
- mp_obj_t callback_obj;
- void *param;
- uint32_t mode;
+ mp_obj_t callback_obj;
+ void *param;
+ uint32_t mode;
} extint_vector_t;
STATIC extint_vector_t extint_vector[EXTI_NUM_VECTORS];
diff --git a/stmhal/file.c b/stmhal/file.c
index 079ab3965b..2d33a8f7b4 100644
--- a/stmhal/file.c
+++ b/stmhal/file.c
@@ -73,7 +73,7 @@ void file_obj_print(void (*print)(void *env, const char *fmt, ...), void *env, m
print(env, "<io.%s %p>", mp_obj_get_type_str(self_in), self_in);
}
-STATIC machine_int_t file_obj_read(mp_obj_t self_in, void *buf, machine_uint_t size, int *errcode) {
+STATIC mp_int_t file_obj_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
pyb_file_obj_t *self = self_in;
UINT sz_out;
FRESULT res = f_read(&self->fp, buf, size, &sz_out);
@@ -84,7 +84,7 @@ STATIC machine_int_t file_obj_read(mp_obj_t self_in, void *buf, machine_uint_t s
return sz_out;
}
-STATIC machine_int_t file_obj_write(mp_obj_t self_in, const void *buf, machine_uint_t size, int *errcode) {
+STATIC mp_int_t file_obj_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
pyb_file_obj_t *self = self_in;
UINT sz_out;
FRESULT res = f_write(&self->fp, buf, size, &sz_out);
@@ -109,8 +109,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(file_obj___exit___obj, 4, 4, file_obj
mp_obj_t file_obj_seek(uint n_args, const mp_obj_t *args) {
pyb_file_obj_t *self = args[0];
- machine_int_t offset = mp_obj_get_int(args[1]);
- machine_int_t whence = 0;
+ mp_int_t offset = mp_obj_get_int(args[1]);
+ mp_int_t whence = 0;
if (n_args == 3) {
whence = mp_obj_get_int(args[2]);
}
@@ -199,7 +199,7 @@ STATIC mp_obj_t file_obj_make_new(mp_obj_t type, uint n_args, uint n_kw, const m
FRESULT res = f_open(&o->fp, fname, mode);
if (res != FR_OK) {
m_del_obj(pyb_file_obj_t, o);
- nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((machine_int_t)fresult_to_errno_table[res])));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT((mp_int_t)fresult_to_errno_table[res])));
}
// for 'a' mode, we must begin at the end of the file
diff --git a/stmhal/gccollect.c b/stmhal/gccollect.c
index c71ed13a5e..e79dc38494 100644
--- a/stmhal/gccollect.c
+++ b/stmhal/gccollect.c
@@ -35,10 +35,10 @@
#include "gccollect.h"
#include MICROPY_HAL_H
-machine_uint_t gc_helper_get_regs_and_sp(machine_uint_t *regs);
+mp_uint_t gc_helper_get_regs_and_sp(mp_uint_t *regs);
// obsolete
-// void gc_helper_get_regs_and_clean_stack(machine_uint_t *regs, machine_uint_t heap_end);
+// void gc_helper_get_regs_and_clean_stack(mp_uint_t *regs, mp_uint_t heap_end);
void gc_collect(void) {
// get current time, in case we want to time the GC
@@ -52,8 +52,8 @@ void gc_collect(void) {
gc_collect_root((void**)&_sbss, ((uint32_t)&_ebss - (uint32_t)&_sbss) / sizeof(uint32_t));
// get the registers and the sp
- machine_uint_t regs[10];
- machine_uint_t sp = gc_helper_get_regs_and_sp(regs);
+ mp_uint_t regs[10];
+ mp_uint_t sp = gc_helper_get_regs_and_sp(regs);
// trace the stack, including the registers (since they live on the stack in this function)
gc_collect_root((void**)sp, ((uint32_t)&_ram_end - sp) / sizeof(uint32_t));
diff --git a/stmhal/i2c.c b/stmhal/i2c.c
index b6ab531293..9a616c6d62 100644
--- a/stmhal/i2c.c
+++ b/stmhal/i2c.c
@@ -268,7 +268,7 @@ STATIC mp_obj_t pyb_i2c_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// get i2c number
- machine_int_t i2c_id = mp_obj_get_int(args[0]) - 1;
+ mp_int_t i2c_id = mp_obj_get_int(args[0]) - 1;
// check i2c number
if (!(0 <= i2c_id && i2c_id < MP_ARRAY_SIZE(pyb_i2c_obj) && pyb_i2c_obj[i2c_id].i2c != NULL)) {
@@ -311,7 +311,7 @@ STATIC mp_obj_t pyb_i2c_is_ready(mp_obj_t self_in, mp_obj_t i2c_addr_o) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "I2C must be a master"));
}
- machine_uint_t i2c_addr = mp_obj_get_int(i2c_addr_o) << 1;
+ mp_uint_t i2c_addr = mp_obj_get_int(i2c_addr_o) << 1;
for (int i = 0; i < 10; i++) {
HAL_StatusTypeDef status = HAL_I2C_IsDeviceReady(self->i2c, i2c_addr, 10, 200);
@@ -383,7 +383,7 @@ STATIC mp_obj_t pyb_i2c_send(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
if (vals[1].u_int == PYB_I2C_MASTER_ADDRESS) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "addr argument required"));
}
- machine_uint_t i2c_addr = vals[1].u_int << 1;
+ mp_uint_t i2c_addr = vals[1].u_int << 1;
status = HAL_I2C_Master_Transmit(self->i2c, i2c_addr, bufinfo.buf, bufinfo.len, vals[2].u_int);
} else {
status = HAL_I2C_Slave_Transmit(self->i2c, bufinfo.buf, bufinfo.len, vals[2].u_int);
@@ -433,7 +433,7 @@ STATIC mp_obj_t pyb_i2c_recv(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
if (vals[1].u_int == PYB_I2C_MASTER_ADDRESS) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "addr argument required"));
}
- machine_uint_t i2c_addr = vals[1].u_int << 1;
+ mp_uint_t i2c_addr = vals[1].u_int << 1;
status = HAL_I2C_Master_Receive(self->i2c, i2c_addr, bufinfo.buf, bufinfo.len, vals[2].u_int);
} else {
status = HAL_I2C_Slave_Receive(self->i2c, bufinfo.buf, bufinfo.len, vals[2].u_int);
@@ -488,8 +488,8 @@ STATIC mp_obj_t pyb_i2c_mem_read(uint n_args, const mp_obj_t *args, mp_map_t *kw
mp_obj_t o_ret = pyb_buf_get_for_recv(vals[0].u_obj, &bufinfo);
// get the addresses
- machine_uint_t i2c_addr = vals[1].u_int << 1;
- machine_uint_t mem_addr = vals[2].u_int;
+ mp_uint_t i2c_addr = vals[1].u_int << 1;
+ mp_uint_t mem_addr = vals[2].u_int;
HAL_StatusTypeDef status = HAL_I2C_Mem_Read(self->i2c, i2c_addr, mem_addr, I2C_MEMADD_SIZE_8BIT, bufinfo.buf, bufinfo.len, vals[3].u_int);
@@ -535,8 +535,8 @@ STATIC mp_obj_t pyb_i2c_mem_write(uint n_args, const mp_obj_t *args, mp_map_t *k
pyb_buf_get_for_send(vals[0].u_obj, &bufinfo, data);
// get the addresses
- machine_uint_t i2c_addr = vals[1].u_int << 1;
- machine_uint_t mem_addr = vals[2].u_int;
+ mp_uint_t i2c_addr = vals[1].u_int << 1;
+ mp_uint_t mem_addr = vals[2].u_int;
HAL_StatusTypeDef status = HAL_I2C_Mem_Write(self->i2c, i2c_addr, mem_addr, I2C_MEMADD_SIZE_8BIT, bufinfo.buf, bufinfo.len, vals[3].u_int);
diff --git a/stmhal/led.c b/stmhal/led.c
index c1b298b179..51eaeb4885 100644
--- a/stmhal/led.c
+++ b/stmhal/led.c
@@ -45,7 +45,7 @@
typedef struct _pyb_led_obj_t {
mp_obj_base_t base;
- machine_uint_t led_id;
+ mp_uint_t led_id;
const pin_obj_t *led_pin;
} pyb_led_obj_t;
@@ -160,7 +160,7 @@ int led_get_intensity(pyb_led_t led) {
#if defined(PYBV4) || defined(PYBV10)
if (led == 4) {
- machine_uint_t i = (TIM3->CCR1 * 255 + (USBD_CDC_POLLING_INTERVAL*1000) - 2) / ((USBD_CDC_POLLING_INTERVAL*1000) - 1);
+ mp_uint_t i = (TIM3->CCR1 * 255 + (USBD_CDC_POLLING_INTERVAL*1000) - 2) / ((USBD_CDC_POLLING_INTERVAL*1000) - 1);
if (i > 255) {
i = 255;
}
@@ -181,7 +181,7 @@ int led_get_intensity(pyb_led_t led) {
}
}
-void led_set_intensity(pyb_led_t led, machine_int_t intensity) {
+void led_set_intensity(pyb_led_t led, mp_int_t intensity) {
#if defined(PYBV4) || defined(PYBV10)
if (led == 4) {
// set intensity using PWM pulse width
@@ -226,7 +226,7 @@ STATIC mp_obj_t led_obj_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// get led number
- machine_int_t led_id = mp_obj_get_int(args[0]);
+ mp_int_t led_id = mp_obj_get_int(args[0]);
// check led number
if (!(1 <= led_id && led_id <= NUM_LEDS)) {
diff --git a/stmhal/modos.c b/stmhal/modos.c
index e0df05ca6b..dd6fd67ec9 100644
--- a/stmhal/modos.c
+++ b/stmhal/modos.c
@@ -162,7 +162,7 @@ STATIC mp_obj_t os_sync(void) {
MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync);
STATIC mp_obj_t os_urandom(mp_obj_t num) {
- machine_int_t n = mp_obj_get_int(num);
+ mp_int_t n = mp_obj_get_int(num);
byte *data;
mp_obj_t o = mp_obj_str_builder_start(&mp_type_bytes, n, &data);
for (int i = 0; i < n; i++) {
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c
index 9dcd0e76ca..8b594332b7 100644
--- a/stmhal/modpyb.c
+++ b/stmhal/modpyb.c
@@ -194,7 +194,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_millis_obj, pyb_millis);
/// \function delay(ms)
/// Delay for the given number of milliseconds.
STATIC mp_obj_t pyb_delay(mp_obj_t ms_in) {
- machine_int_t ms = mp_obj_get_int(ms_in);
+ mp_int_t ms = mp_obj_get_int(ms_in);
if (ms >= 0) {
HAL_Delay(ms);
}
@@ -205,7 +205,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_delay_obj, pyb_delay);
/// \function udelay(us)
/// Delay for the given number of microseconds.
STATIC mp_obj_t pyb_udelay(mp_obj_t usec_in) {
- machine_int_t usec = mp_obj_get_int(usec_in);
+ mp_int_t usec = mp_obj_get_int(usec_in);
if (usec > 0) {
uint32_t count = 0;
const uint32_t utime = (168 * usec / 4);
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index 28e654c8a6..00afa989cc 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -84,8 +84,8 @@ extern const struct _mp_obj_module_t time_module;
#define UINT_FMT "%u"
#define INT_FMT "%d"
-typedef int machine_int_t; // must be pointer size
-typedef unsigned int machine_uint_t; // must be pointer size
+typedef int mp_int_t; // must be pointer size
+typedef unsigned int mp_uint_t; // must be pointer size
typedef void *machine_ptr_t; // must be of pointer size
typedef const void *machine_const_ptr_t; // must be of pointer size
diff --git a/stmhal/pin.c b/stmhal/pin.c
index a9ebfa9766..56f179f40c 100644
--- a/stmhal/pin.c
+++ b/stmhal/pin.c
@@ -352,7 +352,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_name_obj, pin_name);
/// Get the pin port.
STATIC mp_obj_t pin_port(mp_obj_t self_in) {
pin_obj_t *self = self_in;
- return MP_OBJ_NEW_SMALL_INT((mp_small_int_t)self->port);
+ return MP_OBJ_NEW_SMALL_INT((mp_int_t)self->port);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_port_obj, pin_port);
@@ -360,7 +360,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_port_obj, pin_port);
/// Get the pin number.
STATIC mp_obj_t pin_pin(mp_obj_t self_in) {
pin_obj_t *self = self_in;
- return MP_OBJ_NEW_SMALL_INT((mp_small_int_t)self->pin);
+ return MP_OBJ_NEW_SMALL_INT((mp_int_t)self->pin);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pin_pin_obj, pin_pin);
diff --git a/stmhal/pybstdio.c b/stmhal/pybstdio.c
index 5447a62202..2a4386e097 100644
--- a/stmhal/pybstdio.c
+++ b/stmhal/pybstdio.c
@@ -99,7 +99,7 @@ void stdio_obj_print(void (*print)(void *env, const char *fmt, ...), void *env,
print(env, "<io.FileIO %d>", self->fd);
}
-STATIC machine_int_t stdio_read(mp_obj_t self_in, void *buf, machine_uint_t size, int *errcode) {
+STATIC mp_int_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
pyb_stdio_obj_t *self = self_in;
if (self->fd == STDIO_FD_IN) {
for (uint i = 0; i < size; i++) {
@@ -117,7 +117,7 @@ STATIC machine_int_t stdio_read(mp_obj_t self_in, void *buf, machine_uint_t size
}
}
-STATIC machine_int_t stdio_write(mp_obj_t self_in, const void *buf, machine_uint_t size, int *errcode) {
+STATIC mp_int_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
pyb_stdio_obj_t *self = self_in;
if (self->fd == STDIO_FD_OUT || self->fd == STDIO_FD_ERR) {
stdout_tx_strn(buf, size);
diff --git a/stmhal/rtc.c b/stmhal/rtc.c
index 8f0d007327..9cc9268763 100644
--- a/stmhal/rtc.c
+++ b/stmhal/rtc.c
@@ -51,7 +51,7 @@ RTC_HandleTypeDef RTCHandle;
// rtc_info indicates various things about RTC startup
// it's a bit of a hack at the moment
-static machine_uint_t rtc_info;
+static mp_uint_t rtc_info;
// Note: LSI is around (32KHz), these dividers should work either way
// ck_spre(1Hz) = RTCCLK(LSE) /(uwAsynchPrediv + 1)*(uwSynchPrediv + 1)
@@ -90,7 +90,7 @@ void rtc_init(void) {
RCC_LSEConfig(RCC_LSE_ON);
// Wait till LSE is ready
- machine_uint_t sys_tick = sys_tick_counter;
+ mp_uint_t sys_tick = sys_tick_counter;
while((RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) && (--timeout > 0)) {
}
@@ -181,7 +181,7 @@ void rtc_init(void) {
RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
- machine_uint_t tick = HAL_GetTick();
+ mp_uint_t tick = HAL_GetTick();
if (HAL_RTC_Init(&RTCHandle) != HAL_OK) {
// init error
diff --git a/stmhal/servo.c b/stmhal/servo.c
index 3da445fa8d..8cd0a4ef76 100644
--- a/stmhal/servo.c
+++ b/stmhal/servo.c
@@ -194,7 +194,7 @@ STATIC mp_obj_t pyb_servo_make_new(mp_obj_t type_in, uint n_args, uint n_kw, con
mp_arg_check_num(n_args, n_kw, 1, 1, false);
// get servo number
- machine_int_t servo_id = mp_obj_get_int(args[0]) - 1;
+ mp_int_t servo_id = mp_obj_get_int(args[0]) - 1;
// check servo number
if (!(0 <= servo_id && servo_id < PYB_SERVO_NUM)) {
diff --git a/stmhal/spi.c b/stmhal/spi.c
index 448b8696ea..52f80ce292 100644
--- a/stmhal/spi.c
+++ b/stmhal/spi.c
@@ -314,7 +314,7 @@ STATIC mp_obj_t pyb_spi_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
// get SPI number
- machine_int_t spi_id = mp_obj_get_int(args[0]) - 1;
+ mp_int_t spi_id = mp_obj_get_int(args[0]) - 1;
// check SPI number
if (!(0 <= spi_id && spi_id < PYB_NUM_SPI && pyb_spi_obj[spi_id].spi != NULL)) {
diff --git a/stmhal/timer.c b/stmhal/timer.c
index 73842e4b1d..30bcf2c079 100644
--- a/stmhal/timer.c
+++ b/stmhal/timer.c
@@ -90,7 +90,7 @@
typedef struct _pyb_timer_obj_t {
mp_obj_base_t base;
- machine_uint_t tim_id;
+ mp_uint_t tim_id;
mp_obj_t callback;
TIM_HandleTypeDef tim;
IRQn_Type irqn;
diff --git a/stmhal/uart.c b/stmhal/uart.c
index a85f7f9e3a..9436c2938b 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.c
@@ -289,7 +289,7 @@ STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, uint n_args, const mp
if (vals[3].u_obj == mp_const_none) {
init->Parity = UART_PARITY_NONE;
} else {
- machine_int_t parity = mp_obj_get_int(vals[3].u_obj);
+ mp_int_t parity = mp_obj_get_int(vals[3].u_obj);
init->Parity = (parity & 1) ? UART_PARITY_ODD : UART_PARITY_EVEN;
}
init->Mode = UART_MODE_TX_RX;