![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
This project serves as a template for work with the Freescale FRDM-KL46 board. Support will be added to all on-board peripherals, sensors and I/O.
Dependencies: FRDM_MMA8451Q MAG3110 TSI mbed
Fork of FRDM-KL46-Template by
Project Information:
Theory
This project has been created to serve as a template for those who wish to use the Freescale Freedom FRDM-KL46Z board. Existing drivers within mbed have been brought together and board specific configurations for certain inputs and outputs have included.
Libraries
- TSI (source: http://mbed.org/users/emilmont/code/TSI/ ) Capacitive Touch library to support the on-board Touch-Slider
- FRDM_MMA8451Q (source: http://mbed.org/users/clemente/code/FRDM_MMA8451Q/ ) Freescale MMA8451 Accelerometer connected on I2C0
- MAG3110 (source: http://mbed.org/users/mmaas/code/MAG3110/) (based on: http://mbed.org/users/SomeRandomBloke/code/MAG3110/)
TODOs
- Add support for Segment LCD - intend to use driver in example code: http://cache.freescale.com/files/32bit/software/KL46_SC.exe
Hardware Information:
FRDM-KL46Z Information
- User Guide Guide: http://cache.freescale.com/files/microcontrollers/doc/user_guide/FRDM-KL46Z_UM.pdf
- Schematics: http://cache.freescale.com/files/microcontrollers/hardware_tools/schematics/FRDM-KL46Z_SCH.pdf
Freescale Kinetis L-Series Microcontroller Information
- Kinetis KL46 Drop Page: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=KL4x
- Kinetis KL46 Fact Sheet: http://cache.freescale.com/files/microcontrollers/doc/fact_sheet/LSERIESKL4FS.pdf
- Kinetis KL46 Reference Manual: http://cache.freescale.com/files/microcontrollers/doc/ref_manual/KL46P121M48SF4RM.pdf
- Kinetis KL46 Data Sheet: http://cache.freescale.com/files/microcontrollers/doc/data_sheet/KL46P121M48SF4.pdf
Freescale Sensor Information
MMA8451Q
MAG3110
main.cpp@2:48ac01f5024d, 2013-12-19 (annotated)
- Committer:
- mmaas
- Date:
- Thu Dec 19 15:39:52 2013 +0000
- Revision:
- 2:48ac01f5024d
- Parent:
- 1:28c81db67f50
- Child:
- 3:1e85b49a3e18
Online mbed library was updated with fix for enabling pullups on GPIO. Removed local library and added back online library. Works.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mmaas | 0:79ae6809c2d0 | 1 | #include "mbed.h" |
mmaas | 0:79ae6809c2d0 | 2 | |
mmaas | 1:28c81db67f50 | 3 | // Include support for USB Serial console |
mmaas | 0:79ae6809c2d0 | 4 | Serial pc(USBTX, USBRX); |
mmaas | 0:79ae6809c2d0 | 5 | |
mmaas | 1:28c81db67f50 | 6 | // Include support for on-board green and red LEDs |
mmaas | 2:48ac01f5024d | 7 | DigitalOut greenLED(LED_GREEN); |
mmaas | 1:28c81db67f50 | 8 | DigitalOut redLED(LED_RED); |
mmaas | 1:28c81db67f50 | 9 | |
mmaas | 1:28c81db67f50 | 10 | // Definitions for LED states (logic inverted output value 0 = O) |
mmaas | 1:28c81db67f50 | 11 | #define LED_ON 0 |
mmaas | 1:28c81db67f50 | 12 | #define LED_OFF 1 |
mmaas | 0:79ae6809c2d0 | 13 | |
mmaas | 0:79ae6809c2d0 | 14 | int main() { |
mmaas | 0:79ae6809c2d0 | 15 | |
mmaas | 1:28c81db67f50 | 16 | // Ensure LEDs are off |
mmaas | 2:48ac01f5024d | 17 | greenLED = LED_OFF; |
mmaas | 1:28c81db67f50 | 18 | redLED = LED_OFF; |
mmaas | 1:28c81db67f50 | 19 | |
mmaas | 0:79ae6809c2d0 | 20 | // Set Serial Port data rate and say Hello |
mmaas | 0:79ae6809c2d0 | 21 | pc.baud( 230400 ); |
mmaas | 0:79ae6809c2d0 | 22 | pc.printf("Hello World\r\n"); |
mmaas | 0:79ae6809c2d0 | 23 | |
mmaas | 2:48ac01f5024d | 24 | // Quick blink LEDs |
mmaas | 2:48ac01f5024d | 25 | redLED = LED_ON; |
mmaas | 2:48ac01f5024d | 26 | wait(.05); |
mmaas | 2:48ac01f5024d | 27 | greenLED = LED_ON; |
mmaas | 2:48ac01f5024d | 28 | wait(.05); |
mmaas | 2:48ac01f5024d | 29 | greenLED = LED_OFF; |
mmaas | 2:48ac01f5024d | 30 | redLED = LED_OFF; |
mmaas | 2:48ac01f5024d | 31 | |
mmaas | 2:48ac01f5024d | 32 | wait(1); |
mmaas | 2:48ac01f5024d | 33 | |
mmaas | 2:48ac01f5024d | 34 | |
mmaas | 2:48ac01f5024d | 35 | |
mmaas | 1:28c81db67f50 | 36 | // Blink LEDs - green first |
mmaas | 0:79ae6809c2d0 | 37 | while(1) { |
mmaas | 2:48ac01f5024d | 38 | greenLED = LED_ON; |
mmaas | 1:28c81db67f50 | 39 | redLED = LED_OFF; |
mmaas | 1:28c81db67f50 | 40 | |
mmaas | 1:28c81db67f50 | 41 | wait(1); |
mmaas | 1:28c81db67f50 | 42 | |
mmaas | 2:48ac01f5024d | 43 | greenLED = LED_OFF; |
mmaas | 1:28c81db67f50 | 44 | redLED = LED_ON; |
mmaas | 1:28c81db67f50 | 45 | |
mmaas | 1:28c81db67f50 | 46 | wait(1); |
mmaas | 1:28c81db67f50 | 47 | |
mmaas | 0:79ae6809c2d0 | 48 | } |
mmaas | 0:79ae6809c2d0 | 49 | } |