EtherCAT slave that reads 3 Xsens IMU's connected to a Xbus Master
Dependencies: MODSERIAL mbed KL25Z_ClockControl
Fork of EtherCAT by
EtherCAT/cpuinit.cpp@13:5e4dcbd44786, 2015-03-03 (annotated)
- Committer:
- vsluiter
- Date:
- Tue Mar 03 12:14:22 2015 +0000
- Revision:
- 13:5e4dcbd44786
- Parent:
- 8:09dcef3ed467
- Child:
- 17:c5946a0fde83
Changed xbus to cpp in order to interface with MODSERIAL object, added initialization code for xbusmaster;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vsluiter | 1:5e22bf1a3817 | 1 | /* |
vsluiter | 1:5e22bf1a3817 | 2 | * SOES Simple Open EtherCAT Slave |
vsluiter | 1:5e22bf1a3817 | 3 | * |
vsluiter | 1:5e22bf1a3817 | 4 | * File : cpuinit.c |
vsluiter | 1:5e22bf1a3817 | 5 | * Version : 0.9.2 |
vsluiter | 1:5e22bf1a3817 | 6 | * Date : 22-02-2010 |
vsluiter | 1:5e22bf1a3817 | 7 | * Copyright (C) 2007-2010 Arthur Ketels |
vsluiter | 1:5e22bf1a3817 | 8 | * |
vsluiter | 1:5e22bf1a3817 | 9 | * SOES is free software; you can redistribute it and/or modify it under |
vsluiter | 1:5e22bf1a3817 | 10 | * the terms of the GNU General Public License version 2 as published by the Free |
vsluiter | 1:5e22bf1a3817 | 11 | * Software Foundation. |
vsluiter | 1:5e22bf1a3817 | 12 | * |
vsluiter | 1:5e22bf1a3817 | 13 | * SOES is distributed in the hope that it will be useful, but WITHOUT ANY |
vsluiter | 1:5e22bf1a3817 | 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or |
vsluiter | 1:5e22bf1a3817 | 15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
vsluiter | 1:5e22bf1a3817 | 16 | * for more details. |
vsluiter | 1:5e22bf1a3817 | 17 | * |
vsluiter | 1:5e22bf1a3817 | 18 | * As a special exception, if other files instantiate templates or use macros |
vsluiter | 1:5e22bf1a3817 | 19 | * or inline functions from this file, or you compile this file and link it |
vsluiter | 1:5e22bf1a3817 | 20 | * with other works to produce a work based on this file, this file does not |
vsluiter | 1:5e22bf1a3817 | 21 | * by itself cause the resulting work to be covered by the GNU General Public |
vsluiter | 1:5e22bf1a3817 | 22 | * License. However the source code for this file must still be made available |
vsluiter | 1:5e22bf1a3817 | 23 | * in accordance with section (3) of the GNU General Public License. |
vsluiter | 1:5e22bf1a3817 | 24 | * |
vsluiter | 1:5e22bf1a3817 | 25 | * This exception does not invalidate any other reasons why a work based on |
vsluiter | 1:5e22bf1a3817 | 26 | * this file might be covered by the GNU General Public License. |
vsluiter | 1:5e22bf1a3817 | 27 | * |
vsluiter | 1:5e22bf1a3817 | 28 | * The EtherCAT Technology, the trade name and logo "EtherCAT" are the intellectual |
vsluiter | 1:5e22bf1a3817 | 29 | * property of, and protected by Beckhoff Automation GmbH. |
vsluiter | 1:5e22bf1a3817 | 30 | */ |
vsluiter | 1:5e22bf1a3817 | 31 | //#include <avr/io.h> |
vsluiter | 1:5e22bf1a3817 | 32 | #include "cpuinit.h" |
vsluiter | 1:5e22bf1a3817 | 33 | #include "mbed.h" |
vsluiter | 1:5e22bf1a3817 | 34 | |
vsluiter | 5:6d75f432a41f | 35 | extern float FrontRight_offset; |
vsluiter | 5:6d75f432a41f | 36 | extern float FrontLeft_offset; |
vsluiter | 5:6d75f432a41f | 37 | extern float BackLeft_offset; |
vsluiter | 5:6d75f432a41f | 38 | extern float BackRight_offset; |
vsluiter | 5:6d75f432a41f | 39 | |
vsluiter | 1:5e22bf1a3817 | 40 | void cpuinit(void) |
vsluiter | 1:5e22bf1a3817 | 41 | { |
vsluiter | 1:5e22bf1a3817 | 42 | //shoe_serial.baud(921600); |
vsluiter | 1:5e22bf1a3817 | 43 | //et1100_spi.format(8,3); |
vsluiter | 8:09dcef3ed467 | 44 | et1100_spi.frequency(1000000); |
vsluiter | 13:5e4dcbd44786 | 45 | |
vsluiter | 13:5e4dcbd44786 | 46 | xbus.baud(115200); |
vsluiter | 13:5e4dcbd44786 | 47 | wait(1);//because Xbus master and IMU's need to boot. |
vsluiter | 13:5e4dcbd44786 | 48 | XbusInitializeXbusMaster(); |
vsluiter | 13:5e4dcbd44786 | 49 | |
vsluiter | 5:6d75f432a41f | 50 | wait_ms(20); |
vsluiter | 13:5e4dcbd44786 | 51 | |
vsluiter | 1:5e22bf1a3817 | 52 | |
vsluiter | 1:5e22bf1a3817 | 53 | } |
vsluiter | 1:5e22bf1a3817 | 54 |