Skip to content

Fix merge errors which were accidentally committed #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions src/current_sense/hardware_specific/samd21_mcu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ static void adcStopWithDMA(void);
static void adcStartWithDMA(void);

/**
<<<<<<< HEAD
* @brief ADC sync wait
=======
* @brief ADC sync wait
>>>>>>> dev
* @retval void
*/
static __inline__ void ADCsync() __attribute__((always_inline, unused));
Expand All @@ -86,15 +82,9 @@ static void ADCsync() {

// ADC DMA sequential free running (6) with Interrupts /////////////////

<<<<<<< HEAD
SAMDCurrentSenseADCDMA * SAMDCurrentSenseADCDMA::getHardwareAPIInstance()
{

=======
SAMDCurrentSenseADCDMA * SAMDCurrentSenseADCDMA::getHardwareAPIInstance()
{

>>>>>>> dev
return &instance;
}

Expand Down Expand Up @@ -146,11 +136,7 @@ float SAMDCurrentSenseADCDMA::toVolts(uint16_t counts) {
}

void SAMDCurrentSenseADCDMA::initPins(){
<<<<<<< HEAD

=======

>>>>>>> dev
pinMode(pinAREF, INPUT);
pinMode(pinA, INPUT);
pinMode(pinB, INPUT);
Expand All @@ -159,11 +145,7 @@ void SAMDCurrentSenseADCDMA::initPins(){
uint32_t ainB = g_APinDescription[pinB].ulADCChannelNumber;
firstAIN = min(ainA, ainB);
lastAIN = max(ainA, ainB);
<<<<<<< HEAD
if( _isset(pinC) )
=======
if( _isset(pinC) )
>>>>>>> dev
{
uint32_t ainC = g_APinDescription[pinC].ulADCChannelNumber;
pinMode(pinC, INPUT);
Expand All @@ -178,23 +160,13 @@ void SAMDCurrentSenseADCDMA::initPins(){

void SAMDCurrentSenseADCDMA::initADC(){

<<<<<<< HEAD
analogRead(pinA); // do some pin init pinPeripheral()
analogRead(pinB); // do some pin init pinPeripheral()
analogRead(pinC); // do some pin init pinPeripheral()

ADC->CTRLA.bit.ENABLE = 0x00; // Disable ADC
ADCsync();
//ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC0_Val; // 2.2297f V Supply VDDANA
=======
analogRead(pinA); // do some pin init pinPeripheral()
analogRead(pinB); // do some pin init pinPeripheral()
analogRead(pinC); // do some pin init pinPeripheral()

ADC->CTRLA.bit.ENABLE = 0x00; // Disable ADC
ADCsync();
//ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC0_Val; // 2.2297 V Supply VDDANA
>>>>>>> dev
ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain select as 1X
// ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_DIV2_Val; // default
ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_AREFA;
Expand Down Expand Up @@ -243,11 +215,7 @@ void SAMDCurrentSenseADCDMA::initADC(){
*/
ADC->INPUTCTRL.bit.MUXPOS = oneBeforeFirstAIN;
ADCsync();
<<<<<<< HEAD
ADC->INPUTCTRL.bit.INPUTSCAN = lastAIN; // so the adc will scan from oneBeforeFirstAIN to lastAIN (inclusive)
=======
ADC->INPUTCTRL.bit.INPUTSCAN = lastAIN; // so the adc will scan from oneBeforeFirstAIN to lastAIN (inclusive)
>>>>>>> dev
ADCsync();
ADC->INPUTCTRL.bit.INPUTOFFSET = 0; //input scan cursor
ADCsync();
Expand Down Expand Up @@ -278,15 +246,9 @@ void SAMDCurrentSenseADCDMA::adcToDMATransfer(void *rxdata, uint32_t hwords) {
DMAC->CHCTRLA.reg &= ~DMAC_CHCTRLA_ENABLE;
DMAC->CHCTRLA.reg = DMAC_CHCTRLA_SWRST;
DMAC->SWTRIGCTRL.reg &= (uint32_t)(~(1 << channelDMA));
<<<<<<< HEAD

DMAC->CHCTRLB.reg = DMAC_CHCTRLB_LVL(0)
| DMAC_CHCTRLB_TRIGSRC(ADC_DMAC_ID_RESRDY)
=======

DMAC->CHCTRLB.reg = DMAC_CHCTRLB_LVL(0)
| DMAC_CHCTRLB_TRIGSRC(ADC_DMAC_ID_RESRDY)
>>>>>>> dev
| DMAC_CHCTRLB_TRIGACT_BEAT;
DMAC->CHINTENSET.reg = DMAC_CHINTENSET_MASK ; // enable all 3 interrupts
descriptor.descaddr = 0;
Expand Down Expand Up @@ -327,11 +289,7 @@ void adcStartWithDMA(void){
ADCsync();
ADC->SWTRIG.bit.FLUSH = 1;
ADCsync();
<<<<<<< HEAD
ADC->CTRLA.bit.ENABLE = 0x01;
=======
ADC->CTRLA.bit.ENABLE = 0x01;
>>>>>>> dev
ADCsync();
}

Expand Down