Add Winbond 25Q128 flash driver
[betaflight.git] / src / main / target / CRAZYFLIE2 / syslink.h
bloba0b59eb23a2ca6566badecfed20b756b90dcc2e4
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
24 * This file contains definitions for the syslink protocol, a UART-based
25 * protocol for communication between the NRF51 MCU and the STM32 MCU on
26 * the Crazyflie flight controller board.
28 * For more details, see https://wiki.bitcraze.io/doc:crazyflie:syslink:index
31 #define SYSLINK_MTU 32
33 #define SYSLINK_START_BYTE1 0xBC
34 #define SYSLINK_START_BYTE2 0xCF
36 #define SYSLINK_RADIO_GROUP 0x00
37 #define SYSLINK_RADIO_RAW 0x00
38 #define SYSLINK_RADIO_CHANNEL 0x01
39 #define SYSLINK_RADIO_DATARATE 0x02
40 #define SYSLINK_RADIO_CONTWAVE 0x03
41 #define SYSLINK_RADIO_RSSI 0x04
42 #define SYSLINK_RADIO_ADDRESS 0x05
43 #define SYSLINK_RADIO_RAW_BROADCAST 0x06
45 #define SYSLINK_PM_GROUP 0x10
46 #define SYSLINK_PM_SOURCE 0x10
47 #define SYSLINK_PM_ONOFF_SWITCHOFF 0x11
48 #define SYSLINK_PM_BATTERY_VOLTAGE 0x12
49 #define SYSLINK_PM_BATTERY_STATE 0x13
50 #define SYSLINK_PM_BATTERY_AUTOUPDATE 0x14
52 #define SYSLINK_OW_GROUP 0x20
53 #define SYSLINK_OW_SCAN 0x20
54 #define SYSLINK_OW_GETINFO 0x21
55 #define SYSLINK_OW_READ 0x22
56 #define SYSLINK_OW_WRITE 0x23
58 typedef struct syslinkPacket_s
60 uint8_t type;
61 uint8_t length;
62 char data[SYSLINK_MTU];
63 } __attribute__((packed)) syslinkPacket_t;
65 // State machine states for receiving syslink packets
66 typedef enum
68 waitForFirstStart,
69 waitForSecondStart,
70 waitForType,
71 waitForLength,
72 waitForData,
73 waitForChksum1,
74 waitForChksum2
75 } syslinkRxState_e;