Skip to content

Commit

Permalink
Declare v1.0.0 and switch to MIT to match parent lib
Browse files Browse the repository at this point in the history
  • Loading branch information
sarfata committed Jan 31, 2017
1 parent a1450ee commit 542816c
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 69 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tags
*.o
53 changes: 28 additions & 25 deletions NMEA2000_teensy.cpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
/*
NMEA2000_teensy.cpp
/*
The MIT License
2015 Copyright (c) Thomas Sarlandie All right reserved.
Author: Thomas Sarlandie
Copyright (c) 2015-2017 Thomas Sarlandie [email protected]
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-
1301 USA
Inherited NMEA2000 object for Teensy internal CAN
based setup. See also NMEA2000 library.
Requires FlexCAN library.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#include <NMEA2000_teensy.h>
/*
Inherited NMEA2000 object for Teensy internal CAN
based setup. See also NMEA2000 library.
Requires FlexCAN library.
*/

#include <NMEA2000_teensy.h>
#include <FlexCAN.h>
#include <kinetis_flexcan.h>

Expand All @@ -42,7 +45,7 @@ bool tNMEA2000_teensy::CANSendFrame(unsigned long id, unsigned char len, const u
out.ext = 1;
out.len = len;
out.timeout = (wait_sent?DefTimeOut:0);

for (int i=0; i<len && i<8; i++) out.buf[i] = buf[i];

return CANbus->write(out) == 1;
Expand All @@ -59,7 +62,7 @@ bool tNMEA2000_teensy::CANSendFrame(unsigned long id, unsigned char len, const u

//*****************************************************************************
bool tNMEA2000_teensy::CANOpen() {
CANbus->begin();
CANbus->begin();
return true;
}

Expand All @@ -68,7 +71,7 @@ bool tNMEA2000_teensy::CANGetFrame(unsigned long &id, unsigned char &len, unsign
CAN_message_t incoming;

if (CANbus->available() > 0) {
CANbus->read(incoming);
CANbus->read(incoming);
id = incoming.id;
len = incoming.len;
for (int i = 0; i < len && i < 8; i++) {
Expand Down
56 changes: 30 additions & 26 deletions NMEA2000_teensy.h
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
/*
NMEA2000_due.h
2015 Copyright (c) Thomas Sarlandie All right reserved.
Author: Thomas Sarlandie
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-
1301 USA
Inherited NMEA2000 object for Teensy internal CAN
based setup. See also NMEA2000 library.
Requires FlexCAN library.
/*
The MIT License
Copyright (c) 2016 Thomas Sarlandie [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

/*
Inherited NMEA2000 object for Teensy internal CAN
based setup. See also NMEA2000 library.
Requires FlexCAN library.
*/

#ifndef _NMEA2000_TEENSY_H_
#define _NMEA2000_TEENSY_H_

#include <NMEA2000.h>
#include <NMEA2000.h>
#include <N2kMsg.h>

#include <FlexCAN.h>
Expand All @@ -36,11 +40,11 @@ class tNMEA2000_teensy : public tNMEA2000
{
protected:
FlexCAN *CANbus;
uint16_t DefTimeOut;
uint16_t DefTimeOut;
bool CANSendFrame(unsigned long id, unsigned char len, const unsigned char *buf, bool wait_sent);
bool CANOpen();
bool CANGetFrame(unsigned long &id, unsigned char &len, unsigned char *buf);

public:
tNMEA2000_teensy(uint16_t _DefTimeOut=2);
};
Expand Down
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,24 @@ You will need a CAN transceiver like the MCP2551 (for a list of other tested CAN

## License

2015 Copyright (c) Thomas Sarlandie. All right reserved.

Author: Thomas Sarlandie

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-
1301 USA
The MIT License

Copyright (c) 2015-2017 Thomas Sarlandie [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name=NMEA2000_teensy
version=0.0.1
version=1.0.0
author=Thomas Sarlandie
maintainer=Thomas Sarlandie
sentence=NMEA2000 library driver for the Teensy 3.1/3.2
sentence=NMEA2000 library driver for the Teensy 3.1/3.2
paragraph=See https://github.com/ttlappalainen/NMEA2000
category=Communication
url=
Expand Down

0 comments on commit 542816c

Please sign in to comment.