SingingCat 0
application
main-header.h
1#ifndef MAIN_HEADER_H
2#define MAIN_HEADER_H 1
3
4#define REMAP_SPI1 1
5
6#define SPI_DEVICE_CC1101 1
7
8#define DELAY_DEFAULT 0
9#define DELAY_SERIAL 1
10#define DELAY_ESP2SERIAL 2
11#define DELAY_WRITESPI 3
12#define DELAY_TI1101 4
13
14#define MAIN_MCULIBHANDLE 1
15
19#define USART_CONSOLE 1
20#define USART_ESP8266 2
21
22#include <stdint.h>
23#include <stdarg.h>
24
25
26#include "platform-header.h"
27#include "ascii_parser.h"
28#include "ringbuffer.h"
29#include "packetbuffer.h"
30#include "fatal-error.h"
31#include "command-parser.h"
32#include "config.h"
33#include "espressif/esp8266.h"
34#include "espressif/esp8266_cloud.h"
35#include "strings-common.h"
36#include "addressing.h"
37#include "command-handler.h"
38#include "routing.h"
39#include "routing_functions.h"
40#include "crypt.h"
41#include "decode_esp_packet.h"
42#include "build_version.h"
43#include "onewire.h"
44#include "checksums.h"
45#include "multiram.h"
46#include "logging.h"
47#include "mculibrary.h"
48#include "loader-api.h"
49#include "reboot.h"
50#include "queue.h"
51
52
53long get_systickctr();
54long systick_diff(long timestamp);
55void Delay(uint32_t nTime);
56void TimingDelay_Decrement(void);
57
58int app_main(void);
59void process_command(struct command *com);
60int open_serial(int num, int baudrate);
61void set_baudrate(int num, int baudrate);
62int write_serial_char(int handle, char c);
63int write_serial_string(int handle, const char *txt);
64int write_serial_line(int handle, const char *txt);
65void serial_fail_port(int port);
66void serial_ok_port(int port);
67
68void restart_app(void) __attribute__((no_instrument_function));
69
70void usart_init();
71void reset_delay_counter(int n);
72int get_delay_counter(int n);
73void noop();
74
75int startsWith(const char *c1, const char *c2);
76
77void gpio_init(byte remap);
78void gpio_configure_pins(byte remap);
79void gpioa_on(int pin);
80void gpioa_off(int pin);
81void gpiob_on(int pin);
82void gpiob_off(int pin);
83void gpioc_on(int pin);
84void gpioc_off(int pin);
85//void gpio_enable_irq_on_pa0();
86//void gpio_disable_irq_on_pa0();
87void gpio_enable_irq_on_pb15();
88void gpio_disable_irq_on_pb15();
89
90byte is_gpiob_irq_triggered(int num);
91void clear_gpiob_irq(int num);
92
93byte get_status_of_gpio_b(int num);
94void system_reset();
95
96
97
98
99// flash abstraction layer
100/*
101 * int flash_write(const void *buf, const int size);
102 * int flash_read(void *buf, const int size);
103 * int flash_calc_crc(const void *buf, const int size);
104 */
105// return number of seconds since last boot
106long get_seconds_since_boot() __attribute__((no_instrument_function));
107
108void set_relay(int relay, int state, int timeout);
109void relay_counter();
110
111void mainentry(void);
112
113
114
115void UserSysTick_Handler(void);
116
117int app_main(void);
118// set to 1 to avoid printing to console
119void setquietflag(byte x);
120// set to 1 to printf to usb, otherwise will print to serialport
121void print_to_usb(int x);
122// print to somewhere sensible (serial/console/usb or so)
123void print(const char *txt);
124
125
126// return address where we store flash config
127void *get_flash_config_addr();
128void *get_flash_user_config_addr();
129
130// this will send a command via a given device. The way to address the device is platform independent, thus implementations for different platforms implement this in different ways.
131// returns 0 on success
132int send_buf_via_device(int dev, const byte *buf, int size);
133// get and consume next byte from console. if >255: no byte available
134uint16_t console_get_byte();
135int console_get_line(char *outbuf, int bufsize);
136// stick a byte into the console buffer as if it were received from console/usb
137void console_add_byte(uint8_t b);
138
139// clear the console buffer;
140void console_reset();
141
142void *sc_realloc(void *ptr, size_t size);
143void sc_free(void *ptr);
144
145void process_terminal_input();
146void print_program_status();
147void print_boot_info();
148#endif
int app_main(void)
Definition: main.c:839
void print_boot_info()
print startup information
Definition: boot_info.c:37
void process_command(struct command *com)
command is parsed, now execute it
definitions of routing table structures
definitions of routing table structures