808
Dependents: Chromatograph_Mobile
src/FT_GPU_Hal.cpp@12:f0980f7a75ae, 2020-08-08 (annotated)
- Committer:
- nikmaos
- Date:
- Sat Aug 08 18:30:58 2020 +0000
- Revision:
- 12:f0980f7a75ae
- Parent:
- 11:2f11d40f0f9a
- Child:
- 13:5959af2ac87a
808
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JackB | 10:6a81aeca25e3 | 1 | /* mbed Library for FTDI FT813 Enbedded Video Engine "EVE" |
cpm219 | 0:2d0ef4830603 | 2 | * based on Original Code Sample from FTDI |
cpm219 | 0:2d0ef4830603 | 3 | * ported to mbed by Peter Drescher, DC2PD 2014 |
cpm219 | 0:2d0ef4830603 | 4 | * Released under the MIT License: http://mbed.org/license/mit |
cpm219 | 0:2d0ef4830603 | 5 | * 19.09.14 changed to shorter function names |
cpm219 | 0:2d0ef4830603 | 6 | * FTDI was using very long names. |
cpm219 | 0:2d0ef4830603 | 7 | * Ft_App_Flush_Co_Buffer -> Flush_Co_Buffer ... */ |
cpm219 | 0:2d0ef4830603 | 8 | |
cpm219 | 0:2d0ef4830603 | 9 | #include "FT_Platform.h" |
cpm219 | 0:2d0ef4830603 | 10 | #include "mbed.h" |
cpm219 | 0:2d0ef4830603 | 11 | #include "FT_LCD_Type.h" |
cpm219 | 6:ce30c1530d71 | 12 | //Serial pc(USBTX, USBRX); |
vitlog | 11:2f11d40f0f9a | 13 | //Serial pc(SERIAL_TX,SERIAL_RX,115200); |
JackB | 10:6a81aeca25e3 | 14 | #define SPI_SPEED_START 10000000 |
JackB | 10:6a81aeca25e3 | 15 | #define SPI_SPEED_AFTER 27000000 |
JackB | 10:6a81aeca25e3 | 16 | |
JackB | 10:6a81aeca25e3 | 17 | FT813::FT813(PinName mosi, |
cpm219 | 0:2d0ef4830603 | 18 | PinName miso, |
cpm219 | 0:2d0ef4830603 | 19 | PinName sck, |
cpm219 | 0:2d0ef4830603 | 20 | PinName ss, |
cpm219 | 0:2d0ef4830603 | 21 | PinName intr, |
cpm219 | 0:2d0ef4830603 | 22 | PinName pd) |
JackB | 10:6a81aeca25e3 | 23 | : |
JackB | 10:6a81aeca25e3 | 24 | _spi(mosi, miso, sck), |
JackB | 10:6a81aeca25e3 | 25 | _ss(ss), |
JackB | 10:6a81aeca25e3 | 26 | _pd(pd), |
JackB | 10:6a81aeca25e3 | 27 | _f800_isr(InterruptIn(intr)) |
JackB | 10:6a81aeca25e3 | 28 | { |
JackB | 10:6a81aeca25e3 | 29 | _spi.format(8, 0); // 8 bit spi mode 0 |
JackB | 10:6a81aeca25e3 | 30 | _spi.frequency(SPI_SPEED_START); // start with 10 Mhz SPI clock |
JackB | 10:6a81aeca25e3 | 31 | _ss = 1; // cs high |
JackB | 10:6a81aeca25e3 | 32 | _pd = 1; // PD high |
nikmaos | 12:f0980f7a75ae | 33 | _IsOn=Bootup(); |
JackB | 10:6a81aeca25e3 | 34 | _address = 0; |
JackB | 10:6a81aeca25e3 | 35 | _bitmap_count = 0; |
JackB | 10:6a81aeca25e3 | 36 | _bitmapCount = 0; |
JackB | 10:6a81aeca25e3 | 37 | _bitmapAddress = 0; |
JackB | 10:6a81aeca25e3 | 38 | } |
cpm219 | 0:2d0ef4830603 | 39 | |
cpm219 | 0:2d0ef4830603 | 40 | |
JackB | 10:6a81aeca25e3 | 41 | ft_bool_t FT813::Bootup(void) |
JackB | 10:6a81aeca25e3 | 42 | { |
nikmaos | 12:f0980f7a75ae | 43 | //printf("Bootup() entered\r\n");//temp |
cpm219 | 0:2d0ef4830603 | 44 | Open(); |
cpm219 | 5:506e2de9a9e6 | 45 | |
nikmaos | 12:f0980f7a75ae | 46 | return BootupConfig(); |
JackB | 10:6a81aeca25e3 | 47 | } |
cpm219 | 0:2d0ef4830603 | 48 | |
nikmaos | 12:f0980f7a75ae | 49 | ft_bool_t FT813::IsOn(void) |
nikmaos | 12:f0980f7a75ae | 50 | { |
nikmaos | 12:f0980f7a75ae | 51 | return FT813::_IsOn; |
nikmaos | 12:f0980f7a75ae | 52 | } |
cpm219 | 0:2d0ef4830603 | 53 | |
nikmaos | 12:f0980f7a75ae | 54 | char FT813::BootupConfig(void) |
JackB | 10:6a81aeca25e3 | 55 | { |
cpm219 | 0:2d0ef4830603 | 56 | ft_uint8_t chipid; |
cpm219 | 0:2d0ef4830603 | 57 | /* Do a power cycle for safer side */ |
JackB | 10:6a81aeca25e3 | 58 | Powercycle(FT_TRUE); |
cpm219 | 0:2d0ef4830603 | 59 | /* |
cpm219 | 0:2d0ef4830603 | 60 | 7/8/16: Curt added the sleep delay below... |
cpm219 | 0:2d0ef4830603 | 61 | */ |
cpm219 | 0:2d0ef4830603 | 62 | // Sleep(30); |
cpm219 | 0:2d0ef4830603 | 63 | |
cpm219 | 0:2d0ef4830603 | 64 | /* Set the clk to external clock */ |
vitlog | 11:2f11d40f0f9a | 65 | HostCommand(FT_GPU_INTERNAL_OSC); |
cpm219 | 0:2d0ef4830603 | 66 | Sleep(10); |
cpm219 | 0:2d0ef4830603 | 67 | |
JackB | 10:6a81aeca25e3 | 68 | /* Access address 0 to wake up the FT813 */ |
JackB | 10:6a81aeca25e3 | 69 | HostCommand(FT_GPU_ACTIVE_M); |
cpm219 | 0:2d0ef4830603 | 70 | Sleep(500); |
cpm219 | 0:2d0ef4830603 | 71 | |
cpm219 | 0:2d0ef4830603 | 72 | /* Switch PLL output to 48MHz */ |
JackB | 10:6a81aeca25e3 | 73 | HostCommand(FT_GPU_PLL_48M); |
cpm219 | 0:2d0ef4830603 | 74 | Sleep(10); |
cpm219 | 0:2d0ef4830603 | 75 | |
cpm219 | 0:2d0ef4830603 | 76 | /* Do a core reset for safer side */ |
JackB | 10:6a81aeca25e3 | 77 | HostCommand(FT_GPU_CORE_RESET); |
cpm219 | 0:2d0ef4830603 | 78 | Sleep(500); |
JackB | 10:6a81aeca25e3 | 79 | //Read Register ID to check if FT813 is ready. |
JackB | 10:6a81aeca25e3 | 80 | chipid = Rd8(REG_ID); |
vitlog | 11:2f11d40f0f9a | 81 | //chipid = Rd8(0x0C0000); |
vitlog | 11:2f11d40f0f9a | 82 | //pc.printf("ID1: 0x%08X\n", chipid);//temp |
nikmaos | 12:f0980f7a75ae | 83 | |
nikmaos | 12:f0980f7a75ae | 84 | //Если дисплей не отвечает то прервать инициализацию |
nikmaos | 12:f0980f7a75ae | 85 | char sec=0; |
nikmaos | 12:f0980f7a75ae | 86 | while(chipid != 0x7C) //раскомментить как заработает |
nikmaos | 12:f0980f7a75ae | 87 | { |
nikmaos | 12:f0980f7a75ae | 88 | wait_ms(100); |
nikmaos | 12:f0980f7a75ae | 89 | sec++; |
nikmaos | 12:f0980f7a75ae | 90 | if (sec>5) |
nikmaos | 12:f0980f7a75ae | 91 | { |
nikmaos | 12:f0980f7a75ae | 92 | printf("ERR!: Display is not connected\r\n"); |
nikmaos | 12:f0980f7a75ae | 93 | return 0; |
nikmaos | 12:f0980f7a75ae | 94 | } |
nikmaos | 12:f0980f7a75ae | 95 | } |
nikmaos | 12:f0980f7a75ae | 96 | //tmp |
vitlog | 11:2f11d40f0f9a | 97 | //printf("ID2: 0x%08X\n", chipid);//tmp |
cpm219 | 0:2d0ef4830603 | 98 | |
cpm219 | 0:2d0ef4830603 | 99 | // Speed up |
JackB | 10:6a81aeca25e3 | 100 | // _spi.frequency(50000000); // 30 Mhz SPI clock DC |
JackB | 10:6a81aeca25e3 | 101 | _spi.frequency(SPI_SPEED_AFTER); // 20 Mhz SPI clock DC |
JackB | 10:6a81aeca25e3 | 102 | // _spi.frequency(12000000); // 12 Mhz SPI clock |
cpm219 | 0:2d0ef4830603 | 103 | /* Configuration of LCD display */ |
cpm219 | 0:2d0ef4830603 | 104 | DispHCycle = my_DispHCycle; |
JackB | 10:6a81aeca25e3 | 105 | Wr16(REG_HCYCLE, DispHCycle); |
cpm219 | 0:2d0ef4830603 | 106 | DispHOffset = my_DispHOffset; |
JackB | 10:6a81aeca25e3 | 107 | Wr16(REG_HOFFSET, DispHOffset); |
cpm219 | 0:2d0ef4830603 | 108 | DispWidth = my_DispWidth; |
JackB | 10:6a81aeca25e3 | 109 | Wr16(REG_HSIZE, DispWidth); |
cpm219 | 0:2d0ef4830603 | 110 | DispHSync0 = my_DispHSync0; |
JackB | 10:6a81aeca25e3 | 111 | Wr16(REG_HSYNC0, DispHSync0); |
cpm219 | 0:2d0ef4830603 | 112 | DispHSync1 = my_DispHSync1; |
JackB | 10:6a81aeca25e3 | 113 | Wr16(REG_HSYNC1, DispHSync1); |
cpm219 | 0:2d0ef4830603 | 114 | DispVCycle = my_DispVCycle; |
JackB | 10:6a81aeca25e3 | 115 | Wr16(REG_VCYCLE, DispVCycle); |
cpm219 | 0:2d0ef4830603 | 116 | DispVOffset = my_DispVOffset; |
JackB | 10:6a81aeca25e3 | 117 | Wr16(REG_VOFFSET, DispVOffset); |
cpm219 | 0:2d0ef4830603 | 118 | DispHeight = my_DispHeight; |
JackB | 10:6a81aeca25e3 | 119 | Wr16(REG_VSIZE, DispHeight); |
cpm219 | 0:2d0ef4830603 | 120 | DispVSync0 = my_DispVSync0; |
JackB | 10:6a81aeca25e3 | 121 | Wr16(REG_VSYNC0, DispVSync0); |
cpm219 | 0:2d0ef4830603 | 122 | DispVSync1 = my_DispVSync1; |
JackB | 10:6a81aeca25e3 | 123 | Wr16(REG_VSYNC1, DispVSync1); |
cpm219 | 0:2d0ef4830603 | 124 | DispSwizzle = my_DispSwizzle; |
JackB | 10:6a81aeca25e3 | 125 | Wr8(REG_SWIZZLE, DispSwizzle); |
cpm219 | 0:2d0ef4830603 | 126 | DispPCLKPol = my_DispPCLKPol; |
JackB | 10:6a81aeca25e3 | 127 | Wr8(REG_PCLK_POL, DispPCLKPol); |
vitlog | 11:2f11d40f0f9a | 128 | Wr8(REG_CSPREAD, 1); //поменяно для Riverdi 0 на 1 |
cpm219 | 0:2d0ef4830603 | 129 | DispPCLK = my_DispPCLK; |
JackB | 10:6a81aeca25e3 | 130 | Wr8(REG_PCLK, DispPCLK); // After this display is visible on the LCD |
cpm219 | 0:2d0ef4830603 | 131 | |
JackB | 10:6a81aeca25e3 | 132 | Wr16(REG_PWM_HZ, 10000); |
cpm219 | 4:03932ce8a04e | 133 | //#ifdef Inv_Backlite // turn on backlite |
JackB | 10:6a81aeca25e3 | 134 | // Wr16(REG_PWM_DUTY, 0); |
cpm219 | 4:03932ce8a04e | 135 | //#else |
JackB | 10:6a81aeca25e3 | 136 | Wr16(REG_PWM_DUTY, 255); // Brightness 127 |
cpm219 | 4:03932ce8a04e | 137 | //#endif |
JackB | 10:6a81aeca25e3 | 138 | Wr8(REG_GPIO_DIR, 0x82); //| Rd8(REG_GPIO_DIR)); |
JackB | 10:6a81aeca25e3 | 139 | Wr8(REG_GPIO, 0x080); //| Rd8(REG_GPIO)); |
cpm219 | 0:2d0ef4830603 | 140 | |
JackB | 10:6a81aeca25e3 | 141 | Wr32(RAM_DL, CLEAR(1, 1, 1)); |
JackB | 10:6a81aeca25e3 | 142 | Wr32(RAM_DL+4, DISPLAY()); |
JackB | 10:6a81aeca25e3 | 143 | Wr32(REG_DLSWAP, 1); |
cpm219 | 0:2d0ef4830603 | 144 | |
JackB | 10:6a81aeca25e3 | 145 | Wr16(REG_PCLK, DispPCLK); |
cpm219 | 0:2d0ef4830603 | 146 | |
JackB | 10:6a81aeca25e3 | 147 | /* Touch configuration - configure the resistance value to 1200 */ |
JackB | 10:6a81aeca25e3 | 148 | /* This value is specific to customer requirement and derived by experiment */ |
JackB | 10:6a81aeca25e3 | 149 | // Wr16(REG_TOUCH_RZTHRESH,2400); |
vitlog | 11:2f11d40f0f9a | 150 | Wr16(REG_TOUCH_RZTHRESH, 1800); //поменяно с 0xFFFF на 1800 |
nikmaos | 12:f0980f7a75ae | 151 | return 1; //дисплей включен и настроен |
cpm219 | 0:2d0ef4830603 | 152 | } |
cpm219 | 0:2d0ef4830603 | 153 | |
cpm219 | 0:2d0ef4830603 | 154 | /* API to initialize the SPI interface */ |
JackB | 10:6a81aeca25e3 | 155 | ft_bool_t FT813::Init() |
cpm219 | 0:2d0ef4830603 | 156 | { |
JackB | 10:6a81aeca25e3 | 157 | // This is done in the constructor |
cpm219 | 0:2d0ef4830603 | 158 | return 1; |
cpm219 | 0:2d0ef4830603 | 159 | } |
cpm219 | 0:2d0ef4830603 | 160 | |
JackB | 10:6a81aeca25e3 | 161 | ft_bool_t FT813::Open() |
cpm219 | 0:2d0ef4830603 | 162 | { |
cpm219 | 0:2d0ef4830603 | 163 | cmd_fifo_wp = dl_buff_wp = 0; |
cpm219 | 0:2d0ef4830603 | 164 | status = OPENED; |
cpm219 | 0:2d0ef4830603 | 165 | return 1; |
cpm219 | 0:2d0ef4830603 | 166 | } |
cpm219 | 0:2d0ef4830603 | 167 | |
JackB | 10:6a81aeca25e3 | 168 | ft_void_t FT813::Close() |
cpm219 | 0:2d0ef4830603 | 169 | { |
cpm219 | 0:2d0ef4830603 | 170 | status = CLOSED; |
cpm219 | 0:2d0ef4830603 | 171 | } |
cpm219 | 0:2d0ef4830603 | 172 | |
JackB | 10:6a81aeca25e3 | 173 | ft_void_t FT813::DeInit() |
cpm219 | 0:2d0ef4830603 | 174 | { |
cpm219 | 0:2d0ef4830603 | 175 | } |
cpm219 | 0:2d0ef4830603 | 176 | |
cpm219 | 0:2d0ef4830603 | 177 | /*The APIs for reading/writing transfer continuously only with small buffer system*/ |
JackB | 10:6a81aeca25e3 | 178 | ft_void_t FT813::StartTransfer(FT_GPU_TRANSFERDIR_T rw, ft_uint32_t addr) |
cpm219 | 0:2d0ef4830603 | 179 | { |
JackB | 10:6a81aeca25e3 | 180 | if (FT_GPU_READ == rw) { |
cpm219 | 0:2d0ef4830603 | 181 | _ss = 0; // cs low |
cpm219 | 0:2d0ef4830603 | 182 | _spi.write(addr >> 16); |
cpm219 | 0:2d0ef4830603 | 183 | _spi.write(addr >> 8); |
cpm219 | 0:2d0ef4830603 | 184 | _spi.write(addr & 0xff); |
cpm219 | 0:2d0ef4830603 | 185 | _spi.write(0); //Dummy Read Byte |
cpm219 | 0:2d0ef4830603 | 186 | status = READING; |
JackB | 10:6a81aeca25e3 | 187 | } else { |
cpm219 | 0:2d0ef4830603 | 188 | _ss = 0; // cs low |
cpm219 | 0:2d0ef4830603 | 189 | _spi.write(0x80 | (addr >> 16)); |
cpm219 | 0:2d0ef4830603 | 190 | _spi.write(addr >> 8); |
cpm219 | 0:2d0ef4830603 | 191 | _spi.write(addr & 0xff); |
cpm219 | 0:2d0ef4830603 | 192 | status = WRITING; |
cpm219 | 0:2d0ef4830603 | 193 | } |
cpm219 | 0:2d0ef4830603 | 194 | } |
cpm219 | 0:2d0ef4830603 | 195 | |
cpm219 | 0:2d0ef4830603 | 196 | |
cpm219 | 0:2d0ef4830603 | 197 | /*The APIs for writing transfer continuously only*/ |
JackB | 10:6a81aeca25e3 | 198 | ft_void_t FT813::StartCmdTransfer(FT_GPU_TRANSFERDIR_T rw, ft_uint16_t count) |
cpm219 | 0:2d0ef4830603 | 199 | { |
JackB | 10:6a81aeca25e3 | 200 | StartTransfer(rw, cmd_fifo_wp + RAM_CMD); |
cpm219 | 0:2d0ef4830603 | 201 | } |
cpm219 | 0:2d0ef4830603 | 202 | |
JackB | 10:6a81aeca25e3 | 203 | ft_uint8_t FT813::TransferString(const ft_char8_t *string) |
cpm219 | 0:2d0ef4830603 | 204 | { |
cpm219 | 0:2d0ef4830603 | 205 | ft_uint16_t length = strlen(string); |
JackB | 10:6a81aeca25e3 | 206 | while(length --) { |
JackB | 10:6a81aeca25e3 | 207 | Transfer8(*string); |
JackB | 10:6a81aeca25e3 | 208 | string++; |
cpm219 | 0:2d0ef4830603 | 209 | } |
cpm219 | 0:2d0ef4830603 | 210 | //Append one null as ending flag |
JackB | 10:6a81aeca25e3 | 211 | Transfer8(0); |
cpm219 | 0:2d0ef4830603 | 212 | return(1); |
cpm219 | 0:2d0ef4830603 | 213 | } |
cpm219 | 0:2d0ef4830603 | 214 | |
cpm219 | 0:2d0ef4830603 | 215 | |
JackB | 10:6a81aeca25e3 | 216 | ft_uint8_t FT813::Transfer8(ft_uint8_t value) |
cpm219 | 0:2d0ef4830603 | 217 | { |
cpm219 | 0:2d0ef4830603 | 218 | return _spi.write(value); |
cpm219 | 0:2d0ef4830603 | 219 | } |
cpm219 | 0:2d0ef4830603 | 220 | |
cpm219 | 0:2d0ef4830603 | 221 | |
JackB | 10:6a81aeca25e3 | 222 | ft_uint16_t FT813::Transfer16(ft_uint16_t value) |
cpm219 | 0:2d0ef4830603 | 223 | { |
cpm219 | 0:2d0ef4830603 | 224 | ft_uint16_t retVal = 0; |
cpm219 | 0:2d0ef4830603 | 225 | |
JackB | 10:6a81aeca25e3 | 226 | if (status == WRITING) { |
JackB | 10:6a81aeca25e3 | 227 | Transfer8(value & 0xFF);//LSB first |
JackB | 10:6a81aeca25e3 | 228 | Transfer8((value >> 8) & 0xFF); |
JackB | 10:6a81aeca25e3 | 229 | } else { |
JackB | 10:6a81aeca25e3 | 230 | retVal = Transfer8(0); |
JackB | 10:6a81aeca25e3 | 231 | retVal |= (ft_uint16_t)Transfer8(0) << 8; |
cpm219 | 0:2d0ef4830603 | 232 | } |
cpm219 | 0:2d0ef4830603 | 233 | |
cpm219 | 0:2d0ef4830603 | 234 | return retVal; |
cpm219 | 0:2d0ef4830603 | 235 | } |
cpm219 | 0:2d0ef4830603 | 236 | |
JackB | 10:6a81aeca25e3 | 237 | ft_uint32_t FT813::Transfer32(ft_uint32_t value) |
cpm219 | 0:2d0ef4830603 | 238 | { |
cpm219 | 0:2d0ef4830603 | 239 | ft_uint32_t retVal = 0; |
JackB | 10:6a81aeca25e3 | 240 | if (status == WRITING) { |
JackB | 10:6a81aeca25e3 | 241 | Transfer16(value & 0xFFFF);//LSB first |
JackB | 10:6a81aeca25e3 | 242 | Transfer16((value >> 16) & 0xFFFF); |
JackB | 10:6a81aeca25e3 | 243 | } else { |
JackB | 10:6a81aeca25e3 | 244 | retVal = Transfer16(0); |
JackB | 10:6a81aeca25e3 | 245 | retVal |= (ft_uint32_t)Transfer16(0) << 16; |
cpm219 | 0:2d0ef4830603 | 246 | } |
cpm219 | 0:2d0ef4830603 | 247 | return retVal; |
cpm219 | 0:2d0ef4830603 | 248 | } |
cpm219 | 0:2d0ef4830603 | 249 | |
JackB | 10:6a81aeca25e3 | 250 | ft_void_t FT813::EndTransfer() |
cpm219 | 0:2d0ef4830603 | 251 | { |
cpm219 | 0:2d0ef4830603 | 252 | _ss = 1; |
cpm219 | 0:2d0ef4830603 | 253 | status = OPENED; |
cpm219 | 0:2d0ef4830603 | 254 | } |
cpm219 | 0:2d0ef4830603 | 255 | |
JackB | 10:6a81aeca25e3 | 256 | ft_uint8_t FT813::Rd8(ft_uint32_t addr) |
cpm219 | 0:2d0ef4830603 | 257 | { |
cpm219 | 0:2d0ef4830603 | 258 | ft_uint8_t value; |
JackB | 10:6a81aeca25e3 | 259 | StartTransfer(FT_GPU_READ, addr); |
JackB | 10:6a81aeca25e3 | 260 | value = Transfer8(0); |
JackB | 10:6a81aeca25e3 | 261 | EndTransfer(); |
cpm219 | 0:2d0ef4830603 | 262 | return value; |
cpm219 | 0:2d0ef4830603 | 263 | } |
JackB | 10:6a81aeca25e3 | 264 | |
JackB | 10:6a81aeca25e3 | 265 | ft_uint16_t FT813::Rd16(ft_uint32_t addr) |
cpm219 | 0:2d0ef4830603 | 266 | { |
cpm219 | 0:2d0ef4830603 | 267 | ft_uint16_t value; |
JackB | 10:6a81aeca25e3 | 268 | StartTransfer(FT_GPU_READ, addr); |
JackB | 10:6a81aeca25e3 | 269 | value = Transfer16(0); |
JackB | 10:6a81aeca25e3 | 270 | EndTransfer(); |
cpm219 | 0:2d0ef4830603 | 271 | return value; |
cpm219 | 0:2d0ef4830603 | 272 | } |
JackB | 10:6a81aeca25e3 | 273 | |
JackB | 10:6a81aeca25e3 | 274 | ft_uint32_t FT813::Rd32(ft_uint32_t addr) |
cpm219 | 0:2d0ef4830603 | 275 | { |
cpm219 | 0:2d0ef4830603 | 276 | ft_uint32_t value; |
JackB | 10:6a81aeca25e3 | 277 | StartTransfer(FT_GPU_READ, addr); |
JackB | 10:6a81aeca25e3 | 278 | value = Transfer32(0); |
JackB | 10:6a81aeca25e3 | 279 | EndTransfer(); |
cpm219 | 0:2d0ef4830603 | 280 | return value; |
cpm219 | 0:2d0ef4830603 | 281 | } |
cpm219 | 0:2d0ef4830603 | 282 | |
JackB | 10:6a81aeca25e3 | 283 | ft_void_t FT813::Wr8(ft_uint32_t addr, ft_uint8_t v) |
cpm219 | 0:2d0ef4830603 | 284 | { |
JackB | 10:6a81aeca25e3 | 285 | // StartTransfer(FT_GPU_WRITE, addr); |
JackB | 10:6a81aeca25e3 | 286 | // if (FT_GPU_READ == rw) { // if (FT_GPU_READ == FT_GPU_WRITE) |
JackB | 10:6a81aeca25e3 | 287 | // _ss = 0; // cs low |
JackB | 10:6a81aeca25e3 | 288 | // _spi.write(addr >> 16); |
JackB | 10:6a81aeca25e3 | 289 | // _spi.write(addr >> 8); |
JackB | 10:6a81aeca25e3 | 290 | // _spi.write(addr & 0xff); |
JackB | 10:6a81aeca25e3 | 291 | // _spi.write(0); //Dummy Read Byte |
JackB | 10:6a81aeca25e3 | 292 | // status = READING; |
JackB | 10:6a81aeca25e3 | 293 | // } else { |
JackB | 10:6a81aeca25e3 | 294 | _ss = 0; // cs low |
JackB | 10:6a81aeca25e3 | 295 | _spi.write(0x80 | (addr >> 16)); |
JackB | 10:6a81aeca25e3 | 296 | _spi.write(addr >> 8); |
JackB | 10:6a81aeca25e3 | 297 | _spi.write(addr & 0xff); |
JackB | 10:6a81aeca25e3 | 298 | status = WRITING; |
JackB | 10:6a81aeca25e3 | 299 | // } |
JackB | 10:6a81aeca25e3 | 300 | |
JackB | 10:6a81aeca25e3 | 301 | // Transfer8(v); |
JackB | 10:6a81aeca25e3 | 302 | _spi.write(v); |
JackB | 10:6a81aeca25e3 | 303 | // EndTransfer(); |
JackB | 10:6a81aeca25e3 | 304 | _ss = 1; |
JackB | 10:6a81aeca25e3 | 305 | status = OPENED; |
cpm219 | 0:2d0ef4830603 | 306 | } |
cpm219 | 0:2d0ef4830603 | 307 | |
JackB | 10:6a81aeca25e3 | 308 | ft_void_t FT813::Wr16(ft_uint32_t addr, ft_uint16_t v) |
JackB | 10:6a81aeca25e3 | 309 | { |
JackB | 10:6a81aeca25e3 | 310 | StartTransfer(FT_GPU_WRITE, addr); |
JackB | 10:6a81aeca25e3 | 311 | Transfer16(v); |
JackB | 10:6a81aeca25e3 | 312 | EndTransfer(); |
JackB | 10:6a81aeca25e3 | 313 | } |
JackB | 10:6a81aeca25e3 | 314 | |
JackB | 10:6a81aeca25e3 | 315 | ft_void_t FT813::Wr32(ft_uint32_t addr, ft_uint32_t v) |
JackB | 10:6a81aeca25e3 | 316 | { |
JackB | 10:6a81aeca25e3 | 317 | StartTransfer(FT_GPU_WRITE, addr); |
JackB | 10:6a81aeca25e3 | 318 | Transfer32(v); |
JackB | 10:6a81aeca25e3 | 319 | EndTransfer(); |
JackB | 10:6a81aeca25e3 | 320 | } |
JackB | 10:6a81aeca25e3 | 321 | |
JackB | 10:6a81aeca25e3 | 322 | ft_void_t FT813::HostCommand(ft_uint8_t cmd) |
cpm219 | 0:2d0ef4830603 | 323 | { |
cpm219 | 0:2d0ef4830603 | 324 | _ss = 0; |
cpm219 | 0:2d0ef4830603 | 325 | _spi.write(cmd); |
cpm219 | 0:2d0ef4830603 | 326 | _spi.write(0); |
cpm219 | 0:2d0ef4830603 | 327 | _spi.write(0); |
cpm219 | 0:2d0ef4830603 | 328 | _ss = 1; |
cpm219 | 0:2d0ef4830603 | 329 | } |
cpm219 | 0:2d0ef4830603 | 330 | |
JackB | 10:6a81aeca25e3 | 331 | ft_void_t FT813::ClockSelect(FT_GPU_PLL_SOURCE_T pllsource) |
cpm219 | 0:2d0ef4830603 | 332 | { |
JackB | 10:6a81aeca25e3 | 333 | HostCommand(pllsource); |
cpm219 | 0:2d0ef4830603 | 334 | } |
cpm219 | 0:2d0ef4830603 | 335 | |
JackB | 10:6a81aeca25e3 | 336 | ft_void_t FT813::PLL_FreqSelect(FT_GPU_PLL_FREQ_T freq) |
cpm219 | 0:2d0ef4830603 | 337 | { |
JackB | 10:6a81aeca25e3 | 338 | HostCommand(freq); |
cpm219 | 0:2d0ef4830603 | 339 | } |
cpm219 | 0:2d0ef4830603 | 340 | |
JackB | 10:6a81aeca25e3 | 341 | ft_void_t FT813::PowerModeSwitch(FT_GPU_POWER_MODE_T pwrmode) |
cpm219 | 0:2d0ef4830603 | 342 | { |
JackB | 10:6a81aeca25e3 | 343 | HostCommand(pwrmode); |
cpm219 | 0:2d0ef4830603 | 344 | } |
cpm219 | 0:2d0ef4830603 | 345 | |
JackB | 10:6a81aeca25e3 | 346 | ft_void_t FT813::CoreReset() |
cpm219 | 0:2d0ef4830603 | 347 | { |
JackB | 10:6a81aeca25e3 | 348 | HostCommand(0x68); |
cpm219 | 0:2d0ef4830603 | 349 | } |
cpm219 | 0:2d0ef4830603 | 350 | |
JackB | 10:6a81aeca25e3 | 351 | ft_void_t FT813::Updatecmdfifo(ft_uint16_t count) |
cpm219 | 0:2d0ef4830603 | 352 | { |
JackB | 10:6a81aeca25e3 | 353 | cmd_fifo_wp = (cmd_fifo_wp + count) & 4095; |
cpm219 | 0:2d0ef4830603 | 354 | //4 byte alignment |
JackB | 10:6a81aeca25e3 | 355 | cmd_fifo_wp = (cmd_fifo_wp + 3) & 0xffc; |
JackB | 10:6a81aeca25e3 | 356 | Wr16(REG_CMD_WRITE, cmd_fifo_wp); |
cpm219 | 0:2d0ef4830603 | 357 | } |
cpm219 | 0:2d0ef4830603 | 358 | |
JackB | 10:6a81aeca25e3 | 359 | ft_uint16_t FT813::fifo_Freespace() |
cpm219 | 0:2d0ef4830603 | 360 | { |
cpm219 | 0:2d0ef4830603 | 361 | ft_uint16_t fullness,retval; |
cpm219 | 0:2d0ef4830603 | 362 | |
JackB | 10:6a81aeca25e3 | 363 | fullness = (cmd_fifo_wp - Rd16(REG_CMD_READ)) & 4095; |
cpm219 | 0:2d0ef4830603 | 364 | retval = (FT_CMD_FIFO_SIZE - 4) - fullness; |
cpm219 | 0:2d0ef4830603 | 365 | return (retval); |
cpm219 | 0:2d0ef4830603 | 366 | } |
cpm219 | 0:2d0ef4830603 | 367 | |
JackB | 10:6a81aeca25e3 | 368 | ft_void_t FT813::WrCmdBuf(ft_uint8_t *buffer, ft_uint16_t count) |
cpm219 | 0:2d0ef4830603 | 369 | { |
cpm219 | 0:2d0ef4830603 | 370 | ft_uint32_t length =0, SizeTransfered = 0; |
cpm219 | 0:2d0ef4830603 | 371 | |
JackB | 10:6a81aeca25e3 | 372 | #define MAX_CMD_FIFO_TRANSFER fifo_Freespace() |
cpm219 | 0:2d0ef4830603 | 373 | do { |
cpm219 | 0:2d0ef4830603 | 374 | length = count; |
JackB | 10:6a81aeca25e3 | 375 | if (length > MAX_CMD_FIFO_TRANSFER) { |
cpm219 | 0:2d0ef4830603 | 376 | length = MAX_CMD_FIFO_TRANSFER; |
cpm219 | 0:2d0ef4830603 | 377 | } |
JackB | 10:6a81aeca25e3 | 378 | CheckCmdBuffer(length); |
cpm219 | 0:2d0ef4830603 | 379 | |
JackB | 10:6a81aeca25e3 | 380 | StartCmdTransfer(FT_GPU_WRITE, length); |
cpm219 | 0:2d0ef4830603 | 381 | |
JackB | 10:6a81aeca25e3 | 382 | SizeTransfered = 0; |
cpm219 | 0:2d0ef4830603 | 383 | while (length--) { |
JackB | 10:6a81aeca25e3 | 384 | // Transfer8(*buffer); |
JackB | 10:6a81aeca25e3 | 385 | _spi.write(*buffer); |
JackB | 10:6a81aeca25e3 | 386 | buffer++; |
JackB | 10:6a81aeca25e3 | 387 | SizeTransfered++; |
cpm219 | 0:2d0ef4830603 | 388 | } |
JackB | 10:6a81aeca25e3 | 389 | length = SizeTransfered; |
cpm219 | 0:2d0ef4830603 | 390 | |
JackB | 10:6a81aeca25e3 | 391 | EndTransfer(); |
JackB | 10:6a81aeca25e3 | 392 | Updatecmdfifo(length); |
cpm219 | 0:2d0ef4830603 | 393 | |
JackB | 10:6a81aeca25e3 | 394 | WaitCmdfifo_empty(); |
cpm219 | 0:2d0ef4830603 | 395 | |
cpm219 | 0:2d0ef4830603 | 396 | count -= length; |
JackB | 10:6a81aeca25e3 | 397 | } while (count > 0); |
cpm219 | 0:2d0ef4830603 | 398 | } |
cpm219 | 0:2d0ef4830603 | 399 | |
JackB | 10:6a81aeca25e3 | 400 | ft_void_t FT813::WrCmdBufFromFlash(FT_PROGMEM ft_prog_uchar8_t *buffer, ft_uint16_t count) |
cpm219 | 0:2d0ef4830603 | 401 | { |
cpm219 | 0:2d0ef4830603 | 402 | ft_uint32_t length =0, SizeTransfered = 0; |
cpm219 | 0:2d0ef4830603 | 403 | |
JackB | 10:6a81aeca25e3 | 404 | #define MAX_CMD_FIFO_TRANSFER fifo_Freespace() |
cpm219 | 0:2d0ef4830603 | 405 | do { |
cpm219 | 0:2d0ef4830603 | 406 | length = count; |
JackB | 10:6a81aeca25e3 | 407 | if (length > MAX_CMD_FIFO_TRANSFER) { |
cpm219 | 0:2d0ef4830603 | 408 | length = MAX_CMD_FIFO_TRANSFER; |
cpm219 | 0:2d0ef4830603 | 409 | } |
JackB | 10:6a81aeca25e3 | 410 | CheckCmdBuffer(length); |
cpm219 | 0:2d0ef4830603 | 411 | |
JackB | 10:6a81aeca25e3 | 412 | StartCmdTransfer(FT_GPU_WRITE,length); |
cpm219 | 0:2d0ef4830603 | 413 | |
JackB | 10:6a81aeca25e3 | 414 | SizeTransfered = 0; |
cpm219 | 0:2d0ef4830603 | 415 | while (length--) { |
JackB | 10:6a81aeca25e3 | 416 | Transfer8(ft_pgm_read_byte_near(buffer)); |
cpm219 | 0:2d0ef4830603 | 417 | buffer++; |
JackB | 10:6a81aeca25e3 | 418 | SizeTransfered++; |
cpm219 | 0:2d0ef4830603 | 419 | } |
JackB | 10:6a81aeca25e3 | 420 | length = SizeTransfered; |
cpm219 | 0:2d0ef4830603 | 421 | |
JackB | 10:6a81aeca25e3 | 422 | EndTransfer(); |
JackB | 10:6a81aeca25e3 | 423 | Updatecmdfifo(length); |
cpm219 | 0:2d0ef4830603 | 424 | |
JackB | 10:6a81aeca25e3 | 425 | WaitCmdfifo_empty(); |
cpm219 | 0:2d0ef4830603 | 426 | |
cpm219 | 0:2d0ef4830603 | 427 | count -= length; |
JackB | 10:6a81aeca25e3 | 428 | } while (count > 0); |
cpm219 | 0:2d0ef4830603 | 429 | } |
cpm219 | 0:2d0ef4830603 | 430 | |
JackB | 10:6a81aeca25e3 | 431 | ft_void_t FT813::CheckCmdBuffer(ft_uint16_t count) |
cpm219 | 0:2d0ef4830603 | 432 | { |
cpm219 | 0:2d0ef4830603 | 433 | ft_uint16_t getfreespace; |
JackB | 10:6a81aeca25e3 | 434 | do { |
JackB | 10:6a81aeca25e3 | 435 | getfreespace = fifo_Freespace(); |
JackB | 10:6a81aeca25e3 | 436 | } while(getfreespace < count); |
cpm219 | 0:2d0ef4830603 | 437 | } |
cpm219 | 0:2d0ef4830603 | 438 | |
JackB | 10:6a81aeca25e3 | 439 | ft_void_t FT813::WaitCmdfifo_empty() |
cpm219 | 0:2d0ef4830603 | 440 | { |
JackB | 10:6a81aeca25e3 | 441 | while(Rd16(REG_CMD_READ) != Rd16(REG_CMD_WRITE)); |
cpm219 | 0:2d0ef4830603 | 442 | |
JackB | 10:6a81aeca25e3 | 443 | cmd_fifo_wp = Rd16(REG_CMD_WRITE); |
cpm219 | 0:2d0ef4830603 | 444 | } |
cpm219 | 0:2d0ef4830603 | 445 | |
JackB | 10:6a81aeca25e3 | 446 | ft_void_t FT813::WaitLogo_Finish() |
cpm219 | 0:2d0ef4830603 | 447 | { |
JackB | 10:6a81aeca25e3 | 448 | ft_int16_t cmdrdptr, cmdwrptr; |
cpm219 | 0:2d0ef4830603 | 449 | |
JackB | 10:6a81aeca25e3 | 450 | do { |
JackB | 10:6a81aeca25e3 | 451 | cmdrdptr = Rd16(REG_CMD_READ); |
JackB | 10:6a81aeca25e3 | 452 | cmdwrptr = Rd16(REG_CMD_WRITE); |
JackB | 10:6a81aeca25e3 | 453 | } while ((cmdwrptr != cmdrdptr) || (cmdrdptr != 0)); |
JackB | 10:6a81aeca25e3 | 454 | cmd_fifo_wp = 0; |
cpm219 | 0:2d0ef4830603 | 455 | } |
cpm219 | 0:2d0ef4830603 | 456 | |
JackB | 10:6a81aeca25e3 | 457 | ft_void_t FT813::ResetCmdFifo() |
cpm219 | 0:2d0ef4830603 | 458 | { |
cpm219 | 0:2d0ef4830603 | 459 | cmd_fifo_wp = 0; |
cpm219 | 0:2d0ef4830603 | 460 | } |
cpm219 | 0:2d0ef4830603 | 461 | |
JackB | 10:6a81aeca25e3 | 462 | ft_void_t FT813::WrCmd32(ft_uint32_t cmd) |
cpm219 | 0:2d0ef4830603 | 463 | { |
JackB | 10:6a81aeca25e3 | 464 | CheckCmdBuffer(sizeof(cmd)); |
cpm219 | 0:2d0ef4830603 | 465 | |
JackB | 10:6a81aeca25e3 | 466 | Wr32(RAM_CMD + cmd_fifo_wp, cmd); |
cpm219 | 0:2d0ef4830603 | 467 | |
JackB | 10:6a81aeca25e3 | 468 | Updatecmdfifo(sizeof(cmd)); |
cpm219 | 0:2d0ef4830603 | 469 | } |
cpm219 | 0:2d0ef4830603 | 470 | |
JackB | 10:6a81aeca25e3 | 471 | ft_void_t FT813::ResetDLBuffer() |
cpm219 | 0:2d0ef4830603 | 472 | { |
JackB | 10:6a81aeca25e3 | 473 | dl_buff_wp = 0; |
cpm219 | 0:2d0ef4830603 | 474 | } |
cpm219 | 0:2d0ef4830603 | 475 | |
JackB | 10:6a81aeca25e3 | 476 | /* Toggle PD_N pin of FT813 board for a power cycle*/ |
JackB | 10:6a81aeca25e3 | 477 | ft_void_t FT813::Powercycle(ft_bool_t up) |
cpm219 | 0:2d0ef4830603 | 478 | { |
cpm219 | 0:2d0ef4830603 | 479 | if (up) |
cpm219 | 0:2d0ef4830603 | 480 | { |
JackB | 10:6a81aeca25e3 | 481 | //Toggle PD_N from low to high for power up switch |
JackB | 10:6a81aeca25e3 | 482 | _pd = 0; |
JackB | 10:6a81aeca25e3 | 483 | Sleep(20); |
cpm219 | 0:2d0ef4830603 | 484 | |
JackB | 10:6a81aeca25e3 | 485 | _pd = 1; |
JackB | 10:6a81aeca25e3 | 486 | Sleep(20); |
JackB | 10:6a81aeca25e3 | 487 | } else { |
JackB | 10:6a81aeca25e3 | 488 | //Toggle PD_N from high to low for power down switch |
JackB | 10:6a81aeca25e3 | 489 | _pd = 1; |
JackB | 10:6a81aeca25e3 | 490 | Sleep(20); |
cpm219 | 0:2d0ef4830603 | 491 | |
JackB | 10:6a81aeca25e3 | 492 | _pd = 0; |
JackB | 10:6a81aeca25e3 | 493 | Sleep(20); |
cpm219 | 0:2d0ef4830603 | 494 | } |
cpm219 | 0:2d0ef4830603 | 495 | } |
cpm219 | 0:2d0ef4830603 | 496 | |
JackB | 10:6a81aeca25e3 | 497 | ft_void_t FT813::WrMemFromFlash(ft_uint32_t addr, const ft_prog_uchar8_t *buffer, ft_uint32_t length) |
cpm219 | 0:2d0ef4830603 | 498 | { |
cpm219 | 0:2d0ef4830603 | 499 | //ft_uint32_t SizeTransfered = 0; |
cpm219 | 0:2d0ef4830603 | 500 | |
JackB | 10:6a81aeca25e3 | 501 | StartTransfer(FT_GPU_WRITE,addr); |
cpm219 | 0:2d0ef4830603 | 502 | |
cpm219 | 0:2d0ef4830603 | 503 | while (length--) { |
JackB | 10:6a81aeca25e3 | 504 | Transfer8(ft_pgm_read_byte_near(buffer)); |
cpm219 | 0:2d0ef4830603 | 505 | buffer++; |
cpm219 | 0:2d0ef4830603 | 506 | } |
cpm219 | 0:2d0ef4830603 | 507 | |
JackB | 10:6a81aeca25e3 | 508 | EndTransfer(); |
cpm219 | 0:2d0ef4830603 | 509 | } |
cpm219 | 0:2d0ef4830603 | 510 | |
JackB | 10:6a81aeca25e3 | 511 | ft_void_t FT813::WrMem(ft_uint32_t addr, const ft_uint8_t *buffer, ft_uint32_t length) |
cpm219 | 0:2d0ef4830603 | 512 | { |
cpm219 | 0:2d0ef4830603 | 513 | //ft_uint32_t SizeTransfered = 0; |
cpm219 | 0:2d0ef4830603 | 514 | |
JackB | 10:6a81aeca25e3 | 515 | StartTransfer(FT_GPU_WRITE,addr); |
cpm219 | 0:2d0ef4830603 | 516 | |
cpm219 | 0:2d0ef4830603 | 517 | while (length--) { |
JackB | 10:6a81aeca25e3 | 518 | Transfer8(*buffer); |
cpm219 | 0:2d0ef4830603 | 519 | buffer++; |
cpm219 | 0:2d0ef4830603 | 520 | } |
cpm219 | 0:2d0ef4830603 | 521 | |
JackB | 10:6a81aeca25e3 | 522 | EndTransfer(); |
cpm219 | 0:2d0ef4830603 | 523 | } |
cpm219 | 0:2d0ef4830603 | 524 | |
JackB | 10:6a81aeca25e3 | 525 | ft_void_t FT813::RdMem(ft_uint32_t addr, ft_uint8_t *buffer, ft_uint32_t length) |
cpm219 | 0:2d0ef4830603 | 526 | { |
cpm219 | 0:2d0ef4830603 | 527 | //ft_uint32_t SizeTransfered = 0; |
cpm219 | 0:2d0ef4830603 | 528 | |
JackB | 10:6a81aeca25e3 | 529 | StartTransfer(FT_GPU_READ,addr); |
cpm219 | 0:2d0ef4830603 | 530 | |
cpm219 | 0:2d0ef4830603 | 531 | while (length--) { |
JackB | 10:6a81aeca25e3 | 532 | *buffer = Transfer8(0); |
cpm219 | 0:2d0ef4830603 | 533 | buffer++; |
cpm219 | 0:2d0ef4830603 | 534 | } |
cpm219 | 0:2d0ef4830603 | 535 | |
JackB | 10:6a81aeca25e3 | 536 | EndTransfer(); |
cpm219 | 0:2d0ef4830603 | 537 | } |
cpm219 | 0:2d0ef4830603 | 538 | |
JackB | 10:6a81aeca25e3 | 539 | ft_int32_t FT813::Dec2Ascii(ft_char8_t *pSrc, ft_int32_t value) |
cpm219 | 0:2d0ef4830603 | 540 | { |
cpm219 | 0:2d0ef4830603 | 541 | ft_int16_t Length; |
JackB | 10:6a81aeca25e3 | 542 | ft_char8_t *pdst, charval; |
JackB | 10:6a81aeca25e3 | 543 | ft_int32_t CurrVal = value, tmpval,i; |
JackB | 10:6a81aeca25e3 | 544 | ft_char8_t tmparray[16], idx = 0; |
cpm219 | 0:2d0ef4830603 | 545 | |
cpm219 | 0:2d0ef4830603 | 546 | Length = strlen(pSrc); |
cpm219 | 0:2d0ef4830603 | 547 | pdst = pSrc + Length; |
cpm219 | 0:2d0ef4830603 | 548 | |
JackB | 10:6a81aeca25e3 | 549 | if(0 == value) { |
cpm219 | 0:2d0ef4830603 | 550 | *pdst++ = '0'; |
cpm219 | 0:2d0ef4830603 | 551 | *pdst++ = '\0'; |
cpm219 | 0:2d0ef4830603 | 552 | return 0; |
cpm219 | 0:2d0ef4830603 | 553 | } |
cpm219 | 0:2d0ef4830603 | 554 | |
JackB | 10:6a81aeca25e3 | 555 | if(CurrVal < 0) { |
cpm219 | 0:2d0ef4830603 | 556 | *pdst++ = '-'; |
cpm219 | 0:2d0ef4830603 | 557 | CurrVal = - CurrVal; |
cpm219 | 0:2d0ef4830603 | 558 | } |
cpm219 | 0:2d0ef4830603 | 559 | /* insert the value */ |
JackB | 10:6a81aeca25e3 | 560 | while(CurrVal > 0) { |
cpm219 | 0:2d0ef4830603 | 561 | tmpval = CurrVal; |
cpm219 | 0:2d0ef4830603 | 562 | CurrVal /= 10; |
cpm219 | 0:2d0ef4830603 | 563 | tmpval = tmpval - CurrVal*10; |
cpm219 | 0:2d0ef4830603 | 564 | charval = '0' + tmpval; |
cpm219 | 0:2d0ef4830603 | 565 | tmparray[idx++] = charval; |
cpm219 | 0:2d0ef4830603 | 566 | } |
cpm219 | 0:2d0ef4830603 | 567 | |
JackB | 10:6a81aeca25e3 | 568 | for(i = 0; i < idx; i++) { |
cpm219 | 0:2d0ef4830603 | 569 | *pdst++ = tmparray[idx - i - 1]; |
cpm219 | 0:2d0ef4830603 | 570 | } |
cpm219 | 0:2d0ef4830603 | 571 | *pdst++ = '\0'; |
cpm219 | 0:2d0ef4830603 | 572 | |
cpm219 | 0:2d0ef4830603 | 573 | return 0; |
cpm219 | 0:2d0ef4830603 | 574 | } |
cpm219 | 0:2d0ef4830603 | 575 | |
JackB | 10:6a81aeca25e3 | 576 | ft_void_t FT813::Sleep(ft_uint16_t ms) |
cpm219 | 0:2d0ef4830603 | 577 | { |
cpm219 | 0:2d0ef4830603 | 578 | wait_ms(ms); |
cpm219 | 0:2d0ef4830603 | 579 | } |
cpm219 | 0:2d0ef4830603 | 580 | |
JackB | 10:6a81aeca25e3 | 581 | ft_void_t FT813::Sound_ON() |
JackB | 10:6a81aeca25e3 | 582 | { |
JackB | 10:6a81aeca25e3 | 583 | Wr8(REG_GPIO, 0x02 | Rd8(REG_GPIO)); |
cpm219 | 0:2d0ef4830603 | 584 | } |
cpm219 | 0:2d0ef4830603 | 585 | |
JackB | 10:6a81aeca25e3 | 586 | ft_void_t FT813::Sound_OFF() |
JackB | 10:6a81aeca25e3 | 587 | { |
JackB | 10:6a81aeca25e3 | 588 | Wr8(REG_GPIO, 0xFD & Rd8(REG_GPIO)); |
cpm219 | 0:2d0ef4830603 | 589 | } |