RETRO ROBOT E
Dependencies: DisplayN18 ROBOT SC16IS750 mbed
main.cpp@0:757b151e589e, 2015-03-02 (annotated)
- Committer:
- RLRiedinger
- Date:
- Mon Mar 02 04:24:41 2015 +0000
- Revision:
- 0:757b151e589e
RETRO ROBOT E
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RLRiedinger | 0:757b151e589e | 1 | #include "mbed.h" |
RLRiedinger | 0:757b151e589e | 2 | #include "ROBOT.h" |
RLRiedinger | 0:757b151e589e | 3 | #include "SC16IS750.h" |
RLRiedinger | 0:757b151e589e | 4 | |
RLRiedinger | 0:757b151e589e | 5 | //#define AUTO_START |
RLRiedinger | 0:757b151e589e | 6 | |
RLRiedinger | 0:757b151e589e | 7 | #if defined(TARGET_LPC11U24) |
RLRiedinger | 0:757b151e589e | 8 | |
RLRiedinger | 0:757b151e589e | 9 | // SPI for LPC11U24 |
RLRiedinger | 0:757b151e589e | 10 | |
RLRiedinger | 0:757b151e589e | 11 | #define D_MOSI p5 |
RLRiedinger | 0:757b151e589e | 12 | #define D_MISO p6 |
RLRiedinger | 0:757b151e589e | 13 | #define D_SCLK p7 |
RLRiedinger | 0:757b151e589e | 14 | #define D_CS p8 |
RLRiedinger | 0:757b151e589e | 15 | |
RLRiedinger | 0:757b151e589e | 16 | #define D_INTR P0_15 |
RLRiedinger | 0:757b151e589e | 17 | #define D_RST P0_22 |
RLRiedinger | 0:757b151e589e | 18 | |
RLRiedinger | 0:757b151e589e | 19 | // I2C for LPC11U24 |
RLRiedinger | 0:757b151e589e | 20 | |
RLRiedinger | 0:757b151e589e | 21 | #define D_SCL P0_4 |
RLRiedinger | 0:757b151e589e | 22 | #define D_SDA P0_5 |
RLRiedinger | 0:757b151e589e | 23 | |
RLRiedinger | 0:757b151e589e | 24 | // Serial for LPC11U24 |
RLRiedinger | 0:757b151e589e | 25 | |
RLRiedinger | 0:757b151e589e | 26 | #define D_TX USBTX |
RLRiedinger | 0:757b151e589e | 27 | #define D_RX USBRX |
RLRiedinger | 0:757b151e589e | 28 | |
RLRiedinger | 0:757b151e589e | 29 | //#define D_RST p25 |
RLRiedinger | 0:757b151e589e | 30 | //#define D_STS p26 |
RLRiedinger | 0:757b151e589e | 31 | |
RLRiedinger | 0:757b151e589e | 32 | #define ESP8266_RST P0_10 |
RLRiedinger | 0:757b151e589e | 33 | |
RLRiedinger | 0:757b151e589e | 34 | DigitalOut esp8266_rst(ESP8266_RST); |
RLRiedinger | 0:757b151e589e | 35 | |
RLRiedinger | 0:757b151e589e | 36 | #endif |
RLRiedinger | 0:757b151e589e | 37 | |
RLRiedinger | 0:757b151e589e | 38 | ROBOT robot; |
RLRiedinger | 0:757b151e589e | 39 | |
RLRiedinger | 0:757b151e589e | 40 | char UART_BUFFER[81]; |
RLRiedinger | 0:757b151e589e | 41 | |
RLRiedinger | 0:757b151e589e | 42 | void debug_print(unsigned int line, const char* function) { |
RLRiedinger | 0:757b151e589e | 43 | |
RLRiedinger | 0:757b151e589e | 44 | sprintf(UART_BUFFER, "%6d %s\r\n", line, function); |
RLRiedinger | 0:757b151e589e | 45 | robot.serial_print2(UART_BUFFER); |
RLRiedinger | 0:757b151e589e | 46 | |
RLRiedinger | 0:757b151e589e | 47 | |
RLRiedinger | 0:757b151e589e | 48 | } |
RLRiedinger | 0:757b151e589e | 49 | |
RLRiedinger | 0:757b151e589e | 50 | void debug_print_string(unsigned int line, const char* function, char * text) { |
RLRiedinger | 0:757b151e589e | 51 | |
RLRiedinger | 0:757b151e589e | 52 | sprintf(UART_BUFFER, "%6d %s %s\r\n", line, function, text); |
RLRiedinger | 0:757b151e589e | 53 | robot.serial_print2(UART_BUFFER); |
RLRiedinger | 0:757b151e589e | 54 | |
RLRiedinger | 0:757b151e589e | 55 | |
RLRiedinger | 0:757b151e589e | 56 | } |
RLRiedinger | 0:757b151e589e | 57 | |
RLRiedinger | 0:757b151e589e | 58 | int main() { |
RLRiedinger | 0:757b151e589e | 59 | |
RLRiedinger | 0:757b151e589e | 60 | robot.showSplashScreen(); |
RLRiedinger | 0:757b151e589e | 61 | |
RLRiedinger | 0:757b151e589e | 62 | robot.get_options(); |
RLRiedinger | 0:757b151e589e | 63 | |
RLRiedinger | 0:757b151e589e | 64 | //while (true) |
RLRiedinger | 0:757b151e589e | 65 | // robot.tick(); |
RLRiedinger | 0:757b151e589e | 66 | |
RLRiedinger | 0:757b151e589e | 67 | } |