Skip to content

Commit bcc9298

Browse files
committed
stmhal: Add TODO's to exti.c; fix delay in lcd.c.
1 parent c63f984 commit bcc9298

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

stmhal/exti.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
// There is also a C API, so that drivers which require EXTI interrupt lines
6767
// can also use this code. See exti.h for the available functions and
6868
// usrsw.h for an example of using this.
69+
//
70+
// TODO Add python method to change callback object.
6971

7072
#define EXTI_OFFSET (EXTI_BASE - PERIPH_BASE)
7173

@@ -302,6 +304,7 @@ void Handle_EXTI_Irq(uint32_t line) {
302304
if (line < EXTI_NUM_VECTORS) {
303305
exti_vector_t *v = &exti_vector[line];
304306
if (v->callback_obj != mp_const_none) {
307+
// TODO need to wrap this in an nlr_buf; really need a general function for this
305308
rt_call_function_1(v->callback_obj, MP_OBJ_NEW_SMALL_INT(line));
306309
}
307310
}

stmhal/lcd.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <stdio.h>
12
#include <string.h>
23
#include <stm32f4xx_hal.h>
34

@@ -59,8 +60,12 @@
5960
#define LCD_INSTR (0)
6061
#define LCD_DATA (1)
6162

63+
static void lcd_delay(void) {
64+
__asm volatile ("nop\nnop");
65+
}
66+
6267
static void lcd_out(int instr_data, uint8_t i) {
63-
HAL_Delay(0);
68+
lcd_delay();
6469
PYB_LCD_PORT->BSRRH = PYB_LCD_CS1_PIN; // CS=0; enable
6570
if (instr_data == LCD_INSTR) {
6671
PYB_LCD_PORT->BSRRH = PYB_LCD_A0_PIN; // A0=0; select instr reg
@@ -69,15 +74,15 @@ static void lcd_out(int instr_data, uint8_t i) {
6974
}
7075
// send byte bigendian, latches on rising clock
7176
for (uint32_t n = 0; n < 8; n++) {
72-
HAL_Delay(0);
77+
lcd_delay();
7378
PYB_LCD_PORT->BSRRH = PYB_LCD_SCL_PIN; // SCL=0
7479
if ((i & 0x80) == 0) {
7580
PYB_LCD_PORT->BSRRH = PYB_LCD_SI_PIN; // SI=0
7681
} else {
7782
PYB_LCD_PORT->BSRRL = PYB_LCD_SI_PIN; // SI=1
7883
}
7984
i <<= 1;
80-
HAL_Delay(0);
85+
lcd_delay();
8186
PYB_LCD_PORT->BSRRL = PYB_LCD_SCL_PIN; // SCL=1
8287
}
8388
PYB_LCD_PORT->BSRRL = PYB_LCD_CS1_PIN; // CS=1; disable

0 commit comments

Comments
 (0)