Skip to content

Commit 1abe503

Browse files
committed
Added 'machine.Onewire' module with DS1820 family support
1 parent 76c3fd1 commit 1abe503

File tree

19 files changed

+2638
-15
lines changed

19 files changed

+2638
-15
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ SPIFFS is also supported (with directories support) and can be selected when bui
4242
* **i2c** module, **master** & **slave**, compatible with the i2c module on my ESP32 port<br>SSD1306 module provided as MicroPython frozen module
4343
* **spi** module, **master** & **slave**, compatible with the spi module on my ESP32 port with added slave support
4444
* **WS2812** (neopyxel) support, using **spi** module
45+
* **Timer** and **PWM** modules
46+
* **OneWire** & **DS18x20** module
4547
* **ymodem** module for file transfer to/from K210 board using ymodem protocol is provided
4648
* **uhashlib** and **ucryptolib** using K210 hardware AES are implemented
4749
* **Display** module ported from my MicroPython for ESP32 display module<br>Rich set of drawing methods, direct write or **framebuffer**, *jpeg*, *bmp* and *raw* image format<br>Flexible fonts support (fixed width and proportional) with user fonts loadable from file (online *Font creator* provided)

firmware/MaixPy.bin

16 KB
Binary file not shown.

firmware/MaixPy.kfpkg

6.43 KB
Binary file not shown.

firmware/MaixPy_firmware.zip

29.8 KB
Binary file not shown.

firmware/MaixPy_sqlite.bin

20 KB
Binary file not shown.

firmware/MaixPy_sqlite.kfpkg

8.39 KB
Binary file not shown.

k210-freertos/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ const char Banner[] = {"\n __ __ _____ __ __ _____ __ __
107107
|_| |_| /_/ \\_\\ |_____| /_/ \\_\\ |_| |_|\n\
108108
------------------------------------------------------\n"};
109109

110-
static const char *ver_info1 = "\nMaixPy-FreeRTOS by LoBo v"MICROPY_PY_LOBO_VERSION" (two MPY tasks)\n-----------------------------------------------\n";
111-
static const char *ver_info2 = "\nMaixPy-FreeRTOS by LoBo v"MICROPY_PY_LOBO_VERSION"\n-------------------------------\n";
110+
static const char *ver_info1 = "\nMaixPy-FreeRTOS by LoBo v"MICROPY_PY_LOBO_VERSION" (two MPY tasks)\n------------------------------------------------\n";
111+
static const char *ver_info2 = "\nMaixPy-FreeRTOS by LoBo v"MICROPY_PY_LOBO_VERSION"\n--------------------------------\n";
112112

113113
static const char* TAG = "[MAIN]";
114114
static const char* TAG_MAIN = "[MAIXPY]";

k210-freertos/mpy_support/mpconfigport.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
#define MICROPY_HW_BOARD_NAME "Sipeed_board"
4242
#define MICROPY_HW_MCU_NAME "Kendryte-K210"
4343
#define MICROPY_PY_SYS_PLATFORM "K210/FreeRTOS"
44-
#define MICROPY_PY_LOBO_VERSION "1.11.10"
45-
#define MICROPY_PY_LOBO_VERSION_NUM (0x011110)
44+
#define MICROPY_PY_LOBO_VERSION "1.11.11"
45+
#define MICROPY_PY_LOBO_VERSION_NUM (0x011111)
4646

4747
#define MICROPY_PY_USE_LOG_COLORS (1)
4848

@@ -108,9 +108,9 @@
108108
// #define FIRMWARE_SIZE (value*4096)
109109
// Round the value to the 4 KB: value = ((file_size // 4096) * 4096 + 4096) / 4096
110110
#if MICROPY_PY_USE_SQLITE
111-
#define FIRMWARE_SIZE (447*4096)
111+
#define FIRMWARE_SIZE (455*4096)
112112
#else
113-
#define FIRMWARE_SIZE (343*4096)
113+
#define FIRMWARE_SIZE (351*4096)
114114
#endif
115115

116116
// === SRAM reserved for dynamic allocation by standard malloc function

k210-freertos/mpy_support/standard_lib/include/machine_uart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ int uart_buf_find_from(uart_ringbuf_t *r, size_t start_pos, size_t size, const c
109109
int uart_buf_find(uart_ringbuf_t *r, size_t size, const char *pattern, int pattern_length, size_t *buflen);
110110
void uart_buf_flush(uart_ringbuf_t *r);
111111
void uart_ringbuf_alloc(uint8_t uart_num, size_t sz);
112-
int uart_hard_init(uint32_t uart_num, uint8_t tx, uint8_t rx, gpio_pin_func_t func, bool mutex, bool semaphore, int rb_size);
112+
int uart_hard_init(uint32_t uart_num, uint8_t tx, int8_t rx, gpio_pin_func_t func, bool mutex, bool semaphore, int rb_size);
113113
bool uart_deinit(uint32_t uart_num, uint8_t *end_task, uint8_t tx, uint8_t rx);
114114

115115
#endif

k210-freertos/mpy_support/standard_lib/include/modmachine.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ typedef enum _gpio_func_t
7171
GPIO_FUNC_GSM_UART,
7272
GPIO_FUNC_WIFI_UART,
7373
GPIO_FUNC_TIMER,
74+
GPIO_FUNC_1WIRE,
7475
} gpio_pin_func_t;
7576

7677
typedef enum _gpio_func_as_t
@@ -95,6 +96,7 @@ typedef enum _gpio_func_as_t
9596
GPIO_USEDAS_DATA1,
9697
GPIO_USEDAS_DATA2,
9798
GPIO_USEDAS_DATA3,
99+
GPIO_USEDAS_1WIRE,
98100
} gpio_pin_func_as_t;
99101

100102

@@ -210,8 +212,8 @@ extern handle_t flash_spi;
210212
extern handle_t gpiohs_handle;
211213
extern uint32_t mp_used_gpiohs;
212214
extern machine_pin_def_t mp_used_pins[FPIOA_NUM_IO];
213-
extern const char *gpiohs_funcs[15];
214-
extern const char *gpiohs_funcs_in_use[15];
215+
extern const char *gpiohs_funcs[16];
216+
extern const char *gpiohs_funcs_in_use[16];
215217
extern const char *reset_reason[8];
216218
extern const char *term_colors[8];
217219
extern mpy_config_t mpy_config;
@@ -242,5 +244,7 @@ extern const mp_obj_type_t machine_hw_i2c_type;
242244
extern const mp_obj_type_t machine_hw_spi_type;
243245
extern const mp_obj_type_t machine_timer_type;
244246
extern const mp_obj_type_t machine_pwm_type;
247+
extern const mp_obj_type_t machine_onewire_type;
248+
extern const mp_obj_type_t machine_ds18x20_type;
245249

246250
#endif // MICROPY_MODMACHINE_H

0 commit comments

Comments
 (0)