Skip to content

Commit

Permalink
Add support for more microcontrollers (ATMega128/328)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrazio committed May 4, 2018
1 parent 74b01b6 commit 8c356aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 29 deletions.
33 changes: 10 additions & 23 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;


[platformio]
env_default = uno, pro, nano, uno_native, pro_native, nano_native
env_default = uno, pro, nano, nano168, nano168p, debug

[common]
lib_ignore =
Expand All @@ -28,53 +26,42 @@ lib_deps_external =
[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_ignore = ${common.lib_ignore}
src_build_flags = ${common.src_build_flags}
lib_deps = ${common.lib_deps_external}

[env:uno_native]
platform = atmelavr
board = uno
lib_ignore = ${common.lib_ignore}
src_build_flags = ${common.src_build_flags}
lib_deps = ${common.lib_deps_external}

[env:pro]
platform = atmelavr
board = pro16MHzatmega328
framework = arduino
lib_ignore = ${common.lib_ignore}
src_build_flags = ${common.src_build_flags}
lib_deps = ${common.lib_deps_external}
; Uncomment this line if you have upgraded the bootloader
; on your Arduino Pro Mini
;upload_speed = 115200
upload_protocol = usbasp
upload_flags = -Pusb

[env:pro_native]
[env:nano]
platform = atmelavr
board = pro16MHzatmega328
board = nanoatmega328
lib_ignore = ${common.lib_ignore}
src_build_flags = ${common.src_build_flags}
lib_deps = ${common.lib_deps_external}
; Uncomment this line if you have upgraded the bootloader
; on your Arduino Pro Mini
; on your Arduino Nano
;upload_speed = 115200

[env:nano]
[env:nano168]
platform = atmelavr
board = nanoatmega328
framework = arduino
board = nanoatmega168
lib_ignore = ${common.lib_ignore}
src_build_flags = ${common.src_build_flags}
lib_deps = ${common.lib_deps_external}
; Uncomment this line if you have upgraded the bootloader
; on your Arduino Nano
;upload_speed = 115200

[env:nano_native]
[env:nano168p]
platform = atmelavr
board = nanoatmega328
board = 168pa16m
lib_ignore = ${common.lib_ignore}
src_build_flags = ${common.src_build_flags}
lib_deps = ${common.lib_deps_external}
Expand Down
6 changes: 3 additions & 3 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

// Activate the following directive if you'd like to invert the motor rotation
// changing the focus direction.
//#define INVERT_MOTOR_DIR
#define INVERT_MOTOR_DIR

// When active ardufocus will apply a trapezoidal acceleration profile to the
// motor's speed, this feature is EXPERIMENTAL. The objective is to help the
Expand All @@ -81,15 +81,15 @@
// When active ardufocus will cut the stepper motor current when idle, in theory
// this could lead to less accuracy betwen movements but will keep the motor
// cool. When disabling this flag make sure your motor does not overheat.
#define MOTOR_SLEEP_WHEN_IDLE
//#define MOTOR_SLEEP_WHEN_IDLE

// When active each two half-steps will increase one unit on the step counter
// thus making distance-per-step constant between the two stepping modes, full
// and half.
//
// Enable this flag if you're using a cheap stepper motor such as 28BYJ-48 and
// verify if the overall system accuracy increases.
//#define COMPRESS_HALF_STEPS
#define COMPRESS_HALF_STEPS

// ----------------------------------------------------------------------------
// Temperature sensor configuration -------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions src/hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
#include <stdint.h>
#include <stdlib.h>

#include <avr/pgmspace.h>

#include "version.h"
#include "config.h"

#include "macro.h"

#ifdef __AVR_ATmega328P__

#if defined (__AVR_ATmega328P__) || defined (__AVR_ATmega168__) || defined (__AVR_ATmega168P__)
enum hal_timer_t
{
NOTIMER = 0,
Expand Down Expand Up @@ -84,7 +85,7 @@
};

#else
#error AVR ATmega328P not found, aborting
#error AVR ATmega328/128[P] not found, aborting
#endif

#endif

0 comments on commit 8c356aa

Please sign in to comment.