2015-04-07 12:50:56 -06:00
|
|
|
/*
|
|
|
|
* Author: Jon Trulson <jtrulson@ics.com>
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2015-04-07 12:50:56 -06:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2015-04-07 12:50:56 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
2017-08-30 15:00:29 -07:00
|
|
|
|
2016-04-25 14:27:51 -07:00
|
|
|
#include "sx6119.hpp"
|
2015-04-07 12:50:56 -06:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
int
|
|
|
|
main(int argc, char** argv)
|
2015-04-07 12:50:56 -06:00
|
|
|
{
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
|
|
|
// Instantiate a SX6119 on digital pins 2 (power) and 3 (seek)
|
|
|
|
// This example was tested on the Grove FM Receiver.
|
|
|
|
|
|
|
|
upm::SX6119 radio(2, 3);
|
|
|
|
|
|
|
|
// if an argument was specified (any argument), seek to the next
|
|
|
|
// station, else just toggle the power.
|
2015-04-07 12:50:56 -06:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
cout << "Supply any argument to the command line to seek to the" << endl;
|
|
|
|
cout << "next station." << endl;
|
|
|
|
cout << "Running the example without an argument will toggle the" << endl;
|
|
|
|
cout << "power on or off." << endl;
|
2015-04-07 12:50:56 -06:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
cout << endl;
|
2015-04-07 12:50:56 -06:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
bool doSeek = false;
|
2015-04-07 12:50:56 -06:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
if (argc > 1)
|
|
|
|
doSeek = true;
|
2015-04-07 12:50:56 -06:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
// depending on what was selected, do it
|
2015-04-07 12:50:56 -06:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
if (doSeek)
|
|
|
|
radio.seek();
|
|
|
|
else
|
|
|
|
radio.togglePower();
|
2015-04-07 12:50:56 -06:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
2015-04-07 12:50:56 -06:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
cout << "Exiting..." << endl;
|
2015-04-07 12:50:56 -06:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
return 0;
|
2015-04-07 12:50:56 -06:00
|
|
|
}
|