Skip to content

Commit c3305c4

Browse files
robert-hhdpgeorge
authored andcommitted
stm32: Add definitions required for lwIP version of Wiznet NIC.
1 parent 7179240 commit c3305c4

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Diff for: ports/stm32/mphalport.h

+8
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,19 @@ static inline mp_uint_t mp_hal_ticks_cpu(void) {
9696
#define mp_hal_pin_od_high(p) mp_hal_pin_high(p)
9797
#define mp_hal_pin_read(p) (((p)->gpio->IDR >> (p)->pin) & 1)
9898
#define mp_hal_pin_write(p, v) ((v) ? mp_hal_pin_high(p) : mp_hal_pin_low(p))
99+
#define mp_hal_pin_interrupt(pin, handler, trigger, hard) extint_register_pin(pin, trigger, hard, handler)
100+
101+
enum mp_hal_pin_interrupt_trigger {
102+
MP_HAL_PIN_TRIGGER_NONE,
103+
MP_HAL_PIN_TRIGGER_FALL = GPIO_MODE_IT_FALLING,
104+
MP_HAL_PIN_TRIGGER_RISE = GPIO_MODE_IT_RISING,
105+
};
99106

100107
void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio);
101108
void mp_hal_pin_config(mp_hal_pin_obj_t pin, uint32_t mode, uint32_t pull, uint32_t alt);
102109
bool mp_hal_pin_config_alt(mp_hal_pin_obj_t pin, uint32_t mode, uint32_t pull, uint8_t fn, uint8_t unit);
103110
void mp_hal_pin_config_speed(mp_hal_pin_obj_t pin_obj, uint32_t speed);
111+
void extint_register_pin(const pin_obj_t *pin, uint32_t mode, bool hard_irq, mp_obj_t callback_obj);
104112

105113
enum {
106114
MP_HAL_MAC_WLAN0 = 0,

Diff for: ports/stm32/mpnetworkport.c

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050

5151
#if MICROPY_PY_NETWORK_WIZNET5K
5252
void wiznet5k_poll(void);
53+
void wiznet5k_deinit(void);
54+
55+
void wiznet5k_try_poll(void) {
56+
pendsv_schedule_dispatch(PENDSV_DISPATCH_WIZNET, wiznet5k_poll);
57+
}
5358
#endif
5459

5560
u32_t sys_now(void) {

Diff for: ports/stm32/pendsv.h

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ enum {
3535
#if MICROPY_PY_NETWORK_CYW43
3636
PENDSV_DISPATCH_CYW43,
3737
#endif
38+
#if MICROPY_PY_NETWORK_WIZNET5K
39+
PENDSV_DISPATCH_WIZNET,
40+
#endif
3841
#endif
3942
#if MICROPY_PY_BLUETOOTH && !MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
4043
PENDSV_DISPATCH_BLUETOOTH_HCI,

0 commit comments

Comments
 (0)