![](/media/cache/group/orange_and_cat.png.50x50_q85.jpg)
pwm period is now 200us instead of the default 20ms veml6040 config is now AF_BIT | TRIG_BIT
Dependencies: mbed MMA8451Q USBDevice WakeUp vt100
Fork of afero_node_suntory_2017_06_15 by
main.cpp@2:dfe671e31221, 2017-01-24 (annotated)
- Committer:
- wataloh
- Date:
- Tue Jan 24 10:00:28 2017 +0000
- Revision:
- 2:dfe671e31221
- Parent:
- 1:b2a9a6f2c30e
- Child:
- 5:9d5c7ee80f3b
latest
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wataloh | 0:20bce0dcc921 | 1 | #include "mbed.h" |
wataloh | 0:20bce0dcc921 | 2 | #include "AferoCommHndlr.h" |
wataloh | 0:20bce0dcc921 | 3 | #include "pin_defines.h" |
wataloh | 0:20bce0dcc921 | 4 | #include "debugIO.h" |
wataloh | 0:20bce0dcc921 | 5 | #include "RTC_Handler.h" |
wataloh | 1:b2a9a6f2c30e | 6 | #include "Preferences.hpp" |
wataloh | 2:dfe671e31221 | 7 | #include "WakeUp.h" |
wataloh | 0:20bce0dcc921 | 8 | |
wataloh | 0:20bce0dcc921 | 9 | Timer t; |
wataloh | 2:dfe671e31221 | 10 | /* |
wataloh | 2:dfe671e31221 | 11 | template<typename A> class DebugIO |
wataloh | 2:dfe671e31221 | 12 | { |
wataloh | 2:dfe671e31221 | 13 | static A* self; |
wataloh | 2:dfe671e31221 | 14 | public: |
wataloh | 2:dfe671e31221 | 15 | template<typename... Args> void printf(Args... args) |
wataloh | 2:dfe671e31221 | 16 | { |
wataloh | 2:dfe671e31221 | 17 | self->mof(args...); |
wataloh | 2:dfe671e31221 | 18 | } |
wataloh | 2:dfe671e31221 | 19 | }; |
wataloh | 0:20bce0dcc921 | 20 | |
wataloh | 2:dfe671e31221 | 21 | template<typename A> A* DebugIO<A>::self = NULL; |
wataloh | 2:dfe671e31221 | 22 | |
wataloh | 2:dfe671e31221 | 23 | class DBGO : public DebugIO<DBGO> |
wataloh | 2:dfe671e31221 | 24 | { |
wataloh | 2:dfe671e31221 | 25 | public: |
wataloh | 2:dfe671e31221 | 26 | void mof(const char* fmt, ...) |
wataloh | 2:dfe671e31221 | 27 | { |
wataloh | 2:dfe671e31221 | 28 | va_list args; |
wataloh | 2:dfe671e31221 | 29 | va_start(args,fmt); |
wataloh | 2:dfe671e31221 | 30 | vprintf(fmt,args); |
wataloh | 2:dfe671e31221 | 31 | va_end(args); |
wataloh | 2:dfe671e31221 | 32 | } |
wataloh | 2:dfe671e31221 | 33 | }; |
wataloh | 2:dfe671e31221 | 34 | */ |
wataloh | 0:20bce0dcc921 | 35 | int |
wataloh | 0:20bce0dcc921 | 36 | main() |
wataloh | 0:20bce0dcc921 | 37 | { |
wataloh | 2:dfe671e31221 | 38 | // DBGO dbgo; |
wataloh | 2:dfe671e31221 | 39 | // dbgo.printf("hi"); |
wataloh | 2:dfe671e31221 | 40 | WakeUp::calibrate(); |
wataloh | 2:dfe671e31221 | 41 | wait_ms(1000); |
wataloh | 0:20bce0dcc921 | 42 | t.start(); |
wataloh | 0:20bce0dcc921 | 43 | initDebugIO(); |
wataloh | 0:20bce0dcc921 | 44 | RTC_Handler::getInstance()->setUTC(1483228800); |
wataloh | 0:20bce0dcc921 | 45 | time_t t_t = RTC_Handler::getInstance()->getUTC(); |
wataloh | 0:20bce0dcc921 | 46 | mbedSPI mbedspi; |
wataloh | 1:b2a9a6f2c30e | 47 | DigitalOut ASR1Reset( |
wataloh | 1:b2a9a6f2c30e | 48 | (PinName)PINS::ASR_1::RESET, |
wataloh | 1:b2a9a6f2c30e | 49 | PINS::ASR_1::SIG::RESET::DEASSERT); |
wataloh | 1:b2a9a6f2c30e | 50 | ASR1Reset = PINS::ASR_1::SIG::RESET::ASSERT; |
wataloh | 1:b2a9a6f2c30e | 51 | wait_ms(1000); |
wataloh | 1:b2a9a6f2c30e | 52 | ASR1Reset = PINS::ASR_1::SIG::RESET::DEASSERT; |
wataloh | 1:b2a9a6f2c30e | 53 | wait_ms(1000); |
wataloh | 0:20bce0dcc921 | 54 | AferoCommHndlr *aHnd = AferoCommHndlr::create(&t,&mbedspi); |
wataloh | 0:20bce0dcc921 | 55 | while(1) { |
wataloh | 0:20bce0dcc921 | 56 | aHnd->loop(); |
wataloh | 0:20bce0dcc921 | 57 | } |
wataloh | 0:20bce0dcc921 | 58 | } |