Skip to content

Commit

Permalink
add error
Browse files Browse the repository at this point in the history
  • Loading branch information
wxkim committed Sep 10, 2024
1 parent da53682 commit 7f59de9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 1 addition & 4 deletions Platform/Interfaces/iadc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ namespace platform

//adc operations
virtual uint16_t convert() const = 0;
virtual void write() = 0;

//buffer mngmt
//virtual void read() = 0;
virtual void writeToBuffer() = 0;

private:

Expand Down
15 changes: 13 additions & 2 deletions Platform/STM/F4/ADC/adc_stmf4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,24 @@ namespace platform {
else {//use during debug

printf("HAL ADC error code: "+HAL_ADC_GetError(hadc));
return 0x0000; //
}

}

void AdcStmF4::write() //redundant?
void AdcStmF4::writeToBuffer() //redundant?
{
uint16_t value = convert();
uint16_t ADC_Conversion_Result = convert();

if( (adc_buf != nullptr) && (adc_buf->size() < buffer_size) )
{
adc_buf->push_back(convert());
}

else
{//use during debug
printf("ADC Buffer Error or Buffer Full\n");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Platform/STM/F4/ADC/adc_stmf4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace platform {

uint16_t convert();

void write();
void writeToBuffer();

private:

Expand Down

0 comments on commit 7f59de9

Please sign in to comment.