MySensors Library & Examples  2.3.2
MyHwSTM32F1.h
1 /*
2  * The MySensors Arduino library handles the wireless radio link and protocol
3  * between your home built sensors/actuators and HA controller of choice.
4  * The sensors forms a self healing radio network with optional repeaters. Each
5  * repeater and gateway builds a routing tables in EEPROM which keeps track of the
6  * network topology allowing messages to be routed to nodes.
7  *
8  * Created by Henrik Ekblad <[email protected]>
9  * Copyright (C) 2013-2019 Sensnology AB
10  * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
11  *
12  * Documentation: http://www.mysensors.org
13  * Support Forum: http://forum.mysensors.org
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * version 2 as published by the Free Software Foundation.
18  */
19 
20 #ifndef MyHwSTM32F1_h
21 #define MyHwSTM32F1_h
22 
23 #include <libmaple/iwdg.h>
24 #include <itoa.h>
25 #include <EEPROM.h>
26 #include <SPI.h>
27 
28 #ifdef __cplusplus
29 #include <Arduino.h>
30 #endif
31 
32 #define CRYPTO_LITTLE_ENDIAN
33 
34 #ifndef MY_SERIALDEVICE
35 #define MY_SERIALDEVICE Serial
36 #endif
37 
38 #ifndef MY_DEBUGDEVICE
39 #define MY_DEBUGDEVICE MY_SERIALDEVICE
40 #endif
41 
42 #ifndef MY_STM32F1_TEMPERATURE_OFFSET
43 #define MY_STM32F1_TEMPERATURE_OFFSET (0.0f)
44 #endif
45 
46 #ifndef MY_STM32F1_TEMPERATURE_GAIN
47 #define MY_STM32F1_TEMPERATURE_GAIN (1.0f)
48 #endif
49 
50 // SS default
51 #ifndef SS
52 #define SS PA4
53 #endif
54 
55 // mapping
56 #define snprintf_P snprintf
57 #define vsnprintf_P vsnprintf
58 #define strncpy_P strncpy
59 #define printf_P printf
60 #define yield() // not defined
61 
62 #ifndef digitalPinToInterrupt
63 #define digitalPinToInterrupt(__pin) (__pin)
64 #endif
65 
66 #define hwDigitalWrite(__pin, __value) digitalWrite(__pin, __value)
67 #define hwDigitalRead(__pin) digitalRead(__pin)
68 #define hwPinMode(__pin, __value) pinMode(__pin, __value)
69 #define hwWatchdogReset() iwdg_feed()
70 #define hwReboot() nvic_sys_reset()
71 #define hwMillis() millis()
72 #define hwGetSleepRemaining() (0ul)
73 
74 extern void serialEventRun(void) __attribute__((weak));
75 bool hwInit(void);
76 void hwRandomNumberInit(void);
77 void hwReadConfigBlock(void *buf, void *addr, size_t length);
78 void hwWriteConfigBlock(void *buf, void *addr, size_t length);
79 void hwWriteConfig(const int addr, uint8_t value);
80 uint8_t hwReadConfig(const int addr);
81 
82 // SOFTSPI
83 #ifdef MY_SOFTSPI
84 #error Soft SPI is not available on this architecture!
85 #endif
86 #define hwSPI SPI
87 
88 
89 #ifndef DOXYGEN
90 #define MY_CRITICAL_SECTION
91 #endif /* DOXYGEN */
92 
93 #endif
__attribute__
struct @4::@5 __attribute__
Doxygen will complain without this comment.
Definition: DigitalPin.h:65