fix nrf and esp8266 builds for OneWire fix
This commit is contained in:
parent
52a11547cb
commit
b4fd77bb7c
@ -1,3 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Scott Shawcroft
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "lib/mp-readline/readline.h"
|
#include "lib/mp-readline/readline.h"
|
||||||
|
@ -92,6 +92,7 @@ SRC_C = \
|
|||||||
machine_hspi.c \
|
machine_hspi.c \
|
||||||
modesp.c \
|
modesp.c \
|
||||||
modnetwork.c \
|
modnetwork.c \
|
||||||
|
mphalport.c \
|
||||||
ets_alt_task.c \
|
ets_alt_task.c \
|
||||||
fatfs_port.c \
|
fatfs_port.c \
|
||||||
posix_helpers.c \
|
posix_helpers.c \
|
||||||
|
33
ports/esp8266/mphalport.c
Normal file
33
ports/esp8266/mphalport.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "esp_mphal.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void mp_hal_delay_us_loop(uint32_t us) {
|
||||||
|
mp_hal_delay_us(us);
|
||||||
|
}
|
34
ports/esp8266/mphalport.h
Normal file
34
ports/esp8266/mphalport.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MICROPY_INCLUDED_ESP8266_MPHALPORT_H
|
||||||
|
#define MICROPY_INCLUDED_ESP8266_MPHALPORT_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void mp_hal_delay_us_loop(uint32_t us);
|
||||||
|
|
||||||
|
#endif // MICROPY_INCLUDED_ESP8266_MPHALPORT_H
|
@ -32,6 +32,8 @@
|
|||||||
#include "py/mperrno.h"
|
#include "py/mperrno.h"
|
||||||
#include "hal_uart.h"
|
#include "hal_uart.h"
|
||||||
|
|
||||||
|
extern uint32_t common_hal_mcu_processor_get_frequency(void);
|
||||||
|
|
||||||
#define UART_INSTANCE UART_BASE(0)
|
#define UART_INSTANCE UART_BASE(0)
|
||||||
FIL* boot_output_file;
|
FIL* boot_output_file;
|
||||||
|
|
||||||
@ -90,7 +92,7 @@ void mp_hal_stdout_tx_str(const char *str) {
|
|||||||
// Testing done at 48 MHz on SAMD21 and 120 MHz on SAMD51 (cache on).
|
// Testing done at 48 MHz on SAMD21 and 120 MHz on SAMD51 (cache on).
|
||||||
// TODO: Test on NRF. For now, use SAMD51 calibration, even though nRF52 runs slower.
|
// TODO: Test on NRF. For now, use SAMD51 calibration, even though nRF52 runs slower.
|
||||||
// Fraction should compensate.
|
// Fraction should compensate.
|
||||||
#define DELAY_LOOP_ITERATIONS_PER_US (30U*120000000U) / common_hal_mcu_processor_get_frequency())
|
#define DELAY_LOOP_ITERATIONS_PER_US ( (30U*120000000U) / common_hal_mcu_processor_get_frequency())
|
||||||
|
|
||||||
void mp_hal_delay_us_loop(uint32_t us) {
|
void mp_hal_delay_us_loop(uint32_t us) {
|
||||||
for (uint32_t i = us*DELAY_LOOP_ITERATIONS_PER_US; i > 0; i--) {
|
for (uint32_t i = us*DELAY_LOOP_ITERATIONS_PER_US; i > 0; i--) {
|
||||||
|
Loading…
Reference in New Issue
Block a user