Skip to content

Commit 133b99b

Browse files
authored
Merge pull request adafruit#999 from arturo182/nrf_mphalport
nrf: mphalport cleanup
2 parents fd5634e + 1ea633c commit 133b99b

1 file changed

Lines changed: 10 additions & 38 deletions

File tree

ports/nrf/mphalport.h

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,53 +27,25 @@
2727
#ifndef __NRF52_HAL
2828
#define __NRF52_HAL
2929

30-
#include "py/mpconfig.h"
30+
#include <stdbool.h>
31+
#include <stdint.h>
32+
33+
#include "hal_gpio.h"
34+
#include "lib/utils/interrupt_char.h"
35+
#include "nrf.h"
3136
#include NRF5_HAL_H
3237
#include "pin.h"
33-
#include "hal_gpio.h"
34-
35-
#include "lib/oofatfs/ff.h"
36-
37-
typedef enum
38-
{
39-
HAL_OK = 0x00,
40-
HAL_ERROR = 0x01,
41-
HAL_BUSY = 0x02,
42-
HAL_TIMEOUT = 0x03
43-
} HAL_StatusTypeDef;
38+
#include "py/mpconfig.h"
4439

45-
extern FIL* boot_output_file;
40+
extern volatile uint64_t ticks_ms;
4641

47-
static inline uint32_t hal_tick_fake(void) {
48-
return 0;
42+
static inline mp_uint_t mp_hal_ticks_ms(void) {
43+
return ticks_ms;
4944
}
5045

51-
#define mp_hal_ticks_ms hal_tick_fake // TODO: implement. Right now, return 0 always
52-
53-
extern const unsigned char mp_hal_status_to_errno_table[4];
54-
55-
NORETURN void mp_hal_raise(HAL_StatusTypeDef status);
56-
void mp_hal_set_interrupt_char(int c); // -1 to disable
57-
5846
int mp_hal_stdin_rx_chr(void);
5947
void mp_hal_stdout_tx_str(const char *str);
6048
bool mp_hal_stdin_any(void);
6149

62-
#define mp_hal_pin_obj_t const pin_obj_t*
63-
#define mp_hal_get_pin_obj(o) pin_find(o)
64-
#define mp_hal_pin_high(p) hal_gpio_pin_high(p)
65-
#define mp_hal_pin_low(p) hal_gpio_pin_low(p)
66-
#define mp_hal_pin_read(p) hal_gpio_pin_read(p)
67-
#define mp_hal_pin_write(p, v) do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
68-
#define mp_hal_pin_od_low(p) mp_hal_pin_low(p)
69-
#define mp_hal_pin_od_high(p) mp_hal_pin_high(p)
70-
#define mp_hal_pin_open_drain(p) hal_gpio_cfg_pin(p->port, p->pin, HAL_GPIO_MODE_INPUT, HAL_GPIO_PULL_DISABLED)
71-
72-
73-
// TODO: empty implementation for now. Used by machine_spi.c:69
74-
#define mp_hal_delay_us_fast(p)
75-
#define mp_hal_ticks_us() (0)
76-
#define mp_hal_ticks_cpu() (0)
77-
7850
#endif
7951

0 commit comments

Comments
 (0)