This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bin = 'build\\tdd.bin' | |
disk = 'F:\\' | |
copy(bin, disk) | |
sleep(1.5) | |
serial = Serial('COM8', timeout = 1) | |
serial.flushInput() | |
serial.flushOutput() | |
serial.sendBreak() | |
while True: | |
c = serial.readline() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
#include <assert.h> | |
int main(void) | |
{ | |
assert(sizeof(short)==2); | |
unsigned short us = 0; | |
short ss = SHRT_MIN; // -32768 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
#include <assert.h> | |
int main(void) | |
{ | |
assert(sizeof(short)==2); | |
short ss = SHRT_MIN; | |
int si = ss; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
#include <assert.h> | |
#define MAGIC_NUMBER 0xFFFF7F8F | |
int main(void) | |
{ | |
assert(sizeof(short)==2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
#include <assert.h> | |
int main(void) | |
{ | |
assert(sizeof(short)==2); | |
unsigned short us = 0x8080; | |
short ss = us; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
#include <assert.h> | |
int main(void) | |
{ | |
assert(sizeof(unsigned char)==1); | |
unsigned char uc1 = 0xff; | |
unsigned char uc2 = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
#include <assert.h> | |
int main(void) | |
{ | |
assert(sizeof(unsigned char)==1); | |
unsigned char uc1 = 0xff; | |
unsigned char uc2 = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <limits.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
assert(sizeof(int)==4); | |
int intMin = INT_MIN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
unsigned int ui = 16; | |
printf("%u * 16 = %u\n", ui, ui*16); | |
printf("%u << 4 = %u\n", ui, ui << 4); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include "timer.h" | |
volatile uint32_t* const portd_moder = (uint32_t*) 0x40020C00; | |
volatile uint32_t* const portd_odr = (uint32_t*) 0x40020C14; | |
volatile uint32_t* const rcc_ahb1enr = (uint32_t*) 0x40023830; | |
extern void sleep(uint32_t ms); // use systick to busy-wait |
OlderNewer