PICO I2C FW
Dependencies: USBDevice
PicoCommands.h@28:c6fb76beb476, 2021-12-29 (annotated)
- Committer:
- walterluu
- Date:
- Wed Dec 29 07:00:48 2021 +0000
- Revision:
- 28:c6fb76beb476
- Parent:
- 27:72e40a8d3001
PICO I2C FW
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cyberjoey | 27:72e40a8d3001 | 1 | #ifndef PICOCOMMANDS_H |
cyberjoey | 27:72e40a8d3001 | 2 | #define PICOCOMMANDS_H |
cyberjoey | 27:72e40a8d3001 | 3 | |
cyberjoey | 27:72e40a8d3001 | 4 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 5 | /// PICO USB HID supported commands (Report ID byte) |
cyberjoey | 27:72e40a8d3001 | 6 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 7 | enum UsbHidReportID |
cyberjoey | 27:72e40a8d3001 | 8 | { |
cyberjoey | 27:72e40a8d3001 | 9 | GenericHID = 0x00 |
cyberjoey | 27:72e40a8d3001 | 10 | }; |
cyberjoey | 27:72e40a8d3001 | 11 | |
cyberjoey | 27:72e40a8d3001 | 12 | enum UsbHidOpCode |
cyberjoey | 27:72e40a8d3001 | 13 | { |
cyberjoey | 27:72e40a8d3001 | 14 | GetEmbApp = 0x01, |
cyberjoey | 27:72e40a8d3001 | 15 | SetEmbApp = 0x02, |
cyberjoey | 27:72e40a8d3001 | 16 | |
cyberjoey | 27:72e40a8d3001 | 17 | I2CGet = 0x10, |
cyberjoey | 27:72e40a8d3001 | 18 | I2CSetCfg = 0x11, |
cyberjoey | 27:72e40a8d3001 | 19 | I2CWriteReg = 0x12, |
cyberjoey | 27:72e40a8d3001 | 20 | I2CReadReg = 0x13, |
cyberjoey | 27:72e40a8d3001 | 21 | I2CReadNoReg = 0x14, |
cyberjoey | 27:72e40a8d3001 | 22 | |
cyberjoey | 27:72e40a8d3001 | 23 | SpiGet = 0x20, |
cyberjoey | 27:72e40a8d3001 | 24 | SpiSet = 0x21, |
cyberjoey | 27:72e40a8d3001 | 25 | SpiWrite = 0x22, |
cyberjoey | 27:72e40a8d3001 | 26 | |
cyberjoey | 27:72e40a8d3001 | 27 | GpioGet = 0x30, |
cyberjoey | 27:72e40a8d3001 | 28 | GpioSetCfg = 0x31, |
cyberjoey | 27:72e40a8d3001 | 29 | GpioWrite = 0x32, |
cyberjoey | 27:72e40a8d3001 | 30 | GpioRead = 0x33, |
cyberjoey | 27:72e40a8d3001 | 31 | GpioIntFuncState = 0x34, |
cyberjoey | 27:72e40a8d3001 | 32 | GpioIntNotify = 0x35, |
cyberjoey | 27:72e40a8d3001 | 33 | |
cyberjoey | 27:72e40a8d3001 | 34 | PwmSetRaw = 0x40, |
cyberjoey | 27:72e40a8d3001 | 35 | PwmSetCfgRaw = 0x41, |
cyberjoey | 27:72e40a8d3001 | 36 | }; |
cyberjoey | 27:72e40a8d3001 | 37 | |
cyberjoey | 27:72e40a8d3001 | 38 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 39 | /// PICO USB HID General Get/Set opcodes |
cyberjoey | 27:72e40a8d3001 | 40 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 41 | enum UsbHidGetSet |
cyberjoey | 27:72e40a8d3001 | 42 | { |
cyberjoey | 27:72e40a8d3001 | 43 | VerNum = 0x00, |
cyberjoey | 27:72e40a8d3001 | 44 | VerStr = 0x01, |
cyberjoey | 27:72e40a8d3001 | 45 | BoardID = 0x02, |
cyberjoey | 27:72e40a8d3001 | 46 | ProdIDStr = 0x03, |
cyberjoey | 27:72e40a8d3001 | 47 | }; |
cyberjoey | 27:72e40a8d3001 | 48 | |
cyberjoey | 27:72e40a8d3001 | 49 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 50 | /// PICO USB HID SPI Get/Set opcodes |
cyberjoey | 27:72e40a8d3001 | 51 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 52 | enum UsbHidSpi |
cyberjoey | 27:72e40a8d3001 | 53 | { |
cyberjoey | 27:72e40a8d3001 | 54 | SetCfg = 0x00, |
cyberjoey | 27:72e40a8d3001 | 55 | GetCfg = 0x00, |
cyberjoey | 27:72e40a8d3001 | 56 | |
cyberjoey | 27:72e40a8d3001 | 57 | GetBusSpeedAll = 0x01, |
cyberjoey | 27:72e40a8d3001 | 58 | GetBusSpeedCur = 0x02, |
cyberjoey | 27:72e40a8d3001 | 59 | SetChipSelect = 0x03, |
cyberjoey | 27:72e40a8d3001 | 60 | }; |
cyberjoey | 27:72e40a8d3001 | 61 | |
cyberjoey | 27:72e40a8d3001 | 62 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 63 | /// PICO Supported Ports |
cyberjoey | 27:72e40a8d3001 | 64 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 65 | enum GpioPortID |
cyberjoey | 27:72e40a8d3001 | 66 | { |
cyberjoey | 27:72e40a8d3001 | 67 | GpioA = 0, |
cyberjoey | 27:72e40a8d3001 | 68 | GpioB = 1, |
cyberjoey | 27:72e40a8d3001 | 69 | GpioC = 2, |
cyberjoey | 27:72e40a8d3001 | 70 | }; |
cyberjoey | 27:72e40a8d3001 | 71 | |
cyberjoey | 27:72e40a8d3001 | 72 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 73 | /// PICO Supported Pin IDs |
cyberjoey | 27:72e40a8d3001 | 74 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 75 | enum GpioPinID |
cyberjoey | 27:72e40a8d3001 | 76 | { |
cyberjoey | 27:72e40a8d3001 | 77 | PinID0 = 0, |
cyberjoey | 27:72e40a8d3001 | 78 | PinID1 = 1, |
cyberjoey | 27:72e40a8d3001 | 79 | PinID2 = 2, |
cyberjoey | 27:72e40a8d3001 | 80 | PinID3 = 3, |
cyberjoey | 27:72e40a8d3001 | 81 | PinID4 = 4, |
cyberjoey | 27:72e40a8d3001 | 82 | PinID5 = 5, |
cyberjoey | 27:72e40a8d3001 | 83 | PinID6 = 6, |
cyberjoey | 27:72e40a8d3001 | 84 | PinID7 = 7, |
cyberjoey | 27:72e40a8d3001 | 85 | PinID8 = 8, |
cyberjoey | 27:72e40a8d3001 | 86 | PinID9 = 9, |
cyberjoey | 27:72e40a8d3001 | 87 | PinID10 = 10, |
cyberjoey | 27:72e40a8d3001 | 88 | PinID11 = 11, |
cyberjoey | 27:72e40a8d3001 | 89 | PinID12 = 12, |
cyberjoey | 27:72e40a8d3001 | 90 | PinID13 = 13, |
cyberjoey | 27:72e40a8d3001 | 91 | PinID14 = 14, |
cyberjoey | 27:72e40a8d3001 | 92 | PinID15 = 15, |
cyberjoey | 27:72e40a8d3001 | 93 | }; |
cyberjoey | 27:72e40a8d3001 | 94 | |
cyberjoey | 27:72e40a8d3001 | 95 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 96 | /// PICO Supported Pin modes |
cyberjoey | 27:72e40a8d3001 | 97 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 98 | enum GpioPinMode |
cyberjoey | 27:72e40a8d3001 | 99 | { |
cyberjoey | 27:72e40a8d3001 | 100 | InputFloating = 0, |
cyberjoey | 27:72e40a8d3001 | 101 | InputPullup = 1, |
cyberjoey | 27:72e40a8d3001 | 102 | InputPulldown = 2, |
cyberjoey | 27:72e40a8d3001 | 103 | OutputOpenDrain = 3, |
cyberjoey | 27:72e40a8d3001 | 104 | OutputPushpull = 4 |
cyberjoey | 27:72e40a8d3001 | 105 | }; |
cyberjoey | 27:72e40a8d3001 | 106 | |
cyberjoey | 27:72e40a8d3001 | 107 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 108 | /// PICO Supported Interrupt Functional States |
cyberjoey | 27:72e40a8d3001 | 109 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 110 | enum GpioIntFuncState |
cyberjoey | 27:72e40a8d3001 | 111 | { |
cyberjoey | 27:72e40a8d3001 | 112 | Disable = 0, |
cyberjoey | 27:72e40a8d3001 | 113 | Enable = 1 |
cyberjoey | 27:72e40a8d3001 | 114 | }; |
cyberjoey | 27:72e40a8d3001 | 115 | |
cyberjoey | 27:72e40a8d3001 | 116 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 117 | /// PICO Supported Pin States |
cyberjoey | 27:72e40a8d3001 | 118 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 119 | enum GpioPinState |
cyberjoey | 27:72e40a8d3001 | 120 | { |
cyberjoey | 27:72e40a8d3001 | 121 | Low = 0, |
cyberjoey | 27:72e40a8d3001 | 122 | High = 1 |
cyberjoey | 27:72e40a8d3001 | 123 | }; |
cyberjoey | 27:72e40a8d3001 | 124 | |
cyberjoey | 27:72e40a8d3001 | 125 | enum CmdStatus |
cyberjoey | 27:72e40a8d3001 | 126 | { |
cyberjoey | 27:72e40a8d3001 | 127 | Success = 0x00, |
cyberjoey | 27:72e40a8d3001 | 128 | Failure = 0x01, |
cyberjoey | 27:72e40a8d3001 | 129 | |
cyberjoey | 27:72e40a8d3001 | 130 | I2CBusy = 0x10, |
cyberjoey | 27:72e40a8d3001 | 131 | I2CResourceError = 0x11, |
cyberjoey | 27:72e40a8d3001 | 132 | I2CNotSupported = 0x12, |
cyberjoey | 27:72e40a8d3001 | 133 | I2CUnknown = 0x13, |
cyberjoey | 27:72e40a8d3001 | 134 | I2CMrmsErr = 0x14, |
cyberjoey | 27:72e40a8d3001 | 135 | I2CMtmsErr = 0x15, |
cyberjoey | 27:72e40a8d3001 | 136 | I2CMbtErr = 0x16 |
cyberjoey | 27:72e40a8d3001 | 137 | }; |
cyberjoey | 27:72e40a8d3001 | 138 | |
cyberjoey | 27:72e40a8d3001 | 139 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 140 | /// PICO Supported Hardware Blocks |
cyberjoey | 27:72e40a8d3001 | 141 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 142 | enum HardwareBlockID |
cyberjoey | 27:72e40a8d3001 | 143 | { |
cyberjoey | 27:72e40a8d3001 | 144 | One = 1, |
cyberjoey | 27:72e40a8d3001 | 145 | Two = 2 |
cyberjoey | 27:72e40a8d3001 | 146 | }; |
cyberjoey | 27:72e40a8d3001 | 147 | |
cyberjoey | 27:72e40a8d3001 | 148 | /// <summary> |
cyberjoey | 27:72e40a8d3001 | 149 | /// PICO Firmware Version |
cyberjoey | 27:72e40a8d3001 | 150 | /// </summary> |
cyberjoey | 27:72e40a8d3001 | 151 | struct FWVersion |
cyberjoey | 27:72e40a8d3001 | 152 | { |
cyberjoey | 27:72e40a8d3001 | 153 | uint8_t Major; |
cyberjoey | 27:72e40a8d3001 | 154 | uint8_t Minor; |
cyberjoey | 27:72e40a8d3001 | 155 | uint8_t Inc; |
cyberjoey | 27:72e40a8d3001 | 156 | }; |
cyberjoey | 27:72e40a8d3001 | 157 | |
cyberjoey | 27:72e40a8d3001 | 158 | #endif |