multiplayer pong game for LPC 1768
Dependencies: mbed MbedJSONValue mbed-rtos Adafruit_ST7735 Adafruit_GFX EthernetInterface DebouncedInterrupt
network.cpp@15:9d90f68e53da, 2020-11-12 (annotated)
- Committer:
- vsoltan
- Date:
- Thu Nov 12 05:51:00 2020 +0000
- Revision:
- 15:9d90f68e53da
- Parent:
- 13:95d44f7855ca
- Child:
- 17:32ae1f106002
added game state object
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vsoltan | 11:d0a105f6743f | 1 | #include "network.h" |
vsoltan | 11:d0a105f6743f | 2 | |
vsoltan | 11:d0a105f6743f | 3 | void initEthernet(EthernetInterface *eth, UDPSocket *sock, Endpoint *nist) { |
vsoltan | 11:d0a105f6743f | 4 | eth->init(); //Use DHCP |
vsoltan | 11:d0a105f6743f | 5 | eth->connect(); |
vsoltan | 11:d0a105f6743f | 6 | sock->init(); |
vsoltan | 11:d0a105f6743f | 7 | nist->set_address(AWS_IP, PORT); |
denizguler | 13:95d44f7855ca | 8 | sock->set_blocking(false, 0); |
vsoltan | 15:9d90f68e53da | 9 | printf("Connected to %s, port: %i\n\r", AWS_IP, PORT); |
vsoltan | 11:d0a105f6743f | 10 | } |
vsoltan | 11:d0a105f6743f | 11 | |
vsoltan | 11:d0a105f6743f | 12 | void cleanupEthernet(EthernetInterface *eth, UDPSocket *sock) { |
vsoltan | 11:d0a105f6743f | 13 | sock->close(); |
vsoltan | 11:d0a105f6743f | 14 | eth->disconnect(); |
vsoltan | 11:d0a105f6743f | 15 | } |