modifications by pre-commit
This commit is contained in:
parent
253385d9b7
commit
d3bf1fe15d
@ -29,7 +29,7 @@
|
||||
#include "common-hal/rotaryio/IncrementalEncoder.h"
|
||||
#include "common-hal/countio/Counter.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
//#include "samd/external_interrupts.h"
|
||||
// #include "samd/external_interrupts.h"
|
||||
#include "eic_handler.h"
|
||||
|
||||
// Which handler should be called for a particular channel?
|
||||
@ -42,31 +42,31 @@ void set_eic_handler(uint8_t channel, uint8_t eic_handler) {
|
||||
void shared_eic_handler(uint8_t channel) {
|
||||
uint8_t handler = eic_channel_handler[channel];
|
||||
switch (handler) {
|
||||
#if CIRCUITPY_PULSEIO
|
||||
case EIC_HANDLER_PULSEIN:
|
||||
pulsein_interrupt_handler(channel);
|
||||
break;
|
||||
#endif
|
||||
#if CIRCUITPY_PULSEIO
|
||||
case EIC_HANDLER_PULSEIN:
|
||||
pulsein_interrupt_handler(channel);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_PS2IO
|
||||
case EIC_HANDLER_PS2:
|
||||
ps2_interrupt_handler(channel);
|
||||
break;
|
||||
#endif
|
||||
#if CIRCUITPY_PS2IO
|
||||
case EIC_HANDLER_PS2:
|
||||
ps2_interrupt_handler(channel);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_ROTARYIO
|
||||
case EIC_HANDLER_INCREMENTAL_ENCODER:
|
||||
incrementalencoder_interrupt_handler(channel);
|
||||
break;
|
||||
#endif
|
||||
#if CIRCUITPY_ROTARYIO
|
||||
case EIC_HANDLER_INCREMENTAL_ENCODER:
|
||||
incrementalencoder_interrupt_handler(channel);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_COUNTIO
|
||||
case EIC_HANDLER_COUNTER:
|
||||
counter_interrupt_handler(channel);
|
||||
break;
|
||||
#endif
|
||||
#if CIRCUITPY_COUNTIO
|
||||
case EIC_HANDLER_COUNTER:
|
||||
counter_interrupt_handler(channel);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -35,14 +35,14 @@
|
||||
#endif
|
||||
|
||||
DWORD get_fattime(void) {
|
||||
#if CIRCUITPY_RTC
|
||||
#if CIRCUITPY_RTC
|
||||
timeutils_struct_time_t tm;
|
||||
common_hal_rtc_get_time(&tm);
|
||||
return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
|
||||
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
|
||||
#else
|
||||
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
|
||||
#else
|
||||
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,22 +9,22 @@
|
||||
// The next line is a marker to start looking for definitions. Lines above the next line are ignored.
|
||||
// START_LD_DEFINES
|
||||
|
||||
/*RAM_SIZE=*/ RAM_SIZE;
|
||||
/*FLASH_SIZE=*/ FLASH_SIZE;
|
||||
/*RAM_SIZE=*/ RAM_SIZE;
|
||||
/*FLASH_SIZE=*/ FLASH_SIZE;
|
||||
|
||||
/*BOOTLOADER_SIZE=*/ BOOTLOADER_SIZE;
|
||||
/*BOOTLOADER_START_ADDR=*/ BOOTLOADER_START_ADDR;
|
||||
/*BOOTLOADER_SIZE=*/ BOOTLOADER_SIZE;
|
||||
/*BOOTLOADER_START_ADDR=*/ BOOTLOADER_START_ADDR;
|
||||
|
||||
/*CIRCUITPY_DEFAULT_STACK_SIZE=*/ CIRCUITPY_DEFAULT_STACK_SIZE;
|
||||
/*CIRCUITPY_DEFAULT_STACK_SIZE=*/ CIRCUITPY_DEFAULT_STACK_SIZE;
|
||||
|
||||
/*CIRCUITPY_FIRMWARE_START_ADDR=*/ CIRCUITPY_FIRMWARE_START_ADDR;
|
||||
/*CIRCUITPY_FIRMWARE_SIZE=*/ CIRCUITPY_FIRMWARE_SIZE;
|
||||
/*CIRCUITPY_FIRMWARE_START_ADDR=*/ CIRCUITPY_FIRMWARE_START_ADDR;
|
||||
/*CIRCUITPY_FIRMWARE_SIZE=*/ CIRCUITPY_FIRMWARE_SIZE;
|
||||
|
||||
/*CIRCUITPY_INTERNAL_CONFIG_START_ADDR=*/ CIRCUITPY_INTERNAL_CONFIG_START_ADDR;
|
||||
/*CIRCUITPY_INTERNAL_CONFIG_SIZE=*/ CIRCUITPY_INTERNAL_CONFIG_SIZE;
|
||||
/*CIRCUITPY_INTERNAL_CONFIG_START_ADDR=*/ CIRCUITPY_INTERNAL_CONFIG_START_ADDR;
|
||||
/*CIRCUITPY_INTERNAL_CONFIG_SIZE=*/ CIRCUITPY_INTERNAL_CONFIG_SIZE;
|
||||
|
||||
/*CIRCUITPY_INTERNAL_NVM_START_ADDR=*/ CIRCUITPY_INTERNAL_NVM_START_ADDR;
|
||||
/*CIRCUITPY_INTERNAL_NVM_SIZE=*/ CIRCUITPY_INTERNAL_NVM_SIZE;
|
||||
/*CIRCUITPY_INTERNAL_NVM_START_ADDR=*/ CIRCUITPY_INTERNAL_NVM_START_ADDR;
|
||||
/*CIRCUITPY_INTERNAL_NVM_SIZE=*/ CIRCUITPY_INTERNAL_NVM_SIZE;
|
||||
|
||||
/*CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR=*/ CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR;
|
||||
/*CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE=*/ CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE;
|
||||
/*CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE=*/ CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE;
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
// HMCRAMC0_SIZE is defined in the ASF4 include files for each SAMD21 chip.
|
||||
#define RAM_SIZE HMCRAMC0_SIZE
|
||||
#define BOOTLOADER_SIZE (8*1024)
|
||||
#define BOOTLOADER_SIZE (8 * 1024)
|
||||
#define CIRCUITPY_MCU_FAMILY samd21
|
||||
#define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21"
|
||||
#define SPI_FLASH_MAX_BAUDRATE 8000000
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
// HSRAM_SIZE is defined in the ASF4 include files for each SAM_D5X_E5X chip.
|
||||
#define RAM_SIZE HSRAM_SIZE
|
||||
#define BOOTLOADER_SIZE (16*1024)
|
||||
#define BOOTLOADER_SIZE (16 * 1024)
|
||||
#define CIRCUITPY_MCU_FAMILY samd51
|
||||
#ifdef SAMD51
|
||||
#define MICROPY_PY_SYS_PLATFORM "MicroChip SAMD51"
|
||||
@ -96,7 +96,7 @@
|
||||
#ifdef SAMD21
|
||||
|
||||
#if INTERNAL_FLASH_FILESYSTEM
|
||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (64*1024)
|
||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (64 * 1024)
|
||||
#else
|
||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (0)
|
||||
#endif
|
||||
@ -131,7 +131,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef CIRCUITPY_DEFAULT_STACK_SIZE
|
||||
#define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024)
|
||||
#define CIRCUITPY_DEFAULT_STACK_SIZE (24 * 1024)
|
||||
#endif
|
||||
|
||||
#ifndef SAMD5x_E5x_BOD33_LEVEL
|
||||
@ -148,7 +148,7 @@
|
||||
// If CIRCUITPY is internal, use half of flash for it.
|
||||
#if INTERNAL_FLASH_FILESYSTEM
|
||||
#ifndef CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE
|
||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (FLASH_SIZE/2)
|
||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (FLASH_SIZE / 2)
|
||||
#endif
|
||||
#else
|
||||
#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (0)
|
||||
|
@ -56,15 +56,15 @@ extern uint32_t common_hal_mcu_processor_get_frequency(void);
|
||||
// Testing done at 48 MHz on SAMD21 and 120 MHz on SAMD51, multiplication and division cancel out.
|
||||
// But get the frequency just in case.
|
||||
#ifdef SAMD21
|
||||
#define DELAY_LOOP_ITERATIONS_PER_US ( (10U*48000000U) / common_hal_mcu_processor_get_frequency())
|
||||
#define DELAY_LOOP_ITERATIONS_PER_US ((10U * 48000000U) / common_hal_mcu_processor_get_frequency())
|
||||
#endif
|
||||
#ifdef SAM_D5X_E5X
|
||||
#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())
|
||||
#endif
|
||||
|
||||
void mp_hal_delay_us(mp_uint_t delay) {
|
||||
for (uint32_t i = delay*DELAY_LOOP_ITERATIONS_PER_US; i > 0; i--) {
|
||||
asm volatile("nop");
|
||||
for (uint32_t i = delay * DELAY_LOOP_ITERATIONS_PER_US; i > 0; i--) {
|
||||
asm volatile ("nop");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "supervisor/shared/tick.h"
|
||||
|
||||
// Global millisecond tick count (driven by SysTick interrupt).
|
||||
#define mp_hal_ticks_ms() ((mp_uint_t) supervisor_ticks_ms32())
|
||||
#define mp_hal_ticks_ms() ((mp_uint_t)supervisor_ticks_ms32())
|
||||
|
||||
// Number of bytes in receive buffer
|
||||
extern volatile uint8_t usb_rx_count;
|
||||
|
@ -49,31 +49,31 @@ void shared_timer_handler(bool is_tc, uint8_t index) {
|
||||
// Make sure to add the handler #define to timer_handler.h
|
||||
if (is_tc) {
|
||||
uint8_t handler = tc_handler[index];
|
||||
switch(handler) {
|
||||
switch (handler) {
|
||||
case TC_HANDLER_PULSEIN:
|
||||
#if CIRCUITPY_PULSEIO
|
||||
#if CIRCUITPY_PULSEIO
|
||||
pulsein_timer_interrupt_handler(index);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case TC_HANDLER_PULSEOUT:
|
||||
#if CIRCUITPY_PULSEIO
|
||||
#if CIRCUITPY_PULSEIO
|
||||
pulseout_interrupt_handler(index);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case TC_HANDLER_PEW:
|
||||
#if CIRCUITPY_PEW
|
||||
#if CIRCUITPY_PEW
|
||||
pewpew_interrupt_handler(index);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case TC_HANDLER_FREQUENCYIN:
|
||||
#if CIRCUITPY_FREQUENCYIO
|
||||
#if CIRCUITPY_FREQUENCYIO
|
||||
frequencyin_interrupt_handler(index);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case TC_HANDLER_RGBMATRIX:
|
||||
#if CIRCUITPY_RGBMATRIX
|
||||
#if CIRCUITPY_RGBMATRIX
|
||||
_PM_IRQ_HANDLER();
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -30,6 +30,9 @@
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/shared/stack.h"
|
||||
|
||||
void port_background_task(void) {}
|
||||
void port_start_background_task(void) {}
|
||||
void port_finish_background_task(void) {}
|
||||
void port_background_task(void) {
|
||||
}
|
||||
void port_start_background_task(void) {
|
||||
}
|
||||
void port_finish_background_task(void) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user