├── LICENSE ├── README.md ├── bench ├── .gitignore ├── console.py ├── drawingarea.py └── main.py ├── control_schema ├── drawing-artsy.svg ├── drawing.svg └── schema.png ├── docs ├── 01292A.pdf ├── 784774156.pdf ├── AN1078.pdf ├── AN1942.pdf ├── CD00211314.pdf ├── CD00258017.pdf ├── CD00298474.pdf ├── DM00031020.pdf ├── DM00037051.pdf ├── DM00039084.pdf ├── DM00051150.pdf ├── DM00097745.pdf ├── DRM099.pdf ├── DRM109.pdf ├── FULLTEXT01.pdf ├── GARS2006papers_S3P3.pdf ├── MB997.pdf ├── MCF51_ACLIB.pdf ├── MSc_Thesis_Subin_Sivadas_4119037.pdf ├── NCP1117-D.PDF ├── PMEG6020ER.pdf ├── SDR0805.pdf ├── SRN6045.pdf ├── TI_MotorControlCompendium_2010.odp ├── Tracking_Demodulation_Embedded.html ├── Tracking_Demodulation_Embedded_files │ ├── 0101spectraeq1.gif │ ├── 0101spectraeq10.gif │ ├── 0101spectraeq2.gif │ ├── 0101spectraeq3.gif │ ├── 0101spectraeq4.gif │ ├── 0101spectraeq5.gif │ ├── 0101spectraeq6.gif │ ├── 0101spectraeq7.gif │ ├── 0101spectraeq8.gif │ ├── 0101spectraeq9.gif │ ├── 0101spectrafig1.gif │ ├── 0101spectrafig2.gif │ ├── BrightcoveExperiences.js │ ├── ads │ ├── all.js │ ├── app.css │ ├── checkauth.js │ ├── container.html │ ├── contentgating.js │ ├── css.css │ ├── custom_tracking.js │ ├── embedded-logo.png │ ├── envelope.png │ ├── expand-arrow.png │ ├── federated_f9.swf │ ├── feedback-tab.png │ ├── folder.png │ ├── ga.js │ ├── global.css │ ├── gpt.js │ ├── h_s_code_remote.js │ ├── in.js │ ├── insight.js │ ├── j.js │ ├── jHtmlArea-0.js │ ├── jquery-ui.css │ ├── jquery-ui.js │ ├── jquery.js │ ├── jquery_002.js │ ├── lightbox-embedded.css │ ├── lightbox.css │ ├── lightbox.js │ ├── modernizr.js │ ├── nextgen.js │ ├── plugins.js │ ├── printer.png │ ├── pubads_impl_52.js │ ├── registration.css │ ├── socialfeed.css │ ├── start-up.css │ ├── transparent-swatch.png │ ├── twlightbox.css │ ├── ubm-global-footer.css │ ├── ubm-global-footer.js │ ├── ubm_tech_logo_footer_black88x111.jpg │ ├── vXhNDLnX1CtX07Kf4sAFw.js │ ├── w9JKbyW340G.html │ ├── w9JKbyW340G_002.html │ └── widgets.js ├── WCE2011_pp1504-1508.pdf ├── abm3b.pdf ├── advanced simulation model for brusless dc motor drives.pdf ├── bpra048.pdf ├── drv8301.pdf ├── drv8302.pdf ├── ir2011.pdf ├── irfh7440pbf-1.pdf ├── irlr7843.pdf ├── lm2574.pdf ├── res2digi401.pdf ├── scialert_sim │ ├── Modeling and Simulation of BLDCM Using MATLAB_SIMULINK.html │ └── Modeling and Simulation of BLDCM Using MATLAB_SIMULINK_files │ │ ├── element.js │ │ ├── element_main.js │ │ ├── eq1-2k6-688-691.gif │ │ ├── eq2-2k6-688-691.gif │ │ ├── eq3-2k6-688-691.gif │ │ ├── eq4-2k6-688-691.gif │ │ ├── eq5-2k6-688-691.gif │ │ ├── eq6-2k6-688-691.gif │ │ ├── eq7-2k6-688-691.gif │ │ ├── eq8-2k6-688-691.gif │ │ ├── fig1-2k6-688-691.gif │ │ ├── fig2-2k6-688-691.gif │ │ ├── fig3-2k6-688-691.gif │ │ ├── fig4-2k6-688-691.gif │ │ ├── fig5-2k6-688-691.gif │ │ ├── fig6-2k6-688-691.gif │ │ ├── fulltext_01.gif │ │ ├── fulltext_02.gif │ │ ├── fulltext_03.gif │ │ ├── fulltext_04.gif │ │ ├── fulltext_05.gif │ │ ├── fulltext_06.gif │ │ ├── fulltext_07.gif │ │ ├── fulltext_08.gif │ │ ├── fulltext_10.gif │ │ ├── jquery-latest.js │ │ ├── main.js │ │ ├── page_flip.png │ │ ├── selectuser.js │ │ ├── spacer.gif │ │ ├── style.css │ │ ├── translate-32.png │ │ ├── translateelement.css │ │ └── wz_tooltip.js ├── slva552.pdf ├── slva642.pdf ├── slva654.pdf ├── slvc539.zip ├── sn65hvd230.pdf ├── sprabn7.pdf └── tps54160.pdf ├── escsim ├── .gitignore ├── constants.py ├── graph.py ├── sim.py └── simulator.py ├── escsw-coocox ├── Drivers │ ├── STM32_USB_Device_Library │ │ ├── Class │ │ │ └── cdc │ │ │ │ ├── inc │ │ │ │ └── usbd_cdc_core.h │ │ │ │ └── src │ │ │ │ └── usbd_cdc_core.c │ │ ├── Core │ │ │ ├── inc │ │ │ │ ├── usbd_conf_template.h │ │ │ │ ├── usbd_core.h │ │ │ │ ├── usbd_def.h │ │ │ │ ├── usbd_ioreq.h │ │ │ │ ├── usbd_req.h │ │ │ │ └── usbd_usr.h │ │ │ └── src │ │ │ │ ├── usbd_core.c │ │ │ │ ├── usbd_ioreq.c │ │ │ │ └── usbd_req.c │ │ └── Release_Notes.html │ └── STM32_USB_OTG_Driver │ │ ├── Release_Notes.html │ │ ├── inc │ │ ├── usb_bsp.h │ │ ├── usb_core.h │ │ ├── usb_dcd.h │ │ ├── usb_dcd_int.h │ │ ├── usb_defines.h │ │ ├── usb_hcd.h │ │ ├── usb_hcd_int.h │ │ ├── usb_otg.h │ │ └── usb_regs.h │ │ └── src │ │ ├── usb_core.c │ │ ├── usb_dcd.c │ │ ├── usb_dcd_int.c │ │ ├── usb_hcd.c │ │ ├── usb_hcd_int.c │ │ └── usb_otg.c ├── ESC.cogui ├── ESC.comarker ├── ESC.coproj ├── STM32F4-Discovery │ ├── pdm_filter.h │ ├── stm32f4_discovery.c │ ├── stm32f4_discovery.h │ ├── stm32f4_discovery_audio_codec.c │ ├── stm32f4_discovery_audio_codec.h │ ├── stm32f4_discovery_lis302dl.c │ └── stm32f4_discovery_lis302dl.h ├── algorithms.c ├── algorithms.h ├── cdc │ ├── inc │ │ ├── usb_conf.h │ │ ├── usbd_cdc_vcp.h │ │ ├── usbd_conf.h │ │ ├── usbd_desc.h │ │ └── usbh_conf.h │ └── src │ │ ├── usb_bsp.c │ │ ├── usbd_cdc_vcp.c │ │ ├── usbd_desc.c │ │ └── usbd_usr.c ├── cmsis │ ├── core_cm4.h │ ├── core_cm4_simd.h │ ├── core_cmFunc.h │ └── core_cmInstr.h ├── cmsis_boot │ ├── startup │ │ └── startup_stm32f4xx.c │ ├── stm32f4xx.h │ ├── stm32f4xx_conf.h │ ├── system_stm32f4xx.c │ └── system_stm32f4xx.h ├── cmsis_lib │ ├── include │ │ ├── misc.h │ │ ├── stm32f4xx_adc.h │ │ ├── stm32f4xx_dac.h │ │ ├── stm32f4xx_dma.h │ │ ├── stm32f4xx_exti.h │ │ ├── stm32f4xx_gpio.h │ │ ├── stm32f4xx_i2c.h │ │ ├── stm32f4xx_pwr.h │ │ ├── stm32f4xx_rcc.h │ │ ├── stm32f4xx_spi.h │ │ ├── stm32f4xx_syscfg.h │ │ ├── stm32f4xx_tim.h │ │ └── stm32f4xx_usart.h │ └── source │ │ ├── misc.c │ │ ├── stm32f4xx_adc.c │ │ ├── stm32f4xx_dac.c │ │ ├── stm32f4xx_dma.c │ │ ├── stm32f4xx_exti.c │ │ ├── stm32f4xx_gpio.c │ │ ├── stm32f4xx_i2c.c │ │ ├── stm32f4xx_pwr.c │ │ ├── stm32f4xx_rcc.c │ │ ├── stm32f4xx_spi.c │ │ ├── stm32f4xx_syscfg.c │ │ ├── stm32f4xx_tim.c │ │ └── stm32f4xx_usart.c ├── componentfile.history ├── config.c ├── config.h ├── main.c ├── stm32f4_discovery_callbacks.c ├── stm32f4xx_it.c ├── stm32f4xx_it.h ├── syscalls │ └── syscalls.c └── vars.h ├── foc_simulation ├── .gitignore ├── __init__.py ├── foc.py └── run_foc.sh └── hardware ├── BOMv4.ods ├── boardv4.png ├── bomv7.ods ├── bomv9.ods ├── escv4.pdf ├── escv7.svg ├── escv8.pdf └── escv9.pdf /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Field Oriented Control 2 | 3 | FOC is an algorithm used to run motors with several benefits: 4 | 5 | * they run more quiet 6 | * they produce less vibrations, because the torque ripple is lower 7 | * they are more efficient (some people report even 25% improvement) 8 | * One report indicates a 100% improvement at very low rpm. 9 | 10 | ## Why? 11 | 12 | I tried creating this ESC for about a year now and the hardware consistently had issues: 13 | 14 | * No voltage for the 3.3v system / processor 15 | * The processor couldn't be programmed 16 | * Lots of noise on the ADC parts. 17 | 18 | It is too expensive for me to continue, given the track record of the project. 19 | 20 | Looking at the repository however, I think it's important to opensource it, because regardless of the hardware (and the video below), it's clear I got pretty close. 21 | 22 | What's most interesting probably are three parts: the algorithms.c code, the documentation in the docs folder (I scoured this together on the inet, browsing for ages and clicking links everywhere) and the simulator with the FOC implementation that suggests the algorithm should actually work. 23 | 24 | So I hope that someone else with better means to create electronics can use this information and put a working FOC ESC together. 25 | 26 | ## Did none of it work? 27 | 28 | Yes, there have been boards that worked, but the noise on ADC was too high for the algorithm to work reliably and the processor was not powerful enough. A video is here: 29 | 30 | https://www.youtube.com/watch?v=6R9PgWKNlGw 31 | 32 | Oh, and here's the simulator at work: 33 | 34 | https://www.youtube.com/watch?v=rsVllHhEW88 35 | 36 | The biggest issues and hints: 37 | 38 | 1. I could not get the buck/boost in the DRV8301/2 chips to work reliably. 8 out of 10 boards failed, because it didn't produce 5V or it couldn't handle the current load. 39 | 2. Depending on how the board is routed, you may get a lot of noise in the ADC channels. One of the versions used separation of analog and digital for the processor, but that really got in the way. It seems best to simply connect analog and digital together, because that's the reference the DRV chips use. 40 | 3. Routing the analog signals where the current is measured at the resistor needs a lot of attention. The GND and signal track need to have similar length and be routed away from interference. 41 | 4. Separate high power from digital. In the latest design, the current sensor (resistors) are in the middle of the board with the mosfets to the right. 42 | 5. Using separate components rather than the chip could bring benefits. This allows you to get current sensing amplifiers very close to where the signals are generated with minimum trace and then use the amplified signal (10x?) instead, which significantly reduces noise seen at the cpu. 43 | 44 | ## What's in here? 45 | 46 | bench: A utility to receive motor telemetry over UART in python and plotting it on a UI. 47 | control_schema: A schematic explanation how FOC works 48 | docs: Loads, loads and loads of docs... about FOC in general, reports, simulation and datasheets for components that were used. 49 | escsim: A simulator for a brushless DC motor (BLDC), without an algorithm controlling it. 50 | escsw-coocox: A preliminary implementation in coocox for the motor controller. Here you have the "algorithm" in algorithms.c 51 | foc_simulation: Implementation of the algorithm in python to use it with the simulator 52 | hardware: Some schematics of the hardware to build the ESC. 53 | 54 | ## Can I ask questions? 55 | 56 | Try to raise an issue in this repository, so that some common questions get answered. But I consider this thing done and dusted, I'm moving on. 57 | 58 | ## Is anyone making one right now? 59 | 60 | By my knowledge this project is pretty active. It's a bit focused towards higher power ESC (so maybe not immediately useful for quads), but for wings and skateboards, should be good: 61 | 62 | http://vedder.se/ 63 | 64 | I learned from this blog here too: 65 | 66 | http://scolton.blogspot.com.br/p/motor-controllers.html 67 | 68 | There are other ESC's to look at: 69 | 70 | - pxESC (has CAN implementation!) 71 | - ESC32 72 | 73 | There also exist some ESC's that are not widely known at all, mostly home-built electronics projects. 74 | -------------------------------------------------------------------------------- /bench/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | 3 | -------------------------------------------------------------------------------- /bench/console.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import argparse 3 | import tty, sys 4 | import termios 5 | import select 6 | 7 | import math 8 | import sys 9 | import serial 10 | from struct import * 11 | import threading 12 | import sys, tty, termios 13 | 14 | UART_BUF_SIZE = 8 15 | X_LIM = 100 16 | 17 | class MyConsole(): 18 | def __init__( self, dev ): 19 | self.ser = serial.Serial( dev, 115200, timeout=1 ) 20 | t = threading.Thread(target=self.read_input) 21 | t.daemon = True 22 | t.start() 23 | 24 | def on_timeout( self, userdata ): 25 | self.receive_uart() 26 | return True 27 | 28 | def readme( self ): 29 | fd = sys.stdin.fileno() 30 | old_settings = termios.tcgetattr(fd) 31 | try: 32 | tty.setraw(sys.stdin.fileno()) 33 | ch = sys.stdin.read(1) 34 | finally: 35 | termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) 36 | return ch 37 | 38 | def read_input( self ): 39 | while True: 40 | c = self.readme() 41 | if ( c == 'c' ): 42 | break 43 | if ( c == '+' ): 44 | self.ser.write( '+' ) 45 | if ( c == '-' ): 46 | self.ser.write( '-' ) 47 | 48 | def synchronize( self ): 49 | # synchronize first 50 | x3 = 0xFF 51 | x2 = 0xFF 52 | x1 = 0xFF 53 | x = 0xFF 54 | 55 | while True: 56 | x3 = x2 57 | x2 = x1 58 | x1 = x 59 | x = self.ser.read(1) 60 | if x == '\n' and x1 == '\0' and x2 == '\0' and x3 == '\0': 61 | break 62 | 63 | def receive_uart( self ): 64 | x = self.ser.read( UART_BUF_SIZE ) 65 | if len(x) == UART_BUF_SIZE: 66 | (calls, end) = unpack( '>ii', x ) 67 | if not end == 0x0000000a: 68 | self.synchronize() 69 | return 70 | if calls > 0: 71 | print "calls: %d"%( calls ) 72 | 73 | def main( dev ): 74 | app = MyConsole( dev ) 75 | while True: 76 | app.receive_uart() 77 | 78 | if __name__ == "__main__": 79 | parser = argparse.ArgumentParser(description='Process some integers.') 80 | parser.add_argument('dev', help='the USB serial device to use') 81 | 82 | args = parser.parse_args() 83 | main( args.dev ) 84 | 85 | -------------------------------------------------------------------------------- /bench/drawingarea.py: -------------------------------------------------------------------------------- 1 | from gi.repository import Gtk, Gdk, GObject 2 | 3 | class Graph2(Gtk.DrawingArea): 4 | def __init__ (self, ymin, ymax): 5 | Gtk.DrawingArea.__init__(self) 6 | self.set_size_request( 1024, 200 ) 7 | self.scale = 200.0 / (ymax+abs(ymin)) 8 | self.mid = ymax * self.scale 9 | self.connect("draw", self.draw) 10 | self.connect("configure_event", self.configure_event) 11 | self.a1 = [self.mid] * 1024 12 | self.a2 = [self.mid] * 1024 13 | 14 | # Create a new backing pixmap of the appropriate size 15 | def configure_event(self, widget, event): 16 | rect = widget.get_allocation() 17 | return True 18 | 19 | def append( self, v1, v2 ): 20 | self.a1.pop(0) 21 | self.a1.append( self.mid - v1 * self.scale ) 22 | self.a2.pop(0) 23 | self.a2.append( self.mid - v2 * self.scale ) 24 | self.queue_draw() 25 | 26 | # Redraw the screen from the backing pixmap 27 | # This method calls the operations going on in the model 28 | def draw( self, widget, cr): 29 | rect = widget.get_allocation() 30 | 31 | cr.set_line_width(0.5) 32 | cr.set_source_rgb(1.0, 0, 0) 33 | cr.move_to( 0, self.a1[0] ) 34 | for i in range(1, len(self.a1)): 35 | cr.line_to( i, self.a1[ i ] ) 36 | cr.stroke() 37 | 38 | cr.set_source_rgb(0.0, 1.0, 0) 39 | cr.move_to( 0, self.a2[0] ) 40 | for i in range(1, len(self.a2)): 41 | cr.line_to( i, self.a2[ i ] ) 42 | cr.stroke() 43 | 44 | return True 45 | 46 | class Graph3(Gtk.DrawingArea): 47 | def __init__ (self, ymin, ymax): 48 | Gtk.DrawingArea.__init__(self) 49 | self.set_size_request( 1024, 200 ) 50 | self.scale = 200.0 / (ymax+abs(ymin)) 51 | self.mid = ymax * self.scale 52 | self.connect("draw", self.draw) 53 | self.connect("configure_event", self.configure_event) 54 | self.a1 = [self.mid] * 1024 55 | self.a2 = [self.mid] * 1024 56 | self.a3 = [self.mid] * 1024 57 | 58 | # Create a new backing pixmap of the appropriate size 59 | def configure_event(self, widget, event): 60 | rect = widget.get_allocation() 61 | return True 62 | 63 | def append( self, v1, v2, v3 ): 64 | self.a1.pop(0) 65 | self.a1.append( self.mid - v1 * self.scale ) 66 | self.a2.pop(0) 67 | self.a2.append( self.mid - v2 * self.scale ) 68 | self.a3.pop(0) 69 | self.a3.append( self.mid - v3 * self.scale ) 70 | self.queue_draw() 71 | 72 | # Redraw the screen from the backing pixmap 73 | # This method calls the operations going on in the model 74 | def draw( self, widget, cr): 75 | rect = widget.get_allocation() 76 | 77 | cr.set_line_width(0.5) 78 | cr.set_source_rgb(1.0, 0, 0) 79 | cr.move_to( 0, self.a1[0] ) 80 | for i in range(1, len(self.a1)): 81 | cr.line_to( i, self.a1[ i ] ) 82 | cr.stroke() 83 | 84 | cr.set_source_rgb(0.0, 1.0, 0) 85 | cr.move_to( 0, self.a2[0] ) 86 | for i in range(1, len(self.a2)): 87 | cr.line_to( i, self.a2[ i ] ) 88 | cr.stroke() 89 | 90 | cr.set_source_rgb(0.0, 0.0, 1.0) 91 | cr.move_to( 0, self.a3[0] ) 92 | for i in range(1, len(self.a3)): 93 | cr.line_to( i, self.a3[ i ] ) 94 | cr.stroke() 95 | 96 | return True 97 | -------------------------------------------------------------------------------- /bench/main.py: -------------------------------------------------------------------------------- 1 | from gi.repository import Gtk, Gdk, GObject 2 | 3 | import numpy as np 4 | import drawingarea 5 | import argparse 6 | 7 | import math 8 | import sys 9 | import serial 10 | from struct import * 11 | 12 | UART_BUF_SIZE = 84 13 | X_LIM = 100 14 | 15 | # Fix16 scaling factor 16 | SCALE = 65536. 17 | 18 | # Fix16 overflow indicator 19 | OVERFLOW = -2**31 20 | 21 | def f16_to_float(val): 22 | return float(val) / SCALE 23 | 24 | def float_to_f16(val): 25 | val = int(round(val * SCALE)) 26 | if val >= 2**31 or val < -2**31: 27 | val = OVERFLOW 28 | return val 29 | 30 | class Display(Gtk.Window): 31 | def __init__ (self, dev): 32 | Gtk.Window.__init__(self) 33 | 34 | self.rpma = drawingarea.Graph2( -2000, 2000 ) 35 | self.curra = drawingarea.Graph3( -20000, 20000 ) 36 | 37 | vbox = Gtk.VBox() 38 | self.add(vbox) 39 | 40 | vbox.pack_start(self.rpma, True, True, 0) 41 | vbox.pack_start(self.curra, True, True, 0) 42 | 43 | hbox = Gtk.HBox() 44 | self.voltsl = self.add_label( "volts: ", hbox ) 45 | self.pwm_inl = self.add_label( "pwm: ", hbox ) 46 | self.iqrl = self.add_label( "Iqreq: ", hbox ) 47 | self.vql = self.add_label( "Vq: ", hbox ) 48 | self.vdl = self.add_label( "Vd: ", hbox ) 49 | vbox.pack_start(hbox, True, True, 0) 50 | 51 | hbox = Gtk.HBox() 52 | plusbtn = Gtk.Button( "+" ) 53 | plusbtn.connect( "clicked" , self.addpwm ) 54 | hbox.pack_start( plusbtn, True, True, 0 ) 55 | minbtn = Gtk.Button( "-" ) 56 | minbtn.connect( "clicked" , self.subtractpwm ) 57 | hbox.pack_start( minbtn, True, True, 0 ) 58 | self.graph = False 59 | graphbtn = Gtk.Button( "graph" ) 60 | graphbtn.connect( "clicked" , self.toggle_graph ) 61 | hbox.pack_start( graphbtn, True, True, 0 ) 62 | 63 | vbox.pack_start(hbox, True, True, 0) 64 | # Create toolbar 65 | #toolbar = NavigationToolbar(self.canvas, self) 66 | #vbox.pack_start(toolbar, False, False, 0) 67 | 68 | self.connect_after('destroy', self.destroy) 69 | 70 | #self.set_size_request (200, 200) 71 | self.ser = serial.Serial( dev, 57600, timeout=1 ) 72 | self.synchronize() 73 | self.show_all() 74 | 75 | def toggle_graph( self, btn ): 76 | self.graph = not self.graph 77 | btn.set_label( "Graph: %d"%( self.graph ) ) 78 | 79 | def add_label( self, labelname, hbox ): 80 | ln = Gtk.Label( labelname ) 81 | vlabel = Gtk.Label( "0.00" ) 82 | hbox.pack_start( ln, True, True, 0 ) 83 | hbox.pack_start( vlabel, True, True, 0 ) 84 | return vlabel 85 | 86 | def addpwm( self, btn ): 87 | self.ser.write( '+' ) 88 | 89 | def subtractpwm( self, btn ): 90 | self.ser.write( '-' ) 91 | 92 | def destroy(self,window): 93 | Gtk.main_quit() 94 | 95 | def on_timeout( self, userdata ): 96 | self.receive_uart() 97 | return True 98 | 99 | def synchronize( self ): 100 | # synchronize first 101 | x3 = 0xFF 102 | x2 = 0xFF 103 | x1 = 0xFF 104 | x = 0xFF 105 | 106 | while True: 107 | x3 = x2 108 | x2 = x1 109 | x1 = x 110 | x = self.ser.read(1) 111 | if x == '\n' and x1 == '\0' and x2 == '\0' and x3 == '\0': 112 | break 113 | 114 | def receive_uart( self ): 115 | if ( self.ser.inWaiting() <= 0 ): 116 | return 117 | x = self.ser.read( UART_BUF_SIZE ) 118 | if ( len(x) == UART_BUF_SIZE ): 119 | (self.volts, self.Ialpha, self.Ibeta, self.aHat, self.idm, self.iqm, self.rpm, self.bemfa, self.vidx, self.vq, self.vd, self.valpha, self.vbeta, self.rpm_command, self.pwm_in, self.iqr, self.va, self.vb, self.vc, self.extra, self.end) = unpack( '>iiiiiiiiiiiiiiiiiiiii', x ) 120 | if not self.end == 0x0000000a: 121 | self.synchronize() 122 | return 123 | 124 | self.rpma.append( self.rpm, self.rpm_command ) 125 | self.curra.append( f16_to_float( self.Ialpha ) * 1000, f16_to_float( self.Ibeta ) * 1000, 0 ) 126 | 127 | self.voltsl.set_text( "%04.3f"%(self.volts/1000.0) ) 128 | self.pwm_inl.set_text( "%d"%(self.pwm_in) ) 129 | self.iqrl.set_text( "%d"%(self.iqr) ) 130 | self.vql.set_text( "%d"%(self.vq) ) 131 | self.vdl.set_text( "%d"%(self.vd) ) 132 | 133 | print "ialpha: %f, ibeta: %f, reqrpm: %d, mesrpm: %d, iqm: %f, idm: %f, valpha: %f, vbeta: %f, vq: %d, vd: %d, bemfa: %f, extra: %d"%( f16_to_float( self.Ialpha ), f16_to_float( self.Ibeta ), self.rpm_command, self.rpm, f16_to_float( self.iqm ), f16_to_float( self.idm ), f16_to_float( self.valpha ), f16_to_float( self.vbeta ), self.vq, self.vd, f16_to_float( self.bemfa ), self.extra ) 134 | 135 | #print "%f, %f, %f, %f, %f"%( f16_to_float( self.Ialpha ), f16_to_float( self.Ibeta ), f16_to_float(self.extra), f16_to_float( self.iqm ), f16_to_float( self.idm )) 136 | 137 | def main( dev ): 138 | app = Display( dev ) 139 | GObject.timeout_add(20, app.on_timeout, None) 140 | Gtk.main() 141 | 142 | if __name__ == "__main__": 143 | parser = argparse.ArgumentParser(description='Process some integers.') 144 | parser.add_argument('dev', help='the USB serial device to use') 145 | 146 | args = parser.parse_args() 147 | main( args.dev ) 148 | 149 | -------------------------------------------------------------------------------- /control_schema/schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/control_schema/schema.png -------------------------------------------------------------------------------- /docs/01292A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/01292A.pdf -------------------------------------------------------------------------------- /docs/784774156.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/784774156.pdf -------------------------------------------------------------------------------- /docs/AN1078.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/AN1078.pdf -------------------------------------------------------------------------------- /docs/AN1942.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/AN1942.pdf -------------------------------------------------------------------------------- /docs/CD00211314.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/CD00211314.pdf -------------------------------------------------------------------------------- /docs/CD00258017.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/CD00258017.pdf -------------------------------------------------------------------------------- /docs/CD00298474.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/CD00298474.pdf -------------------------------------------------------------------------------- /docs/DM00031020.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/DM00031020.pdf -------------------------------------------------------------------------------- /docs/DM00037051.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/DM00037051.pdf -------------------------------------------------------------------------------- /docs/DM00039084.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/DM00039084.pdf -------------------------------------------------------------------------------- /docs/DM00051150.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/DM00051150.pdf -------------------------------------------------------------------------------- /docs/DM00097745.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/DM00097745.pdf -------------------------------------------------------------------------------- /docs/DRM099.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/DRM099.pdf -------------------------------------------------------------------------------- /docs/DRM109.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/DRM109.pdf -------------------------------------------------------------------------------- /docs/FULLTEXT01.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/FULLTEXT01.pdf -------------------------------------------------------------------------------- /docs/GARS2006papers_S3P3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/GARS2006papers_S3P3.pdf -------------------------------------------------------------------------------- /docs/MB997.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/MB997.pdf -------------------------------------------------------------------------------- /docs/MCF51_ACLIB.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/MCF51_ACLIB.pdf -------------------------------------------------------------------------------- /docs/MSc_Thesis_Subin_Sivadas_4119037.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/MSc_Thesis_Subin_Sivadas_4119037.pdf -------------------------------------------------------------------------------- /docs/NCP1117-D.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/NCP1117-D.PDF -------------------------------------------------------------------------------- /docs/PMEG6020ER.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/PMEG6020ER.pdf -------------------------------------------------------------------------------- /docs/SDR0805.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/SDR0805.pdf -------------------------------------------------------------------------------- /docs/SRN6045.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/SRN6045.pdf -------------------------------------------------------------------------------- /docs/TI_MotorControlCompendium_2010.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/TI_MotorControlCompendium_2010.odp -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq1.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq10.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq2.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq3.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq4.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq5.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq6.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq7.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq8.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectraeq9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectraeq9.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectrafig1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectrafig1.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/0101spectrafig2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/0101spectrafig2.gif -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/checkauth.js: -------------------------------------------------------------------------------- 1 | $( document ).ready(function() { 2 | var referer = encodeURIComponent(document.referrer); 3 | var siteBasePath = window.location.protocol + '//' + window.location.hostname; 4 | var redirectTo = encodeURIComponent(siteBasePath + '/checkauthIFrame.htm'); 5 | $.ajax({ 6 | url: '/checkauth', 7 | data: {'referer': referer, 'redirectTo': redirectTo}, 8 | success: function(data){ 9 | if (typeof(data) != 'undefined' && data != null && typeof(data.redirectTo) != 'undefined' && data.redirectTo != null) { 10 | $('body').append(''); 11 | $('#checkAuthFrame').load(function() { 12 | var cLocation = $(this).contents().find('#cLocation').html(); 13 | //Get URL from param 14 | var token = $.getUrlVar(cLocation, 'token'); 15 | if ( token !== undefined && token != '' ) { 16 | //If token is exist then do second checkauth call to process the token 17 | var welcomeUrl = encodeURIComponent(siteBasePath + '/index/welcome'); 18 | $.ajax({ 19 | type: "GET", 20 | url: "/checkauth", 21 | data: {'referer': referer, 'redirectTo': welcomeUrl, 'token': token}, 22 | success: function(data){ 23 | $.welcomeCall ( welcomeUrl ); 24 | 25 | //Authenticate into Gama account for who logged in via SSO 26 | //$.gamaAccCall (); 27 | }, 28 | dataType: 'json', 29 | cache: false 30 | }); 31 | } 32 | else { 33 | $.welcomeCall (); 34 | } 35 | }); 36 | } 37 | else { 38 | $.welcomeCall (); 39 | } 40 | }, 41 | dataType: 'json', 42 | cache: false 43 | }); 44 | 45 | $.welcomeCall = function ( welcomeUrl ) { 46 | var referer = encodeURIComponent(document.referrer); 47 | var redirectTo = encodeURIComponent(window.location.href); 48 | if ( typeof ( welcomeUrl ) == 'undefined' ) { 49 | welcomeUrl = siteBasePath + '/index/welcome'; 50 | } 51 | $.ajax({ 52 | url: decodeURIComponent(welcomeUrl), 53 | data: {'referer': referer, 'redirectTo': redirectTo}, 54 | type: 'POST', 55 | success: function(data){ 56 | //Update welcome bar 57 | 58 | $('.login-bar').html(data); 59 | 60 | //Initialize lightbox 61 | $('.login-bar').nextGenInit({ 62 | width: 780, 63 | siteUrlPrefix: '', 64 | siteRedirectPrefix: '' 65 | }); 66 | }, 67 | cache: false 68 | }); 69 | }; 70 | 71 | $.gamaAccCall = function ( ) { 72 | $.ajax({ 73 | url: '/registration/managegamaaccount', 74 | success: function ( data ) { 75 | //If there is any error in loggin into gama account then logout from NG acc as well 76 | if ( data.error && data.logoutUrl ) { 77 | window.location = data.logoutUrl; 78 | } 79 | }, 80 | cache: false 81 | }); 82 | }; 83 | 84 | $.getUrlVar = function(url, key){ 85 | var result = new RegExp(key + "=([^&]*)", "i").exec(url); 86 | return result && unescape(result[1]) || ""; 87 | }; 88 | }); -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/container.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/contentgating.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/css.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Open Sans'; 3 | font-style: normal; 4 | font-weight: 400; 5 | src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v10/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff'); 6 | } 7 | @font-face { 8 | font-family: 'Open Sans'; 9 | font-style: normal; 10 | font-weight: 700; 11 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://fonts.gstatic.com/s/opensans/v10/k3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff) format('woff'); 12 | } 13 | -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/custom_tracking.js: -------------------------------------------------------------------------------- 1 | /* This file is used for adding javascript/jquery util functions which can be used for various purposes across sites 2 | * @Date Created: /09/06/2012 3 | */ 4 | 5 | /* itc_tracking function is used to track itc value in omniture. 6 | * @params: pass the anchor element and get the name attribute where the itc value has been set. 7 | * @result: tracking the itc value in v4 of omniture. 8 | */ 9 | function itc_tracking (element, event) 10 | { 11 | var itc_code = element.attr('name'); 12 | var classname = element.attr('class'); 13 | 14 | if(classname != null && classname != "undefined" && classname.indexOf("contentgating") !== -1) { 15 | event.preventDefault(); 16 | } 17 | if (itc_code != null && itc_code !=''){ 18 | var itc_link = element.attr('href'); 19 | event.preventDefault(); 20 | var s=s_gi('cmpglobalvista'); 21 | s.eVar4= itc_code; 22 | s.tl(element,'o','Internal Tracking Code'); 23 | if(classname == null || classname == "undefined" || classname.indexOf("contentgating") == -1) { 24 | setTimeout(function(){ 25 | //if the link contains target attribute, then page should open based on the target value 26 | var target = element.attr('target'); 27 | if (target != null && target != '') 28 | { 29 | window.open(itc_link, target); 30 | } 31 | else 32 | { 33 | window.location = itc_link; 34 | } 35 | },800); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/embedded-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/embedded-logo.png -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/envelope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/envelope.png -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/expand-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/expand-arrow.png -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/federated_f9.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/federated_f9.swf -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/feedback-tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/feedback-tab.png -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/folder.png -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/global.css: -------------------------------------------------------------------------------- 1 | .universal-header-for-mobile { 2 | display:none; 3 | } 4 | .universal-header, .universal-header-for-mobile { 5 | background: none repeat scroll 0 0 #000000; 6 | color: white; 7 | float: left; 8 | font-size: 14px; 9 | font-weight: bold; 10 | width: 100%; 11 | height:30px; 12 | font-family: Arial, Helvetica, sans-serif; 13 | font-size:13px; 14 | } 15 | .universal-header a { 16 | display: inline-block; 17 | overflow: hidden; 18 | text-decoration: none; 19 | text-indent: -999em; 20 | width:30px; 21 | height:30px; 22 | cursor:pointer; 23 | margin-left:30px; 24 | } 25 | .universal-header span { 26 | overflow:hidden; 27 | background-color:#333231; 28 | width:2px; 29 | height:30px; 30 | display:inline-block; 31 | } 32 | .universal-header a.datasheets { 33 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -6px -6px transparent; 34 | } 35 | .universal-header a.datasheets:hover, .universal-header a.datasheets.selected { 36 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -6px -41px transparent; 37 | } 38 | .universal-header a.ebn { 39 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -41px -6px transparent; 40 | } 41 | .universal-header a.ebn:hover, .universal-header a.ebn.selected { 42 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -41px -41px transparent; 43 | } 44 | .universal-header a.edn { 45 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -76px -6px transparent; 46 | } 47 | .universal-header a.edn:hover, .universal-header a.edn.selected { 48 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -76px -41px transparent; 49 | } 50 | .universal-header a.eet { 51 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -111px -6px transparent; 52 | } 53 | .universal-header a.eet:hover, .universal-header a.eet.selected { 54 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -111px -41px transparent; 55 | } 56 | .universal-header a.emb { 57 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -146px -6px transparent; 58 | } 59 | .universal-header a.emb:hover, .universal-header a.emb.selected { 60 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -146px -41px transparent; 61 | } 62 | .universal-header a.pa { 63 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -181px -6px transparent; 64 | } 65 | .universal-header a.pa:hover, .universal-header a.pa.selected { 66 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -181px -41px transparent; 67 | } 68 | .universal-header a.tol { 69 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -216px -6px transparent; 70 | margin-right:30px; 71 | } 72 | .universal-header a.tol:hover, .universal-header a.tol.selected { 73 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -216px -41px transparent; 74 | } 75 | .universal-header a.tmw { 76 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -251px -6px transparent; 77 | } 78 | .universal-header a.tmw:hover, .universal-header a.tmw.selected { 79 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -251px -41px transparent; 80 | } 81 | .universal-header .events a { 82 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -286px -6px transparent; 83 | width:60px; 84 | } 85 | .universal-header .events:hover > a { 86 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -286px -41px transparent; 87 | } 88 | .universal-header a.ubmt { 89 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -351px -4px transparent; 90 | float:right; 91 | margin-right:30px; 92 | width:80px; 93 | } 94 | .universal-header a.ubmt:hover { 95 | background: url("http://www.embedded.com/content/images/icons/UniversalHeader_Sprite.png") no-repeat scroll -351px -39px transparent; 96 | } 97 | .universal-header .events { 98 | display: inline-block; 99 | padding: 0; 100 | position: relative; 101 | } 102 | .universal-header ul { 103 | display: none; 104 | position: absolute; 105 | top: 29px; 106 | left: 29px; 107 | background: #000; 108 | z-index: 10000; 109 | width: 120px; 110 | list-style: none outside none; 111 | margin:0; padding:0; 112 | } 113 | .universal-header ul a { 114 | display: block; 115 | padding: 5px 0 5px 10px; 116 | border-right: none; 117 | float: none; 118 | color:white; 119 | text-indent:inherit; 120 | margin:0; 121 | width:110px !important; 122 | height:auto; 123 | background-image:none !important; 124 | } 125 | .universal-header ul a:hover, .universal-header-for-mobile ul a:hover, .universal-header-for-mobile:hover > a { 126 | color:#dadada; 127 | text-shadow: 0 0 5px #fff; 128 | } 129 | /* mobile css */ 130 | .universal-header-for-mobile a { 131 | line-height:30px; 132 | padding-left:15px; 133 | color:white; 134 | } 135 | .universal-header-for-mobile ul { 136 | display: none; 137 | position: absolute; 138 | background: #000; 139 | z-index: 10000; 140 | list-style: none outside none; 141 | top: 29px; 142 | width: 100%; 143 | margin:0; padding:0; 144 | } 145 | .universal-header-for-mobile ul a { 146 | display: block; 147 | padding: 5px 0 5px 15px; 148 | float: none; 149 | color:white; 150 | text-indent:inherit; 151 | margin:0; 152 | height:auto; 153 | text-decoration:none; 154 | } 155 | /* tablet settings */ 156 | @media screen and (max-width: 780px) 157 | { 158 | .universal-header .events { 159 | display:none; 160 | } 161 | } 162 | /* mobile settings */ 163 | @media screen and (max-width: 320px) 164 | { 165 | .universal-header { 166 | display:none; 167 | } 168 | .universal-header-for-mobile { 169 | display:block; 170 | cursor:pointer; 171 | } 172 | } 173 | #nextGenContainer #main { 174 | background: none repeat scroll 0 0 rgba(0, 0, 0, 0) !important; 175 | padding: 0 !important; 176 | } 177 | #registrationForm { 178 | border-top: 0 none !important; 179 | } 180 | #ngLoadingScreen.embedded { 181 | -moz-box-sizing: content-box; 182 | } 183 | #LoginForm ul.loginMessages { 184 | color: #FF0000; 185 | list-style: none outside none; 186 | max-width: 300px; 187 | padding: 0; 188 | } 189 | -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/in.js: -------------------------------------------------------------------------------- 1 | if(!window.console){window.console={} 2 | }if(typeof window.console.log!=="function"){window.console.log=function(){} 3 | }if(typeof window.console.warn!=="function"){window.console.warn=function(){} 4 | }(function(){var S={"bootstrapInit":+new Date()},p=document,m=(/^https?:\/\/.*?linkedin.*?\/in\.js.*?$/),b=(/async=true/),D=(/^https:\/\//),J=(/\/\*((?:.|[\s])*?)\*\//m),F=(/\r/g),j=(/[\s]/g),g=(/^[\s]*(.*?)[\s]*:[\s]*(.*)[\s]*$/),x=(/_([a-z])/gi),A=(/^[\s]+|[\s]+$/g),u=(/^[a-z]{2}(_)[A-Z]{2}$/),C=(/suppress(Warnings|_warnings):true/gi),d=(/^api(Key|_key)$/gi),k="\n",G=",",n="",I="@",o="extensions",Z="on",w="onDOMReady",ac="onOnce",aa="script",L="https://www.linkedin.com/uas/js/userspace?v=0.0.2000-RC8.39396-1420",h="https://platform.linkedin.com/js/secureAnonymousFramework?v=0.0.2000-RC8.39396-1420",H="http://platform.linkedin.com/js/nonSecureAnonymousFramework?v=0.0.2000-RC8.39396-1420",P="http://platform.linkedin.com/js/frameworkV2?v=0.0.2000-RC8.39396-1420",B=p.getElementsByTagName("head")[0],t=p.getElementsByTagName(aa),X=[],a=[],O=["lang"],R={},c=false,ad,l,W,r,K,E,ab; 5 | if(window.IN&&IN.ENV&&IN.ENV.js){if(!IN.ENV.js.suppressWarnings){console.warn("duplicate in.js loaded, any parameters will be ignored") 6 | }return 7 | }window.IN=window.IN||{}; 8 | IN.ENV={}; 9 | IN.ENV.js={}; 10 | IN.ENV.js.extensions={}; 11 | statsQueue=IN.ENV.statsQueue=[]; 12 | statsQueue.push(S); 13 | ad=IN.ENV.evtQueue=[]; 14 | IN.Event={on:function(){ad.push({type:Z,args:arguments}) 15 | },onDOMReady:function(){ad.push({type:w,args:arguments}) 16 | },onOnce:function(){ad.push({type:ac,args:arguments}) 17 | }}; 18 | IN.$extensions=function(ag){var aj,i,af,ai,ah=IN.ENV.js.extensions; 19 | aj=ag.split(G); 20 | for(var ae=0,e=aj.length; 21 | ae= 1); m[g.axis] = g.size === "auto" ? j[g.axis] : g.size; p[g.axis] = Math.min(m[g.axis], Math.max(0, (g.sizethumb === "auto" ? (m[g.axis] * h.ratio) : g.sizethumb))); d.ratio = g.sizethumb === "auto" ? (h[g.axis] / m[g.axis]) : (h[g.axis] - j[g.axis]) / (m[g.axis] - p[g.axis]); r = (z === "relative" && h.ratio <= 1) ? Math.min((h[g.axis] - j[g.axis]), Math.max(0, r)) : 0; r = (z === "bottom" && h.ratio <= 1) ? (h[g.axis] - j[g.axis]) : isNaN(parseInt(z, 10)) ? r : parseInt(z, 10); w() }; function w() { var z = v.toLowerCase(); p.obj.css(n, r / d.ratio); h.obj.css(n, -r); o.start = p.obj.offset()[n]; d.obj.css(z, m[g.axis]); m.obj.css(z, m[g.axis]); p.obj.css(z, p[g.axis]) } function s() { if (!e) { p.obj.bind("mousedown", i); m.obj.bind("mouseup", u) } else { j.obj[0].ontouchstart = function (z) { if (1 === z.touches.length) { i(z.touches[0]); z.stopPropagation() } } } if (g.scroll && window.addEventListener) { t[0].addEventListener("DOMMouseScroll", x, false); t[0].addEventListener("mousewheel", x, false); t[0].addEventListener("MozMousePixelScroll", function (z) { z.preventDefault() }, false) } else { if (g.scroll) { t[0].onmousewheel = x } } } function i(A) { a("body").addClass("noSelect"); var z = parseInt(p.obj.css(n), 10); o.start = l ? A.pageX : A.pageY; y.start = z == "auto" ? 0 : z; if (!e) { a(document).bind("mousemove", u); a(document).bind("mouseup", f); p.obj.bind("mouseup", f) } else { document.ontouchmove = function (B) { B.preventDefault(); u(B.touches[0]) }; document.ontouchend = f } } function x(B) { if (h.ratio < 1) { var A = B || window.event, z = A.wheelDelta ? A.wheelDelta / 120 : -A.detail / 3; r -= z * g.wheel; r = Math.min((h[g.axis] - j[g.axis]), Math.max(0, r)); p.obj.css(n, r / d.ratio); h.obj.css(n, -r); if (g.lockscroll || (r !== (h[g.axis] - j[g.axis]) && r !== 0)) { A = a.event.fix(A); A.preventDefault() } } } function u(z) { if (h.ratio < 1) { if (g.invertscroll && e) { y.now = Math.min((m[g.axis] - p[g.axis]), Math.max(0, (y.start + (o.start - (l ? z.pageX : z.pageY))))) } else { y.now = Math.min((m[g.axis] - p[g.axis]), Math.max(0, (y.start + ((l ? z.pageX : z.pageY) - o.start)))) } r = y.now * d.ratio; h.obj.css(n, -r); p.obj.css(n, y.now) } } function f() { a("body").removeClass("noSelect"); a(document).unbind("mousemove", u); a(document).unbind("mouseup", f); p.obj.unbind("mouseup", f); document.ontouchmove = document.ontouchend = null } return c() } } (jQuery)); -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/lightbox-embedded.css: -------------------------------------------------------------------------------- 1 | 2 | /*CSS SPECFIC TO EMBEDDED LIGHTBOX*/ 3 | #TWLightBoxPanel { 4 | width:630px !important; 5 | } 6 | #nextGenLoginContainer #registrationForm fieldset{ 7 | width:548px !important; 8 | } 9 | .embedded #registerlink2{display:none;} 10 | input[type="text"], input[type="password"], input[type="date"], input[type="datetime"], input[type="email"], input[type="number"], input[type="search"], input[type="tel"], input[type="time"], input[type="url"] 11 | { 12 | box-shadow: none !important; 13 | color: #000000 !important; 14 | display: block !important; 15 | height: 24 !important; 16 | margin: 0px !important; 17 | padding: 0px !important; 18 | transition: none; 19 | width: 100%; 20 | } 21 | textarea{ 22 | box-shadow: none !important; 23 | color: #000000 !important; 24 | display: block ; 25 | height: 24 ; 26 | margin: 0px !important; 27 | padding: 0px !important; 28 | transition: none; 29 | width: 100%; 30 | } 31 | .embedded #registrationForm .elementType_checkbox input{ 32 | margin-left:0px !important; 33 | margin-top:0px !important; 34 | } 35 | 36 | #nextGenLoginContainer.register 37 | { 38 | height:488px !important; 39 | } 40 | .ngLoadingScreen{ 41 | height:50px!important; 42 | } 43 | #nextGenLoginContainer { 44 | height: 426px!important; 45 | } 46 | /*CSS SPECFIC TO EMBEDDED LIGHTBOX*/ 47 | 48 | /*WELCOME CSS*/ 49 | .greetings{ 50 | font-family: "Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif; 51 | font-size: 14px; 52 | font-weight: normal; 53 | line-height: 1.6; 54 | margin-bottom: 17px; 55 | float: right; 56 | margin-right: 153px !important; 57 | } 58 | /*WELCOME CSS*/ 59 | 60 | .social_media #___plusone_0, #___plusone_1{ 61 | 62 | position: static !important; 63 | } 64 | .registerlogo { 65 | margin: 10px 20px; 66 | text-align: center; 67 | } 68 | .registerlogo .stlogo { 69 | background: url("http://cdn.embedded.com/Content/images/structure/embedded-logo.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); 70 | height: 58px; 71 | width: 331px; 72 | margin-left: 130px; 73 | } 74 | -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/printer.png -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/socialfeed.css: -------------------------------------------------------------------------------- 1 | /***** widget css ******/ 2 | #social-media .clearfix:after { 3 | content: "."; 4 | display: block; 5 | clear: both; 6 | visibility: hidden; 7 | line-height: 0; 8 | height: 0; 9 | } 10 | html[xmlns] .clearfix { 11 | display: block; 12 | } 13 | 14 | * html .clearfix { 15 | height: 1%; 16 | } 17 | .blue-social { 18 | background-color:#4996CF; 19 | border-radius: 3px 3px 0 0; 20 | color:white; 21 | font-size:18px; 22 | margin:0; 23 | padding: 18px 16px; 24 | text-transform:uppercase; 25 | } 26 | #social-media .widget-title { 27 | background: #000; 28 | color: #fff; 29 | font-size: 16px; 30 | font-weight: bold; 31 | text-align: center; 32 | font-family: "PT Sans Narrow","Helvetica Neue",Helvetica,Arial,sans-serif; 33 | padding: 5px 0; 34 | } 35 | #social-media.tmw .widget-title { 36 | background-color: #069; 37 | } 38 | #social-media #fb { 39 | padding: 10px 8px 10px 8px; 40 | } 41 | #social-media #fb, #social-media #gplus, #social-media #twit{ 42 | border-bottom: 1px dashed #999999; 43 | } 44 | #social-media #gplus{ 45 | padding: 12px 0 0 0; 46 | height: 145px; 47 | position: relative; 48 | } 49 | #___plus_0, #___plus_1 { 50 | position: absolute; 51 | left: 8px; 52 | } 53 | #___plusone_0, #___plusone_1 { 54 | position: absolute; 55 | left: 140px; 56 | top: 30px; 57 | z-index: 2; 58 | } 59 | #gplus_1 { 60 | width: 120px; 61 | height: 69px; 62 | } 63 | #gplus_2 { 64 | width: 120px; 65 | height: 69px; 66 | } 67 | #social-media #twit{ 68 | padding: 12px 0 12px 8px; 69 | } 70 | .twitter-follow-button { 71 | width: 190px; 72 | } 73 | #twit .button { 74 | padding-right: 6px; 75 | } 76 | #social-media #gplus #gplus_feeds, #social-media #twit #twit_feeds{ 77 | background: url("images/icn_followers.jpg"); 78 | background-repeat: no-repeat; 79 | width: 112px; 80 | height: 30px; 81 | float: right; 82 | text-indent: 20px 83 | } 84 | #social-media #gplus #gplus_feeds p, #social-media #twit #twit_feeds p{ 85 | position: absolute; 86 | margin: 8px 0 0 0; 87 | } 88 | #social-media #other-medias { 89 | padding: 12px 8px; 90 | } 91 | #social-media #other-medias img { 92 | margin:0; 93 | } 94 | #twit img { 95 | vertical-align: top; 96 | } 97 | .module #social-media .body { 98 | padding: 10px 6px 0px 6px; 99 | } 100 | 101 | 102 | /* Tiny Scrollbar */ 103 | #scrollbar1 { width: 100%; margin: 0; } 104 | #scrollbar1 .viewport { width: 93%; height: 289px; overflow: hidden; position: relative; } 105 | #scrollbar1 .overview { list-style: none; position: absolute; left: 0; top: 0; padding: 0; margin: 0; } 106 | #scrollbar1 .scrollbar{ background: transparent url(../images/scrollbar/bg-scrollbar-track-y.png) no-repeat 0 0; position: relative; background-position: 0 0; float: right; width: 15px; } 107 | #scrollbar1 .track { background: transparent url(../images/scrollbar/bg-scrollbar-trackend-y.png) no-repeat 0 100%; height: 100%; width:13px; position: relative; padding: 0 1px; } 108 | #scrollbar1 .thumb { background: transparent url(../images/scrollbar/bg-scrollbar-thumb-y.png) no-repeat 50% 100%; height: 20px; width: 25px; cursor: pointer; overflow: hidden; position: absolute; top: 0; left: -5px; } 109 | #scrollbar1 .thumb .end { background: transparent url(../images/scrollbar/bg-scrollbar-thumb-y.png) no-repeat 50% 0; overflow: hidden; height: 5px; width: 25px; } 110 | #scrollbar1 .disable { display: none; } 111 | .noSelect { user-select: none; -o-user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; } 112 | 113 | #scrollbar1 .overview .base-container { 114 | padding: 0; 115 | margin: 5px 0 5px 5px; 116 | width: 100% 117 | line-height: 15px; 118 | float: left; 119 | clear: both; 120 | } 121 | #scrollbar1 .overview .base-container .img { 122 | background-color: white; 123 | border: 1px solid #b6b6b6; 124 | padding: 2px; 125 | float: left; 126 | margin: 0 10px 0 0; 127 | } 128 | #scrollbar1 .overview .base-container a { 129 | font-weight: bold; 130 | font-size: 12px; 131 | } 132 | #scrollbar1 .overview .base-container a.readmore { 133 | font-size: 10px; 134 | } 135 | #social-media .latest-comments { 136 | height: 100%; 137 | border-left: 1px solid #b9b9b9; 138 | border-bottom: 1px solid #b9b9b9; 139 | } 140 | #scrollbar1 div img { 141 | background-color: #FFFFFF; 142 | border: 1px solid #B6B6B6; 143 | } 144 | #scrollbar1 img { 145 | float: left; 146 | margin: 0 10px 0 0; 147 | } -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/transparent-swatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/transparent-swatch.png -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/ubm-global-footer.css: -------------------------------------------------------------------------------- 1 | /* 2 | html,body,div,span,applet,object,iframe,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video { 3 | border:0; 4 | margin:0; 5 | padding:0; 6 | } 7 | use of the above ^ ^ deoends on the site */ 8 | body { 9 | margin:0; 10 | padding:0; 11 | background-color:#000; 12 | } 13 | #footerblack { 14 | font-family:Arial, Helvetica, sans-serif; 15 | font-size:.7em; 16 | text-align:left; 17 | background-color:#000; 18 | } 19 | #footerblack #rightlinks ul { 20 | color:#fff; 21 | border-bottom:.1em solid #666; 22 | margin:0; 23 | padding:.3em 1em .3em .3em; 24 | } 25 | #footerblack ul.ubm-global-network, #footergrey ul.ubm-global-network { 26 | border-bottom: solid .1em #999999; 27 | border-top: solid .1em #999999; 28 | padding: 1em .5em; 29 | color: #999999; 30 | list-style: none; 31 | text-align: center; 32 | float:left; 33 | } 34 | #footerblack ul.ubm-global-network li , #footergrey ul.ubm-global-network li { 35 | display: inline; 36 | line-height: 2em; 37 | border-right: solid .1em #fff; 38 | padding: 0 1em 0 0; 39 | margin: 0 1em 0 0; 40 | color:#fff; 41 | } 42 | #footergrey ul.ubm-global-network li { 43 | color:#666; 44 | border-right: solid .1em #666; 45 | } 46 | #footerblack ul.ubm-global-network li.first , #footergrey ul.ubm-global-network li.first, 47 | #footerblack ul.ubm-global-network li.last , #footergrey ul.ubm-global-network li.last { 48 | border-right: medium none; 49 | } 50 | #footerblack #rightlinks ul li a, #footerblack ul.ubm-global-network li a { 51 | color:#fff; 52 | text-decoration:none; 53 | font-weight:bold; 54 | } 55 | #footerblack #rightlinks ul li a:hover, #footerblack ul.ubm-global-network li a:hover { 56 | color:#999; 57 | text-decoration:underline; 58 | } 59 | #footerblack #rightlinks ul.blue { 60 | color:#9cf; 61 | border-bottom:0em; 62 | font-weight:normal; 63 | } 64 | #footerblack #rightlinks ul li a.blue { 65 | color:#9cf; 66 | font-weight:normal; 67 | } 68 | #footergrey { 69 | background-color:#e5e5e7; 70 | font-family:Arial, Helvetica, sans-serif; 71 | font-size:.7em; 72 | text-align:left; 73 | } 74 | #footergrey #rightlinks ul { 75 | color:#666; 76 | border-bottom:.1em solid #666; 77 | margin:0; 78 | padding:.3em 1em .3em .3em; 79 | } 80 | #footergrey #rightlinks ul li a, #footergrey ul.ubm-global-network li a { 81 | color:#666; 82 | text-decoration:none; 83 | font-weight:bold; 84 | } 85 | #footergrey #rightlinks ul li a:hover, #footergrey ul.ubm-global-network li a:hover { 86 | color:#333; 87 | text-decoration:underline; 88 | } 89 | #footergrey #rightlinks ul.blue { 90 | color:#369; 91 | border-bottom:0em; 92 | font-weight:normal; 93 | } 94 | #footergrey #rightlinks ul li a.blue { 95 | color:#369; 96 | font-weight:normal; 97 | } 98 | #footergrey #rightlinks ul.normal { 99 | font-weight:normal; 100 | } 101 | #footergrey #rightlinks ul li a.normal { 102 | color:#666; 103 | font-weight:normal; 104 | } 105 | #footerblack #left, 106 | #footergrey #left { 107 | float:left; 108 | margin:0; 109 | padding:0; 110 | } 111 | #footerblack #rightlinks, 112 | #footergrey #rightlinks { 113 | float:left; 114 | margin-top:1em; 115 | padding:0; 116 | } 117 | #footerblack #rightlinks ul li, 118 | #footergrey #rightlinks ul li { 119 | display:inline; 120 | } 121 | #footerblack #rightlinks ul.normal, 122 | #footerblack #rightlinks ul li a.normal { 123 | color:#fffff; 124 | font-weight:normal; 125 | } 126 | @media screen and (max-width: 780px) 127 | { 128 | .hide-for-small { 129 | display: none; 130 | } 131 | #footerblack #left, 132 | #footergrey #left, 133 | #footerblack #rightlinks, 134 | #footergrey #rightlinks { 135 | margin-left: auto;margin-right: auto;text-align: center;width: 100%; 136 | } 137 | } 138 | @media screen and (max-width: 920px) { 139 | #footerblack #rightlinks, 140 | #footergrey #rightlinks { 141 | float: none; 142 | } 143 | } -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/ubm-global-footer.js: -------------------------------------------------------------------------------- 1 | // JavaScript Document 2 | 3 | function getURLVar(name) { 4 | if (name = (new RegExp('[?&]' + encodeURIComponent(name) + '=([^&]*)')).exec(location.search)) 5 | return decodeURIComponent(name[1]); 6 | } 7 | 8 | var color = getURLVar('color'); 9 | var name = getURLVar('email'); 10 | 11 | /* 12 | var url_string = String(document.location); 13 | var url_index = url_string.indexOf("?email="); 14 | if (url_index>=0) { 15 | 16 | url_string = url_string.split('?'); 17 | url_string = url_string[1].split('='); 18 | //split if there is a second parameter of location 19 | if (url_string[2].toString() != null || "") { 20 | color = url_string[2].toString(); 21 | } 22 | url_string = url_string[1].split('&'); 23 | name = url_string[0].toString(); 24 | } 25 | */ 26 | if ( color == "grey") { 27 | document.getElementById('footerblack').id = 'footergrey'; 28 | document.getElementById("UBM_global_footer_img").src="http://twimgs.com/informationweek/footernav/oct2012/ubm_tech_logo_footer_grey88x111.jpg"; 29 | document.body.style.background = "#E5E5E7"; 30 | 31 | 32 | } 33 | document.getElementById("feedback_email").href = name; -------------------------------------------------------------------------------- /docs/Tracking_Demodulation_Embedded_files/ubm_tech_logo_footer_black88x111.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/Tracking_Demodulation_Embedded_files/ubm_tech_logo_footer_black88x111.jpg -------------------------------------------------------------------------------- /docs/WCE2011_pp1504-1508.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/WCE2011_pp1504-1508.pdf -------------------------------------------------------------------------------- /docs/abm3b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/abm3b.pdf -------------------------------------------------------------------------------- /docs/advanced simulation model for brusless dc motor drives.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/advanced simulation model for brusless dc motor drives.pdf -------------------------------------------------------------------------------- /docs/bpra048.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/bpra048.pdf -------------------------------------------------------------------------------- /docs/drv8301.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/drv8301.pdf -------------------------------------------------------------------------------- /docs/drv8302.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/drv8302.pdf -------------------------------------------------------------------------------- /docs/ir2011.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/ir2011.pdf -------------------------------------------------------------------------------- /docs/irfh7440pbf-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/irfh7440pbf-1.pdf -------------------------------------------------------------------------------- /docs/irlr7843.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/irlr7843.pdf -------------------------------------------------------------------------------- /docs/lm2574.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/lm2574.pdf -------------------------------------------------------------------------------- /docs/res2digi401.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/docs/res2digi401.pdf -------------------------------------------------------------------------------- /docs/scialert_sim/Modeling and Simulation of BLDCM Using MATLAB_SIMULINK_files/element.js: -------------------------------------------------------------------------------- 1 | (function(){var d=window,e=document,f="text/javascript",g="text/css",h="stylesheet",k="script",l="link",m="head",n="complete",p="UTF-8",q=".";function r(b){var a=e.getElementsByTagName(m)[0];a||(a=e.body.parentNode.appendChild(e.createElement(m)));a.appendChild(b)}function _loadJs(b){var a=e.createElement(k);a.type=f;a.charset=p;a.src=b;r(a)}function _loadCss(b){var a=e.createElement(l);a.type=g;a.rel=h;a.charset=p;a.href=b;r(a)}function _isNS(b){b=b.split(q);for(var a=d,c=0;cI)){var J=Number(G[2]),K=new Date,L=1E4*K.getFullYear()+100*(K.getMonth()+1)+K.getDate();!J||J 780 ): 31 | del self.l1[0] 32 | del self.l2[0] 33 | del self.l3[0] 34 | del self.l4[0] 35 | del self.l5[0] 36 | del self.l6[0] 37 | del self.l7[0] 38 | del self.l8[0] 39 | 40 | def draw_line( self, ctx, l ): 41 | for i in xrange(len( l )): 42 | ctx.line_to( i, l[i] ) 43 | 44 | def draw_lines(self,ctx ): 45 | ctx.translate( 10, 50 ) 46 | ctx.set_source_rgb(0, 0, 0) 47 | self.draw_line( ctx, self.l1 ) 48 | ctx.stroke() 49 | ctx.set_source_rgb(0, 0, 1) 50 | self.draw_line( ctx, self.l2 ) 51 | ctx.stroke() 52 | ctx.translate( 0, 150 ) 53 | ctx.set_source_rgb(0, 0, 0) 54 | self.draw_line( ctx, self.l3 ) 55 | ctx.stroke() 56 | ctx.set_source_rgb(0, 1, 0) 57 | self.draw_line( ctx, self.l4 ) 58 | ctx.stroke() 59 | ctx.translate( 0, 150 ) 60 | ctx.set_source_rgb(0, 0, 0) 61 | self.draw_line( ctx, self.l5 ) 62 | ctx.stroke() 63 | ctx.set_source_rgb(1, 0, 0) 64 | self.draw_line( ctx, self.l6 ) 65 | ctx.stroke() 66 | ctx.translate( 0, 150 ) 67 | ctx.set_source_rgb(0, 0, 0) 68 | self.draw_line( ctx, self.l7 ) 69 | ctx.stroke() 70 | ctx.set_source_rgb(1, 0, 1) 71 | self.draw_line( ctx, self.l8 ) 72 | ctx.stroke() 73 | 74 | def draw(self, da, ctx): 75 | ctx.scale( 1.0, 1.0 ) 76 | ctx.set_line_width(1) 77 | self.draw_lines( ctx ) 78 | 79 | 80 | -------------------------------------------------------------------------------- /escsim/sim.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Based on cairo-demo/X11/cairo-demo.c 4 | """ 5 | from gi.repository import Gdk, Gtk, GObject 6 | from graph import Graph 7 | from simulator import Simulator 8 | import constants 9 | 10 | t = 0.0 11 | n = 0 12 | sim = None 13 | graph = None 14 | pwm = None 15 | 16 | def main(): 17 | win = Gtk.Window() 18 | win.connect('destroy', lambda w: Gtk.main_quit()) 19 | win.set_default_size(800, 650) 20 | 21 | global graph, sim, pwm 22 | 23 | vbox = Gtk.VBox() 24 | win.add(vbox) 25 | 26 | graph = Graph() 27 | vbox.pack_start(graph, True, True, 0) 28 | 29 | hbox = Gtk.HBox() 30 | plusbtn = Gtk.Button( "+" ) 31 | plusbtn.connect( "clicked" , addpwm ) 32 | hbox.pack_start( plusbtn, True, True, 0 ) 33 | minbtn = Gtk.Button( "-" ) 34 | minbtn.connect( "clicked" , subtractpwm ) 35 | hbox.pack_start( minbtn, True, True, 0 ) 36 | pwm = add_label( "pwm: ", hbox ) 37 | 38 | vbox.pack_start(hbox, False, False, 0) 39 | sim = Simulator() 40 | 41 | GObject.timeout_add( 5, callback ) 42 | 43 | win.show_all() 44 | Gtk.main() 45 | 46 | print "bye!" 47 | 48 | def callback(): 49 | global t, n, sim, graph, pwm 50 | 51 | t = t + 1.0 / constants.FREQ 52 | n = n + 1 53 | 54 | pwm.set_text( "%d"%(sim.getPwm()) ) 55 | 56 | # t = t in s after last step 57 | a,b,c,d,e,f,g,h = sim.step_sim( t, n ) 58 | graph.update_lists( a,b,c,d,e,f,g,h ) 59 | graph.queue_draw() 60 | 61 | return True 62 | 63 | def add_label( labelname, hbox ): 64 | ln = Gtk.Label( labelname ) 65 | vlabel = Gtk.Label( "0.00" ) 66 | hbox.pack_start( ln, True, True, 0 ) 67 | hbox.pack_start( vlabel, True, True, 0 ) 68 | return vlabel 69 | 70 | def addpwm( btn ): 71 | global sim 72 | sim.movepwm(1) 73 | 74 | def subtractpwm( btn ): 75 | global sim 76 | sim.movepwm(-1) 77 | 78 | if __name__ == '__main__': 79 | main() 80 | 81 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_Device_Library/Class/cdc/inc/usbd_cdc_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_cdc_core.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief header file for the usbd_cdc_core.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | 24 | #ifndef __USB_CDC_CORE_H_ 25 | #define __USB_CDC_CORE_H_ 26 | 27 | #include "usbd_ioreq.h" 28 | 29 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 30 | * @{ 31 | */ 32 | 33 | /** @defgroup usbd_cdc 34 | * @brief This file is the Header file for USBD_cdc.c 35 | * @{ 36 | */ 37 | 38 | 39 | /** @defgroup usbd_cdc_Exported_Defines 40 | * @{ 41 | */ 42 | #define USB_CDC_CONFIG_DESC_SIZ (67) 43 | #define USB_CDC_DESC_SIZ (67-9) 44 | 45 | #define CDC_DESCRIPTOR_TYPE 0x21 46 | 47 | #define DEVICE_CLASS_CDC 0x02 48 | #define DEVICE_SUBCLASS_CDC 0x00 49 | 50 | 51 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 52 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 53 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 54 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 55 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 56 | 57 | #define STANDARD_ENDPOINT_DESC_SIZE 0x09 58 | 59 | #define CDC_DATA_IN_PACKET_SIZE *(uint16_t *)(((USB_OTG_CORE_HANDLE *)pdev)->dev.pConfig_descriptor + 57) 60 | 61 | #define CDC_DATA_OUT_PACKET_SIZE *(uint16_t *)(((USB_OTG_CORE_HANDLE *)pdev)->dev.pConfig_descriptor + 64) 62 | 63 | /*---------------------------------------------------------------------*/ 64 | /* CDC definitions */ 65 | /*---------------------------------------------------------------------*/ 66 | 67 | /**************************************************/ 68 | /* CDC Requests */ 69 | /**************************************************/ 70 | #define SEND_ENCAPSULATED_COMMAND 0x00 71 | #define GET_ENCAPSULATED_RESPONSE 0x01 72 | #define SET_COMM_FEATURE 0x02 73 | #define GET_COMM_FEATURE 0x03 74 | #define CLEAR_COMM_FEATURE 0x04 75 | #define SET_LINE_CODING 0x20 76 | #define GET_LINE_CODING 0x21 77 | #define SET_CONTROL_LINE_STATE 0x22 78 | #define SEND_BREAK 0x23 79 | #define NO_CMD 0xFF 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | 86 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 87 | * @{ 88 | */ 89 | typedef struct _CDC_IF_PROP 90 | { 91 | uint16_t (*pIf_Init) (void); 92 | uint16_t (*pIf_DeInit) (void); 93 | uint16_t (*pIf_Ctrl) (uint32_t Cmd, uint8_t* Buf, uint32_t Len); 94 | uint16_t (*pIf_DataTx) (uint8_t* Buf, uint32_t Len); 95 | uint16_t (*pIf_DataRx) (uint8_t* Buf, uint32_t Len); 96 | } 97 | CDC_IF_Prop_TypeDef; 98 | /** 99 | * @} 100 | */ 101 | 102 | 103 | 104 | /** @defgroup USBD_CORE_Exported_Macros 105 | * @{ 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** @defgroup USBD_CORE_Exported_Variables 113 | * @{ 114 | */ 115 | 116 | extern USBD_Class_cb_TypeDef USBD_CDC_cb; 117 | /** 118 | * @} 119 | */ 120 | 121 | /** @defgroup USB_CORE_Exported_Functions 122 | * @{ 123 | */ 124 | /** 125 | * @} 126 | */ 127 | 128 | #endif // __USB_CDC_CORE_H_ 129 | /** 130 | * @} 131 | */ 132 | 133 | /** 134 | * @} 135 | */ 136 | 137 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 138 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_Device_Library/Core/inc/usbd_conf_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_conf_template.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief usb device configuration template file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_CONF__H__ 24 | #define __USBD_CONF__H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f2xx.h" 28 | 29 | 30 | 31 | /** @defgroup USB_CONF_Exported_Defines 32 | * @{ 33 | */ 34 | #define USE_USB_OTG_HS 35 | 36 | #define USBD_CFG_MAX_NUM 1 37 | #define USB_MAX_STR_DESC_SIZ 64 38 | #define USBD_EP0_MAX_PACKET_SIZE 64 39 | 40 | /** 41 | * @} 42 | */ 43 | 44 | 45 | /** @defgroup USB_CONF_Exported_Types 46 | * @{ 47 | */ 48 | /** 49 | * @} 50 | */ 51 | 52 | 53 | /** @defgroup USB_CONF_Exported_Macros 54 | * @{ 55 | */ 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @defgroup USB_CONF_Exported_Variables 61 | * @{ 62 | */ 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @defgroup USB_CONF_Exported_FunctionsPrototype 68 | * @{ 69 | */ 70 | /** 71 | * @} 72 | */ 73 | 74 | 75 | #endif //__USBD_CONF__H__ 76 | 77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 78 | 79 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_Device_Library/Core/inc/usbd_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_core.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief Header file for usbd_core.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_CORE_H 24 | #define __USBD_CORE_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_dcd.h" 28 | #include "usbd_def.h" 29 | #include "usbd_conf.h" 30 | 31 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 32 | * @{ 33 | */ 34 | 35 | /** @defgroup USBD_CORE 36 | * @brief This file is the Header file for usbd_core.c file 37 | * @{ 38 | */ 39 | 40 | 41 | /** @defgroup USBD_CORE_Exported_Defines 42 | * @{ 43 | */ 44 | 45 | typedef enum { 46 | USBD_OK = 0, 47 | USBD_BUSY, 48 | USBD_FAIL, 49 | }USBD_Status; 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 56 | * @{ 57 | */ 58 | 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | 66 | /** @defgroup USBD_CORE_Exported_Macros 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup USBD_CORE_Exported_Variables 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype 83 | * @{ 84 | */ 85 | void USBD_Init(USB_OTG_CORE_HANDLE *pdev, 86 | USB_OTG_CORE_ID_TypeDef coreID, 87 | USBD_DEVICE *pDevice, 88 | USBD_Class_cb_TypeDef *class_cb, 89 | USBD_Usr_cb_TypeDef *usr_cb); 90 | 91 | USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev); 92 | 93 | USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 94 | 95 | USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | #endif /* __USBD_CORE_H */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_Device_Library/Core/inc/usbd_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_def.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief general defines for the usb device library 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | 24 | #ifndef __USBD_DEF_H 25 | #define __USBD_DEF_H 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usbd_conf.h" 28 | 29 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 30 | * @{ 31 | */ 32 | 33 | /** @defgroup USB_DEF 34 | * @brief general defines for the usb device library file 35 | * @{ 36 | */ 37 | 38 | /** @defgroup USB_DEF_Exported_Defines 39 | * @{ 40 | */ 41 | 42 | #ifndef NULL 43 | #define NULL 0 44 | #endif 45 | 46 | #define USB_LEN_DEV_QUALIFIER_DESC 0x0A 47 | #define USB_LEN_DEV_DESC 0x12 48 | #define USB_LEN_CFG_DESC 0x09 49 | #define USB_LEN_IF_DESC 0x09 50 | #define USB_LEN_EP_DESC 0x07 51 | #define USB_LEN_OTG_DESC 0x03 52 | 53 | #define USBD_IDX_LANGID_STR 0x00 54 | #define USBD_IDX_MFC_STR 0x01 55 | #define USBD_IDX_PRODUCT_STR 0x02 56 | #define USBD_IDX_SERIAL_STR 0x03 57 | #define USBD_IDX_CONFIG_STR 0x04 58 | #define USBD_IDX_INTERFACE_STR 0x05 59 | 60 | #define USB_REQ_TYPE_STANDARD 0x00 61 | #define USB_REQ_TYPE_CLASS 0x20 62 | #define USB_REQ_TYPE_VENDOR 0x40 63 | #define USB_REQ_TYPE_MASK 0x60 64 | 65 | #define USB_REQ_RECIPIENT_DEVICE 0x00 66 | #define USB_REQ_RECIPIENT_INTERFACE 0x01 67 | #define USB_REQ_RECIPIENT_ENDPOINT 0x02 68 | #define USB_REQ_RECIPIENT_MASK 0x03 69 | 70 | #define USB_REQ_GET_STATUS 0x00 71 | #define USB_REQ_CLEAR_FEATURE 0x01 72 | #define USB_REQ_SET_FEATURE 0x03 73 | #define USB_REQ_SET_ADDRESS 0x05 74 | #define USB_REQ_GET_DESCRIPTOR 0x06 75 | #define USB_REQ_SET_DESCRIPTOR 0x07 76 | #define USB_REQ_GET_CONFIGURATION 0x08 77 | #define USB_REQ_SET_CONFIGURATION 0x09 78 | #define USB_REQ_GET_INTERFACE 0x0A 79 | #define USB_REQ_SET_INTERFACE 0x0B 80 | #define USB_REQ_SYNCH_FRAME 0x0C 81 | 82 | #define USB_DESC_TYPE_DEVICE 1 83 | #define USB_DESC_TYPE_CONFIGURATION 2 84 | #define USB_DESC_TYPE_STRING 3 85 | #define USB_DESC_TYPE_INTERFACE 4 86 | #define USB_DESC_TYPE_ENDPOINT 5 87 | #define USB_DESC_TYPE_DEVICE_QUALIFIER 6 88 | #define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 7 89 | 90 | 91 | #define USB_CONFIG_REMOTE_WAKEUP 2 92 | #define USB_CONFIG_SELF_POWERED 1 93 | 94 | #define USB_FEATURE_EP_HALT 0 95 | #define USB_FEATURE_REMOTE_WAKEUP 1 96 | #define USB_FEATURE_TEST_MODE 2 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | 103 | /** @defgroup USBD_DEF_Exported_TypesDefinitions 104 | * @{ 105 | */ 106 | /** 107 | * @} 108 | */ 109 | 110 | 111 | 112 | /** @defgroup USBD_DEF_Exported_Macros 113 | * @{ 114 | */ 115 | #define SWAPBYTE(addr) (((uint16_t)(*((uint8_t *)(addr)))) + \ 116 | (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8)) 117 | 118 | #define LOBYTE(x) ((uint8_t)(x & 0x00FF)) 119 | #define HIBYTE(x) ((uint8_t)((x & 0xFF00) >>8)) 120 | /** 121 | * @} 122 | */ 123 | 124 | /** @defgroup USBD_DEF_Exported_Variables 125 | * @{ 126 | */ 127 | 128 | /** 129 | * @} 130 | */ 131 | 132 | /** @defgroup USBD_DEF_Exported_FunctionsPrototype 133 | * @{ 134 | */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | #endif /* __USBD_DEF_H */ 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | /** 147 | * @} 148 | */ 149 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 150 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_ioreq.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief header file for the usbd_ioreq.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | 24 | #ifndef __USBD_IOREQ_H_ 25 | #define __USBD_IOREQ_H_ 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "usbd_def.h" 29 | #include "usbd_core.h" 30 | 31 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 32 | * @{ 33 | */ 34 | 35 | /** @defgroup USBD_IOREQ 36 | * @brief header file for the usbd_ioreq.c file 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USBD_IOREQ_Exported_Defines 41 | * @{ 42 | */ 43 | /** 44 | * @} 45 | */ 46 | 47 | 48 | /** @defgroup USBD_IOREQ_Exported_Types 49 | * @{ 50 | */ 51 | 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | 59 | /** @defgroup USBD_IOREQ_Exported_Macros 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @defgroup USBD_IOREQ_Exported_Variables 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype 76 | * @{ 77 | */ 78 | 79 | USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev, 80 | uint8_t *buf, 81 | uint16_t len); 82 | 83 | USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev, 84 | uint8_t *pbuf, 85 | uint16_t len); 86 | 87 | USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev, 88 | uint8_t *pbuf, 89 | uint16_t len); 90 | 91 | USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev, 92 | uint8_t *pbuf, 93 | uint16_t len); 94 | 95 | USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev); 96 | 97 | USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev); 98 | 99 | uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev , 100 | uint8_t epnum); 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | #endif /* __USBD_IOREQ_H_ */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** 113 | * @} 114 | */ 115 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 116 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_Device_Library/Core/inc/usbd_req.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_req.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief header file for the usbd_req.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | 24 | #ifndef __USB_REQUEST_H_ 25 | #define __USB_REQUEST_H_ 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "usbd_def.h" 29 | #include "usbd_core.h" 30 | #include "usbd_conf.h" 31 | 32 | 33 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 34 | * @{ 35 | */ 36 | 37 | /** @defgroup USBD_REQ 38 | * @brief header file for the usbd_ioreq.c file 39 | * @{ 40 | */ 41 | 42 | /** @defgroup USBD_REQ_Exported_Defines 43 | * @{ 44 | */ 45 | /** 46 | * @} 47 | */ 48 | 49 | 50 | /** @defgroup USBD_REQ_Exported_Types 51 | * @{ 52 | */ 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | 59 | /** @defgroup USBD_REQ_Exported_Macros 60 | * @{ 61 | */ 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup USBD_REQ_Exported_Variables 67 | * @{ 68 | */ 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype 74 | * @{ 75 | */ 76 | 77 | USBD_Status USBD_StdDevReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 78 | USBD_Status USBD_StdItfReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 79 | USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 80 | void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE *pdev, 81 | USB_SETUP_REQ *req); 82 | 83 | void USBD_CtlError( USB_OTG_CORE_HANDLE *pdev, 84 | USB_SETUP_REQ *req); 85 | 86 | void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len); 87 | /** 88 | * @} 89 | */ 90 | 91 | #endif /* __USB_REQUEST_H_ */ 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | 102 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 103 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_Device_Library/Core/inc/usbd_usr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_usr.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief Header file for usbd_usr.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_USR_H__ 24 | #define __USBD_USR_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usbd_core.h" 28 | 29 | 30 | /** @addtogroup USBD_USER 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup USBD_MSC_DEMO_USER_CALLBACKS 35 | * @{ 36 | */ 37 | 38 | /** @defgroup USBD_USR 39 | * @brief This file is the Header file for usbd_usr.c 40 | * @{ 41 | */ 42 | 43 | 44 | /** @defgroup USBD_USR_Exported_Types 45 | * @{ 46 | */ 47 | 48 | extern USBD_Usr_cb_TypeDef USR_cb; 49 | extern USBD_Usr_cb_TypeDef USR_FS_cb; 50 | extern USBD_Usr_cb_TypeDef USR_HS_cb; 51 | 52 | 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | 59 | 60 | /** @defgroup USBD_USR_Exported_Defines 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup USBD_USR_Exported_Macros 69 | * @{ 70 | */ 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup USBD_USR_Exported_Variables 76 | * @{ 77 | */ 78 | 79 | void USBD_USR_Init(void); 80 | void USBD_USR_DeviceReset (uint8_t speed); 81 | void USBD_USR_DeviceConfigured (void); 82 | void USBD_USR_DeviceSuspended(void); 83 | void USBD_USR_DeviceResumed(void); 84 | 85 | void USBD_USR_DeviceConnected(void); 86 | void USBD_USR_DeviceDisconnected(void); 87 | 88 | void USBD_USR_FS_Init(void); 89 | void USBD_USR_FS_DeviceReset (uint8_t speed); 90 | void USBD_USR_FS_DeviceConfigured (void); 91 | void USBD_USR_FS_DeviceSuspended(void); 92 | void USBD_USR_FS_DeviceResumed(void); 93 | 94 | void USBD_USR_FS_DeviceConnected(void); 95 | void USBD_USR_FS_DeviceDisconnected(void); 96 | 97 | void USBD_USR_HS_Init(void); 98 | void USBD_USR_HS_DeviceReset (uint8_t speed); 99 | void USBD_USR_HS_DeviceConfigured (void); 100 | void USBD_USR_HS_DeviceSuspended(void); 101 | void USBD_USR_HS_DeviceResumed(void); 102 | 103 | void USBD_USR_HS_DeviceConnected(void); 104 | void USBD_USR_HS_DeviceDisconnected(void); 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** @defgroup USBD_USR_Exported_FunctionsPrototype 111 | * @{ 112 | */ 113 | /** 114 | * @} 115 | */ 116 | 117 | #endif /*__USBD_USR_H__*/ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_Device_Library/Core/src/usbd_ioreq.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_ioreq.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief This file provides the IO requests APIs for control endpoints. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "usbd_ioreq.h" 24 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 25 | * @{ 26 | */ 27 | 28 | 29 | /** @defgroup USBD_IOREQ 30 | * @brief control I/O requests module 31 | * @{ 32 | */ 33 | 34 | /** @defgroup USBD_IOREQ_Private_TypesDefinitions 35 | * @{ 36 | */ 37 | /** 38 | * @} 39 | */ 40 | 41 | 42 | /** @defgroup USBD_IOREQ_Private_Defines 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | 51 | /** @defgroup USBD_IOREQ_Private_Macros 52 | * @{ 53 | */ 54 | /** 55 | * @} 56 | */ 57 | 58 | 59 | /** @defgroup USBD_IOREQ_Private_Variables 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | 68 | /** @defgroup USBD_IOREQ_Private_FunctionPrototypes 69 | * @{ 70 | */ 71 | /** 72 | * @} 73 | */ 74 | 75 | 76 | /** @defgroup USBD_IOREQ_Private_Functions 77 | * @{ 78 | */ 79 | 80 | /** 81 | * @brief USBD_CtlSendData 82 | * send data on the ctl pipe 83 | * @param pdev: device instance 84 | * @param buff: pointer to data buffer 85 | * @param len: length of data to be sent 86 | * @retval status 87 | */ 88 | USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev, 89 | uint8_t *pbuf, 90 | uint16_t len) 91 | { 92 | USBD_Status ret = USBD_OK; 93 | 94 | pdev->dev.in_ep[0].total_data_len = len; 95 | pdev->dev.in_ep[0].rem_data_len = len; 96 | pdev->dev.device_state = USB_OTG_EP0_DATA_IN; 97 | 98 | DCD_EP_Tx (pdev, 0, pbuf, len); 99 | 100 | return ret; 101 | } 102 | 103 | /** 104 | * @brief USBD_CtlContinueSendData 105 | * continue sending data on the ctl pipe 106 | * @param pdev: device instance 107 | * @param buff: pointer to data buffer 108 | * @param len: length of data to be sent 109 | * @retval status 110 | */ 111 | USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev, 112 | uint8_t *pbuf, 113 | uint16_t len) 114 | { 115 | USBD_Status ret = USBD_OK; 116 | 117 | DCD_EP_Tx (pdev, 0, pbuf, len); 118 | 119 | 120 | return ret; 121 | } 122 | 123 | /** 124 | * @brief USBD_CtlPrepareRx 125 | * receive data on the ctl pipe 126 | * @param pdev: USB OTG device instance 127 | * @param buff: pointer to data buffer 128 | * @param len: length of data to be received 129 | * @retval status 130 | */ 131 | USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev, 132 | uint8_t *pbuf, 133 | uint16_t len) 134 | { 135 | USBD_Status ret = USBD_OK; 136 | 137 | pdev->dev.out_ep[0].total_data_len = len; 138 | pdev->dev.out_ep[0].rem_data_len = len; 139 | pdev->dev.device_state = USB_OTG_EP0_DATA_OUT; 140 | 141 | DCD_EP_PrepareRx (pdev, 142 | 0, 143 | pbuf, 144 | len); 145 | 146 | 147 | return ret; 148 | } 149 | 150 | /** 151 | * @brief USBD_CtlContinueRx 152 | * continue receive data on the ctl pipe 153 | * @param pdev: USB OTG device instance 154 | * @param buff: pointer to data buffer 155 | * @param len: length of data to be received 156 | * @retval status 157 | */ 158 | USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev, 159 | uint8_t *pbuf, 160 | uint16_t len) 161 | { 162 | USBD_Status ret = USBD_OK; 163 | 164 | DCD_EP_PrepareRx (pdev, 165 | 0, 166 | pbuf, 167 | len); 168 | return ret; 169 | } 170 | /** 171 | * @brief USBD_CtlSendStatus 172 | * send zero lzngth packet on the ctl pipe 173 | * @param pdev: USB OTG device instance 174 | * @retval status 175 | */ 176 | USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev) 177 | { 178 | USBD_Status ret = USBD_OK; 179 | pdev->dev.device_state = USB_OTG_EP0_STATUS_IN; 180 | DCD_EP_Tx (pdev, 181 | 0, 182 | NULL, 183 | 0); 184 | 185 | USB_OTG_EP0_OutStart(pdev); 186 | 187 | return ret; 188 | } 189 | 190 | /** 191 | * @brief USBD_CtlReceiveStatus 192 | * receive zero lzngth packet on the ctl pipe 193 | * @param pdev: USB OTG device instance 194 | * @retval status 195 | */ 196 | USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev) 197 | { 198 | USBD_Status ret = USBD_OK; 199 | pdev->dev.device_state = USB_OTG_EP0_STATUS_OUT; 200 | DCD_EP_PrepareRx ( pdev, 201 | 0, 202 | NULL, 203 | 0); 204 | 205 | USB_OTG_EP0_OutStart(pdev); 206 | 207 | return ret; 208 | } 209 | 210 | 211 | /** 212 | * @brief USBD_GetRxCount 213 | * returns the received data length 214 | * @param pdev: USB OTG device instance 215 | * epnum: endpoint index 216 | * @retval Rx Data blength 217 | */ 218 | uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum) 219 | { 220 | return pdev->dev.out_ep[epnum].xfer_count; 221 | } 222 | 223 | /** 224 | * @} 225 | */ 226 | 227 | 228 | /** 229 | * @} 230 | */ 231 | 232 | 233 | /** 234 | * @} 235 | */ 236 | 237 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 238 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_OTG_Driver/inc/usb_bsp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_bsp.h 4 | * @author MCD Application Team 5 | * @version V2.0.0 6 | * @date 22-July-2011 7 | * @brief Specific api's relative to the used hardware platform 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USB_BSP__H__ 24 | #define __USB_BSP__H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_core.h" 28 | #include "stm32f4_discovery.h" 29 | 30 | /** @addtogroup USB_OTG_DRIVER 31 | * @{ 32 | */ 33 | 34 | /** @defgroup USB_BSP 35 | * @brief This file is the 36 | * @{ 37 | */ 38 | 39 | 40 | /** @defgroup USB_BSP_Exported_Defines 41 | * @{ 42 | */ 43 | /** 44 | * @} 45 | */ 46 | 47 | 48 | /** @defgroup USB_BSP_Exported_Types 49 | * @{ 50 | */ 51 | /** 52 | * @} 53 | */ 54 | 55 | 56 | /** @defgroup USB_BSP_Exported_Macros 57 | * @{ 58 | */ 59 | /** 60 | * @} 61 | */ 62 | 63 | /** @defgroup USB_BSP_Exported_Variables 64 | * @{ 65 | */ 66 | /** 67 | * @} 68 | */ 69 | 70 | /** @defgroup USB_BSP_Exported_FunctionsPrototype 71 | * @{ 72 | */ 73 | void BSP_Init(void); 74 | 75 | void USB_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev); 76 | void USB_OTG_BSP_uDelay (const uint32_t usec); 77 | void USB_OTG_BSP_mDelay (const uint32_t msec); 78 | void USB_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev); 79 | #ifdef USE_HOST_MODE 80 | void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev); 81 | void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state); 82 | #endif 83 | /** 84 | * @} 85 | */ 86 | 87 | #endif //__USB_BSP__H__ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** 94 | * @} 95 | */ 96 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 97 | 98 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_OTG_Driver/inc/usb_dcd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_dcd.h 4 | * @author MCD Application Team 5 | * @version V2.0.0 6 | * @date 22-July-2011 7 | * @brief Peripheral Driver Header file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __DCD_H__ 24 | #define __DCD_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_core.h" 28 | 29 | 30 | /** @addtogroup USB_OTG_DRIVER 31 | * @{ 32 | */ 33 | 34 | /** @defgroup USB_DCD 35 | * @brief This file is the 36 | * @{ 37 | */ 38 | 39 | 40 | /** @defgroup USB_DCD_Exported_Defines 41 | * @{ 42 | */ 43 | #define USB_OTG_EP_CONTROL 0 44 | #define USB_OTG_EP_ISOC 1 45 | #define USB_OTG_EP_BULK 2 46 | #define USB_OTG_EP_INT 3 47 | #define USB_OTG_EP_MASK 3 48 | 49 | /* Device Status */ 50 | #define USB_OTG_DEFAULT 1 51 | #define USB_OTG_ADDRESSED 2 52 | #define USB_OTG_CONFIGURED 3 53 | #define USB_OTG_SUSPENDED 4 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | 60 | /** @defgroup USB_DCD_Exported_Types 61 | * @{ 62 | */ 63 | /******************************************************************************** 64 | Data structure type 65 | ********************************************************************************/ 66 | typedef struct 67 | { 68 | uint8_t bLength; 69 | uint8_t bDescriptorType; 70 | uint8_t bEndpointAddress; 71 | uint8_t bmAttributes; 72 | uint16_t wMaxPacketSize; 73 | uint8_t bInterval; 74 | } 75 | EP_DESCRIPTOR , *PEP_DESCRIPTOR; 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | 82 | /** @defgroup USB_DCD_Exported_Macros 83 | * @{ 84 | */ 85 | /** 86 | * @} 87 | */ 88 | 89 | /** @defgroup USB_DCD_Exported_Variables 90 | * @{ 91 | */ 92 | /** 93 | * @} 94 | */ 95 | 96 | /** @defgroup USB_DCD_Exported_FunctionsPrototype 97 | * @{ 98 | */ 99 | /******************************************************************************** 100 | EXPORTED FUNCTION FROM THE USB-OTG LAYER 101 | ********************************************************************************/ 102 | void DCD_Init(USB_OTG_CORE_HANDLE *pdev , 103 | USB_OTG_CORE_ID_TypeDef coreID); 104 | 105 | void DCD_DevConnect (USB_OTG_CORE_HANDLE *pdev); 106 | void DCD_DevDisconnect (USB_OTG_CORE_HANDLE *pdev); 107 | void DCD_EP_SetAddress (USB_OTG_CORE_HANDLE *pdev, 108 | uint8_t address); 109 | uint32_t DCD_EP_Open(USB_OTG_CORE_HANDLE *pdev , 110 | uint8_t ep_addr, 111 | uint16_t ep_mps, 112 | uint8_t ep_type); 113 | 114 | uint32_t DCD_EP_Close (USB_OTG_CORE_HANDLE *pdev, 115 | uint8_t ep_addr); 116 | 117 | 118 | uint32_t DCD_EP_PrepareRx ( USB_OTG_CORE_HANDLE *pdev, 119 | uint8_t ep_addr, 120 | uint8_t *pbuf, 121 | uint16_t buf_len); 122 | 123 | uint32_t DCD_EP_Tx (USB_OTG_CORE_HANDLE *pdev, 124 | uint8_t ep_addr, 125 | uint8_t *pbuf, 126 | uint32_t buf_len); 127 | uint32_t DCD_EP_Stall (USB_OTG_CORE_HANDLE *pdev, 128 | uint8_t epnum); 129 | uint32_t DCD_EP_ClrStall (USB_OTG_CORE_HANDLE *pdev, 130 | uint8_t epnum); 131 | uint32_t DCD_EP_Flush (USB_OTG_CORE_HANDLE *pdev, 132 | uint8_t epnum); 133 | uint32_t DCD_Handle_ISR(USB_OTG_CORE_HANDLE *pdev); 134 | 135 | uint32_t DCD_GetEPStatus(USB_OTG_CORE_HANDLE *pdev , 136 | uint8_t epnum); 137 | 138 | void DCD_SetEPStatus (USB_OTG_CORE_HANDLE *pdev , 139 | uint8_t epnum , 140 | uint32_t Status); 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | 147 | #endif //__DCD_H__ 148 | 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 158 | 159 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_OTG_Driver/inc/usb_dcd_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_dcd_int.h 4 | * @author MCD Application Team 5 | * @version V2.0.0 6 | * @date 22-July-2011 7 | * @brief Peripheral Device Interface Layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef USB_DCD_INT_H__ 24 | #define USB_DCD_INT_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_dcd.h" 28 | 29 | 30 | 31 | /** @addtogroup USB_OTG_DRIVER 32 | * @{ 33 | */ 34 | 35 | /** @defgroup USB_DCD_INT 36 | * @brief This file is the 37 | * @{ 38 | */ 39 | 40 | 41 | /** @defgroup USB_DCD_INT_Exported_Defines 42 | * @{ 43 | */ 44 | 45 | typedef struct _USBD_DCD_INT 46 | { 47 | uint8_t (* DataOutStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); 48 | uint8_t (* DataInStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); 49 | uint8_t (* SetupStage) (USB_OTG_CORE_HANDLE *pdev); 50 | uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev); 51 | uint8_t (* Reset) (USB_OTG_CORE_HANDLE *pdev); 52 | uint8_t (* Suspend) (USB_OTG_CORE_HANDLE *pdev); 53 | uint8_t (* Resume) (USB_OTG_CORE_HANDLE *pdev); 54 | uint8_t (* IsoINIncomplete) (USB_OTG_CORE_HANDLE *pdev); 55 | uint8_t (* IsoOUTIncomplete) (USB_OTG_CORE_HANDLE *pdev); 56 | 57 | uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev); 58 | uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev); 59 | 60 | }USBD_DCD_INT_cb_TypeDef; 61 | 62 | extern USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops; 63 | /** 64 | * @} 65 | */ 66 | 67 | 68 | /** @defgroup USB_DCD_INT_Exported_Types 69 | * @{ 70 | */ 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup USB_DCD_INT_Exported_Macros 76 | * @{ 77 | */ 78 | 79 | #define CLEAR_IN_EP_INTR(epnum,intr) \ 80 | diepint.d32=0; \ 81 | diepint.b.intr = 1; \ 82 | USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[epnum]->DIEPINT,diepint.d32); 83 | 84 | #define CLEAR_OUT_EP_INTR(epnum,intr) \ 85 | doepint.d32=0; \ 86 | doepint.b.intr = 1; \ 87 | USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[epnum]->DOEPINT,doepint.d32); 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup USB_DCD_INT_Exported_Variables 94 | * @{ 95 | */ 96 | /** 97 | * @} 98 | */ 99 | 100 | /** @defgroup USB_DCD_INT_Exported_FunctionsPrototype 101 | * @{ 102 | */ 103 | 104 | uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | 111 | #endif // USB_DCD_INT_H__ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 121 | 122 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_OTG_Driver/inc/usb_hcd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_hcd.h 4 | * @author MCD Application Team 5 | * @version V2.0.0 6 | * @date 22-July-2011 7 | * @brief Host layer Header file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USB_HCD_H__ 24 | #define __USB_HCD_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_regs.h" 28 | #include "usb_core.h" 29 | 30 | 31 | /** @addtogroup USB_OTG_DRIVER 32 | * @{ 33 | */ 34 | 35 | /** @defgroup USB_HCD 36 | * @brief This file is the 37 | * @{ 38 | */ 39 | 40 | 41 | /** @defgroup USB_HCD_Exported_Defines 42 | * @{ 43 | */ 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @defgroup USB_HCD_Exported_Types 50 | * @{ 51 | */ 52 | /** 53 | * @} 54 | */ 55 | 56 | 57 | /** @defgroup USB_HCD_Exported_Macros 58 | * @{ 59 | */ 60 | /** 61 | * @} 62 | */ 63 | 64 | /** @defgroup USB_HCD_Exported_Variables 65 | * @{ 66 | */ 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup USB_HCD_Exported_FunctionsPrototype 72 | * @{ 73 | */ 74 | uint32_t HCD_Init (USB_OTG_CORE_HANDLE *pdev , 75 | USB_OTG_CORE_ID_TypeDef coreID); 76 | uint32_t HCD_HC_Init (USB_OTG_CORE_HANDLE *pdev , 77 | uint8_t hc_num); 78 | uint32_t HCD_SubmitRequest (USB_OTG_CORE_HANDLE *pdev , 79 | uint8_t hc_num) ; 80 | uint32_t HCD_GetCurrentSpeed (USB_OTG_CORE_HANDLE *pdev); 81 | uint32_t HCD_ResetPort (USB_OTG_CORE_HANDLE *pdev); 82 | uint32_t HCD_IsDeviceConnected (USB_OTG_CORE_HANDLE *pdev); 83 | uint32_t HCD_GetCurrentFrame (USB_OTG_CORE_HANDLE *pdev) ; 84 | URB_STATE HCD_GetURB_State (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num); 85 | uint32_t HCD_GetXferCnt (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num); 86 | HC_STATUS HCD_GetHCState (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num) ; 87 | /** 88 | * @} 89 | */ 90 | 91 | #endif //__USB_HCD_H__ 92 | 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 102 | 103 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_OTG_Driver/inc/usb_hcd_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_hcd_int.h 4 | * @author MCD Application Team 5 | * @version V2.0.0 6 | * @date 22-July-2011 7 | * @brief Peripheral Device Interface Layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __HCD_INT_H__ 24 | #define __HCD_INT_H__ 25 | 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "usb_hcd.h" 29 | 30 | 31 | /** @addtogroup USB_OTG_DRIVER 32 | * @{ 33 | */ 34 | 35 | /** @defgroup USB_HCD_INT 36 | * @brief This file is the 37 | * @{ 38 | */ 39 | 40 | 41 | /** @defgroup USB_HCD_INT_Exported_Defines 42 | * @{ 43 | */ 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @defgroup USB_HCD_INT_Exported_Types 50 | * @{ 51 | */ 52 | /** 53 | * @} 54 | */ 55 | 56 | 57 | /** @defgroup USB_HCD_INT_Exported_Macros 58 | * @{ 59 | */ 60 | 61 | #define CLEAR_HC_INT(HC_REGS, intr) \ 62 | {\ 63 | USB_OTG_HCINTn_TypeDef hcint_clear; \ 64 | hcint_clear.d32 = 0; \ 65 | hcint_clear.b.intr = 1; \ 66 | USB_OTG_WRITE_REG32(&((HC_REGS)->HCINT), hcint_clear.d32);\ 67 | }\ 68 | 69 | #define MASK_HOST_INT_CHH(hc_num) { USB_OTG_HCGINTMSK_TypeDef GINTMSK; \ 70 | GINTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCGINTMSK); \ 71 | GINTMSK.b.chhltd = 0; \ 72 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCGINTMSK, GINTMSK.d32);} 73 | 74 | #define UNMASK_HOST_INT_CHH(hc_num) { USB_OTG_HCGINTMSK_TypeDef GINTMSK; \ 75 | GINTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCGINTMSK); \ 76 | GINTMSK.b.chhltd = 1; \ 77 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCGINTMSK, GINTMSK.d32);} 78 | 79 | #define MASK_HOST_INT_ACK(hc_num) { USB_OTG_HCGINTMSK_TypeDef GINTMSK; \ 80 | GINTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCGINTMSK); \ 81 | GINTMSK.b.ack = 0; \ 82 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCGINTMSK, GINTMSK.d32);} 83 | 84 | #define UNMASK_HOST_INT_ACK(hc_num) { USB_OTG_HCGINTMSK_TypeDef GINTMSK; \ 85 | GINTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCGINTMSK); \ 86 | GINTMSK.b.ack = 1; \ 87 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCGINTMSK, GINTMSK.d32);} 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup USB_HCD_INT_Exported_Variables 94 | * @{ 95 | */ 96 | /** 97 | * @} 98 | */ 99 | 100 | /** @defgroup USB_HCD_INT_Exported_FunctionsPrototype 101 | * @{ 102 | */ 103 | /* Callbacks handler */ 104 | void ConnectCallback_Handler(USB_OTG_CORE_HANDLE *pdev); 105 | void Disconnect_Callback_Handler(USB_OTG_CORE_HANDLE *pdev); 106 | void Overcurrent_Callback_Handler(USB_OTG_CORE_HANDLE *pdev); 107 | uint32_t USBH_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | 114 | 115 | #endif //__HCD_INT_H__ 116 | 117 | 118 | /** 119 | * @} 120 | */ 121 | 122 | /** 123 | * @} 124 | */ 125 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 126 | 127 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_OTG_Driver/inc/usb_otg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_otg.h 4 | * @author MCD Application Team 5 | * @version V2.0.0 6 | * @date 22-July-2011 7 | * @brief OTG Core Header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USB_OTG__ 24 | #define __USB_OTG__ 25 | 26 | 27 | /** @addtogroup USB_OTG_DRIVER 28 | * @{ 29 | */ 30 | 31 | /** @defgroup USB_OTG 32 | * @brief This file is the 33 | * @{ 34 | */ 35 | 36 | 37 | /** @defgroup USB_OTG_Exported_Defines 38 | * @{ 39 | */ 40 | 41 | 42 | void USB_OTG_InitiateSRP(void); 43 | void USB_OTG_InitiateHNP(uint8_t state , uint8_t mode); 44 | void USB_OTG_Switchback (USB_OTG_CORE_HANDLE *pdev); 45 | uint32_t USB_OTG_GetCurrentState (USB_OTG_CORE_HANDLE *pdev); 46 | 47 | uint32_t STM32_USBO_OTG_ISR_Handler(USB_OTG_CORE_HANDLE *pdev); 48 | /** 49 | * @} 50 | */ 51 | 52 | 53 | /** @defgroup USB_OTG_Exported_Types 54 | * @{ 55 | */ 56 | /** 57 | * @} 58 | */ 59 | 60 | 61 | /** @defgroup USB_OTG_Exported_Macros 62 | * @{ 63 | */ 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup USB_OTG_Exported_Variables 69 | * @{ 70 | */ 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup USB_OTG_Exported_FunctionsPrototype 76 | * @{ 77 | */ 78 | /** 79 | * @} 80 | */ 81 | 82 | 83 | #endif //__USB_OTG__ 84 | 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 94 | 95 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_OTG_Driver/src/usb_hcd.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_hcd.c 4 | * @author MCD Application Team 5 | * @version V2.0.0 6 | * @date 22-July-2011 7 | * @brief Host Interface Layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "usb_core.h" 24 | #include "usb_hcd.h" 25 | #include "usb_conf.h" 26 | #include "usb_bsp.h" 27 | 28 | 29 | /** @addtogroup USB_OTG_DRIVER 30 | * @{ 31 | */ 32 | 33 | /** @defgroup USB_HCD 34 | * @brief This file is the interface between EFSL ans Host mass-storage class 35 | * @{ 36 | */ 37 | 38 | 39 | /** @defgroup USB_HCD_Private_Defines 40 | * @{ 41 | */ 42 | /** 43 | * @} 44 | */ 45 | 46 | 47 | /** @defgroup USB_HCD_Private_TypesDefinitions 48 | * @{ 49 | */ 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | 56 | /** @defgroup USB_HCD_Private_Macros 57 | * @{ 58 | */ 59 | /** 60 | * @} 61 | */ 62 | 63 | 64 | /** @defgroup USB_HCD_Private_Variables 65 | * @{ 66 | */ 67 | /** 68 | * @} 69 | */ 70 | 71 | 72 | /** @defgroup USB_HCD_Private_FunctionPrototypes 73 | * @{ 74 | */ 75 | /** 76 | * @} 77 | */ 78 | 79 | 80 | /** @defgroup USB_HCD_Private_Functions 81 | * @{ 82 | */ 83 | 84 | /** 85 | * @brief HCD_Init 86 | * Initialize the HOST portion of the driver. 87 | * @param pdev: Selected device 88 | * @param base_address: OTG base address 89 | * @retval Status 90 | */ 91 | uint32_t HCD_Init(USB_OTG_CORE_HANDLE *pdev , 92 | USB_OTG_CORE_ID_TypeDef coreID) 93 | { 94 | uint8_t i = 0; 95 | pdev->host.ConnSts = 0; 96 | 97 | for (i= 0; i< USB_OTG_MAX_TX_FIFOS; i++) 98 | { 99 | pdev->host.ErrCnt[i] = 0; 100 | pdev->host.XferCnt[i] = 0; 101 | pdev->host.HC_Status[i] = HC_IDLE; 102 | } 103 | pdev->host.hc[0].max_packet = 8; 104 | 105 | USB_OTG_SelectCore(pdev, coreID); 106 | #ifndef DUAL_ROLE_MODE_ENABLED 107 | USB_OTG_DisableGlobalInt(pdev); 108 | USB_OTG_CoreInit(pdev); 109 | 110 | /* Force Host Mode*/ 111 | USB_OTG_SetCurrentMode(pdev , HOST_MODE); 112 | USB_OTG_CoreInitHost(pdev); 113 | USB_OTG_EnableGlobalInt(pdev); 114 | #endif 115 | 116 | return 0; 117 | } 118 | 119 | 120 | /** 121 | * @brief HCD_GetCurrentSpeed 122 | * Get Current device Speed. 123 | * @param pdev : Selected device 124 | * @retval Status 125 | */ 126 | 127 | uint32_t HCD_GetCurrentSpeed (USB_OTG_CORE_HANDLE *pdev) 128 | { 129 | USB_OTG_HPRT0_TypeDef HPRT0; 130 | HPRT0.d32 = USB_OTG_READ_REG32(pdev->regs.HPRT0); 131 | 132 | return HPRT0.b.prtspd; 133 | } 134 | 135 | /** 136 | * @brief HCD_ResetPort 137 | * Issues the reset command to device 138 | * @param pdev : Selected device 139 | * @retval Status 140 | */ 141 | uint32_t HCD_ResetPort(USB_OTG_CORE_HANDLE *pdev) 142 | { 143 | /* 144 | Before starting to drive a USB reset, the application waits for the OTG 145 | interrupt triggered by the debounce done bit (DBCDNE bit in OTG_FS_GOTGINT), 146 | which indicates that the bus is stable again after the electrical debounce 147 | caused by the attachment of a pull-up resistor on DP (FS) or DM (LS). 148 | */ 149 | 150 | USB_OTG_ResetPort(pdev); 151 | return 0; 152 | } 153 | 154 | /** 155 | * @brief HCD_IsDeviceConnected 156 | * Check if the device is connected. 157 | * @param pdev : Selected device 158 | * @retval Device connection status. 1 -> connected and 0 -> disconnected 159 | * 160 | */ 161 | uint32_t HCD_IsDeviceConnected(USB_OTG_CORE_HANDLE *pdev) 162 | { 163 | return (pdev->host.ConnSts); 164 | } 165 | 166 | /** 167 | * @brief HCD_GetCurrentFrame 168 | * This function returns the frame number for sof packet 169 | * @param pdev : Selected device 170 | * @retval Frame number 171 | * 172 | */ 173 | uint32_t HCD_GetCurrentFrame (USB_OTG_CORE_HANDLE *pdev) 174 | { 175 | return (USB_OTG_READ_REG32(&pdev->regs.HREGS->HFNUM) & 0xFFFF) ; 176 | } 177 | 178 | /** 179 | * @brief HCD_GetURB_State 180 | * This function returns the last URBstate 181 | * @param pdev: Selected device 182 | * @retval URB_STATE 183 | * 184 | */ 185 | URB_STATE HCD_GetURB_State (USB_OTG_CORE_HANDLE *pdev , uint8_t ch_num) 186 | { 187 | return pdev->host.URB_State[ch_num] ; 188 | } 189 | 190 | /** 191 | * @brief HCD_GetXferCnt 192 | * This function returns the last URBstate 193 | * @param pdev: Selected device 194 | * @retval No. of data bytes transferred 195 | * 196 | */ 197 | uint32_t HCD_GetXferCnt (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num) 198 | { 199 | return pdev->host.XferCnt[ch_num] ; 200 | } 201 | 202 | 203 | 204 | /** 205 | * @brief HCD_GetHCState 206 | * This function returns the HC Status 207 | * @param pdev: Selected device 208 | * @retval HC_STATUS 209 | * 210 | */ 211 | HC_STATUS HCD_GetHCState (USB_OTG_CORE_HANDLE *pdev , uint8_t ch_num) 212 | { 213 | return pdev->host.HC_Status[ch_num] ; 214 | } 215 | 216 | /** 217 | * @brief HCD_HC_Init 218 | * This function prepare a HC and start a transfer 219 | * @param pdev: Selected device 220 | * @param hc_num: Channel number 221 | * @retval status 222 | */ 223 | uint32_t HCD_HC_Init (USB_OTG_CORE_HANDLE *pdev , uint8_t hc_num) 224 | { 225 | return USB_OTG_HC_Init(pdev, hc_num); 226 | } 227 | 228 | /** 229 | * @brief HCD_SubmitRequest 230 | * This function prepare a HC and start a transfer 231 | * @param pdev: Selected device 232 | * @param hc_num: Channel number 233 | * @retval status 234 | */ 235 | uint32_t HCD_SubmitRequest (USB_OTG_CORE_HANDLE *pdev , uint8_t hc_num) 236 | { 237 | 238 | pdev->host.URB_State[hc_num] = URB_IDLE; 239 | pdev->host.hc[hc_num].xfer_count = 0 ; 240 | return USB_OTG_HC_StartXfer(pdev, hc_num); 241 | } 242 | 243 | 244 | /** 245 | * @} 246 | */ 247 | 248 | /** 249 | * @} 250 | */ 251 | 252 | /** 253 | * @} 254 | */ 255 | 256 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 257 | -------------------------------------------------------------------------------- /escsw-coocox/Drivers/STM32_USB_OTG_Driver/src/usb_otg.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_otg.c 4 | * @author MCD Application Team 5 | * @version V2.0.0 6 | * @date 22-July-2011 7 | * @brief OTG Core Layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "usb_defines.h" 24 | #include "usb_regs.h" 25 | #include "usb_core.h" 26 | #include "usb_otg.h" 27 | 28 | /** @addtogroup USB_OTG_DRIVER 29 | * @{ 30 | */ 31 | 32 | /** @defgroup USB_OTG 33 | * @brief This file is the interface between EFSL ans Host mass-storage class 34 | * @{ 35 | */ 36 | 37 | 38 | /** @defgroup USB_OTG_Private_Defines 39 | * @{ 40 | */ 41 | /** 42 | * @} 43 | */ 44 | 45 | 46 | /** @defgroup USB_OTG_Private_TypesDefinitions 47 | * @{ 48 | */ 49 | /** 50 | * @} 51 | */ 52 | 53 | 54 | 55 | /** @defgroup USB_OTG_Private_Macros 56 | * @{ 57 | */ 58 | /** 59 | * @} 60 | */ 61 | 62 | 63 | /** @defgroup USB_OTG_Private_Variables 64 | * @{ 65 | */ 66 | /** 67 | * @} 68 | */ 69 | 70 | 71 | /** @defgroup USB_OTG_Private_FunctionPrototypes 72 | * @{ 73 | */ 74 | 75 | static uint32_t USB_OTG_Read_itr(USB_OTG_CORE_HANDLE *pdev); 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | 82 | /** @defgroup USB_OTG_Private_Functions 83 | * @{ 84 | */ 85 | 86 | 87 | /* OTG Interrupt Handler */ 88 | 89 | 90 | /** 91 | * @brief STM32_USBO_OTG_ISR_Handler 92 | * 93 | * @param None 94 | * @retval : None 95 | */ 96 | uint32_t STM32_USBO_OTG_ISR_Handler(USB_OTG_CORE_HANDLE *pdev) 97 | { 98 | uint32_t retval = 0; 99 | USB_OTG_GINTSTS_TypeDef gintsts ; 100 | gintsts.d32 = 0; 101 | 102 | gintsts.d32 = USB_OTG_Read_itr(pdev); 103 | if (gintsts.d32 == 0) 104 | { 105 | return 0; 106 | } 107 | if (gintsts.b.otgintr) 108 | { 109 | retval |= 1;//USB_OTG_HandleOTG_ISR(pdev); 110 | } 111 | if (gintsts.b.conidstschng) 112 | { 113 | retval |= 2;//USB_OTG_HandleConnectorIDStatusChange_ISR(pdev); 114 | } 115 | if (gintsts.b.sessreqintr) 116 | { 117 | retval |= 3;//USB_OTG_HandleSessionRequest_ISR(pdev); 118 | } 119 | return retval; 120 | } 121 | 122 | 123 | /** 124 | * @brief USB_OTG_Read_itr 125 | * returns the Core Interrupt register 126 | * @param None 127 | * @retval : status 128 | */ 129 | static uint32_t USB_OTG_Read_itr(USB_OTG_CORE_HANDLE *pdev) 130 | { 131 | USB_OTG_GINTSTS_TypeDef gintsts; 132 | USB_OTG_GINTMSK_TypeDef gintmsk; 133 | USB_OTG_GINTMSK_TypeDef gintmsk_common; 134 | 135 | 136 | gintsts.d32 = 0; 137 | gintmsk.d32 = 0; 138 | gintmsk_common.d32 = 0; 139 | 140 | /* OTG interrupts */ 141 | gintmsk_common.b.sessreqintr = 1; 142 | gintmsk_common.b.conidstschng = 1; 143 | gintmsk_common.b.otgintr = 1; 144 | 145 | gintsts.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GINTSTS); 146 | gintmsk.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GINTMSK); 147 | return ((gintsts.d32 & gintmsk.d32 ) & gintmsk_common.d32); 148 | } 149 | 150 | 151 | /** 152 | * @brief USB_OTG_GetCurrentState 153 | * Return current OTG State 154 | * @param None 155 | * @retval : None 156 | */ 157 | uint32_t USB_OTG_GetCurrentState (USB_OTG_CORE_HANDLE *pdev) 158 | { 159 | return pdev->otg.OTG_State; 160 | } 161 | 162 | 163 | /** 164 | * @} 165 | */ 166 | 167 | /** 168 | * @} 169 | */ 170 | 171 | /** 172 | * @} 173 | */ 174 | 175 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 176 | -------------------------------------------------------------------------------- /escsw-coocox/ESC.comarker: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /escsw-coocox/STM32F4-Discovery/pdm_filter.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file pdm_filter.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 28-October-2011 7 | * @brief Header file for PDM audio software decoding Library. 8 | * This Library is used to decode and reconstruct the audio signal 9 | * produced by MP45DT02 MEMS microphone from STMicroelectronics. 10 | * For more details about this Library, please refer to document 11 | * "PDM audio software decoding on STM32 microcontrollers (AN3998)". 12 | ****************************************************************************** 13 | * @attention 14 | * 15 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 16 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 17 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 18 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 19 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 20 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 21 | * 22 | *

© COPYRIGHT 2011 STMicroelectronics

23 | ****************************************************************************** 24 | */ 25 | 26 | /* Define to prevent recursive inclusion -------------------------------------*/ 27 | #ifndef __PDM_FILTER_H 28 | #define __PDM_FILTER_H 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /* Includes ------------------------------------------------------------------*/ 35 | #include 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | typedef struct { 39 | uint16_t Fs; 40 | float LP_HZ; 41 | float HP_HZ; 42 | uint16_t In_MicChannels; 43 | uint16_t Out_MicChannels; 44 | char InternalFilter[34]; 45 | } PDMFilter_InitStruct; 46 | 47 | /* Exported constants --------------------------------------------------------*/ 48 | /* Exported macros -----------------------------------------------------------*/ 49 | #define HTONS(A) ((((u16)(A) & 0xff00) >> 8) | \ 50 | (((u16)(A) & 0x00ff) << 8)) 51 | 52 | /* Exported functions ------------------------------------------------------- */ 53 | void PDM_Filter_Init(PDMFilter_InitStruct * Filter); 54 | 55 | int32_t PDM_Filter_64_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); 56 | int32_t PDM_Filter_80_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); 57 | int32_t PDM_Filter_64_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); 58 | int32_t PDM_Filter_80_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif /* __PDM_FILTER_H */ 65 | 66 | /*******************(C)COPYRIGHT 2011 STMicroelectronics *****END OF FILE******/ 67 | -------------------------------------------------------------------------------- /escsw-coocox/STM32F4-Discovery/stm32f4_discovery.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4_discovery.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 28-October-2011 7 | * @brief This file contains definitions for STM32F4-Discovery Kit's Leds and 8 | * push-button hardware resources. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4_DISCOVERY_H 25 | #define __STM32F4_DISCOVERY_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | #include "stm32f4xx_gpio.h" 34 | #include "stm32f4xx_syscfg.h" 35 | #include "stm32f4xx_rcc.h" 36 | #include "stm32f4xx_exti.h" 37 | #include "misc.h" 38 | 39 | /** @addtogroup Utilities 40 | * @{ 41 | */ 42 | 43 | /** @addtogroup STM32F4_DISCOVERY 44 | * @{ 45 | */ 46 | 47 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL 48 | * @{ 49 | */ 50 | 51 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Types 52 | * @{ 53 | */ 54 | typedef enum 55 | { 56 | LED4 = 0, 57 | LED3 = 1, 58 | LED5 = 2, 59 | LED6 = 3 60 | } Led_TypeDef; 61 | 62 | typedef enum 63 | { 64 | BUTTON_USER = 0, 65 | } Button_TypeDef; 66 | 67 | typedef enum 68 | { 69 | BUTTON_MODE_GPIO = 0, 70 | BUTTON_MODE_EXTI = 1 71 | } ButtonMode_TypeDef; 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Constants 77 | * @{ 78 | */ 79 | 80 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_LED 81 | * @{ 82 | */ 83 | #define LEDn 4 84 | 85 | #define LED4_PIN GPIO_Pin_12 86 | #define LED4_GPIO_PORT GPIOD 87 | #define LED4_GPIO_CLK RCC_AHB1Periph_GPIOD 88 | 89 | #define LED3_PIN GPIO_Pin_13 90 | #define LED3_GPIO_PORT GPIOD 91 | #define LED3_GPIO_CLK RCC_AHB1Periph_GPIOD 92 | 93 | #define LED5_PIN GPIO_Pin_14 94 | #define LED5_GPIO_PORT GPIOD 95 | #define LED5_GPIO_CLK RCC_AHB1Periph_GPIOD 96 | 97 | #define LED6_PIN GPIO_Pin_15 98 | #define LED6_GPIO_PORT GPIOD 99 | #define LED6_GPIO_CLK RCC_AHB1Periph_GPIOD 100 | /** 101 | * @} 102 | */ 103 | 104 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_BUTTON 105 | * @{ 106 | */ 107 | #define BUTTONn 1 108 | 109 | /** 110 | * @brief Wakeup push-button 111 | */ 112 | #define USER_BUTTON_PIN GPIO_Pin_0 113 | #define USER_BUTTON_GPIO_PORT GPIOA 114 | #define USER_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOA 115 | #define USER_BUTTON_EXTI_LINE EXTI_Line0 116 | #define USER_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOA 117 | #define USER_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource0 118 | #define USER_BUTTON_EXTI_IRQn EXTI0_IRQn 119 | /** 120 | * @} 121 | */ 122 | 123 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Macros 124 | * @{ 125 | */ 126 | /** 127 | * @} 128 | */ 129 | 130 | 131 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Functions 132 | * @{ 133 | */ 134 | void STM_EVAL_LEDInit(Led_TypeDef Led); 135 | void STM_EVAL_LEDOn(Led_TypeDef Led); 136 | void STM_EVAL_LEDOff(Led_TypeDef Led); 137 | void STM_EVAL_LEDToggle(Led_TypeDef Led); 138 | void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode); 139 | uint32_t STM_EVAL_PBGetState(Button_TypeDef Button); 140 | /** 141 | * @} 142 | */ 143 | 144 | #ifdef __cplusplus 145 | } 146 | #endif 147 | 148 | #endif /* __STM32F4_DISCOVERY_H */ 149 | /** 150 | * @} 151 | */ 152 | 153 | /** 154 | * @} 155 | */ 156 | 157 | /** 158 | * @} 159 | */ 160 | 161 | 162 | 163 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 164 | -------------------------------------------------------------------------------- /escsw-coocox/algorithms.h: -------------------------------------------------------------------------------- 1 | #ifndef ALGORITHMS_H 2 | #define ALGORITHMS_H 3 | 4 | void configure_constants( void ); 5 | void slow_loop( void ); 6 | void fast_loop( void ); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /escsw-coocox/cdc/inc/usbd_cdc_vcp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_cdc_vcp.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief Header for usbd_cdc_vcp.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_CDC_VCP_H 24 | #define __USBD_CDC_VCP_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f4xx_conf.h" 28 | 29 | #include "usbd_cdc_core.h" 30 | #include "usbd_conf.h" 31 | #include 32 | 33 | /* Exported typef ------------------------------------------------------------*/ 34 | /* The following structures groups all needed parameters to be configured for the 35 | ComPort. These parameters can modified on the fly by the host through CDC class 36 | command class requests. */ 37 | typedef struct 38 | { 39 | uint32_t bitrate; 40 | uint8_t format; 41 | uint8_t paritytype; 42 | uint8_t datatype; 43 | }LINE_CODING; 44 | 45 | /* Exported constants --------------------------------------------------------*/ 46 | /* The following define is used to route the USART IRQ handler to be used. 47 | The IRQ handler function is implemented in the usbd_cdc_vcp.c file. */ 48 | #ifdef USE_STM322xG_EVAL 49 | #define EVAL_COM_IRQHandler USART3_IRQHandler 50 | #elif defined(USE_STM3210C_EVAL) 51 | #define EVAL_COM_IRQHandler USART2_IRQHandler 52 | #endif /* USE_STM322xG_EVAL */ 53 | 54 | void VCP_put_char(uint8_t buf); 55 | void VCP_send_str(uint8_t* buf); 56 | int VCP_get_char(uint8_t *buf); 57 | int VCP_get_string(uint8_t *buf); 58 | void VCP_send_buffer(uint8_t* buf, int len); 59 | 60 | #define DEFAULT_CONFIG 0 61 | #define OTHER_CONFIG 1 62 | 63 | /* Exported macro ------------------------------------------------------------*/ 64 | /* Exported functions ------------------------------------------------------- */ 65 | 66 | #endif /* __USBD_CDC_VCP_H */ 67 | 68 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 69 | -------------------------------------------------------------------------------- /escsw-coocox/cdc/inc/usbd_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 22-July-2011 7 | * @brief USB Device configuration file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_CONF__H__ 24 | #define __USBD_CONF__H__ 25 | 26 | /** @defgroup USB_CONF_Exported_Defines 27 | * @{ 28 | */ 29 | #define USBD_CFG_MAX_NUM 1 30 | #define USBD_ITF_MAX_NUM 1 31 | #define USB_MAX_STR_DESC_SIZ 50 32 | 33 | /** @defgroup USB_VCP_Class_Layer_Parameter 34 | * @{ 35 | */ 36 | #define CDC_IN_EP 0x81 /* EP1 for data IN */ 37 | #define CDC_OUT_EP 0x01 /* EP1 for data OUT */ 38 | #define CDC_CMD_EP 0x82 /* EP2 for CDC commands */ 39 | 40 | /* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */ 41 | #ifdef USE_USB_OTG_HS 42 | #define CDC_DATA_MAX_PACKET_SIZE 512 /* Endpoint IN & OUT Packet size */ 43 | #define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */ 44 | 45 | #define CDC_IN_FRAME_INTERVAL 40 /* Number of micro-frames between IN transfers */ 46 | #define APP_RX_DATA_SIZE 2048 /* Total size of IN buffer: 47 | APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL*8 */ 48 | #else 49 | #define CDC_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */ 50 | #define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */ 51 | 52 | #define CDC_IN_FRAME_INTERVAL 5 /* Number of frames between IN transfers */ 53 | #define APP_RX_DATA_SIZE 2048 /* Total size of IN buffer: 54 | APP_RX_DATA_SIZE*8/MAX_BAUDARATE*1000 should be > CDC_IN_FRAME_INTERVAL */ 55 | #endif /* USE_USB_OTG_HS */ 56 | 57 | #define APP_FOPS VCP_fops 58 | /** 59 | * @} 60 | */ 61 | 62 | /** @defgroup USB_CONF_Exported_Types 63 | * @{ 64 | */ 65 | /** 66 | * @} 67 | */ 68 | 69 | 70 | /** @defgroup USB_CONF_Exported_Macros 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USB_CONF_Exported_Variables 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup USB_CONF_Exported_FunctionsPrototype 85 | * @{ 86 | */ 87 | /** 88 | * @} 89 | */ 90 | 91 | 92 | #endif //__USBD_CONF__H__ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | 96 | -------------------------------------------------------------------------------- /escsw-coocox/cdc/inc/usbd_desc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_desc.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief header file for the usbd_desc.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | 24 | #ifndef __USB_DESC_H 25 | #define __USB_DESC_H 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "usbd_def.h" 29 | 30 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 31 | * @{ 32 | */ 33 | 34 | /** @defgroup USB_DESC 35 | * @brief general defines for the usb device library file 36 | * @{ 37 | */ 38 | 39 | /** @defgroup USB_DESC_Exported_Defines 40 | * @{ 41 | */ 42 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 43 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 44 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 45 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 46 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 47 | #define USB_SIZ_DEVICE_DESC 18 48 | #define USB_SIZ_STRING_LANGID 4 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @defgroup USBD_DESC_Exported_TypesDefinitions 56 | * @{ 57 | */ 58 | /** 59 | * @} 60 | */ 61 | 62 | 63 | 64 | /** @defgroup USBD_DESC_Exported_Macros 65 | * @{ 66 | */ 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup USBD_DESC_Exported_Variables 72 | * @{ 73 | */ 74 | extern uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC]; 75 | extern uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ]; 76 | extern uint8_t USBD_OtherSpeedCfgDesc[USB_LEN_CFG_DESC]; 77 | extern uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC]; 78 | extern uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID]; 79 | extern USBD_DEVICE USR_desc; 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup USBD_DESC_Exported_FunctionsPrototype 85 | * @{ 86 | */ 87 | 88 | 89 | uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length); 90 | uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length); 91 | uint8_t * USBD_USR_ManufacturerStrDescriptor ( uint8_t speed , uint16_t *length); 92 | uint8_t * USBD_USR_ProductStrDescriptor ( uint8_t speed , uint16_t *length); 93 | uint8_t * USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length); 94 | uint8_t * USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length); 95 | uint8_t * USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length); 96 | 97 | #ifdef USB_SUPPORT_USER_STRING_DESC 98 | uint8_t * USBD_USR_USRStringDesc (uint8_t speed, uint8_t idx , uint16_t *length); 99 | #endif /* USB_SUPPORT_USER_STRING_DESC */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | #endif /* __USBD_DESC_H */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 115 | -------------------------------------------------------------------------------- /escsw-coocox/cdc/inc/usbh_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_conf_template 4 | * @author MCD Application Team 5 | * @version V2.0.0 6 | * @date 22-July-2011 7 | * @brief General USB Host library configuration 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBH_CONF__H__ 24 | #define __USBH_CONF__H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | /** @addtogroup USBH_OTG_DRIVER 28 | * @{ 29 | */ 30 | 31 | /** @defgroup USBH_CONF 32 | * @brief usb otg low level driver configuration file 33 | * @{ 34 | */ 35 | 36 | /** @defgroup USBH_CONF_Exported_Defines 37 | * @{ 38 | */ 39 | 40 | #define USBH_MAX_NUM_ENDPOINTS 2 41 | #define USBH_MAX_NUM_INTERFACES 2 42 | #ifdef USE_USB_OTG_FS 43 | #define USBH_MSC_MPS_SIZE 0x40 44 | #else 45 | #define USBH_MSC_MPS_SIZE 0x200 46 | #endif 47 | 48 | /** 49 | * @} 50 | */ 51 | 52 | 53 | /** @defgroup USBH_CONF_Exported_Types 54 | * @{ 55 | */ 56 | /** 57 | * @} 58 | */ 59 | 60 | 61 | /** @defgroup USBH_CONF_Exported_Macros 62 | * @{ 63 | */ 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup USBH_CONF_Exported_Variables 69 | * @{ 70 | */ 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup USBH_CONF_Exported_FunctionsPrototype 76 | * @{ 77 | */ 78 | /** 79 | * @} 80 | */ 81 | 82 | 83 | #endif //__USBH_CONF__H__ 84 | 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 94 | 95 | -------------------------------------------------------------------------------- /escsw-coocox/cdc/src/usbd_usr.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_usr.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief This file includes the user application layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | #include "usbd_usr.h" 23 | #include "usbd_ioreq.h" 24 | 25 | USBD_Usr_cb_TypeDef USR_cb = 26 | { 27 | USBD_USR_Init, 28 | USBD_USR_DeviceReset, 29 | USBD_USR_DeviceConfigured, 30 | USBD_USR_DeviceSuspended, 31 | USBD_USR_DeviceResumed, 32 | 33 | USBD_USR_DeviceConnected, 34 | USBD_USR_DeviceDisconnected, 35 | }; 36 | 37 | 38 | /** 39 | * @brief USBD_USR_Init 40 | * Displays the message on LCD for host lib initialization 41 | * @param None 42 | * @retval None 43 | */ 44 | void USBD_USR_Init(void) 45 | { 46 | 47 | } 48 | 49 | /** 50 | * @brief USBD_USR_DeviceReset 51 | * Displays the message on LCD on device Reset Event 52 | * @param speed : device speed 53 | * @retval None 54 | */ 55 | void USBD_USR_DeviceReset(uint8_t speed ) 56 | { 57 | switch (speed) 58 | { 59 | case USB_OTG_SPEED_HIGH: 60 | break; 61 | 62 | case USB_OTG_SPEED_FULL: 63 | break; 64 | default: 65 | break; 66 | 67 | } 68 | } 69 | 70 | 71 | /** 72 | * @brief USBD_USR_DeviceConfigured 73 | * Displays the message on LCD on device configuration Event 74 | * @param None 75 | * @retval Staus 76 | */ 77 | void USBD_USR_DeviceConfigured (void) 78 | { 79 | } 80 | 81 | 82 | /** 83 | * @brief USBD_USR_DeviceConnected 84 | * Displays the message on LCD on device connection Event 85 | * @param None 86 | * @retval Staus 87 | */ 88 | void USBD_USR_DeviceConnected (void) 89 | { 90 | } 91 | 92 | 93 | /** 94 | * @brief USBD_USR_DeviceDisonnected 95 | * Displays the message on LCD on device disconnection Event 96 | * @param None 97 | * @retval Staus 98 | */ 99 | void USBD_USR_DeviceDisconnected (void) 100 | { 101 | } 102 | 103 | /** 104 | * @brief USBD_USR_DeviceSuspended 105 | * Displays the message on LCD on device suspend Event 106 | * @param None 107 | * @retval None 108 | */ 109 | void USBD_USR_DeviceSuspended(void) 110 | { 111 | /* Users can do their application actions here for the USB-Reset */ 112 | } 113 | 114 | 115 | /** 116 | * @brief USBD_USR_DeviceResumed 117 | * Displays the message on LCD on device resume Event 118 | * @param None 119 | * @retval None 120 | */ 121 | void USBD_USR_DeviceResumed(void) 122 | { 123 | /* Users can do their application actions here for the USB-Reset */ 124 | } 125 | 126 | 127 | -------------------------------------------------------------------------------- /escsw-coocox/cmsis_boot/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/escsw-coocox/cmsis_boot/stm32f4xx.h -------------------------------------------------------------------------------- /escsw-coocox/cmsis_boot/stm32f4xx_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_CONF_H 24 | #define __STM32F4xx_CONF_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | /* Uncomment the line below to enable peripheral header file inclusion */ 28 | //#include "stm32f4xx_adc.h" 29 | //#include "stm32f4xx_can.h" 30 | //#include "stm32f4xx_crc.h" 31 | //#include "stm32f4xx_cryp.h" 32 | //#include "stm32f4xx_dac.h" 33 | //#include "stm32f4xx_dbgmcu.h" 34 | //#include "stm32f4xx_dcmi.h" 35 | #include "stm32f4xx_dma.h" 36 | #include "stm32f4xx_exti.h" 37 | //#include "stm32f4xx_flash.h" 38 | //#include "stm32f4xx_fsmc.h" 39 | //#include "stm32f4xx_hash.h" 40 | #include "stm32f4xx_gpio.h" 41 | //#include "stm32f4xx_i2c.h" 42 | //#include "stm32f4xx_iwdg.h" 43 | //#include "stm32f4xx_pwr.h" 44 | #include "stm32f4xx_rcc.h" 45 | //#include "stm32f4xx_rng.h" 46 | //#include "stm32f4xx_rtc.h" 47 | //#include "stm32f4xx_sdio.h" 48 | //#include "stm32f4xx_spi.h" 49 | #include "stm32f4xx_syscfg.h" 50 | #include "stm32f4xx_tim.h" 51 | //#include "stm32f4xx_usart.h" 52 | //#include "stm32f4xx_wwdg.h" 53 | #include "misc.h" 54 | /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 55 | 56 | /* Exported types ------------------------------------------------------------*/ 57 | /* Exported constants --------------------------------------------------------*/ 58 | 59 | /* If an external clock source is used, then the value of the following define 60 | should be set to the value of the external clock source, else, if no external 61 | clock is used, keep this define commented */ 62 | /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */ 63 | 64 | 65 | /* Uncomment the line below to expanse the "assert_param" macro in the 66 | Standard Peripheral Library drivers code */ 67 | /* #define USE_FULL_ASSERT 1 */ 68 | 69 | /* Exported macro ------------------------------------------------------------*/ 70 | #ifdef USE_FULL_ASSERT 71 | 72 | /** 73 | * @brief The assert_param macro is used for function's parameters check. 74 | * @param expr: If expr is false, it calls assert_failed function 75 | * which reports the name of the source file and the source 76 | * line number of the call that failed. 77 | * If expr is true, it returns no value. 78 | * @retval None 79 | */ 80 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 81 | /* Exported functions ------------------------------------------------------- */ 82 | void assert_failed(uint8_t* file, uint32_t line); 83 | #else 84 | #define assert_param(expr) ((void)0) 85 | #endif /* USE_FULL_ASSERT */ 86 | 87 | #endif /* __STM32F4xx_CONF_H */ 88 | 89 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 90 | -------------------------------------------------------------------------------- /escsw-coocox/cmsis_boot/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f4xx_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F4XX_H 34 | #define __SYSTEM_STM32F4XX_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F4xx_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F4xx_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @addtogroup STM32F4xx_System_Exported_Constants 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @addtogroup STM32F4xx_System_Exported_Macros 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @addtogroup STM32F4xx_System_Exported_Functions 77 | * @{ 78 | */ 79 | 80 | extern void SystemInit(void); 81 | extern void SystemCoreClockUpdate(void); 82 | /** 83 | * @} 84 | */ 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /*__SYSTEM_STM32F4XX_H */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 100 | -------------------------------------------------------------------------------- /escsw-coocox/cmsis_lib/include/misc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file misc.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the miscellaneous 8 | * firmware library functions (add-on to CMSIS functions). 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __MISC_H 25 | #define __MISC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup MISC 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | 44 | /** 45 | * @brief NVIC Init Structure definition 46 | */ 47 | 48 | typedef struct 49 | { 50 | uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled. 51 | This parameter can be an enumerator of @ref IRQn_Type 52 | enumeration (For the complete STM32 Devices IRQ Channels 53 | list, please refer to stm32f4xx.h file) */ 54 | 55 | uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel 56 | specified in NVIC_IRQChannel. This parameter can be a value 57 | between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table 58 | A lower priority value indicates a higher priority */ 59 | 60 | uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified 61 | in NVIC_IRQChannel. This parameter can be a value 62 | between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table 63 | A lower priority value indicates a higher priority */ 64 | 65 | FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel 66 | will be enabled or disabled. 67 | This parameter can be set either to ENABLE or DISABLE */ 68 | } NVIC_InitTypeDef; 69 | 70 | /* Exported constants --------------------------------------------------------*/ 71 | 72 | /** @defgroup MISC_Exported_Constants 73 | * @{ 74 | */ 75 | 76 | /** @defgroup MISC_Vector_Table_Base 77 | * @{ 78 | */ 79 | 80 | #define NVIC_VectTab_RAM ((uint32_t)0x20000000) 81 | #define NVIC_VectTab_FLASH ((uint32_t)0x08000000) 82 | #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \ 83 | ((VECTTAB) == NVIC_VectTab_FLASH)) 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup MISC_System_Low_Power 89 | * @{ 90 | */ 91 | 92 | #define NVIC_LP_SEVONPEND ((uint8_t)0x10) 93 | #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04) 94 | #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02) 95 | #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \ 96 | ((LP) == NVIC_LP_SLEEPDEEP) || \ 97 | ((LP) == NVIC_LP_SLEEPONEXIT)) 98 | /** 99 | * @} 100 | */ 101 | 102 | /** @defgroup MISC_Preemption_Priority_Group 103 | * @{ 104 | */ 105 | 106 | #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority 107 | 4 bits for subpriority */ 108 | #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority 109 | 3 bits for subpriority */ 110 | #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority 111 | 2 bits for subpriority */ 112 | #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority 113 | 1 bits for subpriority */ 114 | #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority 115 | 0 bits for subpriority */ 116 | 117 | #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \ 118 | ((GROUP) == NVIC_PriorityGroup_1) || \ 119 | ((GROUP) == NVIC_PriorityGroup_2) || \ 120 | ((GROUP) == NVIC_PriorityGroup_3) || \ 121 | ((GROUP) == NVIC_PriorityGroup_4)) 122 | 123 | #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) 124 | 125 | #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) 126 | 127 | #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF) 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /** @defgroup MISC_SysTick_clock_source 134 | * @{ 135 | */ 136 | 137 | #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB) 138 | #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004) 139 | #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \ 140 | ((SOURCE) == SysTick_CLKSource_HCLK_Div8)) 141 | /** 142 | * @} 143 | */ 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | /* Exported macro ------------------------------------------------------------*/ 150 | /* Exported functions --------------------------------------------------------*/ 151 | 152 | void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup); 153 | void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct); 154 | void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset); 155 | void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState); 156 | void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource); 157 | 158 | #ifdef __cplusplus 159 | } 160 | #endif 161 | 162 | #endif /* __MISC_H */ 163 | 164 | /** 165 | * @} 166 | */ 167 | 168 | /** 169 | * @} 170 | */ 171 | 172 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 173 | -------------------------------------------------------------------------------- /escsw-coocox/cmsis_lib/include/stm32f4xx_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_pwr.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the PWR firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_PWR_H 25 | #define __STM32F4xx_PWR_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup PWR 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup PWR_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup PWR_PVD_detection_level 50 | * @{ 51 | */ 52 | 53 | #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0 54 | #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1 55 | #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2 56 | #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3 57 | #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4 58 | #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5 59 | #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6 60 | #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7 61 | 62 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \ 63 | ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \ 64 | ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \ 65 | ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7)) 66 | /** 67 | * @} 68 | */ 69 | 70 | 71 | /** @defgroup PWR_Regulator_state_in_STOP_mode 72 | * @{ 73 | */ 74 | 75 | #define PWR_Regulator_ON ((uint32_t)0x00000000) 76 | #define PWR_Regulator_LowPower PWR_CR_LPDS 77 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ 78 | ((REGULATOR) == PWR_Regulator_LowPower)) 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup PWR_STOP_mode_entry 84 | * @{ 85 | */ 86 | 87 | #define PWR_STOPEntry_WFI ((uint8_t)0x01) 88 | #define PWR_STOPEntry_WFE ((uint8_t)0x02) 89 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) 90 | 91 | /** @defgroup PWR_Regulator_Voltage_Scale 92 | * @{ 93 | */ 94 | 95 | #define PWR_Regulator_Voltage_Scale1 ((uint32_t)0x00004000) 96 | #define PWR_Regulator_Voltage_Scale2 ((uint32_t)0x00000000) 97 | #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_Regulator_Voltage_Scale1) || ((VOLTAGE) == PWR_Regulator_Voltage_Scale2)) 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** @defgroup PWR_Flag 104 | * @{ 105 | */ 106 | 107 | #define PWR_FLAG_WU PWR_CSR_WUF 108 | #define PWR_FLAG_SB PWR_CSR_SBF 109 | #define PWR_FLAG_PVDO PWR_CSR_PVDO 110 | #define PWR_FLAG_BRR PWR_CSR_BRR 111 | #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY 112 | 113 | /** @defgroup PWR_Flag_Legacy 114 | * @{ 115 | */ 116 | #define PWR_FLAG_REGRDY PWR_FLAG_VOSRDY 117 | /** 118 | * @} 119 | */ 120 | 121 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ 122 | ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_BRR) || \ 123 | ((FLAG) == PWR_FLAG_VOSRDY)) 124 | 125 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) 126 | /** 127 | * @} 128 | */ 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /* Exported macro ------------------------------------------------------------*/ 135 | /* Exported functions --------------------------------------------------------*/ 136 | 137 | /* Function used to set the PWR configuration to the default reset state ******/ 138 | void PWR_DeInit(void); 139 | 140 | /* Backup Domain Access function **********************************************/ 141 | void PWR_BackupAccessCmd(FunctionalState NewState); 142 | 143 | /* PVD configuration functions ************************************************/ 144 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); 145 | void PWR_PVDCmd(FunctionalState NewState); 146 | 147 | /* WakeUp pins configuration functions ****************************************/ 148 | void PWR_WakeUpPinCmd(FunctionalState NewState); 149 | 150 | /* Main and Backup Regulators configuration functions *************************/ 151 | void PWR_BackupRegulatorCmd(FunctionalState NewState); 152 | void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage); 153 | 154 | /* FLASH Power Down configuration functions ***********************************/ 155 | void PWR_FlashPowerDownCmd(FunctionalState NewState); 156 | 157 | /* Low Power modes configuration functions ************************************/ 158 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); 159 | void PWR_EnterSTANDBYMode(void); 160 | 161 | /* Flags management functions *************************************************/ 162 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); 163 | void PWR_ClearFlag(uint32_t PWR_FLAG); 164 | 165 | #ifdef __cplusplus 166 | } 167 | #endif 168 | 169 | #endif /* __STM32F4xx_PWR_H */ 170 | 171 | /** 172 | * @} 173 | */ 174 | 175 | /** 176 | * @} 177 | */ 178 | 179 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 180 | -------------------------------------------------------------------------------- /escsw-coocox/cmsis_lib/include/stm32f4xx_syscfg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_syscfg.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the SYSCFG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_SYSCFG_H 25 | #define __STM32F4xx_SYSCFG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup SYSCFG 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup SYSCFG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup SYSCFG_EXTI_Port_Sources 50 | * @{ 51 | */ 52 | #define EXTI_PortSourceGPIOA ((uint8_t)0x00) 53 | #define EXTI_PortSourceGPIOB ((uint8_t)0x01) 54 | #define EXTI_PortSourceGPIOC ((uint8_t)0x02) 55 | #define EXTI_PortSourceGPIOD ((uint8_t)0x03) 56 | #define EXTI_PortSourceGPIOE ((uint8_t)0x04) 57 | #define EXTI_PortSourceGPIOF ((uint8_t)0x05) 58 | #define EXTI_PortSourceGPIOG ((uint8_t)0x06) 59 | #define EXTI_PortSourceGPIOH ((uint8_t)0x07) 60 | #define EXTI_PortSourceGPIOI ((uint8_t)0x08) 61 | 62 | #define IS_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == EXTI_PortSourceGPIOA) || \ 63 | ((PORTSOURCE) == EXTI_PortSourceGPIOB) || \ 64 | ((PORTSOURCE) == EXTI_PortSourceGPIOC) || \ 65 | ((PORTSOURCE) == EXTI_PortSourceGPIOD) || \ 66 | ((PORTSOURCE) == EXTI_PortSourceGPIOE) || \ 67 | ((PORTSOURCE) == EXTI_PortSourceGPIOF) || \ 68 | ((PORTSOURCE) == EXTI_PortSourceGPIOG) || \ 69 | ((PORTSOURCE) == EXTI_PortSourceGPIOH) || \ 70 | ((PORTSOURCE) == EXTI_PortSourceGPIOI)) 71 | /** 72 | * @} 73 | */ 74 | 75 | 76 | /** @defgroup SYSCFG_EXTI_Pin_Sources 77 | * @{ 78 | */ 79 | #define EXTI_PinSource0 ((uint8_t)0x00) 80 | #define EXTI_PinSource1 ((uint8_t)0x01) 81 | #define EXTI_PinSource2 ((uint8_t)0x02) 82 | #define EXTI_PinSource3 ((uint8_t)0x03) 83 | #define EXTI_PinSource4 ((uint8_t)0x04) 84 | #define EXTI_PinSource5 ((uint8_t)0x05) 85 | #define EXTI_PinSource6 ((uint8_t)0x06) 86 | #define EXTI_PinSource7 ((uint8_t)0x07) 87 | #define EXTI_PinSource8 ((uint8_t)0x08) 88 | #define EXTI_PinSource9 ((uint8_t)0x09) 89 | #define EXTI_PinSource10 ((uint8_t)0x0A) 90 | #define EXTI_PinSource11 ((uint8_t)0x0B) 91 | #define EXTI_PinSource12 ((uint8_t)0x0C) 92 | #define EXTI_PinSource13 ((uint8_t)0x0D) 93 | #define EXTI_PinSource14 ((uint8_t)0x0E) 94 | #define EXTI_PinSource15 ((uint8_t)0x0F) 95 | #define IS_EXTI_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == EXTI_PinSource0) || \ 96 | ((PINSOURCE) == EXTI_PinSource1) || \ 97 | ((PINSOURCE) == EXTI_PinSource2) || \ 98 | ((PINSOURCE) == EXTI_PinSource3) || \ 99 | ((PINSOURCE) == EXTI_PinSource4) || \ 100 | ((PINSOURCE) == EXTI_PinSource5) || \ 101 | ((PINSOURCE) == EXTI_PinSource6) || \ 102 | ((PINSOURCE) == EXTI_PinSource7) || \ 103 | ((PINSOURCE) == EXTI_PinSource8) || \ 104 | ((PINSOURCE) == EXTI_PinSource9) || \ 105 | ((PINSOURCE) == EXTI_PinSource10) || \ 106 | ((PINSOURCE) == EXTI_PinSource11) || \ 107 | ((PINSOURCE) == EXTI_PinSource12) || \ 108 | ((PINSOURCE) == EXTI_PinSource13) || \ 109 | ((PINSOURCE) == EXTI_PinSource14) || \ 110 | ((PINSOURCE) == EXTI_PinSource15)) 111 | /** 112 | * @} 113 | */ 114 | 115 | 116 | /** @defgroup SYSCFG_Memory_Remap_Config 117 | * @{ 118 | */ 119 | #define SYSCFG_MemoryRemap_Flash ((uint8_t)0x00) 120 | #define SYSCFG_MemoryRemap_SystemFlash ((uint8_t)0x01) 121 | #define SYSCFG_MemoryRemap_FSMC ((uint8_t)0x02) 122 | #define SYSCFG_MemoryRemap_SRAM ((uint8_t)0x03) 123 | 124 | #define IS_SYSCFG_MEMORY_REMAP_CONFING(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \ 125 | ((REMAP) == SYSCFG_MemoryRemap_SystemFlash) || \ 126 | ((REMAP) == SYSCFG_MemoryRemap_SRAM) || \ 127 | ((REMAP) == SYSCFG_MemoryRemap_FSMC)) 128 | /** 129 | * @} 130 | */ 131 | 132 | 133 | /** @defgroup SYSCFG_ETHERNET_Media_Interface 134 | * @{ 135 | */ 136 | #define SYSCFG_ETH_MediaInterface_MII ((uint32_t)0x00000000) 137 | #define SYSCFG_ETH_MediaInterface_RMII ((uint32_t)0x00000001) 138 | 139 | #define IS_SYSCFG_ETH_MEDIA_INTERFACE(INTERFACE) (((INTERFACE) == SYSCFG_ETH_MediaInterface_MII) || \ 140 | ((INTERFACE) == SYSCFG_ETH_MediaInterface_RMII)) 141 | /** 142 | * @} 143 | */ 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | /* Exported macro ------------------------------------------------------------*/ 150 | /* Exported functions --------------------------------------------------------*/ 151 | 152 | void SYSCFG_DeInit(void); 153 | void SYSCFG_MemoryRemapConfig(uint8_t SYSCFG_MemoryRemap); 154 | void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex); 155 | void SYSCFG_ETH_MediaInterfaceConfig(uint32_t SYSCFG_ETH_MediaInterface); 156 | void SYSCFG_CompensationCellCmd(FunctionalState NewState); 157 | FlagStatus SYSCFG_GetCompensationCellStatus(void); 158 | 159 | #ifdef __cplusplus 160 | } 161 | #endif 162 | 163 | #endif /*__STM32F4xx_SYSCFG_H */ 164 | 165 | /** 166 | * @} 167 | */ 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 174 | -------------------------------------------------------------------------------- /escsw-coocox/cmsis_lib/source/stm32f4xx_rcc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/escsw-coocox/cmsis_lib/source/stm32f4xx_rcc.c -------------------------------------------------------------------------------- /escsw-coocox/componentfile.history: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /escsw-coocox/config.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIG_H 2 | #define CONFIG_H 3 | 4 | void config(void); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /escsw-coocox/main.c: -------------------------------------------------------------------------------- 1 | #include "stm32f4_discovery.h" 2 | #include 3 | #include "stm32f4xx_adc.h" 4 | 5 | #include "config.h" 6 | #include "vars.h" 7 | 8 | __IO uint16_t ADCConvertedValue[4]; 9 | __IO uint32_t DutyCycle; 10 | __IO uint32_t Frequency; 11 | 12 | int main(void) { 13 | config(); 14 | 15 | while (1) { 16 | static int i; 17 | 18 | for (i = 0; i < 1000000; ++i) 19 | ; 20 | printf("%u %u %u %u %u %u\n", currentTime, ADCConvertedValue[0], ADCConvertedValue[1], ADCConvertedValue[2], ADCConvertedValue[3], fastfreq ); 21 | 22 | //GPIO_ToggleBits(GPIOD, GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15); 23 | GPIO_ToggleBits(GPIOD, GPIO_Pin_15); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /escsw-coocox/stm32f4_discovery_callbacks.c: -------------------------------------------------------------------------------- 1 | #include "STM32F4-Discovery/stm32f4_discovery.h" 2 | 3 | void EVAL_AUDIO_TransferComplete_CallBack(uint32_t pBuffer, uint32_t Size){ 4 | 5 | } 6 | 7 | uint16_t EVAL_AUDIO_GetSampleCallBack(void){ 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /escsw-coocox/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file GPIO/IOToggle/stm32f4xx_it.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_IT_H 24 | #define __STM32F4xx_IT_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f4xx.h" 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported functions ------------------------------------------------------- */ 37 | 38 | void NMI_Handler(void); 39 | void HardFault_Handler(void); 40 | void MemManage_Handler(void); 41 | void BusFault_Handler(void); 42 | void UsageFault_Handler(void); 43 | void SVC_Handler(void); 44 | void DebugMon_Handler(void); 45 | void PendSV_Handler(void); 46 | void SysTick_Handler(void); 47 | void DMA2_Stream0_IRQHandler(void); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __STM32F4xx_IT_H */ 54 | 55 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 56 | -------------------------------------------------------------------------------- /escsw-coocox/syscalls/syscalls.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************//***** 2 | * @file stdio.c 3 | * @brief Implementation of newlib syscall 4 | ********************************************************************************/ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "usbd_cdc_vcp.h" 11 | 12 | #undef errno 13 | extern int errno; 14 | extern int _end; 15 | 16 | /*This function is used for handle heap option*/ 17 | __attribute__ ((used)) 18 | caddr_t _sbrk ( int incr ) 19 | { 20 | static unsigned char *heap = NULL; 21 | unsigned char *prev_heap; 22 | 23 | if (heap == NULL) { 24 | heap = (unsigned char *)&_end; 25 | } 26 | prev_heap = heap; 27 | 28 | heap += incr; 29 | 30 | return (caddr_t) prev_heap; 31 | } 32 | 33 | __attribute__ ((used)) 34 | int link(char *old, char *new) 35 | { 36 | return -1; 37 | } 38 | 39 | __attribute__ ((used)) 40 | int _close(int file) 41 | { 42 | return -1; 43 | } 44 | 45 | __attribute__ ((used)) 46 | int _fstat(int file, struct stat *st) 47 | { 48 | st->st_mode = S_IFCHR; 49 | return 0; 50 | } 51 | 52 | __attribute__ ((used)) 53 | int _isatty(int file) 54 | { 55 | return 1; 56 | } 57 | 58 | __attribute__ ((used)) 59 | int _lseek(int file, int ptr, int dir) 60 | { 61 | return 0; 62 | } 63 | 64 | /*Low layer read(input) function*/ 65 | __attribute__ ((used)) 66 | int _read(int file, char *ptr, int len) 67 | { 68 | 69 | if (file != 0) { 70 | return 0; 71 | } 72 | 73 | // Use USB CDC Port for stdin 74 | while(!VCP_get_char((uint8_t*)ptr)){}; 75 | 76 | // Echo typed characters 77 | VCP_put_char((uint8_t)*ptr); 78 | 79 | return 1; 80 | } 81 | 82 | 83 | /*Low layer write(output) function*/ 84 | __attribute__ ((used)) 85 | int _write(int file, char *ptr, int len) 86 | { 87 | VCP_send_buffer((uint8_t*)ptr, len); 88 | return len; 89 | } 90 | 91 | __attribute__ ((used)) 92 | void abort(void) 93 | { 94 | /* Abort called */ 95 | while(1); 96 | } 97 | 98 | /* --------------------------------- End Of File ------------------------------ */ 99 | -------------------------------------------------------------------------------- /escsw-coocox/vars.h: -------------------------------------------------------------------------------- 1 | #ifndef VARS_H 2 | #define VARS_H 3 | 4 | #define GTDEBUG 1 5 | 6 | #define DS_IDLE 0 7 | #define DS_PARK 1 8 | #define DS_RAMP 2 9 | #define DS_RUN 3 10 | 11 | extern uint32_t currentTime; 12 | extern uint32_t fastcounter; 13 | extern uint32_t fastfreq; 14 | 15 | extern __IO uint32_t DutyCycle; 16 | extern __IO uint32_t Frequency; 17 | extern __IO uint16_t ADCConvertedValue[4]; 18 | 19 | extern float Ialpha; 20 | extern float Ibeta; 21 | extern float valpha; 22 | extern float vbeta; 23 | extern float vbus; 24 | extern int drivestate; 25 | extern float theta; 26 | extern float Iqm; 27 | extern float Idm; 28 | extern float vq; 29 | extern float vd; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /foc_simulation/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | 3 | -------------------------------------------------------------------------------- /foc_simulation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/foc_simulation/__init__.py -------------------------------------------------------------------------------- /foc_simulation/run_foc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PYTHONPATH=`pwd` 4 | cd /work/bldc-sim 5 | 6 | python sim.py foc 7 | 8 | -------------------------------------------------------------------------------- /hardware/BOMv4.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/hardware/BOMv4.ods -------------------------------------------------------------------------------- /hardware/boardv4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/hardware/boardv4.png -------------------------------------------------------------------------------- /hardware/bomv7.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/hardware/bomv7.ods -------------------------------------------------------------------------------- /hardware/bomv9.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/hardware/bomv9.ods -------------------------------------------------------------------------------- /hardware/escv4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/hardware/escv4.pdf -------------------------------------------------------------------------------- /hardware/escv8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/hardware/escv8.pdf -------------------------------------------------------------------------------- /hardware/escv9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtoonstra/foc_esc/58425c0ce5865c077ce313bd672b971380f2edad/hardware/escv9.pdf --------------------------------------------------------------------------------