diff options
Diffstat (limited to 'ports/atmel-samd')
132 files changed, 1237 insertions, 1046 deletions
diff --git a/ports/atmel-samd/asf4_conf/samd21/hpl_gclk_config.h b/ports/atmel-samd/asf4_conf/samd21/hpl_gclk_config.h index b97131f0b..a3d67d8b3 100644 --- a/ports/atmel-samd/asf4_conf/samd21/hpl_gclk_config.h +++ b/ports/atmel-samd/asf4_conf/samd21/hpl_gclk_config.h @@ -93,8 +93,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 0 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 0 division <0x0000-0xFFFF> // <i> // <id> gclk_gen_0_div #ifndef CONF_GCLK_GEN_0_DIV @@ -177,8 +177,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 1 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 1 division <0x0000-0xFFFF> // <i> // <id> gclk_gen_1_div #ifndef CONF_GCLK_GEN_1_DIV @@ -263,8 +263,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 2 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 2 division <0x0000-0xFFFF> // <i> // <id> gclk_gen_2_div #ifndef CONF_GCLK_GEN_2_DIV @@ -349,8 +349,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 3 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 3 division <0x0000-0xFFFF> // <i> // <id> gclk_gen_3_div #ifndef CONF_GCLK_GEN_3_DIV @@ -435,8 +435,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 4 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 4 division <0x0000-0xFFFF> // <i> // <id> gclk_gen_4_div #ifndef CONF_GCLK_GEN_4_DIV @@ -521,8 +521,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 5 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 5 division <0x0000-0xFFFF> // <i> // <id> gclk_gen_5_div #ifndef CONF_GCLK_GEN_5_DIV @@ -607,8 +607,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 6 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 6 division <0x0000-0xFFFF> // <i> // <id> gclk_gen_6_div #ifndef CONF_GCLK_GEN_6_DIV @@ -693,8 +693,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 7 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 7 division <0x0000-0xFFFF> // <i> // <id> gclk_gen_7_div #ifndef CONF_GCLK_GEN_7_DIV diff --git a/ports/atmel-samd/asf4_conf/samd21/hpl_sercom_config.h b/ports/atmel-samd/asf4_conf/samd21/hpl_sercom_config.h index 85d05fc50..007a72d06 100644 --- a/ports/atmel-samd/asf4_conf/samd21/hpl_sercom_config.h +++ b/ports/atmel-samd/asf4_conf/samd21/hpl_sercom_config.h @@ -294,12 +294,12 @@ // BAUD: register value low [7:0] // BAUDLOW: register value high [15:8], only used for odd BAUD + BAUDLOW #define CONF_SERCOM_1_I2CM_BAUD_BAUDLOW \ - (((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \ - - (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \ - / 1000)) \ - * 10 \ - + 5) \ - / (CONF_SERCOM_1_I2CM_BAUD * 10)) + (((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \ + - (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \ + / 1000)) \ + * 10 \ + + 5) \ + / (CONF_SERCOM_1_I2CM_BAUD * 10)) #ifndef CONF_SERCOM_1_I2CM_BAUD_RATE #if CONF_SERCOM_1_I2CM_BAUD_BAUDLOW > (0xFF * 2) #warning Requested I2C baudrate too low, please check @@ -309,9 +309,9 @@ #define CONF_SERCOM_1_I2CM_BAUD_RATE 1 #else #define CONF_SERCOM_1_I2CM_BAUD_RATE \ - ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \ - ? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \ - : (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2)) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \ + ? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \ + : (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2)) #endif #endif @@ -506,7 +506,7 @@ #if CONF_SERCOM_2_USART_SAMPR == 0 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -514,7 +514,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 1 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) + ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -522,7 +522,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 2 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -530,7 +530,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 3 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) + ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -538,7 +538,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 4 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -552,9 +552,9 @@ #define CONF_SERCOM_3_SPI_ENABLE 1 #endif -//<o> SPI DMA TX Channel <0-32> -//<i> This defines DMA channel to be used -//<id> spi_master_dma_tx_channel +// <o> SPI DMA TX Channel <0-32> +// <i> This defines DMA channel to be used +// <id> spi_master_dma_tx_channel #ifndef CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL #define CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL 0 #endif @@ -565,9 +565,9 @@ #define CONF_SERCOM_3_SPI_RX_CHANNEL 1 #endif -//<o> DMA Channel <0-32> -//<i> This defines DMA channel to be used -//<id> spi_master_dma_rx_channel +// <o> DMA Channel <0-32> +// <i> This defines DMA channel to be used +// <id> spi_master_dma_rx_channel #ifndef CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL #define CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL 1 #endif diff --git a/ports/atmel-samd/asf4_conf/samd21/hpl_sysctrl_config.h b/ports/atmel-samd/asf4_conf/samd21/hpl_sysctrl_config.h index 74ec2bee9..193298ed9 100644 --- a/ports/atmel-samd/asf4_conf/samd21/hpl_sysctrl_config.h +++ b/ports/atmel-samd/asf4_conf/samd21/hpl_sysctrl_config.h @@ -95,7 +95,7 @@ #endif // <o>Osc Calibration Value <0-65535> -// <i> Set the Oscillator Calibration Value +// <i> Set the Oscillator Calibration Value // <i> Default: 1 // <id> osc8m_arch_calib #ifndef CONF_OSC8M_CALIB @@ -183,7 +183,7 @@ #endif // <o>Osc Calibration Value <0-65535> -// <i> Set the Oscillator Calibration Value +// <i> Set the Oscillator Calibration Value // <i> Default: 0 // <id> osc32k_arch_calib #ifndef CONF_OSC32K_CALIB @@ -396,7 +396,7 @@ #endif // <o>Osc Calibration Value <0-255> -// <i> Set the Oscillator Calibration Value +// <i> Set the Oscillator Calibration Value // <i> Default: 0 // <id> osculp32k_arch_calib #ifndef CONF_OSCULP32K_CALIB @@ -536,7 +536,7 @@ #endif // <o>DFLL Multiply Factor<0-65535> -// <i> Set the DFLL Multiply Factor +// <i> Set the DFLL Multiply Factor // <i> Default: 0 // <id> dfll48m_mul #ifndef CONF_DFLL_MUL @@ -564,17 +564,17 @@ #if CONF_DFLL_OVERWRITE_CALIBRATION == 0 #define CONF_DEFAULT_CORASE \ - ((FUSES_DFLL48M_COARSE_CAL_Msk & (*((uint32_t *)FUSES_DFLL48M_COARSE_CAL_ADDR))) >> FUSES_DFLL48M_COARSE_CAL_Pos) + ((FUSES_DFLL48M_COARSE_CAL_Msk & (*((uint32_t *)FUSES_DFLL48M_COARSE_CAL_ADDR))) >> FUSES_DFLL48M_COARSE_CAL_Pos) #define CONF_DFLLVAL \ - SYSCTRL_DFLLVAL_COARSE(((CONF_DEFAULT_CORASE) == 0x3F) ? 0x1F : (CONF_DEFAULT_CORASE)) \ - | SYSCTRL_DFLLVAL_FINE(512) + SYSCTRL_DFLLVAL_COARSE(((CONF_DEFAULT_CORASE) == 0x3F) ? 0x1F : (CONF_DEFAULT_CORASE)) \ + | SYSCTRL_DFLLVAL_FINE(512) #else #define CONF_DFLLVAL SYSCTRL_DFLLVAL_COARSE(CONF_DFLL_COARSE) | SYSCTRL_DFLLVAL_FINE(CONF_DFLL_FINE) #endif -//</e> +// </e> // </h> // </e> diff --git a/ports/atmel-samd/asf4_conf/samd21/hpl_tc_config.h b/ports/atmel-samd/asf4_conf/samd21/hpl_tc_config.h index 90e9b0735..d651ca33a 100644 --- a/ports/atmel-samd/asf4_conf/samd21/hpl_tc_config.h +++ b/ports/atmel-samd/asf4_conf/samd21/hpl_tc_config.h @@ -27,7 +27,7 @@ #define CONF_TC3_PRESCALER TC_CTRLA_PRESCALER_DIV8_Val #endif -//<o> Period Value <0x00000000-0xFFFFFFFF> +// <o> Period Value <0x00000000-0xFFFFFFFF> // <id> tc_per #ifndef CONF_TC3_PER #define CONF_TC3_PER 0x32 @@ -52,7 +52,7 @@ /* Caculate pwm ccx register value based on WAVE_PER_VAL and Waveform Duty Value */ #if CONF_TC3_PRESCALER < TC_CTRLA_PRESCALER_DIV64_Val #define CONF_TC3_CC0 \ - ((uint32_t)(((double)CONF_TC3_WAVE_PER_VAL * CONF_GCLK_TC3_FREQUENCY) / 1000000 / (1 << CONF_TC3_PRESCALER) - 1)) + ((uint32_t)(((double)CONF_TC3_WAVE_PER_VAL * CONF_GCLK_TC3_FREQUENCY) / 1000000 / (1 << CONF_TC3_PRESCALER) - 1)) #define CONF_TC3_CC1 ((CONF_TC3_CC0 * CONF_TC3_WAVE_DUTY_VAL) / 1000) #elif CONF_TC3_PRESCALER == TC_CTRLA_PRESCALER_DIV64_Val @@ -83,7 +83,7 @@ // <h> Advanced settings /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC3_WAVEGEN TC_CTRLA_WAVEGEN_MFRQ_Val +// #define CONF_TC3_WAVEGEN TC_CTRLA_WAVEGEN_MFRQ_Val // <q> Run in standby // <i> Indicates whether the will continue running in standby sleep mode or not @@ -103,14 +103,14 @@ #endif /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC3_DIR 0 -//#define CONF_TC3_ONESHOT 0 +// #define CONF_TC3_DIR 0 +// #define CONF_TC3_ONESHOT 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC3_INVEN0 0 -//#define CONF_TC3_INVEN1 0 -//#define CONF_TC3_CPTEN0 0 -//#define CONF_TC3_CPTEN1 0 +// #define CONF_TC3_INVEN0 0 +// #define CONF_TC3_INVEN1 0 +// #define CONF_TC3_CPTEN0 0 +// #define CONF_TC3_CPTEN1 0 // <q> Debug Running Mode // <i> Indicates whether the Debug Running Mode is enabled or not diff --git a/ports/atmel-samd/asf4_conf/samd21/usbd_config.h b/ports/atmel-samd/asf4_conf/samd21/usbd_config.h index df6dac3f7..b0f570b5e 100644 --- a/ports/atmel-samd/asf4_conf/samd21/usbd_config.h +++ b/ports/atmel-samd/asf4_conf/samd21/usbd_config.h @@ -101,7 +101,7 @@ #ifndef CONF_USB_COMPOSITE_IPRODUCT #define CONF_USB_COMPOSITE_IPRODUCT \ - (CONF_USB_COMPOSITE_IPRODUCT_EN * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN)) + (CONF_USB_COMPOSITE_IPRODUCT_EN * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN)) #endif // <s> Unicode string of iProduct @@ -124,8 +124,8 @@ #ifndef CONF_USB_COMPOSITE_ISERIALNUM #define CONF_USB_COMPOSITE_ISERIALNUM \ - (CONF_USB_COMPOSITE_ISERIALNUM_EN \ - * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN)) + (CONF_USB_COMPOSITE_ISERIALNUM_EN \ + * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN)) #endif // <s> Unicode string of iSerialNum @@ -162,9 +162,9 @@ #ifndef CONF_USB_COMPOSITE_ICONFIG #define CONF_USB_COMPOSITE_ICONFIG \ - (CONF_USB_COMPOSITE_ICONFIG_EN \ - * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN \ - + CONF_USB_COMPOSITE_ICONFIG_EN)) + (CONF_USB_COMPOSITE_ICONFIG_EN \ + * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN \ + + CONF_USB_COMPOSITE_ICONFIG_EN)) #endif // <s> Unicode string of iConfig @@ -453,9 +453,9 @@ #ifndef CONF_USB_COMPOSITE_HID_GENERIC_REPORT #define CONF_USB_COMPOSITE_HID_GENERIC_REPORT \ - 0x06, 0xFF, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x09, 0x02, 0x09, 0x03, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, \ - 0x40, 0x81, 0x02, 0x09, 0x04, 0x09, 0x05, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40, 0x91, 0x02, \ - 0x09, 0x06, 0x09, 0x07, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x04, 0xB1, 0x02, 0xC0 + 0x06, 0xFF, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x09, 0x02, 0x09, 0x03, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, \ + 0x40, 0x81, 0x02, 0x09, 0x04, 0x09, 0x05, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40, 0x91, 0x02, \ + 0x09, 0x06, 0x09, 0x07, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x04, 0xB1, 0x02, 0xC0 #endif // <o> HID Generic INTERRUPT IN Endpoint Address @@ -650,7 +650,7 @@ #ifndef CONF_USB_MSC_LUN0_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN0_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN0_CAPACITY * 1024 / CONF_USB_MSC_LUN0_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN0_CAPACITY * 1024 / CONF_USB_MSC_LUN0_BLOCK_SIZE - 1) #endif // </e> @@ -713,7 +713,7 @@ #ifndef CONF_USB_MSC_LUN1_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN1_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN1_CAPACITY * 1024 / CONF_USB_MSC_LUN1_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN1_CAPACITY * 1024 / CONF_USB_MSC_LUN1_BLOCK_SIZE - 1) #endif // </e> @@ -775,7 +775,7 @@ #ifndef CONF_USB_MSC_LUN2_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN2_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN2_CAPACITY * 1024 / CONF_USB_MSC_LUN2_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN2_CAPACITY * 1024 / CONF_USB_MSC_LUN2_BLOCK_SIZE - 1) #endif // </e> @@ -837,7 +837,7 @@ #ifndef CONF_USB_MSC_LUN3_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN3_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN3_CAPACITY * 1024 / CONF_USB_MSC_LUN3_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN3_CAPACITY * 1024 / CONF_USB_MSC_LUN3_BLOCK_SIZE - 1) #endif // </e> diff --git a/ports/atmel-samd/asf4_conf/samd51/hpl_gclk_config.h b/ports/atmel-samd/asf4_conf/samd51/hpl_gclk_config.h index 6f4f01a7e..1dda85a69 100644 --- a/ports/atmel-samd/asf4_conf/samd51/hpl_gclk_config.h +++ b/ports/atmel-samd/asf4_conf/samd51/hpl_gclk_config.h @@ -11,7 +11,7 @@ // Used in hpl/core/hpl_init.c to define which clocks should be initialized first. // Not clear why all these need to be specified, but it doesn't work properly otherwise. -//#define CIRCUITPY_GCLK_INIT_1ST (1 << 0 | 1 << 1 | 1 << 3 | 1 <<5) +// #define CIRCUITPY_GCLK_INIT_1ST (1 << 0 | 1 << 1 | 1 << 3 | 1 <<5) #define CIRCUITPY_GCLK_INIT_1ST 0xffff /* Auto-generated config file hpl_gclk_config.h */ @@ -52,7 +52,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_0_div_sel +// <id> gclk_gen_0_div_sel #ifndef CONF_GCLK_GEN_0_DIVSEL #define CONF_GCLK_GEN_0_DIVSEL 0 #endif @@ -86,8 +86,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 0 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 0 division <0x0000-0xFFFF> // <id> gclk_gen_0_div #ifndef CONF_GCLK_GEN_0_DIV #define CONF_GCLK_GEN_0_DIV 1 @@ -126,7 +126,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_1_div_sel +// <id> gclk_gen_1_div_sel #ifndef CONF_GCLK_GEN_1_DIVSEL #define CONF_GCLK_GEN_1_DIVSEL 0 #endif @@ -160,8 +160,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 1 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 1 division <0x0000-0xFFFF> // <id> gclk_gen_1_div #ifndef CONF_GCLK_GEN_1_DIV #define CONF_GCLK_GEN_1_DIV 1 @@ -201,7 +201,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_2_div_sel +// <id> gclk_gen_2_div_sel #ifndef CONF_GCLK_GEN_2_DIVSEL #define CONF_GCLK_GEN_2_DIVSEL 1 #endif @@ -235,8 +235,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 2 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 2 division <0x0000-0xFFFF> // <id> gclk_gen_2_div #ifndef CONF_GCLK_GEN_2_DIV #define CONF_GCLK_GEN_2_DIV 4 @@ -276,7 +276,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_3_div_sel +// <id> gclk_gen_3_div_sel #ifndef CONF_GCLK_GEN_3_DIVSEL #define CONF_GCLK_GEN_3_DIVSEL 0 #endif @@ -310,8 +310,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 3 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 3 division <0x0000-0xFFFF> // <id> gclk_gen_3_div #ifndef CONF_GCLK_GEN_3_DIV #define CONF_GCLK_GEN_3_DIV 1 @@ -351,7 +351,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_4_div_sel +// <id> gclk_gen_4_div_sel #ifndef CONF_GCLK_GEN_4_DIVSEL #define CONF_GCLK_GEN_4_DIVSEL 0 #endif @@ -385,8 +385,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 4 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 4 division <0x0000-0xFFFF> // <id> gclk_gen_4_div #ifndef CONF_GCLK_GEN_4_DIV #define CONF_GCLK_GEN_4_DIV 1 @@ -426,7 +426,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_5_div_sel +// <id> gclk_gen_5_div_sel #ifndef CONF_GCLK_GEN_5_DIVSEL #define CONF_GCLK_GEN_5_DIVSEL 0 #endif @@ -460,8 +460,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 5 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 5 division <0x0000-0xFFFF> // <id> gclk_gen_5_div #ifndef CONF_GCLK_GEN_5_DIV #define CONF_GCLK_GEN_5_DIV 24 @@ -501,7 +501,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_6_div_sel +// <id> gclk_gen_6_div_sel #ifndef CONF_GCLK_GEN_6_DIVSEL #define CONF_GCLK_GEN_6_DIVSEL 0 #endif @@ -535,8 +535,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 6 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 6 division <0x0000-0xFFFF> // <id> gclk_gen_6_div #ifndef CONF_GCLK_GEN_6_DIV #define CONF_GCLK_GEN_6_DIV 4 @@ -576,7 +576,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_7_div_sel +// <id> gclk_gen_7_div_sel #ifndef CONF_GCLK_GEN_7_DIVSEL #define CONF_GCLK_GEN_7_DIVSEL 0 #endif @@ -610,8 +610,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 7 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 7 division <0x0000-0xFFFF> // <id> gclk_gen_7_div #ifndef CONF_GCLK_GEN_7_DIV #define CONF_GCLK_GEN_7_DIV 1 @@ -651,7 +651,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_8_div_sel +// <id> gclk_gen_8_div_sel #ifndef CONF_GCLK_GEN_8_DIVSEL #define CONF_GCLK_GEN_8_DIVSEL 0 #endif @@ -685,8 +685,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 8 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 8 division <0x0000-0xFFFF> // <id> gclk_gen_8_div #ifndef CONF_GCLK_GEN_8_DIV #define CONF_GCLK_GEN_8_DIV 1 @@ -726,7 +726,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_9_div_sel +// <id> gclk_gen_9_div_sel #ifndef CONF_GCLK_GEN_9_DIVSEL #define CONF_GCLK_GEN_9_DIVSEL 0 #endif @@ -760,8 +760,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 9 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 9 division <0x0000-0xFFFF> // <id> gclk_gen_9_div #ifndef CONF_GCLK_GEN_9_DIV #define CONF_GCLK_GEN_9_DIV 1 @@ -801,7 +801,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_10_div_sel +// <id> gclk_gen_10_div_sel #ifndef CONF_GCLK_GEN_10_DIVSEL #define CONF_GCLK_GEN_10_DIVSEL 0 #endif @@ -835,8 +835,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 10 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 10 division <0x0000-0xFFFF> // <id> gclk_gen_10_div #ifndef CONF_GCLK_GEN_10_DIV #define CONF_GCLK_GEN_10_DIV 1 @@ -876,7 +876,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_11_div_sel +// <id> gclk_gen_11_div_sel #ifndef CONF_GCLK_GEN_11_DIVSEL #define CONF_GCLK_GEN_11_DIVSEL 0 #endif @@ -910,8 +910,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 11 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 11 division <0x0000-0xFFFF> // <id> gclk_gen_11_div #ifndef CONF_GCLK_GEN_11_DIV #define CONF_GCLK_GEN_11_DIV 1 diff --git a/ports/atmel-samd/asf4_conf/samd51/hpl_oscctrl_config.h b/ports/atmel-samd/asf4_conf/samd51/hpl_oscctrl_config.h index cd1186605..f7f79fada 100644 --- a/ports/atmel-samd/asf4_conf/samd51/hpl_oscctrl_config.h +++ b/ports/atmel-samd/asf4_conf/samd51/hpl_oscctrl_config.h @@ -96,8 +96,8 @@ #ifndef CONF_XOSC0_XTALEN #define CONF_XOSC0_XTALEN 0 #endif -//</h> -//</e> +// </h> +// </e> #if CONF_XOSC0_FREQUENCY >= 32000000 #define CONF_XOSC0_CFDPRESC 0x0 @@ -209,8 +209,8 @@ #ifndef CONF_XOSC1_XTALEN #define CONF_XOSC1_XTALEN 0 #endif -//</h> -//</e> +// </h> +// </e> #if CONF_XOSC1_FREQUENCY >= 32000000 #define CONF_XOSC1_CFDPRESC 0x0 @@ -372,11 +372,11 @@ #define CONF_DFLL_FINE (0x80) #endif -//</e> +// </e> -//</h> +// </h> -//</e> +// </e> // <e> FDPLL0 Configuration // <i> Indicates whether configuration for FDPLL0 is enabled or not @@ -501,8 +501,8 @@ #define CONF_FDPLL0_FILTER 0x0 #endif -//</h> -//</e> +// </h> +// </e> // <e> FDPLL1 Configuration // <i> Indicates whether configuration for FDPLL1 is enabled or not // <id> enable_fdpll1 @@ -626,8 +626,8 @@ #define CONF_FDPLL1_FILTER 0x0 #endif -//</h> -//</e> +// </h> +// </e> // <<< end of configuration section >>> diff --git a/ports/atmel-samd/asf4_conf/samd51/hpl_sercom_config.h b/ports/atmel-samd/asf4_conf/samd51/hpl_sercom_config.h index cd411154c..b43861977 100644 --- a/ports/atmel-samd/asf4_conf/samd51/hpl_sercom_config.h +++ b/ports/atmel-samd/asf4_conf/samd51/hpl_sercom_config.h @@ -294,12 +294,12 @@ // BAUD: register value low [7:0] // BAUDLOW: register value high [15:8], only used for odd BAUD + BAUDLOW #define CONF_SERCOM_1_I2CM_BAUD_BAUDLOW \ - (((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \ - - (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \ - / 1000)) \ - * 10 \ - + 5) \ - / (CONF_SERCOM_1_I2CM_BAUD * 10)) + (((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \ + - (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \ + / 1000)) \ + * 10 \ + + 5) \ + / (CONF_SERCOM_1_I2CM_BAUD * 10)) #ifndef CONF_SERCOM_1_I2CM_BAUD_RATE #if CONF_SERCOM_1_I2CM_BAUD_BAUDLOW > (0xFF * 2) #warning Requested I2C baudrate too low, please check @@ -309,9 +309,9 @@ #define CONF_SERCOM_1_I2CM_BAUD_RATE 1 #else #define CONF_SERCOM_1_I2CM_BAUD_RATE \ - ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \ - ? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \ - : (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2)) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \ + ? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \ + : (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2)) #endif #endif @@ -525,7 +525,7 @@ #if CONF_SERCOM_2_USART_SAMPR == 0 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -533,7 +533,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 1 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) + ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -541,7 +541,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 2 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -549,7 +549,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 3 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) + ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -557,7 +557,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 4 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -571,9 +571,9 @@ #define CONF_SERCOM_3_SPI_ENABLE 1 #endif -//<o> SPI DMA TX Channel <0-32> -//<i> This defines DMA channel to be used -//<id> spi_master_dma_tx_channel +// <o> SPI DMA TX Channel <0-32> +// <i> This defines DMA channel to be used +// <id> spi_master_dma_tx_channel #ifndef CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL #define CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL 0 #endif @@ -584,9 +584,9 @@ #define CONF_SERCOM_3_SPI_RX_CHANNEL 1 #endif -//<o> DMA Channel <0-32> -//<i> This defines DMA channel to be used -//<id> spi_master_dma_rx_channel +// <o> DMA Channel <0-32> +// <i> This defines DMA channel to be used +// <id> spi_master_dma_rx_channel #ifndef CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL #define CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL 1 #endif diff --git a/ports/atmel-samd/asf4_conf/samd51/hpl_tc_config.h b/ports/atmel-samd/asf4_conf/samd51/hpl_tc_config.h index 38d48e9b6..3bc688295 100644 --- a/ports/atmel-samd/asf4_conf/samd51/hpl_tc_config.h +++ b/ports/atmel-samd/asf4_conf/samd51/hpl_tc_config.h @@ -45,7 +45,7 @@ /* Caculate pwm ccx register value based on WAVE_PER_VAL and Waveform Duty Value */ #if CONF_TC0_PRESCALER < TC_CTRLA_PRESCALER_DIV64_Val #define CONF_TC0_CC0 \ - ((uint32_t)(((double)CONF_TC0_WAVE_PER_VAL * CONF_GCLK_TC0_FREQUENCY) / 1000000 / (1 << CONF_TC0_PRESCALER) - 1)) + ((uint32_t)(((double)CONF_TC0_WAVE_PER_VAL * CONF_GCLK_TC0_FREQUENCY) / 1000000 / (1 << CONF_TC0_PRESCALER) - 1)) #define CONF_TC0_CC1 ((CONF_TC0_CC0 * CONF_TC0_WAVE_DUTY_VAL) / 1000) #elif CONF_TC0_PRESCALER == TC_CTRLA_PRESCALER_DIV64_Val @@ -114,15 +114,15 @@ #endif /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_CAPTEN0 0 -//#define CONF_TC0_CAPTEN1 0 -//#define CONF_TC0_COPEN0 0 -//#define CONF_TC0_COPEN1 0 +// #define CONF_TC0_CAPTEN0 0 +// #define CONF_TC0_CAPTEN1 0 +// #define CONF_TC0_COPEN0 0 +// #define CONF_TC0_COPEN1 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_DIR 0 -//#define CONF_TC0_ONESHOT 0 -//#define CONF_TC0_LUPD 0 +// #define CONF_TC0_DIR 0 +// #define CONF_TC0_ONESHOT 0 +// #define CONF_TC0_LUPD 0 // <q> Debug Running Mode // <i> Indicates whether the Debug Running Mode is enabled or not @@ -182,25 +182,25 @@ // <6=> Period captured in CC1, pulse width in CC0 // <7=> Pulse width capture // <i> Event which will be performed on an event -//<id> tc_arch_evact +// <id> tc_arch_evact #ifndef CONF_TC0_EVACT #define CONF_TC0_EVACT 0 #endif // </e> /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_WAVEGEN TC_CTRLA_WAVEGEN_MFRQ_Val +// #define CONF_TC0_WAVEGEN TC_CTRLA_WAVEGEN_MFRQ_Val /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_INVEN0 0 -//#define CONF_TC0_INVEN1 0 +// #define CONF_TC0_INVEN0 0 +// #define CONF_TC0_INVEN1 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_PERBUF 0 +// #define CONF_TC0_PERBUF 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_CCBUF0 0 -//#define CONF_TC0_CCBUF1 0 +// #define CONF_TC0_CCBUF0 0 +// #define CONF_TC0_CCBUF1 0 // </h> diff --git a/ports/atmel-samd/asf4_conf/samd51/usbd_config.h b/ports/atmel-samd/asf4_conf/samd51/usbd_config.h index be1fa3c9e..b2629e123 100644 --- a/ports/atmel-samd/asf4_conf/samd51/usbd_config.h +++ b/ports/atmel-samd/asf4_conf/samd51/usbd_config.h @@ -101,7 +101,7 @@ #ifndef CONF_USB_COMPOSITE_IPRODUCT #define CONF_USB_COMPOSITE_IPRODUCT \ - (CONF_USB_COMPOSITE_IPRODUCT_EN * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN)) + (CONF_USB_COMPOSITE_IPRODUCT_EN * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN)) #endif // <s> Unicode string of iProduct @@ -124,8 +124,8 @@ #ifndef CONF_USB_COMPOSITE_ISERIALNUM #define CONF_USB_COMPOSITE_ISERIALNUM \ - (CONF_USB_COMPOSITE_ISERIALNUM_EN \ - * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN)) + (CONF_USB_COMPOSITE_ISERIALNUM_EN \ + * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN)) #endif // <s> Unicode string of iSerialNum @@ -162,9 +162,9 @@ #ifndef CONF_USB_COMPOSITE_ICONFIG #define CONF_USB_COMPOSITE_ICONFIG \ - (CONF_USB_COMPOSITE_ICONFIG_EN \ - * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN \ - + CONF_USB_COMPOSITE_ICONFIG_EN)) + (CONF_USB_COMPOSITE_ICONFIG_EN \ + * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN \ + + CONF_USB_COMPOSITE_ICONFIG_EN)) #endif // <s> Unicode string of iConfig @@ -453,9 +453,9 @@ #ifndef CONF_USB_COMPOSITE_HID_GENERIC_REPORT #define CONF_USB_COMPOSITE_HID_GENERIC_REPORT \ - 0x06, 0xFF, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x09, 0x02, 0x09, 0x03, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, \ - 0x40, 0x81, 0x02, 0x09, 0x04, 0x09, 0x05, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40, 0x91, 0x02, \ - 0x09, 0x06, 0x09, 0x07, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x04, 0xB1, 0x02, 0xC0 + 0x06, 0xFF, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x09, 0x02, 0x09, 0x03, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, \ + 0x40, 0x81, 0x02, 0x09, 0x04, 0x09, 0x05, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40, 0x91, 0x02, \ + 0x09, 0x06, 0x09, 0x07, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x04, 0xB1, 0x02, 0xC0 #endif // <o> HID Generic INTERRUPT IN Endpoint Address @@ -650,7 +650,7 @@ #ifndef CONF_USB_MSC_LUN0_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN0_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN0_CAPACITY * 1024 / CONF_USB_MSC_LUN0_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN0_CAPACITY * 1024 / CONF_USB_MSC_LUN0_BLOCK_SIZE - 1) #endif // </e> @@ -713,7 +713,7 @@ #ifndef CONF_USB_MSC_LUN1_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN1_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN1_CAPACITY * 1024 / CONF_USB_MSC_LUN1_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN1_CAPACITY * 1024 / CONF_USB_MSC_LUN1_BLOCK_SIZE - 1) #endif // </e> @@ -775,7 +775,7 @@ #ifndef CONF_USB_MSC_LUN2_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN2_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN2_CAPACITY * 1024 / CONF_USB_MSC_LUN2_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN2_CAPACITY * 1024 / CONF_USB_MSC_LUN2_BLOCK_SIZE - 1) #endif // </e> @@ -837,7 +837,7 @@ #ifndef CONF_USB_MSC_LUN3_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN3_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN3_CAPACITY * 1024 / CONF_USB_MSC_LUN3_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN3_CAPACITY * 1024 / CONF_USB_MSC_LUN3_BLOCK_SIZE - 1) #endif // </e> diff --git a/ports/atmel-samd/asf4_conf/same51/hpl_gclk_config.h b/ports/atmel-samd/asf4_conf/same51/hpl_gclk_config.h index 6f4f01a7e..1dda85a69 100644 --- a/ports/atmel-samd/asf4_conf/same51/hpl_gclk_config.h +++ b/ports/atmel-samd/asf4_conf/same51/hpl_gclk_config.h @@ -11,7 +11,7 @@ // Used in hpl/core/hpl_init.c to define which clocks should be initialized first. // Not clear why all these need to be specified, but it doesn't work properly otherwise. -//#define CIRCUITPY_GCLK_INIT_1ST (1 << 0 | 1 << 1 | 1 << 3 | 1 <<5) +// #define CIRCUITPY_GCLK_INIT_1ST (1 << 0 | 1 << 1 | 1 << 3 | 1 <<5) #define CIRCUITPY_GCLK_INIT_1ST 0xffff /* Auto-generated config file hpl_gclk_config.h */ @@ -52,7 +52,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_0_div_sel +// <id> gclk_gen_0_div_sel #ifndef CONF_GCLK_GEN_0_DIVSEL #define CONF_GCLK_GEN_0_DIVSEL 0 #endif @@ -86,8 +86,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 0 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 0 division <0x0000-0xFFFF> // <id> gclk_gen_0_div #ifndef CONF_GCLK_GEN_0_DIV #define CONF_GCLK_GEN_0_DIV 1 @@ -126,7 +126,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_1_div_sel +// <id> gclk_gen_1_div_sel #ifndef CONF_GCLK_GEN_1_DIVSEL #define CONF_GCLK_GEN_1_DIVSEL 0 #endif @@ -160,8 +160,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 1 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 1 division <0x0000-0xFFFF> // <id> gclk_gen_1_div #ifndef CONF_GCLK_GEN_1_DIV #define CONF_GCLK_GEN_1_DIV 1 @@ -201,7 +201,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_2_div_sel +// <id> gclk_gen_2_div_sel #ifndef CONF_GCLK_GEN_2_DIVSEL #define CONF_GCLK_GEN_2_DIVSEL 1 #endif @@ -235,8 +235,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 2 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 2 division <0x0000-0xFFFF> // <id> gclk_gen_2_div #ifndef CONF_GCLK_GEN_2_DIV #define CONF_GCLK_GEN_2_DIV 4 @@ -276,7 +276,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_3_div_sel +// <id> gclk_gen_3_div_sel #ifndef CONF_GCLK_GEN_3_DIVSEL #define CONF_GCLK_GEN_3_DIVSEL 0 #endif @@ -310,8 +310,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 3 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 3 division <0x0000-0xFFFF> // <id> gclk_gen_3_div #ifndef CONF_GCLK_GEN_3_DIV #define CONF_GCLK_GEN_3_DIV 1 @@ -351,7 +351,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_4_div_sel +// <id> gclk_gen_4_div_sel #ifndef CONF_GCLK_GEN_4_DIVSEL #define CONF_GCLK_GEN_4_DIVSEL 0 #endif @@ -385,8 +385,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 4 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 4 division <0x0000-0xFFFF> // <id> gclk_gen_4_div #ifndef CONF_GCLK_GEN_4_DIV #define CONF_GCLK_GEN_4_DIV 1 @@ -426,7 +426,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_5_div_sel +// <id> gclk_gen_5_div_sel #ifndef CONF_GCLK_GEN_5_DIVSEL #define CONF_GCLK_GEN_5_DIVSEL 0 #endif @@ -460,8 +460,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 5 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 5 division <0x0000-0xFFFF> // <id> gclk_gen_5_div #ifndef CONF_GCLK_GEN_5_DIV #define CONF_GCLK_GEN_5_DIV 24 @@ -501,7 +501,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_6_div_sel +// <id> gclk_gen_6_div_sel #ifndef CONF_GCLK_GEN_6_DIVSEL #define CONF_GCLK_GEN_6_DIVSEL 0 #endif @@ -535,8 +535,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 6 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 6 division <0x0000-0xFFFF> // <id> gclk_gen_6_div #ifndef CONF_GCLK_GEN_6_DIV #define CONF_GCLK_GEN_6_DIV 4 @@ -576,7 +576,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_7_div_sel +// <id> gclk_gen_7_div_sel #ifndef CONF_GCLK_GEN_7_DIVSEL #define CONF_GCLK_GEN_7_DIVSEL 0 #endif @@ -610,8 +610,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 7 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 7 division <0x0000-0xFFFF> // <id> gclk_gen_7_div #ifndef CONF_GCLK_GEN_7_DIV #define CONF_GCLK_GEN_7_DIV 1 @@ -651,7 +651,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_8_div_sel +// <id> gclk_gen_8_div_sel #ifndef CONF_GCLK_GEN_8_DIVSEL #define CONF_GCLK_GEN_8_DIVSEL 0 #endif @@ -685,8 +685,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 8 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 8 division <0x0000-0xFFFF> // <id> gclk_gen_8_div #ifndef CONF_GCLK_GEN_8_DIV #define CONF_GCLK_GEN_8_DIV 1 @@ -726,7 +726,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_9_div_sel +// <id> gclk_gen_9_div_sel #ifndef CONF_GCLK_GEN_9_DIVSEL #define CONF_GCLK_GEN_9_DIVSEL 0 #endif @@ -760,8 +760,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 9 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 9 division <0x0000-0xFFFF> // <id> gclk_gen_9_div #ifndef CONF_GCLK_GEN_9_DIV #define CONF_GCLK_GEN_9_DIV 1 @@ -801,7 +801,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_10_div_sel +// <id> gclk_gen_10_div_sel #ifndef CONF_GCLK_GEN_10_DIVSEL #define CONF_GCLK_GEN_10_DIVSEL 0 #endif @@ -835,8 +835,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 10 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 10 division <0x0000-0xFFFF> // <id> gclk_gen_10_div #ifndef CONF_GCLK_GEN_10_DIV #define CONF_GCLK_GEN_10_DIV 1 @@ -876,7 +876,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_11_div_sel +// <id> gclk_gen_11_div_sel #ifndef CONF_GCLK_GEN_11_DIVSEL #define CONF_GCLK_GEN_11_DIVSEL 0 #endif @@ -910,8 +910,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 11 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 11 division <0x0000-0xFFFF> // <id> gclk_gen_11_div #ifndef CONF_GCLK_GEN_11_DIV #define CONF_GCLK_GEN_11_DIV 1 diff --git a/ports/atmel-samd/asf4_conf/same51/hpl_oscctrl_config.h b/ports/atmel-samd/asf4_conf/same51/hpl_oscctrl_config.h index cd1186605..f7f79fada 100644 --- a/ports/atmel-samd/asf4_conf/same51/hpl_oscctrl_config.h +++ b/ports/atmel-samd/asf4_conf/same51/hpl_oscctrl_config.h @@ -96,8 +96,8 @@ #ifndef CONF_XOSC0_XTALEN #define CONF_XOSC0_XTALEN 0 #endif -//</h> -//</e> +// </h> +// </e> #if CONF_XOSC0_FREQUENCY >= 32000000 #define CONF_XOSC0_CFDPRESC 0x0 @@ -209,8 +209,8 @@ #ifndef CONF_XOSC1_XTALEN #define CONF_XOSC1_XTALEN 0 #endif -//</h> -//</e> +// </h> +// </e> #if CONF_XOSC1_FREQUENCY >= 32000000 #define CONF_XOSC1_CFDPRESC 0x0 @@ -372,11 +372,11 @@ #define CONF_DFLL_FINE (0x80) #endif -//</e> +// </e> -//</h> +// </h> -//</e> +// </e> // <e> FDPLL0 Configuration // <i> Indicates whether configuration for FDPLL0 is enabled or not @@ -501,8 +501,8 @@ #define CONF_FDPLL0_FILTER 0x0 #endif -//</h> -//</e> +// </h> +// </e> // <e> FDPLL1 Configuration // <i> Indicates whether configuration for FDPLL1 is enabled or not // <id> enable_fdpll1 @@ -626,8 +626,8 @@ #define CONF_FDPLL1_FILTER 0x0 #endif -//</h> -//</e> +// </h> +// </e> // <<< end of configuration section >>> diff --git a/ports/atmel-samd/asf4_conf/same51/hpl_sercom_config.h b/ports/atmel-samd/asf4_conf/same51/hpl_sercom_config.h index cd411154c..b43861977 100644 --- a/ports/atmel-samd/asf4_conf/same51/hpl_sercom_config.h +++ b/ports/atmel-samd/asf4_conf/same51/hpl_sercom_config.h @@ -294,12 +294,12 @@ // BAUD: register value low [7:0] // BAUDLOW: register value high [15:8], only used for odd BAUD + BAUDLOW #define CONF_SERCOM_1_I2CM_BAUD_BAUDLOW \ - (((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \ - - (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \ - / 1000)) \ - * 10 \ - + 5) \ - / (CONF_SERCOM_1_I2CM_BAUD * 10)) + (((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \ + - (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \ + / 1000)) \ + * 10 \ + + 5) \ + / (CONF_SERCOM_1_I2CM_BAUD * 10)) #ifndef CONF_SERCOM_1_I2CM_BAUD_RATE #if CONF_SERCOM_1_I2CM_BAUD_BAUDLOW > (0xFF * 2) #warning Requested I2C baudrate too low, please check @@ -309,9 +309,9 @@ #define CONF_SERCOM_1_I2CM_BAUD_RATE 1 #else #define CONF_SERCOM_1_I2CM_BAUD_RATE \ - ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \ - ? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \ - : (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2)) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \ + ? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \ + : (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2)) #endif #endif @@ -525,7 +525,7 @@ #if CONF_SERCOM_2_USART_SAMPR == 0 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -533,7 +533,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 1 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) + ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -541,7 +541,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 2 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -549,7 +549,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 3 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) + ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -557,7 +557,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 4 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -571,9 +571,9 @@ #define CONF_SERCOM_3_SPI_ENABLE 1 #endif -//<o> SPI DMA TX Channel <0-32> -//<i> This defines DMA channel to be used -//<id> spi_master_dma_tx_channel +// <o> SPI DMA TX Channel <0-32> +// <i> This defines DMA channel to be used +// <id> spi_master_dma_tx_channel #ifndef CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL #define CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL 0 #endif @@ -584,9 +584,9 @@ #define CONF_SERCOM_3_SPI_RX_CHANNEL 1 #endif -//<o> DMA Channel <0-32> -//<i> This defines DMA channel to be used -//<id> spi_master_dma_rx_channel +// <o> DMA Channel <0-32> +// <i> This defines DMA channel to be used +// <id> spi_master_dma_rx_channel #ifndef CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL #define CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL 1 #endif diff --git a/ports/atmel-samd/asf4_conf/same51/hpl_tc_config.h b/ports/atmel-samd/asf4_conf/same51/hpl_tc_config.h index 38d48e9b6..3bc688295 100644 --- a/ports/atmel-samd/asf4_conf/same51/hpl_tc_config.h +++ b/ports/atmel-samd/asf4_conf/same51/hpl_tc_config.h @@ -45,7 +45,7 @@ /* Caculate pwm ccx register value based on WAVE_PER_VAL and Waveform Duty Value */ #if CONF_TC0_PRESCALER < TC_CTRLA_PRESCALER_DIV64_Val #define CONF_TC0_CC0 \ - ((uint32_t)(((double)CONF_TC0_WAVE_PER_VAL * CONF_GCLK_TC0_FREQUENCY) / 1000000 / (1 << CONF_TC0_PRESCALER) - 1)) + ((uint32_t)(((double)CONF_TC0_WAVE_PER_VAL * CONF_GCLK_TC0_FREQUENCY) / 1000000 / (1 << CONF_TC0_PRESCALER) - 1)) #define CONF_TC0_CC1 ((CONF_TC0_CC0 * CONF_TC0_WAVE_DUTY_VAL) / 1000) #elif CONF_TC0_PRESCALER == TC_CTRLA_PRESCALER_DIV64_Val @@ -114,15 +114,15 @@ #endif /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_CAPTEN0 0 -//#define CONF_TC0_CAPTEN1 0 -//#define CONF_TC0_COPEN0 0 -//#define CONF_TC0_COPEN1 0 +// #define CONF_TC0_CAPTEN0 0 +// #define CONF_TC0_CAPTEN1 0 +// #define CONF_TC0_COPEN0 0 +// #define CONF_TC0_COPEN1 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_DIR 0 -//#define CONF_TC0_ONESHOT 0 -//#define CONF_TC0_LUPD 0 +// #define CONF_TC0_DIR 0 +// #define CONF_TC0_ONESHOT 0 +// #define CONF_TC0_LUPD 0 // <q> Debug Running Mode // <i> Indicates whether the Debug Running Mode is enabled or not @@ -182,25 +182,25 @@ // <6=> Period captured in CC1, pulse width in CC0 // <7=> Pulse width capture // <i> Event which will be performed on an event -//<id> tc_arch_evact +// <id> tc_arch_evact #ifndef CONF_TC0_EVACT #define CONF_TC0_EVACT 0 #endif // </e> /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_WAVEGEN TC_CTRLA_WAVEGEN_MFRQ_Val +// #define CONF_TC0_WAVEGEN TC_CTRLA_WAVEGEN_MFRQ_Val /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_INVEN0 0 -//#define CONF_TC0_INVEN1 0 +// #define CONF_TC0_INVEN0 0 +// #define CONF_TC0_INVEN1 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_PERBUF 0 +// #define CONF_TC0_PERBUF 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_CCBUF0 0 -//#define CONF_TC0_CCBUF1 0 +// #define CONF_TC0_CCBUF0 0 +// #define CONF_TC0_CCBUF1 0 // </h> diff --git a/ports/atmel-samd/asf4_conf/same51/usbd_config.h b/ports/atmel-samd/asf4_conf/same51/usbd_config.h index be1fa3c9e..b2629e123 100644 --- a/ports/atmel-samd/asf4_conf/same51/usbd_config.h +++ b/ports/atmel-samd/asf4_conf/same51/usbd_config.h @@ -101,7 +101,7 @@ #ifndef CONF_USB_COMPOSITE_IPRODUCT #define CONF_USB_COMPOSITE_IPRODUCT \ - (CONF_USB_COMPOSITE_IPRODUCT_EN * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN)) + (CONF_USB_COMPOSITE_IPRODUCT_EN * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN)) #endif // <s> Unicode string of iProduct @@ -124,8 +124,8 @@ #ifndef CONF_USB_COMPOSITE_ISERIALNUM #define CONF_USB_COMPOSITE_ISERIALNUM \ - (CONF_USB_COMPOSITE_ISERIALNUM_EN \ - * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN)) + (CONF_USB_COMPOSITE_ISERIALNUM_EN \ + * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN)) #endif // <s> Unicode string of iSerialNum @@ -162,9 +162,9 @@ #ifndef CONF_USB_COMPOSITE_ICONFIG #define CONF_USB_COMPOSITE_ICONFIG \ - (CONF_USB_COMPOSITE_ICONFIG_EN \ - * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN \ - + CONF_USB_COMPOSITE_ICONFIG_EN)) + (CONF_USB_COMPOSITE_ICONFIG_EN \ + * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN \ + + CONF_USB_COMPOSITE_ICONFIG_EN)) #endif // <s> Unicode string of iConfig @@ -453,9 +453,9 @@ #ifndef CONF_USB_COMPOSITE_HID_GENERIC_REPORT #define CONF_USB_COMPOSITE_HID_GENERIC_REPORT \ - 0x06, 0xFF, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x09, 0x02, 0x09, 0x03, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, \ - 0x40, 0x81, 0x02, 0x09, 0x04, 0x09, 0x05, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40, 0x91, 0x02, \ - 0x09, 0x06, 0x09, 0x07, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x04, 0xB1, 0x02, 0xC0 + 0x06, 0xFF, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x09, 0x02, 0x09, 0x03, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, \ + 0x40, 0x81, 0x02, 0x09, 0x04, 0x09, 0x05, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40, 0x91, 0x02, \ + 0x09, 0x06, 0x09, 0x07, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x04, 0xB1, 0x02, 0xC0 #endif // <o> HID Generic INTERRUPT IN Endpoint Address @@ -650,7 +650,7 @@ #ifndef CONF_USB_MSC_LUN0_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN0_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN0_CAPACITY * 1024 / CONF_USB_MSC_LUN0_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN0_CAPACITY * 1024 / CONF_USB_MSC_LUN0_BLOCK_SIZE - 1) #endif // </e> @@ -713,7 +713,7 @@ #ifndef CONF_USB_MSC_LUN1_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN1_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN1_CAPACITY * 1024 / CONF_USB_MSC_LUN1_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN1_CAPACITY * 1024 / CONF_USB_MSC_LUN1_BLOCK_SIZE - 1) #endif // </e> @@ -775,7 +775,7 @@ #ifndef CONF_USB_MSC_LUN2_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN2_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN2_CAPACITY * 1024 / CONF_USB_MSC_LUN2_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN2_CAPACITY * 1024 / CONF_USB_MSC_LUN2_BLOCK_SIZE - 1) #endif // </e> @@ -837,7 +837,7 @@ #ifndef CONF_USB_MSC_LUN3_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN3_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN3_CAPACITY * 1024 / CONF_USB_MSC_LUN3_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN3_CAPACITY * 1024 / CONF_USB_MSC_LUN3_BLOCK_SIZE - 1) #endif // </e> diff --git a/ports/atmel-samd/asf4_conf/same54/hpl_gclk_config.h b/ports/atmel-samd/asf4_conf/same54/hpl_gclk_config.h index 6f4f01a7e..1dda85a69 100644 --- a/ports/atmel-samd/asf4_conf/same54/hpl_gclk_config.h +++ b/ports/atmel-samd/asf4_conf/same54/hpl_gclk_config.h @@ -11,7 +11,7 @@ // Used in hpl/core/hpl_init.c to define which clocks should be initialized first. // Not clear why all these need to be specified, but it doesn't work properly otherwise. -//#define CIRCUITPY_GCLK_INIT_1ST (1 << 0 | 1 << 1 | 1 << 3 | 1 <<5) +// #define CIRCUITPY_GCLK_INIT_1ST (1 << 0 | 1 << 1 | 1 << 3 | 1 <<5) #define CIRCUITPY_GCLK_INIT_1ST 0xffff /* Auto-generated config file hpl_gclk_config.h */ @@ -52,7 +52,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_0_div_sel +// <id> gclk_gen_0_div_sel #ifndef CONF_GCLK_GEN_0_DIVSEL #define CONF_GCLK_GEN_0_DIVSEL 0 #endif @@ -86,8 +86,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 0 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 0 division <0x0000-0xFFFF> // <id> gclk_gen_0_div #ifndef CONF_GCLK_GEN_0_DIV #define CONF_GCLK_GEN_0_DIV 1 @@ -126,7 +126,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_1_div_sel +// <id> gclk_gen_1_div_sel #ifndef CONF_GCLK_GEN_1_DIVSEL #define CONF_GCLK_GEN_1_DIVSEL 0 #endif @@ -160,8 +160,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 1 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 1 division <0x0000-0xFFFF> // <id> gclk_gen_1_div #ifndef CONF_GCLK_GEN_1_DIV #define CONF_GCLK_GEN_1_DIV 1 @@ -201,7 +201,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_2_div_sel +// <id> gclk_gen_2_div_sel #ifndef CONF_GCLK_GEN_2_DIVSEL #define CONF_GCLK_GEN_2_DIVSEL 1 #endif @@ -235,8 +235,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 2 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 2 division <0x0000-0xFFFF> // <id> gclk_gen_2_div #ifndef CONF_GCLK_GEN_2_DIV #define CONF_GCLK_GEN_2_DIV 4 @@ -276,7 +276,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_3_div_sel +// <id> gclk_gen_3_div_sel #ifndef CONF_GCLK_GEN_3_DIVSEL #define CONF_GCLK_GEN_3_DIVSEL 0 #endif @@ -310,8 +310,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 3 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 3 division <0x0000-0xFFFF> // <id> gclk_gen_3_div #ifndef CONF_GCLK_GEN_3_DIV #define CONF_GCLK_GEN_3_DIV 1 @@ -351,7 +351,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_4_div_sel +// <id> gclk_gen_4_div_sel #ifndef CONF_GCLK_GEN_4_DIVSEL #define CONF_GCLK_GEN_4_DIVSEL 0 #endif @@ -385,8 +385,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 4 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 4 division <0x0000-0xFFFF> // <id> gclk_gen_4_div #ifndef CONF_GCLK_GEN_4_DIV #define CONF_GCLK_GEN_4_DIV 1 @@ -426,7 +426,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_5_div_sel +// <id> gclk_gen_5_div_sel #ifndef CONF_GCLK_GEN_5_DIVSEL #define CONF_GCLK_GEN_5_DIVSEL 0 #endif @@ -460,8 +460,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 5 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 5 division <0x0000-0xFFFF> // <id> gclk_gen_5_div #ifndef CONF_GCLK_GEN_5_DIV #define CONF_GCLK_GEN_5_DIV 24 @@ -501,7 +501,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_6_div_sel +// <id> gclk_gen_6_div_sel #ifndef CONF_GCLK_GEN_6_DIVSEL #define CONF_GCLK_GEN_6_DIVSEL 0 #endif @@ -535,8 +535,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 6 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 6 division <0x0000-0xFFFF> // <id> gclk_gen_6_div #ifndef CONF_GCLK_GEN_6_DIV #define CONF_GCLK_GEN_6_DIV 4 @@ -576,7 +576,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_7_div_sel +// <id> gclk_gen_7_div_sel #ifndef CONF_GCLK_GEN_7_DIVSEL #define CONF_GCLK_GEN_7_DIVSEL 0 #endif @@ -610,8 +610,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 7 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 7 division <0x0000-0xFFFF> // <id> gclk_gen_7_div #ifndef CONF_GCLK_GEN_7_DIV #define CONF_GCLK_GEN_7_DIV 1 @@ -651,7 +651,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_8_div_sel +// <id> gclk_gen_8_div_sel #ifndef CONF_GCLK_GEN_8_DIVSEL #define CONF_GCLK_GEN_8_DIVSEL 0 #endif @@ -685,8 +685,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 8 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 8 division <0x0000-0xFFFF> // <id> gclk_gen_8_div #ifndef CONF_GCLK_GEN_8_DIV #define CONF_GCLK_GEN_8_DIV 1 @@ -726,7 +726,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_9_div_sel +// <id> gclk_gen_9_div_sel #ifndef CONF_GCLK_GEN_9_DIVSEL #define CONF_GCLK_GEN_9_DIVSEL 0 #endif @@ -760,8 +760,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 9 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 9 division <0x0000-0xFFFF> // <id> gclk_gen_9_div #ifndef CONF_GCLK_GEN_9_DIV #define CONF_GCLK_GEN_9_DIV 1 @@ -801,7 +801,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_10_div_sel +// <id> gclk_gen_10_div_sel #ifndef CONF_GCLK_GEN_10_DIVSEL #define CONF_GCLK_GEN_10_DIVSEL 0 #endif @@ -835,8 +835,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 10 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 10 division <0x0000-0xFFFF> // <id> gclk_gen_10_div #ifndef CONF_GCLK_GEN_10_DIV #define CONF_GCLK_GEN_10_DIV 1 @@ -876,7 +876,7 @@ // <q> Divide Selection // <i> Indicates whether Divide Selection is enabled or not -//<id> gclk_gen_11_div_sel +// <id> gclk_gen_11_div_sel #ifndef CONF_GCLK_GEN_11_DIVSEL #define CONF_GCLK_GEN_11_DIVSEL 0 #endif @@ -910,8 +910,8 @@ #endif // </h> -//<h> Generic Clock Generator Division -//<o> Generic clock generator 11 division <0x0000-0xFFFF> +// <h> Generic Clock Generator Division +// <o> Generic clock generator 11 division <0x0000-0xFFFF> // <id> gclk_gen_11_div #ifndef CONF_GCLK_GEN_11_DIV #define CONF_GCLK_GEN_11_DIV 1 diff --git a/ports/atmel-samd/asf4_conf/same54/hpl_oscctrl_config.h b/ports/atmel-samd/asf4_conf/same54/hpl_oscctrl_config.h index cd1186605..f7f79fada 100644 --- a/ports/atmel-samd/asf4_conf/same54/hpl_oscctrl_config.h +++ b/ports/atmel-samd/asf4_conf/same54/hpl_oscctrl_config.h @@ -96,8 +96,8 @@ #ifndef CONF_XOSC0_XTALEN #define CONF_XOSC0_XTALEN 0 #endif -//</h> -//</e> +// </h> +// </e> #if CONF_XOSC0_FREQUENCY >= 32000000 #define CONF_XOSC0_CFDPRESC 0x0 @@ -209,8 +209,8 @@ #ifndef CONF_XOSC1_XTALEN #define CONF_XOSC1_XTALEN 0 #endif -//</h> -//</e> +// </h> +// </e> #if CONF_XOSC1_FREQUENCY >= 32000000 #define CONF_XOSC1_CFDPRESC 0x0 @@ -372,11 +372,11 @@ #define CONF_DFLL_FINE (0x80) #endif -//</e> +// </e> -//</h> +// </h> -//</e> +// </e> // <e> FDPLL0 Configuration // <i> Indicates whether configuration for FDPLL0 is enabled or not @@ -501,8 +501,8 @@ #define CONF_FDPLL0_FILTER 0x0 #endif -//</h> -//</e> +// </h> +// </e> // <e> FDPLL1 Configuration // <i> Indicates whether configuration for FDPLL1 is enabled or not // <id> enable_fdpll1 @@ -626,8 +626,8 @@ #define CONF_FDPLL1_FILTER 0x0 #endif -//</h> -//</e> +// </h> +// </e> // <<< end of configuration section >>> diff --git a/ports/atmel-samd/asf4_conf/same54/hpl_sercom_config.h b/ports/atmel-samd/asf4_conf/same54/hpl_sercom_config.h index cd411154c..b43861977 100644 --- a/ports/atmel-samd/asf4_conf/same54/hpl_sercom_config.h +++ b/ports/atmel-samd/asf4_conf/same54/hpl_sercom_config.h @@ -294,12 +294,12 @@ // BAUD: register value low [7:0] // BAUDLOW: register value high [15:8], only used for odd BAUD + BAUDLOW #define CONF_SERCOM_1_I2CM_BAUD_BAUDLOW \ - (((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \ - - (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \ - / 1000)) \ - * 10 \ - + 5) \ - / (CONF_SERCOM_1_I2CM_BAUD * 10)) + (((CONF_GCLK_SERCOM1_CORE_FREQUENCY - (CONF_SERCOM_1_I2CM_BAUD * 10) \ + - (CONF_SERCOM_1_I2CM_TRISE * (CONF_SERCOM_1_I2CM_BAUD / 100) * (CONF_GCLK_SERCOM1_CORE_FREQUENCY / 10000) \ + / 1000)) \ + * 10 \ + + 5) \ + / (CONF_SERCOM_1_I2CM_BAUD * 10)) #ifndef CONF_SERCOM_1_I2CM_BAUD_RATE #if CONF_SERCOM_1_I2CM_BAUD_BAUDLOW > (0xFF * 2) #warning Requested I2C baudrate too low, please check @@ -309,9 +309,9 @@ #define CONF_SERCOM_1_I2CM_BAUD_RATE 1 #else #define CONF_SERCOM_1_I2CM_BAUD_RATE \ - ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \ - ? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \ - : (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2)) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW & 0x1) \ + ? (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2) + ((CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2 + 1) << 8) \ + : (CONF_SERCOM_1_I2CM_BAUD_BAUDLOW / 2)) #endif #endif @@ -525,7 +525,7 @@ #if CONF_SERCOM_2_USART_SAMPR == 0 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 16.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -533,7 +533,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 1 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) + ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 16)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -541,7 +541,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 2 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 8.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -549,7 +549,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 3 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) + ((CONF_GCLK_SERCOM2_CORE_FREQUENCY) / (CONF_SERCOM_2_USART_BAUD * 8)) - (CONF_SERCOM_2_USART_FRACTIONAL / 8) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -557,7 +557,7 @@ #elif CONF_SERCOM_2_USART_SAMPR == 4 #ifndef CONF_SERCOM_2_USART_BAUD_RATE #define CONF_SERCOM_2_USART_BAUD_RATE \ - 65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) + 65536 - ((65536 * 3.0f * CONF_SERCOM_2_USART_BAUD) / CONF_GCLK_SERCOM2_CORE_FREQUENCY) #endif #ifndef CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH #define CONF_SERCOM_2_USART_RECEIVE_PULSE_LENGTH 0 @@ -571,9 +571,9 @@ #define CONF_SERCOM_3_SPI_ENABLE 1 #endif -//<o> SPI DMA TX Channel <0-32> -//<i> This defines DMA channel to be used -//<id> spi_master_dma_tx_channel +// <o> SPI DMA TX Channel <0-32> +// <i> This defines DMA channel to be used +// <id> spi_master_dma_tx_channel #ifndef CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL #define CONF_SERCOM_3_SPI_M_DMA_TX_CHANNEL 0 #endif @@ -584,9 +584,9 @@ #define CONF_SERCOM_3_SPI_RX_CHANNEL 1 #endif -//<o> DMA Channel <0-32> -//<i> This defines DMA channel to be used -//<id> spi_master_dma_rx_channel +// <o> DMA Channel <0-32> +// <i> This defines DMA channel to be used +// <id> spi_master_dma_rx_channel #ifndef CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL #define CONF_SERCOM_3_SPI_M_DMA_RX_CHANNEL 1 #endif diff --git a/ports/atmel-samd/asf4_conf/same54/hpl_tc_config.h b/ports/atmel-samd/asf4_conf/same54/hpl_tc_config.h index 38d48e9b6..3bc688295 100644 --- a/ports/atmel-samd/asf4_conf/same54/hpl_tc_config.h +++ b/ports/atmel-samd/asf4_conf/same54/hpl_tc_config.h @@ -45,7 +45,7 @@ /* Caculate pwm ccx register value based on WAVE_PER_VAL and Waveform Duty Value */ #if CONF_TC0_PRESCALER < TC_CTRLA_PRESCALER_DIV64_Val #define CONF_TC0_CC0 \ - ((uint32_t)(((double)CONF_TC0_WAVE_PER_VAL * CONF_GCLK_TC0_FREQUENCY) / 1000000 / (1 << CONF_TC0_PRESCALER) - 1)) + ((uint32_t)(((double)CONF_TC0_WAVE_PER_VAL * CONF_GCLK_TC0_FREQUENCY) / 1000000 / (1 << CONF_TC0_PRESCALER) - 1)) #define CONF_TC0_CC1 ((CONF_TC0_CC0 * CONF_TC0_WAVE_DUTY_VAL) / 1000) #elif CONF_TC0_PRESCALER == TC_CTRLA_PRESCALER_DIV64_Val @@ -114,15 +114,15 @@ #endif /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_CAPTEN0 0 -//#define CONF_TC0_CAPTEN1 0 -//#define CONF_TC0_COPEN0 0 -//#define CONF_TC0_COPEN1 0 +// #define CONF_TC0_CAPTEN0 0 +// #define CONF_TC0_CAPTEN1 0 +// #define CONF_TC0_COPEN0 0 +// #define CONF_TC0_COPEN1 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_DIR 0 -//#define CONF_TC0_ONESHOT 0 -//#define CONF_TC0_LUPD 0 +// #define CONF_TC0_DIR 0 +// #define CONF_TC0_ONESHOT 0 +// #define CONF_TC0_LUPD 0 // <q> Debug Running Mode // <i> Indicates whether the Debug Running Mode is enabled or not @@ -182,25 +182,25 @@ // <6=> Period captured in CC1, pulse width in CC0 // <7=> Pulse width capture // <i> Event which will be performed on an event -//<id> tc_arch_evact +// <id> tc_arch_evact #ifndef CONF_TC0_EVACT #define CONF_TC0_EVACT 0 #endif // </e> /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_WAVEGEN TC_CTRLA_WAVEGEN_MFRQ_Val +// #define CONF_TC0_WAVEGEN TC_CTRLA_WAVEGEN_MFRQ_Val /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_INVEN0 0 -//#define CONF_TC0_INVEN1 0 +// #define CONF_TC0_INVEN0 0 +// #define CONF_TC0_INVEN1 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_PERBUF 0 +// #define CONF_TC0_PERBUF 0 /* Commented intentionally. Timer uses fixed value. May be used by other abstractions based on TC. */ -//#define CONF_TC0_CCBUF0 0 -//#define CONF_TC0_CCBUF1 0 +// #define CONF_TC0_CCBUF0 0 +// #define CONF_TC0_CCBUF1 0 // </h> diff --git a/ports/atmel-samd/asf4_conf/same54/usbd_config.h b/ports/atmel-samd/asf4_conf/same54/usbd_config.h index be1fa3c9e..b2629e123 100644 --- a/ports/atmel-samd/asf4_conf/same54/usbd_config.h +++ b/ports/atmel-samd/asf4_conf/same54/usbd_config.h @@ -101,7 +101,7 @@ #ifndef CONF_USB_COMPOSITE_IPRODUCT #define CONF_USB_COMPOSITE_IPRODUCT \ - (CONF_USB_COMPOSITE_IPRODUCT_EN * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN)) + (CONF_USB_COMPOSITE_IPRODUCT_EN * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN)) #endif // <s> Unicode string of iProduct @@ -124,8 +124,8 @@ #ifndef CONF_USB_COMPOSITE_ISERIALNUM #define CONF_USB_COMPOSITE_ISERIALNUM \ - (CONF_USB_COMPOSITE_ISERIALNUM_EN \ - * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN)) + (CONF_USB_COMPOSITE_ISERIALNUM_EN \ + * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN)) #endif // <s> Unicode string of iSerialNum @@ -162,9 +162,9 @@ #ifndef CONF_USB_COMPOSITE_ICONFIG #define CONF_USB_COMPOSITE_ICONFIG \ - (CONF_USB_COMPOSITE_ICONFIG_EN \ - * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN \ - + CONF_USB_COMPOSITE_ICONFIG_EN)) + (CONF_USB_COMPOSITE_ICONFIG_EN \ + * (CONF_USB_COMPOSITE_IMANUFACT_EN + CONF_USB_COMPOSITE_IPRODUCT_EN + CONF_USB_COMPOSITE_ISERIALNUM_EN \ + + CONF_USB_COMPOSITE_ICONFIG_EN)) #endif // <s> Unicode string of iConfig @@ -453,9 +453,9 @@ #ifndef CONF_USB_COMPOSITE_HID_GENERIC_REPORT #define CONF_USB_COMPOSITE_HID_GENERIC_REPORT \ - 0x06, 0xFF, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x09, 0x02, 0x09, 0x03, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, \ - 0x40, 0x81, 0x02, 0x09, 0x04, 0x09, 0x05, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40, 0x91, 0x02, \ - 0x09, 0x06, 0x09, 0x07, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x04, 0xB1, 0x02, 0xC0 + 0x06, 0xFF, 0xFF, 0x09, 0x01, 0xA1, 0x01, 0x09, 0x02, 0x09, 0x03, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, \ + 0x40, 0x81, 0x02, 0x09, 0x04, 0x09, 0x05, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x40, 0x91, 0x02, \ + 0x09, 0x06, 0x09, 0x07, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 0x04, 0xB1, 0x02, 0xC0 #endif // <o> HID Generic INTERRUPT IN Endpoint Address @@ -650,7 +650,7 @@ #ifndef CONF_USB_MSC_LUN0_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN0_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN0_CAPACITY * 1024 / CONF_USB_MSC_LUN0_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN0_CAPACITY * 1024 / CONF_USB_MSC_LUN0_BLOCK_SIZE - 1) #endif // </e> @@ -713,7 +713,7 @@ #ifndef CONF_USB_MSC_LUN1_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN1_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN1_CAPACITY * 1024 / CONF_USB_MSC_LUN1_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN1_CAPACITY * 1024 / CONF_USB_MSC_LUN1_BLOCK_SIZE - 1) #endif // </e> @@ -775,7 +775,7 @@ #ifndef CONF_USB_MSC_LUN2_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN2_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN2_CAPACITY * 1024 / CONF_USB_MSC_LUN2_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN2_CAPACITY * 1024 / CONF_USB_MSC_LUN2_BLOCK_SIZE - 1) #endif // </e> @@ -837,7 +837,7 @@ #ifndef CONF_USB_MSC_LUN3_LAST_BLOCK_ADDR #define CONF_USB_MSC_LUN3_LAST_BLOCK_ADDR \ - ((uint32_t)CONF_USB_MSC_LUN3_CAPACITY * 1024 / CONF_USB_MSC_LUN3_BLOCK_SIZE - 1) + ((uint32_t)CONF_USB_MSC_LUN3_CAPACITY * 1024 / CONF_USB_MSC_LUN3_BLOCK_SIZE - 1) #endif // </e> diff --git a/ports/atmel-samd/audio_dma.c b/ports/atmel-samd/audio_dma.c index c6c636160..0fe71e6d5 100644 --- a/ports/atmel-samd/audio_dma.c +++ b/ports/atmel-samd/audio_dma.c @@ -38,7 +38,7 @@ #if CIRCUITPY_AUDIOIO || CIRCUITPY_AUDIOBUSIO -static audio_dma_t* audio_dma_state[AUDIO_DMA_CHANNEL_COUNT]; +static audio_dma_t *audio_dma_state[AUDIO_DMA_CHANNEL_COUNT]; // This cannot be in audio_dma_state because it's volatile. static volatile bool audio_dma_pending[AUDIO_DMA_CHANNEL_COUNT]; @@ -64,20 +64,22 @@ void audio_dma_free_channel(uint8_t channel) { } void audio_dma_disable_channel(uint8_t channel) { - if (channel >= AUDIO_DMA_CHANNEL_COUNT) + if (channel >= AUDIO_DMA_CHANNEL_COUNT) { return; + } dma_disable_channel(channel); } void audio_dma_enable_channel(uint8_t channel) { - if (channel >= AUDIO_DMA_CHANNEL_COUNT) + if (channel >= AUDIO_DMA_CHANNEL_COUNT) { return; + } dma_enable_channel(channel); } -void audio_dma_convert_signed(audio_dma_t* dma, uint8_t* buffer, uint32_t buffer_length, - uint8_t** output_buffer, uint32_t* output_buffer_length, - uint8_t* output_spacing) { +void audio_dma_convert_signed(audio_dma_t *dma, uint8_t *buffer, uint32_t buffer_length, + uint8_t **output_buffer, uint32_t *output_buffer_length, + uint8_t *output_spacing) { if (dma->first_buffer_free) { *output_buffer = dma->first_buffer; } else { @@ -92,18 +94,18 @@ void audio_dma_convert_signed(audio_dma_t* dma, uint8_t* buffer, uint32_t buffer if (dma->bytes_per_sample == 1) { for (uint32_t i = 0; i < buffer_length; i += dma->spacing) { if (dma->signed_to_unsigned) { - ((uint8_t*) *output_buffer)[out_i] = ((int8_t*) buffer)[i] + 0x80; + ((uint8_t *)*output_buffer)[out_i] = ((int8_t *)buffer)[i] + 0x80; } else { - ((int8_t*) *output_buffer)[out_i] = ((uint8_t*) buffer)[i] - 0x80; + ((int8_t *)*output_buffer)[out_i] = ((uint8_t *)buffer)[i] - 0x80; } out_i += 1; } } else if (dma->bytes_per_sample == 2) { for (uint32_t i = 0; i < buffer_length / 2; i += dma->spacing) { if (dma->signed_to_unsigned) { - ((uint16_t*) *output_buffer)[out_i] = ((int16_t*) buffer)[i] + 0x8000; + ((uint16_t *)*output_buffer)[out_i] = ((int16_t *)buffer)[i] + 0x8000; } else { - ((int16_t*) *output_buffer)[out_i] = ((uint16_t*) buffer)[i] - 0x8000; + ((int16_t *)*output_buffer)[out_i] = ((uint16_t *)buffer)[i] - 0x8000; } out_i += 1; } @@ -117,14 +119,14 @@ void audio_dma_convert_signed(audio_dma_t* dma, uint8_t* buffer, uint32_t buffer dma->first_buffer_free = !dma->first_buffer_free; } -void audio_dma_load_next_block(audio_dma_t* dma) { - uint8_t* buffer; +void audio_dma_load_next_block(audio_dma_t *dma) { + uint8_t *buffer; uint32_t buffer_length; audioio_get_buffer_result_t get_buffer_result = audiosample_get_buffer(dma->sample, dma->single_channel, dma->audio_channel, - &buffer, &buffer_length); + &buffer, &buffer_length); - DmacDescriptor* descriptor = dma->second_descriptor; + DmacDescriptor *descriptor = dma->second_descriptor; if (dma->first_descriptor_free) { descriptor = dma_descriptor(dma->dma_channel); } @@ -135,14 +137,14 @@ void audio_dma_load_next_block(audio_dma_t* dma) { return; } - uint8_t* output_buffer; + uint8_t *output_buffer; uint32_t output_buffer_length; uint8_t output_spacing; audio_dma_convert_signed(dma, buffer, buffer_length, &output_buffer, &output_buffer_length, &output_spacing); descriptor->BTCNT.reg = output_buffer_length / dma->beat_size / output_spacing; - descriptor->SRCADDR.reg = ((uint32_t) output_buffer) + output_buffer_length; + descriptor->SRCADDR.reg = ((uint32_t)output_buffer) + output_buffer_length; if (get_buffer_result == GET_BUFFER_DONE) { if (dma->loop) { audiosample_reset_buffer(dma->sample, dma->single_channel, dma->audio_channel); @@ -153,8 +155,8 @@ void audio_dma_load_next_block(audio_dma_t* dma) { descriptor->BTCTRL.bit.VALID = true; } -static void setup_audio_descriptor(DmacDescriptor* descriptor, uint8_t beat_size, - uint8_t spacing, uint32_t output_register_address) { +static void setup_audio_descriptor(DmacDescriptor *descriptor, uint8_t beat_size, + uint8_t spacing, uint32_t output_register_address) { uint32_t beat_size_reg = DMAC_BTCTRL_BEATSIZE_BYTE; if (beat_size == 2) { beat_size_reg = DMAC_BTCTRL_BEATSIZE_HWORD; @@ -162,22 +164,22 @@ static void setup_audio_descriptor(DmacDescriptor* descriptor, uint8_t beat_size beat_size_reg = DMAC_BTCTRL_BEATSIZE_WORD; } descriptor->BTCTRL.reg = beat_size_reg | - DMAC_BTCTRL_SRCINC | - DMAC_BTCTRL_EVOSEL_BLOCK | - DMAC_BTCTRL_STEPSIZE(spacing - 1) | - DMAC_BTCTRL_STEPSEL_SRC; + DMAC_BTCTRL_SRCINC | + DMAC_BTCTRL_EVOSEL_BLOCK | + DMAC_BTCTRL_STEPSIZE(spacing - 1) | + DMAC_BTCTRL_STEPSEL_SRC; descriptor->DSTADDR.reg = output_register_address; } // Playback should be shutdown before calling this. -audio_dma_result audio_dma_setup_playback(audio_dma_t* dma, - mp_obj_t sample, - bool loop, - bool single_channel, - uint8_t audio_channel, - bool output_signed, - uint32_t output_register_address, - uint8_t dma_trigger_source) { +audio_dma_result audio_dma_setup_playback(audio_dma_t *dma, + mp_obj_t sample, + bool loop, + bool single_channel, + uint8_t audio_channel, + bool output_signed, + uint32_t output_register_address, + uint8_t dma_trigger_source) { uint8_t dma_channel = audio_dma_allocate_channel(); if (dma_channel >= AUDIO_DMA_CHANNEL_COUNT) { return AUDIO_DMA_DMA_BUSY; @@ -199,18 +201,18 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t* dma, bool samples_signed; uint32_t max_buffer_length; audiosample_get_buffer_structure(sample, single_channel, &single_buffer, &samples_signed, - &max_buffer_length, &dma->spacing); + &max_buffer_length, &dma->spacing); uint8_t output_spacing = dma->spacing; if (output_signed != samples_signed) { output_spacing = 1; max_buffer_length /= dma->spacing; - dma->first_buffer = (uint8_t*) m_realloc(dma->first_buffer, max_buffer_length); + dma->first_buffer = (uint8_t *)m_realloc(dma->first_buffer, max_buffer_length); if (dma->first_buffer == NULL) { return AUDIO_DMA_MEMORY_ERROR; } dma->first_buffer_free = true; if (!single_buffer) { - dma->second_buffer = (uint8_t*) m_realloc(dma->second_buffer, max_buffer_length); + dma->second_buffer = (uint8_t *)m_realloc(dma->second_buffer, max_buffer_length); if (dma->second_buffer == NULL) { return AUDIO_DMA_MEMORY_ERROR; } @@ -221,7 +223,7 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t* dma, dma->event_channel = 0xff; if (!single_buffer) { - dma->second_descriptor = (DmacDescriptor*) m_malloc(sizeof(DmacDescriptor), false); + dma->second_descriptor = (DmacDescriptor *)m_malloc(sizeof(DmacDescriptor), false); if (dma->second_descriptor == NULL) { return AUDIO_DMA_MEMORY_ERROR; } @@ -257,26 +259,26 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t* dma, dma->beat_size *= 2; } -#ifdef SAM_D5X_E5X + #ifdef SAM_D5X_E5X int irq = dma->event_channel < 4 ? EVSYS_0_IRQn + dma->event_channel : EVSYS_4_IRQn; -#else + #else int irq = EVSYS_IRQn; -#endif + #endif NVIC_DisableIRQ(irq); NVIC_ClearPendingIRQ(irq); - DmacDescriptor* first_descriptor = dma_descriptor(dma_channel); + DmacDescriptor *first_descriptor = dma_descriptor(dma_channel); setup_audio_descriptor(first_descriptor, dma->beat_size, output_spacing, output_register_address); if (single_buffer) { first_descriptor->DESCADDR.reg = 0; if (dma->loop) { - first_descriptor->DESCADDR.reg = (uint32_t) first_descriptor; + first_descriptor->DESCADDR.reg = (uint32_t)first_descriptor; } } else { - first_descriptor->DESCADDR.reg = (uint32_t) dma->second_descriptor; + first_descriptor->DESCADDR.reg = (uint32_t)dma->second_descriptor; setup_audio_descriptor(dma->second_descriptor, dma->beat_size, output_spacing, output_register_address); - dma->second_descriptor->DESCADDR.reg = (uint32_t) first_descriptor; + dma->second_descriptor->DESCADDR.reg = (uint32_t)first_descriptor; } // Load the first two blocks up front. @@ -293,7 +295,7 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t* dma, return AUDIO_DMA_OK; } -void audio_dma_stop(audio_dma_t* dma) { +void audio_dma_stop(audio_dma_t *dma) { uint8_t channel = dma->dma_channel; if (channel < AUDIO_DMA_CHANNEL_COUNT) { audio_dma_disable_channel(channel); @@ -305,15 +307,15 @@ void audio_dma_stop(audio_dma_t* dma) { dma->dma_channel = AUDIO_DMA_CHANNEL_COUNT; } -void audio_dma_pause(audio_dma_t* dma) { +void audio_dma_pause(audio_dma_t *dma) { dma_suspend_channel(dma->dma_channel); } -void audio_dma_resume(audio_dma_t* dma) { +void audio_dma_resume(audio_dma_t *dma) { dma_resume_channel(dma->dma_channel); } -bool audio_dma_get_paused(audio_dma_t* dma) { +bool audio_dma_get_paused(audio_dma_t *dma) { if (dma->dma_channel >= AUDIO_DMA_CHANNEL_COUNT) { return false; } @@ -322,7 +324,7 @@ bool audio_dma_get_paused(audio_dma_t* dma) { return (status & DMAC_CHINTFLAG_SUSP) != 0; } -void audio_dma_init(audio_dma_t* dma) { +void audio_dma_init(audio_dma_t *dma) { dma->dma_channel = AUDIO_DMA_CHANNEL_COUNT; } @@ -337,7 +339,7 @@ void audio_dma_reset(void) { } } -bool audio_dma_get_playing(audio_dma_t* dma) { +bool audio_dma_get_playing(audio_dma_t *dma) { if (dma->dma_channel >= AUDIO_DMA_CHANNEL_COUNT) { return false; } @@ -352,7 +354,7 @@ bool audio_dma_get_playing(audio_dma_t* dma) { // WARN(tannewt): DO NOT print from here, or anything it calls. Printing calls // background tasks such as this and causes a stack overflow. STATIC void dma_callback_fun(void *arg) { - audio_dma_t* dma = arg; + audio_dma_t *dma = arg; if (dma == NULL) { return; } @@ -362,7 +364,7 @@ STATIC void dma_callback_fun(void *arg) { void evsyshandler_common(void) { for (uint8_t i = 0; i < AUDIO_DMA_CHANNEL_COUNT; i++) { - audio_dma_t* dma = audio_dma_state[i]; + audio_dma_t *dma = audio_dma_state[i]; if (dma == NULL) { continue; } @@ -370,18 +372,30 @@ void evsyshandler_common(void) { if (!block_done) { continue; } - background_callback_add(&dma->callback, dma_callback_fun, (void*)dma); + background_callback_add(&dma->callback, dma_callback_fun, (void *)dma); } } #ifdef SAM_D5X_E5X -void EVSYS_0_Handler(void) { evsyshandler_common(); } -void EVSYS_1_Handler(void) { evsyshandler_common(); } -void EVSYS_2_Handler(void) { evsyshandler_common(); } -void EVSYS_3_Handler(void) { evsyshandler_common(); } -void EVSYS_4_Handler(void) { evsyshandler_common(); } +void EVSYS_0_Handler(void) { + evsyshandler_common(); +} +void EVSYS_1_Handler(void) { + evsyshandler_common(); +} +void EVSYS_2_Handler(void) { + evsyshandler_common(); +} +void EVSYS_3_Handler(void) { + evsyshandler_common(); +} +void EVSYS_4_Handler(void) { + evsyshandler_common(); +} #else -void EVSYS_Handler(void) { evsyshandler_common(); } +void EVSYS_Handler(void) { + evsyshandler_common(); +} #endif #endif diff --git a/ports/atmel-samd/audio_dma.h b/ports/atmel-samd/audio_dma.h index 4fffd06b8..5506cff62 100644 --- a/ports/atmel-samd/audio_dma.h +++ b/ports/atmel-samd/audio_dma.h @@ -46,10 +46,10 @@ typedef struct { bool signed_to_unsigned; bool unsigned_to_signed; bool first_buffer_free; - uint8_t* first_buffer; - uint8_t* second_buffer; + uint8_t *first_buffer; + uint8_t *second_buffer; bool first_descriptor_free; - DmacDescriptor* second_descriptor; + DmacDescriptor *second_descriptor; background_callback_t callback; } audio_dma_t; @@ -63,7 +63,7 @@ uint32_t audiosample_sample_rate(mp_obj_t sample_obj); uint8_t audiosample_bits_per_sample(mp_obj_t sample_obj); uint8_t audiosample_channel_count(mp_obj_t sample_obj); -void audio_dma_init(audio_dma_t* dma); +void audio_dma_init(audio_dma_t *dma); void audio_dma_reset(void); uint8_t audio_dma_allocate_channel(void); @@ -78,22 +78,22 @@ void audio_dma_free_channel(uint8_t channel); // output_signed is true if the dma'd data should be signed. False and it will be unsigned. // output_register_address is the address to copy data to. // dma_trigger_source is the DMA trigger source which cause another copy -audio_dma_result audio_dma_setup_playback(audio_dma_t* dma, - mp_obj_t sample, - bool loop, - bool single_channel, - uint8_t audio_channel, - bool output_signed, - uint32_t output_register_address, - uint8_t dma_trigger_source); +audio_dma_result audio_dma_setup_playback(audio_dma_t *dma, + mp_obj_t sample, + bool loop, + bool single_channel, + uint8_t audio_channel, + bool output_signed, + uint32_t output_register_address, + uint8_t dma_trigger_source); void audio_dma_disable_channel(uint8_t channel); void audio_dma_enable_channel(uint8_t channel); -void audio_dma_stop(audio_dma_t* dma); -bool audio_dma_get_playing(audio_dma_t* dma); -void audio_dma_pause(audio_dma_t* dma); -void audio_dma_resume(audio_dma_t* dma); -bool audio_dma_get_paused(audio_dma_t* dma); +void audio_dma_stop(audio_dma_t *dma); +bool audio_dma_get_playing(audio_dma_t *dma); +void audio_dma_pause(audio_dma_t *dma); +void audio_dma_resume(audio_dma_t *dma); +bool audio_dma_get_paused(audio_dma_t *dma); void audio_dma_background(void); diff --git a/ports/atmel-samd/background.c b/ports/atmel-samd/background.c index 62c233a3f..237395b6b 100644 --- a/ports/atmel-samd/background.c +++ b/ports/atmel-samd/background.c @@ -44,16 +44,19 @@ // so you can't use this code AND an i2c peripheral // at the same time unless you change this void port_start_background_task(void) { - REG_PORT_DIRSET1 = (1<<3); - REG_PORT_OUTSET1 = (1<<3); + REG_PORT_DIRSET1 = (1 << 3); + REG_PORT_OUTSET1 = (1 << 3); } void port_finish_background_task(void) { - REG_PORT_OUTCLR1 = (1<<3); + REG_PORT_OUTCLR1 = (1 << 3); } #else -void port_start_background_task(void) {} -void port_finish_background_task(void) {} +void port_start_background_task(void) { +} +void port_finish_background_task(void) { +} #endif -void port_background_task(void) {} +void port_background_task(void) { +} diff --git a/ports/atmel-samd/bindings/samd/Clock.c b/ports/atmel-samd/bindings/samd/Clock.c index 478a10fcd..9375a7a84 100644 --- a/ports/atmel-samd/bindings/samd/Clock.c +++ b/ports/atmel-samd/bindings/samd/Clock.c @@ -57,8 +57,7 @@ const mp_obj_property_t samd_clock_enabled_obj = { .base.type = &mp_type_property, .proxy = {(mp_obj_t)&samd_clock_get_enabled_obj, (mp_obj_t)&mp_const_none_obj, - (mp_obj_t)&mp_const_none_obj, - }, + (mp_obj_t)&mp_const_none_obj,}, }; //| parent: Union[Clock, None] @@ -67,14 +66,16 @@ const mp_obj_property_t samd_clock_enabled_obj = { STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) { samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); uint8_t p_type, p_index; - if (!clock_get_parent(self->type, self->index, &p_type, &p_index)) + if (!clock_get_parent(self->type, self->index, &p_type, &p_index)) { return mp_const_none; + } - const mp_map_t* samd_map = &samd_clock_globals.map; + const mp_map_t *samd_map = &samd_clock_globals.map; for (uint8_t i = 0; i < samd_map->alloc; i++) { samd_clock_obj_t *iter = samd_map->table[i].value; - if (iter->type == p_type && iter->index == p_index) + if (iter->type == p_type && iter->index == p_index) { return iter; + } } return mp_const_none; } @@ -85,8 +86,7 @@ const mp_obj_property_t samd_clock_parent_obj = { .base.type = &mp_type_property, .proxy = {(mp_obj_t)&samd_clock_get_parent_obj, (mp_obj_t)&mp_const_none_obj, - (mp_obj_t)&mp_const_none_obj, - }, + (mp_obj_t)&mp_const_none_obj,}, }; //| frequency: int @@ -103,8 +103,7 @@ const mp_obj_property_t samd_clock_frequency_obj = { .base.type = &mp_type_property, .proxy = {(mp_obj_t)&samd_clock_get_frequency_obj, (mp_obj_t)&mp_const_none_obj, - (mp_obj_t)&mp_const_none_obj, - }, + (mp_obj_t)&mp_const_none_obj,}, }; //| calibration: int @@ -120,10 +119,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(samd_clock_get_calibration_obj, samd_clock_get_calibra STATIC mp_obj_t samd_clock_set_calibration(mp_obj_t self_in, mp_obj_t calibration) { samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); int ret = clock_set_calibration(self->type, self->index, mp_obj_get_int(calibration)); - if (ret == -2) + if (ret == -2) { mp_raise_AttributeError(translate("calibration is read only")); - if (ret == -1) + } + if (ret == -1) { mp_raise_ValueError(translate("calibration is out of range")); + } return mp_const_none; } @@ -133,8 +134,7 @@ const mp_obj_property_t samd_clock_calibration_obj = { .base.type = &mp_type_property, .proxy = {(mp_obj_t)&samd_clock_get_calibration_obj, (mp_obj_t)&samd_clock_set_calibration_obj, - (mp_obj_t)&mp_const_none_obj, - }, + (mp_obj_t)&mp_const_none_obj,}, }; STATIC const mp_rom_map_elem_t samd_clock_locals_dict_table[] = { @@ -212,15 +212,15 @@ CLOCK(SYSTICK, 2, 0); #endif STATIC const mp_rom_map_elem_t samd_clock_global_dict_table[] = { -#ifdef SAMD21_EXPOSE_ALL_CLOCKS + #ifdef SAMD21_EXPOSE_ALL_CLOCKS CLOCK_ENTRY(XOSC), CLOCK_ENTRY(GCLKIN), CLOCK_ENTRY(GCLKGEN1), CLOCK_ENTRY(OSCULP32K), -#endif + #endif CLOCK_ENTRY(OSC32K), CLOCK_ENTRY(XOSC32K), -#ifdef SAMD21_EXPOSE_ALL_CLOCKS + #ifdef SAMD21_EXPOSE_ALL_CLOCKS CLOCK_ENTRY(OSC8M), CLOCK_ENTRY(DFLL48M), CLOCK_ENTRY(DPLL96M), @@ -228,9 +228,9 @@ STATIC const mp_rom_map_elem_t samd_clock_global_dict_table[] = { CLOCK_ENTRY_(SYSCTRL, FDPLL), CLOCK_ENTRY_(SYSCTRL, FDPLL32K), CLOCK_ENTRY(WDT), -#endif + #endif CLOCK_ENTRY(RTC), -#ifdef SAMD21_EXPOSE_ALL_CLOCKS + #ifdef SAMD21_EXPOSE_ALL_CLOCKS CLOCK_ENTRY(EIC), CLOCK_ENTRY(USB), CLOCK_ENTRY_(EVSYS, 0), @@ -265,7 +265,7 @@ STATIC const mp_rom_map_elem_t samd_clock_global_dict_table[] = { CLOCK_ENTRY_(I2S, 1), CLOCK_ENTRY(SYSTICK), -#endif + #endif }; MP_DEFINE_CONST_DICT(samd_clock_globals, samd_clock_global_dict_table); diff --git a/ports/atmel-samd/bindings/samd/Clock.h b/ports/atmel-samd/bindings/samd/Clock.h index ccc8f10d1..a4c11556b 100644 --- a/ports/atmel-samd/bindings/samd/Clock.h +++ b/ports/atmel-samd/bindings/samd/Clock.h @@ -37,39 +37,39 @@ typedef struct { } samd_clock_obj_t; #define CLOCK(_name, _type, _index) \ -const samd_clock_obj_t clock_ ## _name = { \ - { &samd_clock_type }, \ - .name = MP_QSTR_ ## _name, \ - .type = _type, \ - .index = _index, \ -} + const samd_clock_obj_t clock_##_name = { \ + { &samd_clock_type }, \ + .name = MP_QSTR_##_name, \ + .type = _type, \ + .index = _index, \ + } #define CLOCK_SOURCE(_name) \ -const samd_clock_obj_t clock_ ## _name = { \ - { &samd_clock_type }, \ - .name = MP_QSTR_ ## _name, \ - .type = 0, \ - .index = GCLK_SOURCE_ ## _name, \ -} + const samd_clock_obj_t clock_##_name = { \ + { &samd_clock_type }, \ + .name = MP_QSTR_##_name, \ + .type = 0, \ + .index = GCLK_SOURCE_##_name, \ + } #define CLOCK_GCLK(_name) \ -const samd_clock_obj_t clock_ ## _name = { \ - { &samd_clock_type }, \ - .name = MP_QSTR_ ## _name, \ - .type = 1, \ - .index = _name ## _GCLK_ID, \ -} + const samd_clock_obj_t clock_##_name = { \ + { &samd_clock_type }, \ + .name = MP_QSTR_##_name, \ + .type = 1, \ + .index = _name##_GCLK_ID, \ + } #define CLOCK_GCLK_(_name, _extra) \ -const samd_clock_obj_t clock_ ## _name ## _ ## _extra = { \ - { &samd_clock_type }, \ - .name = MP_QSTR_ ## _name ## _ ## _extra, \ - .type = 1, \ - .index = _name ## _GCLK_ID_ ## _extra, \ -} + const samd_clock_obj_t clock_##_name##_##_extra = { \ + { &samd_clock_type }, \ + .name = MP_QSTR_##_name##_##_extra, \ + .type = 1, \ + .index = _name##_GCLK_ID_##_extra, \ + } -#define CLOCK_ENTRY(_name) { MP_ROM_QSTR(MP_QSTR_ ## _name), MP_ROM_PTR(&clock_ ## _name) } -#define CLOCK_ENTRY_(_name, _extra) { MP_ROM_QSTR(MP_QSTR_ ## _name ## _ ## _extra), MP_ROM_PTR(&clock_ ## _name ## _ ## _extra) } +#define CLOCK_ENTRY(_name) { MP_ROM_QSTR(MP_QSTR_##_name), MP_ROM_PTR(&clock_##_name) } +#define CLOCK_ENTRY_(_name, _extra) { MP_ROM_QSTR(MP_QSTR_##_name##_##_extra), MP_ROM_PTR(&clock_##_name##_##_extra) } extern const mp_obj_type_t samd_clock_type; extern const mp_obj_dict_t samd_clock_globals; diff --git a/ports/atmel-samd/bindings/samd/__init__.c b/ports/atmel-samd/bindings/samd/__init__.c index 6e9b68ccc..207a6d52e 100644 --- a/ports/atmel-samd/bindings/samd/__init__.c +++ b/ports/atmel-samd/bindings/samd/__init__.c @@ -43,7 +43,7 @@ //| const mp_obj_module_t samd_clock_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&samd_clock_globals, + .globals = (mp_obj_dict_t *)&samd_clock_globals, }; STATIC const mp_rom_map_elem_t samd_module_globals_table[] = { @@ -55,5 +55,5 @@ STATIC MP_DEFINE_CONST_DICT(samd_module_globals, samd_module_globals_table); const mp_obj_module_t samd_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&samd_module_globals, + .globals = (mp_obj_dict_t *)&samd_module_globals, }; diff --git a/ports/atmel-samd/boards/8086_commander/mpconfigboard.h b/ports/atmel-samd/boards/8086_commander/mpconfigboard.h index 9e3be4e6a..0b5d3a267 100644 --- a/ports/atmel-samd/boards/8086_commander/mpconfigboard.h +++ b/ports/atmel-samd/boards/8086_commander/mpconfigboard.h @@ -6,9 +6,9 @@ #define MICROPY_HW_LED_STATUS (&pin_PA06) -#define MICROPY_PORT_A (0) -#define MICROPY_PORT_B (0) -#define MICROPY_PORT_C (0) +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c index 5973eeec1..c67701512 100644 --- a/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c @@ -32,21 +32,20 @@ #include "mpconfigboard.h" void board_init(void) { - REG_PORT_DIRSET1 = PORT_PB20; // PB20 as output - REG_PORT_OUTCLR1 = PORT_PB20; // PB20 cleared - PORT->Group[1].PINCFG[20].reg |= PORT_PINCFG_PMUXEN; // Mux enabled on PB20 - PORT->Group[1].PMUX[10].reg = 0x0C; // PB20 as mux function "M" - // Gclk[6] is on PB20 - GCLK->GENCTRL[6].reg = GCLK_GENCTRL_SRC(GCLK_GENCTRL_SRC_DPLL0) | - GCLK_GENCTRL_IDC | - GCLK_GENCTRL_DIV(10) | - //GCLK_GENCTRL_DIVSEL | - GCLK_GENCTRL_OE | - GCLK_GENCTRL_GENEN; - while ( GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_GENCTRL6) - { - // Wait for synchronization - } + REG_PORT_DIRSET1 = PORT_PB20; // PB20 as output + REG_PORT_OUTCLR1 = PORT_PB20; // PB20 cleared + PORT->Group[1].PINCFG[20].reg |= PORT_PINCFG_PMUXEN; // Mux enabled on PB20 + PORT->Group[1].PMUX[10].reg = 0x0C; // PB20 as mux function "M" + // Gclk[6] is on PB20 + GCLK->GENCTRL[6].reg = GCLK_GENCTRL_SRC(GCLK_GENCTRL_SRC_DPLL0) | + GCLK_GENCTRL_IDC | + GCLK_GENCTRL_DIV(10) | + // GCLK_GENCTRL_DIVSEL | + GCLK_GENCTRL_OE | + GCLK_GENCTRL_GENEN; + while (GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_GENCTRL6) { + // Wait for synchronization + } } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h index cafc82605..3882c2b6d 100644 --- a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.h @@ -17,21 +17,21 @@ #define MICROPY_PORT_D (0) // BC needed? -//#define AUTORESET_DELAY_MS 500 +// #define AUTORESET_DELAY_MS 500 // If you change this, then make sure to update the linker scripts as well to // make sure you don't overwrite code -//#define CIRCUITPY_INTERNAL_NVM_SIZE 8192 +// #define CIRCUITPY_INTERNAL_NVM_SIZE 8192 -//#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) +// #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) // End BC #define EXTERNAL_FLASH_QSPI_DUAL #define BOARD_HAS_CRYSTAL 1 -//#define DEFAULT_I2C_BUS_SCL (&pin_PA13) -//#define DEFAULT_I2C_BUS_SDA (&pin_PA12) +// #define DEFAULT_I2C_BUS_SCL (&pin_PA13) +// #define DEFAULT_I2C_BUS_SDA (&pin_PA12) #define DEFAULT_I2C_BUS_SCL (&pin_PA13) #define DEFAULT_I2C_BUS_SDA (&pin_PA12) diff --git a/ports/atmel-samd/boards/arduino_mkr1300/board.c b/ports/atmel-samd/boards/arduino_mkr1300/board.c index 112b173ec..7af05ba45 100644 --- a/ports/atmel-samd/boards/arduino_mkr1300/board.c +++ b/ports/atmel-samd/boards/arduino_mkr1300/board.c @@ -28,8 +28,7 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/board.c b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c index 112b173ec..7af05ba45 100644 --- a/ports/atmel-samd/boards/arduino_nano_33_iot/board.c +++ b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c @@ -28,8 +28,7 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/arduino_zero/board.c b/ports/atmel-samd/boards/arduino_zero/board.c index 112b173ec..7af05ba45 100644 --- a/ports/atmel-samd/boards/arduino_zero/board.c +++ b/ports/atmel-samd/boards/arduino_zero/board.c @@ -28,8 +28,7 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/board.c b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/bast_pro_mini_m0/board.c +++ b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/bdmicro_vina_d21/board.c b/ports/atmel-samd/boards/bdmicro_vina_d21/board.c index bb1c5335c..bb6ad8bc0 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d21/board.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d21/board.c @@ -27,8 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" -void board_init(void) -{ +void board_init(void) { // struct port_config pin_conf; // port_get_config_defaults(&pin_conf); // diff --git a/ports/atmel-samd/boards/bdmicro_vina_d51/board.c b/ports/atmel-samd/boards/bdmicro_vina_d51/board.c index bb1c5335c..bb6ad8bc0 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d51/board.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d51/board.c @@ -27,8 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" -void board_init(void) -{ +void board_init(void) { // struct port_config pin_conf; // port_get_config_defaults(&pin_conf); // diff --git a/ports/atmel-samd/boards/catwan_usbstick/board.c b/ports/atmel-samd/boards/catwan_usbstick/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/catwan_usbstick/board.c +++ b/ports/atmel-samd/boards/catwan_usbstick/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c b/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c index 5acad5e98..5acad5e98 100755..100644 --- a/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c +++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c diff --git a/ports/atmel-samd/boards/circuitplayground_express/board.c b/ports/atmel-samd/boards/circuitplayground_express/board.c index f771c214b..39e39b0d4 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express/board.c @@ -31,8 +31,7 @@ #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" -void board_init(void) -{ +void board_init(void) { } // Check the status of the two buttons on CircuitPlayground Express. If both are diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h index e46e477e4..a32133e35 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h @@ -28,7 +28,7 @@ #define BOARD_USER_SAFE_MODE_ACTION translate("pressing both buttons at start up.\n") // Increase stack size slightly due to CPX library import nesting -#define CIRCUITPY_DEFAULT_STACK_SIZE (4248) //divisible by 8 +#define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8 #define DEFAULT_I2C_BUS_SCL (&pin_PB03) #define DEFAULT_I2C_BUS_SDA (&pin_PB02) diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c index 13fed598e..4666482e9 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c @@ -31,8 +31,7 @@ #include "hal/include/hal_gpio.h" #include "supervisor/shared/board.h" -void board_init(void) -{ +void board_init(void) { } // Check the status of the two buttons on CircuitPlayground Express. If both are diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c b/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c index 13fed598e..4666482e9 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c @@ -31,8 +31,7 @@ #include "hal/include/hal_gpio.h" #include "supervisor/shared/board.h" -void board_init(void) -{ +void board_init(void) { } // Check the status of the two buttons on CircuitPlayground Express. If both are diff --git a/ports/atmel-samd/boards/cp32-m4/mpconfigboard.h b/ports/atmel-samd/boards/cp32-m4/mpconfigboard.h index 8664a6a0e..bdc44c79b 100644 --- a/ports/atmel-samd/boards/cp32-m4/mpconfigboard.h +++ b/ports/atmel-samd/boards/cp32-m4/mpconfigboard.h @@ -7,8 +7,8 @@ #define CIRCUITPY_MCU_FAMILY samd51 -#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11| PORT_PA12| PORT_PA13) -#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11) +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 | PORT_PA12 | PORT_PA13) +#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) diff --git a/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h index c67f022eb..b04a31c46 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h +++ b/ports/atmel-samd/boards/cp_sapling_m0/mpconfigboard.h @@ -7,15 +7,15 @@ #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) -#define IGNORE_PIN_PA02 1 -#define IGNORE_PIN_PA03 1 -#define IGNORE_PIN_PA04 1 -#define IGNORE_PIN_PA05 1 -#define IGNORE_PIN_PA06 1 -#define IGNORE_PIN_PA07 1 +#define IGNORE_PIN_PA02 1 +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA05 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA07 1 #define IGNORE_PIN_PA12 1 #define IGNORE_PIN_PA13 1 -#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA14 1 #define IGNORE_PIN_PA20 1 #define IGNORE_PIN_PA21 1 // USB is always used internally so skip the pin objects for it. diff --git a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h index 9c69c4802..528d989ed 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/mpconfigboard.h @@ -12,15 +12,15 @@ #define SPI_FLASH_SCK_PIN &pin_PA19 #define SPI_FLASH_CS_PIN &pin_PA22 -#define IGNORE_PIN_PA02 1 -#define IGNORE_PIN_PA03 1 -#define IGNORE_PIN_PA04 1 -#define IGNORE_PIN_PA05 1 -#define IGNORE_PIN_PA06 1 -#define IGNORE_PIN_PA07 1 +#define IGNORE_PIN_PA02 1 +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA05 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA07 1 #define IGNORE_PIN_PA12 1 #define IGNORE_PIN_PA13 1 -#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA14 1 #define IGNORE_PIN_PA20 1 #define IGNORE_PIN_PA21 1 // USB is always used internally so skip the pin objects for it. diff --git a/ports/atmel-samd/boards/datum_distance/board.c b/ports/atmel-samd/boards/datum_distance/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/datum_distance/board.c +++ b/ports/atmel-samd/boards/datum_distance/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/datum_imu/board.c b/ports/atmel-samd/boards/datum_imu/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/datum_imu/board.c +++ b/ports/atmel-samd/boards/datum_imu/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/datum_light/board.c b/ports/atmel-samd/boards/datum_light/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/datum_light/board.c +++ b/ports/atmel-samd/boards/datum_light/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/datum_weather/board.c b/ports/atmel-samd/boards/datum_weather/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/datum_weather/board.c +++ b/ports/atmel-samd/boards/datum_weather/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/board.c b/ports/atmel-samd/boards/dynossat_edu_eps/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/board.c +++ b/ports/atmel-samd/boards/dynossat_edu_eps/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.h b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.h index ef4fa8f99..02707a69d 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.h +++ b/ports/atmel-samd/boards/dynossat_edu_eps/mpconfigboard.h @@ -9,9 +9,9 @@ #define SPI_FLASH_CS_PIN &pin_PA20 // These are pins not to reset. -#define MICROPY_PORT_A ( 0 ) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define BOARD_HAS_CRYSTAL 1 @@ -28,7 +28,7 @@ // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 -#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA03 1 #define IGNORE_PIN_PA13 1 #define IGNORE_PIN_PA14 1 #define IGNORE_PIN_PA15 1 diff --git a/ports/atmel-samd/boards/dynossat_edu_obc/board.c b/ports/atmel-samd/boards/dynossat_edu_obc/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/dynossat_edu_obc/board.c +++ b/ports/atmel-samd/boards/dynossat_edu_obc/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/dynossat_edu_obc/mpconfigboard.h b/ports/atmel-samd/boards/dynossat_edu_obc/mpconfigboard.h index d7df8db74..102a8cfb6 100644 --- a/ports/atmel-samd/boards/dynossat_edu_obc/mpconfigboard.h +++ b/ports/atmel-samd/boards/dynossat_edu_obc/mpconfigboard.h @@ -9,10 +9,10 @@ #define SPI_FLASH_CS_PIN &pin_PA19 // These are pins not to reset. -#define MICROPY_PORT_A ( PORT_PA16 | PORT_PA17 | PORT_PA18 | PORT_PA19 ) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) -#define MICROPY_PORT_D ( 0 ) +#define MICROPY_PORT_A (PORT_PA16 | PORT_PA17 | PORT_PA18 | PORT_PA19) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) +#define MICROPY_PORT_D (0) #define BOARD_HAS_CRYSTAL 1 diff --git a/ports/atmel-samd/boards/escornabot_makech/board.c b/ports/atmel-samd/boards/escornabot_makech/board.c index 5afe2fb65..76849c53e 100644 --- a/ports/atmel-samd/boards/escornabot_makech/board.c +++ b/ports/atmel-samd/boards/escornabot_makech/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/escornabot_makech/pins.c b/ports/atmel-samd/boards/escornabot_makech/pins.c index fefee1919..86a70cb04 100644 --- a/ports/atmel-samd/boards/escornabot_makech/pins.c +++ b/ports/atmel-samd/boards/escornabot_makech/pins.c @@ -1,7 +1,7 @@ #include "shared-bindings/board/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - //LEDs + // LEDs { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA04) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA05) }, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA09) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA13) }, - //UART + // UART { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA01) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA00) }, diff --git a/ports/atmel-samd/boards/feather_m0_adalogger/board.c b/ports/atmel-samd/boards/feather_m0_adalogger/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/feather_m0_adalogger/board.c +++ b/ports/atmel-samd/boards/feather_m0_adalogger/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/feather_m0_basic/board.c b/ports/atmel-samd/boards/feather_m0_basic/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/feather_m0_basic/board.c +++ b/ports/atmel-samd/boards/feather_m0_basic/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/feather_m0_express/board.c b/ports/atmel-samd/boards/feather_m0_express/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/feather_m0_express/board.c +++ b/ports/atmel-samd/boards/feather_m0_express/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.h b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.h index 5421dc889..27ea6c72b 100644 --- a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.h @@ -12,8 +12,8 @@ // These are pins not to reset. #define MICROPY_PORT_A (PORT_PA06) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define BOARD_HAS_CRYSTAL 1 diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/board.c b/ports/atmel-samd/boards/feather_m0_express_crickit/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/board.c +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h index ee61e1d87..112dd80fa 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.h @@ -12,8 +12,8 @@ // These are pins not to reset. #define MICROPY_PORT_A (PORT_PA06) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define BOARD_HAS_CRYSTAL 1 diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/board.c b/ports/atmel-samd/boards/feather_m0_rfm69/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/board.c +++ b/ports/atmel-samd/boards/feather_m0_rfm69/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/board.c b/ports/atmel-samd/boards/feather_m0_rfm9x/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/board.c +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/feather_m0_supersized/board.c b/ports/atmel-samd/boards/feather_m0_supersized/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/board.c +++ b/ports/atmel-samd/boards/feather_m0_supersized/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.h b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.h index 2d9f88e2e..9fa2ba9ce 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.h +++ b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.h @@ -14,8 +14,8 @@ // These are pins not to reset. #define MICROPY_PORT_A (PORT_PA06) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define DEFAULT_I2C_BUS_SCL (&pin_PA23) #define DEFAULT_I2C_BUS_SDA (&pin_PA22) diff --git a/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c b/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c index 6baa43ffa..84960e73c 100755..100644 --- a/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c +++ b/ports/atmel-samd/boards/feather_radiofruit_zigbee/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.h b/ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.h index 2afe35817..b1839f2c9 100755..100644 --- a/ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.h +++ b/ports/atmel-samd/boards/feather_radiofruit_zigbee/mpconfigboard.h @@ -11,8 +11,8 @@ // These are pins not to reset. #define MICROPY_PORT_A (PORT_PA22) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define BOARD_HAS_CRYSTAL 1 diff --git a/ports/atmel-samd/boards/fluff_m0/board.c b/ports/atmel-samd/boards/fluff_m0/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/fluff_m0/board.c +++ b/ports/atmel-samd/boards/fluff_m0/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/gemma_m0/board.c b/ports/atmel-samd/boards/gemma_m0/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/gemma_m0/board.c +++ b/ports/atmel-samd/boards/gemma_m0/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.h b/ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.h index bab055014..f2f3d7cc4 100644 --- a/ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.h @@ -14,11 +14,11 @@ // These are pins not to reset. // QSPI Data pins -#define MICROPY_PORT_A ( PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 ) +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) // QSPI CS, and QSPI SCK -#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 ) +#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) // NeoPixel pin, RX LED, TX LED -#define MICROPY_PORT_C ( PORT_PC24 | PORT_PC30 | PORT_PC31 ) +#define MICROPY_PORT_C (PORT_PC24 | PORT_PC30 | PORT_PC31) #define MICROPY_PORT_D (0) #define BOARD_HAS_CRYSTAL 1 diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c index 8b922d6be..a9c11f1ba 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c @@ -55,13 +55,13 @@ uint8_t display_init_sequence[] = { // fix on VTL 0x3a, 1, 0x05, // COLMOD - 16bit color 0xe0, 16, 0x02, 0x1c, 0x07, 0x12, // _GMCTRP1 Gamma - 0x37, 0x32, 0x29, 0x2d, - 0x29, 0x25, 0x2B, 0x39, - 0x00, 0x01, 0x03, 0x10, + 0x37, 0x32, 0x29, 0x2d, + 0x29, 0x25, 0x2B, 0x39, + 0x00, 0x01, 0x03, 0x10, 0xe1, 16, 0x03, 0x1d, 0x07, 0x06, // _GMCTRN1 - 0x2E, 0x2C, 0x29, 0x2D, - 0x2E, 0x2E, 0x37, 0x3F, - 0x00, 0x00, 0x02, 0x10, + 0x2E, 0x2C, 0x29, 0x2D, + 0x2E, 0x2E, 0x37, 0x3F, + 0x00, 0x00, 0x02, 0x10, 0x2a, 3, 0x02, 0x00, 0x81, // _CASET XSTART = 2, XEND = 129 0x2b, 3, 0x02, 0x00, 0x81, // _RASET XSTART = 2, XEND = 129 0x13, 0 | DELAY, 10, // _NORON @@ -69,7 +69,7 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; busio_spi_obj_t *spi = common_hal_board_create_spi(); common_hal_displayio_fourwire_construct(bus, @@ -81,7 +81,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.h b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.h index e5ac346da..28ce10811 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.h @@ -11,10 +11,10 @@ // These are pins not to reset. // NeoPixel and for the display: Reset, Command or data, and Chip select -#define MICROPY_PORT_A ( PORT_PA01 | PORT_PA12 | PORT_PA27 | PORT_PA28) +#define MICROPY_PORT_A (PORT_PA01 | PORT_PA12 | PORT_PA27 | PORT_PA28) // Data and Clock for the display -#define MICROPY_PORT_B ( PORT_PB22 | PORT_PB23 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_B (PORT_PB22 | PORT_PB23) +#define MICROPY_PORT_C (0) #define DEFAULT_I2C_BUS_SCL (&pin_PA17) #define DEFAULT_I2C_BUS_SDA (&pin_PA16) diff --git a/ports/atmel-samd/boards/hallowing_m4_express/board.c b/ports/atmel-samd/boards/hallowing_m4_express/board.c index f51d4282d..f9cdbdbaf 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m4_express/board.c @@ -47,11 +47,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_PA01, &pin_PA00, NULL); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -62,7 +62,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.h b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.h index 4d911ad64..0ac595edf 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.h +++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.h @@ -8,7 +8,7 @@ #define MICROPY_PORT_A (PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) -#define MICROPY_PORT_D (0) +#define MICROPY_PORT_D (0) #define CIRCUITPY_INTERNAL_NVM_SIZE 0 diff --git a/ports/atmel-samd/boards/kicksat-sprite/pins.c b/ports/atmel-samd/boards/kicksat-sprite/pins.c index 27ee90323..711406189 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/pins.c +++ b/ports/atmel-samd/boards/kicksat-sprite/pins.c @@ -8,20 +8,20 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_radioCS), MP_ROM_PTR(&pin_PA00) }, { MP_ROM_QSTR(MP_QSTR_WAKE), MP_ROM_PTR(&pin_PA01) }, - { MP_ROM_QSTR(MP_QSTR_SHDWN), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_SHDWN), MP_ROM_PTR(&pin_PB10) }, { MP_ROM_QSTR(MP_QSTR_PWDWN), MP_ROM_PTR(&pin_PB11) }, { MP_ROM_QSTR(MP_QSTR_TST), MP_ROM_PTR(&pin_PA11) }, { MP_ROM_QSTR(MP_QSTR_FSYNC), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_VCLK), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_VCLK), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_FSYNC), MP_ROM_PTR(&pin_PA15) }, - { MP_ROM_QSTR(MP_QSTR_MD), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_MC), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_MD), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_MC), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB09) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB08) }, diff --git a/ports/atmel-samd/boards/meowmeow/board.c b/ports/atmel-samd/boards/meowmeow/board.c index 5afe2fb65..76849c53e 100644 --- a/ports/atmel-samd/boards/meowmeow/board.c +++ b/ports/atmel-samd/boards/meowmeow/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/metro_m0_express/board.c b/ports/atmel-samd/boards/metro_m0_express/board.c index bb1c5335c..bb6ad8bc0 100644 --- a/ports/atmel-samd/boards/metro_m0_express/board.c +++ b/ports/atmel-samd/boards/metro_m0_express/board.c @@ -27,8 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" -void board_init(void) -{ +void board_init(void) { // struct port_config pin_conf; // port_get_config_defaults(&pin_conf); // diff --git a/ports/atmel-samd/boards/monster_m4sk/board.c b/ports/atmel-samd/boards/monster_m4sk/board.c index 2b757d091..8ef0c6ff9 100644 --- a/ports/atmel-samd/boards/monster_m4sk/board.c +++ b/ports/atmel-samd/boards/monster_m4sk/board.c @@ -48,11 +48,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA12, NULL); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -63,7 +63,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/nfc_copy_cat/board.c b/ports/atmel-samd/boards/nfc_copy_cat/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/nfc_copy_cat/board.c +++ b/ports/atmel-samd/boards/nfc_copy_cat/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/openbook_m4/board.c b/ports/atmel-samd/boards/openbook_m4/board.c index a110779a6..d8184da73 100644 --- a/ports/atmel-samd/boards/openbook_m4/board.c +++ b/ports/atmel-samd/boards/openbook_m4/board.c @@ -53,11 +53,11 @@ uint8_t stop_sequence[] = { }; void board_init(void) { - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -68,7 +68,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_epaperdisplay_obj_t* display = &displays[0].epaper_display; + displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; display->base.type = &displayio_epaperdisplay_type; common_hal_displayio_epaperdisplay_construct(display, bus, diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c index 26bd53cad..88c5bd969 100644 --- a/ports/atmel-samd/boards/pewpew_m4/board.c +++ b/ports/atmel-samd/boards/pewpew_m4/board.c @@ -57,8 +57,9 @@ uint32_t lookupCfg(uint32_t key, uint32_t defl) { } else { ptr += 4; while (*ptr) { - if (*ptr == key) + if (*ptr == key) { return ptr[1]; + } ptr += 2; } } @@ -84,23 +85,23 @@ uint8_t display_init_sequence[] = { // fix on VTL 0x3a, 1, 0x05, // COLMOD - 16bit color 0xe0, 16, 0x02, 0x1c, 0x07, 0x12, // _GMCTRP1 Gamma - 0x37, 0x32, 0x29, 0x2d, - 0x29, 0x25, 0x2B, 0x39, - 0x00, 0x01, 0x03, 0x10, + 0x37, 0x32, 0x29, 0x2d, + 0x29, 0x25, 0x2B, 0x39, + 0x00, 0x01, 0x03, 0x10, 0xe1, 16, 0x03, 0x1d, 0x07, 0x06, // _GMCTRN1 - 0x2E, 0x2C, 0x29, 0x2D, - 0x2E, 0x2E, 0x37, 0x3F, - 0x00, 0x00, 0x02, 0x10, + 0x2E, 0x2C, 0x29, 0x2D, + 0x2E, 0x2E, 0x37, 0x3F, + 0x00, 0x00, 0x02, 0x10, 0x13, 0 | DELAY, 10, // _NORON 0x29, 0 | DELAY, 100, // _DISPON }; void board_init(void) { - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA15, NULL); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -114,7 +115,7 @@ void board_init(void) { uint32_t cfg0 = lookupCfg(CFG_DISPLAY_CFG0, 0x000000); uint32_t offX = (cfg0 >> 8) & 0xff; uint32_t offY = (cfg0 >> 16) & 0xff; - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/picoplanet/mpconfigboard.h b/ports/atmel-samd/boards/picoplanet/mpconfigboard.h index 61430e06c..30a9169e0 100644 --- a/ports/atmel-samd/boards/picoplanet/mpconfigboard.h +++ b/ports/atmel-samd/boards/picoplanet/mpconfigboard.h @@ -33,10 +33,10 @@ #define DEFAULT_SPI_BUS_SCK (&pin_PA17) #define DEFAULT_SPI_BUS_MOSI (&pin_PA16) -//#define CP_RGB_STATUS_R (&pin_PA06) -//#define CP_RGB_STATUS_G (&pin_PA05) -//#define CP_RGB_STATUS_B (&pin_PA07) -//#define CP_RGB_STATUS_INVERTED_PWM -//#define CP_RGB_STATUS_LED +// #define CP_RGB_STATUS_R (&pin_PA06) +// #define CP_RGB_STATUS_G (&pin_PA05) +// #define CP_RGB_STATUS_B (&pin_PA07) +// #define CP_RGB_STATUS_INVERTED_PWM +// #define CP_RGB_STATUS_LED #define MICROPY_HW_LED_STATUS (&pin_PA06) diff --git a/ports/atmel-samd/boards/pirkey_m0/board.c b/ports/atmel-samd/boards/pirkey_m0/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/pirkey_m0/board.c +++ b/ports/atmel-samd/boards/pirkey_m0/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c index 188bf7bf6..4adf10710 100644 --- a/ports/atmel-samd/boards/pybadge/board.c +++ b/ports/atmel-samd/boards/pybadge/board.c @@ -56,13 +56,13 @@ uint8_t display_init_sequence[] = { // fix on VTL 0x3a, 1, 0x05, // COLMOD - 16bit color 0xe0, 16, 0x02, 0x1c, 0x07, 0x12, // _GMCTRP1 Gamma - 0x37, 0x32, 0x29, 0x2d, - 0x29, 0x25, 0x2B, 0x39, - 0x00, 0x01, 0x03, 0x10, + 0x37, 0x32, 0x29, 0x2d, + 0x29, 0x25, 0x2B, 0x39, + 0x00, 0x01, 0x03, 0x10, 0xe1, 16, 0x03, 0x1d, 0x07, 0x06, // _GMCTRN1 - 0x2E, 0x2C, 0x29, 0x2D, - 0x2E, 0x2E, 0x37, 0x3F, - 0x00, 0x00, 0x02, 0x10, + 0x2E, 0x2C, 0x29, 0x2D, + 0x2E, 0x2E, 0x37, 0x3F, + 0x00, 0x00, 0x02, 0x10, 0x2a, 3, 0x02, 0x00, 0x81, // _CASET XSTART = 2, XEND = 129 0x2b, 3, 0x02, 0x00, 0x81, // _RASET XSTART = 2, XEND = 129 0x13, 0 | DELAY, 10, // _NORON @@ -70,11 +70,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -85,7 +85,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pybadge_airlift/board.c b/ports/atmel-samd/boards/pybadge_airlift/board.c index de7eeda09..fe3549a64 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/board.c +++ b/ports/atmel-samd/boards/pybadge_airlift/board.c @@ -48,11 +48,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -63,7 +63,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pybadge_airlift/pins.c b/ports/atmel-samd/boards/pybadge_airlift/pins.c index cdf8071da..cce9b0442 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/pins.c +++ b/ports/atmel-samd/boards/pybadge_airlift/pins.c @@ -68,5 +68,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { {MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj)}, {MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj)}, - {MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}}; + {MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/boards/pycubed/board.c b/ports/atmel-samd/boards/pycubed/board.c index f092a8d20..2777b9031 100644 --- a/ports/atmel-samd/boards/pycubed/board.c +++ b/ports/atmel-samd/boards/pycubed/board.c @@ -37,10 +37,10 @@ nvm_bytearray_obj_t bootcnt = { .base = { .type = &nvm_bytearray_type - }, - .len = ( uint32_t) 8192, - .start_address = (uint8_t*) (0x00080000 - 8192) - }; + }, + .len = (uint32_t)8192, + .start_address = (uint8_t *)(0x00080000 - 8192) +}; void board_init(void) { diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.h b/ports/atmel-samd/boards/pycubed/mpconfigboard.h index fc16e22b5..244f41da3 100644 --- a/ports/atmel-samd/boards/pycubed/mpconfigboard.h +++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.h @@ -7,9 +7,9 @@ #define MICROPY_HW_NEOPIXEL (&pin_PA21) #define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) -#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11) +#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) #define MICROPY_PORT_C (0) -#define MICROPY_PORT_D (0) +#define MICROPY_PORT_D (0) #define AUTORESET_DELAY_MS 500 diff --git a/ports/atmel-samd/boards/pycubed_mram/board.c b/ports/atmel-samd/boards/pycubed_mram/board.c index f092a8d20..2777b9031 100644 --- a/ports/atmel-samd/boards/pycubed_mram/board.c +++ b/ports/atmel-samd/boards/pycubed_mram/board.c @@ -37,10 +37,10 @@ nvm_bytearray_obj_t bootcnt = { .base = { .type = &nvm_bytearray_type - }, - .len = ( uint32_t) 8192, - .start_address = (uint8_t*) (0x00080000 - 8192) - }; + }, + .len = (uint32_t)8192, + .start_address = (uint8_t *)(0x00080000 - 8192) +}; void board_init(void) { diff --git a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h index e2a733025..0d49e1b00 100644 --- a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h +++ b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h @@ -8,7 +8,7 @@ #define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) #define MICROPY_PORT_B (PORT_PA21 | PORT_PB10 | PORT_PB11) #define MICROPY_PORT_C (0) -#define MICROPY_PORT_D (0) +#define MICROPY_PORT_D (0) #define SPI_FLASH_WP_PIN &pin_PA10 #define SPI_FLASH_HOLD_PIN &pin_PA11 diff --git a/ports/atmel-samd/boards/pygamer/board.c b/ports/atmel-samd/boards/pygamer/board.c index 4614e347c..11e18f127 100644 --- a/ports/atmel-samd/boards/pygamer/board.c +++ b/ports/atmel-samd/boards/pygamer/board.c @@ -56,13 +56,13 @@ uint8_t display_init_sequence[] = { // fix on VTL 0x3a, 1, 0x05, // COLMOD - 16bit color 0xe0, 16, 0x02, 0x1c, 0x07, 0x12, // _GMCTRP1 Gamma - 0x37, 0x32, 0x29, 0x2d, - 0x29, 0x25, 0x2B, 0x39, - 0x00, 0x01, 0x03, 0x10, + 0x37, 0x32, 0x29, 0x2d, + 0x29, 0x25, 0x2B, 0x39, + 0x00, 0x01, 0x03, 0x10, 0xe1, 16, 0x03, 0x1d, 0x07, 0x06, // _GMCTRN1 - 0x2E, 0x2C, 0x29, 0x2D, - 0x2E, 0x2E, 0x37, 0x3F, - 0x00, 0x00, 0x02, 0x10, + 0x2E, 0x2C, 0x29, 0x2D, + 0x2E, 0x2E, 0x37, 0x3F, + 0x00, 0x00, 0x02, 0x10, 0x2a, 3, 0x02, 0x00, 0x81, // _CASET XSTART = 2, XEND = 129 0x2b, 3, 0x02, 0x00, 0x81, // _RASET XSTART = 2, XEND = 129 0x13, 0 | DELAY, 10, // _NORON @@ -70,11 +70,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -85,7 +85,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pygamer_advance/board.c b/ports/atmel-samd/boards/pygamer_advance/board.c index 39bf65602..0711c4298 100644 --- a/ports/atmel-samd/boards/pygamer_advance/board.c +++ b/ports/atmel-samd/boards/pygamer_advance/board.c @@ -48,11 +48,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB12, NULL); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -63,7 +63,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c index db474a820..6fd169689 100644 --- a/ports/atmel-samd/boards/pyportal/board.c +++ b/ports/atmel-samd/boards/pyportal/board.c @@ -53,15 +53,15 @@ uint8_t display_init_sequence[] = { 0xF2, 1, 0x00, // 3Gamma Function Disable 0x26, 1, 0x01, // Gamma curve selected 0xe0, 15, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, // Set Gamma - 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, + 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, 0xe1, 15, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, // Set Gamma - 0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, + 0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, 0x11, DELAY, 120, // Exit Sleep 0x29, DELAY, 120, // Display on }; void board_init(void) { - displayio_parallelbus_obj_t* bus = &displays[0].parallel_bus; + displayio_parallelbus_obj_t *bus = &displays[0].parallel_bus; bus->base.type = &displayio_parallelbus_type; common_hal_displayio_parallelbus_construct(bus, &pin_PA16, // Data0 @@ -71,7 +71,7 @@ void board_init(void) { &pin_PB04, // Read &pin_PA00); // Reset - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pyportal/mpconfigboard.h b/ports/atmel-samd/boards/pyportal/mpconfigboard.h index 00c376ad9..351647b12 100644 --- a/ports/atmel-samd/boards/pyportal/mpconfigboard.h +++ b/ports/atmel-samd/boards/pyportal/mpconfigboard.h @@ -11,10 +11,10 @@ // These are pins not to reset. // QSPI Data pins -#define MICROPY_PORT_A ( PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 ) +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) // QSPI CS, and QSPI SCK -#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 | PORT_PB22 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11 | PORT_PB22) +#define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) #define DEFAULT_I2C_BUS_SCL (&pin_PB03) diff --git a/ports/atmel-samd/boards/pyportal_titano/board.c b/ports/atmel-samd/boards/pyportal_titano/board.c index 59a25c4ac..d219ba794 100644 --- a/ports/atmel-samd/boards/pyportal_titano/board.c +++ b/ports/atmel-samd/boards/pyportal_titano/board.c @@ -37,48 +37,48 @@ #define DELAY 0x80 uint8_t display_init_sequence[] = { - 0x01, DELAY, 100/5, // Soft reset, then delay 10 ms + 0x01, DELAY, 100 / 5, // Soft reset, then delay 10 ms 0xB9, 3, 0xFF, 0x83, 0x57, // Extension command set - 0xFF, DELAY, 500/5, + 0xFF, DELAY, 500 / 5, 0xB3, 4, 0x80, 0x00, 0x06, 0x06, // 0x80 enables SDO pin (0x00 disables) 0xB6, 2, 0x01, 0x25, // -1.52V 0xB0, 1, 0x68, // Normal mode 70Hz, Idle mode 55 Hz 0xCC, 1, 0x05, 0xB1, 6, - 0x00, // Not deep standby - 0x15, // BT - 0x1C, // VSPR - 0x1C, // VSNR - 0x83, // AP - 0xAA, // FS + 0x00, // Not deep standby + 0x15, // BT + 0x1C, // VSPR + 0x1C, // VSNR + 0x83, // AP + 0xAA, // FS 0xC0, 6, - 0x50, // OPON normal - 0x50, // OPON idle - 0x01, // STBA - 0x3C, // STBA - 0x1E, // STBA - 0x08, // GEN + 0x50, // OPON normal + 0x50, // OPON idle + 0x01, // STBA + 0x3C, // STBA + 0x1E, // STBA + 0x08, // GEN 0xB4, 7, - 0x02, // NW 0x02 - 0x40, // RTN - 0x00, // DIV - 0x2A, // DUM - 0x2A, // DUM - 0x0D, // GDON - 0x78, // GDOFF + 0x02, // NW 0x02 + 0x40, // RTN + 0x00, // DIV + 0x2A, // DUM + 0x2A, // DUM + 0x0D, // GDON + 0x78, // GDOFF 0xE0, 34, - 0x02, 0x0A, 0x11, 0x1d, 0x23, 0x35, 0x41, 0x4b, 0x4b, - 0x42, 0x3A, 0x27, 0x1B, 0x08, 0x09, 0x03, 0x02, 0x0A, - 0x11, 0x1d, 0x23, 0x35, 0x41, 0x4b, 0x4b, 0x42, 0x3A, - 0x27, 0x1B, 0x08, 0x09, 0x03, 0x00, 0x01, + 0x02, 0x0A, 0x11, 0x1d, 0x23, 0x35, 0x41, 0x4b, 0x4b, + 0x42, 0x3A, 0x27, 0x1B, 0x08, 0x09, 0x03, 0x02, 0x0A, + 0x11, 0x1d, 0x23, 0x35, 0x41, 0x4b, 0x4b, 0x42, 0x3A, + 0x27, 0x1B, 0x08, 0x09, 0x03, 0x00, 0x01, 0x3a, 1, 0x55, 0x36, 1, 0x60, - 0x11, DELAY, 150/5, // Exit Sleep, then delay 150 ms - 0x29, DELAY, 50/5 + 0x11, DELAY, 150 / 5, // Exit Sleep, then delay 150 ms + 0x29, DELAY, 50 / 5 }; void board_init(void) { - displayio_parallelbus_obj_t* bus = &displays[0].parallel_bus; + displayio_parallelbus_obj_t *bus = &displays[0].parallel_bus; bus->base.type = &displayio_parallelbus_type; common_hal_displayio_parallelbus_construct(bus, &pin_PA16, // Data0 @@ -88,7 +88,7 @@ void board_init(void) { &pin_PB04, // Read &pin_PA00); // Reset - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pyportal_titano/mpconfigboard.h b/ports/atmel-samd/boards/pyportal_titano/mpconfigboard.h index a76f1db5c..61c6117d9 100644 --- a/ports/atmel-samd/boards/pyportal_titano/mpconfigboard.h +++ b/ports/atmel-samd/boards/pyportal_titano/mpconfigboard.h @@ -9,10 +9,10 @@ // These are pins not to reset. // QSPI Data pins -#define MICROPY_PORT_A ( PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 ) +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) // QSPI CS, and QSPI SCK -#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 | PORT_PB22 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11 | PORT_PB22) +#define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) #define DEFAULT_I2C_BUS_SCL (&pin_PB03) diff --git a/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.h b/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.h index c66873aeb..4e482cff5 100644 --- a/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.h +++ b/ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.h @@ -28,8 +28,8 @@ #define DEFAULT_SPI_BUS_MOSI (&pin_PB08) #define DEFAULT_SPI_BUS_MISO (&pin_PB11) -//#define DEFAULT_UART_BUS_RX (&pin_PB03) -//#define DEFAULT_UART_BUS_TX (&pin_PB02) +// #define DEFAULT_UART_BUS_RX (&pin_PB03) +// #define DEFAULT_UART_BUS_TX (&pin_PB02) // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 diff --git a/ports/atmel-samd/boards/robohatmm1_m4/pins.c b/ports/atmel-samd/boards/robohatmm1_m4/pins.c index 74dcfd651..32959ef3f 100644 --- a/ports/atmel-samd/boards/robohatmm1_m4/pins.c +++ b/ports/atmel-samd/boards/robohatmm1_m4/pins.c @@ -1,91 +1,91 @@ #include "shared-bindings/board/__init__.h" // Version 2.4 STATIC const mp_rom_map_elem_t board_global_dict_table[] = { - // SERVO Pins - { MP_ROM_QSTR(MP_QSTR_SERVO1), MP_ROM_PTR(&pin_PA18) }, - { MP_ROM_QSTR(MP_QSTR_SERVO2), MP_ROM_PTR(&pin_PA19) }, - { MP_ROM_QSTR(MP_QSTR_SERVO3), MP_ROM_PTR(&pin_PA20) }, - { MP_ROM_QSTR(MP_QSTR_SERVO4), MP_ROM_PTR(&pin_PA21) }, - { MP_ROM_QSTR(MP_QSTR_SERVO5), MP_ROM_PTR(&pin_PA11) }, - { MP_ROM_QSTR(MP_QSTR_SERVO6), MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_SERVO7), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_SERVO8), MP_ROM_PTR(&pin_PA08) }, + // SERVO Pins + { MP_ROM_QSTR(MP_QSTR_SERVO1), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_SERVO2), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_SERVO3), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_SERVO4), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_SERVO5), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_SERVO6), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_SERVO7), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_SERVO8), MP_ROM_PTR(&pin_PA08) }, - // RCC Pins - { MP_ROM_QSTR(MP_QSTR_RCC1), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_RCC2), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_RCC3), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_RCC4), MP_ROM_PTR(&pin_PA04) }, + // RCC Pins + { MP_ROM_QSTR(MP_QSTR_RCC1), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_RCC2), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_RCC3), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_RCC4), MP_ROM_PTR(&pin_PA04) }, - // Special Function - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA02) }, - { MP_ROM_QSTR(MP_QSTR_POWER_OFF), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_POWER_DISABLE), MP_ROM_PTR(&pin_PA03) }, - { MP_ROM_QSTR(MP_QSTR_POWER_ON), MP_ROM_PTR(&pin_PA27) }, - { MP_ROM_QSTR(MP_QSTR_POWER_ENABLE), MP_ROM_PTR(&pin_PA27) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA27) }, + // Special Function + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_POWER_OFF), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_POWER_DISABLE), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_POWER_ON), MP_ROM_PTR(&pin_PA27) }, + { MP_ROM_QSTR(MP_QSTR_POWER_ENABLE), MP_ROM_PTR(&pin_PA27) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA27) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB23) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB22) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB23) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB22) }, - // GROVE on SERCOM0 - { MP_ROM_QSTR(MP_QSTR_GROVE_SCL), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_GROVE_SDA), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_GROVE_RX), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_GROVE_TX), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_GROVE_D1), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_GROVE_D0), MP_ROM_PTR(&pin_PA08) }, - { MP_ROM_QSTR(MP_QSTR_GROVE_A1), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_GROVE_A0), MP_ROM_PTR(&pin_PA08) }, + // GROVE on SERCOM0 + { MP_ROM_QSTR(MP_QSTR_GROVE_SCL), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_GROVE_SDA), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_GROVE_RX), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_GROVE_TX), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_GROVE_D1), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_GROVE_D0), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_GROVE_A1), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_GROVE_A0), MP_ROM_PTR(&pin_PA08) }, - // UART on SERCOM0 - { MP_ROM_QSTR(MP_QSTR_UART_TX), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_UART_RX), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_UART_CTS), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_UART_RTS), MP_ROM_PTR(&pin_PA07) }, + // UART on SERCOM0 + { MP_ROM_QSTR(MP_QSTR_UART_TX), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_UART_RX), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_UART_CTS), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_UART_RTS), MP_ROM_PTR(&pin_PA07) }, - // UART on SERCOM1 (Raspberry Pi) - { MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_PI_TX), MP_ROM_PTR(&pin_PA16) }, - { MP_ROM_QSTR(MP_QSTR_PI_RX), MP_ROM_PTR(&pin_PA17) }, + // UART on SERCOM1 (Raspberry Pi) + { MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_PI_TX), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_PI_RX), MP_ROM_PTR(&pin_PA17) }, - // I2C on SERCOM1 (External Connector) - { MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_PA00) }, - { MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_PA01) }, + // I2C on SERCOM1 (External Connector) + { MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_PA01) }, - // SPI Flash on SERCOM2 - { MP_ROM_QSTR(MP_QSTR_FLASH_SCK), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_FLASH_MISO), MP_ROM_PTR(&pin_PA14) }, - { MP_ROM_QSTR(MP_QSTR_FLASH_MOSI), MP_ROM_PTR(&pin_PA12) }, - { MP_ROM_QSTR(MP_QSTR_FLASH_CS), MP_ROM_PTR(&pin_PA15) }, + // SPI Flash on SERCOM2 + { MP_ROM_QSTR(MP_QSTR_FLASH_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_MISO), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_MOSI), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_FLASH_CS), MP_ROM_PTR(&pin_PA15) }, - // I2C on SERCOM3 (RPi & Internal) - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, - { MP_ROM_QSTR(MP_QSTR_PI_SDA), MP_ROM_PTR(&pin_PA22) }, - { MP_ROM_QSTR(MP_QSTR_PI_SCL), MP_ROM_PTR(&pin_PA23) }, + // I2C on SERCOM3 (RPi & Internal) + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_PI_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_PI_SCL), MP_ROM_PTR(&pin_PA23) }, - // SPI on SERCOM4 - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB08) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB09) }, - { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PB10) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB11) }, + // SPI on SERCOM4 + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB11) }, - // GPS on SERCOM5 - { MP_ROM_QSTR(MP_QSTR_GPS_TX), MP_ROM_PTR(&pin_PB02) }, - { MP_ROM_QSTR(MP_QSTR_GPS_RX), MP_ROM_PTR(&pin_PB03) }, + // GPS on SERCOM5 + { MP_ROM_QSTR(MP_QSTR_GPS_TX), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_GPS_RX), MP_ROM_PTR(&pin_PB03) }, - // Raspberry Pi - { MP_ROM_QSTR(MP_QSTR_PI_GP25), MP_ROM_PTR(&pin_PA30) }, - { MP_ROM_QSTR(MP_QSTR_SWCLK), MP_ROM_PTR(&pin_PA30) }, - { MP_ROM_QSTR(MP_QSTR_PI_GP24), MP_ROM_PTR(&pin_PA31) }, - { MP_ROM_QSTR(MP_QSTR_SWDIO), MP_ROM_PTR(&pin_PA31) }, + // Raspberry Pi + { MP_ROM_QSTR(MP_QSTR_PI_GP25), MP_ROM_PTR(&pin_PA30) }, + { MP_ROM_QSTR(MP_QSTR_SWCLK), MP_ROM_PTR(&pin_PA30) }, + { MP_ROM_QSTR(MP_QSTR_PI_GP24), MP_ROM_PTR(&pin_PA31) }, + { MP_ROM_QSTR(MP_QSTR_SWDIO), MP_ROM_PTR(&pin_PA31) }, - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - //{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + // { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/boards/sam32/mpconfigboard.h b/ports/atmel-samd/boards/sam32/mpconfigboard.h index 364d380d1..19f326782 100644 --- a/ports/atmel-samd/boards/sam32/mpconfigboard.h +++ b/ports/atmel-samd/boards/sam32/mpconfigboard.h @@ -11,7 +11,7 @@ #define MICROPY_PORT_D (0) #define CIRCUITPY_INTERNAL_NVM_SIZE 0 -#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (128*1024) +#define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (128 * 1024) #define BOARD_HAS_CRYSTAL 1 diff --git a/ports/atmel-samd/boards/same54_xplained/mpconfigboard.h b/ports/atmel-samd/boards/same54_xplained/mpconfigboard.h index 934559a2a..dbdd1aaa6 100644 --- a/ports/atmel-samd/boards/same54_xplained/mpconfigboard.h +++ b/ports/atmel-samd/boards/same54_xplained/mpconfigboard.h @@ -9,9 +9,9 @@ // These are pins not to reset. // QSPI Data pins -#define MICROPY_PORT_A ( PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 ) +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) // QSPI CS, and QSPI SCK -#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 ) +#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) #define MICROPY_PORT_C (0) #define MICROPY_PORT_D (0) diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c index 53c43cd44..fe2393a57 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c @@ -65,11 +65,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_PB20, &pin_PB19, NULL); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -80,7 +80,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, @@ -112,23 +112,23 @@ void board_init(void) { true, // backlight_on_high false); // SH1107_addressing - // Enabling the Power of the 40-pin at the back - CTR_5V.base.type = &digitalio_digitalinout_type; - CTR_3V3.base.type = &digitalio_digitalinout_type; - USB_HOST_ENABLE.base.type = &digitalio_digitalinout_type; + // Enabling the Power of the 40-pin at the back + CTR_5V.base.type = &digitalio_digitalinout_type; + CTR_3V3.base.type = &digitalio_digitalinout_type; + USB_HOST_ENABLE.base.type = &digitalio_digitalinout_type; - common_hal_digitalio_digitalinout_construct(&CTR_5V, PIN_CTR_5V); - common_hal_digitalio_digitalinout_construct(&CTR_3V3, PIN_CTR_3V3); - common_hal_digitalio_digitalinout_construct(&USB_HOST_ENABLE, PIN_USB_HOST_ENABLE); + common_hal_digitalio_digitalinout_construct(&CTR_5V, PIN_CTR_5V); + common_hal_digitalio_digitalinout_construct(&CTR_3V3, PIN_CTR_3V3); + common_hal_digitalio_digitalinout_construct(&USB_HOST_ENABLE, PIN_USB_HOST_ENABLE); - common_hal_digitalio_digitalinout_set_value(&CTR_5V, true); - common_hal_digitalio_digitalinout_set_value(&CTR_3V3, false); - common_hal_digitalio_digitalinout_set_value(&USB_HOST_ENABLE, false); + common_hal_digitalio_digitalinout_set_value(&CTR_5V, true); + common_hal_digitalio_digitalinout_set_value(&CTR_3V3, false); + common_hal_digitalio_digitalinout_set_value(&USB_HOST_ENABLE, false); - // Never reset - common_hal_digitalio_digitalinout_never_reset(&CTR_5V); - common_hal_digitalio_digitalinout_never_reset(&CTR_3V3); - common_hal_digitalio_digitalinout_never_reset(&USB_HOST_ENABLE); + // Never reset + common_hal_digitalio_digitalinout_never_reset(&CTR_5V); + common_hal_digitalio_digitalinout_never_reset(&CTR_3V3); + common_hal_digitalio_digitalinout_never_reset(&USB_HOST_ENABLE); } diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c b/ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c index 0558191e6..45ff7c336 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c @@ -26,7 +26,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA17) }, // MP_QSTR_SDA - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA16) }, //MP_QSTR_SCL + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA16) }, // MP_QSTR_SCL { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA15) }, // MP_QSTR_LED // UART pins diff --git a/ports/atmel-samd/boards/snekboard/board.c b/ports/atmel-samd/boards/snekboard/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/snekboard/board.c +++ b/ports/atmel-samd/boards/snekboard/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/snekboard/mpconfigboard.h b/ports/atmel-samd/boards/snekboard/mpconfigboard.h index 1c0804fe7..bea90a0fa 100644 --- a/ports/atmel-samd/boards/snekboard/mpconfigboard.h +++ b/ports/atmel-samd/boards/snekboard/mpconfigboard.h @@ -12,16 +12,16 @@ // These are pins not to reset. #define MICROPY_PORT_A (PORT_PB11) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define BOARD_HAS_CRYSTAL 0 -#define DEFAULT_I2C_BUS_SCL (&pin_PA08) /* ANALOG 5 */ -#define DEFAULT_I2C_BUS_SDA (&pin_PA09) /* ANALOG 6 */ +#define DEFAULT_I2C_BUS_SCL (&pin_PA08) /* ANALOG 5 */ +#define DEFAULT_I2C_BUS_SDA (&pin_PA09) /* ANALOG 6 */ -#define DEFAULT_UART_BUS_RX (&pin_PB08) /* ANALOG 1 */ -#define DEFAULT_UART_BUS_TX (&pin_PB09) /* ANALOG 2 */ +#define DEFAULT_UART_BUS_RX (&pin_PB08) /* ANALOG 1 */ +#define DEFAULT_UART_BUS_TX (&pin_PB09) /* ANALOG 2 */ // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/board.c b/ports/atmel-samd/boards/sparkfun_lumidrive/board.c index 6baa43ffa..84960e73c 100755..100644 --- a/ports/atmel-samd/boards/sparkfun_lumidrive/board.c +++ b/ports/atmel-samd/boards/sparkfun_lumidrive/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.h b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.h index 80f37429f..836261bf8 100755..100644 --- a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.h +++ b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.h @@ -9,17 +9,17 @@ #define SPI_FLASH_SCK_PIN &pin_PA09 #define SPI_FLASH_CS_PIN &pin_PA13 -#define MICROPY_PORT_A ( 0 ) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define BOARD_HAS_CRYSTAL 1 -//I2C +// I2C #define DEFAULT_I2C_BUS_SCL (&pin_PA23) #define DEFAULT_I2C_BUS_SDA (&pin_PA22) -//SPI +// SPI #define DEFAULT_SPI_BUS_SCK (&pin_PA19) #define DEFAULT_SPI_BUS_MOSI (&pin_PA18) #define DEFAULT_SPI_BUS_MISO (&pin_PA21) diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/mpconfigboard.h b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/mpconfigboard.h index dcce97b8d..c2527301f 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/mpconfigboard.h +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/mpconfigboard.h @@ -1,23 +1,23 @@ #define MICROPY_HW_BOARD_NAME "SparkFun Qwiic Micro" #define MICROPY_HW_MCU_NAME "samd21e18" -#define MICROPY_PORT_A ( 0 ) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define CALIBRATE_CRYSTALLESS 1 #define BOARD_HAS_CRYSTAL 0 -//I2C and Qwiic Connector +// I2C and Qwiic Connector #define DEFAULT_I2C_BUS_SCL (&pin_PA09) #define DEFAULT_I2C_BUS_SDA (&pin_PA08) -//SPI +// SPI #define DEFAULT_SPI_BUS_SCK (&pin_PA07) #define DEFAULT_SPI_BUS_MOSI (&pin_PA06) #define DEFAULT_SPI_BUS_MISO (&pin_PA05) -//UART +// UART #define DEFAULT_UART_BUS_RX (&pin_PA23) #define DEFAULT_UART_BUS_TX (&pin_PA22) diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/mpconfigboard.h b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/mpconfigboard.h index c9b195eef..4fb43629b 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/mpconfigboard.h +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/mpconfigboard.h @@ -9,23 +9,23 @@ #define SPI_FLASH_SCK_PIN &pin_PA17 #define SPI_FLASH_CS_PIN &pin_PA19 -#define MICROPY_PORT_A ( 0 ) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define CALIBRATE_CRYSTALLESS 1 #define BOARD_HAS_CRYSTAL 0 -//I2C and Qwiic Connector +// I2C and Qwiic Connector #define DEFAULT_I2C_BUS_SCL (&pin_PA09) #define DEFAULT_I2C_BUS_SDA (&pin_PA08) -//SPI +// SPI #define DEFAULT_SPI_BUS_SCK (&pin_PA07) #define DEFAULT_SPI_BUS_MOSI (&pin_PA06) #define DEFAULT_SPI_BUS_MISO (&pin_PA05) -//UART +// UART #define DEFAULT_UART_BUS_RX (&pin_PA23) #define DEFAULT_UART_BUS_TX (&pin_PA22) diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c b/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c index 6baa43ffa..84960e73c 100755..100644 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.h b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.h index ae272d502..b4076523f 100755..100644 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.h +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.h @@ -15,9 +15,9 @@ #define SPI_FLASH_SCK_PIN &pin_PB23 #define SPI_FLASH_CS_PIN &pin_PA13 -#define MICROPY_PORT_A ( 0 ) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define BOARD_HAS_CRYSTAL 1 diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c index 95d2eb5a3..e0278aca0 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/pins.c @@ -23,16 +23,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, - { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PA28) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_EN), MP_ROM_PTR(&pin_PA13) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.h b/ports/atmel-samd/boards/uchip/mpconfigboard.h index 5d6af4b78..6b8435877 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.h +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.h @@ -3,7 +3,7 @@ #define MICROPY_HW_LED_STATUS (&pin_PA07) -#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA14 | PORT_PA15 | PORT_PA28 | PORT_PA27 | PORT_PA24 | PORT_PA25) +#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA14 | PORT_PA15 | PORT_PA28 | PORT_PA27 | PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index 918fe2d59..f17b60ff6 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -56,13 +56,13 @@ uint8_t display_init_sequence[] = { // fix on VTL 0x3a, 1, 0x05, // COLMOD - 16bit color 0xe0, 16, 0x02, 0x1c, 0x07, 0x12, // _GMCTRP1 Gamma - 0x37, 0x32, 0x29, 0x2d, - 0x29, 0x25, 0x2B, 0x39, - 0x00, 0x01, 0x03, 0x10, + 0x37, 0x32, 0x29, 0x2d, + 0x29, 0x25, 0x2B, 0x39, + 0x00, 0x01, 0x03, 0x10, 0xe1, 16, 0x03, 0x1d, 0x07, 0x06, // _GMCTRN1 - 0x2E, 0x2C, 0x29, 0x2D, - 0x2E, 0x2E, 0x37, 0x3F, - 0x00, 0x00, 0x02, 0x10, + 0x2E, 0x2C, 0x29, 0x2D, + 0x2E, 0x2E, 0x37, 0x3F, + 0x00, 0x00, 0x02, 0x10, 0x2a, 3, 0x02, 0x00, 0x81, // _CASET XSTART = 2, XEND = 129 0x2b, 3, 0x02, 0x00, 0x81, // _RASET XSTART = 2, XEND = 129 0x13, 0 | DELAY, 10, // _NORON @@ -70,7 +70,7 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; busio_spi_obj_t *spi = common_hal_board_create_spi(); common_hal_displayio_fourwire_construct(bus, @@ -82,7 +82,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c index 6baa43ffa..84960e73c 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c @@ -26,8 +26,7 @@ #include "supervisor/board.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.h b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.h index 8d520f675..67882f633 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.h +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.h @@ -10,8 +10,8 @@ // These are pins not to reset. #define MICROPY_PORT_A (PORT_PA00 | PORT_PA01) -#define MICROPY_PORT_B ( 0 ) -#define MICROPY_PORT_C ( 0 ) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) #define BOARD_HAS_CRYSTAL 0 diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c index 54ce173d8..1a340ae22 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c @@ -15,18 +15,22 @@ STATIC mp_obj_t _bhb_init_adc(void) { /* Enable GCLK0 for the ADC */ GCLK->CLKCTRL.reg = GCLK_CLKCTRL_CLKEN | - GCLK_CLKCTRL_GEN_GCLK0 | - GCLK_CLKCTRL_ID_ADC; + GCLK_CLKCTRL_GEN_GCLK0 | + GCLK_CLKCTRL_ID_ADC; /* Wait for bus synchronization. */ - while (GCLK->STATUS.bit.SYNCBUSY) {}; + while (GCLK->STATUS.bit.SYNCBUSY) { + } + ; - uint32_t bias = (*((uint32_t *) ADC_FUSES_BIASCAL_ADDR) & ADC_FUSES_BIASCAL_Msk) >> ADC_FUSES_BIASCAL_Pos; - uint32_t linearity = (*((uint32_t *) ADC_FUSES_LINEARITY_0_ADDR) & ADC_FUSES_LINEARITY_0_Msk) >> ADC_FUSES_LINEARITY_0_Pos; - linearity |= ((*((uint32_t *) ADC_FUSES_LINEARITY_1_ADDR) & ADC_FUSES_LINEARITY_1_Msk) >> ADC_FUSES_LINEARITY_1_Pos) << 5; + uint32_t bias = (*((uint32_t *)ADC_FUSES_BIASCAL_ADDR) & ADC_FUSES_BIASCAL_Msk) >> ADC_FUSES_BIASCAL_Pos; + uint32_t linearity = (*((uint32_t *)ADC_FUSES_LINEARITY_0_ADDR) & ADC_FUSES_LINEARITY_0_Msk) >> ADC_FUSES_LINEARITY_0_Pos; + linearity |= ((*((uint32_t *)ADC_FUSES_LINEARITY_1_ADDR) & ADC_FUSES_LINEARITY_1_Msk) >> ADC_FUSES_LINEARITY_1_Pos) << 5; /* Wait for bus synchronization. */ - while (ADC->STATUS.bit.SYNCBUSY) {}; + while (ADC->STATUS.bit.SYNCBUSY) { + } + ; /* Write the calibration data. */ ADC->CALIB.reg = ADC_CALIB_BIAS_CAL(bias) | ADC_CALIB_LINEARITY_CAL(linearity); @@ -43,7 +47,7 @@ STATIC mp_obj_t _bhb_init_adc(void) { Set the resolution to 16 for averaging */ ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV32 | - ADC_CTRLB_RESSEL_16BIT; + ADC_CTRLB_RESSEL_16BIT; /* Configure the input parameters. @@ -56,8 +60,8 @@ STATIC mp_obj_t _bhb_init_adc(void) { - MUXPOS_PIN3 means that the ADC should read from AIN2, or PB08. */ ADC->INPUTCTRL.reg = ADC_INPUTCTRL_GAIN_DIV2 | - ADC_INPUTCTRL_MUXNEG_GND | - ADC_INPUTCTRL_MUXPOS_PIN2; + ADC_INPUTCTRL_MUXNEG_GND | + ADC_INPUTCTRL_MUXPOS_PIN2; /* Set PB08 as an input pin. */ @@ -70,7 +74,9 @@ STATIC mp_obj_t _bhb_init_adc(void) { PORT->Group[1].PMUX[4].reg |= PORT_PMUX_PMUXE_B; /* Wait for bus synchronization. */ - while (ADC->STATUS.bit.SYNCBUSY) {}; + while (ADC->STATUS.bit.SYNCBUSY) { + } + ; /* Enable the ADC. */ ADC->CTRLA.bit.ENABLE = true; @@ -83,13 +89,17 @@ STATIC mp_obj_t _bhb_init_adc(void) { STATIC mp_obj_t _bhb_read_adc(void) { /* Wait for bus synchronization. */ - while (ADC->STATUS.bit.SYNCBUSY) {}; + while (ADC->STATUS.bit.SYNCBUSY) { + } + ; /* Start the ADC using a software trigger. */ ADC->SWTRIG.bit.START = true; /* Wait for the result ready flag to be set. */ - while (ADC->INTFLAG.bit.RESRDY == 0); + while (ADC->INTFLAG.bit.RESRDY == 0) { + ; + } /* Clear the flag. */ ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY; @@ -114,7 +124,7 @@ STATIC MP_DEFINE_CONST_DICT(_bhb_module_globals, _bhb_module_globals_table); const mp_obj_module_t _bhb_user_cmodule = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t*)&_bhb_module_globals, + .globals = (mp_obj_dict_t *)&_bhb_module_globals, }; MP_REGISTER_MODULE(MP_QSTR__bhb, _bhb_user_cmodule, MODULE_BHB_ENABLED); diff --git a/ports/atmel-samd/boards/xinabox_cc03/board.c b/ports/atmel-samd/boards/xinabox_cc03/board.c index 112b173ec..7af05ba45 100644 --- a/ports/atmel-samd/boards/xinabox_cc03/board.c +++ b/ports/atmel-samd/boards/xinabox_cc03/board.c @@ -28,8 +28,7 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/xinabox_cs11/board.c b/ports/atmel-samd/boards/xinabox_cs11/board.c index 112b173ec..7af05ba45 100644 --- a/ports/atmel-samd/boards/xinabox_cs11/board.c +++ b/ports/atmel-samd/boards/xinabox_cs11/board.c @@ -28,8 +28,7 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) -{ +void board_init(void) { } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/common-hal/_pew/PewPew.c b/ports/atmel-samd/common-hal/_pew/PewPew.c index 1e7561ac8..40cd52134 100644 --- a/ports/atmel-samd/common-hal/_pew/PewPew.c +++ b/ports/atmel-samd/common-hal/_pew/PewPew.c @@ -47,7 +47,7 @@ void pewpew_interrupt_handler(uint8_t index) { if (index != pewpew_tc_index) { return; } - Tc* tc = tc_insts[index]; + Tc *tc = tc_insts[index]; if (!tc->COUNT16.INTFLAG.bit.MC0) { return; } @@ -60,7 +60,7 @@ void pewpew_interrupt_handler(uint8_t index) { } void pew_init() { - pew_obj_t* pew = MP_STATE_VM(pew_singleton); + pew_obj_t *pew = MP_STATE_VM(pew_singleton); common_hal_digitalio_digitalinout_switch_to_input(pew->buttons, PULL_UP); @@ -97,8 +97,8 @@ void pew_init() { #ifdef SAMD21 tc->COUNT16.CTRLA.reg = TC_CTRLA_MODE_COUNT16 | - TC_CTRLA_PRESCALER_DIV64 | - TC_CTRLA_WAVEGEN_MFRQ; + TC_CTRLA_PRESCALER_DIV64 | + TC_CTRLA_WAVEGEN_MFRQ; #endif #ifdef SAM_D5X_E5X tc_reset(tc); diff --git a/ports/atmel-samd/common-hal/_pew/PewPew.h b/ports/atmel-samd/common-hal/_pew/PewPew.h index a9c3b6626..523be0167 100644 --- a/ports/atmel-samd/common-hal/_pew/PewPew.h +++ b/ports/atmel-samd/common-hal/_pew/PewPew.h @@ -32,9 +32,9 @@ typedef struct { mp_obj_base_t base; - uint8_t* buffer; - mp_obj_t* rows; - mp_obj_t* cols; + uint8_t *buffer; + mp_obj_t *rows; + mp_obj_t *cols; digitalio_digitalinout_obj_t *buttons; uint8_t rows_size; uint8_t cols_size; diff --git a/ports/atmel-samd/common-hal/_pew/__init__.c b/ports/atmel-samd/common-hal/_pew/__init__.c index f3b23c606..b89b464dd 100644 --- a/ports/atmel-samd/common-hal/_pew/__init__.c +++ b/ports/atmel-samd/common-hal/_pew/__init__.c @@ -40,8 +40,10 @@ void pew_tick(void) { static uint8_t last_pressed = 0; digitalio_digitalinout_obj_t *pin; - pew_obj_t* pew = MP_STATE_VM(pew_singleton); - if (!pew) { return; } + pew_obj_t *pew = MP_STATE_VM(pew_singleton); + if (!pew) { + return; + } pin = MP_OBJ_TO_PTR(pew->cols[col]); ++col; @@ -69,7 +71,7 @@ void pew_tick(void) { break; case 2: if (turn == 2 || turn == 5 || turn == 8 || turn == 11) { - value = true; + value = true; } break; case 1: diff --git a/ports/atmel-samd/common-hal/analogio/AnalogIn.c b/ports/atmel-samd/common-hal/analogio/AnalogIn.c index 2bd218cdd..262e44350 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogIn.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogIn.c @@ -46,8 +46,8 @@ #include "hpl/pm/hpl_pm_base.h" #endif -void common_hal_analogio_analogin_construct(analogio_analogin_obj_t* self, - const mcu_pin_obj_t *pin) { +void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, + const mcu_pin_obj_t *pin) { uint8_t adc_index; uint8_t adc_channel = 0xff; for (adc_index = 0; adc_index < NUM_ADC_PER_PIN; adc_index++) { @@ -66,7 +66,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t* self, gpio_set_pin_function(pin->number, GPIO_PIN_FUNCTION_B); - static Adc* adc_insts[] = ADC_INSTS; + static Adc *adc_insts[] = ADC_INSTS; self->instance = adc_insts[adc_index]; self->channel = adc_channel; self->pin = pin; @@ -118,8 +118,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { // Empirical observation shows the first reading is quite different than subsequent ones. uint16_t value; - adc_sync_read_channel(&adc, self->channel, ((uint8_t*) &value), 2); - adc_sync_read_channel(&adc, self->channel, ((uint8_t*) &value), 2); + adc_sync_read_channel(&adc, self->channel, ((uint8_t *)&value), 2); + adc_sync_read_channel(&adc, self->channel, ((uint8_t *)&value), 2); adc_sync_deinit(&adc); // Shift the value to be 16 bit. diff --git a/ports/atmel-samd/common-hal/analogio/AnalogIn.h b/ports/atmel-samd/common-hal/analogio/AnalogIn.h index 0b13ba7e1..3a467f64d 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogIn.h +++ b/ports/atmel-samd/common-hal/analogio/AnalogIn.h @@ -33,8 +33,8 @@ typedef struct { mp_obj_base_t base; - const mcu_pin_obj_t * pin; - Adc* instance; + const mcu_pin_obj_t *pin; + Adc *instance; uint8_t channel; } analogio_analogin_obj_t; diff --git a/ports/atmel-samd/common-hal/analogio/AnalogOut.c b/ports/atmel-samd/common-hal/analogio/AnalogOut.c index 3ddd9cac6..f3b3310eb 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogOut.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogOut.c @@ -47,10 +47,10 @@ #define HAVE_ANALOGOUT ( \ (defined(PIN_PA02) && !defined(IGNORE_PA02)) || \ (defined(SAM_D5X_E5X) && defined(PIN_PA05) && !defined(IGNORE_PA05)) \ -) + ) -void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self, - const mcu_pin_obj_t *pin) { +void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, + const mcu_pin_obj_t *pin) { #if !HAVE_ANALOGOUT mp_raise_NotImplementedError(translate("No DAC on chip")); #else @@ -63,15 +63,15 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self, break; #endif - #if defined(SAM_D5X_E5X) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) + #if defined(SAM_D5X_E5X) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) case PIN_PA05: channel = 1; break; - #endif + #endif default: mp_raise_ValueError(translate("AnalogOut not supported on given pin")); - return; + return; } self->channel = channel; @@ -94,14 +94,14 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self, #ifdef SAM_D5X_E5X if (!common_hal_mcu_pin_is_free(&pin_PA02) || !common_hal_mcu_pin_is_free(&pin_PA05)) { #endif - // Fake the descriptor if the DAC is already initialized. - self->descriptor.device.hw = DAC; + // Fake the descriptor if the DAC is already initialized. + self->descriptor.device.hw = DAC; #ifdef SAM_D5X_E5X - } else { +} else { #endif - result = dac_sync_init(&self->descriptor, DAC); + result = dac_sync_init(&self->descriptor, DAC); #ifdef SAM_D5X_E5X - } +} #endif if (result != ERR_NONE) { mp_raise_OSError(MP_EIO); @@ -134,9 +134,9 @@ void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) { #ifdef SAM_D5X_E5X if (common_hal_mcu_pin_is_free(&pin_PA02) && common_hal_mcu_pin_is_free(&pin_PA05)) { #endif - dac_sync_deinit(&self->descriptor); + dac_sync_deinit(&self->descriptor); #ifdef SAM_D5X_E5X - } +} #endif self->deinited = true; // TODO(tannewt): Turn off the DAC clocks to save power. @@ -144,7 +144,7 @@ void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) { } void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self, - uint16_t value) { + uint16_t value) { #if HAVE_ANALOGOUT // Input is 16 bit so make sure and set LEFTADJ to 1 so it takes the top // bits. This is currently done in asf4_conf/*/hpl_dac_config.h. @@ -155,15 +155,17 @@ void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self, void analogout_reset(void) { // audioout_reset also resets the DAC, and does a smooth ramp down to avoid clicks // if it was enabled, so do that instead if AudioOut is enabled. -#if CIRCUITPY_AUDIOIO + #if CIRCUITPY_AUDIOIO audioout_reset(); -#elif HAVE_ANALOGOUT + #elif HAVE_ANALOGOUT #ifdef SAMD21 - while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {} + while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) { + } #endif #ifdef SAM_D5X_E5X - while (DAC->SYNCBUSY.reg & DAC_SYNCBUSY_SWRST) {} + while (DAC->SYNCBUSY.reg & DAC_SYNCBUSY_SWRST) { + } #endif DAC->CTRLA.reg |= DAC_CTRLA_SWRST; -#endif + #endif } diff --git a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c index 0aa48c804..2488b7b92 100644 --- a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c +++ b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c @@ -61,11 +61,11 @@ #include "audio_dma.h" #ifdef SAMD21 -#define SERCTRL(name) I2S_SERCTRL_ ## name +#define SERCTRL(name) I2S_SERCTRL_##name #endif #ifdef SAM_D5X_E5X -#define SERCTRL(name) I2S_TXCTRL_ ## name +#define SERCTRL(name) I2S_TXCTRL_##name #endif void i2sout_reset(void) { @@ -77,7 +77,8 @@ void i2sout_reset(void) { #endif if (I2S->CTRLA.bit.ENABLE == 1) { I2S->CTRLA.bit.ENABLE = 0; - while (I2S->SYNCBUSY.bit.ENABLE == 1) {} + while (I2S->SYNCBUSY.bit.ENABLE == 1) { + } } // Make sure the I2S peripheral is running so we can see if the resources we need are free. @@ -95,9 +96,9 @@ void i2sout_reset(void) { } // Caller validates that pins are free. -void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, - const mcu_pin_obj_t* bit_clock, const mcu_pin_obj_t* word_select, - const mcu_pin_obj_t* data, bool left_justified) { +void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t *self, + const mcu_pin_obj_t *bit_clock, const mcu_pin_obj_t *word_select, + const mcu_pin_obj_t *data, bool left_justified) { uint8_t serializer = 0xff; uint8_t bc_clock_unit = 0xff; uint8_t ws_clock_unit = 0xff; @@ -130,10 +131,10 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, if (data == &pin_PA07 || data == &pin_PA19) { // I2S SD[0] serializer = 0; } else if (data == &pin_PA08 - #ifdef PIN_PB16 - || data == &pin_PB16 - #endif - ) { // I2S SD[1] + #ifdef PIN_PB16 + || data == &pin_PB16 + #endif + ) { // I2S SD[1] serializer = 1; } #endif @@ -168,7 +169,8 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, if (I2S->CTRLA.bit.ENABLE == 0) { I2S->CTRLA.bit.SWRST = 1; - while (I2S->CTRLA.bit.SWRST == 1) {} + while (I2S->CTRLA.bit.SWRST == 1) { + } } else { #ifdef SAMD21 if ((I2S->CTRLA.vec.SEREN & (1 << serializer)) != 0) { @@ -206,11 +208,11 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, audio_dma_init(&self->dma); } -bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) { +bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t *self) { return self->bit_clock == NULL; } -void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) { +void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t *self) { if (common_hal_audiobusio_i2sout_deinited(self)) { return; } @@ -223,8 +225,8 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) { self->data = NULL; } -void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, - mp_obj_t sample, bool loop) { +void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self, + mp_obj_t sample, bool loop) { if (common_hal_audiobusio_i2sout_get_playing(self)) { common_hal_audiobusio_i2sout_stop(self); } @@ -245,8 +247,8 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, self->gclk = gclk; uint32_t clkctrl = I2S_CLKCTRL_MCKSEL_GCLK | - I2S_CLKCTRL_NBSLOTS(1) | - I2S_CLKCTRL_FSWIDTH_HALF; + I2S_CLKCTRL_NBSLOTS(1) | + I2S_CLKCTRL_FSWIDTH_HALF; if (self->left_justified) { clkctrl |= I2S_CLKCTRL_BITDELAY_LJ; } else { @@ -293,11 +295,11 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, i2s_set_enable(true); #ifdef SAMD21 - uint32_t tx_register = (uint32_t) &I2S->DATA[self->serializer].reg; + uint32_t tx_register = (uint32_t)&I2S->DATA[self->serializer].reg; uint8_t dmac_id = I2S_DMAC_ID_TX_0 + self->serializer; #endif #ifdef SAM_D5X_E5X - uint32_t tx_register = (uint32_t) &I2S->TXDATA.reg; + uint32_t tx_register = (uint32_t)&I2S->TXDATA.reg; uint8_t dmac_id = I2S_DMAC_ID_TX_0; #endif audio_dma_result result = audio_dma_setup_playback(&self->dma, sample, loop, false, 0, @@ -314,26 +316,29 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, I2S->INTFLAG.reg = I2S_INTFLAG_TXUR0 | I2S_INTFLAG_TXUR1; I2S->CTRLA.vec.CKEN = 1 << self->clock_unit; - while ((I2S->SYNCBUSY.vec.CKEN & (1 << self->clock_unit)) != 0) {} + while ((I2S->SYNCBUSY.vec.CKEN & (1 << self->clock_unit)) != 0) { + } // Init the serializer after the clock. Otherwise, it will never enable because its unclocked. #ifdef SAMD21 I2S->CTRLA.vec.SEREN = 1 << self->serializer; - while ((I2S->SYNCBUSY.vec.SEREN & (1 << self->serializer)) != 0) {} + while ((I2S->SYNCBUSY.vec.SEREN & (1 << self->serializer)) != 0) { + } #endif #ifdef SAM_D5X_E5X I2S->CTRLA.bit.TXEN = 1; - while (I2S->SYNCBUSY.bit.TXEN == 1) {} + while (I2S->SYNCBUSY.bit.TXEN == 1) { + } #endif self->playing = true; } -void common_hal_audiobusio_i2sout_pause(audiobusio_i2sout_obj_t* self) { +void common_hal_audiobusio_i2sout_pause(audiobusio_i2sout_obj_t *self) { audio_dma_pause(&self->dma); } -void common_hal_audiobusio_i2sout_resume(audiobusio_i2sout_obj_t* self) { +void common_hal_audiobusio_i2sout_resume(audiobusio_i2sout_obj_t *self) { // Clear any overrun/underrun errors #ifdef SAMD21 I2S->INTFLAG.reg = I2S_INTFLAG_TXUR0 << self->serializer; @@ -345,29 +350,33 @@ void common_hal_audiobusio_i2sout_resume(audiobusio_i2sout_obj_t* self) { audio_dma_resume(&self->dma); } -bool common_hal_audiobusio_i2sout_get_paused(audiobusio_i2sout_obj_t* self) { +bool common_hal_audiobusio_i2sout_get_paused(audiobusio_i2sout_obj_t *self) { return audio_dma_get_paused(&self->dma); } -void common_hal_audiobusio_i2sout_stop(audiobusio_i2sout_obj_t* self) { +void common_hal_audiobusio_i2sout_stop(audiobusio_i2sout_obj_t *self) { audio_dma_stop(&self->dma); #ifdef SAMD21 I2S->CTRLA.vec.SEREN &= ~(1 << self->serializer); - while ((I2S->SYNCBUSY.vec.SEREN & (1 << self->serializer)) != 0) {} + while ((I2S->SYNCBUSY.vec.SEREN & (1 << self->serializer)) != 0) { + } #endif #ifdef SAM_D5X_E5X I2S->CTRLA.bit.TXEN = 0; - while (I2S->SYNCBUSY.bit.TXEN == 1) {} + while (I2S->SYNCBUSY.bit.TXEN == 1) { + } #endif #ifdef SAMD21 if (self->clock_unit == 0) { I2S->CTRLA.bit.CKEN0 = 0; - while (I2S->SYNCBUSY.bit.CKEN0 == 1) {} + while (I2S->SYNCBUSY.bit.CKEN0 == 1) { + } } else { I2S->CTRLA.bit.CKEN1 = 0; - while (I2S->SYNCBUSY.bit.CKEN1 == 1) {} + while (I2S->SYNCBUSY.bit.CKEN1 == 1) { + } } #endif disconnect_gclk_from_peripheral(self->gclk, I2S_GCLK_ID_0 + self->clock_unit); @@ -380,7 +389,7 @@ void common_hal_audiobusio_i2sout_stop(audiobusio_i2sout_obj_t* self) { self->playing = false; } -bool common_hal_audiobusio_i2sout_get_playing(audiobusio_i2sout_obj_t* self) { +bool common_hal_audiobusio_i2sout_get_playing(audiobusio_i2sout_obj_t *self) { bool still_playing = audio_dma_get_playing(&self->dma); if (self->playing && !still_playing) { common_hal_audiobusio_i2sout_stop(self); diff --git a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c.uncrustify b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c.uncrustify new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c.uncrustify diff --git a/ports/atmel-samd/modules/frozentest.py b/ports/atmel-samd/modules/frozentest.py index 0f99b7429..78cdd60bf 100644 --- a/ports/atmel-samd/modules/frozentest.py +++ b/ports/atmel-samd/modules/frozentest.py @@ -1,7 +1,7 @@ -print('uPy') -print('a long string that is not interned') -print('a string that has unicode αβγ chars') -print(b'bytes 1234\x01') +print("uPy") +print("a long string that is not interned") +print("a string that has unicode αβγ chars") +print(b"bytes 1234\x01") print(123456789) for i in range(4): print(i) diff --git a/ports/atmel-samd/tools/gen_pin_name_table.py b/ports/atmel-samd/tools/gen_pin_name_table.py index 4e25c39fd..a78144d40 100644 --- a/ports/atmel-samd/tools/gen_pin_name_table.py +++ b/ports/atmel-samd/tools/gen_pin_name_table.py @@ -27,11 +27,47 @@ import os import os.path -pins = ["PA00", "PA01", "PA02", "PA03", "PB08", "PB09", "PA04", "PA05", "PA06", - "PA07", "PA08", "PA09", "PA10", "PA11", "PB10", "PB11", "PA12", "PA13", - "PA14", "PA15", "PA16", "PA17", "PA18", "PA19", "PA20", "PA21", "PA22", - "PA23", "PA24", "PA25", "PB22", "PB23", "PA27", "PA28", "PA29", "PA30", - "PA31", "PB02", "PB03"] +pins = [ + "PA00", + "PA01", + "PA02", + "PA03", + "PB08", + "PB09", + "PA04", + "PA05", + "PA06", + "PA07", + "PA08", + "PA09", + "PA10", + "PA11", + "PB10", + "PB11", + "PA12", + "PA13", + "PA14", + "PA15", + "PA16", + "PA17", + "PA18", + "PA19", + "PA20", + "PA21", + "PA22", + "PA23", + "PA24", + "PA25", + "PB22", + "PB23", + "PA27", + "PA28", + "PA29", + "PA30", + "PA31", + "PB02", + "PB03", +] # Dictionary keys: [board][pin] = list of pin names mapping = {} @@ -46,7 +82,7 @@ for board in os.listdir("boards"): for line in f: if line.startswith(QSTR): board_name, _, pin = line.split(")") - board_name = board_name[len(QSTR):] + board_name = board_name[len(QSTR) :] pin = pin[-8:-4] if pin not in mapping[board]: mapping[board][pin] = [] @@ -108,61 +144,196 @@ ALL_BUT_USB.remove("PA25") # dictionary is [module][class] = [pins] capabilities = { - "analogio" : { - "AnalogIn" : ["PA02", "PA03", "PB08", "PB09", "PA04", "PA05", "PA06", - "PA07", "PA08", "PA09", "PA10", "PA11", "PB02", "PB03"], - "AnalogOut": ["PA02"] - }, - "audioio" : { - "AudioOut": ["PA02"] - }, - "bitbangio": { - "I2C": ALL_BUT_USB, - "OneWire": ALL_BUT_USB, - "SPI": ALL_BUT_USB + "analogio": { + "AnalogIn": [ + "PA02", + "PA03", + "PB08", + "PB09", + "PA04", + "PA05", + "PA06", + "PA07", + "PA08", + "PA09", + "PA10", + "PA11", + "PB02", + "PB03", + ], + "AnalogOut": ["PA02"], }, + "audioio": {"AudioOut": ["PA02"]}, + "bitbangio": {"I2C": ALL_BUT_USB, "OneWire": ALL_BUT_USB, "SPI": ALL_BUT_USB}, "busio": { - "I2C - SDA": ["PA00", "PB08", "PA08", "PA12", "PA16", "PA22", "PB02"], # SERCOM pad 0 - "I2C - SCL": ["PA01", "PB09", "PA09", "PA13", "PA17", "PA23", "PB03"], # SERCOM pad 1 + "I2C - SDA": ["PA00", "PB08", "PA08", "PA12", "PA16", "PA22", "PB02"], # SERCOM pad 0 + "I2C - SCL": ["PA01", "PB09", "PA09", "PA13", "PA17", "PA23", "PB03"], # SERCOM pad 1 "OneWire": ALL_BUT_USB, - "SPI - MISO": ["PA00", "PA01", "PB08", "PB09", "PA04", "PA05", "PA06", - "PA07", "PA08", "PA09", "PA10", "PA11", "PB10", "PB11", - "PA12", "PA13", "PA14", "PA15", "PA16", "PA17", "PA18", - "PA19", "PA20", "PA21", "PA22", "PA23", "PB22", "PB23", - "PA30", "PA31", "PB02", "PB03"], # any SERCOM pad - "SPI - MOSI": ["PA00", "PB08", "PA04", "PA06", "PA08", "PA10", "PA11", - "PB10", "PB11", "PA14", "PA15", "PA16", "PA18", "PA19", - "PA20", "PA21", "PA22", "PB22", "PB23", "PA30", "PA31", - "PB02"], # any pad but 1 - "SPI - SCK": ["PA01", "PB09", "PA05", "PA07", "PA09", "PA11", "PB11", - "PA13", "PA15", "PA17", "PA19", "PA21", "PA23", "PB23", - "PA31", "PB03"], # 1 or 3 - "UART - RX": ["PA00", "PA01", "PB08", "PB09", "PA04", "PA05", "PA06", - "PA07", "PA08", "PA09", "PA10", "PA11", "PB10", "PB11", - "PA12", "PA13", "PA14", "PA15", "PA16", "PA17", "PA18", - "PA19", "PA20", "PA21", "PA22", "PA23", "PB22", "PB23", - "PA30", "PA31", "PB02", "PB03"], # any pad - "UART - TX": ["PA00", "PB08", "PA04", "PA06", "PA08", "PA10", "PB10", - "PA12", "PA14", "PA16", "PA18", "PA20", "PA22", "PB22", - "PA30", "PB02"] # pad 0 or 2 - }, - "digitalio": { - "DigitalInOut": ALL_BUT_USB + "SPI - MISO": [ + "PA00", + "PA01", + "PB08", + "PB09", + "PA04", + "PA05", + "PA06", + "PA07", + "PA08", + "PA09", + "PA10", + "PA11", + "PB10", + "PB11", + "PA12", + "PA13", + "PA14", + "PA15", + "PA16", + "PA17", + "PA18", + "PA19", + "PA20", + "PA21", + "PA22", + "PA23", + "PB22", + "PB23", + "PA30", + "PA31", + "PB02", + "PB03", + ], # any SERCOM pad + "SPI - MOSI": [ + "PA00", + "PB08", + "PA04", + "PA06", + "PA08", + "PA10", + "PA11", + "PB10", + "PB11", + "PA14", + "PA15", + "PA16", + "PA18", + "PA19", + "PA20", + "PA21", + "PA22", + "PB22", + "PB23", + "PA30", + "PA31", + "PB02", + ], # any pad but 1 + "SPI - SCK": [ + "PA01", + "PB09", + "PA05", + "PA07", + "PA09", + "PA11", + "PB11", + "PA13", + "PA15", + "PA17", + "PA19", + "PA21", + "PA23", + "PB23", + "PA31", + "PB03", + ], # 1 or 3 + "UART - RX": [ + "PA00", + "PA01", + "PB08", + "PB09", + "PA04", + "PA05", + "PA06", + "PA07", + "PA08", + "PA09", + "PA10", + "PA11", + "PB10", + "PB11", + "PA12", + "PA13", + "PA14", + "PA15", + "PA16", + "PA17", + "PA18", + "PA19", + "PA20", + "PA21", + "PA22", + "PA23", + "PB22", + "PB23", + "PA30", + "PA31", + "PB02", + "PB03", + ], # any pad + "UART - TX": [ + "PA00", + "PB08", + "PA04", + "PA06", + "PA08", + "PA10", + "PB10", + "PA12", + "PA14", + "PA16", + "PA18", + "PA20", + "PA22", + "PB22", + "PA30", + "PB02", + ], # pad 0 or 2 }, + "digitalio": {"DigitalInOut": ALL_BUT_USB}, "pulseio": { "PulseIn": ALL_BUT_USB, - "PWMOut": ["PA01", "PB09", "PA04", "PA05", "PA06", "PA07", "PA08", - "PA09", "PA10", "PA11", "PB10", "PB11", "PA12", "PA13", - "PA14", "PA15", "PA16", "PA17", "PA18", "PA19", "PA20", - "PA21", "PA22", "PA23", "PA30", "PA31"] - }, - "ps2io": { - "Ps2": ALL_BUT_USB, + "PWMOut": [ + "PA01", + "PB09", + "PA04", + "PA05", + "PA06", + "PA07", + "PA08", + "PA09", + "PA10", + "PA11", + "PB10", + "PB11", + "PA12", + "PA13", + "PA14", + "PA15", + "PA16", + "PA17", + "PA18", + "PA19", + "PA20", + "PA21", + "PA22", + "PA23", + "PA30", + "PA31", + ], }, + "ps2io": {"Ps2": ALL_BUT_USB}, "touchio": { - "TouchIn": ["PA02", "PA03", "PB08", "PB09", "PA04", "PA05", "PA06", - "PA07", "PB02", "PB03"] - } + "TouchIn": ["PA02", "PA03", "PB08", "PB09", "PA04", "PA05", "PA06", "PA07", "PB02", "PB03"] + }, } column_width = {} @@ -178,7 +349,7 @@ for module in capabilities: module_width[module] -= 2 if module_width[module] < (len(module) + 2): - column_width[module + c] += (len(module) + 2 - module_width[module]) + column_width[module + c] += len(module) + 2 - module_width[module] module_width[module] = len(module) + 2 first_column_width = len("`microcontroller.pin`") diff --git a/ports/atmel-samd/tools/mkcandata.py b/ports/atmel-samd/tools/mkcandata.py index 9668d2208..d505c81bd 100755 --- a/ports/atmel-samd/tools/mkcandata.py +++ b/ports/atmel-samd/tools/mkcandata.py @@ -1,22 +1,27 @@ #!/usr/bin/python3 + def defines(name, suffix): - print(f'mcu_pin_function_t {name} [] = {{') + print(f"mcu_pin_function_t {name} [] = {{") for instance in (0, 1): - for function in 'HI': - for port in 'ABCD': + for function in "HI": + for port in "ABCD": for idx in range(32): - pin = f'P{port}{idx:02d}' - pinmux = f'PINMUX_{pin}{function}_CAN{instance}_{suffix}' - print(f'''\ + pin = f"P{port}{idx:02d}" + pinmux = f"PINMUX_{pin}{function}_CAN{instance}_{suffix}" + print( + f"""\ #if defined({pinmux}) && ! defined(IGNORE_PIN_{pin}) {{&pin_{pin}, {instance}, PIN_{pin}, {pinmux} & 0xffff}}, -#endif''') - print(f'{{NULL, 0, 0}}') - print(f'}};') +#endif""" + ) + print(f"{{NULL, 0, 0}}") + print(f"}};") print() -print('''\ + +print( + """\ #include <stdint.h> #include "py/obj.h" #include "sam.h" @@ -25,7 +30,8 @@ print('''\ #include "atmel_start_pins.h" #include "hal/include/hal_gpio.h" #include "common-hal/microcontroller/Pin.h" -''') +""" +) -defines('can_rx', 'RX') -defines('can_tx', 'TX') +defines("can_rx", "RX") +defines("can_tx", "TX") diff --git a/ports/atmel-samd/tools/mksdiodata.py b/ports/atmel-samd/tools/mksdiodata.py index 48c4a085f..bfdcd696c 100755 --- a/ports/atmel-samd/tools/mksdiodata.py +++ b/ports/atmel-samd/tools/mksdiodata.py @@ -1,21 +1,26 @@ #!/usr/bin/python3 + def defines(name, function): - print(f'mcu_pin_function_t {name} [] = {{') + print(f"mcu_pin_function_t {name} [] = {{") for instance in (0, 1): - for port in 'ABCD': + for port in "ABCD": for idx in range(32): - pin = f'P{port}{idx:02d}' - pinmux = f'PINMUX_{pin}I_SDHC{instance}_{function}' - print(f'''\ + pin = f"P{port}{idx:02d}" + pinmux = f"PINMUX_{pin}I_SDHC{instance}_{function}" + print( + f"""\ #if defined({pinmux}) && ! defined(IGNORE_PIN_{pin}) {{&pin_{pin}, {instance}, PIN_{pin}, {pinmux} & 0xffff}}, -#endif''') - print(f'{{NULL, 0, 0}}') - print(f'}};') +#endif""" + ) + print(f"{{NULL, 0, 0}}") + print(f"}};") print() -print('''\ + +print( + """\ #include <stdint.h> #include "py/obj.h" #include "sam.h" @@ -25,11 +30,12 @@ print('''\ #include "hal/include/hal_gpio.h" #include "common-hal/microcontroller/Pin.h" -''') +""" +) -defines('sdio_ck', 'SDCK') -defines('sdio_cmd', 'SDCMD') -defines('sdio_dat0', 'SDDAT0') -defines('sdio_dat1', 'SDDAT1') -defines('sdio_dat2', 'SDDAT2') -defines('sdio_dat3', 'SDDAT3') +defines("sdio_ck", "SDCK") +defines("sdio_cmd", "SDCMD") +defines("sdio_dat0", "SDDAT0") +defines("sdio_dat1", "SDDAT1") +defines("sdio_dat2", "SDDAT2") +defines("sdio_dat3", "SDDAT3") diff --git a/ports/atmel-samd/tools/update_asf.py b/ports/atmel-samd/tools/update_asf.py index 7b7bac10f..a747d6b06 100644 --- a/ports/atmel-samd/tools/update_asf.py +++ b/ports/atmel-samd/tools/update_asf.py @@ -11,7 +11,11 @@ for chip in ["samd21", "samd51"]: if not os.path.isfile(filename): with open("tools/" + chip + ".json", "r") as project_json: headers = {"content-type": "text/plain"} - r = requests.post("http://start.atmel.com/api/v1/generate/?format=atzip&compilers=[make]&file_name_base=My%20Project", headers=headers, data=project_json) + r = requests.post( + "http://start.atmel.com/api/v1/generate/?format=atzip&compilers=[make]&file_name_base=My%20Project", + headers=headers, + data=project_json, + ) if not r.ok: # Double check that the JSON is minified. If its not, you'll get a 404. print(r.text) @@ -40,7 +44,9 @@ for chip in ["samd21", "samd51"]: for patch in os.listdir("asf4/patches/" + chip): patch = "patches/" + chip + "/" + patch print(patch) - result = subprocess.run(["patch", "-l", "-F", "10", "-u", "-p", "1", "-d", tmp_dir, "-i", "../" + patch]) + result = subprocess.run( + ["patch", "-l", "-F", "10", "-u", "-p", "1", "-d", tmp_dir, "-i", "../" + patch] + ) ok = ok and result.returncode == 0 print() |
