blob: 4cd54de924de05bfbb604ba495a1a241c581139f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include <stdint.h>
#include <stdio.h>
#include "ch573/gpio.h"
#include "ch573/pwr.h"
#include "ch573/uart.h"
#define GPIO_PORT_A ch573_gpio__gpio_port_a
#define GPIO_PORT CH573_GPIO__GPIO_PORT_T_INTF
#define UART1 ch573_uart__uart1
#define UART CH573_UART__UART_T_INTF
#define PWR1 ch573_pwr__pwr_mgmt
#define PWR CH573_PWR__PWR_MGMT_T_INTF
uint32_t collatz(uint32_t n)
{
uint32_t c = 0;
while (n > 1) {
if (n % 2 == 0) {
n /= 2;
} else {
n = n * 3 + 1;
}
c++;
}
return c;
}
/*
* Main routine. This is called on_reset once everything else has been set up.
*/
int main(void)
{
GPIO_PORT.dir.set(GPIO_PORT_A, DIR_OUT, 8);
GPIO_PORT.pd_drv.set(GPIO_PORT_A, 0, 8);
printf("Hello, %s!\n", "World");
for (;;);
return 0;
}
|