MATSU-bedのLチカ用サンプルプログラム

Dependencies:   mbed MATSUbed USBDevice

Fork of MATSU-bed_blinky by takaaki mastuzawa

Wiki https://developer.mbed.org/teams/MATSU-bed/wiki/MATSU-bed-config

Committer:
Tiryoh
Date:
Sun Dec 02 18:08:02 2018 +0000
Revision:
6:238d52235a29
Parent:
5:6190762f5f9a
Update library name

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hardtail 0:d696cd1aea56 1 #include "mbed.h"
hardtail 1:68364bcdd696 2 #include "USBSerial.h"
Tiryoh 6:238d52235a29 3 #include "MATSUbed.h"
hardtail 0:d696cd1aea56 4
hardtail 4:a6882e08058c 5 USBSerial pc(0x1f00,0x2012, 0x0001,false);
hardtail 0:d696cd1aea56 6
hardtail 1:68364bcdd696 7 BusOut myled(LED1, LED2, LED3, LED4);
hardtail 0:d696cd1aea56 8
hardtail 0:d696cd1aea56 9 //DigitalIn sw1(ISP0);
hardtail 0:d696cd1aea56 10 //DigitalIn sw2(ISP1);
hardtail 0:d696cd1aea56 11
hardtail 4:a6882e08058c 12 InterruptIn USB_ISP_bt(ISP0);
hardtail 4:a6882e08058c 13
hardtail 4:a6882e08058c 14 // ISP0ボタンを押すとUSB ISPモードに入る設定
hardtail 4:a6882e08058c 15 void enter_USB_ISP(){
hardtail 4:a6882e08058c 16 pc.printf("enter ISP\n");
hardtail 4:a6882e08058c 17 NVIC_SystemReset();
hardtail 4:a6882e08058c 18 }
hardtail 4:a6882e08058c 19
hardtail 0:d696cd1aea56 20 int main() {
hardtail 4:a6882e08058c 21 USB_ISP_bt.mode(PullUp);
hardtail 4:a6882e08058c 22 USB_ISP_bt.fall(&enter_USB_ISP);
hardtail 0:d696cd1aea56 23
Tiryoh 2:f94af4a543bd 24 myled = 0b0001;
hardtail 0:d696cd1aea56 25
hardtail 0:d696cd1aea56 26 while(1){
hardtail 0:d696cd1aea56 27 if(myled < 0b1000){
Tiryoh 2:f94af4a543bd 28 wait(0.5);
hardtail 0:d696cd1aea56 29 myled = myled << 1;
hardtail 0:d696cd1aea56 30 }else{
Tiryoh 2:f94af4a543bd 31 while(myled != 0b0001) {
Tiryoh 2:f94af4a543bd 32 wait(0.5);
Tiryoh 2:f94af4a543bd 33 myled = myled >> 1;
Tiryoh 2:f94af4a543bd 34 }
hardtail 0:d696cd1aea56 35 }
hardtail 3:618130d2d43e 36 pc.printf("hello world \r\n");
hardtail 0:d696cd1aea56 37 }
Tiryoh 2:f94af4a543bd 38 }