lol: throw exception(s) on fatal errors

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Jon Trulson 2015-09-10 13:19:05 -06:00 committed by Mihai Tudor Panu
parent 7323b58b61
commit 77abd94682

View File

@ -23,6 +23,8 @@
*/
#include <iostream>
#include <string>
#include <stdexcept>
#include <unistd.h>
#include <stdlib.h>
#include <functional>
@ -136,7 +138,15 @@ LoL::LoL() {
int i = 0;
mraa_result_t error;
for (i = 0; i < 12; i++)
m_LoLCtx[i] = mraa_gpio_init(i+2);
{
if ( !(m_LoLCtx[i] = mraa_gpio_init(i+2)) )
{
throw std::invalid_argument(std::string(__FUNCTION__) +
": mraa_gpio_init() failed, invalid pin?");
return;
}
}
memset(framebuffer, 0, LOL_X*LOL_Y);