generated from RIT-EVT/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8da414f
commit 6ced744
Showing
5 changed files
with
51 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* This is a basic sample to show how the current sensing feature of the | ||
* LVSS using the INA138 IC | ||
*/ | ||
|
||
#include <EVT/io/CANopen.hpp> | ||
#include <EVT/io/GPIO.hpp> | ||
#include <EVT/io/UART.hpp> | ||
#include <EVT/io/pin.hpp> | ||
#include <EVT/manager.hpp> | ||
#include <EVT/utils/log.hpp> | ||
#include <EVT/utils/time.hpp> | ||
#include <LVSS.hpp> | ||
|
||
namespace IO = EVT::core::IO; | ||
namespace DEV = EVT::core::DEV; | ||
namespace time = EVT::core::time; | ||
namespace log = EVT::core::log; | ||
namespace types = EVT::core::types; | ||
using namespace std; | ||
|
||
int main(){ | ||
// Initialize system | ||
EVT::core::platform::init(); | ||
|
||
// Setup UART | ||
IO::UART& uart = IO::getUART<IO::Pin::UART_TX, IO::Pin::UART_RX>(9600); | ||
log::LOGGER.setUART(&uart); | ||
log::LOGGER.setLogLevel(log::Logger::LogLevel::INFO); | ||
|
||
//ADC | ||
IO::ADC& adc0 = IO::getADC<IO::Pin::PA_1>(); | ||
|
||
LVSS::INA138 ina138(adc0); | ||
|
||
while(1){ | ||
uart.printf("ADC0: %d\r\n mA", ina138.readCurrent(adc0)); | ||
time::wait(500); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters